home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / biology / gsrc208a.zip / EDNAME.C < prev    next >
C/C++ Source or Header  |  1992-12-06  |  3KB  |  93 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. /*          GWTOP - Topology         */
  11. /*        MS-WINDOWS front end       */
  12. /*                                   */
  13. /*          Title dialog box         */
  14. /*                                   */
  15. /*           QuickC/WIN 1.0          */
  16. /*                                   */
  17. /*   (include here compilers that    */
  18. /*   compiled GWSIM successfully)    */
  19. /*                                   */
  20. /*************************************/
  21.  
  22.  
  23. #include <windows.h>
  24. #include <stdio.h>
  25. #include <string.h>
  26. #include "defines.h"                    /* symbols also used in .DLG files        */
  27. #include "globals.h"                    /* gepasi's own symbols                    */
  28. #include "gwtop.h"                        /* macros, function prototypes, etc.    */
  29. #include "gep1.h"                        /* gepasi's variables                    */
  30. #include "topgvar.h"                    /* global variables                        */
  31.  
  32. #pragma alloc_text( CODE6, EdName )
  33.  
  34. BOOL FAR PASCAL EdName( HWND hDlg, WORD message, WORD wParam, LONG lParam )
  35. {
  36.  static    HWND    hEdit;
  37.  char buff[256];
  38.  
  39.  switch( message )
  40.  {
  41.   case WM_INITDIALOG:
  42.    /* show the image on the mirror.                                    */
  43.    _fmemcpy( (void __far *) buff,
  44.                 (void __far *) topname,
  45.              (size_t) sizeof( topname ) );
  46.  
  47.    /* get the handle to the edit control                            */
  48.    hEdit = GetDlgItem( hDlg, IDE_M0 );
  49.  
  50.    /* Limit the length of the tile to 255 characters                */
  51.    SendMessage( hEdit, EM_LIMITTEXT, (WORD) 255, 0 );
  52.  
  53.    /* if the title is not empty put it in the edit box and select it*/
  54.    if( buff[0] )
  55.    {
  56.     SendMessage( hEdit, WM_SETTEXT, 0, (DWORD) (LPSTR) buff );
  57.     SendMessage( hEdit, EM_SETSEL, 0, MAKELONG( 0, 32767 ) );
  58.    }
  59.  
  60.    /* set the focus on the edit control                                */
  61.    SetFocus( hEdit );
  62.  
  63.    return TRUE;
  64.  
  65.   case WM_COMMAND:
  66.    switch( wParam )
  67.    {
  68.     case IDC_HELP:                        /* Help for this Dialog Box             */
  69.         WinHelp( hDlg, (LPSTR) szHelpFile, HELP_KEY, (DWORD) (LPSTR) "Title editor" );
  70.      SetFocus( hEdit );
  71.      return TRUE;
  72.  
  73.     case IDOK:
  74.      SendMessage( hEdit, WM_GETTEXT, (WORD) 256, (DWORD) (LPSTR) buff );
  75.  
  76.      /* copy the altered image to the original    */
  77.      _fmemcpy( (void __far *) topname,
  78.                   (void __far *) buff,
  79.                (size_t) sizeof( topname ) );
  80.      notsaved = 1;
  81.      /* close the dialog box and return            */
  82.      EndDialog( hDlg, IDOK );
  83.      return TRUE;
  84.  
  85.     case IDCANCEL:
  86.      /* close the dialog box and return            */
  87.      EndDialog( hDlg, IDCANCEL );
  88.      return TRUE;
  89.    }
  90.  
  91.   default: return FALSE;
  92.  }
  93. }