Diff for /np2/x11/gtk2/gtk_menu.c between versions 1.3 and 1.12

version 1.3, 2004/08/14 03:17:53 version 1.12, 2008/03/13 16:27:39
Line 12 Line 12
  * 2. Redistributions in binary form must reproduce the above copyright   * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the   *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.   *    documentation and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products  
  *    derived from this software without specific prior written permission.  
  *   *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES   * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
Line 46 Line 44
 #include "pc9861k.h"  #include "pc9861k.h"
 #include "s98.h"  #include "s98.h"
 #include "scrnbmp.h"  #include "scrnbmp.h"
   #include "sxsi.h"
   
 #include "kdispwin.h"  #include "kdispwin.h"
 #include "toolwin.h"  #include "toolwin.h"
Line 80  static void cb_reset(GtkAction *action,  Line 79  static void cb_reset(GtkAction *action, 
 static void cb_sasiopen(GtkAction *action, gpointer user_data);  static void cb_sasiopen(GtkAction *action, gpointer user_data);
 static void cb_sasiremove(GtkAction *action, gpointer user_data);  static void cb_sasiremove(GtkAction *action, gpointer user_data);
 #endif  #endif
   #if defined(SUPPORT_STATSAVE)
   static void cb_statsave(GtkAction *action, gpointer user_data);
   static void cb_statload(GtkAction *action, gpointer user_data);
   #endif
   
 static void cb_dialog(GtkAction *action, gpointer user_data);  static void cb_dialog(GtkAction *action, gpointer user_data);
 static void cb_radio(GtkRadioAction *action, GtkRadioAction *current, gpointer user_data);  static void cb_radio(GtkRadioAction *action, GtkRadioAction *current, gpointer user_data);
Line 92  static GtkActionEntry menu_entries[] = { Line 95  static GtkActionEntry menu_entries[] = {
 { "ScreenMenu",   NULL, "Screen",   NULL, NULL, NULL },  { "ScreenMenu",   NULL, "Screen",   NULL, NULL, NULL },
 { "DeviceMenu",   NULL, "Device",   NULL, NULL, NULL },  { "DeviceMenu",   NULL, "Device",   NULL, NULL, NULL },
 { "OtherMenu",    NULL, "Other",    NULL, NULL, NULL },  { "OtherMenu",    NULL, "Other",    NULL, NULL, NULL },
   { "StatMenu",     NULL, "Stat",     NULL, NULL, NULL },
   
 /* Submenu */  /* Submenu */
 { "Drive1Menu",   NULL, "Drive_1",   NULL, NULL, NULL },  { "Drive1Menu",   NULL, "Drive_1",   NULL, NULL, NULL },
Line 109  static GtkActionEntry menu_entries[] = { Line 113  static GtkActionEntry menu_entries[] = {
 { "SASI1Menu",    NULL, "SASI-_1",   NULL, NULL, NULL },  { "SASI1Menu",    NULL, "SASI-_1",   NULL, NULL, NULL },
 { "SASI2Menu",    NULL, "SASI-_2",   NULL, NULL, NULL },  { "SASI2Menu",    NULL, "SASI-_2",   NULL, NULL, NULL },
 #endif  #endif
   { "ScrnSizeMenu", NULL, "Size",      NULL, NULL, NULL },
 { "SoundMenu",    NULL, "_Sound",    NULL, NULL, NULL },  { "SoundMenu",    NULL, "_Sound",    NULL, NULL, NULL },
   
 /* MenuItem */  /* MenuItem */
Line 147  static GtkActionEntry menu_entries[] = { Line 152  static GtkActionEntry menu_entries[] = {
 { "serialopt",   NULL, "Se_rial option...", NULL, NULL, G_CALLBACK(cb_dialog) },  { "serialopt",   NULL, "Se_rial option...", NULL, NULL, G_CALLBACK(cb_dialog) },
 { "soundopt",    NULL, "So_und option...",  NULL, NULL, G_CALLBACK(cb_dialog) },  { "soundopt",    NULL, "So_und option...",  NULL, NULL, G_CALLBACK(cb_dialog) },
 { "reset",       NULL, "_Reset",            NULL, NULL, G_CALLBACK(cb_reset) },  { "reset",       NULL, "_Reset",            NULL, NULL, G_CALLBACK(cb_reset) },
   #if defined(SUPPORT_STATSAVE)
   { "stat00save",  NULL, "Save 0",            NULL, NULL, G_CALLBACK(cb_statsave), },
   { "stat01save",  NULL, "Save 1",            NULL, NULL, G_CALLBACK(cb_statsave), },
   { "stat02save",  NULL, "Save 2",            NULL, NULL, G_CALLBACK(cb_statsave), },
   { "stat03save",  NULL, "Save 3",            NULL, NULL, G_CALLBACK(cb_statsave), },
   { "stat04save",  NULL, "Save 4",            NULL, NULL, G_CALLBACK(cb_statsave), },
   { "stat05save",  NULL, "Save 5",            NULL, NULL, G_CALLBACK(cb_statsave), },
   { "stat06save",  NULL, "Save 6",            NULL, NULL, G_CALLBACK(cb_statsave), },
   { "stat07save",  NULL, "Save 7",            NULL, NULL, G_CALLBACK(cb_statsave), },
   { "stat08save",  NULL, "Save 8",            NULL, NULL, G_CALLBACK(cb_statsave), },
   { "stat09save",  NULL, "Save 9",            NULL, NULL, G_CALLBACK(cb_statsave), },
   { "stat00load",  NULL, "Load 0",            NULL, NULL, G_CALLBACK(cb_statload), },
   { "stat01load",  NULL, "Load 1",            NULL, NULL, G_CALLBACK(cb_statload), },
   { "stat02load",  NULL, "Load 2",            NULL, NULL, G_CALLBACK(cb_statload), },
   { "stat03load",  NULL, "Load 3",            NULL, NULL, G_CALLBACK(cb_statload), },
   { "stat04load",  NULL, "Load 4",            NULL, NULL, G_CALLBACK(cb_statload), },
   { "stat05load",  NULL, "Load 5",            NULL, NULL, G_CALLBACK(cb_statload), },
   { "stat06load",  NULL, "Load 6",            NULL, NULL, G_CALLBACK(cb_statload), },
   { "stat07load",  NULL, "Load 7",            NULL, NULL, G_CALLBACK(cb_statload), },
   { "stat08load",  NULL, "Load 8",            NULL, NULL, G_CALLBACK(cb_statload), },
   { "stat09load",  NULL, "Load 9",            NULL, NULL, G_CALLBACK(cb_statload), },
   #endif
 };  };
 static const guint n_menu_entries = G_N_ELEMENTS(menu_entries);  static const guint n_menu_entries = G_N_ELEMENTS(menu_entries);
   
Line 264  static GtkRadioActionEntry rotate_entrie Line 291  static GtkRadioActionEntry rotate_entrie
 };  };
 static const guint n_rotate_entries = G_N_ELEMENTS(rotate_entries);  static const guint n_rotate_entries = G_N_ELEMENTS(rotate_entries);
   
   static GtkRadioActionEntry screensize_entries[] = {
   { "320x200",  NULL, "320x200",  NULL, NULL, 4 },
   { "480x300",  NULL, "480x300",  NULL, NULL, 6 },
   { "640x400",  NULL, "640x400",  NULL, NULL, 8 },
   { "800x500",  NULL, "800x500",  NULL, NULL, 10 },
   { "960x600",  NULL, "960x600",  NULL, NULL, 12 },
   { "1280x800", NULL, "1280x800", NULL, NULL, 16 },
   };
   static const guint n_screensize_entries = G_N_ELEMENTS(screensize_entries);
   
 static void cb_beepvol(gint idx);  static void cb_beepvol(gint idx);
 static void cb_f12key(gint idx);  static void cb_f12key(gint idx);
 static void cb_framerate(gint idx);  static void cb_framerate(gint idx);
Line 271  static void cb_joykey(gint idx); Line 308  static void cb_joykey(gint idx);
 static void cb_memory(gint idx);  static void cb_memory(gint idx);
 static void cb_rotate(gint idx);  static void cb_rotate(gint idx);
 static void cb_screenmode(gint idx);  static void cb_screenmode(gint idx);
   static void cb_screensize(gint idx);
 static void cb_soundboard(gint idx);  static void cb_soundboard(gint idx);
   
 static const struct {  static const struct {
Line 285  static const struct { Line 323  static const struct {
         { memory_entries, G_N_ELEMENTS(memory_entries), cb_memory },          { memory_entries, G_N_ELEMENTS(memory_entries), cb_memory },
         { rotate_entries, G_N_ELEMENTS(rotate_entries), cb_rotate },          { rotate_entries, G_N_ELEMENTS(rotate_entries), cb_rotate },
         { screenmode_entries, G_N_ELEMENTS(screenmode_entries), cb_screenmode },          { screenmode_entries, G_N_ELEMENTS(screenmode_entries), cb_screenmode },
           { screensize_entries, G_N_ELEMENTS(screensize_entries), cb_screensize },
         { soundboard_entries, G_N_ELEMENTS(soundboard_entries), cb_soundboard },          { soundboard_entries, G_N_ELEMENTS(soundboard_entries), cb_soundboard },
 };  };
 static const guint n_radiomenu_entries = G_N_ELEMENTS(radiomenu_entries);  static const guint n_radiomenu_entries = G_N_ELEMENTS(radiomenu_entries);
Line 299  static const gchar *ui_info = Line 338  static const gchar *ui_info =
 "   <menuitem action='configure'/>\n"  "   <menuitem action='configure'/>\n"
 "   <menuitem action='newdisk'/>\n"  "   <menuitem action='newdisk'/>\n"
 "   <menuitem action='font'/>\n"  "   <menuitem action='font'/>\n"
 "   <menuitem action='configure'/>\n"  
 "   <separator/>\n"  "   <separator/>\n"
 "   <menuitem action='exit'/>\n"  "   <menuitem action='exit'/>\n"
 "  </menu>\n"  "  </menu>\n"
Line 341  static const gchar *ui_info = Line 379  static const gchar *ui_info =
 "   <menuitem action='dispvsync'/>\n"  "   <menuitem action='dispvsync'/>\n"
 "   <menuitem action='realpalettes'/>\n"  "   <menuitem action='realpalettes'/>\n"
 "   <menuitem action='nowait'/>\n"  "   <menuitem action='nowait'/>\n"
 "   <menuitem name='framerate' action='autoframe'/>\n"  "   <menuitem action='autoframe'/>\n"
 "   <menuitem action='fullframe'/>\n"  "   <menuitem action='fullframe'/>\n"
 "   <menuitem action='1/2 frame'/>\n"  "   <menuitem action='1/2 frame'/>\n"
 "   <menuitem action='1/3 frame'/>\n"  "   <menuitem action='1/3 frame'/>\n"
 "   <menuitem action='1/4 frame'/>\n"  "   <menuitem action='1/4 frame'/>\n"
   #if defined(SUPPORT_SCREENSIZE)
   "   <separator/>\n"
   "   <menu name='Size' action='ScrnSizeMenu'>\n"
   "    <menuitem action='320x200'/>\n"
   "    <menuitem action='480x300'/>\n"
   "    <menuitem action='640x400'/>\n"
   "    <menuitem action='800x500'/>\n"
   "    <menuitem action='960x600'/>\n"
   "    <menuitem action='1280x800'/>\n"
   "   </menu>\n"
   #endif
 "   <separator/>\n"  "   <separator/>\n"
 "   <menuitem action='screenopt'/>\n"  "   <menuitem action='screenopt'/>\n"
 "  </menu>\n"  "  </menu>\n"
Line 419  static const gchar *ui_info = Line 468  static const gchar *ui_info =
 "   <separator/>\n"  "   <separator/>\n"
 "   <menuitem action='about'/>\n"  "   <menuitem action='about'/>\n"
 "  </menu>\n"  "  </menu>\n"
   #if defined(SUPPORT_STATSAVE)
   "  <menu name='Stat' action='StatMenu'>\n"
   "   <menuitem action='stat00save'/>\n"
   "   <menuitem action='stat01save'/>\n"
   "   <menuitem action='stat02save'/>\n"
   "   <menuitem action='stat03save'/>\n"
   "   <menuitem action='stat04save'/>\n"
   "   <menuitem action='stat05save'/>\n"
   "   <menuitem action='stat06save'/>\n"
   "   <menuitem action='stat07save'/>\n"
   "   <menuitem action='stat08save'/>\n"
   "   <menuitem action='stat09save'/>\n"
   "   <separator/>\n"
   "   <menuitem action='stat00load'/>\n"
   "   <menuitem action='stat01load'/>\n"
   "   <menuitem action='stat02load'/>\n"
   "   <menuitem action='stat03load'/>\n"
   "   <menuitem action='stat04load'/>\n"
   "   <menuitem action='stat05load'/>\n"
   "   <menuitem action='stat06load'/>\n"
   "   <menuitem action='stat07load'/>\n"
   "   <menuitem action='stat08load'/>\n"
   "   <menuitem action='stat09load'/>\n"
   "  </menu>\n"
   #endif
 " </menubar>\n"  " </menubar>\n"
 "</ui>\n";  "</ui>\n";
   
Line 487  xmenu_select_item_by_index(MENU_HDL hdl, Line 561  xmenu_select_item_by_index(MENU_HDL hdl,
         xmenu_select_item_by_index(NULL, rotate_entries, n_rotate_entries, v);          xmenu_select_item_by_index(NULL, rotate_entries, n_rotate_entries, v);
 #define xmenu_select_screenmode(v) \  #define xmenu_select_screenmode(v) \
         xmenu_select_item_by_index(NULL, screenmode_entries, n_screenmode_entries, v);          xmenu_select_item_by_index(NULL, screenmode_entries, n_screenmode_entries, v);
   #define xmenu_select_screensize(v) \
           xmenu_select_item_by_index(NULL, screensize_entries, n_screensize_entries, v);
 #define xmenu_select_soundboard(v) \  #define xmenu_select_soundboard(v) \
         xmenu_select_item_by_index(NULL, soundboard_entries, n_soundboard_entries, v);          xmenu_select_item_by_index(NULL, soundboard_entries, n_soundboard_entries, v);
   
Line 525  cb_bmpsave(GtkAction *action, gpointer u Line 601  cb_bmpsave(GtkAction *action, gpointer u
   
         g_object_set(G_OBJECT(dialog), "show-hidden", TRUE, NULL);          g_object_set(G_OBJECT(dialog), "show-hidden", TRUE, NULL);
         gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);          gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
           if (strlen(bmpfilefolder) == 0) {
                   g_strlcpy(bmpfilefolder, modulefile, sizeof(bmpfilefolder));
                   file_cutname(bmpfilefolder);
           }
         utf8 = g_filename_to_utf8(bmpfilefolder, -1, NULL, NULL, NULL);          utf8 = g_filename_to_utf8(bmpfilefolder, -1, NULL, NULL, NULL);
         if (utf8) {          if (utf8) {
                 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), utf8);                  gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), utf8);
                 g_free(utf8);                  g_free(utf8);
         }          }
   
Line 812  cb_ataopen(GtkAction *action, gpointer u Line 892  cb_ataopen(GtkAction *action, gpointer u
         filter = gtk_file_filter_new();          filter = gtk_file_filter_new();
         if (filter) {          if (filter) {
                 gtk_file_filter_set_name(filter, "IDE disk image files");                  gtk_file_filter_set_name(filter, "IDE disk image files");
                   gtk_file_filter_add_pattern(filter, "*.[tT][hH][dD]");
                   gtk_file_filter_add_pattern(filter, "*.[hH][dD][iI]");
                 gtk_file_filter_add_pattern(filter, "*.[nN][hH][dD]");                  gtk_file_filter_add_pattern(filter, "*.[nN][hH][dD]");
                 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);                  gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
         }          }
Line 906  cb_atapiopen(GtkAction *action, gpointer Line 988  cb_atapiopen(GtkAction *action, gpointer
                 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);                  gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
         }          }
         gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);          gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
           filter = gtk_file_filter_new();
           if (filter) {
                   gtk_file_filter_set_name(filter, "CUE CD-ROM image files");
                   gtk_file_filter_add_pattern(filter, "*.[cC][uU][eE]");
                   gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
           }
   
         if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_OK)          if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_OK)
                 goto end;                  goto end;
Line 916  cb_atapiopen(GtkAction *action, gpointer Line 1004  cb_atapiopen(GtkAction *action, gpointer
                 if (path) {                  if (path) {
                         if ((stat(path, &sb) == 0) && S_ISREG(sb.st_mode) && (sb.st_mode & S_IRUSR)) {                          if ((stat(path, &sb) == 0) && S_ISREG(sb.st_mode) && (sb.st_mode & S_IRUSR)) {
                                 file_cpyname(hddfolder, path, sizeof(hddfolder));                                  file_cpyname(hddfolder, path, sizeof(hddfolder));
                                 diskdrv_setcdrom(DISKDRV_CDROM_ATAPI, path, FALSE);                                  sxsi_devopen(0x02, path);
                                 sysmng_update(SYS_UPDATEOSCFG);                                  sysmng_update(SYS_UPDATEOSCFG);
                         }                          }
                         g_free(path);                          g_free(path);
Line 937  cb_atapiremove(GtkAction *action, gpoint Line 1025  cb_atapiremove(GtkAction *action, gpoint
         UNUSED(action);          UNUSED(action);
         UNUSED(user_data);          UNUSED(user_data);
   
         diskdrv_setcdrom(DISKDRV_CDROM_ATAPI, "", FALSE);          sxsi_devclose(0x02);
 }  }
 #endif  /* SUPPORT_IDEIO */  #endif  /* SUPPORT_IDEIO */
   
Line 991  cb_newdisk(GtkAction *action, gpointer u Line 1079  cb_newdisk(GtkAction *action, gpointer u
   
         g_object_set(G_OBJECT(dialog), "show-hidden", TRUE, NULL);          g_object_set(G_OBJECT(dialog), "show-hidden", TRUE, NULL);
         gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);          gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
           if (strlen(fddfolder) == 0) {
                   g_strlcpy(fddfolder, modulefile, sizeof(fddfolder));
                   file_cutname(fddfolder);
           }
         utf8 = g_filename_to_utf8(fddfolder, -1, NULL, NULL, NULL);          utf8 = g_filename_to_utf8(fddfolder, -1, NULL, NULL, NULL);
         if (utf8) {          if (utf8) {
                 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), utf8);                  gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), utf8);
Line 1031  cb_newdisk(GtkAction *action, gpointer u Line 1123  cb_newdisk(GtkAction *action, gpointer u
         }          }
         gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter[0]);          gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter[0]);
   
         if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_OK) {          if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_OK)
                 gtk_widget_destroy(dialog);                  goto end;
                 install_idle_process();  
                 return;  
         }  
   
         utf8 = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));          utf8 = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
         if (utf8 == NULL)          if (utf8 == NULL)
