[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (c07a6f7bd679489c7430b6b398e9afa926282b08)
The branch, master has been updated
via c07a6f7bd679489c7430b6b398e9afa926282b08 (commit)
via 8b881ae3f24873f7845a37948bea08022a1650b4 (commit)
via bc395b2ddfe90de7ed149e1f382e0e8561449117 (commit)
from 9396377717f7c49cf38d753a35e32d004294b09e (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 | 75 ++++++++++++++++++++++++++++++------
src/hid/gtk/ghid-layer-selector.h | 2 +
src/hid/gtk/gui-config.c | 1 +
src/hid/gtk/gui-top-window.c | 21 +++++++---
4 files changed, 79 insertions(+), 20 deletions(-)
=================
Commit Messages
=================
commit c07a6f7bd679489c7430b6b398e9afa926282b08
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
gtk: sync visiibility of layer selector with core state in LayersChanged
:100644 100644 e0e5eec... 7b3e228... M src/hid/gtk/gui-top-window.c
commit 8b881ae3f24873f7845a37948bea08022a1650b4
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Use signal blocking for visibility toggling in GHidLayerSelector
:100644 100644 dd81dad... c7d7030... M src/hid/gtk/ghid-layer-selector.c
:100644 100644 887d6de... 09fa182... M src/hid/gtk/ghid-layer-selector.h
commit bc395b2ddfe90de7ed149e1f382e0e8561449117
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Add call to ghid_layer_buttons_color_update() when loading new colors
:100644 100644 88bf547... cbd46a4... M src/hid/gtk/gui-config.c
=========
Changes
=========
commit c07a6f7bd679489c7430b6b398e9afa926282b08
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
gtk: sync visiibility of layer selector with core state in LayersChanged
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index e0e5eec..7b3e228 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -458,18 +458,13 @@ layer_process (gchar **color_string, char **text, int *set, int i)
static void
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);
if (layer < max_copper_layer)
- ChangeGroupVisibility (layer, active, true);
+ ChangeGroupVisibility (layer, TRUE, true);
- /* Ensure layer is turned on */
- ghid_layer_selector_make_selected_visible (ls);
ignore_layer_update = false;
ghid_invalidate_all ();
@@ -529,7 +524,8 @@ layer_selector_toggle_callback (GHidLayerSelector *ls, int layer, gpointer d)
* can. If we can't, turn the original layer back on.
*/
if (!ghid_layer_selector_select_next_visible (ls))
- ghid_layer_selector_toggle_layer (ls, layer);
+ ChangeGroupVisibility (layer, true, false);
+
ignore_layer_update = false;
if (redraw)
@@ -1827,6 +1823,15 @@ ghid_do_export (HID_Attr_Val * options)
}
+/*! \brief callback for */
+static gboolean
+get_layer_visible_cb (int id)
+{
+ int visible;
+ layer_process (NULL, NULL, &visible, id);
+ return visible;
+}
+
gint
LayersChanged (int argc, char **argv, Coord x, Coord y)
{
@@ -1835,6 +1840,8 @@ LayersChanged (int argc, char **argv, Coord x, Coord y)
ghid_config_groups_changed();
ghid_layer_buttons_update ();
+ ghid_layer_selector_show_layers
+ (GHID_LAYER_SELECTOR (ghidgui->layer_selector), get_layer_visible_cb);
/* FIXME - if a layer is moved it should retain its color. But layers
| currently can't do that because color info is not saved in the
commit 8b881ae3f24873f7845a37948bea08022a1650b4
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Use signal blocking for visibility toggling in GHidLayerSelector
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index dd81dad..c7d7030 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -81,6 +81,7 @@ struct _layer
{
gint accel_index; /* Index into ls->accel_available */
gulong pick_sig_id;
+ gulong view_sig_id;
GtkWidget *pick_item;
GtkWidget *view_item;
GtkToggleAction *view_action;
@@ -117,27 +118,43 @@ free_ldata (GHidLayerSelector *ls, struct _layer *ldata)
}
+/*! \brief internal set-visibility function -- emits no signals */
+static void
+set_visibility (GHidLayerSelector *ls, GtkTreeIter *iter,
+ struct _layer *ldata, gboolean state)
+{
+ gtk_list_store_set (ls->list_store, iter, VISIBLE_COL, state, -1);
+
+ if (ldata)
+ {
+ g_signal_handler_block (ldata->view_action, ldata->view_sig_id);
+ gtk_toggle_action_set_active (ldata->view_action, state);
+ g_signal_handler_block (ldata->view_action, ldata->view_sig_id);
+ }
+}
+
/*! \brief Flip the visibility state of a given layer
* \par Function Description
* Changes the internal toggle state and menu checkbox state
* of the layer pointed to by iter. Emits a toggle-layer signal.
- * ALL internal visibility-flipping needs to go through this
- * function. Otherwise a signal will not be emitted and it is
- * likely that pcb will become inconsistent with the selector.
*
* \param [in] ls The selector to be acted on
* \param [in] iter A GtkTreeIter pointed at the relevant layer
+ * \param [in] emit Whether or not to emit a signal
*/
static void
-toggle_visibility (GHidLayerSelector *ls, GtkTreeIter *iter)
+toggle_visibility (GHidLayerSelector *ls, GtkTreeIter *iter, gboolean emit)
{
+ gint user_id;
struct _layer *ldata;
gboolean toggle;
gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store), iter,
- VISIBLE_COL, &toggle, STRUCT_COL, &ldata, -1);
- gtk_list_store_set (ls->list_store, iter, VISIBLE_COL, !toggle, -1);
- if (ldata)
- gtk_toggle_action_set_active (ldata->view_action, !toggle);
+ USER_ID_COL, &user_id, VISIBLE_COL, &toggle,
+ STRUCT_COL, &ldata, -1);
+ set_visibility (ls, iter, ldata, !toggle);
+ if (emit)
+ g_signal_emit (ls, ghid_layer_selector_signals[TOGGLE_LAYER_SIGNAL],
+ 0, user_id);
}
/*! \brief Decide if a GtkListStore entry is a layer or separator */
@@ -189,7 +206,7 @@ button_press_cb (GHidLayerSelector *ls, GdkEventButton *event)
gtk_tree_model_get_iter (GTK_TREE_MODEL (ls->list_store), &iter, path);
if (column == ls->visibility_column)
{
- toggle_visibility (ls, &iter);
+ toggle_visibility (ls, &iter, TRUE);
return TRUE;
}
}
@@ -566,8 +583,9 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
gtk_action_group_add_action_with_accel
(ls->action_group, GTK_ACTION (new_layer->view_action), accel2);
gtk_action_connect_accelerator (GTK_ACTION (new_layer->view_action));
- g_signal_connect (G_OBJECT (new_layer->view_action), "activate",
- G_CALLBACK (menu_view_cb), new_layer);
+ new_layer->view_sig_id =
+ g_signal_connect (G_OBJECT (new_layer->view_action), "activate",
+ G_CALLBACK (menu_view_cb), new_layer);
ls->accel_available[i] = FALSE;
new_layer->accel_index = i;
@@ -687,7 +705,7 @@ toggle_foreach_func (GtkTreeModel *model, GtkTreePath *path,
gtk_tree_model_get (model, iter, USER_ID_COL, &id, -1);
if (id == *(gint *) data)
{
- toggle_visibility (ls, iter);
+ toggle_visibility (ls, iter, TRUE);
return TRUE;
}
return FALSE;
@@ -807,7 +825,7 @@ ghid_layer_selector_make_selected_visible (GHidLayerSelector *ls)
gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store),
&iter, VISIBLE_COL, &visible, -1);
if (!visible)
- toggle_visibility (ls, &iter);
+ toggle_visibility (ls, &iter, FALSE);
}
}
@@ -897,5 +915,36 @@ ghid_layer_selector_delete_layers (GHidLayerSelector *ls,
}
}
+/*! \brief Sets the visibility toggle-state of all layers
+ * \par Function Description
+ * Shows layers according to a callback function: a return value of TRUE
+ * means show, FALSE means hide.
+ *
+ * \param [in] ls The selector to be acted on
+ * \param [in] callback Takes the user_id of the layer and returns a boolean
+ */
+void
+ghid_layer_selector_show_layers (GHidLayerSelector *ls,
+ gboolean (*callback)(int user_id))
+{
+ GtkTreeIter iter;
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ls->list_store), &iter);
+ do
+ {
+ struct _layer *ldata;
+ gboolean sep;
+ gint user_id;
+
+ gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store),
+ &iter, USER_ID_COL, &user_id,
+ STRUCT_COL, &ldata,
+ SEPARATOR_COL, &sep, -1);
+ if (!sep)
+ set_visibility (ls, &iter, ldata, callback (user_id));
+ }
+ while (gtk_tree_model_iter_next (GTK_TREE_MODEL (ls->list_store), &iter));
+}
+
+
diff --git a/src/hid/gtk/ghid-layer-selector.h b/src/hid/gtk/ghid-layer-selector.h
index 887d6de..09fa182 100644
--- a/src/hid/gtk/ghid-layer-selector.h
+++ b/src/hid/gtk/ghid-layer-selector.h
@@ -43,6 +43,8 @@ void ghid_layer_selector_update_colors (GHidLayerSelector *ls,
const gchar *(*callback)(int user_id));
void ghid_layer_selector_delete_layers (GHidLayerSelector *ls,
gboolean (*callback)(int user_id));
+void ghid_layer_selector_show_layers (GHidLayerSelector *ls,
+ gboolean (*callback)(int user_id));
G_END_DECLS /* keep c++ happy */
#endif
commit bc395b2ddfe90de7ed149e1f382e0e8561449117
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Add call to ghid_layer_buttons_color_update() when loading new colors
diff --git a/src/hid/gtk/gui-config.c b/src/hid/gtk/gui-config.c
index 88bf547..cbd46a4 100644
--- a/src/hid/gtk/gui-config.c
+++ b/src/hid/gtk/gui-config.c
@@ -1805,6 +1805,7 @@ config_color_load_cb (gpointer data)
gtk_widget_destroy (config_colors_vbox);
config_colors_tab_create (config_colors_tab_vbox);
+ ghid_layer_buttons_color_update ();
ghid_invalidate_all();
}
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs