| version 1.5, 2007/01/02 13:11:01 | version 1.9, 2007/01/24 14:09:32 | 
| Line 108  static GtkActionEntry menu_entries[] = { | Line 108  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 263  static GtkRadioActionEntry rotate_entrie | Line 264  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 270  static void cb_joykey(gint idx); | Line 281  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 284  static const struct { | Line 296  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 298  static const gchar *ui_info = | Line 311  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 340  static const gchar *ui_info = | Line 352  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" | 
 | "   <separator/>\n" | "   <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" | 
 |  | "   <separator/>\n" | 
 | "   <menuitem action='screenopt'/>\n" | "   <menuitem action='screenopt'/>\n" | 
 | "  </menu>\n" | "  </menu>\n" | 
 | "  <menu name='Device' action='DeviceMenu'>\n" | "  <menu name='Device' action='DeviceMenu'>\n" | 
| Line 486  xmenu_select_item_by_index(MENU_HDL hdl, | Line 507  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 1036  cb_newdisk(GtkAction *action, gpointer u | Line 1059  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 1649  cb_screenmode(gint idx) | Line 1669  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 1691  cb_radio(GtkRadioAction *action, GtkRadi | Line 1724  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 1724  equip_fddrive(GtkUIManager *ui_manager, | Line 1824  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 1781  create_menu(void) | Line 1880  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 1792  create_menu(void) | Line 1892  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); | 
 |  | } |