From e9569abf85113b743e25e4d40b63379b6b3ca664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Wed, 30 Nov 2005 23:33:35 +0000 Subject: [PATCH] added signal and handler for F12 key pressed in the main window git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@28 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- src/callbacks.c | 23 ++++++++++++++++++++++- src/callbacks.h | 6 ++++++ src/main.c | 2 ++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/callbacks.c b/src/callbacks.c index 0a0fabaf..497eb41e 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -400,8 +400,14 @@ on_preferences1_activate (GtkMenuItem *menuitem, "font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(2)); g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "editor_font"), "font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(3)); + g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "font_term"), + "font-set", G_CALLBACK(on_prefs_font_choosed), GINT_TO_POINTER(4)); g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "long_line_color"), - "color-set", G_CALLBACK(on_prefs_color_choosed), NULL); + "color-set", G_CALLBACK(on_prefs_color_choosed), GINT_TO_POINTER(1)); + g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "color_fore"), + "color-set", G_CALLBACK(on_prefs_color_choosed), GINT_TO_POINTER(2)); + g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "color_back"), + "color-set", G_CALLBACK(on_prefs_color_choosed), GINT_TO_POINTER(3)); // file chooser buttons in the tools tab g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "button_gcc"), "clicked", G_CALLBACK(on_pref_tools_button_clicked), lookup_widget(app->prefs_dialog, "entry_com_c")); @@ -968,6 +974,21 @@ on_window_configure_event (GtkWidget *widget, } +gboolean +on_window_key_press_event (GtkWidget *widget, + GdkEventKey *event, + gpointer user_data) +{ + if (event->keyval == GDK_F12) + { + gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_SCRATCH); + gtk_widget_grab_focus(lookup_widget(app->window, "textview_scribble")); + return TRUE; + } + return FALSE; +} + + gboolean on_editor_key_press_event (GtkWidget *widget, GdkEventKey *event, diff --git a/src/callbacks.h b/src/callbacks.h index 65861edd..50b2fe87 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * + * $Id$ */ @@ -610,3 +611,8 @@ on_tv_notebook_switch_page (GtkNotebook *notebook, void on_openfiles_tree_popup_clicked (GtkMenuItem *menuitem, gpointer user_data); + +gboolean +on_window_key_press_event (GtkWidget *widget, + GdkEventKey *event, + gpointer user_data); diff --git a/src/main.c b/src/main.c index 5dd3d3c0..ca66c683 100644 --- a/src/main.c +++ b/src/main.c @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * + * $Id$ */ @@ -339,6 +340,7 @@ gint main(gint argc, gchar **argv) // registering some basic events g_signal_connect(G_OBJECT(app->window), "delete_event", G_CALLBACK(on_exit_clicked), NULL); g_signal_connect(G_OBJECT(app->window), "configure-event", G_CALLBACK(on_window_configure_event), NULL); + g_signal_connect(G_OBJECT(app->window), "key-press-event", G_CALLBACK(on_window_key_press_event), NULL); g_signal_connect(G_OBJECT(app->toolbar), "button-press-event", G_CALLBACK(toolbar_popup_menu), NULL); g_signal_connect(G_OBJECT(GTK_COMBO(app->tag_combo)->entry), "changed", G_CALLBACK(on_toolbar_tag_clicked), NULL);