home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / biology / gsrc208a.zip / EDOUNITS.C < prev    next >
C/C++ Source or Header  |  1992-12-05  |  3KB  |  91 lines

  1. #include "copyleft.h"
  2.  
  3. /*
  4.     GEPASI - a simulator of metabolic pathways and other dynamical systems
  5.     Copyright (C) 1989, 1992  Pedro Mendes
  6. */
  7.  
  8. /*************************************/
  9. /*                                   */
  10. /*         GWSIM - Simulation        */
  11. /*        MS-WINDOWS front end       */
  12. /*                                   */
  13. /*               Units               */
  14. /*            dialog box             */
  15. /*                                   */
  16. /*           QuickC/WIN 1.0          */
  17. /*                                   */
  18. /*   (include here compilers that    */
  19. /*   compiled GWSIM successfully)    */
  20. /*                                   */
  21. /*************************************/
  22.  
  23.  
  24. #include <windows.h>
  25. #include <string.h>
  26. #include <stdio.h>
  27. #include "defines.h"                    /* symbols also used in .DLG files        */
  28. #include "globals.h"                    /* gepasi's own symbols                    */
  29. #include "gwsim.h"                        /* macros, function prototypes, etc.    */
  30. #include "gep2.h"                        /* gepasi's variables                    */
  31. #include "simgvar.h"                    /* global variables                        */
  32.  
  33. #pragma alloc_text( CODE9, EdOUnits )
  34.  
  35. BOOL FAR PASCAL EdOUnits(HWND hDlg, WORD message, WORD wParam, LONG lParam)
  36. {
  37.  static    HWND    hTime, hConc, hFlux, hStat;
  38.  char buff[65], buff1[32], buff2[32];
  39.  
  40.  switch( message )
  41.  {
  42.   case WM_INITDIALOG:
  43.    /* get handles to controls                                        */
  44.    hTime = GetDlgItem( hDlg, IDE_M0 );
  45.    hConc = GetDlgItem( hDlg, IDE_M1 );
  46.    hFlux = GetDlgItem( hDlg, IDE_M2 );
  47.    hStat = GetDlgItem( hDlg, IDSTAT_3 );
  48.  
  49.    /* fill in the current set of options                            */
  50.    SendMessage( hTime, WM_SETTEXT, 0, (DWORD)(LPSTR) options.timeu );
  51.    SendMessage( hConc, WM_SETTEXT, 0, (DWORD)(LPSTR) options.concu );
  52.    return TRUE;
  53.  
  54.   case WM_COMMAND:
  55.    switch( wParam )
  56.    {
  57.     case IDE_M0:
  58.     case IDE_M1:
  59.      SendMessage( hConc, WM_GETTEXT, (WORD) sizeof( buff1 ), (DWORD)(LPSTR) buff1 );
  60.      SendMessage( hTime, WM_GETTEXT, (WORD) sizeof( buff2 ), (DWORD)(LPSTR) buff2 );
  61.      if( strchr( buff1, '/' )==NULL )
  62.       wsprintf( (LPSTR) buff, "%s/%s", (LPSTR) buff1, (LPSTR) buff2 );
  63.      else
  64.       wsprintf( (LPSTR) buff, "%s.%s", (LPSTR) buff1, (LPSTR) buff2 );
  65.      SendMessage( hFlux, WM_SETTEXT, 0, (DWORD)(LPSTR) buff );
  66.      EnableWindow( hStat, FALSE );
  67.      EnableWindow( hFlux, FALSE );
  68.      InvalidateRect( hDlg, NULL, FALSE );
  69.      return TRUE;
  70.  
  71.     case IDOK:
  72.      /* read all variables from the controls        */
  73.      SendMessage( hTime, WM_GETTEXT, (WORD) sizeof( options.timeu ), (DWORD)(LPSTR) options.timeu );
  74.      SendMessage( hConc, WM_GETTEXT, (WORD) sizeof( options.concu ), (DWORD)(LPSTR) options.concu );
  75.  
  76.      /* signal that changes were made                */
  77.      notsaved = 1;
  78.  
  79.      /* close the dialog box and return                */
  80.      EndDialog( hDlg, IDOK );
  81.      return TRUE;
  82.  
  83.     case IDCANCEL:
  84.      /* close the dialog box and return            */
  85.      EndDialog( hDlg, IDCANCEL );
  86.      return TRUE;
  87.    }
  88.  
  89.   default: return FALSE;
  90.  }
  91. }