Line 1059  cb_newdisk(GtkAction *action, gpointer u Line 1148  cb_newdisk(GtkAction *action, gpointer u
                 for (i = 0; i < NELEMENTS(filter); i++) {                  for (i = 0; i < NELEMENTS(filter); i++) {
                         if (f == filter[i]) {                          if (f == filter[i]) {
                                 kind = i;                                  kind = i;
                                 tmp = g_strjoin(".", path, extname[i]);                                  tmp = g_strjoin(".", path, extname[i], NULL);
                                 if (tmp) {                                  if (tmp) {
                                         g_free(path);                                          g_free(path);
                                         path = tmp;                                          path = tmp;
Line 1200  cb_sasiremove(GtkAction *action, gpointe Line 1289  cb_sasiremove(GtkAction *action, gpointe
 }  }
 #endif  /* !SUPPORT_IDEIO */  #endif  /* !SUPPORT_IDEIO */
   
   #if defined(SUPPORT_STATSAVE)
   static void
   cb_statsave(GtkAction *action, gpointer user_data)
   {
           const gchar *name = gtk_action_get_name(GTK_ACTION(action));
           char ext[4];
           guint n;
   
           UNUSED(user_data);
   
           /* name = "stat??save" */
           if ((strlen(name) >= 6)
            && (g_ascii_isdigit(name[4]))
            && (g_ascii_isdigit(name[5]))) {
                   n = g_ascii_digit_value(name[4]) * 10;
                   n += g_ascii_digit_value(name[5]);
                   g_snprintf(ext, sizeof(ext), np2flagext, n);
                   flagsave(ext);
           }
   }
   
   static void
   cb_statload(GtkAction *action, gpointer user_data)
   {
           const gchar *name = gtk_action_get_name(GTK_ACTION(action));
           char ext[4];
           guint n;
   
           UNUSED(user_data);
   
           /* name = "stat??load" */
           if ((strlen(name) >= 6)
            && (g_ascii_isdigit(name[4]))
            && (g_ascii_isdigit(name[5]))) {
                   n = g_ascii_digit_value(name[4]) * 10;
                   n += g_ascii_digit_value(name[5]);
                   g_snprintf(ext, sizeof(ext), np2flagext, n);
                   flagload(ext, "Status Load", TRUE);
           }
   }
   #endif
   
 static void  static void
 cb_dialog(GtkAction *action, gpointer user_data)  cb_dialog(GtkAction *action, gpointer user_data)
 {  {
Line 1644  cb_screenmode(gint idx) Line 1775  cb_screenmode(gint idx)
 }  }
   
 static void  static void
   cb_screensize(gint idx)
   {
           guint value;
   
           if (idx >= 0) {
                   value = screensize_entries[idx].value;
           } else {
                   value = 0;
           }
           scrnmng_setmultiple(value);
   }
   
   static void
 cb_soundboard(gint idx)  cb_soundboard(gint idx)
 {  {
         guint value;          guint value;
Line 1686  cb_radio(GtkRadioAction *action, GtkRadi Line 1830  cb_radio(GtkRadioAction *action, GtkRadi
 /*  /*
  * create menubar   * create menubar
  */   */
   static GtkWidget *menubar;
   static guint menubar_timerid;
   
   #define EVENT_MASK      (GDK_ENTER_NOTIFY_MASK|GDK_LEAVE_NOTIFY_MASK)
   
   static gboolean
   menubar_timeout(gpointer p)
   {
   
           UNUSED(p);
   
           if (menubar_timerid) {
                   g_source_remove(menubar_timerid);
                   menubar_timerid = 0;
           }
   
           if (scrnmode & SCRNMODE_FULLSCREEN) {
                   xmenu_hide();
           }
   
           return TRUE;
   }
   
   /*
    - Signal: gboolean GtkWidget::enter_notify_event (GtkWidget *widget,
             GdkEventCrossing *event, gpointer user_data)
   */
   static gboolean
   enter_notify_evhandler(GtkWidget *w, GdkEventCrossing *ev, gpointer p)
   {
   
           UNUSED(w);
           UNUSED(ev);
           UNUSED(p);
   
           if (menubar_timerid) {
                   g_source_remove(menubar_timerid);
                   menubar_timerid = 0;
           }
   
           return TRUE;
   }
   
   /*
    - Signal: gboolean GtkWidget::leave_notify_event (GtkWidget *widget,
             GdkEventCrossing *event, gpointer user_data)
   */
   static gboolean
   leave_notify_evhandler(GtkWidget *w, GdkEventCrossing *ev, gpointer p)
   {
   
           UNUSED(w);
           UNUSED(ev);
           UNUSED(p);
   
           if (menubar_timerid) {
                   g_source_remove(menubar_timerid);
                   menubar_timerid = 0;
           }
   
           if (scrnmode & SCRNMODE_FULLSCREEN) {
                   menubar_timerid = g_timeout_add(1000, menubar_timeout, NULL);
           }
   
           return TRUE;
   }
   
 static void  static void
 equip_fddrive(GtkUIManager *ui_manager, guint no)  equip_fddrive(GtkUIManager *ui_manager, guint no)
 {  {
Line 1719  equip_fddrive(GtkUIManager *ui_manager,  Line 1930  equip_fddrive(GtkUIManager *ui_manager, 
 GtkWidget *  GtkWidget *
 create_menu(void)  create_menu(void)
 {  {
         GtkWidget *menubar;  
         GError *err = NULL;          GError *err = NULL;
         gint rv;          gint rv;
         guint i;          guint i;
Line 1776  create_menu(void) Line 1986  create_menu(void)
         xmenu_select_memory(np2cfg.EXTMEM);          xmenu_select_memory(np2cfg.EXTMEM);
         xmenu_select_rotate(scrnmode & SCRNMODE_ROTATEMASK);          xmenu_select_rotate(scrnmode & SCRNMODE_ROTATEMASK);
         xmenu_select_screenmode(scrnmode & SCRNMODE_FULLSCREEN);          xmenu_select_screenmode(scrnmode & SCRNMODE_FULLSCREEN);
           xmenu_select_screensize(SCREEN_DEFMUL);
         xmenu_select_soundboard(np2cfg.SOUND_SW);          xmenu_select_soundboard(np2cfg.SOUND_SW);
   
         if (np2cfg.fddequip) {          if (np2cfg.fddequip) {
Line 1787  create_menu(void) Line 1998  create_menu(void)
         }          }
   
         menubar = gtk_ui_manager_get_widget(menu_hdl.ui_manager, "/MainMenu");          menubar = gtk_ui_manager_get_widget(menu_hdl.ui_manager, "/MainMenu");
   
           gtk_widget_add_events(menubar, EVENT_MASK);
           g_signal_connect(GTK_OBJECT(menubar), "enter_notify_event",
                       GTK_SIGNAL_FUNC(enter_notify_evhandler), NULL);
           g_signal_connect(GTK_OBJECT(menubar), "leave_notify_event",
                       GTK_SIGNAL_FUNC(leave_notify_evhandler), NULL);
   
         return menubar;          return menubar;
 }  }
   
   void
   xmenu_hide(void)
   {
   
           gtk_widget_hide(menubar);
   }
   
   void
   xmenu_show(void)
   {
   
           gtk_widget_show(menubar);
   }
   
   void
   xmenu_toggle_menu(void)
   {
   
           if (GTK_WIDGET_VISIBLE(menubar))
                   xmenu_hide();
           else
                   xmenu_show();
   }
   
   void
   xmenu_select_screen(UINT8 mode)
   {
   
           xmenu_select_rotate(mode & SCRNMODE_ROTATEMASK);
           xmenu_select_screenmode(mode & SCRNMODE_FULLSCREEN);
   }

Removed from v.1.3  
changed lines
  Added in v.1.12


RetroPC.NET-CVS <cvs@retropc.net>