Hi,
In the current gschem component selector, the apply button has no real
effect. I think it could be used to hide the component selector window,
thus allowing the user to see the whole gschem window and place the
component.

When the user placed a component, the focus was changed to the gschem
window. He could hit the ESC key to finish placing, but the component
selector was still in the front. I also changed this so when the user
hits the ESC key, the component selector is closed.

Attached is a patch implementing these two new features. Any feedback is
welcome.

Thanks,

Carlos
Index: x_compselect.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_compselect.c,v
retrieving revision 1.15
diff -u -r1.15 x_compselect.c
--- x_compselect.c	10 Feb 2007 21:25:29 -0000	1.15
+++ x_compselect.c	6 Apr 2007 20:56:33 -0000
@@ -84,7 +84,7 @@
   TOPLEVEL *toplevel = (TOPLEVEL*)user_data;
 
   switch (arg1) {
-      case GTK_RESPONSE_APPLY: {
+      case GTK_RESPONSE_ACCEPT: {
         gchar *filename, *directory, *component;
         CompselectBehavior behavior;
         
@@ -143,11 +143,21 @@
 	
 	o_complex_set_filename(toplevel, toplevel->current_clib,
 			       toplevel->current_basename);
-        
 	toplevel->event_state = DRAWCOMP;
 
         break;
       }
+
+      case GTK_RESPONSE_APPLY:
+	/* Hide the component selector so the user can see the 
+	   whole schematic window */
+	if (toplevel->current_basename &&
+	    toplevel->current_clib) {
+	  gtk_widget_hide(GTK_WIDGET(compselect));
+	}
+
+	break;
+
       case GTK_RESPONSE_CLOSE:
       case GTK_RESPONSE_DELETE_EVENT:
         g_assert (GTK_WIDGET (dialog) == toplevel->cswindow);
@@ -363,7 +373,7 @@
  *  directory name from the model (the directory name is build from
  *  the ancestors of the row in the model).
  *
- *  It then emits the dialog's <B>apply</B> signal to let its parent
+ *  It then emits the dialog's <B>accept</B> signal to let its parent
  *  know that a component has been selected.
  *
  *  \param [in] selection The current selection in the treeview.
@@ -409,7 +419,7 @@
   /* signal a component has been selected to parent of dialog */
   g_signal_emit_by_name (compselect,
                          "response",
-                         GTK_RESPONSE_APPLY,
+                         GTK_RESPONSE_ACCEPT,
                          NULL);
 
   g_free (filename);
@@ -527,7 +537,7 @@
 
   g_signal_emit_by_name (compselect,
                          "response",
-                         GTK_RESPONSE_APPLY,
+                         GTK_RESPONSE_ACCEPT,
                          NULL);
 }
 
@@ -646,8 +656,7 @@
                        "",
                        COMPSELECT_TYPE_BEHAVIOR,
                        COMPSELECT_BEHAVIOR_REFERENCE,
-                       G_PARAM_READWRITE));
-  
+                       G_PARAM_READWRITE));  
 }
 
 static void
@@ -885,7 +894,7 @@
                           /*  - update button */
                           GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
                           NULL);
-  
+
 }
 
 static void
Index: i_callbacks.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/i_callbacks.c,v
retrieving revision 1.75
diff -u -r1.75 i_callbacks.c
--- i_callbacks.c	24 Feb 2007 18:43:14 -0000	1.75
+++ i_callbacks.c	6 Apr 2007 20:56:36 -0000
@@ -3511,6 +3511,12 @@
 
   exit_if_null(w_current);
 
+  if (w_current->event_state == ENDCOMP &&
+      w_current->cswindow) {
+    /* user pressed escape key, request close of the dialog */
+    gtk_dialog_response (GTK_DIALOG (w_current->cswindow), GTK_RESPONSE_CLOSE);
+  }
+
   if ( (w_current->inside_action) && 
        (w_current->rotated_inside != 0)) {
     o_undo_callback(w_current, UNDO_ACTION);	 

_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to