home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / biz / misc / banker / src / menu.c < prev    next >
C/C++ Source or Header  |  1993-09-02  |  2KB  |  70 lines

  1. /*
  2.  * menu.c
  3.  */
  4.  
  5. /* $Id: menu.c,v 1.3 1993/09/03 00:17:28 beust Exp beust $ */
  6.  
  7. #include "common.h"
  8.  
  9. void
  10. addToNewMenu(struct NewMenu *nm, Gui_t gui,
  11.          UBYTE type, STRPTR label, STRPTR shortCut,
  12.          int id, APTR callback, int n)
  13. {
  14.    nm[n].nm_Type = type;
  15.    nm[n].nm_Label = label;
  16.    nm[n].nm_CommKey = shortCut;
  17.    nm[n].nm_Flags = 0;
  18.    nm[n].nm_MutualExclude = 0;
  19.    nm[n].nm_UserData = (void *) id;
  20.    gui -> menuFunctions[n] = callback;
  21. }
  22.  
  23. MENU_CALLBACK(menuOpen)
  24. {
  25.    if (FileModified) {
  26.       if (showRequester(gui, getString(MSG_TITLE_FILE_MODIFIED),
  27.                  getString(MSG_BODY_FILE_MODIFIED),
  28.                  getString(MSG_YES_OR_NO)) == 0) return;
  29.    }
  30.    openFile(gui, entries, NULL);
  31.    set(gui -> mainWindowObject, MUIA_Window_Title, FileName);
  32. }
  33.  
  34. MENU_CALLBACK(menuSave)
  35. {
  36.    if (STREQUAL(FileName, getString(MSG_NO_FILE_LOADED)))
  37.       getFileName(gui, FileName, getString(MSG_MENU_FILE_SAVE_AS), FileName, Pattern);
  38.  
  39.    saveFile(entries, FileName);
  40.    FileModified = 0;
  41. }
  42.  
  43. MENU_CALLBACK(menuSaveAs)
  44. {
  45.    getFileName(gui, FileName, getString(MSG_MENU_FILE_SAVE_AS), FileName, Pattern);
  46.    menuSave(gui, entries);
  47.    FileModified = 0;
  48. }
  49.  
  50. MENU_CALLBACK(menuPrint)
  51. {
  52.    getFileName(gui, PrintFileName, getString(MSG_MENU_FILE_PRINT),
  53.                PrintFileName, PrintPattern);
  54.  
  55.    writeTextFile(entries, PrintFileName, & PrintFormatStructure);
  56. }
  57.  
  58. MENU_CALLBACK(menuExport)
  59. {
  60.    getFileName(gui, ExportFileName, getString(MSG_MENU_FILE_EXPORT),
  61.                ExportFileName, ExportPattern);
  62.  
  63.    writeTextFile(entries, ExportFileName, & ExportFormatStructure);
  64. }
  65.  
  66. MENU_CALLBACK(menuSavePrefs)
  67. {
  68.    writeOptionsFile(gui);
  69. }
  70.