[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: pcb.git: branch: master updated (c81a96de0ca4d0dd7122d88721a9e2865ff835a7)



The branch, master has been updated
       via  c81a96de0ca4d0dd7122d88721a9e2865ff835a7 (commit)
      from  728f350268e134ca116a6f79577843db7b18e82c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 src/hid/gtk/ghid-layer-selector.c |    7 ++++++-
 src/hid/gtk/gui-top-window.c      |    8 ++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)


=================
 Commit Messages
=================

commit c81a96de0ca4d0dd7122d88721a9e2865ff835a7
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Prevent recursion in layer selector events

:100644 100644 06dc8cd... 7f11f7f... M	src/hid/gtk/ghid-layer-selector.c
:100644 100644 9d170c8... 16de5b4... M	src/hid/gtk/gui-top-window.c

=========
 Changes
=========

commit c81a96de0ca4d0dd7122d88721a9e2865ff835a7
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Prevent recursion in layer selector events

diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index 06dc8cd..7f11f7f 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -65,6 +65,7 @@ struct _GHidLayerSelector
   int n_actions;
 
   gboolean last_activatable;
+  gboolean prevent_recursion;
 };
 
 struct _GHidLayerSelectorClass
@@ -153,6 +154,7 @@ static void
 selection_changed_cb (GtkTreeSelection *selection, GHidLayerSelector *ls)
 {
   GtkTreeIter iter;
+  ls->prevent_recursion = TRUE;
   if (gtk_tree_selection_get_selected (selection, NULL, &iter))
     {
       gint idx;
@@ -161,6 +163,7 @@ selection_changed_cb (GtkTreeSelection *selection, GHidLayerSelector *ls)
       if (ls->pick_actions[0])
         gtk_radio_action_set_current_value (ls->pick_actions[0], idx);
     }
+  ls->prevent_recursion = FALSE;
 }
 
 /*! \brief Callback for menu actions: sync layer selection list, emit signal */
@@ -197,7 +200,8 @@ menu_pick_cb (GtkRadioAction *action, GtkTreeRowReference *rref)
   gtk_tree_model_get (model, &iter, USER_ID_COL, &user_id, -1);
 
   ls = g_object_get_data (G_OBJECT (model), "layer-selector");
-  gtk_tree_selection_select_path (ls->selection, path);
+  if (!ls->prevent_recursion)
+    gtk_tree_selection_select_path (ls->selection, path);
   g_signal_emit (ls, ghid_layer_selector_signals[SELECT_LAYER_SIGNAL],
                  0, user_id);
 }
@@ -318,6 +322,7 @@ ghid_layer_selector_new (void)
   ls->visibility_column = opacity_col;
   ls->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ls));
   ls->action_group = gtk_action_group_new ("LayerSelector");
+  ls->prevent_recursion = FALSE;
   ls->n_actions = 0;
   ls->max_actions = INITIAL_ACTION_MAX;
   ls->view_actions = g_malloc0 (ls->max_actions * sizeof (*ls->view_actions));
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 9d170c8..16de5b4 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -173,6 +173,7 @@ static void ghid_load_menus (void);
 static void ghid_ui_info_append (const gchar *);
 static void ghid_ui_info_indent (int);
 
+static bool ignore_layer_update;
 static gchar * new_ui_info;
 static size_t new_ui_info_sz = 0;
 
@@ -684,6 +685,7 @@ layer_selector_select_callback (GHidLayerSelector *ls, int layer, gpointer d)
   gboolean active;
   layer_process (NULL, NULL, &active, layer);
 
+  ignore_layer_update = true;
   /* Select Layer */
   PCB->SilkActive = (layer == LAYER_BUTTON_SILK);
   PCB->RatDraw  = (layer == LAYER_BUTTON_RATS);
@@ -692,6 +694,7 @@ layer_selector_select_callback (GHidLayerSelector *ls, int layer, gpointer d)
 
   /* Ensure layer is turned on */
   ghid_layer_selector_make_selected_visible (ls);
+  ignore_layer_update = false;
 
   ghid_invalidate_all ();
 }
@@ -705,6 +708,7 @@ layer_selector_toggle_callback (GHidLayerSelector *ls, int layer, gpointer d)
   layer_process (NULL, NULL, &active, layer);
 
   active = !active;
+  ignore_layer_update = true;
   switch (layer)
     {
     case LAYER_BUTTON_SILK:
@@ -750,6 +754,7 @@ layer_selector_toggle_callback (GHidLayerSelector *ls, int layer, gpointer d)
    */
   if (!ghid_layer_selector_select_next_visible (ls))
     ghid_layer_selector_toggle_layer (ls, layer);
+  ignore_layer_update = false;
 
   if (redraw)
     ghid_invalidate_all();
@@ -1074,6 +1079,9 @@ ghid_layer_buttons_update (void)
 {
   gint layer;
 
+  if (ignore_layer_update)
+    return;
+ 
   ghid_layer_selector_delete_layers
     (GHID_LAYER_SELECTOR (ghidgui->layer_selector),
      get_layer_delete);




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs