El sáb, 07-04-2007 a las 22:00 -0400, Ales Hvezda escribió:
[snip]
> I don't understand why you are saying that the apply button has no effect.
[snip]
Because I never wanted to place the same component again... :)
> > 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.
>
> What if the user wants to just stop placing components (by hitting the ESC
> key), but wants to keep the component selection window open (so that the
> place in the selection tree isn't lost)?
Funny. That was I thought at first, but I simplified it later. ok, let's
go back to my previous version. Consider the attached patch:
A new "hide" button is added to the component selector. If the button is
clicked, the component selector is hidden.
If there is a component selected, but no object in the
complex_place_list, it automatically does the same as if the user clicks
on the "apply" button and then on the "hide" button (it assumes the user
wants to place the current component).
If no component is selected, the component selector is hidden anyway
(not sure about this: maybe do nothing in this case?).
Now, the user can place as many components as he wants. When finished,
he just hit the ESC key, and the component selector is presented again
(the place in the selection tree is not lost) and the focus is changed
to it.
The user can choose if continue placing another component or canceling
(by pressing the ESC key or clicking on the "Close" button).
When hitting the ESC key in the component selector, the
complex_place_list is deleted and the default state (SELECT) is
selected. This is not the current behaviour, which just leave the
complex_place_list as it was, allowing the user to place more
comoponents, and therefore the user needs to hit ESC again to go back to
the default state.
Regards,
Carlos
Index: include/x_compselect.h
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/include/x_compselect.h,v
retrieving revision 1.3
diff -u -r1.3 x_compselect.h
--- include/x_compselect.h 10 Feb 2007 21:25:29 -0000 1.3
+++ include/x_compselect.h 8 Apr 2007 12:22:48 -0000
@@ -70,6 +70,7 @@
guint filter_timeout;
GtkComboBox *combobox_behaviors;
+ gboolean hidden;
};
Index: src/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
--- src/x_compselect.c 10 Feb 2007 21:25:29 -0000 1.15
+++ src/x_compselect.c 8 Apr 2007 12:22:49 -0000
@@ -82,6 +82,7 @@
{
Compselect *compselect = (Compselect*)dialog;
TOPLEVEL *toplevel = (TOPLEVEL*)user_data;
+ GValue value = { 0, };
switch (arg1) {
case GTK_RESPONSE_APPLY: {
@@ -148,11 +149,33 @@
break;
}
+ case GTK_RESPONSE_NO:
+ /* Response when clicking on the "hide" button */
+
+ /* If there is no component in the complex place list, set the current one */
+ if (toplevel->page_current->complex_place_list == NULL) {
+ gtk_dialog_response (GTK_DIALOG (compselect), GTK_RESPONSE_APPLY);
+ }
+
+ /* Hide the component selector */
+ g_value_init (&value, G_TYPE_BOOLEAN);
+ g_value_set_boolean(&value, TRUE);
+ g_object_set_property (G_OBJECT(compselect), "hidden", &value);
+ break;
case GTK_RESPONSE_CLOSE:
case GTK_RESPONSE_DELETE_EVENT:
g_assert (GTK_WIDGET (dialog) == toplevel->cswindow);
gtk_widget_destroy (GTK_WIDGET (dialog));
toplevel->cswindow = NULL;
+
+ /* Free the complex place list */
+ g_list_free(toplevel->page_current->complex_place_list);
+ toplevel->page_current->complex_place_list = NULL;
+
+ /* return to the default state */
+ i_set_state(toplevel, SELECT);
+ i_update_toolbar(toplevel);
+
break;
default:
g_assert_not_reached ();
@@ -207,15 +230,15 @@
g_assert (IS_COMPSELECT (toplevel->cswindow));
gtk_widget_destroy (toplevel->cswindow);
toplevel->cswindow = NULL;
- }
-
+ }
}
enum {
PROP_FILENAME=1,
- PROP_BEHAVIOR
+ PROP_BEHAVIOR,
+ PROP_HIDDEN
};
static GObjectClass *compselect_parent_class = NULL;
@@ -647,6 +670,13 @@
COMPSELECT_TYPE_BEHAVIOR,
COMPSELECT_BEHAVIOR_REFERENCE,
G_PARAM_READWRITE));
+ g_object_class_install_property (
+ gobject_class, PROP_HIDDEN,
+ g_param_spec_boolean ("hidden",
+ "",
+ "",
+ FALSE,
+ G_PARAM_READWRITE));
}
@@ -884,8 +914,11 @@
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
/* - update button */
GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
+ _("Hide"), GTK_RESPONSE_NO,
NULL);
-
+
+ /* Initialize the hidden property */
+ compselect->hidden = FALSE;
}
static void
@@ -914,6 +947,13 @@
gtk_combo_box_set_active (compselect->combobox_behaviors,
g_value_get_enum (value));
break;
+ case PROP_HIDDEN:
+ compselect->hidden = g_value_get_boolean(value);
+ if (compselect->hidden)
+ gtk_widget_hide(GTK_WIDGET(compselect));
+ else
+ gtk_window_present (GTK_WINDOW(compselect));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -960,6 +1000,9 @@
gtk_combo_box_get_active (
compselect->combobox_behaviors));
break;
+ case PROP_HIDDEN:
+ g_value_set_boolean(value, compselect->hidden);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
Index: src/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
--- src/i_callbacks.c 24 Feb 2007 18:43:14 -0000 1.75
+++ src/i_callbacks.c 8 Apr 2007 12:22:51 -0000
@@ -3508,9 +3508,26 @@
DEFINE_I_CALLBACK(cancel)
{
TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GValue value = { 0, };
exit_if_null(w_current);
+ if (w_current->event_state == ENDCOMP &&
+ w_current->cswindow) {
+ /* user hit escape key when placing components */
+
+ /* delete the complex place list */
+ g_list_free(w_current->page_current->complex_place_list);
+ w_current->page_current->complex_place_list = NULL;
+ o_redraw_all(w_current);
+
+ /* Present the component selector again */
+ g_value_init (&value, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&value, FALSE);
+ g_object_set_property (G_OBJECT(w_current->cswindow), "hidden", &value);
+ return;
+ }
+
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