gtk port: make keypad allow menu/toolbar accel keys to work too
also: translate some french comments and remove some other also: silence 2 glade warnings
This commit is contained in:
parent
7f0616d4ba
commit
d1ccf402ad
|
@ -312,7 +312,7 @@ ARM7 cpu</property>
|
|||
<widget class="GtkSpinButton" id="wtools_3_palnum">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="adjustment">0 0 15 1 2 1</property>
|
||||
<property name="adjustment">0 0 15 1 2 0</property>
|
||||
<property name="climb_rate">1</property>
|
||||
<signal name="value_changed" handler="on_wtools_3_palnum_value_changed"/>
|
||||
</widget>
|
||||
|
@ -471,7 +471,7 @@ ARM7 cpu</property>
|
|||
<widget class="GtkSpinButton" id="wtools_4_palnum">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="adjustment">0 0 15 1 2 1</property>
|
||||
<property name="adjustment">0 0 15 1 2 0</property>
|
||||
<property name="climb_rate">1</property>
|
||||
<signal name="value_changed" handler="on_wtools_4_palnum_value_changed"/>
|
||||
</widget>
|
||||
|
|
|
@ -453,7 +453,7 @@ static void Open_Select(GtkWidget* widget, gpointer data)
|
|||
GtkFileFilter *pFilter_nds, *pFilter_dsgba, *pFilter_any;
|
||||
GtkWidget *pFileSelection;
|
||||
GtkWidget *pParent;
|
||||
gchar *sChemin;
|
||||
gchar *sPath;
|
||||
|
||||
if (desmume_running())
|
||||
Pause();
|
||||
|
@ -485,24 +485,23 @@ static void Open_Select(GtkWidget* widget, gpointer data)
|
|||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
/* On limite les actions a cette fenetre */
|
||||
/* Only the dialog window is accepting events: */
|
||||
gtk_window_set_modal(GTK_WINDOW(pFileSelection), TRUE);
|
||||
|
||||
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(pFileSelection), pFilter_nds);
|
||||
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(pFileSelection), pFilter_dsgba);
|
||||
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(pFileSelection), pFilter_any);
|
||||
|
||||
/* Affichage fenetre */
|
||||
/* Showing the window */
|
||||
switch(gtk_dialog_run(GTK_DIALOG(pFileSelection))) {
|
||||
case GTK_RESPONSE_OK:
|
||||
/* Recuperation du chemin */
|
||||
sChemin = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(pFileSelection));
|
||||
if(Open((const char*)sChemin, bad_glob_cflash_disk_image_file) < 0) {
|
||||
sPath = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(pFileSelection));
|
||||
if(Open((const char*)sPath, bad_glob_cflash_disk_image_file) < 0) {
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection),
|
||||
GTK_DIALOG_MODAL,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_OK,
|
||||
"Unable to load :\n%s", sChemin);
|
||||
"Unable to load :\n%s", sPath);
|
||||
gtk_dialog_run(GTK_DIALOG(pDialog));
|
||||
gtk_widget_destroy(pDialog);
|
||||
} else {
|
||||
|
@ -511,7 +510,7 @@ static void Open_Select(GtkWidget* widget, gpointer data)
|
|||
|
||||
//Launch(NULL, pWindow);
|
||||
|
||||
g_free(sChemin);
|
||||
g_free(sPath);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -533,8 +532,6 @@ static void Reset()
|
|||
pStatusBar_Change("Running ...");
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef GTKGLEXT_AVAILABLE
|
||||
static void
|
||||
gtk_init_main_gl_area(GtkWidget *widget,
|
||||
|
@ -925,15 +922,17 @@ static gboolean Stylus_Move(GtkWidget *w, GdkEventMotion *e, gpointer data)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
static gboolean Stylus_Press(GtkWidget *w, GdkEventButton *e, gpointer data)
|
||||
|
||||
static gboolean Stylus_Press(GtkWidget * w, GdkEventButton * e,
|
||||
gpointer data)
|
||||
{
|
||||
GdkModifierType state;
|
||||
gint x,y;
|
||||
gint x, y;
|
||||
s32 EmuX, EmuY;
|
||||
const int *opengl = (const int *)data;
|
||||
const int *opengl = (const int *) data;
|
||||
|
||||
if(desmume_running()) {
|
||||
if(e->button == 1) {
|
||||
if (desmume_running()) {
|
||||
if (e->button == 1) {
|
||||
int scaled_x, scaled_y;
|
||||
click = TRUE;
|
||||
|
||||
|
@ -942,14 +941,14 @@ static gboolean Stylus_Press(GtkWidget *w, GdkEventButton *e, gpointer data)
|
|||
scaled_x = x * nds_screen_size_ratio;
|
||||
scaled_y = y * nds_screen_size_ratio;
|
||||
|
||||
if ( !(*opengl)) {
|
||||
if (!(*opengl)) {
|
||||
scaled_y -= 192;
|
||||
}
|
||||
if(scaled_y >= 0 && (state & GDK_BUTTON1_MASK)) {
|
||||
if (scaled_y >= 0 && (state & GDK_BUTTON1_MASK)) {
|
||||
EmuX = scaled_x;
|
||||
EmuY = scaled_y;
|
||||
if(EmuX<0) EmuX = 0; else if(EmuX>255) EmuX = 255;
|
||||
if(EmuY<0) EmuY = 0; else if(EmuY>192) EmuY = 192;
|
||||
if (EmuX < 0) EmuX = 0; else if (EmuX > 255) EmuX = 255;
|
||||
if (EmuY < 0) EmuY = 0; else if (EmuY > 192) EmuY = 192;
|
||||
NDS_setTouchPos(EmuX, EmuY);
|
||||
}
|
||||
}
|
||||
|
@ -1003,16 +1002,26 @@ static gint Key_Press(GtkWidget *w, GdkEventKey *e, gpointer data)
|
|||
savegame(e->keyval - GDK_F1 + 1);
|
||||
return 1;
|
||||
}
|
||||
// FIXME: this is a hack to allow accels to work together with keypad emulation
|
||||
// should be fixed by somebody who knows how to make key_press_event trigger AFTER all GtkAccels
|
||||
guint mask;
|
||||
mask = GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_MOD5_MASK; // shift,ctrl, both alts
|
||||
if( (e->state & mask) == 0){
|
||||
u16 Key = lookup_key(e->keyval);
|
||||
if(Key){
|
||||
ADD_KEY( Cur_Keypad, Key );
|
||||
if(desmume_running()) update_keypad(Cur_Keypad);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PROFILE_MEMORY_ACCESS
|
||||
if ( e->keyval == GDK_Tab) {
|
||||
print_memory_profiling();
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gint Key_Release(GtkWidget *w, GdkEventKey *e, gpointer data)
|
||||
|
@ -1281,7 +1290,7 @@ int SelectFirmwareFile_Load(GtkWidget *w, gpointer data)
|
|||
GtkFileFilter *pFilter_nds, *pFilter_bin, *pFilter_any;
|
||||
GtkWidget *pFileSelection;
|
||||
GtkWidget *pParent;
|
||||
gchar *sChemin;
|
||||
gchar *sPath;
|
||||
|
||||
BOOL oldState = desmume_running();
|
||||
Pause();
|
||||
|
@ -1300,14 +1309,12 @@ int SelectFirmwareFile_Load(GtkWidget *w, gpointer data)
|
|||
gtk_file_filter_add_pattern(pFilter_any, "*");
|
||||
gtk_file_filter_set_name(pFilter_any, "All files");
|
||||
|
||||
/* Creation de la fenetre de selection */
|
||||
pFileSelection = gtk_file_chooser_dialog_new("Load firmware...",
|
||||
GTK_WINDOW(pParent),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
/* On limite les actions a cette fenetre */
|
||||
gtk_window_set_modal(GTK_WINDOW(pFileSelection), TRUE);
|
||||
|
||||
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(pFileSelection), pFilter_nds);
|
||||
|
@ -1316,22 +1323,20 @@ int SelectFirmwareFile_Load(GtkWidget *w, gpointer data)
|
|||
|
||||
if(FirmwareFile[0]) gtk_file_chooser_select_uri(GTK_FILE_CHOOSER(pFileSelection), FirmwareFile);
|
||||
|
||||
/* Affichage fenetre */
|
||||
switch(gtk_dialog_run(GTK_DIALOG(pFileSelection))) {
|
||||
case GTK_RESPONSE_OK:
|
||||
/* Recuperation du chemin */
|
||||
sChemin = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(pFileSelection));
|
||||
if(LoadFirmware((const char*)sChemin) < 0) {
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Unable to load :\n%s", sChemin);
|
||||
sPath = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(pFileSelection));
|
||||
if(LoadFirmware((const char*)sPath) < 0) {
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Unable to load :\n%s", sPath);
|
||||
gtk_dialog_run(GTK_DIALOG(pDialog));
|
||||
gtk_widget_destroy(pDialog);
|
||||
} else {
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Selected firmware :\n%s", sChemin);
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Selected firmware :\n%s", sPath);
|
||||
gtk_dialog_run(GTK_DIALOG(pDialog));
|
||||
gtk_widget_destroy(pDialog);
|
||||
}
|
||||
|
||||
g_free(sChemin);
|
||||
g_free(sPath);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1347,7 +1352,7 @@ int SelectFirmwareFile_Load(GtkWidget *w, gpointer data)
|
|||
GtkFileFilter *pFilter_nds, *pFilter_bin, *pFilter_any;
|
||||
GtkWidget *pFileSelection;
|
||||
GtkWidget *pParent;
|
||||
gchar *sChemin;
|
||||
gchar *sPath;
|
||||
|
||||
BOOL oldState = desmume_running();
|
||||
Pause();
|
||||
|
@ -1366,14 +1371,12 @@ int SelectFirmwareFile_Load(GtkWidget *w, gpointer data)
|
|||
gtk_file_filter_add_pattern(pFilter_any, "*");
|
||||
gtk_file_filter_set_name(pFilter_any, "All files");
|
||||
|
||||
/* Creation de la fenetre de selection */
|
||||
pFileSelection = gtk_file_chooser_dialog_new("Save firmware...",
|
||||
GTK_WINDOW(pParent),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
/* On limite les actions a cette fenetre */
|
||||
gtk_window_set_modal(GTK_WINDOW(pFileSelection), TRUE);
|
||||
|
||||
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(pFileSelection), pFilter_nds);
|
||||
|
@ -1382,22 +1385,20 @@ int SelectFirmwareFile_Load(GtkWidget *w, gpointer data)
|
|||
|
||||
if(FirmwareFile[0]) gtk_file_chooser_select_uri(GTK_FILE_CHOOSER(pFileSelection), FirmwareFile);
|
||||
|
||||
/* Affichage fenetre */
|
||||
switch(gtk_dialog_run(GTK_DIALOG(pFileSelection))) {
|
||||
case GTK_RESPONSE_OK:
|
||||
/* Recuperation du chemin */
|
||||
sChemin = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(pFileSelection));
|
||||
if(LoadFirmware((const char*)sChemin) < 0) {
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Unable to load :\n%s", sChemin);
|
||||
sPath = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(pFileSelection));
|
||||
if(LoadFirmware((const char*)sPath) < 0) {
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Unable to load :\n%s", sPath);
|
||||
gtk_dialog_run(GTK_DIALOG(pDialog));
|
||||
gtk_widget_destroy(pDialog);
|
||||
} else {
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Selected firmware :\n%s", sChemin);
|
||||
GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pFileSelection), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Selected firmware :\n%s", sPath);
|
||||
gtk_dialog_run(GTK_DIALOG(pDialog));
|
||||
gtk_widget_destroy(pDialog);
|
||||
}
|
||||
|
||||
g_free(sChemin);
|
||||
g_free(sPath);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1899,7 +1900,7 @@ common_gtk_main( struct configured_features *my_config)
|
|||
config_file = g_build_filename(g_get_home_dir(), ".desmume.ini", NULL);
|
||||
Read_ConfigFile(config_file);
|
||||
|
||||
/* Creation de la fenetre */
|
||||
/* Create the window */
|
||||
pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(pWindow), "Desmume");
|
||||
|
||||
|
@ -1911,7 +1912,7 @@ common_gtk_main( struct configured_features *my_config)
|
|||
g_signal_connect(G_OBJECT(pWindow), "key_press_event", G_CALLBACK(Key_Press), NULL);
|
||||
g_signal_connect(G_OBJECT(pWindow), "key_release_event", G_CALLBACK(Key_Release), NULL);
|
||||
|
||||
/* Creation de la GtkVBox */
|
||||
/* Create the GtkVBox */
|
||||
pVBox = gtk_vbox_new(FALSE, 0);
|
||||
gtk_container_add(GTK_CONTAINER(pWindow), pVBox);
|
||||
|
||||
|
@ -1941,7 +1942,7 @@ common_gtk_main( struct configured_features *my_config)
|
|||
|
||||
desmume_gtk_toolbar(pVBox);
|
||||
|
||||
/* Création de l'endroit pour l'affichage des écrans */
|
||||
/* Creating the place for showing DS screens */
|
||||
#ifdef GTKGLEXT_AVAILABLE
|
||||
if ( my_config->opengl_2d) {
|
||||
/*
|
||||
|
@ -2099,7 +2100,7 @@ common_gtk_main( struct configured_features *my_config)
|
|||
}
|
||||
}
|
||||
|
||||
/* Boucle principale */
|
||||
/* Main loop */
|
||||
|
||||
// gtk_idle_add(&EmuLoop, pWindow);
|
||||
// g_idle_add(&EmuLoop, pWindow);
|
||||
|
|
Loading…
Reference in New Issue