|
|
| version 1.5, 2007/01/02 13:11:01 | version 1.11, 2007/08/22 15:20:31 |
|---|---|
| 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" |
| #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 486 xmenu_select_item_by_index(MENU_HDL hdl, | Line 509 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 524 cb_bmpsave(GtkAction *action, gpointer u | Line 549 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 811 cb_ataopen(GtkAction *action, gpointer u | Line 840 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 996 cb_newdisk(GtkAction *action, gpointer u | Line 1027 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 1036 cb_newdisk(GtkAction *action, gpointer u | Line 1071 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 1681 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 1736 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 1836 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 1892 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 1904 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); | |
| } |