home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / educatio / xcoral16.zip / CB_NAMES.C < prev    next >
C/C++ Source or Header  |  1993-01-15  |  4KB  |  199 lines

  1. /*
  2. ** Copyright 1989, 1992 by Lionel Fournigault
  3. **
  4. ** Permission to use, copy, and distribute for non-commercial purposes,
  5. ** is hereby granted without fee, providing that the above copyright
  6. ** notice appear in all copies and that both the copyright notice and this
  7. ** permission notice appear in supporting documentation.
  8. ** The software may be modified for your own purposes, but modified versions
  9. ** may not be distributed.
  10. ** This software is provided "as is" without any expressed or implied warranty.
  11. **
  12. **
  13. */
  14.  
  15. #include <stdio.h>
  16. #include <X11/Xlib.h>
  17. #include <X11/Xutil.h>
  18.  
  19. #include "options.h"
  20. #include "xcoral.h"
  21. #include "browser.h"
  22. #include "flist.h"
  23.  
  24. char *menu_names[] = { 
  25.     "File", "Window", "Modes", "Search", "Region", "Font", "Misc", NULL
  26. };
  27.  
  28. static char *file_menu [] = {
  29.     "Read File       ^x^f",
  30.     "Insert File     ^x i",
  31.     "Save File       ^x^s",
  32.     "Write File as   ^x^w",
  33.     "Quit            ^x^c",
  34.     NULL
  35. };
  36.             
  37. static char *window_menu [] = {
  38.     "New Text Window     ^x 2",
  39.     "Delete Text Window  ^x^c",
  40.     "Display Kill Buffer",
  41.     "Display Open Files  ^x b",
  42.     "Display Browser",
  43.     "Unmap Browser",
  44.     NULL
  45. };
  46.  
  47. static char *mode_menu [] = {
  48.     "Default text",
  49.     "C",
  50.     "C ++",
  51.     NULL 
  52. };
  53.             
  54. static char *search_menu [] = { 
  55.     "Forward Search        ^s",
  56.     "Backward Search       ^r",
  57.     "Query Replace      Esc q",
  58.     "Global Replace     Esc r",
  59.     "Goto Line Number    ^x l",
  60.     NULL
  61. };
  62.  
  63. static char *mark_menu [] = {
  64.     "Set Mark              ^space",
  65.     "Exchange point mark     ^x^x",
  66.     "Kill Region               ^w",
  67.     "Copy Region            Esc w",
  68.     "Paste Region              ^y",
  69.     NULL
  70. };
  71.  
  72. static char *font_menu [] = { 
  73.     "Courier 10",
  74.     "Courier 12",
  75.     "Courier bold 14",
  76.     "Courier 20",
  77.     "Helvetica 14",
  78.     "Helvetica 20",
  79.     "Times bold 14",
  80.     "Times 18",
  81.     "Schoolbook 18",
  82.     NULL 
  83. };
  84.  
  85. static char *font_names [] = {
  86.        "-adobe-courier-medium-r-normal--10-100-75-75-m-60-iso8859-1",
  87.        "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1",
  88.        "-adobe-courier-bold-r-normal--14-140-75-75-m-90-iso8859-1",
  89.        "-adobe-courier-medium-r-normal--20-140-100-100-m-110-iso8859-1",
  90.        "-adobe-helvetica-medium-r-normal--14-100-100-100-p-76-iso8859-1",
  91.        "-adobe-helvetica-medium-r-normal--20-140-100-100-p-100-iso8859-1",
  92.        "-adobe-times-bold-r-normal--14-140-75-75-p-77-iso8859-1",
  93.        "-adobe-times-medium-r-normal--18-180-75-75-p-94-iso8859-1",
  94.        "-adobe-new century schoolbook-medium-r-normal--18-180-75-75-p-103-iso8859-1",
  95.        NULL
  96. };
  97.  
  98. static char *misc_menu [] = {
  99.     "New C++ Class",
  100.     "New C++ Method",
  101.     "New C Function",
  102.     "Version", 
  103.     "help", 
  104.     NULL
  105. };
  106.  
  107. char **item_names [] = {
  108.     file_menu, window_menu, mode_menu, search_menu, mark_menu, font_menu, misc_menu, 0
  109. };
  110.  
  111. static void (*f_file []) () = {
  112.     MenuReadFile,
  113.     MenuInsertFile,
  114.     MenuSaveFile,
  115.     MenuWriteFile,
  116.     (void (*)()) DeleteWindow, 
  117.     NULL
  118. };
  119.  
  120. static void (*f_window []) () = { 
  121.     NewWindow,
  122.     (void (*)()) DeleteWindow,
  123.     DisplayKillBuffer,
  124.     DisplayOpenFiles,
  125.     DisplayBrowser,
  126.     UnmapBrowser,
  127.     NULL
  128. };
  129.  
  130. static void (*f_mode []) () = {
  131.     SetDefaultMode,
  132.     SetCMode,
  133.     SetCCMode,
  134.     NULL
  135. };
  136.  
  137. static  void (*f_search []) () = { 
  138.     MenuForwardSearch,
  139.     MenuBackwardSearch,
  140.     MenuQueryReplace,
  141.     MenuGlobalReplace,
  142.     MenuGotoLine,
  143.     NULL
  144. };
  145.  
  146. static void (*f_mark []) () = {
  147.     SetMark,
  148.     ExchangePointMark,
  149.     KillRegion,
  150.     CopyRegion,
  151.     PasteRegion,
  152.     NULL
  153. };
  154.  
  155. static void (*f_font []) () = { 
  156.     NULL
  157. };
  158.  
  159. static void (*f_misc []) () = {
  160.     MakeClass,
  161.     MakeMethod,
  162.     MakeFunction,
  163.     Version,
  164.     Help,
  165.     NULL
  166. };
  167.  
  168. void (**func_names []) () = {
  169.     f_file, f_window, f_mode, f_search, f_mark, f_font, f_misc, 0
  170. };
  171.  
  172. #define M_FONTS 5
  173.  
  174. /*
  175. **    Function name : ExecMenuFunc
  176. **
  177. **    Description : Les fonctions utilisables a partir dee menus.
  178. **    Input : 
  179. **    Ouput :
  180. */
  181. void ExecMenuFunc ( vm, item )
  182.     register vm, item;
  183. {
  184.     extern void exit ();
  185.  
  186.     if ( vm == -1 ) return;
  187.  
  188.     if ( vm ==  M_FONTS ) {
  189.         ChangeTextFont ( dpy, edwin -> text, font_names [item] );
  190.         return;
  191.     }
  192.     ((func_names [vm]) [item]) ( edwin -> text );
  193.     if ( IsLastWindow ( 0 ) == True ) {
  194.         XCloseDisplay ( dpy );
  195.         (void) exit (0);
  196.     }
  197. }
  198.  
  199.