[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: x_multiattrib.nw
User: pbernaud
Date: 05/03/12 13:51:56
Modified: . x_multiattrib.nw
Log:
Made the multiattrib dialog aware of key press and let the Escape key close the dialog.
Revision Changes Path
1.22 +35 -0 eda/geda/devel/gschem/noweb/x_multiattrib.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_multiattrib.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/x_multiattrib.nw,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- x_multiattrib.nw 28 Feb 2005 18:26:04 -0000 1.21
+++ x_multiattrib.nw 12 Mar 2005 18:51:56 -0000 1.22
@@ -160,6 +160,8 @@
<<x_multiattrib.c : multiattrib_callback_popup_menu()>>
<<x_multiattrib.c : multiattrib_callback_popup_*()>>
+<<x_multiattrib.c : multiattrib_callback_dialog_key_pressed()>>
+
<<x_multiattrib.c : multiattrib_callback_value_key_pressed()>>
<<x_multiattrib.c : multiattrib_callback_button_add()>>
@@ -281,6 +283,12 @@
multiattrib->toplevel = NULL;
multiattrib->object = NULL;
+ /* connect to the key-press-event of dialog */
+ g_signal_connect (multiattrib,
+ "key-press-event",
+ G_CALLBACK (multiattrib_callback_dialog_key_pressed),
+ multiattrib);
+
<<multiattrib_init() : create the frame with the list of attributes>>
<<multiattrib_init() : create the 'add attribute' frame>>
@@ -1272,6 +1280,33 @@
@ %def multiattrib_callback_popup_delete
+@subsection Function @code{multiattrib_callback_dialog_key_pressed()}
+
+@defun multiattrib_callback_dialog_key_pressed widget event user_data
+@end defun
+
+<<x_multiattrib.c : multiattrib_callback_dialog_key_pressed()>>=
+static gboolean
+multiattrib_callback_dialog_key_pressed (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer user_data)
+{
+ Multiattrib *multiattrib = (Multiattrib*)widget;
+ gboolean retval = FALSE;
+
+ /* close the dialog if the Escape key is pressed */
+ if (event->keyval == GDK_Escape) {
+ gtk_dialog_response ((GtkDialog*)multiattrib,
+ MULTIATTRIB_RESPONSE_CLOSE);
+ retval = TRUE;
+ }
+
+ return retval;
+}
+
+@ %def multiattrib_callback_dialog_key_pressed
+
+
@subsection Function @code{multiattrib_callback_value_key_pressed()}
@defun multiattrib_callback_value_key_pressed widget event user_data