You can subscribe to this list here.
| 2003 |
Jan
|
Feb
(4) |
Mar
(5) |
Apr
|
May
(5) |
Jun
(30) |
Jul
(2) |
Aug
(18) |
Sep
(14) |
Oct
(7) |
Nov
(21) |
Dec
(44) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(63) |
Feb
(94) |
Mar
(54) |
Apr
(39) |
May
(34) |
Jun
(25) |
Jul
(10) |
Aug
(33) |
Sep
(16) |
Oct
(62) |
Nov
(12) |
Dec
(2) |
| 2005 |
Jan
(71) |
Feb
(8) |
Mar
(50) |
Apr
|
May
(2) |
Jun
(12) |
Jul
(19) |
Aug
(8) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(8) |
| 2006 |
Jan
(10) |
Feb
(1) |
Mar
(301) |
Apr
(232) |
May
(26) |
Jun
(20) |
Jul
(26) |
Aug
(79) |
Sep
(92) |
Oct
(174) |
Nov
(17) |
Dec
(93) |
| 2007 |
Jan
(27) |
Feb
(179) |
Mar
(37) |
Apr
(81) |
May
(20) |
Jun
(5) |
Jul
|
Aug
(40) |
Sep
(68) |
Oct
(8) |
Nov
(47) |
Dec
(34) |
| 2008 |
Jan
(154) |
Feb
(15) |
Mar
(5) |
Apr
(21) |
May
(4) |
Jun
(1) |
Jul
(4) |
Aug
(6) |
Sep
(8) |
Oct
(9) |
Nov
(35) |
Dec
(50) |
| 2009 |
Jan
(8) |
Feb
(10) |
Mar
(6) |
Apr
(9) |
May
(7) |
Jun
(40) |
Jul
(7) |
Aug
(5) |
Sep
(2) |
Oct
(16) |
Nov
(42) |
Dec
(5) |
| 2010 |
Jan
(3) |
Feb
(15) |
Mar
(32) |
Apr
(18) |
May
(6) |
Jun
(9) |
Jul
|
Aug
(11) |
Sep
(16) |
Oct
|
Nov
(4) |
Dec
(35) |
| 2011 |
Jan
(24) |
Feb
(6) |
Mar
(27) |
Apr
(119) |
May
(72) |
Jun
(20) |
Jul
(31) |
Aug
(88) |
Sep
(86) |
Oct
(14) |
Nov
(11) |
Dec
(30) |
| 2012 |
Jan
(4) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <gi...@gp...> - 2011-08-31 17:30:47
|
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 <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
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 <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
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 <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
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 <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
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 <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
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 <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
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();
}
|
|
From: <gi...@gp...> - 2011-08-31 02:02:08
|
The branch, master has been updated
via 9396377717f7c49cf38d753a35e32d004294b09e (commit)
via 6be2f4a159accc28c04652eb8fd3b0b9467487a6 (commit)
from dd80b3287ec84e4884e6bcf29f168f5fcef1aa73 (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/change.c | 12 ++++++------
src/hid/gtk/ghid-layer-selector.c | 5 +++++
2 files changed, 11 insertions(+), 6 deletions(-)
=================
Commit Messages
=================
commit 9396377717f7c49cf38d753a35e32d004294b09e
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Change change.c to treat text scale as mils
:100644 100644 5d44355... eca110e... M src/change.c
commit 6be2f4a159accc28c04652eb8fd3b0b9467487a6
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Configure layer selector to only accept left-clicks
Suggested by Kai-Martin Knaak, seconded by me.
:100644 100644 2c5d0e5... dd81dad... M src/hid/gtk/ghid-layer-selector.c
=========
Changes
=========
commit 9396377717f7c49cf38d753a35e32d004294b09e
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Change change.c to treat text scale as mils
diff --git a/src/change.c b/src/change.c
index 5d44355..eca110e 100644
--- a/src/change.c
+++ b/src/change.c
@@ -128,8 +128,8 @@ static void *ChangePolyClear (LayerTypePtr, PolygonTypePtr);
/* ---------------------------------------------------------------------------
* some local identifiers
*/
-static int Delta; /* change of size */
-static int Absolute; /* Absolute size */
+static Coord Delta; /* change of size */
+static Coord Absolute; /* Absolute size */
static char *NewName; /* new name */
static ObjectFunctionType ChangeSizeFunctions = {
ChangeLineSize,
@@ -838,8 +838,8 @@ ChangeArcClearSize (LayerTypePtr Layer, ArcTypePtr Arc)
static void *
ChangeTextSize (LayerTypePtr Layer, TextTypePtr Text)
{
- int value = (Absolute != 0 ? Text->Scale : 0) +
- (Absolute != 0 ? Absolute : Delta) * 100 / FONT_CAPHEIGHT;
+ int value = Absolute ? COORD_TO_MIL (Absolute)
+ : Text->Scale + COORD_TO_MIL (Delta);
if (TEST_FLAG (LOCKFLAG, Text))
return (NULL);
@@ -914,8 +914,8 @@ ChangeElementSize (ElementTypePtr Element)
static void *
ChangeElementNameSize (ElementTypePtr Element)
{
- int value = (Absolute != 0 ? DESCRIPTION_TEXT (Element).Scale : 0) +
- (Absolute != 0 ? Absolute : Delta) * 100 / FONT_CAPHEIGHT;
+ int value = Absolute ? COORD_TO_MIL (Absolute)
+ : DESCRIPTION_TEXT (Element).Scale + COORD_TO_MIL (Delta);
if (TEST_FLAG (LOCKFLAG, &Element->Name[0]))
return (NULL);
commit 6be2f4a159accc28c04652eb8fd3b0b9467487a6
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Configure layer selector to only accept left-clicks
Suggested by Kai-Martin Knaak, seconded by me.
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index 2c5d0e5..dd81dad 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -176,6 +176,11 @@ button_press_cb (GHidLayerSelector *ls, GdkEventButton *event)
* layer, which will happen if we let this event propagate. */
GtkTreeViewColumn *column;
GtkTreePath *path;
+
+ /* Ignore all but left-clicks */
+ if (event->button != 1)
+ return TRUE;
+
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (ls),
event->x, event->y,
&path, &column, NULL, NULL))
|
|
From: <gi...@gp...> - 2011-08-30 19:02:14
|
The branch, master has been updated
via dd80b3287ec84e4884e6bcf29f168f5fcef1aa73 (commit)
via e66a637ce9aaab6946ba9c36b9bcb839d107a821 (commit)
via 155a29d26c462a51473cc5b24215560020cfa69d (commit)
via 9345c9015e4a3fb23914d4eea65b39dde7d4f6ac (commit)
via 1b98f800696dfcf9f7d6d722612fdd47ea252820 (commit)
via d602d724421312816465777e15cdffc55d394066 (commit)
from 4082cf886a5d65464b8e3e36a3724c5142adb92e (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 | 76 ++++++++++++++++++++-----------------
src/hid/gtk/ghid-layer-selector.h | 1 -
src/hid/gtk/gui-command-window.c | 6 +++
src/hid/gtk/gui-top-window.c | 12 +++---
4 files changed, 53 insertions(+), 42 deletions(-)
=================
Commit Messages
=================
commit dd80b3287ec84e4884e6bcf29f168f5fcef1aa73
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Fix invalid free of ~/.pcb/filename path in gui-top-window.c
:100644 100644 c292660... e0e5eec... M src/hid/gtk/gui-top-window.c
commit e66a637ce9aaab6946ba9c36b9bcb839d107a821
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
minor: fix comment and forward declaration in ghid-layer-selector
:100644 100644 b51a0ec... 2c5d0e5... M src/hid/gtk/ghid-layer-selector.c
:100644 100644 10355a7... 887d6de... M src/hid/gtk/ghid-layer-selector.h
commit 155a29d26c462a51473cc5b24215560020cfa69d
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Remove default layer selection from ghid-layer-selector.c
Having the layer selector select its own first layer is not
needed - pcb does this for us, after making the widget. It's
not the sort of decision a widget should be making on its own,
anyway.
:100644 100644 d0a3cbf... b51a0ec... M src/hid/gtk/ghid-layer-selector.c
commit 9345c9015e4a3fb23914d4eea65b39dde7d4f6ac
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Use g_signal_handler_block instead of flags in ghid-layer-selector.c
Thanks to Peter C. for this code-cleanliness tip. Now the two
layer-selection interfaces (menu button and selector widget)
set each other's GUI state but do not raise any signals past
the original.
:100644 100644 f9d1505... d0a3cbf... M src/hid/gtk/ghid-layer-selector.c
commit 1b98f800696dfcf9f7d6d722612fdd47ea252820
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Add missing free_ldata() in ghid-layer-selector.c
:100644 100644 582fe67... f9d1505... M src/hid/gtk/ghid-layer-selector.c
commit d602d724421312816465777e15cdffc55d394066
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Disable layer selector's GtkAccelGroup while in command mode
:100644 100644 1728bd3... 3701853... M src/hid/gtk/gui-command-window.c
=========
Changes
=========
commit dd80b3287ec84e4884e6bcf29f168f5fcef1aa73
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Fix invalid free of ~/.pcb/filename path in gui-top-window.c
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index c292660..e0e5eec 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -2068,10 +2068,10 @@ ghid_check_special_key (const char *accel, GtkAction *action,
}
/*! \brief Finds the gpcb-menu.res file */
-const char *
+char *
get_menu_filename (void)
{
- const char *rv = NULL;
+ char *rv = NULL;
char *home_pcbmenu = NULL;
/* homedir is set by the core */
@@ -2085,20 +2085,19 @@ get_menu_filename (void)
Message (_("Warning: could not determine home directory\n"));
if (access ("gpcb-menu.res", R_OK) == 0)
- rv = "gpcb-menu.res";
+ rv = strdup ("gpcb-menu.res");
else if (home_pcbmenu != NULL && (access (home_pcbmenu, R_OK) == 0) )
rv = home_pcbmenu;
else if (access (pcbmenu_path, R_OK) == 0)
- rv = pcbmenu_path;
+ rv = strdup (pcbmenu_path);
- free (home_pcbmenu);
return rv;
}
static GtkWidget *
ghid_load_menus (void)
{
- const char *filename;
+ char *filename;
const Resource *r = 0, *bir;
const Resource *mr;
GtkWidget *menu_bar = NULL;
@@ -2129,6 +2128,7 @@ ghid_load_menus (void)
Message ("Using default menus\n");
r = bir;
}
+ free (filename);
mr = resource_subres (r, "MainMenu");
if (!mr)
commit e66a637ce9aaab6946ba9c36b9bcb839d107a821
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
minor: fix comment and forward declaration in ghid-layer-selector
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index b51a0ec..2c5d0e5 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -2,9 +2,8 @@
* \brief Implementation of GHidLayerSelector widget
* \par Description
* This widget is the layer selector on the left side of the Gtk
- * GUI. It also describes (in XML) the relevant sections of the
- * menu for layer selection and visibility toggling, and makes
- * sure these stay in sync.
+ * GUI. It also builds the relevant sections of the menu for layer
+ * selection and visibility toggling, and keeps these in sync.
*/
#include <glib.h>
diff --git a/src/hid/gtk/ghid-layer-selector.h b/src/hid/gtk/ghid-layer-selector.h
index 10355a7..887d6de 100644
--- a/src/hid/gtk/ghid-layer-selector.h
+++ b/src/hid/gtk/ghid-layer-selector.h
@@ -25,7 +25,6 @@ void ghid_layer_selector_add_layer (GHidLayerSelector *ls,
const gchar *color_string,
gboolean visible,
gboolean activatable);
-GtkAccelGroup *ghid_layer_selector_get_accel_group (GHidLayerSelector *ls);
gint ghid_layer_selector_install_pick_items (GHidLayerSelector *ls,
GtkMenuShell *shell, gint pos);
commit 155a29d26c462a51473cc5b24215560020cfa69d
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Remove default layer selection from ghid-layer-selector.c
Having the layer selector select its own first layer is not
needed - pcb does this for us, after making the widget. It's
not the sort of decision a widget should be making on its own,
anyway.
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index d0a3cbf..b51a0ec 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -531,11 +531,6 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
new_layer->view_action = gtk_toggle_action_new (vname, name, NULL, NULL);
gtk_toggle_action_set_active (new_layer->view_action, visible);
- /* Select new layer, if we need */
- if (activatable
- && !gtk_tree_selection_get_selected (ls->selection, NULL, NULL))
- gtk_tree_selection_select_iter (ls->selection, &iter);
-
/* Determine keyboard accelerators */
for (i = 0; i < 20; ++i)
if (ls->accel_available[i])
commit 9345c9015e4a3fb23914d4eea65b39dde7d4f6ac
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Use g_signal_handler_block instead of flags in ghid-layer-selector.c
Thanks to Peter C. for this code-cleanliness tip. Now the two
layer-selection interfaces (menu button and selector widget)
set each other's GUI state but do not raise any signals past
the original.
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index f9d1505..d0a3cbf 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -22,7 +22,9 @@
#define INITIAL_ACTION_MAX 40
/* Forward dec'ls */
+struct _layer;
static void ghid_layer_selector_finalize (GObject *object);
+static void menu_pick_cb (GtkRadioAction *action, struct _layer *ldata);
/*! \brief Signals exposed by the widget */
enum {
@@ -64,7 +66,8 @@ struct _GHidLayerSelector
gboolean accel_available[20];
gboolean last_activatable;
- gboolean prevent_recursion;
+
+ gulong selection_changed_sig_id;
};
struct _GHidLayerSelectorClass
@@ -78,6 +81,7 @@ struct _GHidLayerSelectorClass
struct _layer
{
gint accel_index; /* Index into ls->accel_available */
+ gulong pick_sig_id;
GtkWidget *pick_item;
GtkWidget *view_item;
GtkToggleAction *view_action;
@@ -188,22 +192,27 @@ button_press_cb (GHidLayerSelector *ls, GdkEventButton *event)
return FALSE;
}
-/*! \brief Callback for layer selection change: sync menu */
+/*! \brief Callback for layer selection change: sync menu, emit signal */
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 user_id;
struct _layer *ldata;
gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store), &iter,
STRUCT_COL, &ldata, USER_ID_COL, &user_id, -1);
+
if (ldata && ldata->pick_action)
- gtk_radio_action_set_current_value (ldata->pick_action, user_id);
+ {
+ g_signal_handler_block (ldata->pick_action, ldata->pick_sig_id);
+ gtk_radio_action_set_current_value (ldata->pick_action, user_id);
+ g_signal_handler_unblock (ldata->pick_action, ldata->pick_sig_id);
+ }
+ g_signal_emit (ls, ghid_layer_selector_signals[SELECT_LAYER_SIGNAL],
+ 0, user_id);
}
- ls->prevent_recursion = FALSE;
}
/*! \brief Callback for menu actions: sync layer selection list, emit signal */
@@ -230,20 +239,26 @@ menu_view_cb (GtkToggleAction *action, struct _layer *ldata)
static void
menu_pick_cb (GtkRadioAction *action, struct _layer *ldata)
{
- GHidLayerSelector *ls;
- GtkTreeModel *model = gtk_tree_row_reference_get_model (ldata->rref);
- GtkTreePath *path = gtk_tree_row_reference_get_path (ldata->rref);
- GtkTreeIter iter;
- gint user_id;
+ /* We only care about the activation signal (as opposed to deactivation).
+ * A row we are /deactivating/ might not even exist anymore! */
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+ {
+ GHidLayerSelector *ls;
+ GtkTreeModel *model = gtk_tree_row_reference_get_model (ldata->rref);
+ GtkTreePath *path = gtk_tree_row_reference_get_path (ldata->rref);
+ GtkTreeIter iter;
+ gint user_id;
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter, USER_ID_COL, &user_id, -1);
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter, USER_ID_COL, &user_id, -1);
- ls = g_object_get_data (G_OBJECT (model), "layer-selector");
- 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);
+ ls = g_object_get_data (G_OBJECT (model), "layer-selector");
+ g_signal_handler_block (ls->selection, ls->selection_changed_sig_id);
+ gtk_tree_selection_select_path (ls->selection, path);
+ g_signal_handler_unblock (ls->selection, ls->selection_changed_sig_id);
+ g_signal_emit (ls, ghid_layer_selector_signals[SELECT_LAYER_SIGNAL],
+ 0, user_id);
+ }
}
/* CONSTRUCTOR */
@@ -369,7 +384,6 @@ ghid_layer_selector_new (void)
ls->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ls));
ls->accel_group = gtk_accel_group_new ();
ls->action_group = gtk_action_group_new ("LayerSelector");
- ls->prevent_recursion = FALSE;
ls->n_actions = 0;
for (i = 0; i < 20; ++i)
ls->accel_available[i] = TRUE;
@@ -384,8 +398,9 @@ ghid_layer_selector_new (void)
g_object_set_data (G_OBJECT (ls->list_store), "layer-selector", ls);
g_signal_connect (ls, "button_press_event",
G_CALLBACK (button_press_cb), NULL);
- g_signal_connect (ls->selection, "changed",
- G_CALLBACK (selection_changed_cb), ls);
+ ls->selection_changed_sig_id =
+ g_signal_connect (ls->selection, "changed",
+ G_CALLBACK (selection_changed_cb), ls);
g_object_ref (ls->accel_group);
@@ -543,8 +558,9 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
action,
accel1);
gtk_action_connect_accelerator (action);
- g_signal_connect (G_OBJECT (action), "activate",
- G_CALLBACK (menu_pick_cb), new_layer);
+ new_layer->pick_sig_id =
+ g_signal_connect (G_OBJECT (action), "activate",
+ G_CALLBACK (menu_pick_cb), new_layer);
}
gtk_action_set_accel_group (GTK_ACTION (new_layer->view_action),
ls->accel_group);
commit 1b98f800696dfcf9f7d6d722612fdd47ea252820
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Add missing free_ldata() in ghid-layer-selector.c
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index 582fe67..f9d1505 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -295,11 +295,7 @@ ghid_layer_selector_finalize (GObject *object)
struct _layer *ldata;
gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store),
&iter, STRUCT_COL, &ldata, -1);
-
- g_object_unref (G_OBJECT (ldata->pick_action));
- g_object_unref (G_OBJECT (ldata->view_action));
- gtk_tree_row_reference_free (ldata->rref);
- g_free (ldata);
+ free_ldata (ls, ldata);
}
while (gtk_tree_model_iter_next (GTK_TREE_MODEL (ls->list_store), &iter));
commit d602d724421312816465777e15cdffc55d394066
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Disable layer selector's GtkAccelGroup while in command mode
diff --git a/src/hid/gtk/gui-command-window.c b/src/hid/gtk/gui-command-window.c
index 1728bd3..3701853 100644
--- a/src/hid/gtk/gui-command-window.c
+++ b/src/hid/gtk/gui-command-window.c
@@ -417,6 +417,9 @@ ghid_command_entry_get (gchar * prompt, gchar * command)
gtk_window_remove_accel_group (GTK_WINDOW (out->top_window),
ghid_main_menu_get_accel_group
(GHID_MAIN_MENU (ghidgui->menu_bar)));
+ gtk_window_remove_accel_group (GTK_WINDOW (out->top_window),
+ ghid_layer_selector_get_accel_group
+ (GHID_LAYER_SELECTOR (ghidgui->layer_selector)));
ghid_interface_input_signals_disconnect ();
ghid_interface_set_sensitive (FALSE);
gtk_widget_grab_focus (GTK_WIDGET (ghidgui->command_entry));
@@ -440,6 +443,9 @@ ghid_command_entry_get (gchar * prompt, gchar * command)
gtk_window_add_accel_group (GTK_WINDOW (out->top_window),
ghid_main_menu_get_accel_group
(GHID_MAIN_MENU (ghidgui->menu_bar)));
+ gtk_window_add_accel_group (GTK_WINDOW (out->top_window),
+ ghid_layer_selector_get_accel_group
+ (GHID_LAYER_SELECTOR (ghidgui->layer_selector)));
/* Restore the status line label and give focus back to the drawing area
*/
|
|
From: <gi...@gp...> - 2011-08-29 23:23:12
|
The branch, master has been updated
via 4082cf886a5d65464b8e3e36a3724c5142adb92e (commit)
via 13f48370d78ebbd886c4a56f5d86747d0da61cf9 (commit)
from 026a0f33b0257e4d17fd9f1a09ef18664576837d (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/draw.c | 26 +++++++++++++-------------
src/misc.c | 2 +-
src/misc.h | 2 +-
3 files changed, 15 insertions(+), 15 deletions(-)
=================
Commit Messages
=================
commit 4082cf886a5d65464b8e3e36a3724c5142adb92e
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Add const qualifiers to some BoxType *drawn_area parameters
:100644 100644 e0da9a9... f8db2ba... M src/draw.c
commit 13f48370d78ebbd886c4a56f5d86747d0da61cf9
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
misc.c: Add const qualifier to BoxType * parameter passed to CountHoles
:100644 100644 f6e01c5... ee7e26d... M src/misc.c
:100644 100644 f625cbc... 49246f1... M src/misc.h
=========
Changes
=========
commit 4082cf886a5d65464b8e3e36a3724c5142adb92e
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Add const qualifiers to some BoxType *drawn_area parameters
diff --git a/src/draw.c b/src/draw.c
index e0da9a9..f8db2ba 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -81,15 +81,15 @@ static bool doing_assy = false;
/* ---------------------------------------------------------------------------
* some local prototypes
*/
-static void DrawEverything (BoxTypePtr);
+static void DrawEverything (const BoxType *);
static void DrawPPV (int group, const BoxType *);
static void DrawLayerGroup (int, const BoxType *);
static void AddPart (void *);
static void SetPVColor (PinTypePtr, int);
static void DrawEMark (ElementTypePtr, Coord, Coord, bool);
-static void DrawMask (int side, BoxType *);
-static void DrawPaste (int side, BoxType *);
-static void DrawRats (BoxType *);
+static void DrawMask (int side, const BoxType *);
+static void DrawPaste (int side, const BoxType *);
+static void DrawRats (const BoxType *);
static void DrawSilk (int side, const BoxType *);
/*--------------------------------------------------------------------------------------
@@ -443,7 +443,7 @@ hole_callback (const BoxType * b, void *cl)
}
static void
-DrawHoles (bool draw_plated, bool draw_unplated, BoxType *drawn_area)
+DrawHoles (bool draw_plated, bool draw_unplated, const BoxType *drawn_area)
{
int plated = -1;
@@ -623,7 +623,7 @@ PrintAssembly (int side, const BoxType * drawn_area)
* initializes some identifiers for a new zoom factor and redraws whole screen
*/
static void
-DrawEverything (BoxTypePtr drawn_area)
+DrawEverything (const BoxType *drawn_area)
{
int i, ngroups, side;
int component, solder;
@@ -970,7 +970,7 @@ DrawSilk (int side, const BoxType * drawn_area)
static void
-DrawMaskBoardArea (int mask_type, BoxType *screen)
+DrawMaskBoardArea (int mask_type, const BoxType *drawn_area)
{
/* Skip the mask drawing if the GUI doesn't want this type */
if ((mask_type == HID_MASK_BEFORE && !gui->poly_before) ||
@@ -979,18 +979,18 @@ DrawMaskBoardArea (int mask_type, BoxType *screen)
gui->use_mask (mask_type);
gui->set_color (Output.fgGC, PCB->MaskColor);
- if (screen == NULL)
+ if (drawn_area == NULL)
gui->fill_rect (Output.fgGC, 0, 0, PCB->MaxWidth, PCB->MaxHeight);
else
- gui->fill_rect (Output.fgGC, screen->X1, screen->Y1,
- screen->X2, screen->Y2);
+ gui->fill_rect (Output.fgGC, drawn_area->X1, drawn_area->Y1,
+ drawn_area->X2, drawn_area->Y2);
}
/* ---------------------------------------------------------------------------
* draws solder mask layer - this will cover nearly everything
*/
static void
-DrawMask (int side, BoxType * screen)
+DrawMask (int side, const BoxType *screen)
{
int thin = TEST_FLAG(THINDRAWFLAG, PCB) || TEST_FLAG(THINDRAWPOLYFLAG, PCB);
@@ -1019,7 +1019,7 @@ DrawMask (int side, BoxType * screen)
* draws solder paste layer for a given side of the board
*/
static void
-DrawPaste (int side, BoxType *drawn_area)
+DrawPaste (int side, const BoxType *drawn_area)
{
gui->set_color (Output.fgGC, PCB->ElementColor);
ALLPAD_LOOP (PCB->Data);
@@ -1036,7 +1036,7 @@ DrawPaste (int side, BoxType *drawn_area)
}
static void
-DrawRats (BoxTypePtr drawn_area)
+DrawRats (const BoxType *drawn_area)
{
/*
* XXX lesstif allows positive AND negative drawing in HID_MASK_CLEAR.
commit 13f48370d78ebbd886c4a56f5d86747d0da61cf9
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
misc.c: Add const qualifier to BoxType * parameter passed to CountHoles
diff --git a/src/misc.c b/src/misc.c
index f6e01c5..ee7e26d 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -706,7 +706,7 @@ hole_counting_callback (const BoxType * b, void *cl)
* within_area.
*/
void
-CountHoles (int *plated, int *unplated, BoxType *within_area)
+CountHoles (int *plated, int *unplated, const BoxType *within_area)
{
HoleCountStruct hcs = {0, 0};
diff --git a/src/misc.h b/src/misc.h
index f625cbc..49246f1 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -59,7 +59,7 @@ bool IsLayerEmpty (LayerTypePtr);
bool IsLayerNumEmpty (int);
bool IsLayerGroupEmpty (int);
bool IsPasteEmpty (int);
-void CountHoles (int *, int *, BoxType *);
+void CountHoles (int *, int *, const BoxType *);
BoxTypePtr GetDataBoundingBox (DataTypePtr);
void CenterDisplay (Coord, Coord);
void SetFontInfo (FontTypePtr);
|
|
From: <gi...@gp...> - 2011-08-29 23:07:51
|
The branch, master has been updated
via 026a0f33b0257e4d17fd9f1a09ef18664576837d (commit)
via daf112a1100d05ae5cb9adac41f76d123a597569 (commit)
via 3c01bd38cb59922692408b71cd5d77892dbe6ade (commit)
via 08aa31ec144456684b4e4230425be8f220551e44 (commit)
from 76138e5779cc09453b458bc222a63d2d44ab6343 (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/draw.c | 31 +++++++++++--------------------
src/hid/gerber/gerber.c | 1 +
src/hid/ps/eps.c | 1 +
src/hid/ps/ps.c | 1 +
4 files changed, 14 insertions(+), 20 deletions(-)
=================
Commit Messages
=================
commit 026a0f33b0257e4d17fd9f1a09ef18664576837d
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Fold DrawLayerCommon() into DrawLayer()
Since the last commit, DrawLayer() just calls DrawLayerCommon with the
"clear_pins" argument set to true. The only other DrawLayerCommon caller
passes clear_pins as true, so having functions is redundant.
:100644 100644 fb29826... e0da9a9... M src/draw.c
commit daf112a1100d05ae5cb9adac41f76d123a597569
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
DrawLayer(): Pass true to clear_pins of DrawLayerCommon
This should not affect any rendering. If the check planes flag is set,
we should only draw polygons, nothing more. Only a handful of cases draw
layers via this code-path, and in all but the exporter cases, they are
not called if CHECKPLANES is set.
The exporters which call DrawLayer explicitly clear the CHECKPLANES flag
(since commit 3c01bd38cb59922692408b71cd5d77892dbe6ade), so nothing
should be affected by this argument change.
:100644 100644 83080b3... fb29826... M src/draw.c
commit 3c01bd38cb59922692408b71cd5d77892dbe6ade
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/{ps,eps,gerber}: Clear CHECKPLANESFLAG before exporting
Ensure we are in a sensible view state before exporting. This
update those HIDs which cleared other similar renedering flags
before exporting to include the CHECKPLANES flag.
:100644 100644 4a2d233... 1539f88... M src/hid/gerber/gerber.c
:100644 100644 560f897... a406f38... M src/hid/ps/eps.c
:100644 100644 87202f6... 8e29fd5... M src/hid/ps/ps.c
commit 08aa31ec144456684b4e4230425be8f220551e44
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Have DrawLayerGroup() call DrawPPV for non-gui exporters
This means DrawLayerGroup() can have a void return type as most of
the other drawing functions, and makes things a little neater.
Only the GUI renderers special case the pin / pad / via to wait
until a later rendering oass than the layers they reside on.
:100644 100644 1bbbca0... 83080b3... M src/draw.c
=========
Changes
=========
commit 026a0f33b0257e4d17fd9f1a09ef18664576837d
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Fold DrawLayerCommon() into DrawLayer()
Since the last commit, DrawLayer() just calls DrawLayerCommon with the
"clear_pins" argument set to true. The only other DrawLayerCommon caller
passes clear_pins as true, so having functions is redundant.
diff --git a/src/draw.c b/src/draw.c
index fb29826..e0da9a9 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -1072,18 +1072,15 @@ text_callback (const BoxType * b, void *cl)
return 1;
}
-/* ---------------------------------------------------------------------------
- * draws one non-copper layer
- */
void
-DrawLayerCommon (LayerTypePtr Layer, const BoxType * screen, bool clear_pins)
+DrawLayer (LayerTypePtr Layer, const BoxType * screen)
{
struct poly_info info = {screen, Layer};
/* print the non-clearing polys */
r_search (Layer->polygon_tree, screen, NULL, poly_callback, &info);
- if (clear_pins && TEST_FLAG (CHECKPLANESFLAG, PCB))
+ if (TEST_FLAG (CHECKPLANESFLAG, PCB))
return;
/* draw all visible lines this layer */
@@ -1110,12 +1107,6 @@ DrawLayerCommon (LayerTypePtr Layer, const BoxType * screen, bool clear_pins)
}
}
-void
-DrawLayer (LayerTypePtr Layer, const BoxType * screen)
-{
- DrawLayerCommon (Layer, screen, true);
-}
-
/* ---------------------------------------------------------------------------
* draws one layer group. If the exporter is not a GUI,
* also draws the pins / pads / vias in this layer group.
@@ -1137,7 +1128,7 @@ DrawLayerGroup (int group, const BoxType *drawn_area)
strcmp (Layer->Name, "route") == 0)
rv = 0;
if (layernum < max_copper_layer && Layer->On)
- DrawLayerCommon (Layer, drawn_area, true);
+ DrawLayer (Layer, drawn_area);
}
if (n_entries > 1)
rv = 1;
commit daf112a1100d05ae5cb9adac41f76d123a597569
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
DrawLayer(): Pass true to clear_pins of DrawLayerCommon
This should not affect any rendering. If the check planes flag is set,
we should only draw polygons, nothing more. Only a handful of cases draw
layers via this code-path, and in all but the exporter cases, they are
not called if CHECKPLANES is set.
The exporters which call DrawLayer explicitly clear the CHECKPLANES flag
(since commit 3c01bd38cb59922692408b71cd5d77892dbe6ade), so nothing
should be affected by this argument change.
diff --git a/src/draw.c b/src/draw.c
index 83080b3..fb29826 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -1113,7 +1113,7 @@ DrawLayerCommon (LayerTypePtr Layer, const BoxType * screen, bool clear_pins)
void
DrawLayer (LayerTypePtr Layer, const BoxType * screen)
{
- DrawLayerCommon (Layer, screen, false);
+ DrawLayerCommon (Layer, screen, true);
}
/* ---------------------------------------------------------------------------
commit 3c01bd38cb59922692408b71cd5d77892dbe6ade
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/{ps,eps,gerber}: Clear CHECKPLANESFLAG before exporting
Ensure we are in a sensible view state before exporting. This
update those HIDs which cleared other similar renedering flags
before exporting to include the CHECKPLANES flag.
diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c
index 4a2d233..1539f88 100644
--- a/src/hid/gerber/gerber.c
+++ b/src/hid/gerber/gerber.c
@@ -521,6 +521,7 @@ gerber_do_export (HID_Attr_Val * options)
save_thindraw = PCB->Flags;
CLEAR_FLAG(THINDRAWFLAG, PCB);
CLEAR_FLAG(THINDRAWPOLYFLAG, PCB);
+ CLEAR_FLAG(CHECKPLANESFLAG, PCB);
if (!options)
{
diff --git a/src/hid/ps/eps.c b/src/hid/ps/eps.c
index 560f897..a406f38 100644
--- a/src/hid/ps/eps.c
+++ b/src/hid/ps/eps.c
@@ -198,6 +198,7 @@ eps_hid_export_to_file (FILE * the_file, HID_Attr_Val * options)
save_thindraw = PCB->Flags;
CLEAR_FLAG(THINDRAWFLAG, PCB);
CLEAR_FLAG(THINDRAWPOLYFLAG, PCB);
+ CLEAR_FLAG(CHECKPLANESFLAG, PCB);
f = the_file;
diff --git a/src/hid/ps/ps.c b/src/hid/ps/ps.c
index 87202f6..8e29fd5 100644
--- a/src/hid/ps/ps.c
+++ b/src/hid/ps/ps.c
@@ -601,6 +601,7 @@ ps_hid_export_to_file (FILE * the_file, HID_Attr_Val * options)
save_thindraw = PCB->Flags;
CLEAR_FLAG(THINDRAWFLAG, PCB);
CLEAR_FLAG(THINDRAWPOLYFLAG, PCB);
+ CLEAR_FLAG(CHECKPLANESFLAG, PCB);
global.f = the_file;
global.drill_helper = options[HA_drillhelper].int_value;
commit 08aa31ec144456684b4e4230425be8f220551e44
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Have DrawLayerGroup() call DrawPPV for non-gui exporters
This means DrawLayerGroup() can have a void return type as most of
the other drawing functions, and makes things a little neater.
Only the GUI renderers special case the pin / pad / via to wait
until a later rendering oass than the layers they reside on.
diff --git a/src/draw.c b/src/draw.c
index 1bbbca0..83080b3 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -83,7 +83,7 @@ static bool doing_assy = false;
*/
static void DrawEverything (BoxTypePtr);
static void DrawPPV (int group, const BoxType *);
-static int DrawLayerGroup (int, const BoxType *);
+static void DrawLayerGroup (int, const BoxType *);
static void AddPart (void *);
static void SetPVColor (PinTypePtr, int);
static void DrawEMark (ElementTypePtr, Coord, Coord, bool);
@@ -612,7 +612,6 @@ PrintAssembly (int side, const BoxType * drawn_area)
doing_assy = true;
gui->set_draw_faded (Output.fgGC, 1);
DrawLayerGroup (side_group, drawn_area);
- DrawPPV (side_group, drawn_area);
gui->set_draw_faded (Output.fgGC, 0);
/* draw package */
@@ -677,8 +676,7 @@ DrawEverything (BoxTypePtr drawn_area)
if (gui->set_layer (0, group, 0))
{
- if (DrawLayerGroup (group, drawn_area) && !gui->gui)
- DrawPPV (group, drawn_area);
+ DrawLayerGroup (group, drawn_area);
gui->end_layer ();
}
}
@@ -1119,10 +1117,10 @@ DrawLayer (LayerTypePtr Layer, const BoxType * screen)
}
/* ---------------------------------------------------------------------------
- * draws one layer group. Returns non-zero if pins and pads should be
- * drawn with this group.
+ * draws one layer group. If the exporter is not a GUI,
+ * also draws the pins / pads / vias in this layer group.
*/
-static int
+static void
DrawLayerGroup (int group, const BoxType *drawn_area)
{
int i, rv = 1;
@@ -1143,7 +1141,9 @@ DrawLayerGroup (int group, const BoxType *drawn_area)
}
if (n_entries > 1)
rv = 1;
- return rv;
+
+ if (rv && !gui->gui)
+ DrawPPV (group, drawn_area);
}
static void
|
|
From: <gi...@gp...> - 2011-08-29 22:26:42
|
The branch, master has been updated
via 76138e5779cc09453b458bc222a63d2d44ab6343 (commit)
from 2fecf3a75bdbc47f8317fa92f361444bb885d23d (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/gtkhid-main.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
=================
Commit Messages
=================
commit 76138e5779cc09453b458bc222a63d2d44ab6343
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove unused "button" parameter from Popup function.
Remove the dead code and comments refering to the fact the function's
second argument indicates a mouse button number.
:100644 100644 46a9347... 4d9fdbe... M src/hid/gtk/gtkhid-main.c
=========
Changes
=========
commit 76138e5779cc09453b458bc222a63d2d44ab6343
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove unused "button" parameter from Popup function.
Remove the dead code and comments refering to the fact the function's
second argument indicates a mouse button number.
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 46a9347..4d9fdbe 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -1928,8 +1928,7 @@ N_("Bring up the popup menu specified by @code{MenuName}.\n"
This just pops up the specified menu. The menu must have been defined
as a named subresource of the Popups resource in the menu resource
-file. If called as a response to a mouse button click, the mouse
-button number must be specified as the second argument.
+file.
%end-doc */
@@ -1938,16 +1937,10 @@ static int
Popup (int argc, char **argv, Coord x, Coord y)
{
GtkMenu *menu;
- guint button;
if (argc != 1 && argc != 2)
AFAIL (popup);
- if (argc == 1)
- button = 0;
- else
- button = atoi (argv[1]);
-
menu = ghid_main_menu_get_popup (GHID_MAIN_MENU (ghidgui->menu_bar), argv[0]);
if (! GTK_IS_MENU (menu))
{
|
|
From: <gi...@gp...> - 2011-08-29 21:46:24
|
The branch, master has been updated
via 2fecf3a75bdbc47f8317fa92f361444bb885d23d (commit)
via 4e63bedd088a4830735d9161c50da94f6784314f (commit)
via 8eddcff25d69024c5afe336f9f1ddab7e341df49 (commit)
via 707dd2dc7245cec6f15adc1ae1f735944602c561 (commit)
via d721448d923feaad8a7c89410caff698fa52d0fd (commit)
from 448a50d473e83f4202a70df36fcffe30373ffc38 (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/Makefile.am | 6 +-
src/hid/gtk/ghid-layer-selector.c | 432 ++++++++------
src/hid/gtk/ghid-layer-selector.h | 10 +-
src/hid/gtk/ghid-main-menu.c | 559 +++++++++++++++++
src/hid/gtk/ghid-main-menu.h | 42 ++
src/hid/gtk/gtkhid-main.c | 18 +-
src/hid/gtk/gui-command-window.c | 8 +-
src/hid/gtk/gui-output-events.c | 8 +-
src/hid/gtk/gui-top-window.c | 1235 ++++---------------------------------
src/hid/gtk/gui.h | 14 +-
10 files changed, 1001 insertions(+), 1331 deletions(-)
create mode 100644 src/hid/gtk/ghid-main-menu.c
create mode 100644 src/hid/gtk/ghid-main-menu.h
=================
Commit Messages
=================
commit 2fecf3a75bdbc47f8317fa92f361444bb885d23d
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Link GHidLayerSelector and GHidMainMenu
Layer visibility-toggle and selection menu items now appear
in the main menu. Accelerators work correctly and are reassigned
on deletion/addition of layers to simulate the old behavior.
:100644 100644 684f061... 582fe67... M src/hid/gtk/ghid-layer-selector.c
:100644 100644 bfeffe9... 10355a7... M src/hid/gtk/ghid-layer-selector.h
:100644 100644 945b522... 5693c56... M src/hid/gtk/ghid-main-menu.c
:100644 100644 3b8c728... d667e34... M src/hid/gtk/ghid-main-menu.h
:100644 100644 b2d9c22... c292660... M src/hid/gtk/gui-top-window.c
commit 4e63bedd088a4830735d9161c50da94f6784314f
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Clean up layer data handling in ghid-layer-selector.c
:100644 100644 bd57f57... 684f061... M src/hid/gtk/ghid-layer-selector.c
commit 8eddcff25d69024c5afe336f9f1ddab7e341df49
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Give GHidLayerSelector an internal layer structure
Before we had various arrays to resize and index; now each
row has a structure associated with it, that is easier to
access and maintain.
:100644 100644 7f11f7f... bd57f57... M src/hid/gtk/ghid-layer-selector.c
commit 707dd2dc7245cec6f15adc1ae1f735944602c561
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Replace gtk UI manager with GHidMainMenu widget
This commit replaces the old UI manager with a customize gtk
widget that builds menus directly from a resource tree. This
eliminates the translate-to-XML step, the ugly hacks used to
access individual actions, and all the associated manual
memory management.
This will also give us the ability to have more dynamic menus,
in particular layer lists without maximum capacities.
Layers and route styles are still not hooked into the menu.
This means that those accelerators DO NOT WORK. (This will
be fixed in a later commit.) Checkboxes have been replaced
with radio buttons where appropriate. There are now tearoffs
on the context-menu's submenus.
Other than that, there should be no user-visible changes. ;)
:100644 100644 0c9019d... 46a9347... M src/hid/gtk/gtkhid-main.c
:100644 100644 b08836e... 1728bd3... M src/hid/gtk/gui-command-window.c
:100644 100644 5929a37... b9c5ab3... M src/hid/gtk/gui-output-events.c
:100644 100644 b4dbcaa... b2d9c22... M src/hid/gtk/gui-top-window.c
:100644 100644 30ff593... e7e5f55... M src/hid/gtk/gui.h
commit d721448d923feaad8a7c89410caff698fa52d0fd
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Created ghid-main-menu.[ch]
Still need to hook up layer selector and route styles.
:100644 100644 4b66ac7... a9c51b2... M src/Makefile.am
:000000 100644 0000000... 945b522... A src/hid/gtk/ghid-main-menu.c
:000000 100644 0000000... 3b8c728... A src/hid/gtk/ghid-main-menu.h
=========
Changes
=========
commit 2fecf3a75bdbc47f8317fa92f361444bb885d23d
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Link GHidLayerSelector and GHidMainMenu
Layer visibility-toggle and selection menu items now appear
in the main menu. Accelerators work correctly and are reassigned
on deletion/addition of layers to simulate the old behavior.
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index 684f061..582fe67 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -56,10 +56,13 @@ struct _GHidLayerSelector
GtkTreeViewColumn *visibility_column;
GtkActionGroup *action_group;
+ GtkAccelGroup *accel_group;
GSList *radio_group;
int n_actions;
+ gboolean accel_available[20];
+
gboolean last_activatable;
gboolean prevent_recursion;
};
@@ -74,6 +77,9 @@ struct _GHidLayerSelectorClass
struct _layer
{
+ gint accel_index; /* Index into ls->accel_available */
+ GtkWidget *pick_item;
+ GtkWidget *view_item;
GtkToggleAction *view_action;
GtkRadioAction *pick_action;
GtkTreeRowReference *rref;
@@ -102,6 +108,8 @@ free_ldata (GHidLayerSelector *ls, struct _layer *ldata)
g_object_unref (G_OBJECT (ldata->view_action));
}
gtk_tree_row_reference_free (ldata->rref);
+ if (ldata->accel_index >= 0)
+ ls->accel_available[ldata->accel_index] = TRUE;
g_free (ldata);
}
@@ -278,6 +286,7 @@ ghid_layer_selector_finalize (GObject *object)
GtkTreeIter iter;
GHidLayerSelector *ls = (GHidLayerSelector *) object;
+ g_object_unref (ls->accel_group);
g_object_unref (ls->action_group);
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ls->list_store), &iter);
@@ -334,6 +343,7 @@ ghid_layer_selector_get_type (void)
GtkWidget *
ghid_layer_selector_new (void)
{
+ int i;
GtkCellRenderer *renderer1 = ghid_cell_renderer_visibility_new ();
GtkCellRenderer *renderer2 = gtk_cell_renderer_text_new ();
GtkTreeViewColumn *opacity_col =
@@ -361,9 +371,12 @@ ghid_layer_selector_new (void)
ls->last_activatable = TRUE;
ls->visibility_column = opacity_col;
ls->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ls));
+ ls->accel_group = gtk_accel_group_new ();
ls->action_group = gtk_action_group_new ("LayerSelector");
ls->prevent_recursion = FALSE;
ls->n_actions = 0;
+ for (i = 0; i < 20; ++i)
+ ls->accel_available[i] = TRUE;
gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (ls),
tree_view_separator_func,
@@ -378,7 +391,7 @@ ghid_layer_selector_new (void)
g_signal_connect (ls->selection, "changed",
G_CALLBACK (selection_changed_cb), ls);
- g_object_ref (ls->action_group);
+ g_object_ref (ls->accel_group);
return GTK_WIDGET (ls);
}
@@ -409,11 +422,12 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
gboolean activatable)
{
struct _layer *new_layer = NULL;
- gchar *pname, *vname, *paccel, *vaccel;
+ gchar *pname, *vname;
gboolean new_iter = TRUE;
gboolean last_activatable = TRUE;
GtkTreePath *path;
GtkTreeIter iter;
+ int i;
/* Look for existing layer with this ID */
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ls->list_store), &iter))
@@ -484,24 +498,6 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
/* -- Setup new actions -- */
vname = g_strdup_printf ("LayerView%d", ls->n_actions);
pname = g_strdup_printf ("LayerPick%d", ls->n_actions);
- vaccel = NULL;
- paccel = NULL;
-
- /* Determine keyboard accelerators */
- if (ls->n_actions < 10)
- {
- /* Map 1-0 to actions 1-10 (with '0' meaning 10) */
- int i = (ls->n_actions + 1) % 10;
- vaccel = g_strdup_printf ("<Ctrl>%d", i);
- paccel = g_strdup_printf ("%d", i);
- }
- else
- {
- /* Map 1-0 to actions 11-20 (with '0' meaning 10) */
- int i = (ls->n_actions + 1) % 10;
- vaccel = g_strdup_printf ("<Alt><Ctrl>%d", i);
- paccel = g_strdup_printf ("<Alt>%d", i);
- }
/* Create row reference for actions */
path = gtk_tree_model_get_path (GTK_TREE_MODEL (ls->list_store), &iter);
@@ -516,12 +512,6 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
= gtk_radio_action_new (pname, name, NULL, NULL, user_id);
gtk_radio_action_set_group (new_layer->pick_action, ls->radio_group);
ls->radio_group = gtk_radio_action_get_group (new_layer->pick_action);
- gtk_action_group_add_action_with_accel
- (ls->action_group,
- GTK_ACTION (new_layer->pick_action),
- paccel);
- g_signal_connect (new_layer->pick_action, "toggled",
- G_CALLBACK (menu_pick_cb), new_layer);
}
else
new_layer->pick_action = NULL;
@@ -530,112 +520,148 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
new_layer->view_action = gtk_toggle_action_new (vname, name, NULL, NULL);
gtk_toggle_action_set_active (new_layer->view_action, visible);
- gtk_action_group_add_action_with_accel
- (ls->action_group,
- GTK_ACTION (new_layer->view_action),
- vaccel);
- g_signal_connect (new_layer->view_action, "toggled",
- G_CALLBACK (menu_view_cb), new_layer->rref);
-
-
/* Select new layer, if we need */
if (activatable
&& !gtk_tree_selection_get_selected (ls->selection, NULL, NULL))
gtk_tree_selection_select_iter (ls->selection, &iter);
- /* cleanup */
- if (vaccel)
+ /* Determine keyboard accelerators */
+ for (i = 0; i < 20; ++i)
+ if (ls->accel_available[i])
+ break;
+ if (i < 20)
{
- g_free (vaccel);
- g_free (paccel);
+ /* Map 1-0 to actions 1-10 (with '0' meaning 10) */
+ gchar *accel1 = g_strdup_printf ("%s%d",
+ i < 10 ? "" : "<Alt>",
+ (i + 1) % 10);
+ gchar *accel2 = g_strdup_printf ("<Ctrl>%s%d",
+ i < 10 ? "" : "<Alt>",
+ (i + 1) % 10);
+
+ if (activatable)
+ {
+ GtkAction *action = GTK_ACTION (new_layer->pick_action);
+ gtk_action_set_accel_group (action, ls->accel_group);
+ gtk_action_group_add_action_with_accel (ls->action_group,
+ action,
+ accel1);
+ gtk_action_connect_accelerator (action);
+ g_signal_connect (G_OBJECT (action), "activate",
+ G_CALLBACK (menu_pick_cb), new_layer);
+ }
+ gtk_action_set_accel_group (GTK_ACTION (new_layer->view_action),
+ ls->accel_group);
+ 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);
+
+ ls->accel_available[i] = FALSE;
+ new_layer->accel_index = i;
+ g_free (accel2);
+ g_free (accel1);
}
+ else
+ {
+ new_layer->accel_index = -1;
+ }
+ /* finalize new layer struct */
+ new_layer->pick_item = new_layer->view_item = NULL;
+
+ /* cleanup */
g_free (vname);
g_free (pname);
ls->n_actions++;
}
-/*! \brief used internally */
-static gboolean
-pick_xml_foreach_func (GtkTreeModel *model, GtkTreePath *path,
- GtkTreeIter *iter, gpointer data)
-{
- struct _layer *ldata;
- GString *str = data;
-
- gtk_tree_model_get (model, iter, STRUCT_COL, &ldata, -1);
- if (ldata && ldata->pick_action)
- g_string_append_printf (str, "<menuitem action=\"%s\" />\n",
- gtk_action_get_name (GTK_ACTION (ldata->pick_action)));
- return FALSE;
-}
-/*! \brief used internally */
-static gboolean
-view_xml_foreach_func (GtkTreeModel *model, GtkTreePath *path,
- GtkTreeIter *iter, gpointer data)
-{
- struct _layer *ldata;
- GString *str = data;
-
- gtk_tree_model_get (model, iter, STRUCT_COL, &ldata, -1);
- if (ldata && ldata->view_action)
- g_string_append_printf (str, "<menuitem action=\"%s\" />\n",
- gtk_action_get_name (GTK_ACTION (ldata->view_action)));
- return FALSE;
-}
-
-/*! \brief Get the "Current Layer" menu description of a layer selector
+/*! \brief Install the "Current Layer" menu items for a layer selector
* \par Function Description
- * Returns the XML content used by Gtk in building the layer-selection
- * part of the menu. This is a radio-button list describing which layer
- * is active.
+ * Takes a menu shell and installs menu items for layer selection in
+ * the shell, at the given position.
*
- * \param [in] ls The selector to be acted on
+ * \param [in] ls The selector to be acted on
+ * \param [in] shell The menu to install the items in
+ * \param [in] pos The position in the menu to install items
*
- * \return the requested XML
+ * \return the number of items installed
*/
-gchar *
-ghid_layer_selector_get_pick_xml (GHidLayerSelector *ls)
+gint
+ghid_layer_selector_install_pick_items (GHidLayerSelector *ls,
+ GtkMenuShell *shell, gint pos)
{
- GString *str = g_string_new ("");
- gtk_tree_model_foreach (GTK_TREE_MODEL (ls->list_store),
- pick_xml_foreach_func, str);
- return g_string_free (str, FALSE);
+ GtkTreeIter iter;
+ int n = 0;
+
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ls->list_store), &iter);
+ do
+ {
+ struct _layer *ldata;
+ gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store),
+ &iter, STRUCT_COL, &ldata, -1);
+ if (ldata && ldata->pick_action)
+ {
+ GtkAction *action = GTK_ACTION (ldata->pick_action);
+ ldata->pick_item = gtk_action_create_menu_item (action);
+ gtk_menu_shell_insert (shell, ldata->pick_item, pos + n);
+ ++n;
+ }
+ }
+ while (gtk_tree_model_iter_next (GTK_TREE_MODEL (ls->list_store), &iter));
+
+ return n;
}
-/*! \brief Get the "Shown Layers" menu description of a layer selector
+/*! \brief Install the "Shown Layers" menu items for a layer selector
* \par Function Description
- * Returns the XML content used by Gtk in building the layer-selection
- * part of the menu. This is a toggle-button list describing which layer(s)
- * are visible.
+ * Takes a menu shell and installs menu items for layer selection in
+ * the shell, at the given position.
*
- * \param [in] ls The selector to be acted on
+ * \param [in] ls The selector to be acted on
+ * \param [in] shell The menu to install the items in
+ * \param [in] pos The position in the menu to install items
*
- * \return the requested XML
+ * \return the number of items installed
*/
-gchar *
-ghid_layer_selector_get_view_xml (GHidLayerSelector *ls)
+gint
+ghid_layer_selector_install_view_items (GHidLayerSelector *ls,
+ GtkMenuShell *shell, gint pos)
{
- GString *str = g_string_new ("");
- gtk_tree_model_foreach (GTK_TREE_MODEL (ls->list_store),
- view_xml_foreach_func, str);
- return g_string_free (str, FALSE);
+ GtkTreeIter iter;
+ int n = 0;
+
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ls->list_store), &iter);
+ do
+ {
+ struct _layer *ldata;
+ gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store),
+ &iter, STRUCT_COL, &ldata, -1);
+ if (ldata && ldata->view_action)
+ {
+ GtkAction *action = GTK_ACTION (ldata->view_action);
+ ldata->view_item = gtk_action_create_menu_item (action);
+ gtk_menu_shell_insert (shell, ldata->view_item, pos + n);
+ ++n;
+ }
+ }
+ while (gtk_tree_model_iter_next (GTK_TREE_MODEL (ls->list_store), &iter));
+
+ return n;
}
-/*! \brief Get the GtkActionGroup containing accelerators, etc, of a layer selector
+/*! \brief Returns the GtkAccelGroup of a layer selector
* \par Function Description
- * Returns the GtkActionGroup containing the toggle and radio buttons used
- * in the menu. Also contains the accelerators. This action group should be
- * added to the main UI. See Gtk docs for details.
*
* \param [in] ls The selector to be acted on
*
- * \return the action group of the selector
+ * \return the accel group of the selector
*/
-GtkActionGroup *
-ghid_layer_selector_get_action_group (GHidLayerSelector *ls)
+GtkAccelGroup *
+ghid_layer_selector_get_accel_group (GHidLayerSelector *ls)
{
- return ls->action_group;
+ return ls->accel_group;
}
/*! \brief used internally */
diff --git a/src/hid/gtk/ghid-layer-selector.h b/src/hid/gtk/ghid-layer-selector.h
index bfeffe9..10355a7 100644
--- a/src/hid/gtk/ghid-layer-selector.h
+++ b/src/hid/gtk/ghid-layer-selector.h
@@ -26,9 +26,13 @@ void ghid_layer_selector_add_layer (GHidLayerSelector *ls,
gboolean visible,
gboolean activatable);
GtkAccelGroup *ghid_layer_selector_get_accel_group (GHidLayerSelector *ls);
-gchar *ghid_layer_selector_get_pick_xml (GHidLayerSelector *ls);
-gchar *ghid_layer_selector_get_view_xml (GHidLayerSelector *ls);
-GtkActionGroup *ghid_layer_selector_get_action_group (GHidLayerSelector *ls);
+
+gint ghid_layer_selector_install_pick_items (GHidLayerSelector *ls,
+ GtkMenuShell *shell, gint pos);
+gint ghid_layer_selector_install_view_items (GHidLayerSelector *ls,
+ GtkMenuShell *shell, gint pos);
+
+GtkAccelGroup *ghid_layer_selector_get_accel_group (GHidLayerSelector *ls);
void ghid_layer_selector_toggle_layer (GHidLayerSelector *ls,
gint user_id);
diff --git a/src/hid/gtk/ghid-main-menu.c b/src/hid/gtk/ghid-main-menu.c
index 945b522..5693c56 100644
--- a/src/hid/gtk/ghid-main-menu.c
+++ b/src/hid/gtk/ghid-main-menu.c
@@ -13,6 +13,7 @@
#include "pcb-printf.h"
#include "ghid-main-menu.h"
+#include "ghid-layer-selector.h"
void Message (const char *, ...);
@@ -36,10 +37,13 @@ struct _GHidMainMenu
GList *actions;
GHashTable *popup_table;
+ gint n_layer_views;
+ gint n_layer_picks;
+ gint n_route_styles;
+
GCallback action_cb;
void (*special_key_cb) (const char *accel, GtkAction *action,
const Resource *node);
-
};
struct _GHidMainMenuClass
@@ -433,6 +437,9 @@ ghid_main_menu_new (GCallback action_cb,
mm->layer_view_pos = 0;
mm->layer_pick_pos = 0;
mm->route_style_pos = 0;
+ mm->n_layer_views = 0;
+ mm->n_layer_picks = 0;
+ mm->n_route_styles = 0;
mm->layer_view_shell = NULL;
mm->layer_pick_shell = NULL;
mm->route_style_shell = NULL;
@@ -499,6 +506,50 @@ ghid_main_menu_update_toggle_state (GHidMainMenu *menu,
}
}
+/*! \brief Installs or updates layer selector items */
+void
+ghid_main_menu_install_layer_selector (GHidMainMenu *mm,
+ GHidLayerSelector *ls)
+{
+ GList *children;
+
+ /* @layerview */
+ if (mm->layer_view_shell)
+ {
+ /* Remove old children */
+ children = gtk_container_get_children
+ (GTK_CONTAINER (mm->layer_view_shell));
+ children = g_list_nth (children, mm->layer_view_pos);
+ while (children && mm->n_layer_views--)
+ {
+ gtk_container_remove (GTK_CONTAINER (mm->layer_view_shell),
+ children->data);
+ children = g_list_next (children);
+ }
+ /* Install new ones */
+ mm->n_layer_views = ghid_layer_selector_install_view_items
+ (ls, mm->layer_view_shell, mm->layer_view_pos);
+ }
+
+ /* @layerpick */
+ if (mm->layer_pick_shell)
+ {
+ /* Remove old children */
+ children = gtk_container_get_children
+ (GTK_CONTAINER (mm->layer_pick_shell));
+ children = g_list_nth (children, mm->layer_pick_pos);
+ while (children && mm->n_layer_picks--)
+ {
+ gtk_container_remove (GTK_CONTAINER (mm->layer_pick_shell),
+ children->data);
+ children = g_list_next (children);
+ }
+ /* Install new ones */
+ mm->n_layer_picks = ghid_layer_selector_install_pick_items
+ (ls, mm->layer_pick_shell, mm->layer_pick_pos);
+ }
+}
+
/*! \brief Returns the menu bar's accelerator group */
GtkAccelGroup *
ghid_main_menu_get_accel_group (GHidMainMenu *menu)
diff --git a/src/hid/gtk/ghid-main-menu.h b/src/hid/gtk/ghid-main-menu.h
index 3b8c728..d667e34 100644
--- a/src/hid/gtk/ghid-main-menu.h
+++ b/src/hid/gtk/ghid-main-menu.h
@@ -1,12 +1,13 @@
#ifndef GHID_MAIN_MENU_H__
#define GHID_MAIN_MENU_H__
-#include "resource.h"
-
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
+#include "ghid-layer-selector.h"
+#include "resource.h"
+
G_BEGIN_DECLS /* keep c++ happy */
#define GHID_MAIN_MENU_TYPE (ghid_main_menu_get_type ())
@@ -34,5 +35,8 @@ void ghid_main_menu_add_popup_resource (GHidMainMenu *menu, const char *name,
const Resource *res);
GtkMenu *ghid_main_menu_get_popup (GHidMainMenu *menu, const char *name);
+void ghid_main_menu_install_layer_selector (GHidMainMenu *mm,
+ GHidLayerSelector *ls);
+
G_END_DECLS /* keep c++ happy */
#endif
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index b2d9c22..c292660 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -598,7 +598,6 @@ make_top_menubar (GtkWidget *menu_bar, GtkWidget * hbox, GHidPort * port)
{
GtkWidget *frame;
GtkActionGroup *actions;
- GtkActionGroup *layer_actions;
frame = gtk_frame_new (NULL);
gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, TRUE, 0);
@@ -609,12 +608,13 @@ make_top_menubar (GtkWidget *menu_bar, GtkWidget * hbox, GHidPort * port)
ghidgui->main_actions = actions;
make_menu_actions (actions, port);
- layer_actions = ghid_layer_selector_get_action_group
- (GHID_LAYER_SELECTOR (ghidgui->layer_selector));
gtk_window_add_accel_group (GTK_WINDOW (gport->top_window),
ghid_main_menu_get_accel_group
(GHID_MAIN_MENU (ghidgui->menu_bar)));
+ gtk_window_add_accel_group (GTK_WINDOW (gport->top_window),
+ ghid_layer_selector_get_accel_group
+ (GHID_LAYER_SELECTOR (ghidgui->layer_selector)));
gtk_container_add (GTK_CONTAINER (frame), menu_bar);
@@ -842,6 +842,9 @@ ghid_layer_buttons_update (void)
get_layer_delete);
make_layer_buttons (ghidgui->layer_selector);
make_virtual_layer_buttons (ghidgui->layer_selector);
+ ghid_main_menu_install_layer_selector
+ (GHID_MAIN_MENU (ghidgui->menu_bar),
+ GHID_LAYER_SELECTOR (ghidgui->layer_selector));
/* Sync selected layer with PCB's state */
if (PCB->RatDraw)
commit 4e63bedd088a4830735d9161c50da94f6784314f
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Clean up layer data handling in ghid-layer-selector.c
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index bd57f57..684f061 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -79,6 +79,33 @@ struct _layer
GtkTreeRowReference *rref;
};
+/*! \brief Deletes the action and accelerator from a layer */
+static void
+free_ldata (GHidLayerSelector *ls, struct _layer *ldata)
+{
+ if (ldata->pick_action)
+ {
+ gtk_action_disconnect_accelerator
+ (GTK_ACTION (ldata->pick_action));
+ gtk_action_group_remove_action (ls->action_group,
+ GTK_ACTION (ldata->pick_action));
+/* TODO: make this work without wrecking the radio action group
+ * g_object_unref (G_OBJECT (ldata->pick_action));
+ * */
+ }
+ if (ldata->view_action)
+ {
+ gtk_action_disconnect_accelerator
+ (GTK_ACTION (ldata->view_action));
+ gtk_action_group_remove_action (ls->action_group,
+ GTK_ACTION (ldata->view_action));
+ g_object_unref (G_OBJECT (ldata->view_action));
+ }
+ gtk_tree_row_reference_free (ldata->rref);
+ g_free (ldata);
+
+}
+
/*! \brief Flip the visibility state of a given layer
* \par Function Description
* Changes the internal toggle state and menu checkbox state
@@ -173,11 +200,11 @@ selection_changed_cb (GtkTreeSelection *selection, GHidLayerSelector *ls)
/*! \brief Callback for menu actions: sync layer selection list, emit signal */
static void
-menu_view_cb (GtkToggleAction *action, GtkTreeRowReference *rref)
+menu_view_cb (GtkToggleAction *action, struct _layer *ldata)
{
GHidLayerSelector *ls;
- GtkTreeModel *model = gtk_tree_row_reference_get_model (rref);
- GtkTreePath *path = gtk_tree_row_reference_get_path (rref);
+ GtkTreeModel *model = gtk_tree_row_reference_get_model (ldata->rref);
+ GtkTreePath *path = gtk_tree_row_reference_get_path (ldata->rref);
gboolean state = gtk_toggle_action_get_active (action);
GtkTreeIter iter;
gint user_id;
@@ -193,11 +220,11 @@ menu_view_cb (GtkToggleAction *action, GtkTreeRowReference *rref)
/*! \brief Callback for menu actions: sync layer selection list, emit signal */
static void
-menu_pick_cb (GtkRadioAction *action, GtkTreeRowReference *rref)
+menu_pick_cb (GtkRadioAction *action, struct _layer *ldata)
{
GHidLayerSelector *ls;
- GtkTreeModel *model = gtk_tree_row_reference_get_model (rref);
- GtkTreePath *path = gtk_tree_row_reference_get_path (rref);
+ GtkTreeModel *model = gtk_tree_row_reference_get_model (ldata->rref);
+ GtkTreePath *path = gtk_tree_row_reference_get_path (ldata->rref);
GtkTreeIter iter;
gint user_id;
@@ -437,14 +464,21 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
}
else
{
+ /* If the row exists, we clear out its ldata to create
+ * a new action, accelerator and menu item. */
+ gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store), &iter,
+ STRUCT_COL, &new_layer, -1);
+ free_ldata (ls, new_layer);
+ new_layer = malloc (sizeof (*new_layer));
+
gtk_list_store_set (ls->list_store, &iter,
+ STRUCT_COL, new_layer,
VISIBLE_COL, visible,
COLOR_COL, color_string,
TEXT_COL, name,
FONT_COL, activatable ? NULL : "Italic",
ACTIVATABLE_COL, activatable,
-1);
- return;
}
/* -- Setup new actions -- */
@@ -487,7 +521,7 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
GTK_ACTION (new_layer->pick_action),
paccel);
g_signal_connect (new_layer->pick_action, "toggled",
- G_CALLBACK (menu_pick_cb), new_layer->rref);
+ G_CALLBACK (menu_pick_cb), new_layer);
}
else
new_layer->pick_action = NULL;
@@ -786,44 +820,44 @@ ghid_layer_selector_delete_layers (GHidLayerSelector *ls,
gboolean (*callback)(int user_id))
{
GtkTreeIter iter, last_iter;
- gboolean needs_inc;
- gboolean was_separator = FALSE;
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ls->list_store), &iter);
- do
+
+ gboolean iter_valid =
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ls->list_store), &iter);
+ while (iter_valid)
{
struct _layer *ldata;
- gboolean sep;
+ gboolean sep, was_sep = FALSE;
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);
- /* gtk_list_store_remove will increment the iter for us, so we
- * don't want to do it again in the loop condition */
- needs_inc = TRUE;
- if (!sep && callback (user_id))
+
+ /* Find next iter to delete */
+ while (iter_valid)
{
- if (gtk_list_store_remove (ls->list_store, &iter))
- {
- if (ldata->view_action)
- gtk_action_group_remove_action (ls->action_group,
- GTK_ACTION (ldata->view_action));
- if (ldata->pick_action)
- gtk_action_group_remove_action (ls->action_group,
- GTK_ACTION (ldata->pick_action));
- gtk_tree_row_reference_free (ldata->rref);
- g_free (ldata);
- needs_inc = FALSE;
- }
- else
- return;
- if (was_separator)
+ 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 && callback (user_id))
+ break;
+
+ /* save iter in case it's a bad separator */
+ was_sep = sep;
+ last_iter = iter;
+ /* iterate */
+ iter_valid =
+ gtk_tree_model_iter_next (GTK_TREE_MODEL (ls->list_store), &iter);
+ }
+
+ if (iter_valid)
+ {
+ /* remove preceeding separator */
+ if (was_sep)
gtk_list_store_remove (ls->list_store, &last_iter);
+
+ /*** remove row ***/
+ iter_valid = gtk_list_store_remove (ls->list_store, &iter);
+ free_ldata (ls, ldata);
}
last_iter = iter;
- was_separator = sep;
}
- while (!needs_inc ||
- gtk_tree_model_iter_next (GTK_TREE_MODEL (ls->list_store), &iter));
}
commit 8eddcff25d69024c5afe336f9f1ddab7e341df49
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Give GHidLayerSelector an internal layer structure
Before we had various arrays to resize and index; now each
row has a structure associated with it, that is easier to
access and maintain.
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index 7f11f7f..bd57f57 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -33,7 +33,7 @@ enum {
/*! \brief Columns used for internal data store */
enum {
- INDEX_COL,
+ STRUCT_COL,
USER_ID_COL,
VISIBLE_COL,
COLOR_COL,
@@ -57,11 +57,7 @@ struct _GHidLayerSelector
GtkActionGroup *action_group;
- GtkToggleAction **view_actions;
- GtkRadioAction **pick_actions;
- GtkTreeRowReference **rows;
GSList *radio_group;
- int max_actions;
int n_actions;
gboolean last_activatable;
@@ -76,6 +72,13 @@ struct _GHidLayerSelectorClass
void (* toggle_layer) (GHidLayerSelector *, gint);
};
+struct _layer
+{
+ GtkToggleAction *view_action;
+ GtkRadioAction *pick_action;
+ GtkTreeRowReference *rref;
+};
+
/*! \brief Flip the visibility state of a given layer
* \par Function Description
* Changes the internal toggle state and menu checkbox state
@@ -90,12 +93,13 @@ struct _GHidLayerSelectorClass
static void
toggle_visibility (GHidLayerSelector *ls, GtkTreeIter *iter)
{
- gint idx;
+ struct _layer *ldata;
gboolean toggle;
gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store), iter,
- VISIBLE_COL, &toggle, INDEX_COL, &idx, -1);
+ VISIBLE_COL, &toggle, STRUCT_COL, &ldata, -1);
gtk_list_store_set (ls->list_store, iter, VISIBLE_COL, !toggle, -1);
- gtk_toggle_action_set_active (ls->view_actions[idx], !toggle);
+ if (ldata)
+ gtk_toggle_action_set_active (ldata->view_action, !toggle);
}
/*! \brief Decide if a GtkListStore entry is a layer or separator */
@@ -157,11 +161,12 @@ selection_changed_cb (GtkTreeSelection *selection, GHidLayerSelector *ls)
ls->prevent_recursion = TRUE;
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
{
- gint idx;
+ gint user_id;
+ struct _layer *ldata;
gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store), &iter,
- INDEX_COL, &idx, -1);
- if (ls->pick_actions[0])
- gtk_radio_action_set_current_value (ls->pick_actions[0], idx);
+ STRUCT_COL, &ldata, USER_ID_COL, &user_id, -1);
+ if (ldata && ldata->pick_action)
+ gtk_radio_action_set_current_value (ldata->pick_action, user_id);
}
ls->prevent_recursion = FALSE;
}
@@ -243,16 +248,24 @@ ghid_layer_selector_class_init (GHidLayerSelectorClass *klass)
static void
ghid_layer_selector_finalize (GObject *object)
{
- int i;
+ GtkTreeIter iter;
GHidLayerSelector *ls = (GHidLayerSelector *) object;
g_object_unref (ls->action_group);
- g_free (ls->view_actions);
- g_free (ls->pick_actions);
- for (i = 0; i < ls->n_actions; ++i)
- if (ls->rows[i])
- gtk_tree_row_reference_free (ls->rows[i]);
- g_free (ls->rows);
+
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ls->list_store), &iter);
+ do
+ {
+ struct _layer *ldata;
+ gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store),
+ &iter, STRUCT_COL, &ldata, -1);
+
+ g_object_unref (G_OBJECT (ldata->pick_action));
+ g_object_unref (G_OBJECT (ldata->view_action));
+ gtk_tree_row_reference_free (ldata->rref);
+ g_free (ldata);
+ }
+ while (gtk_tree_model_iter_next (GTK_TREE_MODEL (ls->list_store), &iter));
G_OBJECT_CLASS (ghid_layer_selector_parent_class)->finalize (object);
}
@@ -309,7 +322,7 @@ ghid_layer_selector_new (void)
GHidLayerSelector *ls = g_object_new (GHID_LAYER_SELECTOR_TYPE, NULL);
/* action index, active, color, text, font, is_separator */
- ls->list_store = gtk_list_store_new (N_COLS, G_TYPE_INT, G_TYPE_INT,
+ ls->list_store = gtk_list_store_new (N_COLS, G_TYPE_POINTER, G_TYPE_INT,
G_TYPE_BOOLEAN, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
@@ -324,10 +337,6 @@ ghid_layer_selector_new (void)
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));
- ls->pick_actions = g_malloc0 (ls->max_actions * sizeof (*ls->pick_actions));
- ls->rows = g_malloc0 (ls->max_actions * sizeof (*ls->rows));
gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (ls),
tree_view_separator_func,
@@ -372,6 +381,7 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
gboolean visible,
gboolean activatable)
{
+ struct _layer *new_layer = NULL;
gchar *pname, *vname, *paccel, *vaccel;
gboolean new_iter = TRUE;
gboolean last_activatable = TRUE;
@@ -408,12 +418,14 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
/* Add separator between activatable/non-activatable boundaries */
gtk_list_store_append (ls->list_store, &iter);
gtk_list_store_set (ls->list_store, &iter,
+ STRUCT_COL, NULL,
SEPARATOR_COL, TRUE, -1);
}
/* Create new layer */
+ new_layer = malloc (sizeof (*new_layer));
gtk_list_store_append (ls->list_store, &iter);
gtk_list_store_set (ls->list_store, &iter,
- INDEX_COL, ls->n_actions,
+ STRUCT_COL, new_layer,
USER_ID_COL, user_id,
VISIBLE_COL, visible,
COLOR_COL, color_string,
@@ -424,40 +436,15 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
-1);
}
else
- gtk_list_store_set (ls->list_store, &iter,
- VISIBLE_COL, visible,
- COLOR_COL, color_string,
- TEXT_COL, name,
- FONT_COL, activatable ? NULL : "Italic",
- ACTIVATABLE_COL, activatable,
- -1);
-
- /* Unless we're adding new actions, we're done now */
- if (!new_iter)
- return;
-
- if (activatable && ls->n_actions == 0)
- gtk_tree_selection_select_iter (ls->selection, &iter);
-
- /* Allocate new actions if necessary */
- if (ls->n_actions == ls->max_actions)
{
- void *tmp[2];
- ls->max_actions *= 2;
- tmp[0] = g_realloc (ls->view_actions,
- ls->max_actions * sizeof (*ls->view_actions));
- tmp[1] = g_realloc (ls->pick_actions,
- ls->max_actions * sizeof (*ls->pick_actions));
- tmp[2] = g_realloc (ls->rows,
- ls->max_actions * sizeof (*ls->rows));
- if (tmp[0] == NULL || tmp[1] == NULL || tmp[2] == NULL)
- g_critical ("realloc failed allocating new actions");
- else
- {
- ls->view_actions = tmp[0];
- ls->pick_actions = tmp[1];
- ls->rows = tmp[2];
- }
+ gtk_list_store_set (ls->list_store, &iter,
+ VISIBLE_COL, visible,
+ COLOR_COL, color_string,
+ TEXT_COL, name,
+ FONT_COL, activatable ? NULL : "Italic",
+ ACTIVATABLE_COL, activatable,
+ -1);
+ return;
}
/* -- Setup new actions -- */
@@ -484,40 +471,43 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
/* Create row reference for actions */
path = gtk_tree_model_get_path (GTK_TREE_MODEL (ls->list_store), &iter);
- ls->rows[ls->n_actions] = gtk_tree_row_reference_new
- (GTK_TREE_MODEL (ls->list_store), path);
+ new_layer->rref = gtk_tree_row_reference_new
+ (GTK_TREE_MODEL (ls->list_store), path);
gtk_tree_path_free (path);
/* Create selection action */
if (activatable)
{
- ls->pick_actions[ls->n_actions]
- = gtk_radio_action_new (pname, name, NULL, NULL, ls->n_actions);
- gtk_radio_action_set_group (ls->pick_actions[ls->n_actions],
- ls->radio_group);
- ls->radio_group
- = gtk_radio_action_get_group (ls->pick_actions[ls->n_actions]);
+ new_layer->pick_action
+ = gtk_radio_action_new (pname, name, NULL, NULL, user_id);
+ gtk_radio_action_set_group (new_layer->pick_action, ls->radio_group);
+ ls->radio_group = gtk_radio_action_get_group (new_layer->pick_action);
gtk_action_group_add_action_with_accel
(ls->action_group,
- GTK_ACTION (ls->pick_actions[ls->n_actions]),
+ GTK_ACTION (new_layer->pick_action),
paccel);
- g_signal_connect (ls->pick_actions[ls->n_actions], "toggled",
- G_CALLBACK (menu_pick_cb), ls->rows[ls->n_actions]);
+ g_signal_connect (new_layer->pick_action, "toggled",
+ G_CALLBACK (menu_pick_cb), new_layer->rref);
}
else
- ls->pick_actions[ls->n_actions] = NULL;
+ new_layer->pick_action = NULL;
/* Create visibility action */
- ls->view_actions[ls->n_actions] = gtk_toggle_action_new (vname, name,
- NULL, NULL);
- gtk_toggle_action_set_active (ls->view_actions[ls->n_actions], visible);
+ new_layer->view_action = gtk_toggle_action_new (vname, name, NULL, NULL);
+ gtk_toggle_action_set_active (new_layer->view_action, visible);
gtk_action_group_add_action_with_accel
(ls->action_group,
- GTK_ACTION (ls->view_actions[ls->n_actions]),
+ GTK_ACTION (new_layer->view_action),
vaccel);
- g_signal_connect (ls->view_actions[ls->n_actions], "toggled",
- G_CALLBACK (menu_view_cb), ls->rows[ls->n_actions]);
+ g_signal_connect (new_layer->view_action, "toggled",
+ G_CALLBACK (menu_view_cb), new_layer->rref);
+
+
+ /* Select new layer, if we need */
+ if (activatable
+ && !gtk_tree_selection_get_selected (ls->selection, NULL, NULL))
+ gtk_tree_selection_select_iter (ls->selection, &iter);
/* cleanup */
if (vaccel)
@@ -531,6 +521,35 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
ls->n_actions++;
}
+/*! \brief used internally */
+static gboolean
+pick_xml_foreach_func (GtkTreeModel *model, GtkTreePath *path,
+ GtkTreeIter *iter, gpointer data)
+{
+ struct _layer *ldata;
+ GString *str = data;
+
+ gtk_tree_model_get (model, iter, STRUCT_COL, &ldata, -1);
+ if (ldata && ldata->pick_action)
+ g_string_append_printf (str, "<menuitem action=\"%s\" />\n",
+ gtk_action_get_name (GTK_ACTION (ldata->pick_action)));
+ return FALSE;
+}
+/*! \brief used internally */
+static gboolean
+view_xml_foreach_func (GtkTreeModel *model, GtkTreePath *path,
+ GtkTreeIter *iter, gpointer data)
+{
+ struct _layer *ldata;
+ GString *str = data;
+
+ gtk_tree_model_get (model, iter, STRUCT_COL, &ldata, -1);
+ if (ldata && ldata->view_action)
+ g_string_append_printf (str, "<menuitem action=\"%s\" />\n",
+ gtk_action_get_name (GTK_ACTION (ldata->view_action)));
+ return FALSE;
+}
+
/*! \brief Get the "Current Layer" menu description of a layer selector
* \par Function Description
* Returns the XML content used by Gtk in building the layer-selection
@@ -544,13 +563,9 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
gchar *
ghid_layer_selector_get_pick_xml (GHidLayerSelector *ls)
{
- int i;
GString *str = g_string_new ("");
-
- for (i = 0; i < ls->n_actions; ++i)
- if (ls->pick_actions[i])
- g_string_append_printf (str, "<menuitem action=\"LayerPick%d\" />\n", i);
-
+ gtk_tree_model_foreach (GTK_TREE_MODEL (ls->list_store),
+ pick_xml_foreach_func, str);
return g_string_free (str, FALSE);
}
@@ -567,13 +582,9 @@ ghid_layer_selector_get_pick_xml (GHidLayerSelector *ls)
gchar *
ghid_layer_selector_get_view_xml (GHidLayerSelector *ls)
{
- int i;
GString *str = g_string_new ("");
-
- for (i = 0; i < ls->n_actions; ++i)
- if (ls->view_actions[i])
- g_string_append_printf (str, "<menuitem action=\"LayerView%d\" />\n", i);
-
+ gtk_tree_model_foreach (GTK_TREE_MODEL (ls->list_store),
+ view_xml_foreach_func, str);
return g_string_free (str, FALSE);
}
@@ -780,11 +791,12 @@ ghid_layer_selector_delete_layers (GHidLayerSelector *ls,
gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ls->list_store), &iter);
do
{
+ struct _layer *ldata;
gboolean sep;
- gint user_id, idx;
+ gint user_id;
gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store),
&iter, USER_ID_COL, &user_id,
- INDEX_COL, &idx, SEPARATOR_COL, &sep, -1);
+ STRUCT_COL, &ldata, SEPARATOR_COL, &sep, -1);
/* gtk_list_store_remove will increment the iter for us, so we
* don't want to do it again in the loop condition */
needs_inc = TRUE;
@@ -792,16 +804,14 @@ ghid_layer_selector_delete_layers (GHidLayerSelector *ls,
{
if (gtk_list_store_remove (ls->list_store, &iter))
{
- if (ls->view_actions[idx])
+ if (ldata->view_action)
gtk_action_group_remove_action (ls->action_group,
- GTK_ACTION (ls->view_actions[idx]));
- if (ls->pick_actions[idx])
+ GTK_ACTION (ldata->view_action));
+ if (ldata->pick_action)
gtk_action_group_remove_action (ls->action_group,
- GTK_ACTION (ls->pick_actions[idx]));
- gtk_tree_row_reference_free (ls->rows[idx]);
- ls->view_actions[idx] = NULL;
- ls->pick_actions[idx] = NULL;
- ls->rows[idx] = NULL;
+ GTK_ACTION (ldata->pick_action));
+ gtk_tree_row_reference_free (ldata->rref);
+ g_free (ldata);
needs_inc = FALSE;
}
else
commit 707dd2dc7245cec6f15adc1ae1f735944602c561
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Replace gtk UI manager with GHidMainMenu widget
This commit replaces the old UI manager with a customize gtk
widget that builds menus directly from a resource tree. This
eliminates the translate-to-XML step, the ugly hacks used to
access individual actions, and all the associated manual
memory management.
This will also give us the ability to have more dynamic menus,
in particular layer lists without maximum capacities.
Layers and route styles are still not hooked into the menu.
This means that those accelerators DO NOT WORK. (This will
be fixed in a later commit.) Checkboxes have been replaced
with radio buttons where appropriate. There are now tearoffs
on the context-menu's submenus.
Other than that, there should be no user-visible changes. ;)
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 0c9019d..46a9347 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -1937,8 +1937,7 @@ button number must be specified as the second argument.
static int
Popup (int argc, char **argv, Coord x, Coord y)
{
- GtkWidget *menu;
- char *element;
+ GtkMenu *menu;
guint button;
if (argc != 1 && argc != 2)
@@ -1949,18 +1948,7 @@ Popup (int argc, char **argv, Coord x, Coord y)
else
button = atoi (argv[1]);
- if ( (element = (char *) malloc ( (strlen (argv[0]) + 2) * sizeof (char))) == NULL )
- {
- fprintf (stderr, _("Popup(): malloc failed\n"));
- exit (1);
- }
-
- sprintf (element, "/%s", argv[0]);
- printf (_("Loading popup \"%s\". Button = %u\n"), element, button);
-
- menu = gtk_ui_manager_get_widget (ghidgui->ui_manager, element);
- free (element);
-
+ menu = ghid_main_menu_get_popup (GHID_MAIN_MENU (ghidgui->menu_bar), argv[0]);
if (! GTK_IS_MENU (menu))
{
Message (_("The specified popup menu \"%s\" has not been defined.\n"), argv[0]);
@@ -1970,7 +1958,7 @@ Popup (int argc, char **argv, Coord x, Coord y)
{
ghidgui->in_popup = TRUE;
gtk_widget_grab_focus (ghid_port.drawing_area);
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0,
+ gtk_menu_popup (menu, NULL, NULL, NULL, NULL, 0,
gtk_get_current_event_time());
}
return 0;
diff --git a/src/hid/gtk/gui-command-window.c b/src/hid/gtk/gui-command-window.c
index b08836e..1728bd3 100644
--- a/src/hid/gtk/gui-command-window.c
+++ b/src/hid/gtk/gui-command-window.c
@@ -415,8 +415,8 @@ ghid_command_entry_get (gchar * prompt, gchar * command)
| and connect a handler to look for the escape key.
*/
gtk_window_remove_accel_group (GTK_WINDOW (out->top_window),
- gtk_ui_manager_get_accel_group (ghidgui->
- ui_manager));
+ ghid_main_menu_get_accel_group
+ (GHID_MAIN_MENU (ghidgui->menu_bar)));
ghid_interface_input_signals_disconnect ();
ghid_interface_set_sensitive (FALSE);
gtk_widget_grab_focus (GTK_WIDGET (ghidgui->command_entry));
@@ -438,8 +438,8 @@ ghid_command_entry_get (gchar * prompt, gchar * command)
ghid_interface_input_signals_connect ();
ghid_interface_set_sensitive (TRUE);
gtk_window_add_accel_group (GTK_WINDOW (out->top_window),
- gtk_ui_manager_get_accel_group (ghidgui->
- ui_manager));
+ ghid_main_menu_get_accel_group
+ (GHID_MAIN_MENU (ghidgui->menu_bar)));
/* Restore the status line label and give focus back to the drawing area
*/
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index 5929a37..b9c5ab3 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -199,7 +199,7 @@ ghid_idle_cb (gpointer data)
gboolean
ghid_port_key_release_cb (GtkWidget * drawing_area, GdkEventKey * kev,
- GtkUIManager * ui)
+ gpointer data)
{
gint ksym = kev->keyval;
@@ -225,7 +225,7 @@ ghid_port_key_release_cb (GtkWidget * drawing_area, GdkEventKey * kev,
gboolean
ghid_port_key_press_cb (GtkWidget * drawing_area,
- GdkEventKey * kev, GtkUIManager * ui)
+ GdkEventKey * kev, gpointer data)
{
ModifierKeysState mk;
gint ksym = kev->keyval;
@@ -332,7 +332,7 @@ ghid_port_key_press_cb (GtkWidget * drawing_area,
gboolean
ghid_port_button_press_cb (GtkWidget * drawing_area,
- GdkEventButton * ev, GtkUIManager * ui)
+ GdkEventButton * ev, gpointer data)
{
ModifierKeysState mk;
GdkModifierType state;
@@ -357,7 +357,7 @@ ghid_port_button_press_cb (GtkWidget * drawing_area,
gboolean
ghid_port_button_release_cb (GtkWidget * drawing_area,
- GdkEventButton * ev, GtkUIManager * ui)
+ GdkEventButton * ev, gpointer data)
{
ModifierKeysState mk;
GdkModifierType state;
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index b4dbcaa..b2d9c22 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -136,19 +136,6 @@ RCSID ("$Id$");
* local types
*/
-
-typedef enum {GHID_FLAG_ACTIVE, GHID_FLAG_CHECKED, GHID_FLAG_VISIBLE} MenuFlagType;
-
-/* Used by the menuitems that are toggle actions */
-typedef struct
-{
- const char *actionname;
- const char *flagname;
- MenuFlagType flagtype;
- int oldval;
- const char *xres;
-} ToggleFlagType;
-
/* Used by the route style buttons and menu */
typedef struct
{
@@ -169,47 +156,25 @@ RouteStyleButton;
#define N_ROUTE_STYLES (NUM_STYLES + 3)
-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;
-
-/* the array of actions for "normal" menuitems */
-static GtkActionEntry *new_entries = NULL;
-static gint menuitem_cnt = 0;
-
-/* the array of actions for "toggle" menuitems */
-static GtkToggleActionEntry *new_toggle_entries = NULL;
-static gint tmenuitem_cnt = 0;
-static Resource **action_resources = NULL;
-static Resource **toggle_action_resources = NULL;
+static GtkWidget *ghid_load_menus (void);
/* actions for the @routestyles menuitems */
static GtkToggleActionEntry routestyle_toggle_entries[N_ROUTE_STYLES];
static Resource *routestyle_resources[N_ROUTE_STYLES];
-
-#define MENUITEM "MenuItem"
-#define TMENUITEM "TMenuItem"
#define ROUTESTYLE "RouteStyle"
-
-static ToggleFlagType *tflags = 0;
-static int n_tflags = 0;
-static int max_tflags = 0;
-
GhidGui _ghidgui, *ghidgui = NULL;
GHidPort ghid_port, *gport;
-static GdkColor WhitePixel;
-
-static gchar *bg_image_file;
+static gchar *bg_image_file;
-static char *ghid_hotkey_actions[256];
+static struct { GtkAction *action; const Resource *node; }
+ ghid_hotkey_actions[256];
+#define N_HOTKEY_ACTIONS \
+ (sizeof (ghid_hotkey_actions) / sizeof (ghid_hotkey_actions[0]))
/* ------------------------------------------------------------------
@@ -228,125 +193,39 @@ static gint route_style_index;
static GtkWidget *route_style_edit_button;
-static const char *
-ghid_check_unique_accel (const char *accelerator)
+/*! \brief callback for ghid_main_menu_update_toggle_state () */
+void
+menu_toggle_update_cb (GtkAction *act, const char *tflag, const char *aflag)
{
- static int n_list = 0;
- static char **accel_list;
- static int amax = 0;
- int i;
- const char * a = accelerator;
-
- if (accelerator == NULL)
- return NULL;
-
- if (strlen (accelerator) == 0)
- return accelerator;
-
- if (amax >= n_list)
+ if (tflag != NULL)
{
- n_list += 128;
- if ( (accel_list = (char **)realloc (accel_list, n_list * sizeof (char *))) == NULL)
- {
- fprintf (stderr, "%s(): realloc failed\n", __FUNCTION__);
- exit (1);
- }
+ int v = hid_get_flag (tflag);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (act), !!v);
}
-
- for (i = 0; i < amax ; i++)
- {
- if (strcmp (accel_list[i], accelerator) == 0)
- {
- Message (_("Duplicate accelerator found: \"%s\"\n"
- "The second occurance will be dropped\n"),
- accelerator);
- a = NULL;
- break;
- }
- }
- accel_list[amax] = strdup (accelerator);
- amax++;
-
- return a;
-}
-
-
-/* ------------------------------------------------------------------
- * note_toggle_flag()
- */
-
-static void
-note_toggle_flag (const char *actionname, MenuFlagType type, const char *name)
-{
-
- #ifdef DEBUG_MENUS
- printf ("note_toggle_flag(\"%s\", %d, \"%s\")\n", actionname, type, name);
- #endif
-
- if (n_tflags >= max_tflags)
+ if (aflag != NULL)
{
- max_tflags += 20;
- tflags = (ToggleFlagType *)realloc (tflags, max_tflags * sizeof (ToggleFlagType));
+ int v = hid_get_flag (aflag);
+ gtk_action_set_sensitive (act, !!v);
}
- tflags[n_tflags].actionname = strdup (actionname);
- tflags[n_tflags].flagname = name;
- tflags[n_tflags].flagtype = type;
- tflags[n_tflags].oldval = -1;
- tflags[n_tflags].xres = "none";
- n_tflags++;
}
-
+/*! \brief sync the menu checkboxes with actual pcb state */
void
ghid_update_toggle_flags ()
{
int i;
GtkAction *a;
- gboolean old_holdoff;
gboolean active;
+ gboolean old_holdoff;
char tmpnm[40];
- GValue setfalse = { 0 };
- GValue settrue = { 0 };
- GValue setlabel = { 0 };
-
- g_value_init (&setfalse, G_TYPE_BOOLEAN);
- g_value_init (&settrue, G_TYPE_BOOLEAN);
- g_value_set_boolean (&setfalse, FALSE);
- g_value_set_boolean (&settrue, TRUE);
- g_value_init (&setlabel, G_TYPE_STRING);
/* mask the callbacks */
old_holdoff = ghidgui->toggle_holdoff;
ghidgui->toggle_holdoff = TRUE;
- for (i = 0; i < n_tflags; i++)
- {
- switch (tflags[i].flagtype)
- {
- case GHID_FLAG_ACTIVE:
- {
- int v = hid_get_flag (tflags[i].flagname);
- a = gtk_action_group_get_action (ghidgui->main_actions, tflags[i].actionname);
- g_object_set_property (G_OBJECT (a), "sensitive", v? &settrue : &setfalse);
- tflags[i].oldval = v;
- }
- break;
-
- case GHID_FLAG_CHECKED:
- {
- int v = hid_get_flag (tflags[i].flagname);
- a = gtk_action_group_get_action (ghidgui->main_actions, tflags[i].actionname);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (a), v? TRUE : FALSE);
- tflags[i].oldval = v;
- }
- break;
-
- default:
- printf ("Skipping flagtype %d\n", tflags[i].flagtype);
- break;
- }
- }
+ ghid_main_menu_update_toggle_state (GHID_MAIN_MENU (ghidgui->menu_bar),
+ menu_toggle_update_cb);
for (i = 0; i < N_ROUTE_STYLES; i++)
{
@@ -354,7 +233,7 @@ ghid_update_toggle_flags ()
a = gtk_action_group_get_action (ghidgui->main_actions, tmpnm);
if (i >= NUM_STYLES)
{
- g_object_set_property (G_OBJECT (a), "visible", &setfalse);
+ gtk_action_set_visible (a, FALSE);
}
/* Update the toggle states */
@@ -366,11 +245,7 @@ ghid_update_toggle_flags ()
}
- g_value_unset (&setfalse);
- g_value_unset (&settrue);
- g_value_unset (&setlabel);
ghidgui->toggle_holdoff = old_holdoff;
-
}
static void
@@ -412,103 +287,47 @@ top_window_configure_event_cb (GtkWidget * widget, GdkEventConfigure * ev,
}
-/*
- * This is the main menu callback function. The callback looks at
- * the gtk action name to figure out which menuitem was chosen. Then
- * it looks up in a table to find the pcb actions which should be
- * executed. All menus go through this callback. The tables of
- * actions are loaded from the menu resource file at startup.
+/*! \brief Menu action callback function
+ * \par Function Description
+ * This is the main menu callback function. The callback receives
+ * the original Resource pointer containing the HID actions to be
+ * executed.
*
- * In addition, all hotkeys go through the menus which means they go
- * through here.
+ * All hotkeys go through the menus which means they go through here.
+ * Some, such as tab, are caught by Gtk instead of passed here, so
+ * pcb calls this function directly through ghid_hotkey_cb() for them.
+ *
+ * \param [in] The action that was activated
+ * \param [in] The menu resource associated with the action
*/
static void
-ghid_menu_cb (GtkAction * action, gpointer data)
+ghid_menu_cb (GtkAction *action, const Resource *node)
{
- const gchar * name;
- int id = 0;
- int vi;
- const Resource *node = NULL;
- static int in_cb = 0;
- gboolean old_holdoff;
+ const gchar *name = gtk_action_get_name (action);
- /* If we don't do this then we can end up in loops where changing
- * the state of the toggle actions triggers the callbacks and
- * the call back updates the state of the actions.
- */
- if (in_cb)
+ if (action == NULL || node == NULL)
+ return;
+
+ /* Prevent recursion */
+ if (ghidgui->toggle_holdoff == TRUE)
return;
- else
- in_cb = 1;
- /*
- * Normally this callback is triggered by the menus in which case
- * action will be the gtk action which was triggered. In the case
- * of the "special" hotkeys we will call this callback directly and
- * pass in the name of the menu that it corresponds to in via the
- * data argument
- */
- if (action != NULL)
- {
- name = gtk_action_get_name (action);
- }
- else
- {
- name = (const char *) data;
#ifdef DEBUG_MENUS
- printf ("ghid_menu_cb(): name = \"%s\"\n", UNKNOWN (name));
+ printf ("ghid_menu_cb(): name = \"%s\"\n", name);
#endif
- }
- if (name == NULL)
+ /* Special-case route styles */
+ if (strncmp (name, ROUTESTYLE, strlen (ROUTESTYLE)) == 0)
{
- fprintf (stderr, "%s(%p, %p): name == NULL\n",
- __FUNCTION__, action, data);
- in_cb = 0;
- return;
- }
-
- if ( strncmp (name, MENUITEM, strlen (MENUITEM)) == 0)
- {
- /* This is a "normal" menuitem as opposed to a toggle menuitem
- */
- id = atoi (name + strlen (MENUITEM));
- node = action_resources[id];
- }
- else if ( strncmp (name, TMENUITEM, strlen (TMENUITEM)) == 0)
- {
- /* This is a "toggle" menuitem */
- id = atoi (name + strlen (TMENUITEM));
-
- /* toggle_holdoff lets us update the state of the menus without
- * actually triggering all the callbacks
- */
- if (ghidgui->toggle_holdoff == TRUE)
- node = NULL;
- else
- node = toggle_action_resources[id];
- }
- else if ( strncmp (name, ROUTESTYLE, strlen (ROUTESTYLE)) == 0)
- {
- id = atoi (name + strlen (ROUTESTYLE));
+ int id = atoi (name + strlen (ROUTESTYLE));
if (ghidgui->toggle_holdoff != TRUE)
ghid_route_style_button_set_active (id);
node = NULL;
}
else
{
- fprintf (stderr, "ERROR: ghid_menu_cb(): name = \"%s\" is unknown\n", name);
- }
-
-
-#ifdef DEBUG_MENUS
- printf ("ghid_menu_cb(): name = \"%s\", id = %d\n", name, id);
-#endif
-
- /* Now we should have a pointer to the actions to execute */
- if (node != NULL)
- {
+ int vi;
for (vi = 1; vi < node->c; vi++)
if (resource_type (node->v[vi]) == 10)
{
@@ -518,67 +337,24 @@ ghid_menu_cb (GtkAction * action, gpointer data)
hid_parse_actions (node->v[vi].value);
}
}
- else {
-#ifdef DEBUG_MENUS
-...
[truncated message content] |
|
From: <gi...@gp...> - 2011-08-29 16:39:32
|
The branch, master has been updated
via 448a50d473e83f4202a70df36fcffe30373ffc38 (commit)
from c81a96de0ca4d0dd7122d88721a9e2865ff835a7 (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/gui-top-window.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
=================
Commit Messages
=================
commit 448a50d473e83f4202a70df36fcffe30373ffc38
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Fix select-hidden-layer behavior
When you select a hidden layer, it should toggle the visibility
so that the currently-selected layer is always visible. We were
toggling twice.
:100644 100644 16de5b4... b4dbcaa... M src/hid/gtk/gui-top-window.c
=========
Changes
=========
commit 448a50d473e83f4202a70df36fcffe30373ffc38
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Fix select-hidden-layer behavior
When you select a hidden layer, it should toggle the visibility
so that the currently-selected layer is always visible. We were
toggling twice.
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 16de5b4..b4dbcaa 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -690,7 +690,7 @@ layer_selector_select_callback (GHidLayerSelector *ls, int layer, gpointer d)
PCB->SilkActive = (layer == LAYER_BUTTON_SILK);
PCB->RatDraw = (layer == LAYER_BUTTON_RATS);
if (layer < max_copper_layer)
- ChangeGroupVisibility (layer, true, true);
+ ChangeGroupVisibility (layer, active, true);
/* Ensure layer is turned on */
ghid_layer_selector_make_selected_visible (ls);
|
|
From: <gi...@gp...> - 2011-08-29 15:15:16
|
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 <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
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 <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
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);
|
|
From: <gi...@gp...> - 2011-08-29 05:27:10
|
The branch, master has been updated
via 728f350268e134ca116a6f79577843db7b18e82c (commit)
via 73591e0e0e4c2abc764a2a8be503a44da1ca86f4 (commit)
via 352a088d8c506ef0407cb9c88844bf4033576eb0 (commit)
from acf8d00db4a90b555d768341a97453914b7b4aec (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/Makefile.am | 12 +-
...isibility.c => ghid-cell-renderer-visibility.c} | 118 ++++++++++----------
src/hid/gtk/ghid-cell-renderer-visibility.h | 24 ++++
.../{gtk-pcb-coord-entry.c => ghid-coord-entry.c} | 76 +++++++-------
src/hid/gtk/ghid-coord-entry.h | 35 ++++++
...-pcb-layer-selector.c => ghid-layer-selector.c} | 118 ++++++++++----------
src/hid/gtk/ghid-layer-selector.h | 45 ++++++++
src/hid/gtk/gtk-pcb-cell-renderer-visibility.h | 24 ----
src/hid/gtk/gtk-pcb-coord-entry.h | 35 ------
src/hid/gtk/gtk-pcb-layer-selector.h | 45 --------
src/hid/gtk/gui-config.c | 8 +-
src/hid/gtk/gui-dialog-print.c | 6 +-
src/hid/gtk/gui-dialog-size.c | 28 +++---
src/hid/gtk/gui-top-window.c | 84 +++++++-------
src/hid/gtk/gui-utils.c | 17 ++--
src/hid/gtk/gui.h | 6 +-
16 files changed, 340 insertions(+), 341 deletions(-)
rename src/hid/gtk/{gtk-pcb-cell-renderer-visibility.c => ghid-cell-renderer-visibility.c} (61%)
create mode 100644 src/hid/gtk/ghid-cell-renderer-visibility.h
rename src/hid/gtk/{gtk-pcb-coord-entry.c => ghid-coord-entry.c} (76%)
create mode 100644 src/hid/gtk/ghid-coord-entry.h
rename src/hid/gtk/{gtk-pcb-layer-selector.c => ghid-layer-selector.c} (87%)
create mode 100644 src/hid/gtk/ghid-layer-selector.h
delete mode 100644 src/hid/gtk/gtk-pcb-cell-renderer-visibility.h
delete mode 100644 src/hid/gtk/gtk-pcb-coord-entry.h
delete mode 100644 src/hid/gtk/gtk-pcb-layer-selector.h
=================
Commit Messages
=================
commit 728f350268e134ca116a6f79577843db7b18e82c
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Rename GtkPcbCoordEntry to GHidCoordEntry
:100644 100644 00e7453... 4b66ac7... M src/Makefile.am
:000000 100644 0000000... a49ceca... A src/hid/gtk/ghid-coord-entry.c
:000000 100644 0000000... e90c9f9... A src/hid/gtk/ghid-coord-entry.h
:100644 000000 233dc9b... 0000000... D src/hid/gtk/gtk-pcb-coord-entry.c
:100644 000000 3827ccf... 0000000... D src/hid/gtk/gtk-pcb-coord-entry.h
:100644 100644 215f16a... 88bf547... M src/hid/gtk/gui-config.c
:100644 100644 71b078f... ce98f13... M src/hid/gtk/gui-dialog-print.c
:100644 100644 27c0336... 8cc9185... M src/hid/gtk/gui-dialog-size.c
:100644 100644 a36057b... e9008c6... M src/hid/gtk/gui-utils.c
:100644 100644 ad2a112... 30ff593... M src/hid/gtk/gui.h
commit 73591e0e0e4c2abc764a2a8be503a44da1ca86f4
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Rename GtkPcbLayerSelector to GHidLayerSelector
:100644 100644 f4bba29... 00e7453... M src/Makefile.am
:000000 100644 0000000... 06dc8cd... A src/hid/gtk/ghid-layer-selector.c
:000000 100644 0000000... bfeffe9... A src/hid/gtk/ghid-layer-selector.h
:100644 000000 1067aeb... 0000000... D src/hid/gtk/gtk-pcb-layer-selector.c
:100644 000000 27b0de9... 0000000... D src/hid/gtk/gtk-pcb-layer-selector.h
:100644 100644 26e0030... 9d170c8... M src/hid/gtk/gui-top-window.c
commit 352a088d8c506ef0407cb9c88844bf4033576eb0
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Rename GtkPcbCellRendererVisibility to GHidCellRendererVisibility
:100644 100644 d4c37e0... f4bba29... M src/Makefile.am
:000000 100644 0000000... 2e07c67... A src/hid/gtk/ghid-cell-renderer-visibility.c
:000000 100644 0000000... be08fae... A src/hid/gtk/ghid-cell-renderer-visibility.h
:100644 000000 9e8593c... 0000000... D src/hid/gtk/gtk-pcb-cell-renderer-visibility.c
:100644 000000 212c4a4... 0000000... D src/hid/gtk/gtk-pcb-cell-renderer-visibility.h
:100644 100644 c8c9849... 1067aeb... M src/hid/gtk/gtk-pcb-layer-selector.c
=========
Changes
=========
commit 728f350268e134ca116a6f79577843db7b18e82c
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Rename GtkPcbCoordEntry to GHidCoordEntry
diff --git a/src/Makefile.am b/src/Makefile.am
index 00e7453..4b66ac7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -270,8 +270,8 @@ libgtk_a_CPPFLAGS = -I./hid/gtk
LIBGTK_SRCS = \
dolists.h \
hid/hidint.h \
- hid/gtk/gtk-pcb-coord-entry.c \
- hid/gtk/gtk-pcb-coord-entry.h \
+ hid/gtk/ghid-coord-entry.c \
+ hid/gtk/ghid-coord-entry.h \
hid/gtk/ghid-layer-selector.c \
hid/gtk/ghid-layer-selector.h \
hid/gtk/ghid-cell-renderer-visibility.c \
diff --git a/src/hid/gtk/ghid-coord-entry.c b/src/hid/gtk/ghid-coord-entry.c
new file mode 100644
index 0000000..a49ceca
--- /dev/null
+++ b/src/hid/gtk/ghid-coord-entry.c
@@ -0,0 +1,312 @@
+/*! \file <gtk-pcb-coord-entry.c>
+ * \brief Implementation of GHidCoordEntry widget
+ * \par Description
+ * This widget is a modified spinbox for the user to enter
+ * pcb coords. It is assigned a default unit (for display),
+ * but this can be changed by the user by typing a new one
+ * or right-clicking on the box.
+ *
+ * Internally, it keeps track of its value in pcb coords.
+ * From the user's perspective, it uses natural human units.
+ */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+#include "gtkhid.h"
+#include "gui.h"
+#include "pcb-printf.h"
+
+#include "ghid-coord-entry.h"
+
+enum {
+ UNIT_CHANGE_SIGNAL,
+ LAST_SIGNAL
+};
+
+static guint ghid_coord_entry_signals[LAST_SIGNAL] = { 0 };
+
+struct _GHidCoordEntry
+{
+ GtkSpinButton parent;
+
+ Coord min_value;
+ Coord max_value;
+ Coord value;
+
+ enum ce_step_size step_size;
+ const Unit *unit;
+};
+
+struct _GHidCoordEntryClass
+{
+ GtkSpinButtonClass parent_class;
+
+ void (* change_unit) (GHidCoordEntry *, const Unit *);
+};
+
+/* SIGNAL HANDLERS */
+/*! \brief Callback for "Change Unit" menu click */
+static void
+menu_item_activate_cb (GtkMenuItem *item, GHidCoordEntry *ce)
+{
+ const char *text = gtk_menu_item_get_label (item);
+ const Unit *unit = get_unit_struct (text);
+
+ g_signal_emit (ce, ghid_coord_entry_signals[UNIT_CHANGE_SIGNAL], 0, unit);
+}
+
+/*! \brief Callback for context menu creation */
+static void
+ghid_coord_entry_popup_cb (GHidCoordEntry *ce, GtkMenu *menu, gpointer data)
+{
+ int i, n;
+ const Unit *unit_list;
+ GtkWidget *menu_item, *submenu;
+
+ /* Build submenu */
+ n = get_n_units ();
+ unit_list = get_unit_list ();
+
+ submenu = gtk_menu_new ();
+ for (i = 0; i < n; ++i)
+ {
+ menu_item = gtk_menu_item_new_with_label (unit_list[i].suffix);
+ g_signal_connect (G_OBJECT (menu_item), "activate",
+ G_CALLBACK (menu_item_activate_cb), ce);
+ gtk_menu_shell_append (GTK_MENU_SHELL (submenu), menu_item);
+ gtk_widget_show (menu_item);
+ }
+
+ /* Add submenu to menu */
+ menu_item = gtk_separator_menu_item_new ();
+ gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
+ gtk_widget_show (menu_item);
+
+ menu_item = gtk_menu_item_new_with_label (_("Change Units"));
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), submenu);
+ gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
+ gtk_widget_show (menu_item);
+}
+
+/*! \brief Callback for user output */
+static gboolean
+ghid_coord_entry_output_cb (GHidCoordEntry *ce, gpointer data)
+{
+ GtkAdjustment *adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (ce));
+ double value = gtk_adjustment_get_value (adj);
+ gchar *text;
+
+ text = pcb_g_strdup_printf ("%.*f %s", ce->unit->default_prec, value, ce->unit->suffix);
+ gtk_entry_set_text (GTK_ENTRY (ce), text);
+ g_free (text);
+
+ return TRUE;
+}
+
+/*! \brief Callback for user input */
+static gboolean
+ghid_coord_text_changed_cb (GHidCoordEntry *entry, gpointer data)
+{
+ const char *text;
+ char *suffix;
+ const Unit *new_unit;
+ double value;
+
+ /* Check if units have changed */
+ text = gtk_entry_get_text (GTK_ENTRY (entry));
+ value = strtod (text, &suffix);
+ new_unit = get_unit_struct (suffix);
+ if (new_unit && new_unit != entry->unit)
+ {
+ entry->value = unit_to_coord (new_unit, value);
+ g_signal_emit (entry, ghid_coord_entry_signals[UNIT_CHANGE_SIGNAL], 0, new_unit);
+ }
+
+ return FALSE;
+}
+
+/*! \brief Callback for change in value (input or ^v clicks) */
+static gboolean
+ghid_coord_value_changed_cb (GHidCoordEntry *ce, gpointer data)
+{
+ GtkAdjustment *adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (ce));
+
+ /* Re-calculate internal value */
+ double value = gtk_adjustment_get_value (adj);
+ ce->value = unit_to_coord (ce->unit, value);
+ /* Handle potential unit changes */
+ ghid_coord_text_changed_cb (ce, data);
+
+ return FALSE;
+}
+
+/*! \brief Change the unit used by a coord entry
+ *
+ * \param [in] ce The entry to be acted on
+ * \parin [in] new_unit The new unit to be used
+ */
+static void
+ghid_coord_entry_change_unit (GHidCoordEntry *ce, const Unit *new_unit)
+{
+ double climb_rate = 0.0;
+ GtkAdjustment *adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (ce));
+
+ ce->unit = new_unit;
+ /* Re-calculate min/max values for spinbox */
+ gtk_adjustment_configure (adj, coord_to_unit (new_unit, ce->value),
+ coord_to_unit (new_unit, ce->min_value),
+ coord_to_unit (new_unit, ce->max_value),
+ ce->unit->step_small,
+ ce->unit->step_medium,
+ 0.0);
+
+ switch (ce->step_size)
+ {
+ case CE_TINY: climb_rate = new_unit->step_tiny; break;
+ case CE_SMALL: climb_rate = new_unit->step_small; break;
+ case CE_MEDIUM: climb_rate = new_unit->step_medium; break;
+ case CE_LARGE: climb_rate = new_unit->step_large; break;
+ }
+ gtk_spin_button_configure (GTK_SPIN_BUTTON (ce), adj, climb_rate,
+ new_unit->default_prec + strlen (new_unit->suffix));
+}
+
+/* CONSTRUCTOR */
+static void
+ghid_coord_entry_init (GHidCoordEntry *ce)
+{
+ /* Hookup signal handlers */
+ g_signal_connect (G_OBJECT (ce), "focus_out_event",
+ G_CALLBACK (ghid_coord_text_changed_cb), NULL);
+ g_signal_connect (G_OBJECT (ce), "value_changed",
+ G_CALLBACK (ghid_coord_value_changed_cb), NULL);
+ g_signal_connect (G_OBJECT (ce), "populate_popup",
+ G_CALLBACK (ghid_coord_entry_popup_cb), NULL);
+ g_signal_connect (G_OBJECT (ce), "output",
+ G_CALLBACK (ghid_coord_entry_output_cb), NULL);
+}
+
+static void
+ghid_coord_entry_class_init (GHidCoordEntryClass *klass)
+{
+ klass->change_unit = ghid_coord_entry_change_unit;
+
+ /* GtkAutoComplete *ce : the object acted on */
+ /* const Unit *new_unit: the new unit that was set */
+ ghid_coord_entry_signals[UNIT_CHANGE_SIGNAL] =
+ g_signal_new ("change-unit",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GHidCoordEntryClass, change_unit),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE,
+ 1, G_TYPE_POINTER);
+
+}
+
+/* PUBLIC FUNCTIONS */
+GType
+ghid_coord_entry_get_type (void)
+{
+ static GType ce_type = 0;
+
+ if (!ce_type)
+ {
+ const GTypeInfo ce_info =
+ {
+ sizeof (GHidCoordEntryClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ghid_coord_entry_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GHidCoordEntry),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ghid_coord_entry_init,
+ };
+
+ ce_type = g_type_register_static (GTK_TYPE_SPIN_BUTTON,
+ "GHidCoordEntry",
+ &ce_info,
+ 0);
+ }
+
+ return ce_type;
+}
+
+/*! \brief Create a new GHidCoordEntry
+ *
+ * \param [in] min_val The minimum allowed value, in pcb coords
+ * \param [in] max_val The maximum allowed value, in pcb coords
+ * \param [in] value The default value, in pcb coords
+ * \param [in] unit The default unit
+ * \param [in] step_size How large the default increments should be
+ *
+ * \return a freshly-allocated GHidCoordEntry
+ */
+GtkWidget *
+ghid_coord_entry_new (Coord min_val, Coord max_val, Coord value,
+ const Unit *unit, enum ce_step_size step_size)
+{
+ /* Setup spinbox min/max values */
+ double small_step, big_step;
+ GtkAdjustment *adj;
+ GHidCoordEntry *ce = g_object_new (GHID_COORD_ENTRY_TYPE, NULL);
+
+ ce->unit = unit;
+ ce->min_value = min_val;
+ ce->max_value = max_val;
+ ce->value = value;
+
+ ce->step_size = step_size;
+ switch (step_size)
+ {
+ case CE_TINY:
+ small_step = unit->step_tiny;
+ big_step = unit->step_small;
+ break;
+ case CE_SMALL:
+ small_step = unit->step_small;
+ big_step = unit->step_medium;
+ break;
+ case CE_MEDIUM:
+ small_step = unit->step_medium;
+ big_step = unit->step_large;
+ break;
+ case CE_LARGE:
+ small_step = unit->step_large;
+ big_step = unit->step_huge;
+ break;
+ default:
+ small_step = big_step = 0;
+ break;
+ }
+
+ adj = GTK_ADJUSTMENT (gtk_adjustment_new (coord_to_unit (unit, value),
+ coord_to_unit (unit, min_val),
+ coord_to_unit (unit, max_val),
+ small_step, big_step, 0.0));
+ gtk_spin_button_configure (GTK_SPIN_BUTTON (ce), adj, small_step,
+ unit->default_prec + strlen (unit->suffix));
+ gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (ce), FALSE);
+
+ return GTK_WIDGET (ce);
+}
+
+/*! \brief Gets a GHidCoordEntry's value, in pcb coords */
+Coord
+ghid_coord_entry_get_value (GHidCoordEntry *ce)
+{
+ return ce->value;
+}
+
+/*! \brief Sets a GHidCoordEntry's value, in pcb coords */
+void
+ghid_coord_entry_set_value (GHidCoordEntry *ce, Coord val)
+{
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (ce),
+ coord_to_unit (ce->unit, val));
+}
+
diff --git a/src/hid/gtk/ghid-coord-entry.h b/src/hid/gtk/ghid-coord-entry.h
new file mode 100644
index 0000000..e90c9f9
--- /dev/null
+++ b/src/hid/gtk/ghid-coord-entry.h
@@ -0,0 +1,35 @@
+/* This is the modified GtkSpinbox used for entering Coords.
+ * Hopefully it can be used as a template whenever we migrate the
+ * rest of the Gtk HID to use GObjects and GtkWidget subclassing.
+ */
+#ifndef GHID_COORD_ENTRY_H__
+#define GHID_COORD_ENTRY_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS /* keep c++ happy */
+
+#define GHID_COORD_ENTRY_TYPE (ghid_coord_entry_get_type ())
+#define GHID_COORD_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GHID_COORD_ENTRY_TYPE, GHidCoordEntry))
+#define GHID_COORD_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GHID_COORD_ENTRY_TYPE, GHidCoordEntryClass))
+#define IS_GHID_COORD_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GHID_COORD_ENTRY_TYPE))
+#define IS_GHID_COORD_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GHID_COORD_ENTRY_TYPE))
+
+typedef struct _GHidCoordEntry GHidCoordEntry;
+typedef struct _GHidCoordEntryClass GHidCoordEntryClass;
+
+/* Step sizes */
+enum ce_step_size { CE_TINY, CE_SMALL, CE_MEDIUM, CE_LARGE };
+
+GType ghid_coord_entry_get_type (void);
+GtkWidget* ghid_coord_entry_new (Coord min_val, Coord max_val, Coord value,
+ const Unit *unit, enum ce_step_size step_size);
+void ghid_coord_entry_add_entry (GHidCoordEntry *ce, const gchar *name, const gchar *desc);
+gchar *ghid_coord_entry_get_last_command (GHidCoordEntry *ce);
+
+Coord ghid_coord_entry_get_value (GHidCoordEntry *ce);
+void ghid_coord_entry_set_value (GHidCoordEntry *ce, Coord val);
+
+G_END_DECLS /* keep c++ happy */
+#endif
diff --git a/src/hid/gtk/gtk-pcb-coord-entry.c b/src/hid/gtk/gtk-pcb-coord-entry.c
deleted file mode 100644
index 233dc9b..0000000
--- a/src/hid/gtk/gtk-pcb-coord-entry.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/*! \file <gtk-pcb-coord-entry.c>
- * \brief Implementation of GtkPcbCoordEntry widget
- * \par Description
- * This widget is a modified spinbox for the user to enter
- * pcb coords. It is assigned a default unit (for display),
- * but this can be changed by the user by typing a new one
- * or right-clicking on the box.
- *
- * Internally, it keeps track of its value in pcb coords.
- * From the user's perspective, it uses natural human units.
- */
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gtk/gtk.h>
-
-#include "gtkhid.h"
-#include "gui.h"
-#include "pcb-printf.h"
-
-#include "gtk-pcb-coord-entry.h"
-
-enum {
- UNIT_CHANGE_SIGNAL,
- LAST_SIGNAL
-};
-
-static guint gtk_pcb_coord_entry_signals[LAST_SIGNAL] = { 0 };
-
-struct _GtkPcbCoordEntry
-{
- GtkSpinButton parent;
-
- Coord min_value;
- Coord max_value;
- Coord value;
-
- enum ce_step_size step_size;
- const Unit *unit;
-};
-
-struct _GtkPcbCoordEntryClass
-{
- GtkSpinButtonClass parent_class;
-
- void (* change_unit) (GtkPcbCoordEntry *, const Unit *);
-};
-
-/* SIGNAL HANDLERS */
-/*! \brief Callback for "Change Unit" menu click */
-static void
-menu_item_activate_cb (GtkMenuItem *item, GtkPcbCoordEntry *ce)
-{
- const char *text = gtk_menu_item_get_label (item);
- const Unit *unit = get_unit_struct (text);
-
- g_signal_emit (ce, gtk_pcb_coord_entry_signals[UNIT_CHANGE_SIGNAL], 0, unit);
-}
-
-/*! \brief Callback for context menu creation */
-static void
-gtk_pcb_coord_entry_popup_cb (GtkPcbCoordEntry *ce, GtkMenu *menu, gpointer data)
-{
- int i, n;
- const Unit *unit_list;
- GtkWidget *menu_item, *submenu;
-
- /* Build submenu */
- n = get_n_units ();
- unit_list = get_unit_list ();
-
- submenu = gtk_menu_new ();
- for (i = 0; i < n; ++i)
- {
- menu_item = gtk_menu_item_new_with_label (unit_list[i].suffix);
- g_signal_connect (G_OBJECT (menu_item), "activate",
- G_CALLBACK (menu_item_activate_cb), ce);
- gtk_menu_shell_append (GTK_MENU_SHELL (submenu), menu_item);
- gtk_widget_show (menu_item);
- }
-
- /* Add submenu to menu */
- menu_item = gtk_separator_menu_item_new ();
- gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
- gtk_widget_show (menu_item);
-
- menu_item = gtk_menu_item_new_with_label (_("Change Units"));
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), submenu);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
- gtk_widget_show (menu_item);
-}
-
-/*! \brief Callback for user output */
-static gboolean
-gtk_pcb_coord_entry_output_cb (GtkPcbCoordEntry *ce, gpointer data)
-{
- GtkAdjustment *adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (ce));
- double value = gtk_adjustment_get_value (adj);
- gchar *text;
-
- text = pcb_g_strdup_printf ("%.*f %s", ce->unit->default_prec, value, ce->unit->suffix);
- gtk_entry_set_text (GTK_ENTRY (ce), text);
- g_free (text);
-
- return TRUE;
-}
-
-/*! \brief Callback for user input */
-static gboolean
-gtk_pcb_coord_text_changed_cb (GtkPcbCoordEntry *entry, gpointer data)
-{
- const char *text;
- char *suffix;
- const Unit *new_unit;
- double value;
-
- /* Check if units have changed */
- text = gtk_entry_get_text (GTK_ENTRY (entry));
- value = strtod (text, &suffix);
- new_unit = get_unit_struct (suffix);
- if (new_unit && new_unit != entry->unit)
- {
- entry->value = unit_to_coord (new_unit, value);
- g_signal_emit (entry, gtk_pcb_coord_entry_signals[UNIT_CHANGE_SIGNAL], 0, new_unit);
- }
-
- return FALSE;
-}
-
-/*! \brief Callback for change in value (input or ^v clicks) */
-static gboolean
-gtk_pcb_coord_value_changed_cb (GtkPcbCoordEntry *ce, gpointer data)
-{
- GtkAdjustment *adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (ce));
-
- /* Re-calculate internal value */
- double value = gtk_adjustment_get_value (adj);
- ce->value = unit_to_coord (ce->unit, value);
- /* Handle potential unit changes */
- gtk_pcb_coord_text_changed_cb (ce, data);
-
- return FALSE;
-}
-
-/*! \brief Change the unit used by a coord entry
- *
- * \param [in] ce The entry to be acted on
- * \parin [in] new_unit The new unit to be used
- */
-static void
-gtk_pcb_coord_entry_change_unit (GtkPcbCoordEntry *ce, const Unit *new_unit)
-{
- double climb_rate = 0.0;
- GtkAdjustment *adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (ce));
-
- ce->unit = new_unit;
- /* Re-calculate min/max values for spinbox */
- gtk_adjustment_configure (adj, coord_to_unit (new_unit, ce->value),
- coord_to_unit (new_unit, ce->min_value),
- coord_to_unit (new_unit, ce->max_value),
- ce->unit->step_small,
- ce->unit->step_medium,
- 0.0);
-
- switch (ce->step_size)
- {
- case CE_TINY: climb_rate = new_unit->step_tiny; break;
- case CE_SMALL: climb_rate = new_unit->step_small; break;
- case CE_MEDIUM: climb_rate = new_unit->step_medium; break;
- case CE_LARGE: climb_rate = new_unit->step_large; break;
- }
- gtk_spin_button_configure (GTK_SPIN_BUTTON (ce), adj, climb_rate,
- new_unit->default_prec + strlen (new_unit->suffix));
-}
-
-/* CONSTRUCTOR */
-static void
-gtk_pcb_coord_entry_init (GtkPcbCoordEntry *ce)
-{
- /* Hookup signal handlers */
- g_signal_connect (G_OBJECT (ce), "focus_out_event",
- G_CALLBACK (gtk_pcb_coord_text_changed_cb), NULL);
- g_signal_connect (G_OBJECT (ce), "value_changed",
- G_CALLBACK (gtk_pcb_coord_value_changed_cb), NULL);
- g_signal_connect (G_OBJECT (ce), "populate_popup",
- G_CALLBACK (gtk_pcb_coord_entry_popup_cb), NULL);
- g_signal_connect (G_OBJECT (ce), "output",
- G_CALLBACK (gtk_pcb_coord_entry_output_cb), NULL);
-}
-
-static void
-gtk_pcb_coord_entry_class_init (GtkPcbCoordEntryClass *klass)
-{
- klass->change_unit = gtk_pcb_coord_entry_change_unit;
-
- /* GtkAutoComplete *ce : the object acted on */
- /* const Unit *new_unit: the new unit that was set */
- gtk_pcb_coord_entry_signals[UNIT_CHANGE_SIGNAL] =
- g_signal_new ("change-unit",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GtkPcbCoordEntryClass, change_unit),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE,
- 1, G_TYPE_POINTER);
-
-}
-
-/* PUBLIC FUNCTIONS */
-GType
-gtk_pcb_coord_entry_get_type (void)
-{
- static GType ce_type = 0;
-
- if (!ce_type)
- {
- const GTypeInfo ce_info =
- {
- sizeof (GtkPcbCoordEntryClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gtk_pcb_coord_entry_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GtkPcbCoordEntry),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gtk_pcb_coord_entry_init,
- };
-
- ce_type = g_type_register_static (GTK_TYPE_SPIN_BUTTON,
- "GtkPcbCoordEntry",
- &ce_info,
- 0);
- }
-
- return ce_type;
-}
-
-/*! \brief Create a new GtkPcbCoordEntry
- *
- * \param [in] min_val The minimum allowed value, in pcb coords
- * \param [in] max_val The maximum allowed value, in pcb coords
- * \param [in] value The default value, in pcb coords
- * \param [in] unit The default unit
- * \param [in] step_size How large the default increments should be
- *
- * \return a freshly-allocated GtkPcbCoordEntry
- */
-GtkWidget *
-gtk_pcb_coord_entry_new (Coord min_val, Coord max_val, Coord value,
- const Unit *unit, enum ce_step_size step_size)
-{
- /* Setup spinbox min/max values */
- double small_step, big_step;
- GtkAdjustment *adj;
- GtkPcbCoordEntry *ce = g_object_new (GTK_PCB_COORD_ENTRY_TYPE, NULL);
-
- ce->unit = unit;
- ce->min_value = min_val;
- ce->max_value = max_val;
- ce->value = value;
-
- ce->step_size = step_size;
- switch (step_size)
- {
- case CE_TINY:
- small_step = unit->step_tiny;
- big_step = unit->step_small;
- break;
- case CE_SMALL:
- small_step = unit->step_small;
- big_step = unit->step_medium;
- break;
- case CE_MEDIUM:
- small_step = unit->step_medium;
- big_step = unit->step_large;
- break;
- case CE_LARGE:
- small_step = unit->step_large;
- big_step = unit->step_huge;
- break;
- default:
- small_step = big_step = 0;
- break;
- }
-
- adj = GTK_ADJUSTMENT (gtk_adjustment_new (coord_to_unit (unit, value),
- coord_to_unit (unit, min_val),
- coord_to_unit (unit, max_val),
- small_step, big_step, 0.0));
- gtk_spin_button_configure (GTK_SPIN_BUTTON (ce), adj, small_step,
- unit->default_prec + strlen (unit->suffix));
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (ce), FALSE);
-
- return GTK_WIDGET (ce);
-}
-
-/*! \brief Gets a GtkPcbCoordEntry's value, in pcb coords */
-Coord
-gtk_pcb_coord_entry_get_value (GtkPcbCoordEntry *ce)
-{
- return ce->value;
-}
-
-/*! \brief Sets a GtkPcbCoordEntry's value, in pcb coords */
-void
-gtk_pcb_coord_entry_set_value (GtkPcbCoordEntry *ce, Coord val)
-{
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (ce),
- coord_to_unit (ce->unit, val));
-}
-
diff --git a/src/hid/gtk/gtk-pcb-coord-entry.h b/src/hid/gtk/gtk-pcb-coord-entry.h
deleted file mode 100644
index 3827ccf..0000000
--- a/src/hid/gtk/gtk-pcb-coord-entry.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* This is the modified GtkSpinbox used for entering Coords.
- * Hopefully it can be used as a template whenever we migrate the
- * rest of the Gtk HID to use GObjects and GtkWidget subclassing.
- */
-#ifndef GTK_PCB_COORD_ENTRY_H__
-#define GTK_PCB_COORD_ENTRY_H__
-
-#include <glib.h>
-#include <glib-object.h>
-
-G_BEGIN_DECLS /* keep c++ happy */
-
-#define GTK_PCB_COORD_ENTRY_TYPE (gtk_pcb_coord_entry_get_type ())
-#define GTK_PCB_COORD_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_PCB_COORD_ENTRY_TYPE, GtkPcbCoordEntry))
-#define GTK_PCB_COORD_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_PCB_COORD_ENTRY_TYPE, GtkPcbCoordEntryClass))
-#define IS_GTK_PCB_COORD_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_PCB_COORD_ENTRY_TYPE))
-#define IS_GTK_PCB_COORD_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_PCB_COORD_ENTRY_TYPE))
-
-typedef struct _GtkPcbCoordEntry GtkPcbCoordEntry;
-typedef struct _GtkPcbCoordEntryClass GtkPcbCoordEntryClass;
-
-/* Step sizes */
-enum ce_step_size { CE_TINY, CE_SMALL, CE_MEDIUM, CE_LARGE };
-
-GType gtk_pcb_coord_entry_get_type (void);
-GtkWidget* gtk_pcb_coord_entry_new (Coord min_val, Coord max_val, Coord value,
- const Unit *unit, enum ce_step_size step_size);
-void gtk_pcb_coord_entry_add_entry (GtkPcbCoordEntry *ce, const gchar *name, const gchar *desc);
-gchar *gtk_pcb_coord_entry_get_last_command (GtkPcbCoordEntry *ce);
-
-Coord gtk_pcb_coord_entry_get_value (GtkPcbCoordEntry *ce);
-void gtk_pcb_coord_entry_set_value (GtkPcbCoordEntry *ce, Coord val);
-
-G_END_DECLS /* keep c++ happy */
-#endif
diff --git a/src/hid/gtk/gui-config.c b/src/hid/gtk/gui-config.c
index 215f16a..88bf547 100644
--- a/src/hid/gtk/gui-config.c
+++ b/src/hid/gtk/gui-config.c
@@ -1011,9 +1011,9 @@ text_spin_button_cb (GtkSpinButton * spin, void * dst)
}
static void
-coord_entry_cb (GtkPcbCoordEntry * ce, void * dst)
+coord_entry_cb (GHidCoordEntry * ce, void * dst)
{
- *(Coord *) dst = gtk_pcb_coord_entry_get_value (ce);
+ *(Coord *) dst = ghid_coord_entry_get_value (ce);
ghidgui->config_modified = TRUE;
}
@@ -1139,9 +1139,9 @@ config_sizes_tab_create (GtkWidget * tab_vbox)
static GtkWidget *config_increments_vbox, *config_increments_tab_vbox;
static void
-increment_spin_button_cb (GtkPcbCoordEntry * ce, void * dst)
+increment_spin_button_cb (GHidCoordEntry * ce, void * dst)
{
- *(Coord *)dst = gtk_pcb_coord_entry_get_value (ce);
+ *(Coord *)dst = ghid_coord_entry_get_value (ce);
ghidgui->config_modified = TRUE;
}
diff --git a/src/hid/gtk/gui-dialog-print.c b/src/hid/gtk/gui-dialog-print.c
index 71b078f..ce98f13 100644
--- a/src/hid/gtk/gui-dialog-print.c
+++ b/src/hid/gtk/gui-dialog-print.c
@@ -174,9 +174,9 @@ ghid_attribute_dialog (HID_Attribute * attrs,
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- entry = gtk_pcb_coord_entry_new (attrs[j].min_val, attrs[j].max_val,
- attrs[j].default_val.coord_value,
- Settings.grid_unit, CE_SMALL);
+ entry = ghid_coord_entry_new (attrs[j].min_val, attrs[j].max_val,
+ attrs[j].default_val.coord_value,
+ Settings.grid_unit, CE_SMALL);
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
if(attrs[j].default_val.str_value != NULL)
gtk_entry_set_text (GTK_ENTRY (entry),
diff --git a/src/hid/gtk/gui-dialog-size.c b/src/hid/gtk/gui-dialog-size.c
index 27c0336..8cc9185 100644
--- a/src/hid/gtk/gui-dialog-size.c
+++ b/src/hid/gtk/gui-dialog-size.c
@@ -85,32 +85,32 @@ make_route_string(RouteStyleType * rs)
}
static void
-via_hole_cb (GtkPcbCoordEntry * entry, gpointer data)
+via_hole_cb (GHidCoordEntry * entry, gpointer data)
{
SizesDialog * sd = (SizesDialog *)data;
gdouble via_hole_size, via_size;
- via_hole_size = gtk_pcb_coord_entry_get_value (entry);
- via_size = gtk_pcb_coord_entry_get_value
- (GTK_PCB_COORD_ENTRY (sd->via_size_coord_entry));
+ via_hole_size = ghid_coord_entry_get_value (entry);
+ via_size = ghid_coord_entry_get_value
+ (GHID_COORD_ENTRY (sd->via_size_coord_entry));
if (via_size < via_hole_size + MIN_PINORVIACOPPER)
- gtk_pcb_coord_entry_set_value (GTK_PCB_COORD_ENTRY (sd->via_size_coord_entry),
+ ghid_coord_entry_set_value (GHID_COORD_ENTRY (sd->via_size_coord_entry),
via_hole_size + MIN_PINORVIACOPPER);
}
static void
-via_size_cb (GtkPcbCoordEntry * entry, gpointer data)
+via_size_cb (GHidCoordEntry * entry, gpointer data)
{
SizesDialog * sd = (SizesDialog *)data;
gdouble via_hole_size, via_size;
- via_size = gtk_pcb_coord_entry_get_value (entry);
- via_hole_size = gtk_pcb_coord_entry_get_value
- (GTK_PCB_COORD_ENTRY (sd->via_hole_coord_entry));
+ via_size = ghid_coord_entry_get_value (entry);
+ via_hole_size = ghid_coord_entry_get_value
+ (GHID_COORD_ENTRY (sd->via_hole_coord_entry));
if (via_hole_size > via_size - MIN_PINORVIACOPPER)
- gtk_pcb_coord_entry_set_value (GTK_PCB_COORD_ENTRY (sd->via_hole_coord_entry),
+ ghid_coord_entry_set_value (GHID_COORD_ENTRY (sd->via_hole_coord_entry),
via_size - MIN_PINORVIACOPPER);
}
@@ -261,16 +261,16 @@ ghid_route_style_dialog (gint index, RouteStyleType * temp_rst)
rst = &rst_buf;
rst->Thick =
- gtk_pcb_coord_entry_get_value (GTK_PCB_COORD_ENTRY
+ ghid_coord_entry_get_value (GHID_COORD_ENTRY
(sd->line_width_coord_entry));
rst->Hole =
- gtk_pcb_coord_entry_get_value (GTK_PCB_COORD_ENTRY
+ ghid_coord_entry_get_value (GHID_COORD_ENTRY
(sd->via_hole_coord_entry));
rst->Diameter =
- gtk_pcb_coord_entry_get_value (GTK_PCB_COORD_ENTRY
+ ghid_coord_entry_get_value (GHID_COORD_ENTRY
(sd->via_size_coord_entry));
rst->Keepaway =
- gtk_pcb_coord_entry_get_value (GTK_PCB_COORD_ENTRY
+ ghid_coord_entry_get_value (GHID_COORD_ENTRY
(sd->clearance_coord_entry));
if (index < NUM_STYLES && !set_temp1 && !set_temp2)
diff --git a/src/hid/gtk/gui-utils.c b/src/hid/gtk/gui-utils.c
index a36057b..e9008c6 100644
--- a/src/hid/gtk/gui-utils.c
+++ b/src/hid/gtk/gui-utils.c
@@ -33,7 +33,6 @@
#endif
#include "gui.h"
-#include "gtk-pcb-coord-entry.h"
#include <gdk/gdkkeysyms.h>
#ifdef HAVE_LIBDMALLOC
@@ -273,11 +272,11 @@ ghid_button_connected (GtkWidget * box, GtkWidget ** button,
void
ghid_coord_entry (GtkWidget * box, GtkWidget ** coord_entry, Coord value,
Coord low, Coord high, enum ce_step_size step_size,
- gint width, void (*cb_func) (GtkPcbCoordEntry *, gpointer),
+ gint width, void (*cb_func) (GHidCoordEntry *, gpointer),
gpointer data, gboolean right_align, gchar * string)
{
GtkWidget *hbox = NULL, *label, *entry_widget;
- GtkPcbCoordEntry *entry;
+ GHidCoordEntry *entry;
if (string && box)
{
@@ -286,12 +285,12 @@ ghid_coord_entry (GtkWidget * box, GtkWidget ** coord_entry, Coord value,
box = hbox;
}
- entry_widget = gtk_pcb_coord_entry_new (low, high, value, Settings.grid_unit, step_size);
+ entry_widget = ghid_coord_entry_new (low, high, value, Settings.grid_unit, step_size);
if (coord_entry)
*coord_entry = entry_widget;
if (width > 0)
gtk_widget_set_size_request (entry_widget, width, -1);
- entry = GTK_PCB_COORD_ENTRY (entry_widget);
+ entry = GHID_COORD_ENTRY (entry_widget);
if (data == NULL)
data = (gpointer) entry;
if (cb_func)
@@ -368,21 +367,21 @@ void
ghid_table_coord_entry (GtkWidget * table, gint row, gint column,
GtkWidget ** coord_entry, Coord value,
Coord low, Coord high, enum ce_step_size step_size,
- gint width, void (*cb_func) (GtkPcbCoordEntry *, gpointer),
+ gint width, void (*cb_func) (GHidCoordEntry *, gpointer),
gpointer data, gboolean right_align, gchar * string)
{
GtkWidget *label, *entry_widget;
- GtkPcbCoordEntry *entry;
+ GHidCoordEntry *entry;
if (!table)
return;
- entry_widget = gtk_pcb_coord_entry_new (low, high, value, Settings.grid_unit, step_size);
+ entry_widget = ghid_coord_entry_new (low, high, value, Settings.grid_unit, step_size);
if (coord_entry)
*coord_entry = entry_widget;
if (width > 0)
gtk_widget_set_size_request (entry_widget, width, -1);
- entry = GTK_PCB_COORD_ENTRY (entry_widget);
+ entry = GHID_COORD_ENTRY (entry_widget);
if (data == NULL)
data = (gpointer) entry;
if (cb_func)
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index ad2a112..30ff593 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -36,7 +36,7 @@
#include <sys/stat.h>
#include <gtk/gtk.h>
-#include "gtk-pcb-coord-entry.h"
+#include "ghid-coord-entry.h"
#include "gui-pinout-preview.h"
@@ -371,7 +371,7 @@ void ghid_button_connected (GtkWidget * box, GtkWidget ** button,
gpointer data, gchar * string);
void ghid_coord_entry (GtkWidget * box, GtkWidget ** coord_entry, Coord value,
Coord low, Coord high, enum ce_step_size step_size,
- gint width, void (*cb_func) (GtkPcbCoordEntry *, gpointer),
+ gint width, void (*cb_func) (GHidCoordEntry *, gpointer),
gpointer data, gboolean right_align, gchar * string);
void ghid_spin_button (GtkWidget * box, GtkWidget ** spin_button,
gfloat value, gfloat low, gfloat high, gfloat step0,
@@ -381,7 +381,7 @@ void ghid_spin_button (GtkWidget * box, GtkWidget ** spin_button,
void ghid_table_coord_entry (GtkWidget * table, gint row, gint column,
GtkWidget ** coord_entry, Coord value,
Coord low, Coord high, enum ce_step_size, gint width,
- void (*cb_func) (GtkPcbCoordEntry *, gpointer), gpointer data,
+ void (*cb_func) (GHidCoordEntry *, gpointer), gpointer data,
gboolean right_align, gchar * string);
void ghid_table_spin_button (GtkWidget * box, gint row, gint column,
GtkWidget ** spin_button, gfloat value,
commit 73591e0e0e4c2abc764a2a8be503a44da1ca86f4
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Rename GtkPcbLayerSelector to GHidLayerSelector
diff --git a/src/Makefile.am b/src/Makefile.am
index f4bba29..00e7453 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -272,8 +272,8 @@ LIBGTK_SRCS = \
hid/hidint.h \
hid/gtk/gtk-pcb-coord-entry.c \
hid/gtk/gtk-pcb-coord-entry.h \
- hid/gtk/gtk-pcb-layer-selector.c \
- hid/gtk/gtk-pcb-layer-selector.h \
+ hid/gtk/ghid-layer-selector.c \
+ hid/gtk/ghid-layer-selector.h \
hid/gtk/ghid-cell-renderer-visibility.c \
hid/gtk/ghid-cell-renderer-visibility.h \
hid/gtk/gtkhid-main.c \
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
new file mode 100644
index 0000000..06dc8cd
--- /dev/null
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -0,0 +1,815 @@
+/*! \file <gtk-pcb-layer-selector.c>
+ * \brief Implementation of GHidLayerSelector widget
+ * \par Description
+ * This widget is the layer selector on the left side of the Gtk
+ * GUI. It also describes (in XML) the relevant sections of the
+ * menu for layer selection and visibility toggling, and makes
+ * sure these stay in sync.
+ */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+
+#include "gtkhid.h"
+#include "gui.h"
+#include "pcb-printf.h"
+
+#include "ghid-layer-selector.h"
+#include "ghid-cell-renderer-visibility.h"
+
+#define INITIAL_ACTION_MAX 40
+
+/* Forward dec'ls */
+static void ghid_layer_selector_finalize (GObject *object);
+
+/*! \brief Signals exposed by the widget */
+enum {
+ SELECT_LAYER_SIGNAL,
+ TOGGLE_LAYER_SIGNAL,
+ LAST_SIGNAL
+};
+
+/*! \brief Columns used for internal data store */
+enum {
+ INDEX_COL,
+ USER_ID_COL,
+ VISIBLE_COL,
+ COLOR_COL,
+ TEXT_COL,
+ FONT_COL,
+ ACTIVATABLE_COL,
+ SEPARATOR_COL,
+ N_COLS
+};
+
+static GtkTreeView *ghid_layer_selector_parent_class;
+static guint ghid_layer_selector_signals[LAST_SIGNAL] = { 0 };
+
+struct _GHidLayerSelector
+{
+ GtkTreeView parent;
+
+ GtkListStore *list_store;
+ GtkTreeSelection *selection;
+ GtkTreeViewColumn *visibility_column;
+
+ GtkActionGroup *action_group;
+
+ GtkToggleAction **view_actions;
+ GtkRadioAction **pick_actions;
+ GtkTreeRowReference **rows;
+ GSList *radio_group;
+ int max_actions;
+ int n_actions;
+
+ gboolean last_activatable;
+};
+
+struct _GHidLayerSelectorClass
+{
+ GtkTreeViewClass parent_class;
+
+ void (* select_layer) (GHidLayerSelector *, gint);
+ void (* toggle_layer) (GHidLayerSelector *, gint);
+};
+
+/*! \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
+ */
+static void
+toggle_visibility (GHidLayerSelector *ls, GtkTreeIter *iter)
+{
+ gint idx;
+ gboolean toggle;
+ gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store), iter,
+ VISIBLE_COL, &toggle, INDEX_COL, &idx, -1);
+ gtk_list_store_set (ls->list_store, iter, VISIBLE_COL, !toggle, -1);
+ gtk_toggle_action_set_active (ls->view_actions[idx], !toggle);
+}
+
+/*! \brief Decide if a GtkListStore entry is a layer or separator */
+static gboolean
+tree_view_separator_func (GtkTreeModel *model, GtkTreeIter *iter,
+ gpointer data)
+{
+ gboolean ret_val;
+ gtk_tree_model_get (model, iter, SEPARATOR_COL, &ret_val, -1);
+ return ret_val;
+}
+
+/*! \brief Decide if a GtkListStore entry may be selected */
+static gboolean
+tree_selection_func (GtkTreeSelection *selection, GtkTreeModel *model,
+ GtkTreePath *path, gboolean selected, gpointer data)
+{
+ GtkTreeIter iter;
+
+ if (gtk_tree_model_get_iter (model, &iter, path))
+ {
+ gboolean activatable;
+ gtk_tree_model_get (model, &iter, ACTIVATABLE_COL, &activatable, -1);
+ return activatable;
+ }
+
+ return FALSE;
+}
+
+/* SIGNAL HANDLERS */
+/*! \brief Callback for mouse-click: toggle visibility */
+static gboolean
+button_press_cb (GHidLayerSelector *ls, GdkEventButton *event)
+{
+ /* Handle visibility independently to prevent changing the active
+ * layer, which will happen if we let this event propagate. */
+ GtkTreeViewColumn *column;
+ GtkTreePath *path;
+ if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (ls),
+ event->x, event->y,
+ &path, &column, NULL, NULL))
+ {
+ GtkTreeIter iter;
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (ls->list_store), &iter, path);
+ if (column == ls->visibility_column)
+ {
+ toggle_visibility (ls, &iter);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/*! \brief Callback for layer selection change: sync menu */
+static void
+selection_changed_cb (GtkTreeSelection *selection, GHidLayerSelector *ls)
+{
+ GtkTreeIter iter;
+ if (gtk_tree_selection_get_selected (selection, NULL, &iter))
+ {
+ gint idx;
+ gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store), &iter,
+ INDEX_COL, &idx, -1);
+ if (ls->pick_actions[0])
+ gtk_radio_action_set_current_value (ls->pick_actions[0], idx);
+ }
+}
+
+/*! \brief Callback for menu actions: sync layer selection list, emit signal */
+static void
+menu_view_cb (GtkToggleAction *action, GtkTreeRowReference *rref)
+{
+ GHidLayerSelector *ls;
+ GtkTreeModel *model = gtk_tree_row_reference_get_model (rref);
+ GtkTreePath *path = gtk_tree_row_reference_get_path (rref);
+ gboolean state = gtk_toggle_action_get_active (action);
+ GtkTreeIter iter;
+ gint user_id;
+
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, VISIBLE_COL, state, -1);
+ gtk_tree_model_get (model, &iter, USER_ID_COL, &user_id, -1);
+
+ ls = g_object_get_data (G_OBJECT (model), "layer-selector");
+ g_signal_emit (ls, ghid_layer_selector_signals[TOGGLE_LAYER_SIGNAL],
+ 0, user_id);
+}
+
+/*! \brief Callback for menu actions: sync layer selection list, emit signal */
+static void
+menu_pick_cb (GtkRadioAction *action, GtkTreeRowReference *rref)
+{
+ GHidLayerSelector *ls;
+ GtkTreeModel *model = gtk_tree_row_reference_get_model (rref);
+ GtkTreePath *path = gtk_tree_row_reference_get_path (rref);
+ GtkTreeIter iter;
+ gint user_id;
+
+ gtk_tree_model_get_iter (model, &iter, path);
+ 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);
+ g_signal_emit (ls, ghid_layer_selector_signals[SELECT_LAYER_SIGNAL],
+ 0, user_id);
+}
+
+/* CONSTRUCTOR */
+static void
+ghid_layer_selector_init (GHidLayerSelector *ls)
+{
+ /* Hookup signal handlers */
+}
+
+static void
+ghid_layer_selector_class_init (GHidLayerSelectorClass *klass)
+{
+ GObjectClass *object_class = (GObjectClass *) klass;
+
+ ghid_layer_selector_signals[SELECT_LAYER_SIGNAL] =
+ g_signal_new ("select-layer",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GHidLayerSelectorClass, select_layer),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT, G_TYPE_NONE,
+ 1, G_TYPE_INT);
+ ghid_layer_selector_signals[TOGGLE_LAYER_SIGNAL] =
+ g_signal_new ("toggle-layer",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GHidLayerSelectorClass, toggle_layer),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT, G_TYPE_NONE,
+ 1, G_TYPE_INT);
+
+ object_class->finalize = ghid_layer_selector_finalize;
+}
+
+/*! \brief Clean up object before garbage collection
+ */
+static void
+ghid_layer_selector_finalize (GObject *object)
+{
+ int i;
+ GHidLayerSelector *ls = (GHidLayerSelector *) object;
+
+ g_object_unref (ls->action_group);
+ g_free (ls->view_actions);
+ g_free (ls->pick_actions);
+ for (i = 0; i < ls->n_actions; ++i)
+ if (ls->rows[i])
+ gtk_tree_row_reference_free (ls->rows[i]);
+ g_free (ls->rows);
+
+ G_OBJECT_CLASS (ghid_layer_selector_parent_class)->finalize (object);
+}
+
+/* PUBLIC FUNCTIONS */
+GType
+ghid_layer_selector_get_type (void)
+{
+ static GType ls_type = 0;
+
+ if (!ls_type)
+ {
+ const GTypeInfo ls_info =
+ {
+ sizeof (GHidLayerSelectorClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ghid_layer_selector_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GHidLayerSelector),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ghid_layer_selector_init,
+ };
+
+ ls_type = g_type_register_static (GTK_TYPE_TREE_VIEW,
+ "GHidLayerSelector",
+ &ls_info,
+ 0);
+ }
+
+ return ls_type;
+}
+
+/*! \brief Create a new GHidLayerSelector
+ *
+ * \return a freshly-allocated GHidLayerSelector.
+ */
+GtkWidget *
+ghid_layer_selector_new (void)
+{
+ GtkCellRenderer *renderer1 = ghid_cell_renderer_visibility_new ();
+ GtkCellRenderer *renderer2 = gtk_cell_renderer_text_new ();
+ GtkTreeViewColumn *opacity_col =
+ gtk_tree_view_column_new_with_attributes ("", renderer1,
+ "active", VISIBLE_COL,
+ "color", COLOR_COL, NULL);
+ GtkTreeViewColumn *name_col =
+ gtk_tree_view_column_new_with_attributes ("", renderer2,
+ "text", TEXT_COL,
+ "font", FONT_COL,
+ "sensitive", VISIBLE_COL, NULL);
+
+ GHidLayerSelector *ls = g_object_new (GHID_LAYER_SELECTOR_TYPE, NULL);
+
+ /* action index, active, color, text, font, is_separator */
+ ls->list_store = gtk_list_store_new (N_COLS, G_TYPE_INT, G_TYPE_INT,
+ G_TYPE_BOOLEAN, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
+ gtk_tree_view_insert_column (GTK_TREE_VIEW (ls), opacity_col, -1);
+ gtk_tree_view_insert_column (GTK_TREE_VIEW (ls), name_col, -1);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (ls), GTK_TREE_MODEL (ls->list_store));
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (ls), FALSE);
+
+ ls->last_activatable = TRUE;
+ 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->n_actions = 0;
+ ls->max_actions = INITIAL_ACTION_MAX;
+ ls->view_actions = g_malloc0 (ls->max_actions * sizeof (*ls->view_actions));
+ ls->pick_actions = g_malloc0 (ls->max_actions * sizeof (*ls->pick_actions));
+ ls->rows = g_malloc0 (ls->max_actions * sizeof (*ls->rows));
+
+ gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (ls),
+ tree_view_separator_func,
+ NULL, NULL);
+ gtk_tree_selection_set_select_function (ls->selection, tree_selection_func,
+ NULL, NULL);
+ gtk_tree_selection_set_mode (ls->selection, GTK_SELECTION_BROWSE);
+
+ g_object_set_data (G_OBJECT (ls->list_store), "layer-selector", ls);
+ g_signal_connect (ls, "button_press_event",
+ G_CALLBACK (button_press_cb), NULL);
+ g_signal_connect (ls->selection, "changed",
+ G_CALLBACK (selection_changed_cb), ls);
+
+ g_object_ref (ls->action_group);
+
+ return GTK_WIDGET (ls);
+}
+
+/*! \brief Add a layer to a GHidLayerSelector.
+ * \par Function Description
+ * This function adds an entry to a GHidLayerSelector, which will
+ * appear in the layer-selection list as well as visibility and selection
+ * menus (assuming this is a selectable layer). For the first 20 layers,
+ * keyboard accelerators will be added for selection/visibility toggling.
+ *
+ * If the user_id passed already exists in the layer selector, that layer
+ * will have its data overwritten with the new stuff.
+ *
+ * \param [in] ls The selector to be acted on
+ * \param [in] user_id An ID used to identify the layer; will be passed to selection/visibility callbacks
+ * \param [in] name The name of the layer; will be used on selector and menus
+ * \param [in] color_string The color of the layer on selector
+ * \param [in] visibile Whether the layer is visible
+ * \param [in] activatable Whether the layer appears in menus and can be selected
+ */
+void
+ghid_layer_selector_add_layer (GHidLayerSelector *ls,
+ gint user_id,
+ const gchar *name,
+ const gchar *color_string,
+ gboolean visible,
+ gboolean activatable)
+{
+ gchar *pname, *vname, *paccel, *vaccel;
+ gboolean new_iter = TRUE;
+ gboolean last_activatable = TRUE;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+
+ /* Look for existing layer with this ID */
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ls->list_store), &iter))
+ do
+ {
+ gboolean is_sep, active;
+ gint read_id;
+ gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store),
+ &iter, USER_ID_COL, &read_id,
+ SEPARATOR_COL, &is_sep,
+ ACTIVATABLE_COL, &active, -1);
+ if (!is_sep)
+ {
+ last_activatable = active;
+ if(read_id == user_id)
+ {
+ new_iter = FALSE;
+ break;
+ }
+ }
+ }
+ while (gtk_tree_model_iter_next (GTK_TREE_MODEL (ls->list_store), &iter));
+
+ /* Handle separator addition */
+ if (new_iter)
+ {
+ if (activatable != last_activatable)
+ {
+ /* Add separator between activatable/non-activatable boundaries */
+ gtk_list_store_append (ls->list_store, &iter);
+ gtk_list_store_set (ls->list_store, &iter,
+ SEPARATOR_COL, TRUE, -1);
+ }
+ /* Create new layer */
+ gtk_list_store_append (ls->list_store, &iter);
+ gtk_list_store_set (ls->list_store, &iter,
+ INDEX_COL, ls->n_actions,
+ USER_ID_COL, user_id,
+ VISIBLE_COL, visible,
+ COLOR_COL, color_string,
+ TEXT_COL, name,
+ FONT_COL, activatable ? NULL : "Italic",
+ ACTIVATABLE_COL, activatable,
+ SEPARATOR_COL, FALSE,
+ -1);
+ }
+ else
+ gtk_list_store_set (ls->list_store, &iter,
+ VISIBLE_COL, visible,
+ COLOR_COL, color_string,
+ TEXT_COL, name,
+ FONT_COL, activatable ? NULL : "Italic",
+ ACTIVATABLE_COL, activatable,
+ -1);
+
+ /* Unless we're adding new actions, we're done now */
+ if (!new_iter)
+ return;
+
+ if (activatable && ls->n_actions == 0)
+ gtk_tree_selection_select_iter (ls->selection, &iter);
+
+ /* Allocate new actions if necessary */
+ if (ls->n_actions == ls->max_actions)
+ {
+ void *tmp[2];
+ ls->max_actions *= 2;
+ tmp[0] = g_realloc (ls->view_actions,
+ ls->max_actions * sizeof (*ls->view_actions));
+ tmp[1] = g_realloc (ls->pick_actions,
+ ls->max_actions * sizeof (*ls->pick_actions));
+ tmp[2] = g_realloc (ls->rows,
+ ls->max_actions * sizeof (*ls->rows));
+ if (tmp[0] == NULL || tmp[1] == NULL || tmp[2] == NULL)
+ g_critical ("realloc failed allocating new actions");
+ else
+ {
+ ls->view_actions = tmp[0];
+ ls->pick_actions = tmp[1];
+ ls->rows = tmp[2];
+ }
+ }
+
+ /* -- Setup new actions -- */
+ vname = g_strdup_printf ("LayerView%d", ls->n_actions);
+ pname = g_strdup_printf ("LayerPick%d", ls->n_actions);
+ vaccel = NULL;
+ paccel = NULL;
+
+ /* Determine keyboard accelerators */
+ if (ls->n_actions < 10)
+ {
+ /* Map 1-0 to actions 1-10 (with '0' meaning 10) */
+ int i = (ls->n_actions + 1) % 10;
+ vaccel = g_strdup_printf ("<Ctrl>%d", i);
+ paccel = g_strdup_printf ("%d", i);
+ }
+ else
+ {
+ /* Map 1-0 to actions 11-20 (with '0' meaning 10) */
+ int i = (ls->n_actions + 1) % 10;
+ vaccel = g_strdup_printf ("<Alt><Ctrl>%d", i);
+ paccel = g_strdup_printf ("<Alt>%d", i);
+ }
+
+ /* Create row reference for actions */
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (ls->list_store), &iter);
+ ls->rows[ls->n_actions] = gtk_tree_row_reference_new
+ (GTK_TREE_MODEL (ls->list_store), path);
+ gtk_tree_path_free (path);
+
+ /* Create selection action */
+ if (activatable)
+ {
+ ls->pick_actions[ls->n_actions]
+ = gtk_radio_action_new (pname, name, NULL, NULL, ls->n_actions);
+ gtk_radio_action_set_group (ls->pick_actions[ls->n_actions],
+ ls->radio_group);
+ ls->radio_group
+ = gtk_radio_action_get_group (ls->pick_actions[ls->n_actions]);
+ gtk_action_group_add_action_with_accel
+ (ls->action_group,
+ GTK_ACTION (ls->pick_actions[ls->n_actions]),
+ paccel);
+ g_signal_connect (ls->pick_actions[ls->n_actions], "toggled",
+ G_CALLBACK (menu_pick_cb), ls->rows[ls->n_actions]);
+ }
+ else
+ ls->pick_actions[ls->n_actions] = NULL;
+
+ /* Create visibility action */
+ ls->view_actions[ls->n_actions] = gtk_toggle_action_new (vname, name,
+ NULL, NULL);
+ gtk_toggle_action_set_active (ls->view_actions[ls->n_actions], visible);
+
+ gtk_action_group_add_action_with_accel
+ (ls->action_group,
+ GTK_ACTION (ls->view_actions[ls->n_actions]),
+ vaccel);
+ g_signal_connect (ls->view_actions[ls->n_actions], "toggled",
+ G_CALLBACK (menu_view_cb), ls->rows[ls->n_actions]);
+
+ /* cleanup */
+ if (vaccel)
+ {
+ g_free (vaccel);
+ g_free (paccel);
+ }
+ g_free (vname);
+ g_free (pname);
+
+ ls->n_actions++;
+}
+
+/*! \brief Get the "Current Layer" menu description of a layer selector
+ * \par Function Description
+ * Returns the XML content used by Gtk in building the layer-selection
+ * part of the menu. This is a radio-button list describing which layer
+ * is active.
+ *
+ * \param [in] ls The selector to be acted on
+ *
+ * \return the requested XML
+ */
+gchar *
+ghid_layer_selector_get_pick_xml (GHidLayerSelector *ls)
+{
+ int i;
+ GString *str = g_string_new ("");
+
+ for (i = 0; i < ls->n_actions; ++i)
+ if (ls->pick_actions[i])
+ g_string_append_printf (str, "<menuitem action=\"LayerPick%d\" />\n", i);
+
+ return g_string_free (str, FALSE);
+}
+
+/*! \brief Get the "Shown Layers" menu description of a layer selector
+ * \par Function Description
+ * Returns the XML content used by Gtk in building the layer-selection
+ * part of the menu. This is a toggle-button list describing which layer(s)
+ * are visible.
+ *
+ * \param [in] ls The selector to be acted on
+ *
+ * \return the requested XML
+ */
+gchar *
+ghid_layer_selector_get_view_xml (GHidLayerSelector *ls)
+{
+ int i;
+ GString *str = g_string_new ("");
+
+ for (i = 0; i < ls->n_actions; ++i)
+ if (ls->view_actions[i])
+ g_string_append_printf (str, "<menuitem action=\"LayerView%d\" />\n", i);
+
+ return g_string_free (str, FALSE);
+}
+
+/*! \brief Get the GtkActionGroup containing accelerators, etc, of a layer selector
+ * \par Function Description
+ * Returns the GtkActionGroup containing the toggle and radio buttons used
+ * in the menu. Also contains the accelerators. This action group should be
+ * added to the main UI. See Gtk docs for details.
+ *
+ * \param [in] ls The selector to be acted on
+ *
+ * \return the action group of the selector
+ */
+GtkActionGroup *
+ghid_layer_selector_get_action_group (GHidLayerSelector *ls)
+{
+ return ls->action_group;
+}
+
+/*! \brief used internally */
+static gboolean
+toggle_foreach_func (GtkTreeModel *model, GtkTreePath *path,
+ GtkTreeIter *iter, gpointer data)
+{
+ gint id;
+ GHidLayerSelector *ls = g_object_get_data (G_OBJECT (model),
+ "layer-selector");
+
+ gtk_tree_model_get (model, iter, USER_ID_COL, &id, -1);
+ if (id == *(gint *) data)
+ {
+ toggle_visibility (ls, iter);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*! \brief Toggle a layer's visibility
+ * \par Function Description
+ * Toggle the layer indicated by user_id, emitting a layer-toggle signal.
+ *
+ * \param [in] ls The selector to be acted on
+ * \param [in] user_id The ID of the layer to be affected
+ */
+void
+ghid_layer_selector_toggle_layer (GHidLayerSelector *ls, gint user_id)
+{
+ gtk_tree_model_foreach (GTK_TREE_MODEL (ls->list_store),
+ toggle_foreach_func, &user_id);
+}
+
+/*! \brief used internally */
+static gboolean
+select_foreach_func (GtkTreeModel *model, GtkTreePath *path,
+ GtkTreeIter *iter, gpointer data)
+{
+ gint id;
+ GHidLayerSelector *ls = g_object_get_data (G_OBJECT (model),
+ "layer-selector");
+
+ gtk_tree_model_get (model, iter, USER_ID_COL, &id, -1);
+ if (id == *(gint *) data)
+ {
+ gtk_tree_selection_select_path (ls->selection, path);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*! \brief Select a layer
+ * \par Function Description
+ * Select the layer indicated by user_id, emitting a layer-select signal.
+ *
+ * \param [in] ls The selector to be acted on
+ * \param [in] user_id The ID of the layer to be affected
+ */
+void
+ghid_layer_selector_select_layer (GHidLayerSelector *ls, gint user_id)
+{
+ gtk_tree_model_foreach (GTK_TREE_MODEL (ls->list_store),
+ select_foreach_func, &user_id);
+}
+
+/*! \brief Selects the next visible layer
+ * \par Function Description
+ * Used to ensure hidden layers are not active; if the active layer is
+ * visible, this function is a noop. Otherwise, it will look for the
+ * next layer that IS visible, and select that. Failing that, it will
+ * return FALSE.
+ *
+ * \param [in] ls The selector to be acted on
+ *
+ * \return TRUE on success, FALSE if all selectable layers are hidden
+ */
+gboolean
+ghid_layer_selector_select_next_visible (GHidLayerSelector *ls)
+{
+ GtkTreeIter iter;
+ if (gtk_tree_selection_get_selected (ls->selection, NULL, &iter))
+ {
+ /* Scan forward, looking for selectable iter */
+ do
+ {
+ gboolean visible, activatable;
+ gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store),
+ &iter, VISIBLE_COL, &visible,
+ ACTIVATABLE_COL, &activatable, -1);
+ if (visible && activatable)
+ {
+ gtk_tree_...
[truncated message content] |
|
From: <gi...@gp...> - 2011-08-28 23:29:18
|
The branch, master has been updated
via acf8d00db4a90b555d768341a97453914b7b4aec (commit)
from 6d19063528190b3d678470919f51e59a1cc07a4d (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/gpcb-menu.res.in | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
=================
Commit Messages
=================
commit acf8d00db4a90b555d768341a97453914b7b4aec
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Add mnemonics to menus in default gpcb-menu.res.in
You can now access the main menu without a mouse, by doing
Alt+F, for example, to select the File menu.
:100644 100644 a715ffd... 7e63811... M src/gpcb-menu.res.in
=========
Changes
=========
commit acf8d00db4a90b555d768341a97453914b7b4aec
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Add mnemonics to menus in default gpcb-menu.res.in
You can now access the main menu without a mouse, by doing
Alt+F, for example, to select the File menu.
diff --git a/src/gpcb-menu.res.in b/src/gpcb-menu.res.in
index a715ffd..7e63811 100644
--- a/src/gpcb-menu.res.in
+++ b/src/gpcb-menu.res.in
@@ -45,7 +45,7 @@ MainMenu =
#
# File Menu
#
- {"File"
+ {"File" m=F
{"Save Layout" Save(Layout) tip="Saves current layout" m=S a={"Ctrl-S" "Ctrl<Key>s"}}
{"Save Layout As..." Save(LayoutAs) tip="Saves current layout into a new file" m=A a={"Shift Ctrl-S" "Shift Ctrl<Key>s"}}
-
@@ -78,7 +78,7 @@ MainMenu =
#
# Edit Menu
#
- {"Edit"
+ {"Edit" m=E
{"Undo last operation" Undo() a={"U" "<Key>u"}}
{"Redo last undone operation" Redo() a={"Shift-R" "Shift<Key>r"}}
{"Clear undo-buffer" Undo(ClearList) a={"Shift-Ctrl-U" "Shift Ctrl<Key>u"}}
@@ -114,7 +114,7 @@ MainMenu =
#
# View Menu
#
- {"View"
+ {"View" m=V
{"Enable visible grid" checked=drawgrid Display(Grid)}
{"Grid units"
{"mil" checked=grid_units_mil,1 SetUnits(mil)}
@@ -193,7 +193,7 @@ MainMenu =
#
# Settings menu
#
- {"Settings"
+ {"Settings" m=S
{"'All-direction' lines" checked=alldirection Display(Toggle45Degree) a={"." "<Key>."}}
{"Auto swap line start angle" checked=swapstartdir Display(ToggleStartDirection)}
{"Orthogonal moves" checked=orthomove Display(ToggleOrthoMove)}
@@ -227,7 +227,7 @@ MainMenu =
#
# Select menu
#
- {"Select"
+ {"Select" m=l
{"Select all visible objects" Select(All)}
{"Select all connected objects" Select(Connection)}
-
@@ -285,7 +285,7 @@ MainMenu =
#
# Buffer menu
#
- {"Buffer"
+ {"Buffer" m=B
{"Cut selection to buffer" GetXY(Click to set the snap point for this buffer)
PasteBuffer(Clear) PasteBuffer(AddSelected) RemoveSelected() Mode(PasteBuffer)}
{"Paste buffer to layout" Mode(PasteBuffer)}
@@ -313,7 +313,7 @@ MainMenu =
#
# Connects menu
#
- {"Connects"
+ {"Connects" m=C
{"Lookup connection to object" GetXY(Click on the object) Connection(Find) a={"Ctrl-F" "Ctrl<Key>f"}}
{"Reset scanned pads/pins/vias" Connection(ResetPinsViasAndPads) Display(Redraw)}
{"Reset scanned lines/polygons" Connection(ResetLinesAndPolygons) Display(Redraw)}
@@ -355,7 +355,7 @@ MainMenu =
#
# Info Menu
#
- {"Info"
+ {"Info" m=I
{"Generate object report" ReportObject() a={"Ctrl-R" "Ctrl<Key>r"}}
{"Generate drill summary" Report(DrillReport)}
{"Report found pins/pads" Report(FoundPins)}
@@ -463,7 +463,7 @@ MainMenu =
#
# Window Menu
#
- {"Window"
+ {"Window" m=W
{"Library" DoWindows(Library) a={"i" "<Key>i"}}
{"Message Log" DoWindows(Log)}
{"DRC Check" DoWindows(DRC)}
|
|
From: <gi...@gp...> - 2011-08-28 23:07:26
|
The branch, master has been updated
via 6d19063528190b3d678470919f51e59a1cc07a4d (commit)
via 9813794857f2892408a11ee69735899562b3acc2 (commit)
from 6b0b7b235c7b9937cdc22126ca9ed7a1194a4d05 (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/common/hid_resource.c | 2 +-
src/hid/common/hid_resource.h | 2 +-
src/hid/gtk/gtk-pcb-layer-selector.c | 42 ++++++++++++++++++++++-----------
src/hid/gtk/gui-top-window.c | 35 +++++++++++++--------------
src/res_parse.y | 8 +++---
src/resource.h | 6 ++--
6 files changed, 54 insertions(+), 41 deletions(-)
=================
Commit Messages
=================
commit 6d19063528190b3d678470919f51e59a1cc07a4d
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: Const-correct add_resource_to_menu and related functions
Five files have had const keywords added:
../common/hid_resource.c
../common/hid_resource.h
gui-top-window.c
../../res_parse.y
../../resource.h
No casts were added. No compilation warnings were added.
:100644 100644 11f1171... 842a058... M src/hid/common/hid_resource.c
:100644 100644 d011b31... bb3ccb6... M src/hid/common/hid_resource.h
:100644 100644 d9b3f11... 26e0030... M src/hid/gtk/gui-top-window.c
:100644 100644 373785c... efc44a0... M src/res_parse.y
:100644 100644 614aace... 119d615... M src/resource.h
commit 9813794857f2892408a11ee69735899562b3acc2
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Delete GtkAction along with layer in gtk-pcb-layer-selector.c
:100644 100644 897cd2c... c8c9849... M src/hid/gtk/gtk-pcb-layer-selector.c
=========
Changes
=========
commit 6d19063528190b3d678470919f51e59a1cc07a4d
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: Const-correct add_resource_to_menu and related functions
Five files have had const keywords added:
../common/hid_resource.c
../common/hid_resource.h
gui-top-window.c
../../res_parse.y
../../resource.h
No casts were added. No compilation warnings were added.
diff --git a/src/hid/common/hid_resource.c b/src/hid/common/hid_resource.c
index 11f1171..842a058 100644
--- a/src/hid/common/hid_resource.c
+++ b/src/hid/common/hid_resource.c
@@ -76,7 +76,7 @@ button_name_to_num (const char *name)
}
void
-load_mouse_resource (Resource *res)
+load_mouse_resource (const Resource *res)
{
int bi, mi, a;
int action_count;
diff --git a/src/hid/common/hid_resource.h b/src/hid/common/hid_resource.h
index d011b31..bb3ccb6 100644
--- a/src/hid/common/hid_resource.h
+++ b/src/hid/common/hid_resource.h
@@ -11,7 +11,7 @@
#define M_Multi M_Mod(2)
#define M_Release (~((unsigned)-1>>1)) // set the top bit
-void load_mouse_resource (Resource *res);
+void load_mouse_resource (const Resource *res);
void do_mouse_action (int button, int mods);
#endif
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index d9b3f11..26e0030 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -146,7 +146,7 @@ typedef struct
const char *flagname;
MenuFlagType flagtype;
int oldval;
- char *xres;
+ const char *xres;
} ToggleFlagType;
/* Used by the route style buttons and menu */
@@ -275,7 +275,7 @@ ghid_check_unique_accel (const char *accelerator)
*/
static void
-note_toggle_flag (const char *actionname, MenuFlagType type, char *name)
+note_toggle_flag (const char *actionname, MenuFlagType type, const char *name)
{
#ifdef DEBUG_MENUS
@@ -428,7 +428,7 @@ ghid_menu_cb (GtkAction * action, gpointer data)
const gchar * name;
int id = 0;
int vi;
- Resource *node = NULL;
+ const Resource *node = NULL;
static int in_cb = 0;
gboolean old_holdoff;
@@ -454,7 +454,7 @@ ghid_menu_cb (GtkAction * action, gpointer data)
}
else
{
- name = (char *) data;
+ name = (const char *) data;
#ifdef DEBUG_MENUS
printf ("ghid_menu_cb(): name = \"%s\"\n", UNKNOWN (name));
#endif
@@ -2419,11 +2419,11 @@ static KeyTable key_table[] =
static int n_key_table = sizeof (key_table) / sizeof (key_table[0]);
static void
-add_resource_to_menu (char * menu, Resource * node, void * callback, int indent)
+add_resource_to_menu (const char * menu, const Resource * node, int indent)
{
int i, j;
- char *v;
- Resource *r;
+ const char *v;
+ const Resource *r;
char tmps[32];
char accel[64];
int accel_n;
@@ -2439,7 +2439,7 @@ add_resource_to_menu (char * menu, Resource * node, void * callback, int indent)
{
case 101: /* named subnode */
add_resource_to_menu (node->v[i].name, node->v[i].subres,
- callback, indent + INDENT_INC);
+ indent + INDENT_INC);
break;
case 1: /* unnamed subres */
@@ -2491,7 +2491,7 @@ add_resource_to_menu (char * menu, Resource * node, void * callback, int indent)
* "Enter" -> "Return"
*
*/
- char *p;
+ const char *p;
int j;
enum {KEY, MOD} state;
@@ -2636,8 +2636,7 @@ add_resource_to_menu (char * menu, Resource * node, void * callback, int indent)
#ifdef DEBUG_MENUS
printf ("allocate %ld bytes\n", l);
#endif
- if ( (menulabel = (char *) malloc ( l * sizeof (char)))
- == NULL)
+ if ( (menulabel = (char *) malloc (l)) == NULL)
{
fprintf (stderr, "add_resource_to_menu(): malloc failed\n");
exit (1);
@@ -2696,7 +2695,7 @@ add_resource_to_menu (char * menu, Resource * node, void * callback, int indent)
* menu/submenu
*/
add_resource_to_menu ("sub menu", node->v[i].subres,
- callback, indent + INDENT_INC);
+ indent + INDENT_INC);
ghid_ui_info_indent (indent);
/* and close this menu */
@@ -2824,7 +2823,7 @@ add_resource_to_menu (char * menu, Resource * node, void * callback, int indent)
{
case 110: /* named value = X resource */
{
- char *n = node->v[i].subres->v[j].name;
+ const char *n = node->v[i].subres->v[j].name;
/* allow fg and bg to be abbreviations for
* foreground and background
*/
@@ -3040,10 +3039,10 @@ ghid_ui_info_append (const gchar * newone)
static void
ghid_load_menus (void)
{
- char *filename;
- Resource *r = 0, *bir;
+ const char *filename;
+ const Resource *r = 0, *bir;
char *home_pcbmenu;
- Resource *mr;
+ const Resource *mr;
int i;
for (i = 0; i < sizeof (ghid_hotkey_actions) / sizeof (char *) ; i++)
@@ -3106,7 +3105,7 @@ ghid_load_menus (void)
ghid_ui_info_append ("<ui>\n");
ghid_ui_info_indent (INDENT_INC);
ghid_ui_info_append ("<menubar name='MenuBar'>\n");
- add_resource_to_menu ("Initial Call", mr, 0, 2*INDENT_INC);
+ add_resource_to_menu ("Initial Call", mr, 2*INDENT_INC);
ghid_ui_info_indent (INDENT_INC);
ghid_ui_info_append ("</menubar>\n");
}
@@ -3129,7 +3128,7 @@ ghid_load_menus (void)
ghid_ui_info_append (mr->v[i].name);
ghid_ui_info_append ("'>\n");
add_resource_to_menu ("Initial Call", mr->v[i].subres,
- 0, 2*INDENT_INC);
+ 2*INDENT_INC);
ghid_ui_info_indent (INDENT_INC);
ghid_ui_info_append ("</popup>\n");
}
diff --git a/src/res_parse.y b/src/res_parse.y
index 373785c..efc44a0 100644
--- a/src/res_parse.y
+++ b/src/res_parse.y
@@ -76,7 +76,7 @@ res_item
%%
-static char *res_filename = 0;
+static const char *res_filename = 0;
static FILE *res_file = 0;
static const char **res_strings = 0;
static int res_string_idx = 0;
@@ -110,7 +110,7 @@ res_parse_getchars(char *buf, int max_size)
}
Resource *
-resource_parse(char *filename, const char **strings)
+resource_parse(const char *filename, const char **strings)
{
res_lineno = 1;
if (filename)
@@ -165,7 +165,7 @@ resource_add_val(Resource *n, char *name, char *value, Resource *subres)
}
char *
-resource_value(Resource *res, char *name)
+resource_value(const Resource *res, char *name)
{
int i;
if (res == 0 || name == 0)
@@ -178,7 +178,7 @@ resource_value(Resource *res, char *name)
}
Resource *
-resource_subres(Resource *res, char *name)
+resource_subres(const Resource *res, const char *name)
{
int i;
if (res == 0 || name == 0)
diff --git a/src/resource.h b/src/resource.h
index 614aace..119d615 100644
--- a/src/resource.h
+++ b/src/resource.h
@@ -38,9 +38,9 @@ extern "C"
/* res_parse.y */
/* Pass either filename OR stringtab. */
- Resource *resource_parse (char *filename, const char **stringtab);
- char *resource_value (Resource * res, char *name);
- Resource *resource_subres (Resource * res, char *name);
+ Resource *resource_parse (const char *filename, const char **stringtab);
+ char *resource_value (const Resource * res, char *name);
+ Resource *resource_subres (const Resource * res, const char *name);
Resource *resource_create (Resource * parent);
void resource_add_val (Resource * n, char *name, char *value,
commit 9813794857f2892408a11ee69735899562b3acc2
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Delete GtkAction along with layer in gtk-pcb-layer-selector.c
diff --git a/src/hid/gtk/gtk-pcb-layer-selector.c b/src/hid/gtk/gtk-pcb-layer-selector.c
index 897cd2c..c8c9849 100644
--- a/src/hid/gtk/gtk-pcb-layer-selector.c
+++ b/src/hid/gtk/gtk-pcb-layer-selector.c
@@ -185,10 +185,9 @@ menu_view_cb (GtkToggleAction *action, GtkTreeRowReference *rref)
/*! \brief Callback for menu actions: sync layer selection list, emit signal */
static void
-menu_pick_cb (GtkRadioAction *action, GtkPcbLayerSelector *ls)
+menu_pick_cb (GtkRadioAction *action, GtkTreeRowReference *rref)
{
- int idx = gtk_radio_action_get_current_value (action);
- GtkTreeRowReference *rref = ls->rows[idx];
+ GtkPcbLayerSelector *ls;
GtkTreeModel *model = gtk_tree_row_reference_get_model (rref);
GtkTreePath *path = gtk_tree_row_reference_get_path (rref);
GtkTreeIter iter;
@@ -196,8 +195,9 @@ menu_pick_cb (GtkRadioAction *action, GtkPcbLayerSelector *ls)
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, USER_ID_COL, &user_id, -1);
- gtk_tree_selection_select_path (ls->selection, path);
+ ls = g_object_get_data (G_OBJECT (model), "layer-selector");
+ gtk_tree_selection_select_path (ls->selection, path);
g_signal_emit (ls, gtk_pcb_layer_selector_signals[SELECT_LAYER_SIGNAL],
0, user_id);
}
@@ -246,7 +246,8 @@ gtk_pcb_layer_selector_finalize (GObject *object)
g_free (ls->view_actions);
g_free (ls->pick_actions);
for (i = 0; i < ls->n_actions; ++i)
- gtk_tree_row_reference_free (ls->rows[i]);
+ if (ls->rows[i])
+ gtk_tree_row_reference_free (ls->rows[i]);
g_free (ls->rows);
G_OBJECT_CLASS (gtk_pcb_layer_selector_parent_class)->finalize (object);
@@ -476,6 +477,12 @@ gtk_pcb_layer_selector_add_layer (GtkPcbLayerSelector *ls,
paccel = g_strdup_printf ("<Alt>%d", i);
}
+ /* Create row reference for actions */
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (ls->list_store), &iter);
+ ls->rows[ls->n_actions] = gtk_tree_row_reference_new
+ (GTK_TREE_MODEL (ls->list_store), path);
+ gtk_tree_path_free (path);
+
/* Create selection action */
if (activatable)
{
@@ -490,7 +497,7 @@ gtk_pcb_layer_selector_add_layer (GtkPcbLayerSelector *ls,
GTK_ACTION (ls->pick_actions[ls->n_actions]),
paccel);
g_signal_connect (ls->pick_actions[ls->n_actions], "toggled",
- G_CALLBACK (menu_pick_cb), ls);
+ G_CALLBACK (menu_pick_cb), ls->rows[ls->n_actions]);
}
else
ls->pick_actions[ls->n_actions] = NULL;
@@ -500,11 +507,6 @@ gtk_pcb_layer_selector_add_layer (GtkPcbLayerSelector *ls,
NULL, NULL);
gtk_toggle_action_set_active (ls->view_actions[ls->n_actions], visible);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (ls->list_store), &iter);
- ls->rows[ls->n_actions] = gtk_tree_row_reference_new
- (GTK_TREE_MODEL (ls->list_store), path);
- gtk_tree_path_free (path);
-
gtk_action_group_add_action_with_accel
(ls->action_group,
GTK_ACTION (ls->view_actions[ls->n_actions]),
@@ -774,17 +776,29 @@ gtk_pcb_layer_selector_delete_layers (GtkPcbLayerSelector *ls,
do
{
gboolean sep;
- gint user_id;
+ gint user_id, idx;
gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store),
&iter, USER_ID_COL, &user_id,
- SEPARATOR_COL, &sep, -1);
+ INDEX_COL, &idx, SEPARATOR_COL, &sep, -1);
/* gtk_list_store_remove will increment the iter for us, so we
* don't want to do it again in the loop condition */
needs_inc = TRUE;
if (!sep && callback (user_id))
{
if (gtk_list_store_remove (ls->list_store, &iter))
- needs_inc = FALSE;
+ {
+ if (ls->view_actions[idx])
+ gtk_action_group_remove_action (ls->action_group,
+ GTK_ACTION (ls->view_actions[idx]));
+ if (ls->pick_actions[idx])
+ gtk_action_group_remove_action (ls->action_group,
+ GTK_ACTION (ls->pick_actions[idx]));
+ gtk_tree_row_reference_free (ls->rows[idx]);
+ ls->view_actions[idx] = NULL;
+ ls->pick_actions[idx] = NULL;
+ ls->rows[idx] = NULL;
+ needs_inc = FALSE;
+ }
else
return;
if (was_separator)
|
|
From: <gi...@gp...> - 2011-08-28 23:03:50
|
The branch, master has been updated
via 6b0b7b235c7b9937cdc22126ca9ed7a1194a4d05 (commit)
from 2fc46c54ae1a149586f21f7a244f151f678cce61 (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/ps/eps.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
=================
Commit Messages
=================
commit 6b0b7b235c7b9937cdc22126ca9ed7a1194a4d05
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/ps/eps.c: Remove assigned by unused lastgroup variable
:100644 100644 d280594... 560f897... M src/hid/ps/eps.c
=========
Changes
=========
commit 6b0b7b235c7b9937cdc22126ca9ed7a1194a4d05
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/ps/eps.c: Remove assigned by unused lastgroup variable
diff --git a/src/hid/ps/eps.c b/src/hid/ps/eps.c
index d280594..560f897 100644
--- a/src/hid/ps/eps.c
+++ b/src/hid/ps/eps.c
@@ -66,7 +66,6 @@ static HID eps_hid;
static FILE *f = 0;
static Coord linewidth = -1;
-static int lastgroup = -1;
static int lastcap = -1;
static int lastcolor = -1;
static int print_group[MAX_LAYER];
@@ -268,7 +267,6 @@ eps_hid_export_to_file (FILE * the_file, HID_Attr_Val * options)
fprintf (f, "%%!PS-Adobe-3.0 EPSF-3.0\n");
linewidth = -1;
lastcap = -1;
- lastgroup = -1;
lastcolor = -1;
in_mono = options[HA_mono].int_value;
@@ -311,7 +309,6 @@ eps_hid_export_to_file (FILE * the_file, HID_Attr_Val * options)
fprintf (f,
"/a { gsave setlinewidth translate scale 0 0 1 5 3 roll arc stroke grestore} bind def\n");
- lastgroup = -1;
hid_expose_callback (&eps_hid, bounds, 0);
fprintf (f, "showpage\n");
|
|
From: <gi...@gp...> - 2011-08-28 20:05:48
|
The branch, master has been updated
via 2fc46c54ae1a149586f21f7a244f151f678cce61 (commit)
from 141ef2642efd33b7ec5db8e96ed2291a70b8b9ee (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/gcode/gcode.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
=================
Commit Messages
=================
commit 2fc46c54ae1a149586f21f7a244f151f678cce61
Author: Markus Hitter <ma...@ju...>
Commit: Felix Ruoff <Fe...@po...>
HID-gcode: make use of MAXPATHLEN.
Affects-bug: lp-699497
:100644 100644 40a13b1... 44a71fe... M src/hid/gcode/gcode.c
=========
Changes
=========
commit 2fc46c54ae1a149586f21f7a244f151f678cce61
Author: Markus Hitter <ma...@ju...>
Commit: Felix Ruoff <Fe...@po...>
HID-gcode: make use of MAXPATHLEN.
Affects-bug: lp-699497
diff --git a/src/hid/gcode/gcode.c b/src/hid/gcode/gcode.c
index 40a13b1..44a71fe 100644
--- a/src/hid/gcode/gcode.c
+++ b/src/hid/gcode/gcode.c
@@ -454,7 +454,7 @@ gcode_do_export (HID_Attr_Val * options)
/* ***************** gcode conversion *************************** */
/* potrace uses a different kind of bitmap; for simplicity gcode_im is copied to this format */
bm = bm_new (gdImageSX (gcode_im), gdImageSY (gcode_im));
- filename = (char *)malloc (512);
+ filename = (char *)malloc (MAXPATHLEN);
plist = NULL;
if (is_solder)
{ /* only for back layer */
|
|
From: <gi...@gp...> - 2011-08-28 18:00:05
|
The branch, master has been updated
via 141ef2642efd33b7ec5db8e96ed2291a70b8b9ee (commit)
from 00b46a34d460788c37812af672afae963d1847b2 (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/bom/bom.c | 2 +-
src/hid/gerber/gerber.c | 2 +-
src/main.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
=================
Commit Messages
=================
commit 141ef2642efd33b7ec5db8e96ed2291a70b8b9ee
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add attributes to docu for commandline options
:100644 100644 d217269... b3529cd... M src/hid/bom/bom.c
:100644 100644 5ba410f... 4a2d233... M src/hid/gerber/gerber.c
:100644 100644 171c1f7... 1c19a3c... M src/main.c
=========
Changes
=========
commit 141ef2642efd33b7ec5db8e96ed2291a70b8b9ee
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add attributes to docu for commandline options
diff --git a/src/hid/bom/bom.c b/src/hid/bom/bom.c
index d217269..b3529cd 100644
--- a/src/hid/bom/bom.c
+++ b/src/hid/bom/bom.c
@@ -50,7 +50,7 @@ Name of the XY output file.
/* %start-doc options "8 BOM Creation"
@ftable @code
-@item --xy-unit
+@item --xy-unit <unit>
Unit of XY dimensions. Defaults to mil.
@end ftable
%end-doc
diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c
index 5ba410f..4a2d233 100644
--- a/src/hid/gerber/gerber.c
+++ b/src/hid/gerber/gerber.c
@@ -337,7 +337,7 @@ static HID_Attribute gerber_options[] = {
/* %start-doc options "90 Gerber Export"
@ftable @code
-@item --gerberfile
+@item --gerberfile <string>
Gerber output file prefix. Can include a path.
@end ftable
%end-doc
diff --git a/src/main.c b/src/main.c
index 171c1f7..1c19a3c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -502,7 +502,7 @@ Dump actions (for documentation).
/* %start-doc options "1 General Options"
@ftable @code
-@item --grid-units-mm
+@item --grid-units-mm <string>
Set default grid units. Can be mm or mil. Defaults to mil.
@end ftable
%end-doc
|
|
From: <gi...@gp...> - 2011-08-28 17:32:43
|
The branch, master has been updated
via 00b46a34d460788c37812af672afae963d1847b2 (commit)
from c8a5c4266d99f345c241e41ee15df9bf808a92f3 (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
=========
doc/pcb.texi | 32 +++++++++-----------------------
1 files changed, 9 insertions(+), 23 deletions(-)
=================
Commit Messages
=================
commit 00b46a34d460788c37812af672afae963d1847b2
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Docu: Fix some references to command-line options
and remove the documentation for a non-working X11-Interface option.
:100644 100644 b6b2436... 855244a... M doc/pcb.texi
=========
Changes
=========
commit 00b46a34d460788c37812af672afae963d1847b2
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Docu: Fix some references to command-line options
and remove the documentation for a non-working X11-Interface option.
diff --git a/doc/pcb.texi b/doc/pcb.texi
index b6b2436..855244a 100644
--- a/doc/pcb.texi
+++ b/doc/pcb.texi
@@ -2790,7 +2790,7 @@ default (this may have been changed at compilation time via the
@code{BACKUP_NAME}
variable in @file{globalconfig.h}).
@emph{%i} is replaced by the process ID.
-See also, the command-line option @emph{-backup}.
+See also, the command-line option @emph{--backup-interval}.
@vindex bloat
@cindex bloat
@@ -2798,15 +2798,6 @@ See also, the command-line option @emph{-backup}.
@item Bloat (dimension)
Specifies the minimum spacing design rule in mils.
-@vindex charactersPerLine
-@cindex characters per line
-@cindex linelength
-@cindex list of connections
-@item charactersPerLine (int)
-@pcb{} uses this value to determine the page width when creating lists.
-N, the number of characters per line, defaults to @emph{80}.
-See also, the command-line option @emph{-c}.
-
@vindex connectedColor
@cindex colors
@cindex connections, colors
@@ -2851,7 +2842,7 @@ to its standard output. The default value is
M4PATH="%p";export M4PATH;echo 'include(%f)' | m4
@end example
Using the GNU version of @code{m4} is highly recommended.
-See also, the command-line option @emph{-lelement}.
+See also, the command-line option @emph{--element-command}.
@vindex elementPath
@cindex searchpath for element files
@@ -2881,7 +2872,7 @@ and the current search path (%p). The default value is:
@example
cat %f
@end example
-See also, the command-line option @emph{-lfile}.
+See also, the command-line option @emph{--file-command}.
@vindex filePath
@cindex searchpath for layout files
@@ -2912,7 +2903,7 @@ output. This command defaults to
@example
cat %f
@end example
-See also, the command-line option @emph{-lfont}.
+See also, the command-line option @emph{--font-command}.
@vindex fontFile
@cindex default font
@@ -2923,7 +2914,6 @@ in the directories as defined by the resource @emph{fontPath}.
Searching is only performed if the filename does not contain a directory
component.
The default filename is @file{default_font}.
-See also, the command-line option @emph{-fontfile}.
@vindex fontPath
@cindex searchpath for font files
@@ -2977,7 +2967,6 @@ layer numbers (1..MAX_LAYER). All layers within one group are switched on/off
together. The default setting is @emph{1:2:3:...:MAX_LAYER} which means
all layers are handled separately. Grouping layers one to three looks like
@emph{1,2,3:4:...:MAX_LAYER}
-See also, the command-line option @emph{-lg}.
@vindex layerName
@cindex layer, name of
@@ -3081,7 +3070,6 @@ value. The values are preset to @emph{XtdefaultFont}.
This resource limits the number of characters which are displayed for
pin names in the pinout window. By default the string length is limited
to @emph{eight} characters per name.
-See also, the command-line option @emph{-pnl}.
@vindex pinoutOffsetX
@vindex pinoutOffsetY
@@ -3108,7 +3096,6 @@ They default to @emph{X:50} and @emph{Y:0}.
Sets the zoom factor for the pinout window according to the formula:
scale = 1:(2 power value). Its default value is @emph{two} which results in
a @emph{1:4} scale.
-See also, the command-line option @emph{-pz}.
@vindex printCommand
@cindex printing
@@ -3145,14 +3132,13 @@ If set to @emph{true}, all found connections will be reset before a new
element is scanned. This will produce long lists when scanning the whole
layout for connections. The resource is set to @emph{false} by default.
The feature is only used while looking up connections of all elements.
-See also, the command-line option @emph{-reset, +reset}.
@vindex ringBellWhenFinished
@cindex keyboard bell
@item ringBellWhenFinished (boolean)
Whether to ring the bell (the default) when a possibly lengthy operation
has finished or not.
-See also, the command-line option @emph{-ring, +ring}.
+See also, the command-line option @emph{--ring-bell-finished}.
@vindex routeStyle
@cindex routing style
@@ -3161,7 +3147,7 @@ Default values for the menu of routing styles (seen in the sizes menu).
The string is a comma separated list of name, line thickness,
via diameter, and via drill size.
e.g. "Fat,50,100,40:Skinny,8,35,20:75Ohm,110,110,20"
-See also, the command-line option @emph{-rs} and @emph{Sizes Menu}
+See also, the command-line option @emph{--route-styles} and @emph{Sizes Menu}
@vindex rubberBandMode
@cindex move
@@ -3185,7 +3171,7 @@ its standard input. The default command is:
@example
cat - > %f
@end example
-See also, the command-line option @emph{-sfile}.
+See also, the command-line option @emph{--save-command}.
@vindex saveInTMP
@cindex backup
@@ -3203,7 +3189,7 @@ with the @code{EMERGENCY_NAME} variable in @file{globalconfig.h}.
@emph{%i} is replaced by the process ID.
As an example, loading a new layout when the old one hasn't been saved would
use this resource.
-See also, the command-line option @emph{-save, +save}.
+See also, the command-line option @emph{--save-in-tmp}.
@vindex saveLastCommand
@cindex saving last entered user command
@@ -3211,7 +3197,7 @@ See also, the command-line option @emph{-save, +save}.
@item saveLastCommand (boolean)
Enables the saving of the last entered user command. The option is
@emph{disabled} by default.
-See also, the command-line option @emph{-s, +s}.
+See also, the command-line option @emph{--save-last-command}.
@vindex shrink
@cindex shrink
|
|
From: <gi...@gp...> - 2011-08-28 17:20:13
|
The branch, master has been updated
via c8a5c4266d99f345c241e41ee15df9bf808a92f3 (commit)
from b7f4b2e152568afe1e22c4da79ee11ce93991b0a (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/find.c | 31 ++++++++++++++++++-------------
1 files changed, 18 insertions(+), 13 deletions(-)
=================
Commit Messages
=================
commit c8a5c4266d99f345c241e41ee15df9bf808a92f3
Author: Dima Kogan <dk...@cd...>
Commit: DJ Delorie <dj...@de...>
Better handling of unplated vias
The attached patch adds checks in the geometry intersection functions to
no longer treat unplated vias (mounting holes) as conducting. The
implementation in the patch will act as if the unplated via doesn't
intersect with metal objects at all, which is possibly not what is
desired. Should the conductivity check happen on a higher level from the
geometry intersection routines? A case that would require this is not
obvious to me.
Closes-bug: lp-699499
:100644 100644 1bbb1b5... 6edd29d... M src/find.c
=========
Changes
=========
commit c8a5c4266d99f345c241e41ee15df9bf808a92f3
Author: Dima Kogan <dk...@cd...>
Commit: DJ Delorie <dj...@de...>
Better handling of unplated vias
The attached patch adds checks in the geometry intersection functions to
no longer treat unplated vias (mounting holes) as conducting. The
implementation in the patch will act as if the unplated via doesn't
intersect with metal objects at all, which is possibly not what is
desired. Should the conductivity check happen on a higher level from the
geometry intersection routines? A case that would require this is not
obvious to me.
Closes-bug: lp-699499
diff --git a/src/find.c b/src/find.c
index 1bbb1b5..6edd29d 100644
--- a/src/find.c
+++ b/src/find.c
@@ -516,7 +516,7 @@ PadPadIntersect (PadTypePtr p1, PadTypePtr p2)
{
return LinePadIntersect ((LineTypePtr) p1, p2);
}
-
+
static inline bool
PV_TOUCH_PV (PinTypePtr PV1, PinTypePtr PV2)
{
@@ -690,7 +690,8 @@ LOCtoPVline_callback (const BoxType * b, void *cl)
LineTypePtr line = (LineTypePtr) b;
struct pv_info *i = (struct pv_info *) cl;
- if (!TEST_FLAG (TheFlag, line) && PinLineIntersect (&i->pv, line))
+ if (!TEST_FLAG (TheFlag, line) && PinLineIntersect (&i->pv, line) &&
+ !TEST_FLAG (HOLEFLAG, &i->pv))
{
if (ADD_LINE_TO_LIST (i->layer, line))
longjmp (i->env, 1);
@@ -704,7 +705,8 @@ LOCtoPVarc_callback (const BoxType * b, void *cl)
ArcTypePtr arc = (ArcTypePtr) b;
struct pv_info *i = (struct pv_info *) cl;
- if (!TEST_FLAG (TheFlag, arc) && IS_PV_ON_ARC (&i->pv, arc))
+ if (!TEST_FLAG (TheFlag, arc) && IS_PV_ON_ARC (&i->pv, arc) &&
+ !TEST_FLAG (HOLEFLAG, &i->pv))
{
if (ADD_ARC_TO_LIST (i->layer, arc))
longjmp (i->env, 1);
@@ -719,6 +721,7 @@ LOCtoPVpad_callback (const BoxType * b, void *cl)
struct pv_info *i = (struct pv_info *) cl;
if (!TEST_FLAG (TheFlag, pad) && IS_PV_ON_PAD (&i->pv, pad) &&
+ !TEST_FLAG (HOLEFLAG, &i->pv) &&
ADD_PAD_TO_LIST (TEST_FLAG (ONSOLDERFLAG, pad) ? SOLDER_LAYER :
COMPONENT_LAYER, pad))
longjmp (i->env, 1);
@@ -748,9 +751,10 @@ LOCtoPVpoly_callback (const BoxType * b, void *cl)
* because it might not be inside the polygon, or it could
* be on an edge such that it doesn't actually touch.
*/
- if (!TEST_FLAG (TheFlag, polygon) && (TEST_THERM (i->layer, &i->pv)
- || !TEST_FLAG (CLEARPOLYFLAG,
- polygon)
+ if (!TEST_FLAG (TheFlag, polygon) && !TEST_FLAG (HOLEFLAG, &i->pv) &&
+ (TEST_THERM (i->layer, &i->pv) ||
+ !TEST_FLAG (CLEARPOLYFLAG,
+ polygon)
|| !i->pv.Clearance))
{
double wide = MAX (0.5 * i->pv.Thickness + Bloat, 0);
@@ -972,7 +976,7 @@ pv_pv_callback (const BoxType * b, void *cl)
if (!TEST_FLAG (TheFlag, pin) && PV_TOUCH_PV (&i->pv, pin))
{
- if (TEST_FLAG (HOLEFLAG, pin))
+ if (TEST_FLAG (HOLEFLAG, pin) || TEST_FLAG (HOLEFLAG, &i->pv))
{
SET_FLAG (WARNFLAG, pin);
Settings.RatWarn = true;
@@ -981,7 +985,7 @@ pv_pv_callback (const BoxType * b, void *cl)
else
Message (_("WARNING: Hole too close to via.\n"));
}
- if (ADD_PV_TO_LIST (pin))
+ else if (ADD_PV_TO_LIST (pin))
longjmp (i->env, 1);
}
return 0;
@@ -1045,7 +1049,7 @@ pv_line_callback (const BoxType * b, void *cl)
Settings.RatWarn = true;
Message (_("WARNING: Hole too close to line.\n"));
}
- if (ADD_PV_TO_LIST (pv))
+ else if (ADD_PV_TO_LIST (pv))
longjmp (i->env, 1);
}
return 0;
@@ -1065,7 +1069,7 @@ pv_pad_callback (const BoxType * b, void *cl)
Settings.RatWarn = true;
Message (_("WARNING: Hole too close to pad.\n"));
}
- if (ADD_PV_TO_LIST (pv))
+ else if (ADD_PV_TO_LIST (pv))
longjmp (i->env, 1);
}
return 0;
@@ -1085,7 +1089,7 @@ pv_arc_callback (const BoxType * b, void *cl)
Settings.RatWarn = true;
Message (_("WARNING: Hole touches arc.\n"));
}
- if (ADD_PV_TO_LIST (pv))
+ else if (ADD_PV_TO_LIST (pv))
longjmp (i->env, 1);
}
return 0;
@@ -1097,8 +1101,9 @@ pv_poly_callback (const BoxType * b, void *cl)
PinTypePtr pv = (PinTypePtr) b;
struct lo_info *i = (struct lo_info *) cl;
- /* note that holes in polygons are ok */
- if (!TEST_FLAG (TheFlag, pv) && (TEST_THERM (i->layer, pv) ||
+ /* note that holes in polygons are ok, so they don't generate warnings. */
+ if (!TEST_FLAG (TheFlag, pv) && !TEST_FLAG (HOLEFLAG, pv) &&
+ (TEST_THERM (i->layer, pv) ||
!TEST_FLAG (CLEARPOLYFLAG, &i->polygon) ||
!pv->Clearance))
{
|
|
From: <gi...@gp...> - 2011-08-28 16:59:50
|
The branch, master has been updated
via b7f4b2e152568afe1e22c4da79ee11ce93991b0a (commit)
via 099c532f9ffa76eac8ea048942404724c3ed1ffb (commit)
via 132b7884f3d1b7756cbd3de3c6b2c5d8391f0275 (commit)
via a2bb61a37c8740ac97b78e13850b99dc823ece60 (commit)
via d0a4f57ed3db92168f43bad660aa3e837f835a72 (commit)
via 3ef060db9f824c1e93072cf732bbcb2bd5a1a252 (commit)
via ce68e2acbda0abbd0a37204d89e5a032d0e7f240 (commit)
via 7a1ede921654701b726e3a497d3dc2f8b2591f47 (commit)
via 684c98015b44be8d0894cd3e5fe399a69c4bc12d (commit)
via eb90f7eb41ea46d49286beff7136b2435e1347ae (commit)
via 45074652a9619be78de0834402884969f9797ddc (commit)
via e6581d531dcd196767bbf867918e0ae22a93effb (commit)
via ceea0e16b5495b7f41337bea8cfc82db315746cd (commit)
via bd1083bc23ede3f14148eba2a5da75ceece85c00 (commit)
via 99782e903aaf8c7c3e8d0cfbbfbafb19db66ac6c (commit)
via 883b043e44169c32c58318b8ba5ac6895a040c39 (commit)
via 6072ec8c18b69a6dc7bafd89390d331cf0c11b8b (commit)
via 12d7fee2edb20b4677ea7736eec8eb739db29957 (commit)
from 94a9388560fc43431ac331e477acdb0c7c571220 (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
=========
doc/pcb.texi | 312 ++------------
src/hid/bom/bom.c | 26 +-
src/hid/gcode/gcode.c | 2 +-
src/hid/gerber/gerber.c | 30 ++-
src/hid/gtk/gui-top-window.c | 24 +
src/hid/lesstif/main.c | 23 +
src/hid/lpr/lpr.c | 15 +-
src/hid/nelma/nelma.c | 46 ++-
src/hid/png/png.c | 121 +++++-
src/hid/ps/eps.c | 44 ++-
src/hid/ps/ps.c | 177 +++++++-
src/main.c | 968 +++++++++++++++++++++++++++++++++++++++---
12 files changed, 1400 insertions(+), 388 deletions(-)
=================
Commit Messages
=================
commit b7f4b2e152568afe1e22c4da79ee11ce93991b0a
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Unify HID description (no fullstop at end of description)
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 a4377db... 40a13b1... M src/hid/gcode/gcode.c
:100644 100644 9fd936c... 5ba410f... M src/hid/gerber/gerber.c
:100644 100644 8a7b76a... 259812c... M src/hid/lpr/lpr.c
:100644 100644 cf704a7... 9659b66... M src/hid/nelma/nelma.c
:100644 100644 f9db4ca... f00d407... M src/hid/png/png.c
:100644 100644 08ede88... 87202f6... M src/hid/ps/ps.c
commit 099c532f9ffa76eac8ea048942404724c3ed1ffb
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for ps HID commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 02448e5... 08ede88... M src/hid/ps/ps.c
commit 132b7884f3d1b7756cbd3de3c6b2c5d8391f0275
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for eps HID commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 903270e... d280594... M src/hid/ps/eps.c
commit a2bb61a37c8740ac97b78e13850b99dc823ece60
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for png HID commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 61437a0... f9db4ca... M src/hid/png/png.c
commit d0a4f57ed3db92168f43bad660aa3e837f835a72
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for nemla HID commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 d5a58d8... cf704a7... M src/hid/nelma/nelma.c
commit 3ef060db9f824c1e93072cf732bbcb2bd5a1a252
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for lpt HID commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 65f0491... 8a7b76a... M src/hid/lpr/lpr.c
commit ce68e2acbda0abbd0a37204d89e5a032d0e7f240
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for Gerber HID commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 8829527... 9fd936c... M src/hid/gerber/gerber.c
commit 7a1ede921654701b726e3a497d3dc2f8b2591f47
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for the BOM HID commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 70b0567... d217269... M src/hid/bom/bom.c
commit 684c98015b44be8d0894cd3e5fe399a69c4bc12d
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for commandline-options for GTK+ and lesstif GUI
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 e2beb3c... d9b3f11... M src/hid/gtk/gui-top-window.c
:100644 100644 30739e9... 1885761... M src/hid/lesstif/main.c
commit eb90f7eb41ea46d49286beff7136b2435e1347ae
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for DRC commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 e99ea2c... 171c1f7... M src/main.c
commit 45074652a9619be78de0834402884969f9797ddc
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for general gui commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 6b5b577... e99ea2c... M src/main.c
commit e6581d531dcd196767bbf867918e0ae22a93effb
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for path commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 692a805... 6b5b577... M src/main.c
commit ceea0e16b5495b7f41337bea8cfc82db315746cd
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for commandline commands
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 9e6b3ad... 692a805... M src/main.c
commit bd1083bc23ede3f14148eba2a5da75ceece85c00
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for layer names commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 376dd1d... 9e6b3ad... M src/main.c
commit 99782e903aaf8c7c3e8d0cfbbfbafb19db66ac6c
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for size commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 ee1abbc... 376dd1d... M src/main.c
commit 883b043e44169c32c58318b8ba5ac6895a040c39
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for color commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 fe957c4... ee1abbc... M src/main.c
commit 6072ec8c18b69a6dc7bafd89390d331cf0c11b8b
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Docu: Add general description for commandline options
... and for general options.
(Patch 3/19 of this patch-serie is missing on purpose)
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 06d3860... b6b2436... M doc/pcb.texi
:100644 100644 5ce6e53... fe957c4... M src/main.c
commit 12d7fee2edb20b4677ea7736eec8eb739db29957
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Remove out-dated docu for commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
:100644 100644 cb09c00... 06d3860... M doc/pcb.texi
=========
Changes
=========
commit b7f4b2e152568afe1e22c4da79ee11ce93991b0a
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Unify HID description (no fullstop at end of description)
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/hid/gcode/gcode.c b/src/hid/gcode/gcode.c
index a4377db..40a13b1 100644
--- a/src/hid/gcode/gcode.c
+++ b/src/hid/gcode/gcode.c
@@ -1005,7 +1005,7 @@ hid_gcode_init ()
gcode_hid.struct_size = sizeof (HID);
gcode_hid.name = "gcode";
- gcode_hid.description = "G-CODE export.";
+ gcode_hid.description = "G-CODE export";
gcode_hid.exporter = 1;
gcode_hid.poly_before = 1;
diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c
index 9fd936c..5ba410f 100644
--- a/src/hid/gerber/gerber.c
+++ b/src/hid/gerber/gerber.c
@@ -1270,7 +1270,7 @@ hid_gerber_init ()
gerber_hid.struct_size = sizeof (gerber_hid);
gerber_hid.name = "gerber";
- gerber_hid.description = "RS-274X (Gerber) export.";
+ gerber_hid.description = "RS-274X (Gerber) export";
gerber_hid.exporter = 1;
gerber_hid.get_export_options = gerber_get_export_options;
diff --git a/src/hid/lpr/lpr.c b/src/hid/lpr/lpr.c
index 8a7b76a..259812c 100644
--- a/src/hid/lpr/lpr.c
+++ b/src/hid/lpr/lpr.c
@@ -135,7 +135,7 @@ hid_lpr_init ()
lpr_hid.struct_size = sizeof (HID);
lpr_hid.name = "lpr";
- lpr_hid.description = "Postscript print.";
+ lpr_hid.description = "Postscript print";
lpr_hid.printer = 1;
lpr_hid.poly_before = 1;
diff --git a/src/hid/nelma/nelma.c b/src/hid/nelma/nelma.c
index cf704a7..9659b66 100644
--- a/src/hid/nelma/nelma.c
+++ b/src/hid/nelma/nelma.c
@@ -1074,7 +1074,7 @@ hid_nelma_init()
nelma_hid.struct_size = sizeof (HID);
nelma_hid.name = "nelma";
- nelma_hid.description = "Numerical analysis package export.";
+ nelma_hid.description = "Numerical analysis package export";
nelma_hid.exporter = 1;
nelma_hid.poly_before = 1;
diff --git a/src/hid/png/png.c b/src/hid/png/png.c
index f9db4ca..f00d407 100644
--- a/src/hid/png/png.c
+++ b/src/hid/png/png.c
@@ -1644,7 +1644,7 @@ hid_png_init ()
png_hid.struct_size = sizeof (HID);
png_hid.name = "png";
- png_hid.description = "GIF/JPEG/PNG export.";
+ png_hid.description = "GIF/JPEG/PNG export";
png_hid.exporter = 1;
png_hid.poly_before = 1;
diff --git a/src/hid/ps/ps.c b/src/hid/ps/ps.c
index 08ede88..87202f6 100644
--- a/src/hid/ps/ps.c
+++ b/src/hid/ps/ps.c
@@ -1527,7 +1527,7 @@ hid_ps_init ()
ps_hid.struct_size = sizeof (HID);
ps_hid.name = "ps";
- ps_hid.description = "Postscript export.";
+ ps_hid.description = "Postscript export";
ps_hid.exporter = 1;
ps_hid.poly_before = 1;
commit 099c532f9ffa76eac8ea048942404724c3ed1ffb
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for ps HID commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/hid/ps/ps.c b/src/hid/ps/ps.c
index 02448e5..08ede88 100644
--- a/src/hid/ps/ps.c
+++ b/src/hid/ps/ps.c
@@ -145,57 +145,212 @@ static MediaType media_data[] = {
HID_Attribute ps_attribute_list[] = {
/* other HIDs expect this to be first. */
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@item --psfile <string>
+Name of the postscript output file. Can contain a path.
+@end ftable
+%end-doc
+*/
{"psfile", "Postscript output file",
HID_String, 0, 0, {0, 0, 0}, 0, 0},
#define HA_psfile 0
- {"drill-helper", "Prints a centering target in large drill holes",
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@cindex drill-helper
+@item --drill-helper
+Print a centering target in large drill holes.
+@end ftable
+%end-doc
+*/
+ {"drill-helper", "Print a centering target in large drill holes",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_drillhelper 1
- {"align-marks", "Prints alignment marks on each layer",
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@cindex align-marks
+@item --align-marks
+Print alignment marks on each sheet. This is meant to ease alignment during exposure.
+@end ftable
+%end-doc
+*/
+ {"align-marks", "Print alignment marks on each sheet",
HID_Boolean, 0, 0, {1, 0, 0}, 0, 0},
#define HA_alignmarks 2
- {"outline", "Prints outline on each layer",
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@item --outline
+Print the contents of the outline layer on each sheet.
+@end ftable
+%end-doc
+*/
+ {"outline", "Print outline on each sheet",
HID_Boolean, 0, 0, {1, 0, 0}, 0, 0},
#define HA_outline 3
- {"mirror", "Prints mirror image of each layer",
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@item --mirror
+Print mirror image.
+@end ftable
+%end-doc
+*/
+ {"mirror", "Print mirror image of every page",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_mirror 4
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@item --fill-page
+Scale output to make the board fit the page.
+@end ftable
+%end-doc
+*/
{"fill-page", "Scale board to fill page",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_fillpage 5
- {"auto-mirror", "Prints mirror image of appropriate layers",
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@item --auto-mirror
+Print mirror image of appropriate layers.
+@end ftable
+%end-doc
+*/
+ {"auto-mirror", "Print mirror image of appropriate layers",
HID_Boolean, 0, 0, {1, 0, 0}, 0, 0},
#define HA_automirror 6
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@item --ps-color
+Postscript output in color.
+@end ftable
+%end-doc
+*/
{"ps-color", "Prints in color",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_color 7
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@cindex ps-bloat
+@item --ps-bloat <num>
+Amount to add to trace/pad/pin edges.
+@end ftable
+%end-doc
+*/
{"ps-bloat", "Amount to add to trace/pad/pin edges",
HID_Coord, -MIL_TO_COORD (100), MIL_TO_COORD (100), {0, 0, 0}, 0, 0},
#define HA_psbloat 8
- {"ps-invert", "Draw images as white-on-black",
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@cindex ps-invert
+@item --ps-invert
+Draw objects as white-on-black.
+@end ftable
+%end-doc
+*/
+ {"ps-invert", "Draw objects as white-on-black",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_psinvert 9
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@item --media <media-name>
+Size of the media, the postscript is fitted to. The parameter
+@code{<media-name>} can be any of the standard names for paper size: @samp{A0}
+to @samp{A10}, @samp{B0} to @samp{B10}, @samp{Letter}, @samp{11x17},
+@samp{Ledger}, @samp{Legal}, @samp{Executive}, @samp{A-Size}, @samp{B-size},
+@samp{C-Size}, @samp{D-size}, @samp{E-size}, @samp{US-Business_Card},
+@samp{Intl-Business_Card}.
+@end ftable
+%end-doc
+*/
{"media", "media type",
HID_Enum, 0, 0, {22, 0, 0}, medias, 0},
#define HA_media 10
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@cindex psfade
+@item --psfade <num>
+Fade amount for assembly drawings (0.0=missing, 1.0=solid).
+@end ftable
+%end-doc
+*/
{"psfade", "Fade amount for assembly drawings (0.0=missing, 1.0=solid)",
HID_Real, 0, 1, {0, 0, 0.40}, 0, 0},
#define HA_psfade 11
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@item --scale <num>
+Scale value to compensate for printer sizing errors (1.0 = full scale).
+@end ftable
+%end-doc
+*/
{"scale", "Scale value to compensate for printer sizing errors (1.0 = full scale)",
HID_Real, 0.01, 4, {0, 0, 1.00}, 0, 0},
#define HA_scale 12
- {"multi-file", "Produce multiple files, one per page, instead of a single file.",
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@cindex multi-file
+@item --multi-file
+Produce multiple files, one per page, instead of a single multi page file.
+@end ftable
+%end-doc
+*/
+ {"multi-file", "Produce multiple files, one per page, instead of a single file",
HID_Boolean, 0, 0, {0, 0, 0.40}, 0, 0},
#define HA_multifile 13
- {"xcalib", "X-Axis calibration (paper width).",
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@item --xcalib <num>
+Paper width. Used for x-Axis calibration.
+@end ftable
+%end-doc
+*/
+ {"xcalib", "Paper width. Used for x-Axis calibration",
HID_Real, 0, 0, {0, 0, 1.0}, 0, 0},
#define HA_xcalib 14
- {"ycalib", "Y-Axis calibration (paper height).",
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@item --ycalib <num>
+Paper height. Used for y-Axis calibration.
+@end ftable
+%end-doc
+*/
+ {"ycalib", "Paper height. Used for y-Axis calibration",
HID_Real, 0, 0, {0, 0, 1.0}, 0, 0},
#define HA_ycalib 15
- {"drill-copper", "Draw drill holes in pins / vias, instead of leaving solid copper.",
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@item --drill-copper
+Draw drill holes in pins / vias, instead of leaving solid copper.
+@end ftable
+%end-doc
+*/
+ {"drill-copper", "Draw drill holes in pins / vias, instead of leaving solid copper",
HID_Boolean, 0, 0, {1, 0, 0}, 0, 0},
#define HA_drillcopper 16
+
+/* %start-doc options "91 Postscript Export"
+@ftable @code
+@cindex show-legend
+@item --show-legend
+Print file name and scale on printout.
+@end ftable
+%end-doc
+*/
{"show-legend", "Print file name and scale on printout",
HID_Boolean, 0, 0, {1, 0, 0}, 0, 0},
#define HA_legend 17
commit 132b7884f3d1b7756cbd3de3c6b2c5d8391f0275
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for eps HID commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/hid/ps/eps.c b/src/hid/ps/eps.c
index 903270e..d280594 100644
--- a/src/hid/ps/eps.c
+++ b/src/hid/ps/eps.c
@@ -75,18 +75,60 @@ static int fast_erase = -1;
static HID_Attribute eps_attribute_list[] = {
/* other HIDs expect this to be first. */
+
+/* %start-doc options "92 Encapsulated Postscript Export"
+@ftable @code
+@item --eps-file <string>
+Name of the encapsulated postscript output file. Can contain a path.
+@end ftable
+%end-doc
+*/
{"eps-file", "Encapsulated Postscript output file",
HID_String, 0, 0, {0, 0, 0}, 0, 0},
#define HA_psfile 0
+
+/* %start-doc options "92 Encapsulated Postscript Export"
+@ftable @code
+@item --eps-scale <num>
+Scale EPS output by the parameter @samp{num}.
+@end ftable
+%end-doc
+*/
{"eps-scale", "EPS scale",
HID_Real, 0, 100, {0, 0, 1.0}, 0, 0},
#define HA_scale 1
+
+/* %start-doc options "92 Encapsulated Postscript Export"
+@ftable @code
+@cindex as-shown (EPS)
+@item --as-shown
+Export layers as shown on screen.
+@end ftable
+%end-doc
+*/
{"as-shown", "Export layers as shown on screen",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_as_shown 2
- {"monochrome", "Convert to monochrome (like the ps export)",
+
+/* %start-doc options "92 Encapsulated Postscript Export"
+@ftable @code
+@item --monochrome
+Convert output to monochrome.
+@end ftable
+%end-doc
+*/
+ {"monochrome", "Convert to monochrome",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_mono 3
+
+/* %start-doc options "92 Encapsulated Postscript Export"
+@ftable @code
+@cindex only-visible
+@item --only-visible
+Limit the bounds of the EPS file to the visible items.
+@end ftable
+%end-doc
+*/
{"only-visible", "Limit the bounds of the EPS file to the visible items",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_only_visible 4
commit a2bb61a37c8740ac97b78e13850b99dc823ece60
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for png HID commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/hid/png/png.c b/src/hid/png/png.c
index 61437a0..f9db4ca 100644
--- a/src/hid/png/png.c
+++ b/src/hid/png/png.c
@@ -164,58 +164,161 @@ static const char *filetypes[] = {
HID_Attribute png_attribute_list[] = {
/* other HIDs expect this to be first. */
+
+/* %start-doc options "93 PNG Options"
+@ftable @code
+@item --outfile <string>
+Name of the file to be exported to. Can contain a path.
+@end ftable
+%end-doc
+*/
{"outfile", "Graphics output file",
HID_String, 0, 0, {0, 0, 0}, 0, 0},
#define HA_pngfile 0
- {"dpi", "Scale factor (pixels/inch). 0 to scale to fix specified size",
- HID_Integer, 0, 10000, {100, 0, 0}, 0, 0},
+/* %start-doc options "93 PNG Options"
+@ftable @code
+@item --dpi
+Scale factor in pixels/inch. Set to 0 to scale to size specified in the layout.
+@end ftable
+%end-doc
+*/
+ {"dpi", "Scale factor (pixels/inch). 0 to scale to specified size",
+ HID_Integer, 0, 1000, {100, 0, 0}, 0, 0},
#define HA_dpi 1
- {"x-max", "Maximum width (pixels). 0 to not constrain.",
+/* %start-doc options "93 PNG Options"
+@ftable @code
+@item --x-max
+Width of the png image in pixels. No constraint, when set to 0.
+@end ftable
+%end-doc
+*/
+ {"x-max", "Maximum width (pixels). 0 to not constrain",
HID_Integer, 0, 10000, {0, 0, 0}, 0, 0},
#define HA_xmax 2
- {"y-max", "Maximum height (pixels). 0 to not constrain.",
+/* %start-doc options "93 PNG Options"
+@ftable @code
+@item --y-max
+Height of the png output in pixels. No constraint, when set to 0.
+@end ftable
+%end-doc
+*/
+ {"y-max", "Maximum height (pixels). 0 to not constrain",
HID_Integer, 0, 10000, {0, 0, 0}, 0, 0},
#define HA_ymax 3
- {"xy-max", "Maximum width and height (pixels). 0 to not constrain.",
+/* %start-doc options "93 PNG Options"
+@ftable @code
+@item --xy-max
+Maximum width and height of the PNG output in pixels. No constraint, when set to 0.
+@end ftable
+%end-doc
+*/
+ {"xy-max", "Maximum width and height (pixels). 0 to not constrain",
HID_Integer, 0, 10000, {0, 0, 0}, 0, 0},
#define HA_xymax 4
+/* %start-doc options "93 PNG Options"
+@ftable @code
+@item --as-shown
+Export layers as shown on screen.
+@end ftable
+%end-doc
+*/
{"as-shown", "Export layers as shown on screen",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_as_shown 5
+/* %start-doc options "93 PNG Options"
+@ftable @code
+@item --monochrome
+Convert output to monochrome.
+@end ftable
+%end-doc
+*/
{"monochrome", "Convert to monochrome",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_mono 6
- {"only-visible", "Limit the bounds of the PNG file to the visible items",
+/* %start-doc options "93 PNG Options"
+@ftable @code
+@item --only-vivible
+Limit the bounds of the exported PNG image to the visible items.
+@end ftable
+%end-doc
+*/
+ {"only-visible", "Limit the bounds of the PNG image to the visible items",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_only_visible 7
+/* %start-doc options "93 PNG Options"
+@ftable @code
+@item --use-alpha
+Make the background and any holes transparent.
+@end ftable
+%end-doc
+*/
{"use-alpha", "Make the background and any holes transparent",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_use_alpha 8
- {"format", "Graphics file format",
+/* %start-doc options "93 PNG Options"
+@ftable @code
+@item --format <string>
+File format to be exported. Parameter @code{<string>} can be @samp{PNG},
+@samp{GIF}, or @samp{JPEG}.
+@end ftable
+%end-doc
+*/
+ {"format", "Export file format",
HID_Enum, 0, 0, {0, 0, 0}, filetypes, 0},
#define HA_filetype 9
+/* %start-doc options "93 PNG Options"
+@ftable @code
+@item --png-bloat <num><dim>
+Amount of extra thickness to add to traces, pads, or pin edges. The parameter
+@samp{<num><dim>} is a number, appended by a dimension @samp{mm}, @samp{mil}, or
+@samp{pix}. If no dimension is given, the default dimension is 1/100 mil.
+@end ftable
+%end-doc
+*/
{"png-bloat", "Amount (in/mm/mil/pix) to add to trace/pad/pin edges (1 = 1/100 mil)",
HID_String, 0, 0, {0, 0, 0}, 0, 0},
#define HA_bloat 10
- {"photo-mode", "Photo-realistic mode",
+/* %start-doc options "93 PNG Options"
+@ftable @code
+@cindex photo-mode
+@item --photo-mode
+Export a photo realistic image of the layout.
+@end ftable
+%end-doc
+*/
+ {"photo-mode", "Photo-realistic export mode",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_photo_mode 11
+/* %start-doc options "93 PNG Options"
+@ftable @code
+@item --photo-flip-x
+In photo-realistic mode, export the reverse side of the layout. Left-right flip.
+@end ftable
+%end-doc
+*/
{"photo-flip-x", "Show reverse side of the board, left-right flip",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_photo_flip_x 12
+/* %start-doc options "93 PNG Options"
+@ftable @code
+@item --photo-flip-y
+In photo-realistic mode, export the reverse side of the layout. Up-down flip.
+@end ftable
+%end-doc
+*/
{"photo-flip-y", "Show reverse side of the board, up-down flip",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_photo_flip_y 13
commit d0a4f57ed3db92168f43bad660aa3e837f835a72
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for nemla HID commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/hid/nelma/nelma.c b/src/hid/nelma/nelma.c
index d5a58d8..cf704a7 100644
--- a/src/hid/nelma/nelma.c
+++ b/src/hid/nelma/nelma.c
@@ -153,23 +153,59 @@ static const double nelma_air_epsilon = 8.85e-12;
HID_Attribute nelma_attribute_list[] = {
/* other HIDs expect this to be first. */
+
+/* %start-doc options "nelma Options"
+@ftable @code
+@item -- basename <string>
+File name prefix.
+@end ftable
+%end-doc
+*/
{"basename", "File name prefix",
HID_String, 0, 0, {0, 0, 0}, 0, 0},
#define HA_basename 0
- {"dpi", "Horizontal scale factor (grid points/inch).",
+/* %start-doc options "nelma Options"
+@ftable @code
+@item --dpi <num>
+Horizontal scale factor (grid points/inch).
+@end ftable
+%end-doc
+*/
+ {"dpi", "Horizontal scale factor (grid points/inch)",
HID_Integer, 0, 1000, {100, 0, 0}, 0, 0},
#define HA_dpi 1
- {"copper-height", "Copper layer height (um).",
+/* %start-doc options "nelma Options"
+@ftable @code
+@item --copper-height <num>
+Copper layer height (um).
+@end ftable
+%end-doc
+*/
+ {"copper-height", "Copper layer height (um)",
HID_Integer, 0, 200, {100, 0, 0}, 0, 0},
#define HA_copperh 2
- {"substrate-height", "Substrate layer height (um).",
+/* %start-doc options "nelma Options"
+@ftable @code
+@item --substrate-height <num>
+Substrate layer height (um).
+@end ftable
+%end-doc
+*/
+ {"substrate-height", "Substrate layer height (um)",
HID_Integer, 0, 10000, {2000, 0, 0}, 0, 0},
#define HA_substrateh 3
- {"substrate-epsilon", "Substrate relative epsilon.",
+/* %start-doc options "nelma Options"
+@ftable @code
+@item --substrate-epsilon <num>
+Substrate relative epsilon.
+@end ftable
+%end-doc
+*/
+ {"substrate-epsilon", "Substrate relative epsilon",
HID_Real, 0, 100, {0, 0, 4.0}, 0, 0},
#define HA_substratee 4
};
commit 3ef060db9f824c1e93072cf732bbcb2bd5a1a252
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for lpt HID commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/hid/lpr/lpr.c b/src/hid/lpr/lpr.c
index 65f0491..8a7b76a 100644
--- a/src/hid/lpr/lpr.c
+++ b/src/hid/lpr/lpr.c
@@ -29,7 +29,18 @@ RCSID ("$Id$");
#define CRASH fprintf(stderr, "HID error: pcb called unimplemented PS function %s.\n", __FUNCTION__); abort()
static HID_Attribute base_lpr_options[] = {
- {"lprcommand", "Command to print",
+
+/* %start-doc options "98 lpr Printing Options"
+@ftable @code
+@item --lprcommand <string>
+Command to use for printing. Defaults to @code{lpr}. This can be used to produce
+PDF output with a virtual PDF printer. Example: @*
+@code{--lprcommand "lp -d CUPS-PDF-Printer"}.
+@end ftable
+@noindent In addition, all @ref{Postscript Export} options are valid.
+%end-doc
+*/
+ {"lprcommand", "Command to use for printing",
HID_String, 0, 0, {0, 0, 0}, 0, 0},
#define HA_lprcommand 0
};
commit ce68e2acbda0abbd0a37204d89e5a032d0e7f240
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for Gerber HID commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c
index 8829527..9fd936c 100644
--- a/src/hid/gerber/gerber.c
+++ b/src/hid/gerber/gerber.c
@@ -334,13 +334,37 @@ static const char *name_style_names[] = {
};
static HID_Attribute gerber_options[] = {
+
+/* %start-doc options "90 Gerber Export"
+@ftable @code
+@item --gerberfile
+Gerber output file prefix. Can include a path.
+@end ftable
+%end-doc
+*/
{"gerberfile", "Gerber output file base",
HID_String, 0, 0, {0, 0, 0}, 0, 0},
#define HA_gerberfile 0
- {"all-layers", "Print all layers, even empty ones",
+
+/* %start-doc options "90 Gerber Export"
+@ftable @code
+@item --all-layers
+Output contains all layers, even empty ones.
+@end ftable
+%end-doc
+*/
+ {"all-layers", "Output all layers, even empty ones",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_all_layers 1
- {"verbose", "print file names and aperture counts",
+
+/* %start-doc options "90 Gerber Export"
+@ftable @code
+@item --verbose
+Print file names and aperture counts on stdout.
+@end ftable
+%end-doc
+*/
+ {"verbose", "Print file names and aperture counts on stdout",
HID_Boolean, 0, 0, {0, 0, 0}, 0, 0},
#define HA_verbose 2
{"copy-outline", "Copy outline onto other layers",
commit 7a1ede921654701b726e3a497d3dc2f8b2591f47
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for the BOM HID commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/hid/bom/bom.c b/src/hid/bom/bom.c
index 70b0567..d217269 100644
--- a/src/hid/bom/bom.c
+++ b/src/hid/bom/bom.c
@@ -27,12 +27,34 @@
RCSID ("$Id$");
static HID_Attribute bom_options[] = {
- {"bomfile", "BOM output file",
+/* %start-doc options "8 BOM Creation"
+@ftable @code
+@item --bomfile <string>
+Name of the BOM output file.
+@end ftable
+%end-doc
+*/
+ {"bomfile", "Name of the BOM output file",
HID_String, 0, 0, {0, 0, 0}, 0, 0},
#define HA_bomfile 0
- {"xyfile", "XY output file",
+/* %start-doc options "8 BOM Creation"
+@ftable @code
+@item --xyfile <string>
+Name of the XY output file.
+@end ftable
+%end-doc
+*/
+ {"xyfile", "Name of the XY output file",
HID_String, 0, 0, {0, 0, 0}, 0, 0},
#define HA_xyfile 1
+
+/* %start-doc options "8 BOM Creation"
+@ftable @code
+@item --xy-unit
+Unit of XY dimensions. Defaults to mil.
+@end ftable
+%end-doc
+*/
{"xy-unit", "XY units",
HID_Unit, 0, 0, {-1, 0, 0}, NULL, 0},
#define HA_unit 2
commit 684c98015b44be8d0894cd3e5fe399a69c4bc12d
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for commandline-options for GTK+ and lesstif GUI
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index e2beb3c..d9b3f11 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -1908,14 +1908,38 @@ static int stdin_listen = 0;
static char *pcbmenu_path = "gpcb-menu.res";
HID_Attribute ghid_attribute_list[] = {
+
+/* %start-doc options "21 GTK+ GUI Options"
+@ftable @code
+@item --listen
+Listen for actions on stdin.
+@end ftable
+%end-doc
+*/
{"listen", "Listen for actions on stdin",
HID_Boolean, 0, 0, {0, 0, 0}, 0, &stdin_listen},
#define HA_listen 0
+/* %start-doc options "21 GTK+ GUI Options"
+@ftable @code
+@item --bg-image <string>
+File name of an image to put into the background of the GUI canvas. The image must
+be a color PPM image, in binary (not ASCII) format. It can be any size, and will be
+automatically scaled to fit the canvas.
+@end ftable
+%end-doc
+*/
{"bg-image", "Background Image",
HID_String, 0, 0, {0, 0, 0}, 0, &bg_image_file},
#define HA_bg_image 1
+/* %start-doc options "21 GTK+ GUI Options"
+@ftable @code
+@item --pcb-menu <string>
+Location of the @file{gpcb-menu.res} file which defines the menu for the GTK+ GUI.
+@end ftable
+%end-doc
+*/
{"pcb-menu", "Location of gpcb-menu.res file",
HID_String, 0, 0, {0, PCBLIBDIR "/gpcb-menu.res", 0}, 0, &pcbmenu_path}
#define HA_pcbmenu 2
diff --git a/src/hid/lesstif/main.c b/src/hid/lesstif/main.c
index 30739e9..1885761 100644
--- a/src/hid/lesstif/main.c
+++ b/src/hid/lesstif/main.c
@@ -198,14 +198,37 @@ HID_Attribute lesstif_attribute_list[] = {
HID_Boolean, 0, 0, {0, 0, 0}, 0, &use_private_colormap},
#define HA_colormap 0
+/* %start-doc options "22 lesstif GUI Options"
+@ftable @code
+@item --listen
+Listen for actions on stdin.
+@end ftable
+%end-doc
+*/
{"listen", "Listen on standard input for actions",
HID_Boolean, 0, 0, {0, 0, 0}, 0, &stdin_listen},
#define HA_listen 1
+/* %start-doc options "22 lesstif GUI Options"
+@ftable @code
+@item --bg-image <string>
+File name of an image to put into the background of the GUI canvas. The image must
+be a color PPM image, in binary (not ASCII) format. It can be any size, and will be
+automatically scaled to fit the canvas.
+@end ftable
+%end-doc
+*/
{"bg-image", "Background Image",
HID_String, 0, 0, {0, 0, 0}, 0, &background_image_file},
#define HA_bg_image 2
+/* %start-doc options "22 lesstif GUI Options"
+@ftable @code
+@item --pcb-menu <string>
+Location of the @file{pcb-menu.res} file which defines the menu for the lesstif GUI.
+@end ftable
+%end-doc
+*/
{"pcb-menu", "Location of pcb-menu.res file",
HID_String, 0, 0, {0, PCBLIBDIR "/pcb-menu.res", 0}, 0, &lesstif_pcbmenu_path}
#define HA_pcbmenu 3
commit eb90f7eb41ea46d49286beff7136b2435e1347ae
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for DRC commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/main.c b/src/main.c
index e99ea2c..171c1f7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -874,13 +874,69 @@ Default value is @code{2mil}.
CSET (AlignmentDistance, MIL_TO_COORD(2), "alignment-distance",
"distance between the boards outline and alignment targets"),
- CSET (Bloat, MIL_TO_COORD(10), "bloat", 0),
- CSET (Shrink, MIL_TO_COORD(10), "shrink", 0),
+/* %start-doc options "7 DRC Options"
+All parameters should be given with an unit. If no unit is given, 1/100 mil
+(cmil) will be used for backward compability. Valid units are given in section
+@ref{Sizes}.
+%end-doc
+*/
+
+
+/* %start-doc options "7 DRC Options"
+@ftable @code
+@item --bloat <num>
+Minimum spacing. Default value is @code{10mil}.
+@end ftable
+%end-doc
+*/
+ CSET (Bloat, MIL_TO_COORD(10), "bloat", "DRC minimum spacing in 1/100 mil"),
+
+/* %start-doc options "7 DRC Options"
+@ftable @code
+@item --shrink <num>
+Minimum touching overlap. Default value is @code{10mil}.
+@end ftable
+%end-doc
+*/
+ CSET (Shrink, MIL_TO_COORD(10), "shrink", "DRC minimum overlap in 1/100 mils"),
+
+/* %start-doc options "7 DRC Options"
+@ftable @code
+@item --min-width <num>
+Minimum width of copper. Default value is @code{10mil}.
+@end ftable
+%end-doc
+*/
CSET (minWid, MIL_TO_COORD(10), "min-width", "DRC minimum copper spacing"),
+
+/* %start-doc options "7 DRC Options"
+@ftable @code
+@item --min-silk <num>
+Minimum width of lines in silk. Default value is @code{10mil}.
+@end ftable
+%end-doc
+*/
CSET (minSlk, MIL_TO_COORD(10), "min-silk", "DRC minimum silk width"),
+
+/* %start-doc options "7 DRC Options"
+@ftable @code
+@item --min-drill <num>
+Minimum diameter of holes. Default value is @code{15mil}.
+@end ftable
+%end-doc
+*/
CSET (minDrill, MIL_TO_COORD(15), "min-drill", "DRC minimum drill diameter"),
+
+/* %start-doc options "7 DRC Options"
+@ftable @code
+@item --min-ring <num>
+Minimum width of annular ring. Default value is @code{10mil}.
+@end ftable
+%end-doc
+*/
CSET (minRing, MIL_TO_COORD(10), "min-ring", "DRC minimum annular ring"),
+
/* %start-doc options "5 Sizes"
@ftable @code
@item --grid <num>
commit 45074652a9619be78de0834402884969f9797ddc
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for general gui commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/main.c b/src/main.c
index 6b5b577..e99ea2c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1224,16 +1224,93 @@ names, layer numbers and layer groups.
SSET (GnetlistProgram, NULL, "gnetlist",
"Sets the name and optionally full path to the gnetlist(3) program"),
- CSET (PinoutOffsetX, MIL_TO_COORD(1), "pinout-offset-x", 0),
- CSET (PinoutOffsetY, MIL_TO_COORD(1), "pinout-offset-y", 0),
- CSET (PinoutTextOffsetX, MIL_TO_COORD(8), "pinout-text-offset-x", 0),
- CSET (PinoutTextOffsetY, MIL_TO_COORD(-1), "pinout-text-offset-y", 0),
+/* %start-doc options "2 General GUI Options"
+@ftable @code
+@item --pinout-offset-x <num>
+Horizontal offset of the pin number display. Defaults to @code{100mil}.
+@end ftable
+%end-doc
+*/
+ CSET (PinoutOffsetX, MIL_TO_COORD(1), "pinout-offset-x",
+ "Horizontal offset of the pin number display in mil"),
+
+/* %start-doc options "2 General GUI Options"
+@ftable @code
+@item --pinout-offset-y <num>
+Vertical offset of the pin number display. Defaults to @code{100mil}.
+@end ftable
+%end-doc
+*/
+ CSET (PinoutOffsetY, MIL_TO_COORD(1), "pinout-offset-y",
+ "Vertical offset of the pin number display in mil"),
+
+/* %start-doc options "2 General GUI Options"
+@ftable @code
+@item --pinout-text-offset-x <num>
+Horizontal offset of the pin name display. Defaults to @code{800mil}.
+@end ftable
+%end-doc
+*/
+ CSET (PinoutTextOffsetX, MIL_TO_COORD(8), "pinout-text-offset-x",
+ "Horizontal offset of the pin name display in mil"),
+
+/* %start-doc options "2 General GUI Options"
+@ftable @code
+@item --pinout-text-offset-y <num>
+Vertical offset of the pin name display. Defaults to @code{-100mil}.
+@end ftable
+%end-doc
+*/
+ CSET (PinoutTextOffsetY, MIL_TO_COORD(-1), "pinout-text-offset-y",
+ "Vertical offset of the pin name display in mil"),
+
+/* %start-doc options "2 General GUI Options"
+@ftable @code
+@item --draw-grid
+If set, draw the grid at start-up.
+@end ftable
+%end-doc
+*/
+ BSET (DrawGrid, 0, "draw-grid", "If set, draw the grid at start-up"),
+
+/* %start-doc options "2 General GUI Options"
+@ftable @code
+@item --clear-line
+If set, new lines clear polygons.
+@end ftable
+%end-doc
+*/
+ BSET (ClearLine, 1, "clear-line", "If set, new lines clear polygons"),
- BSET (DrawGrid, 0, "draw-grid", "default to drawing the grid at startup"),
- BSET (ClearLine, 1, "clear-line", 0),
+/* %start-doc options "2 General GUI Options"
+@ftable @code
+@item --full-poly
+If set, new polygons are full ones.
+@end ftable
+%end-doc
+*/
BSET (FullPoly, 0, "full-poly", 0),
- BSET (UniqueNames, 1, "unique-names", 0),
- BSET (SnapPin, 1, "snap-pin", 0),
+
+/* %start-doc options "2 General GUI Options"
+@ftable @code
+@item --unique-names
+If set, you will not be permitted to change the name of an component to match that
+of another component.
+@end ftable
+%end-doc
+*/
+ BSET (UniqueNames, 1, "unique-names", "Prevents identical component names"),
+
+/* %start-doc options "2 General GUI Options"
+@ftable @code
+@item --snap-pin
+If set, pin centers and pad end points are treated as additional grid points
+that the cursor can snap to.
+@end ftable
+%end-doc
+*/
+ BSET (SnapPin, 1, "snap-pin",
+ "If set, the cursor snaps to pads and pin centers"),
/* %start-doc options "1 General Options"
@ftable @code
@@ -1255,9 +1332,25 @@ If set, all data which would otherwise be lost are saved in a temporary file
BSET (SaveInTMP, 0, "save-in-tmp",
"When set, all data which would otherwise be lost are saved in /tmp"),
- BSET (AllDirectionLines, 0, "all-direction-lines", 0),
+/* %start-doc options "2 General GUI Options"
+@ftable @code
+@item --all-direction-lines
+Allow all directions, when drawing new lines.
+@end ftable
+%end-doc
+*/
+ BSET (AllDirectionLines, 0, "all-direction-lines",
+ "Allow all directions, when drawing new lines"),
+
+/* %start-doc options "2 General GUI Options"
+@ftable @code
+@item --show-number
+Pinout shows number.
+@end ftable
+%end-doc
+*/
+ BSET (ShowNumber, 0, "show-number", "Pinout shows number"),
- BSET (ShowNumber, 0, "show-number", 0),
/* %start-doc options "1 General Options"
@ftable @code
@item --reset-after-element
commit e6581d531dcd196767bbf867918e0ae22a93effb
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for path commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/main.c b/src/main.c
index 692a805..6b5b577 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1073,6 +1073,13 @@ Defaults to @code{"ListLibraryContents.sh %p %f"}
SSET (LibraryContentsCommand, "ListLibraryContents.sh '%p' '%f'",
"lib-contents-command", "Command to query the contents of the library"),
+/* %start-doc options "5 Paths"
+@ftable @code
+@item --lib-newlib <string>
+Top level directory for the newlib style library.
+@end ftable
+%end-doc
+*/
SSET (LibraryTree, PCBTREEPATH, "lib-newlib",
"Top level directory for the newlib style library"),
@@ -1085,9 +1092,25 @@ Command to save to a file.
*/
SSET (SaveCommand, "", "save-command", "Command to save to a file"),
- SSET (LibraryFilename, LIBRARYFILENAME, "lib-name", 0),
+/* %start-doc options "5 Paths"
+@ftable @code
+@item --lib-name <string>
+The default filename for the library.
+@end ftable
+%end-doc
+*/
+ SSET (LibraryFilename, LIBRARYFILENAME, "lib-name",
+ "The default filename for the library"),
+
+/* %start-doc options "5 Paths"
+@ftable @code
+@item --default-font <string>
+The name of the default font.
+@end ftable
+%end-doc
+*/
SSET (FontFile, "default_font", "default-font",
- "File name of default font."),
+ "File name of default font"),
/* %start-doc options "1 General Options"
@ftable @code
@@ -1102,6 +1125,15 @@ A string that defines the route styles. Defaults to @*
":Fat,4000,6000,3500,1000:Skinny,600,2402,1181,600", "route-styles",
"A string that defines the route styles"),
+/* %start-doc options "5 Paths"
+@ftable @code
+@item --file-path <string>
+A colon separated list of directories or commands (starts with '|'). The path
+is passed to the program specified in @option{--file-command} together with the selected
+filename.
+@end ftable
+%end-doc
+*/
SSET (FilePath, "", "file-path", 0),
/* %start-doc options "6 Commands"
@@ -1113,7 +1145,16 @@ Command for reading a netlist. Sequence @code{%f} is replaced by the netlist fil
*/
SSET (RatCommand, "", "rat-command", "Command for reading a netlist"),
- SSET (FontPath, PCBLIBPATH, "font-path", 0),
+/* %start-doc options "5 Paths"
+@ftable @code
+@item --font-path <string>
+A colon separated list of directories to search the default font. Defaults to
+the default library path.
+@end ftable
+%end-doc
+*/
+ SSET (FontPath, PCBLIBPATH, "font-path",
+ "Colon separated list of directories to search the default font"),
/* %start-doc options "1 General Options"
@ftable @code
@@ -1126,7 +1167,16 @@ The path is passed to the program specified in @option{--element-command}.
SSET(ElementPath, PCBLIBPATH, "element-path",
"A colon separated list of directories or commands (starts with '|')"),
- SSET (LibraryPath, PCBLIBPATH, "lib-path", 0),
+/* %start-doc options "5 Paths"
+@ftable @code
+@item --lib-path <string>
+A colon separated list of directories that will be passed to the commands specified
+by @option{--element-command} and @option{--element-contents-command}.
+@end ftable
+%end-doc
+*/
+ SSET (LibraryPath, PCBLIBPATH, "lib-path",
+ "A colon separated list of directories"),
/* %start-doc options "1 General Options"
@ftable @code
commit ceea0e16b5495b7f41337bea8cfc82db315746cd
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for commandline commands
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/main.c b/src/main.c
index 9e6b3ad..692a805 100644
--- a/src/main.c
+++ b/src/main.c
@@ -992,21 +992,99 @@ Layer group string. Defaults to @code{"1,c:2:3:4:5:6,s:7:8"}.
*/
SSET (Groups, "1,c:2:3:4:5:6,s:7:8", "groups", "Layer group string"),
- SSET (FontCommand, "",
- "font-command", 0),
- SSET (FileCommand, "", "file-command", "Command to read a file."),
+
+/* %start-doc options "6 Commands"
+pcb uses external commands for input output operations. These commands can be
+configured at start-up to meet local requirements. The command string may include
+special sequences @code{%f}, @code{%p} or @code{%a}. These are replaced when the
+command is called. The sequence @code{%f} is replaced by the file name,
+@code{%p} gets the path and @code{%a} indicates a package name.
+%end-doc
+*/
+
+/* %start-doc options "6 Commands"
+@ftable @code
+@item --font-command <string>
+Command to load a font.
+@end ftable
+%end-doc
+*/
+ SSET (FontCommand, "", "font-command", "Command to load a font"),
+
+/* %start-doc options "6 Commands"
+@ftable @code
+@item --file-command <string>
+Command to read a file.
+@end ftable
+%end-doc
+*/
+ SSET (FileCommand, "", "file-command", "Command to read a file"),
+
+/* %start-doc options "6 Commands"
+@ftable @code
+@item --element-command <string>
+Command to read a footprint. @*
+Defaults to @code{"M4PATH='%p';export M4PATH;echo 'include(%f)' | m4"}
+@end ftable
+%end-doc
+*/
SSET (ElementCommand,
"M4PATH='%p';export M4PATH;echo 'include(%f)' | " GNUM4,
- "element-command", 0),
- SSET (PrintFile, "%f.output", "print-file", 0),
- SSET (LibraryCommandDir, PCBLIBDIR, "lib-command-dir", 0),
+ "element-command", "Command to read a footprint"),
+
+/* %start-doc options "6 Commands"
+@ftable @code
+@item --print-file <string>
+Command to print to a file.
+@end ftable
+%end-doc
+*/
+ SSET (PrintFile, "%f.output", "print-file", "Command to print to a file"),
+
+/* %start-doc options "6 Commands"
+@ftable @code
+@item --lib-command-dir <string>
+Path to the command that queries the library.
+@end ftable
+%end-doc
+*/
+ SSET (LibraryCommandDir, PCBLIBDIR, "lib-command-dir",
+ "Path to the command that queries the library"),
+
+/* %start-doc options "6 Commands"
+@ftable @code
+@item --lib-command <string>
+Command to query the library. @*
+Defaults to @code{"QueryLibrary.sh '%p' '%f' %a"}
+@end ftable
+%end-doc
+*/
SSET (LibraryCommand, "QueryLibrary.sh '%p' '%f' %a",
- "lib-command", 0),
+ "lib-command", "Command to query the library"),
+
+/* %start-doc options "6 Commands"
+@ftable @code
+@item --lib-contents-command <string>
+Command to query the contents of the library. @*
+Defaults to @code{"ListLibraryContents.sh %p %f"}
+@end ftable
+%end-doc
+*/
SSET (LibraryContentsCommand, "ListLibraryContents.sh '%p' '%f'",
- "lib-contents-command", 0),
+ "lib-contents-command", "Command to query the contents of the library"),
+
SSET (LibraryTree, PCBTREEPATH, "lib-newlib",
"Top level directory for the newlib style library"),
- SSET (SaveCommand, "", "save-command", 0),
+
+/* %start-doc options "6 Commands"
+@ftable @code
+@item --save-command <string>
+Command to save to a file.
+@end ftable
+%end-doc
+*/
+ SSET (SaveCommand, "", "save-command", "Command to save to a file"),
+
SSET (LibraryFilename, LIBRARYFILENAME, "lib-name", 0),
SSET (FontFile, "default_font", "default-font",
"File name of default font."),
@@ -1025,7 +1103,16 @@ A string that defines the route styles. Defaults to @*
"A string that defines the route styles"),
SSET (FilePath, "", "file-path", 0),
- SSET (RatCommand, "", "rat-command", 0),
+
+/* %start-doc options "6 Commands"
+@ftable @code
+@item --rat-command <string>
+Command for reading a netlist. Sequence @code{%f} is replaced by the netlist filename.
+@end ftable
+%end-doc
+*/
+ SSET (RatCommand, "", "rat-command", "Command for reading a netlist"),
+
SSET (FontPath, PCBLIBPATH, "font-path", 0),
/* %start-doc options "1 General Options"
commit bd1083bc23ede3f14148eba2a5da75ceece85c00
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for layer names commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/main.c b/src/main.c
index 376dd1d..9e6b3ad 100644
--- a/src/main.c
+++ b/src/main.c
@@ -911,13 +911,76 @@ The default value is @code{60}.
ISET (BackupInterval, 60, "backup-interval",
"Time between automatic backups in seconds. Set to 0 to disable"),
+/* %start-doc options "4 Layer Names"
+@ftable @code
+@item --layer-name-1 <string>
+Name of the 1st Layer. Default is @code{"top"}.
+@end ftable
+%end-doc
+*/
LAYERNAME (1, "top"),
+
+/* %start-doc options "4 Layer Names"
+@ftable @code
+@item --layer-name-2 <string>
+Name of the 2nd Layer. Default is @code{"ground"}.
+@end ftable
+%end-doc
+*/
LAYERNAME (2, "ground"),
+
+/* %start-doc options "4 Layer Names"
+@ftable @code
+@item --layer-name-3 <string>
+Name of the 3nd Layer. Default is @code{"signal2"}.
+@end ftable
+%end-doc
+*/
LAYERNAME (3, "signal2"),
+
+/* %start-doc options "4 Layer Names"
+@ftable @code
+@item --layer-name-4 <string>
+Name of the 4rd Layer. Default is @code{"signal3"}.
+@end ftable
+%end-doc
+*/
LAYERNAME (4, "signal3"),
+
+/* %start-doc options "4 Layer Names"
+@ftable @code
+@item --layer-name-5 <string>
+Name of the 5rd Layer. Default is @code{"power"}.
+@end ftable
+%end-doc
+*/
LAYERNAME (5, "power"),
+
+/* %start-doc options "4 Layer Names"
+@ftable @code
+@item --layer-name-6 <string>
+Name of the 6rd Layer. Default is @code{"bottom"}.
+@end ftable
+%end-doc
+*/
LAYERNAME (6, "bottom"),
+
+/* %start-doc options "4 Layer Names"
+@ftable @code
+@item --layer-name-7 <string>
+Name of the 7rd Layer. Default is @code{"outline"}.
+@end ftable
+%end-doc
+*/
LAYERNAME (7, "outline"),
+
+/* %start-doc options "4 Layer Names"
+@ftable @code
+@item --layer-name-8 <string>
+Name of the 8rd Layer. Default is @code{"spare"}.
+@end ftable
+%end-doc
+*/
LAYERNAME (8, "spare"),
/* %start-doc options "1 General Options"
commit 99782e903aaf8c7c3e8d0cfbbfbafb19db66ac6c
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for size commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/main.c b/src/main.c
index ee1abbc..376dd1d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -757,16 +757,123 @@ Color of the mask layer. Default value is @code{"#ff0000"}
*/
COLOR (MaskColor, "#ff0000", "mask-color", "color for solder mask"),
- CSET (ViaThickness, MIL_TO_COORD(60), "via-thickness", 0),
- CSET (ViaDrillingHole, MIL_TO_COORD(28), "via-drilling-hole", 0),
+
+/* %start-doc options "5 Sizes"
+All parameters should be given with an unit. If no unit is given, 1/100 mil
+(cmil) will be used. Write units without space to the
+number like @code{3mm}, not @code{3 mm}.
+Valid Units are:
+ @table @samp
+ @item km
+ Kilometer
+ @item m
+ Meter
+ @item cm
+ Centimeter
+ @item mm
+ Millimeter
+ @item um
+ Micrometer
+ @item nm
+ Nanometer
+ @item in
+ Inch (1in = 0.0254m)
+ @item mil
+ Mil (1000mil = 1in)
+ @item cmil
+ Centimil (1/100 mil)
+@end table
+
+@ftable @code
+@item --via-thickness <num>
+Default diameter of vias. Default value is @code{60mil}.
+@end ftable
+%end-doc
+*/
+ CSET (ViaThickness, MIL_TO_COORD(60), "via-thickness",
+ "default diameter of vias in 1/100 mil"),
+
+/* %start-doc options "5 Sizes"
+@ftable @code
+@item --via-drilling-hole <num>
+Default diameter of holes. Default value is @code{28mil}.
+@end ftable
+%end-doc
+*/
+ CSET (ViaDrillingHole, MIL_TO_COORD(28), "via-drilling-hole",
+ "default diameter of holes"),
+
+/* %start-doc options "5 Sizes"
+@ftable @code
+@item --line-thickness <num>
+Default thickness of new lines. Default value is @code{10mil}.
+@end ftable
+%end-doc
+*/
CSET (LineThickness, MIL_TO_COORD(10), "line-thickness",
- "Initial thickness of new lines."),
- CSET (RatThickness, MIL_TO_COORD(10), "rat-thickness", 0),
- CSET (Keepaway, MIL_TO_COORD(10), "keepaway", 0),
- CSET (MaxWidth, MIL_TO_COORD(6000), "default-PCB-width", 0),
- CSET (MaxHeight, MIL_TO_COORD(5000), "default-PCB-height", 0),
- ISET (TextScale, 100, "text-scale", 0),
- CSET (AlignmentDistance, MIL_TO_COORD(2), "alignment-distance", 0),
+ "initial thickness of new lines"),
+
+/* %start-doc options "5 Sizes"
+@ftable @code
+@item --rat-thickness <num>
+Thickness of rats. Values from 1 to 19 are fixed width in screen pixels.
+Anything larger means PCB units (i.e. 100 means "1 mil"). Default value
+is @code{10mil}.
+@end ftable
+%end-doc
+*/
+ CSET (RatThickness, MIL_TO_COORD(10), "rat-thickness", "thickness of rat lines"),
+
+/* %start-doc options "5 Sizes"
+@ftable @code
+@item --keepaway <num>
+Default minimum distance between a track and adjacent copper.
+Default value is @code{10mil}.
+@end ftable
+%end-doc
+*/
+ CSET (Keepaway, MIL_TO_COORD(10), "keepaway", "minimum distance between adjacent copper"),
+
+/* %start-doc options "5 Sizes"
+@ftable @code
+@item --default-PCB-width <num>
+Default width of the canvas. Default value is @code{6000mil}.
+@end ftable
+%end-doc
+*/
+ CSET (MaxWidth, MIL_TO_COORD(6000), "default-PCB-width",
+ "default width of the canvas"),
+
+/* %start-doc options "5 Sizes"
+@ftable @code
+@item --default-PCB-height <num>
+Default height of the canvas. Default value is @code{5000mil}.
+@end ftable
+%end-doc
+*/
+ CSET (MaxHeight, MIL_TO_COORD(5000), "default-PCB-height",
+ "default height of the canvas"),
+
+/* %start-doc options "5 Sizes"
+@ftable @code
+@item --text-scale <num>
+Default text scale. This value is in percent. Default value is @code{100}.
+@end ftable
+%end-doc
+*/
+ ISET (TextScale, 100, "text-scale", "default text scale in percent"),
+
+/* %start-doc options "5 Sizes"
+@ftable @code
+@item --alignment-distance <num>
+Specifies the distance between the board outline and alignment targets.
+Default value is @code{2mil}.
+@end ftable
+%end-doc
+*/
+ CSET (AlignmentDistance, MIL_TO_COORD(2), "alignment-distance",
+ "distance between the boards outline and alignment targets"),
+
CSET (Bloat, MIL_TO_COORD(10), "bloat", 0),
CSET (Shrink, MIL_TO_COORD(10), "shrink", 0),
CSET (minWid, MIL_TO_COORD(10), "min-width", "DRC minimum copper spacing"),
@@ -774,9 +881,25 @@ Color of the mask layer. Default value is @code{"#ff0000"}
CSET (minDrill, MIL_TO_COORD(15), "min-drill", "DRC minimum drill diameter"),
CSET (minRing, MIL_TO_COORD(10), "min-ring", "DRC minimum annular ring"),
- CSET (Grid, MIL_TO_COORD(10), "grid", 0),
+/* %start-doc options "5 Sizes"
+@ftable @code
+@item --grid <num>
+Initial grid size. Default value is @code{10mil}.
+@end ftable
+%end-doc
+*/
+ CSET (Grid, MIL_TO_COORD(10), "grid", "Initial grid size in 1/100 mil"),
+
+/* %start-doc options "5 Sizes"
+@ftable @code
+@item --minimum polygon area <num>
+Minimum polygon area.
+@end ftable
+%end-doc
+*/
RSET (IsleArea, MIL_TO_COORD(100) * MIL_TO_COORD(100), "minimum polygon area", 0),
+
/* %start-doc options "1 General Options"
@ftable @code
@item --backup-interval
commit 883b043e44169c32c58318b8ba5ac6895a040c39
Author: Felix Ruoff <Fe...@po...>
Commit: Felix Ruoff <Fe...@po...>
Add docu for color commandline options
Most parts of this patch-serie was written by Kai-Martin Knaak.
Adaption to actual git HEAD and some modifications by Felix Ruoff.
diff --git a/src/main.c b/src/main.c
index fe957c4..ee1abbc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -510,36 +510,195 @@ Set default grid units. Can be mm or mil. Defaults to mil.
{"grid-units", "Default grid units (mm|mil)", HID_String, 0, 0, {0, "mil", 0},
0, &grid_units},
- COLOR (BlackColor, "#000000", "black-color", "color for black"),
- COLOR (WhiteColor, "#ffffff", "white-color", "color for white"),
+/* %start-doc options "3 Colors"
+@ftable @code
+@item --black-color <string>
+Color value for black. Default: @samp{#000000}
+@end ftable
+%end-doc
+*/
+ COLOR (BlackColor, "#000000", "black-color", "color value of 'black'"),
+
+/* %start-doc options "3 Colors"
+@ftable @code
+@item --black-color <string>
+Color value for white. Default: @samp{#ffffff}
+@end ftable
+%end-doc
+*/
+ COLOR (WhiteColor, "#ffffff", "white-color", "color value of 'white'"),
+
+/* %start-doc options "3 Colors"
+@ftable @code
+@item --background-color <string>
+Background color of the canvas. Default: @samp{#e5e5e5}
+@end ftable
+%end-doc
+*/
COLOR (BackgroundColor, "#e5e5e5", "background-color",
"color for background"),
+
+/* %start-doc options "3 Colors"
+@ftable @code
+@item --crosshair-color <string>
+Color of the crosshair. Default: @samp{#ff0000}
+@end ftable
+%end-doc
+*/
COLOR (CrosshairColor, "#ff0000", "crosshair-color",
"color for the crosshair"),
- COLOR (CrossColor, "#cdcd00", "cross-color", "color for cross"),
- COLOR (ViaColor, "#7f7f7f", "via-color", "color for vias"),
+
+/* %start-doc options "3 Colors"
+@ftable @code
+@item --cross-color <string>
+Color of the cross. De...
[truncated message content] |
|
From: <gi...@gp...> - 2011-08-28 14:52:46
|
The branch, master has been updated
via 94a9388560fc43431ac331e477acdb0c7c571220 (commit)
from 74e7a2b360e2b4cbe49510cfb3a645666ffbcd95 (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/draw.c | 30 ------------------------------
src/misc.c | 37 +++++++++++++++++++++++++++++++++++++
src/misc.h | 1 +
3 files changed, 38 insertions(+), 30 deletions(-)
=================
Commit Messages
=================
commit 94a9388560fc43431ac331e477acdb0c7c571220
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Move CountHoles() from draw.c to misc.c and export it
This function may be more generally useful.
:100644 100644 ea3e1ce... 1bbbca0... M src/draw.c
:100644 100644 af1e58f... f6e01c5... M src/misc.c
:100644 100644 deaca84... f625cbc... M src/misc.h
=========
Changes
=========
commit 94a9388560fc43431ac331e477acdb0c7c571220
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Move CountHoles() from draw.c to misc.c and export it
This function may be more generally useful.
diff --git a/src/draw.c b/src/draw.c
index ea3e1ce..1bbbca0 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -454,36 +454,6 @@ DrawHoles (bool draw_plated, bool draw_unplated, BoxType *drawn_area)
r_search (PCB->Data->via_tree, drawn_area, NULL, hole_callback, &plated);
}
-typedef struct
-{
- int nplated;
- int nunplated;
-} HoleCountStruct;
-
-static int
-hole_counting_callback (const BoxType * b, void *cl)
-{
- PinTypePtr pin = (PinTypePtr) b;
- HoleCountStruct *hcs = (HoleCountStruct *) cl;
- if (TEST_FLAG (HOLEFLAG, pin))
- hcs->nunplated++;
- else
- hcs->nplated++;
- return 1;
-}
-
-static void
-CountHoles (int *plated, int *unplated, BoxType *drawn_area)
-{
- HoleCountStruct hcs = {0, 0};
-
- r_search (PCB->Data->pin_tree, drawn_area, NULL, hole_counting_callback, &hcs);
- r_search (PCB->Data->via_tree, drawn_area, NULL, hole_counting_callback, &hcs);
-
- if (plated != NULL) *plated = hcs.nplated;
- if (unplated != NULL) *unplated = hcs.nunplated;
-}
-
static void
_draw_line (LineType *line)
{
diff --git a/src/misc.c b/src/misc.c
index af1e58f..f6e01c5 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -681,6 +681,43 @@ IsPasteEmpty (int side)
return paste_empty;
}
+
+typedef struct
+{
+ int nplated;
+ int nunplated;
+} HoleCountStruct;
+
+static int
+hole_counting_callback (const BoxType * b, void *cl)
+{
+ PinTypePtr pin = (PinTypePtr) b;
+ HoleCountStruct *hcs = (HoleCountStruct *) cl;
+ if (TEST_FLAG (HOLEFLAG, pin))
+ hcs->nunplated++;
+ else
+ hcs->nplated++;
+ return 1;
+}
+
+/* ---------------------------------------------------------------------------
+ * counts the number of plated and unplated holes in the design within
+ * a given area of the board. To count for the whole board, pass NULL
+ * within_area.
+ */
+void
+CountHoles (int *plated, int *unplated, BoxType *within_area)
+{
+ HoleCountStruct hcs = {0, 0};
+
+ r_search (PCB->Data->pin_tree, within_area, NULL, hole_counting_callback, &hcs);
+ r_search (PCB->Data->via_tree, within_area, NULL, hole_counting_callback, &hcs);
+
+ if (plated != NULL) *plated = hcs.nplated;
+ if (unplated != NULL) *unplated = hcs.nunplated;
+}
+
+
/* ---------------------------------------------------------------------------
* gets minimum and maximum coordinates
* returns NULL if layout is empty
diff --git a/src/misc.h b/src/misc.h
index deaca84..f625cbc 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -59,6 +59,7 @@ bool IsLayerEmpty (LayerTypePtr);
bool IsLayerNumEmpty (int);
bool IsLayerGroupEmpty (int);
bool IsPasteEmpty (int);
+void CountHoles (int *, int *, BoxType *);
BoxTypePtr GetDataBoundingBox (DataTypePtr);
void CenterDisplay (Coord, Coord);
void SetFontInfo (FontTypePtr);
|
|
From: <gi...@gp...> - 2011-08-28 14:44:31
|
The branch, master has been updated
via 74e7a2b360e2b4cbe49510cfb3a645666ffbcd95 (commit)
from 0d39e62943da3b0686b2f41a53ddb9b4f0b4b20e (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/draw.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
=================
Commit Messages
=================
commit 74e7a2b360e2b4cbe49510cfb3a645666ffbcd95
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Move doing_assy flag assignment into PrintAssembly()
Keeps things tidier
:100644 100644 7d7a594... ea3e1ce... M src/draw.c
=========
Changes
=========
commit 74e7a2b360e2b4cbe49510cfb3a645666ffbcd95
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
draw.c: Move doing_assy flag assignment into PrintAssembly()
Keeps things tidier
diff --git a/src/draw.c b/src/draw.c
index 7d7a594..ea3e1ce 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -639,6 +639,7 @@ PrintAssembly (int side, const BoxType * drawn_area)
{
int side_group = GetLayerGroupNumberByNumber (max_copper_layer + side);
+ doing_assy = true;
gui->set_draw_faded (Output.fgGC, 1);
DrawLayerGroup (side_group, drawn_area);
DrawPPV (side_group, drawn_area);
@@ -646,6 +647,7 @@ PrintAssembly (int side, const BoxType * drawn_area)
/* draw package */
DrawSilk (side, drawn_area);
+ doing_assy = false;
}
/* ---------------------------------------------------------------------------
@@ -787,8 +789,6 @@ DrawEverything (BoxTypePtr drawn_area)
gui->end_layer ();
}
- doing_assy = true;
-
if (gui->set_layer ("topassembly", SL (ASSY, TOP), 0))
{
PrintAssembly (COMPONENT_LAYER, drawn_area);
@@ -801,8 +801,6 @@ DrawEverything (BoxTypePtr drawn_area)
gui->end_layer ();
}
- doing_assy = false;
-
if (gui->set_layer ("fab", SL (FAB, 0), 0))
{
PrintFab (Output.fgGC);
|
|
From: <gi...@gp...> - 2011-08-28 11:39:10
|
The branch, master has been updated
via 0d39e62943da3b0686b2f41a53ddb9b4f0b4b20e (commit)
from 7433061c74f1fadcb5bbdccdaea5850be19dd1cc (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/gcode/gcode.c | 5 -----
src/hid/nelma/nelma.c | 5 -----
2 files changed, 0 insertions(+), 10 deletions(-)
=================
Commit Messages
=================
commit 0d39e62943da3b0686b2f41a53ddb9b4f0b4b20e
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/{nelma,gcode}: Remove assigned but unused variables lastcap and lastgroup
:100644 100644 07e3d35... a4377db... M src/hid/gcode/gcode.c
:100644 100644 e91594b... d5a58d8... M src/hid/nelma/nelma.c
=========
Changes
=========
commit 0d39e62943da3b0686b2f41a53ddb9b4f0b4b20e
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/{nelma,gcode}: Remove assigned but unused variables lastcap and lastgroup
diff --git a/src/hid/gcode/gcode.c b/src/hid/gcode/gcode.c
index 07e3d35..a4377db 100644
--- a/src/hid/gcode/gcode.c
+++ b/src/hid/gcode/gcode.c
@@ -93,9 +93,7 @@ struct hid_gc_struct
static struct color_struct *black = NULL, *white = NULL;
static int linewidth = -1;
-static int lastgroup = -1;
static gdImagePtr lastbrush = (gdImagePtr)((void *) -1);
-static int lastcap = -1;
static int lastcolor = -1;
/* gd image and file for PNG export */
@@ -369,10 +367,7 @@ gcode_start_png_export ()
linewidth = -1;
lastbrush = (gdImagePtr)((void *) -1);
- lastcap = -1;
- lastgroup = -1;
lastcolor = -1;
- lastgroup = -1;
hid_expose_callback (&gcode_hid, ®ion, 0);
}
diff --git a/src/hid/nelma/nelma.c b/src/hid/nelma/nelma.c
index e91594b..d5a58d8 100644
--- a/src/hid/nelma/nelma.c
+++ b/src/hid/nelma/nelma.c
@@ -111,9 +111,7 @@ static HID nelma_hid;
static struct color_struct *black = NULL, *white = NULL;
static Coord linewidth = -1;
-static int lastgroup = -1;
static gdImagePtr lastbrush = (gdImagePtr)((void *) -1);
-static int lastcap = -1;
static int lastcolor = -1;
/* gd image and file for PNG export */
@@ -614,10 +612,7 @@ nelma_start_png_export()
linewidth = -1;
lastbrush = (gdImagePtr)((void *) -1);
- lastcap = -1;
- lastgroup = -1;
lastcolor = -1;
- lastgroup = -1;
hid_expose_callback(&nelma_hid, ®ion, 0);
}
|
|
From: <gi...@gp...> - 2011-08-28 11:27:37
|
The branch, master has been updated
via 7433061c74f1fadcb5bbdccdaea5850be19dd1cc (commit)
from 107c850395265126f836aa9077ae24adf53ee818 (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/draw.h | 3 ---
src/main.c | 3 ---
2 files changed, 0 insertions(+), 6 deletions(-)
=================
Commit Messages
=================
commit 7433061c74f1fadcb5bbdccdaea5850be19dd1cc
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Remove traces of LoadBackgroundImage() from the core of PCB
:100644 100644 484ae98... ef32ebb... M src/draw.h
:100644 100644 2f4322f... 5ce6e53... M src/main.c
=========
Changes
=========
commit 7433061c74f1fadcb5bbdccdaea5850be19dd1cc
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Remove traces of LoadBackgroundImage() from the core of PCB
diff --git a/src/draw.h b/src/draw.h
index 484ae98..ef32ebb 100644
--- a/src/draw.h
+++ b/src/draw.h
@@ -70,8 +70,5 @@ void EraseElement (ElementTypePtr);
void EraseElementPinsAndPads (ElementTypePtr);
void EraseElementName (ElementTypePtr);
void EraseObject (int, void *, void *);
-void LoadBackgroundImage (char *);
-
-/*GdkDrawable *draw_get_current_drawable(void);*/
#endif
diff --git a/src/main.c b/src/main.c
index 2f4322f..5ce6e53 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1052,9 +1052,6 @@ main (int argc, char *argv[])
LayerStringToLayerStack (Settings.InitialLayerStack);
}
- /* FIX_ME
- LoadBackgroundImage (Settings.BackgroundImage); */
-
/* This must be called before any other atexit functions
* are registered, as it configures an atexit function to
* clean up and free various items of allocated memory,
|
|
From: <gi...@gp...> - 2011-08-27 16:33:04
|
The branch, master has been updated
discards a1a89df145cae47d0f85afeae4b8e1e045a4d5c9 (commit)
via 107c850395265126f836aa9077ae24adf53ee818 (commit)
from a1a89df145cae47d0f85afeae4b8e1e045a4d5c9 (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/gtkhid-gdk.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
=================
Commit Messages
=================
commit 107c850395265126f836aa9077ae24adf53ee818
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use view_data struct to simplify saving and restoring views
:100644 100644 631e5b7... 4deae2b... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 ea8dd40... 21a22e8... M src/hid/gtk/gtkhid-gl.c
=========
Changes
=========
commit 107c850395265126f836aa9077ae24adf53ee818
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use view_data struct to simplify saving and restoring views
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index 631e5b7..4deae2b 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -1165,25 +1165,18 @@ ghid_pinout_preview_expose (GtkWidget *widget,
{
GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW (widget);
GdkDrawable *save_drawable;
- double save_zoom;
int da_w, da_h;
- int save_left, save_top;
+ view_data save_view;
int save_width, save_height;
- int save_view_width, save_view_height;
double xz, yz;
render_priv *priv = gport->render_priv;
- save_zoom = gport->view.coord_per_px;
- save_width = gport->width;
- save_height = gport->height;
- save_left = gport->view.x0;
- save_top = gport->view.y0;
- save_view_width = gport->view.width;
- save_view_height = gport->view.height;
-
/* Setup drawable and zoom factor for drawing routines
*/
save_drawable = gport->drawable;
+ save_view = gport->view;
+ save_width = gport->width;
+ save_height = gport->height;
gdk_window_get_geometry (widget->window, 0, 0, &da_w, &da_h, 0);
xz = (double) pinout->x_max / da_w;
@@ -1208,13 +1201,9 @@ ghid_pinout_preview_expose (GtkWidget *widget,
hid_expose_callback (&ghid_hid, NULL, &pinout->element);
gport->drawable = save_drawable;
- gport->view.coord_per_px = save_zoom;
+ gport->view = save_view;
gport->width = save_width;
gport->height = save_height;
- gport->view.x0 = save_left;
- gport->view.y0 = save_top;
- gport->view.width = save_view_width;
- gport->view.height = save_view_height;
return FALSE;
}
@@ -1224,21 +1213,15 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
{
GdkPixmap *pixmap;
GdkDrawable *save_drawable;
- double save_zoom;
- int save_left, save_top;
+ view_data save_view;
int save_width, save_height;
- int save_view_width, save_view_height;
BoxType region;
render_priv *priv = gport->render_priv;
save_drawable = gport->drawable;
- save_zoom = gport->view.coord_per_px;
+ save_view = gport->view;
save_width = gport->width;
save_height = gport->height;
- save_left = gport->view.x0;
- save_top = gport->view.y0;
- save_view_width = gport->view.width;
- save_view_height = gport->view.height;
pixmap = gdk_pixmap_new (NULL, width, height, depth);
@@ -1273,13 +1256,9 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
hid_expose_callback (&ghid_hid, ®ion, NULL);
gport->drawable = save_drawable;
- gport->view.coord_per_px = save_zoom;
+ gport->view = save_view;
gport->width = save_width;
gport->height = save_height;
- gport->view.x0 = save_left;
- gport->view.y0 = save_top;
- gport->view.width = save_view_width;
- gport->view.height = save_view_height;
return pixmap;
}
diff --git a/src/hid/gtk/gtkhid-gl.c b/src/hid/gtk/gtkhid-gl.c
index ea8dd40..21a22e8 100644
--- a/src/hid/gtk/gtkhid-gl.c
+++ b/src/hid/gtk/gtkhid-gl.c
@@ -1028,20 +1028,14 @@ ghid_pinout_preview_expose (GtkWidget *widget,
GdkGLContext* pGlContext = gtk_widget_get_gl_context (widget);
GdkGLDrawable* pGlDrawable = gtk_widget_get_gl_drawable (widget);
GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW (widget);
- double save_zoom;
int da_w, da_h;
- int save_left, save_top;
+ view_data save_view;
int save_width, save_height;
- int save_view_width, save_view_height;
double xz, yz;
- save_zoom = gport->view.coord_per_px;
+ save_view = gport->view;
save_width = gport->width;
save_height = gport->height;
- save_left = gport->view.x0;
- save_top = gport->view.y0;
- save_view_width = gport->view.width;
- save_view_height = gport->view.height;
/* Setup zoom factor for drawing routines */
@@ -1116,13 +1110,9 @@ ghid_pinout_preview_expose (GtkWidget *widget,
gport->render_priv->in_context = false;
gdk_gl_drawable_gl_end (pGlDrawable);
- gport->view.coord_per_px = save_zoom;
+ gport->view = save_view;
gport->width = save_width;
gport->height = save_height;
- gport->view.x0 = save_left;
- gport->view.y0 = save_top;
- gport->view.width = save_view_width;
- gport->view.height = save_view_height;
return FALSE;
}
@@ -1136,19 +1126,13 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
GdkGLPixmap *glpixmap;
GdkGLContext* glcontext;
GdkGLDrawable* gldrawable;
- double save_zoom;
- int save_left, save_top;
+ view_data save_view;
int save_width, save_height;
- int save_view_width, save_view_height;
BoxType region;
- save_zoom = gport->view.coord_per_px;
+ save_view = gport->view;
save_width = gport->width;
save_height = gport->height;
- save_left = gport->view.x0;
- save_top = gport->view.y0;
- save_view_width = gport->view.width;
- save_view_height = gport->view.height;
/* Setup rendering context for drawing routines
*/
@@ -1240,13 +1224,9 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
g_object_unref (glconfig);
g_object_unref (glcontext);
- gport->view.coord_per_px = save_zoom;
+ gport->view = save_view;
gport->width = save_width;
gport->height = save_height;
- gport->view.x0 = save_left;
- gport->view.y0 = save_top;
- gport->view.width = save_view_width;
- gport->view.height = save_view_height;
return pixmap;
}
|
|
From: <gi...@gp...> - 2011-08-27 16:28:33
|
The branch, master has been updated
via a1a89df145cae47d0f85afeae4b8e1e045a4d5c9 (commit)
from f568e65da130e42d3ccdb6a9e14452e85173df86 (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/gtkhid-gdk.c | 38 ++++++++------------------------------
src/hid/gtk/gtkhid-gl.c | 32 ++++++--------------------------
2 files changed, 14 insertions(+), 56 deletions(-)
=================
Commit Messages
=================
commit a1a89df145cae47d0f85afeae4b8e1e045a4d5c9
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use view_data struct to simplify saving and restoring views
:100644 100644 631e5b7... ce631a5... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 ea8dd40... 21a22e8... M src/hid/gtk/gtkhid-gl.c
=========
Changes
=========
commit a1a89df145cae47d0f85afeae4b8e1e045a4d5c9
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use view_data struct to simplify saving and restoring views
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index 631e5b7..ce631a5 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -1165,25 +1165,17 @@ ghid_pinout_preview_expose (GtkWidget *widget,
{
GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW (widget);
GdkDrawable *save_drawable;
- double save_zoom;
- int da_w, da_h;
- int save_left, save_top;
+ view_data save_view;
int save_width, save_height;
- int save_view_width, save_view_height;
double xz, yz;
render_priv *priv = gport->render_priv;
- save_zoom = gport->view.coord_per_px;
- save_width = gport->width;
- save_height = gport->height;
- save_left = gport->view.x0;
- save_top = gport->view.y0;
- save_view_width = gport->view.width;
- save_view_height = gport->view.height;
-
/* Setup drawable and zoom factor for drawing routines
*/
save_drawable = gport->drawable;
+ save_view = gport->view;
+ save_width = gport->width;
+ save_height = gport->height;
gdk_window_get_geometry (widget->window, 0, 0, &da_w, &da_h, 0);
xz = (double) pinout->x_max / da_w;
@@ -1208,13 +1200,9 @@ ghid_pinout_preview_expose (GtkWidget *widget,
hid_expose_callback (&ghid_hid, NULL, &pinout->element);
gport->drawable = save_drawable;
- gport->view.coord_per_px = save_zoom;
+ gport->view = save_view;
gport->width = save_width;
gport->height = save_height;
- gport->view.x0 = save_left;
- gport->view.y0 = save_top;
- gport->view.width = save_view_width;
- gport->view.height = save_view_height;
return FALSE;
}
@@ -1224,21 +1212,15 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
{
GdkPixmap *pixmap;
GdkDrawable *save_drawable;
- double save_zoom;
- int save_left, save_top;
+ view_data save_view;
int save_width, save_height;
- int save_view_width, save_view_height;
BoxType region;
render_priv *priv = gport->render_priv;
save_drawable = gport->drawable;
- save_zoom = gport->view.coord_per_px;
+ save_view = gport->view;
save_width = gport->width;
save_height = gport->height;
- save_left = gport->view.x0;
- save_top = gport->view.y0;
- save_view_width = gport->view.width;
- save_view_height = gport->view.height;
pixmap = gdk_pixmap_new (NULL, width, height, depth);
@@ -1273,13 +1255,9 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
hid_expose_callback (&ghid_hid, ®ion, NULL);
gport->drawable = save_drawable;
- gport->view.coord_per_px = save_zoom;
+ gport->view = save_view;
gport->width = save_width;
gport->height = save_height;
- gport->view.x0 = save_left;
- gport->view.y0 = save_top;
- gport->view.width = save_view_width;
- gport->view.height = save_view_height;
return pixmap;
}
diff --git a/src/hid/gtk/gtkhid-gl.c b/src/hid/gtk/gtkhid-gl.c
index ea8dd40..21a22e8 100644
--- a/src/hid/gtk/gtkhid-gl.c
+++ b/src/hid/gtk/gtkhid-gl.c
@@ -1028,20 +1028,14 @@ ghid_pinout_preview_expose (GtkWidget *widget,
GdkGLContext* pGlContext = gtk_widget_get_gl_context (widget);
GdkGLDrawable* pGlDrawable = gtk_widget_get_gl_drawable (widget);
GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW (widget);
- double save_zoom;
int da_w, da_h;
- int save_left, save_top;
+ view_data save_view;
int save_width, save_height;
- int save_view_width, save_view_height;
double xz, yz;
- save_zoom = gport->view.coord_per_px;
+ save_view = gport->view;
save_width = gport->width;
save_height = gport->height;
- save_left = gport->view.x0;
- save_top = gport->view.y0;
- save_view_width = gport->view.width;
- save_view_height = gport->view.height;
/* Setup zoom factor for drawing routines */
@@ -1116,13 +1110,9 @@ ghid_pinout_preview_expose (GtkWidget *widget,
gport->render_priv->in_context = false;
gdk_gl_drawable_gl_end (pGlDrawable);
- gport->view.coord_per_px = save_zoom;
+ gport->view = save_view;
gport->width = save_width;
gport->height = save_height;
- gport->view.x0 = save_left;
- gport->view.y0 = save_top;
- gport->view.width = save_view_width;
- gport->view.height = save_view_height;
return FALSE;
}
@@ -1136,19 +1126,13 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
GdkGLPixmap *glpixmap;
GdkGLContext* glcontext;
GdkGLDrawable* gldrawable;
- double save_zoom;
- int save_left, save_top;
+ view_data save_view;
int save_width, save_height;
- int save_view_width, save_view_height;
BoxType region;
- save_zoom = gport->view.coord_per_px;
+ save_view = gport->view;
save_width = gport->width;
save_height = gport->height;
- save_left = gport->view.x0;
- save_top = gport->view.y0;
- save_view_width = gport->view.width;
- save_view_height = gport->view.height;
/* Setup rendering context for drawing routines
*/
@@ -1240,13 +1224,9 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
g_object_unref (glconfig);
g_object_unref (glcontext);
- gport->view.coord_per_px = save_zoom;
+ gport->view = save_view;
gport->width = save_width;
gport->height = save_height;
- gport->view.x0 = save_left;
- gport->view.y0 = save_top;
- gport->view.width = save_view_width;
- gport->view.height = save_view_height;
return pixmap;
}
|
|
From: <gi...@gp...> - 2011-08-27 14:45:19
|
The branch, master has been updated
discards 112045192b260c75012499d5b15543c3dd082495 (commit)
via f568e65da130e42d3ccdb6a9e14452e85173df86 (commit)
from 112045192b260c75012499d5b15543c3dd082495 (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/gtkhid-main.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
=================
Commit Messages
=================
commit f568e65da130e42d3ccdb6a9e14452e85173df86
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Encapsulate view parameters in a structure
:100644 100644 817a0fa... 631e5b7... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 8c1e8a2... ea8dd40... M src/hid/gtk/gtkhid-gl.c
:100644 100644 b1af557... 0c9019d... M src/hid/gtk/gtkhid-main.c
:100644 100644 81dcd45... 5929a37... M src/hid/gtk/gui-output-events.c
:100644 100644 f8674e6... e2beb3c... M src/hid/gtk/gui-top-window.c
:100644 100644 c3f00a3... ad2a112... M src/hid/gtk/gui.h
=========
Changes
=========
commit f568e65da130e42d3ccdb6a9e14452e85173df86
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Encapsulate view parameters in a structure
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index 817a0fa..631e5b7 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -172,11 +172,11 @@ ghid_draw_grid (void)
gdk_gc_set_clip_origin (priv->grid_gc, 0, 0);
set_clip (priv, priv->grid_gc);
}
- x1 = GridFit (SIDE_X (gport->view_x0), PCB->Grid, PCB->GridOffsetX);
- y1 = GridFit (SIDE_Y (gport->view_y0), PCB->Grid, PCB->GridOffsetY);
- x2 = GridFit (SIDE_X (gport->view_x0 + gport->view_width - 1),
+ x1 = GridFit (SIDE_X (gport->view.x0), PCB->Grid, PCB->GridOffsetX);
+ y1 = GridFit (SIDE_Y (gport->view.y0), PCB->Grid, PCB->GridOffsetY);
+ x2 = GridFit (SIDE_X (gport->view.x0 + gport->view.width - 1),
PCB->Grid, PCB->GridOffsetX);
- y2 = GridFit (SIDE_Y (gport->view_y0 + gport->view_height - 1),
+ y2 = GridFit (SIDE_Y (gport->view.y0 + gport->view.height - 1),
PCB->Grid, PCB->GridOffsetY);
if (x1 > x2)
{
@@ -233,10 +233,10 @@ ghid_draw_bg_image (void)
if (!ghidgui->bg_pixbuf)
return;
- w = PCB->MaxWidth / gport->zoom;
- h = PCB->MaxHeight / gport->zoom;
- x = gport->view_x0 / gport->zoom;
- y = gport->view_y0 / gport->zoom;
+ w = PCB->MaxWidth / gport->view.coord_per_px;
+ h = PCB->MaxHeight / gport->view.coord_per_px;
+ x = gport->view.x0 / gport->view.coord_per_px;
+ y = gport->view.y0 / gport->view.coord_per_px;
if (w_scaled != w || h_scaled != h)
{
@@ -529,7 +529,7 @@ ghid_draw_line (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
dy2 = Vy ((double) y2);
if (!ClipLine (0, 0, gport->width, gport->height,
- &dx1, &dy1, &dx2, &dy2, gc->width / gport->zoom))
+ &dx1, &dy1, &dx2, &dy2, gc->width / gport->view.coord_per_px))
return;
USE_GC (gc);
@@ -544,25 +544,25 @@ ghid_draw_arc (hidGC gc, Coord cx, Coord cy,
gint w, h, radius;
render_priv *priv = gport->render_priv;
- w = gport->width * gport->zoom;
- h = gport->height * gport->zoom;
+ w = gport->width * gport->view.coord_per_px;
+ h = gport->height * gport->view.coord_per_px;
radius = (xradius > yradius) ? xradius : yradius;
- if (SIDE_X (cx) < gport->view_x0 - radius
- || SIDE_X (cx) > gport->view_x0 + w + radius
- || SIDE_Y (cy) < gport->view_y0 - radius
- || SIDE_Y (cy) > gport->view_y0 + h + radius)
+ if (SIDE_X (cx) < gport->view.x0 - radius
+ || SIDE_X (cx) > gport->view.x0 + w + radius
+ || SIDE_Y (cy) < gport->view.y0 - radius
+ || SIDE_Y (cy) > gport->view.y0 + h + radius)
return;
USE_GC (gc);
vrx = Vz (xradius);
vry = Vz (yradius);
- if (ghid_flip_x)
+ if (gport->view.flip_x)
{
start_angle = 180 - start_angle;
delta_angle = -delta_angle;
}
- if (ghid_flip_y)
+ if (gport->view.flip_y)
{
start_angle = -start_angle;
delta_angle = -delta_angle;
@@ -583,17 +583,17 @@ ghid_draw_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
render_priv *priv = gport->render_priv;
lw = gc->width;
- w = gport->width * gport->zoom;
- h = gport->height * gport->zoom;
-
- if ((SIDE_X (x1) < gport->view_x0 - lw
- && SIDE_X (x2) < gport->view_x0 - lw)
- || (SIDE_X (x1) > gport->view_x0 + w + lw
- && SIDE_X (x2) > gport->view_x0 + w + lw)
- || (SIDE_Y (y1) < gport->view_y0 - lw
- && SIDE_Y (y2) < gport->view_y0 - lw)
- || (SIDE_Y (y1) > gport->view_y0 + h + lw
- && SIDE_Y (y2) > gport->view_y0 + h + lw))
+ w = gport->width * gport->view.coord_per_px;
+ h = gport->height * gport->view.coord_per_px;
+
+ if ((SIDE_X (x1) < gport->view.x0 - lw
+ && SIDE_X (x2) < gport->view.x0 - lw)
+ || (SIDE_X (x1) > gport->view.x0 + w + lw
+ && SIDE_X (x2) > gport->view.x0 + w + lw)
+ || (SIDE_Y (y1) < gport->view.y0 - lw
+ && SIDE_Y (y2) < gport->view.y0 - lw)
+ || (SIDE_Y (y1) > gport->view.y0 + h + lw
+ && SIDE_Y (y2) > gport->view.y0 + h + lw))
return;
x1 = Vx (x1);
@@ -626,12 +626,12 @@ ghid_fill_circle (hidGC gc, Coord cx, Coord cy, Coord radius)
gint w, h, vr;
render_priv *priv = gport->render_priv;
- w = gport->width * gport->zoom;
- h = gport->height * gport->zoom;
- if (SIDE_X (cx) < gport->view_x0 - radius
- || SIDE_X (cx) > gport->view_x0 + w + radius
- || SIDE_Y (cy) < gport->view_y0 - radius
- || SIDE_Y (cy) > gport->view_y0 + h + radius)
+ w = gport->width * gport->view.coord_per_px;
+ h = gport->height * gport->view.coord_per_px;
+ if (SIDE_X (cx) < gport->view.x0 - radius
+ || SIDE_X (cx) > gport->view.x0 + w + radius
+ || SIDE_Y (cy) < gport->view.y0 - radius
+ || SIDE_Y (cy) > gport->view.y0 + h + radius)
return;
USE_GC (gc);
@@ -669,17 +669,17 @@ ghid_fill_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
render_priv *priv = gport->render_priv;
lw = gc->width;
- w = gport->width * gport->zoom;
- h = gport->height * gport->zoom;
-
- if ((SIDE_X (x1) < gport->view_x0 - lw
- && SIDE_X (x2) < gport->view_x0 - lw)
- || (SIDE_X (x1) > gport->view_x0 + w + lw
- && SIDE_X (x2) > gport->view_x0 + w + lw)
- || (SIDE_Y (y1) < gport->view_y0 - lw
- && SIDE_Y (y2) < gport->view_y0 - lw)
- || (SIDE_Y (y1) > gport->view_y0 + h + lw
- && SIDE_Y (y2) > gport->view_y0 + h + lw))
+ w = gport->width * gport->view.coord_per_px;
+ h = gport->height * gport->view.coord_per_px;
+
+ if ((SIDE_X (x1) < gport->view.x0 - lw
+ && SIDE_X (x2) < gport->view.x0 - lw)
+ || (SIDE_X (x1) > gport->view.x0 + w + lw
+ && SIDE_X (x2) > gport->view.x0 + w + lw)
+ || (SIDE_Y (y1) < gport->view.y0 - lw
+ && SIDE_Y (y2) < gport->view.y0 - lw)
+ || (SIDE_Y (y1) > gport->view.y0 + h + lw
+ && SIDE_Y (y2) > gport->view.y0 + h + lw))
return;
x1 = Vx (x1);
@@ -1173,13 +1173,13 @@ ghid_pinout_preview_expose (GtkWidget *widget,
double xz, yz;
render_priv *priv = gport->render_priv;
- save_zoom = gport->zoom;
+ save_zoom = gport->view.coord_per_px;
save_width = gport->width;
save_height = gport->height;
- save_left = gport->view_x0;
- save_top = gport->view_y0;
- save_view_width = gport->view_width;
- save_view_height = gport->view_height;
+ save_left = gport->view.x0;
+ save_top = gport->view.y0;
+ save_view_width = gport->view.width;
+ save_view_height = gport->view.height;
/* Setup drawable and zoom factor for drawing routines
*/
@@ -1189,17 +1189,17 @@ ghid_pinout_preview_expose (GtkWidget *widget,
xz = (double) pinout->x_max / da_w;
yz = (double) pinout->y_max / da_h;
if (xz > yz)
- gport->zoom = xz;
+ gport->view.coord_per_px = xz;
else
- gport->zoom = yz;
+ gport->view.coord_per_px = yz;
gport->drawable = widget->window;
gport->width = da_w;
gport->height = da_h;
- gport->view_width = da_w * gport->zoom;
- gport->view_height = da_h * gport->zoom;
- gport->view_x0 = (pinout->x_max - gport->view_width) / 2;
- gport->view_y0 = (pinout->y_max - gport->view_height) / 2;
+ gport->view.width = da_w * gport->view.coord_per_px;
+ gport->view.height = da_h * gport->view.coord_per_px;
+ gport->view.x0 = (pinout->x_max - gport->view.width) / 2;
+ gport->view.y0 = (pinout->y_max - gport->view.height) / 2;
/* clear background */
gdk_draw_rectangle (widget->window, priv->bg_gc, TRUE, 0, 0, da_w, da_h);
@@ -1208,13 +1208,13 @@ ghid_pinout_preview_expose (GtkWidget *widget,
hid_expose_callback (&ghid_hid, NULL, &pinout->element);
gport->drawable = save_drawable;
- gport->zoom = save_zoom;
+ gport->view.coord_per_px = save_zoom;
gport->width = save_width;
gport->height = save_height;
- gport->view_x0 = save_left;
- gport->view_y0 = save_top;
- gport->view_width = save_view_width;
- gport->view_height = save_view_height;
+ gport->view.x0 = save_left;
+ gport->view.y0 = save_top;
+ gport->view.width = save_view_width;
+ gport->view.height = save_view_height;
return FALSE;
}
@@ -1232,13 +1232,13 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
render_priv *priv = gport->render_priv;
save_drawable = gport->drawable;
- save_zoom = gport->zoom;
+ save_zoom = gport->view.coord_per_px;
save_width = gport->width;
save_height = gport->height;
- save_left = gport->view_x0;
- save_top = gport->view_y0;
- save_view_width = gport->view_width;
- save_view_height = gport->view_height;
+ save_left = gport->view.x0;
+ save_top = gport->view.y0;
+ save_view_width = gport->view.width;
+ save_view_height = gport->view.height;
pixmap = gdk_pixmap_new (NULL, width, height, depth);
@@ -1246,15 +1246,15 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
*/
gport->drawable = pixmap;
- gport->zoom = zoom;
+ gport->view.coord_per_px = zoom;
gport->width = width;
gport->height = height;
- gport->view_width = width * gport->zoom;
- gport->view_height = height * gport->zoom;
- gport->view_x0 = ghid_flip_x ? PCB->MaxWidth - cx : cx;
- gport->view_x0 -= gport->view_height / 2;
- gport->view_y0 = ghid_flip_y ? PCB->MaxHeight - cy : cy;
- gport->view_y0 -= gport->view_width / 2;
+ gport->view.width = width * gport->view.coord_per_px;
+ gport->view.height = height * gport->view.coord_per_px;
+ gport->view.x0 = gport->view.flip_x ? PCB->MaxWidth - cx : cx;
+ gport->view.x0 -= gport->view.height / 2;
+ gport->view.y0 = gport->view.flip_y ? PCB->MaxHeight - cy : cy;
+ gport->view.y0 -= gport->view.width / 2;
/* clear background */
gdk_draw_rectangle (pixmap, priv->bg_gc, TRUE, 0, 0, width, height);
@@ -1273,13 +1273,13 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
hid_expose_callback (&ghid_hid, ®ion, NULL);
gport->drawable = save_drawable;
- gport->zoom = save_zoom;
+ gport->view.coord_per_px = save_zoom;
gport->width = save_width;
gport->height = save_height;
- gport->view_x0 = save_left;
- gport->view_y0 = save_top;
- gport->view_width = save_view_width;
- gport->view_height = save_view_height;
+ gport->view.x0 = save_left;
+ gport->view.y0 = save_top;
+ gport->view.width = save_view_width;
+ gport->view.height = save_view_height;
return pixmap;
}
diff --git a/src/hid/gtk/gtkhid-gl.c b/src/hid/gtk/gtkhid-gl.c
index 8c1e8a2..ea8dd40 100644
--- a/src/hid/gtk/gtkhid-gl.c
+++ b/src/hid/gtk/gtkhid-gl.c
@@ -538,7 +538,7 @@ ghid_draw_line (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
{
USE_GC (gc);
- hidgl_draw_line (gc->cap, gc->width, x1, y1, x2, y2, gport->zoom);
+ hidgl_draw_line (gc->cap, gc->width, x1, y1, x2, y2, gport->view.coord_per_px);
}
void
@@ -548,7 +548,7 @@ ghid_draw_arc (hidGC gc, Coord cx, Coord cy, Coord xradius, Coord yradius,
USE_GC (gc);
hidgl_draw_arc (gc->width, cx, cy, xradius, yradius,
- start_angle, delta_angle, gport->zoom);
+ start_angle, delta_angle, gport->view.coord_per_px);
}
void
@@ -565,7 +565,7 @@ ghid_fill_circle (hidGC gc, Coord cx, Coord cy, Coord radius)
{
USE_GC (gc);
- hidgl_fill_circle (cx, cy, radius, gport->zoom);
+ hidgl_fill_circle (cx, cy, radius, gport->view.coord_per_px);
}
@@ -582,7 +582,7 @@ ghid_fill_pcb_polygon (hidGC gc, PolygonType *poly, const BoxType *clip_box)
{
USE_GC (gc);
- hidgl_fill_pcb_polygon (poly, clip_box, gport->zoom);
+ hidgl_fill_pcb_polygon (poly, clip_box, gport->view.coord_per_px);
}
void
@@ -745,8 +745,8 @@ ghid_show_crosshair (gboolean paint_new_location)
{
gint x, y, z;
gboolean draw_markers;
- int vcw = VCW * gport->zoom;
- int vcd = VCD * gport->zoom;
+ int vcw = VCW * gport->view.coord_per_px;
+ int vcd = VCD * gport->view.coord_per_px;
static int done_once = 0;
static GdkColor cross_color;
@@ -783,25 +783,25 @@ ghid_show_crosshair (gboolean paint_new_location)
if (x >= 0 && paint_new_location && draw_markers)
{
glBegin (GL_QUADS);
- glVertex3i (SIDE_X (gport->view_x0), y - vcd, z);
- glVertex3i (SIDE_X (gport->view_x0), y - vcd + vcw, z);
- glVertex3i (SIDE_X (gport->view_x0 + vcd), y - vcd + vcw, z);
- glVertex3i (SIDE_X (gport->view_x0 + vcd), y - vcd, z);
-
- glVertex3i (SIDE_X (gport->view_x0 + gport->view_width), y - vcd, z);
- glVertex3i (SIDE_X (gport->view_x0 + gport->view_width), y - vcd + vcw, z);
- glVertex3i (SIDE_X (gport->view_x0 + gport->view_width - vcd), y - vcd + vcw, z);
- glVertex3i (SIDE_X (gport->view_x0 + gport->view_width - vcd), y - vcd, z);
-
- glVertex3i (x - vcd, SIDE_Y (gport->view_y0), z);
- glVertex3i (x - vcd, SIDE_Y (gport->view_y0 + vcd), z);
- glVertex3i (x - vcd + vcw, SIDE_Y (gport->view_y0 + vcd), z);
- glVertex3i (x - vcd + vcw, SIDE_Y (gport->view_y0), z);
-
- glVertex3i (x - vcd, SIDE_Y (gport->view_y0 + gport->view_height - vcd), z);
- glVertex3i (x - vcd, SIDE_Y (gport->view_y0 + gport->view_height), z);
- glVertex3i (x - vcd + vcw, SIDE_Y (gport->view_y0 + gport->view_height), z);
- glVertex3i (x - vcd + vcw, SIDE_Y (gport->view_y0 + gport->view_height - vcd), z);
+ glVertex3i (SIDE_X (gport->view.x0), y - vcd, z);
+ glVertex3i (SIDE_X (gport->view.x0), y - vcd + vcw, z);
+ glVertex3i (SIDE_X (gport->view.x0 + vcd), y - vcd + vcw, z);
+ glVertex3i (SIDE_X (gport->view.x0 + vcd), y - vcd, z);
+
+ glVertex3i (SIDE_X (gport->view.x0 + gport->view.width), y - vcd, z);
+ glVertex3i (SIDE_X (gport->view.x0 + gport->view.width), y - vcd + vcw, z);
+ glVertex3i (SIDE_X (gport->view.x0 + gport->view.width - vcd), y - vcd + vcw, z);
+ glVertex3i (SIDE_X (gport->view.x0 + gport->view.width - vcd), y - vcd, z);
+
+ glVertex3i (x - vcd, SIDE_Y (gport->view.y0), z);
+ glVertex3i (x - vcd, SIDE_Y (gport->view.y0 + vcd), z);
+ glVertex3i (x - vcd + vcw, SIDE_Y (gport->view.y0 + vcd), z);
+ glVertex3i (x - vcd + vcw, SIDE_Y (gport->view.y0), z);
+
+ glVertex3i (x - vcd, SIDE_Y (gport->view.y0 + gport->view.height - vcd), z);
+ glVertex3i (x - vcd, SIDE_Y (gport->view.y0 + gport->view.height), z);
+ glVertex3i (x - vcd + vcw, SIDE_Y (gport->view.y0 + gport->view.height), z);
+ glVertex3i (x - vcd + vcw, SIDE_Y (gport->view.y0 + gport->view.height - vcd), z);
glEnd ();
}
@@ -933,13 +933,13 @@ ghid_drawing_area_expose_cb (GtkWidget *widget,
glLoadIdentity ();
glTranslatef (0.0f, 0.0f, -Z_NEAR);
- glScalef ((ghid_flip_x ? -1. : 1.) / port->zoom,
- (ghid_flip_y ? -1. : 1.) / port->zoom,
- ((ghid_flip_x == ghid_flip_y) ? 1. : -1.) / port->zoom);
- glTranslatef (ghid_flip_x ? port->view_x0 - PCB->MaxWidth :
- -port->view_x0,
- ghid_flip_y ? port->view_y0 - PCB->MaxHeight :
- -port->view_y0, 0);
+ glScalef ((port->view.flip_x ? -1. : 1.) / port->view.coord_per_px,
+ (port->view.flip_y ? -1. : 1.) / port->view.coord_per_px,
+ ((port->view.flip_x == port->view.flip_y) ? 1. : -1.) / port->view.coord_per_px);
+ glTranslatef (port->view.flip_x ? port->view.x0 - PCB->MaxWidth :
+ -port->view.x0,
+ port->view.flip_y ? port->view.y0 - PCB->MaxHeight :
+ -port->view.y0, 0);
glEnable (GL_STENCIL_TEST);
glClearColor (port->offlimits_color.red / 65535.,
@@ -1035,13 +1035,13 @@ ghid_pinout_preview_expose (GtkWidget *widget,
int save_view_width, save_view_height;
double xz, yz;
- save_zoom = gport->zoom;
+ save_zoom = gport->view.coord_per_px;
save_width = gport->width;
save_height = gport->height;
- save_left = gport->view_x0;
- save_top = gport->view_y0;
- save_view_width = gport->view_width;
- save_view_height = gport->view_height;
+ save_left = gport->view.x0;
+ save_top = gport->view.y0;
+ save_view_width = gport->view.width;
+ save_view_height = gport->view.height;
/* Setup zoom factor for drawing routines */
@@ -1049,16 +1049,16 @@ ghid_pinout_preview_expose (GtkWidget *widget,
xz = (double) pinout->x_max / da_w;
yz = (double) pinout->y_max / da_h;
if (xz > yz)
- gport->zoom = xz;
+ gport->view.coord_per_px = xz;
else
- gport->zoom = yz;
+ gport->view.coord_per_px = yz;
gport->width = da_w;
gport->height = da_h;
- gport->view_width = da_w * gport->zoom;
- gport->view_height = da_h * gport->zoom;
- gport->view_x0 = (pinout->x_max - gport->view_width) / 2;
- gport->view_y0 = (pinout->y_max - gport->view_height) / 2;
+ gport->view.width = da_w * gport->view.coord_per_px;
+ gport->view.height = da_h * gport->view.coord_per_px;
+ gport->view.x0 = (pinout->x_max - gport->view.width) / 2;
+ gport->view.y0 = (pinout->y_max - gport->view.height) / 2;
/* make GL-context "current" */
if (!gdk_gl_drawable_gl_begin (pGlDrawable, pGlContext)) {
@@ -1097,12 +1097,12 @@ ghid_pinout_preview_expose (GtkWidget *widget,
hidgl_init_triangle_array (&buffer);
ghid_invalidate_current_gc ();
glPushMatrix ();
- glScalef ((ghid_flip_x ? -1. : 1.) / gport->zoom,
- (ghid_flip_y ? -1. : 1.) / gport->zoom, 1);
- glTranslatef (ghid_flip_x ? gport->view_x0 - PCB->MaxWidth :
- -gport->view_x0,
- ghid_flip_y ? gport->view_y0 - PCB->MaxHeight :
- -gport->view_y0, 0);
+ glScalef ((gport->view.flip_x ? -1. : 1.) / gport->view.coord_per_px,
+ (gport->view.flip_y ? -1. : 1.) / gport->view.coord_per_px, 1);
+ glTranslatef (gport->view.flip_x ? gport->view.x0 - PCB->MaxWidth :
+ -gport->view.x0,
+ gport->view.flip_y ? gport->view.y0 - PCB->MaxHeight :
+ -gport->view.y0, 0);
hid_expose_callback (&ghid_hid, NULL, &pinout->element);
hidgl_flush_triangles (&buffer);
glPopMatrix ();
@@ -1116,13 +1116,13 @@ ghid_pinout_preview_expose (GtkWidget *widget,
gport->render_priv->in_context = false;
gdk_gl_drawable_gl_end (pGlDrawable);
- gport->zoom = save_zoom;
+ gport->view.coord_per_px = save_zoom;
gport->width = save_width;
gport->height = save_height;
- gport->view_x0 = save_left;
- gport->view_y0 = save_top;
- gport->view_width = save_view_width;
- gport->view_height = save_view_height;
+ gport->view.x0 = save_left;
+ gport->view.y0 = save_top;
+ gport->view.width = save_view_width;
+ gport->view.height = save_view_height;
return FALSE;
}
@@ -1142,13 +1142,13 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
int save_view_width, save_view_height;
BoxType region;
- save_zoom = gport->zoom;
+ save_zoom = gport->view.coord_per_px;
save_width = gport->width;
save_height = gport->height;
- save_left = gport->view_x0;
- save_top = gport->view_y0;
- save_view_width = gport->view_width;
- save_view_height = gport->view_height;
+ save_left = gport->view.x0;
+ save_top = gport->view.y0;
+ save_view_width = gport->view.width;
+ save_view_height = gport->view.height;
/* Setup rendering context for drawing routines
*/
@@ -1164,15 +1164,15 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
/* Setup zoom factor for drawing routines */
- gport->zoom = zoom;
+ gport->view.coord_per_px = zoom;
gport->width = width;
gport->height = height;
- gport->view_width = width * gport->zoom;
- gport->view_height = height * gport->zoom;
- gport->view_x0 = ghid_flip_x ? PCB->MaxWidth - cx : cx;
- gport->view_x0 -= gport->view_height / 2;
- gport->view_y0 = ghid_flip_y ? PCB->MaxHeight - cy : cy;
- gport->view_y0 -= gport->view_width / 2;
+ gport->view.width = width * gport->view.coord_per_px;
+ gport->view.height = height * gport->view.coord_per_px;
+ gport->view.x0 = gport->view.flip_x ? PCB->MaxWidth - cx : cx;
+ gport->view.x0 -= gport->view.height / 2;
+ gport->view.y0 = gport->view.flip_y ? PCB->MaxHeight - cy : cy;
+ gport->view.y0 -= gport->view.width / 2;
/* make GL-context "current" */
if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext)) {
@@ -1208,12 +1208,12 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
hidgl_init_triangle_array (&buffer);
ghid_invalidate_current_gc ();
glPushMatrix ();
- glScalef ((ghid_flip_x ? -1. : 1.) / gport->zoom,
- (ghid_flip_y ? -1. : 1.) / gport->zoom, 1);
- glTranslatef (ghid_flip_x ? gport->view_x0 - PCB->MaxWidth :
- -gport->view_x0,
- ghid_flip_y ? gport->view_y0 - PCB->MaxHeight :
- -gport->view_y0, 0);
+ glScalef ((gport->view.flip_x ? -1. : 1.) / gport->view.coord_per_px,
+ (gport->view.flip_y ? -1. : 1.) / gport->view.coord_per_px, 1);
+ glTranslatef (gport->view.flip_x ? gport->view.x0 - PCB->MaxWidth :
+ -gport->view.x0,
+ gport->view.flip_y ? gport->view.y0 - PCB->MaxHeight :
+ -gport->view.y0, 0);
region.X1 = MIN(Px(0), Px(gport->width + 1));
region.Y1 = MIN(Py(0), Py(gport->height + 1));
@@ -1240,13 +1240,13 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
g_object_unref (glconfig);
g_object_unref (glcontext);
- gport->zoom = save_zoom;
+ gport->view.coord_per_px = save_zoom;
gport->width = save_width;
gport->height = save_height;
- gport->view_x0 = save_left;
- gport->view_y0 = save_top;
- gport->view_width = save_view_width;
- gport->view_height = save_view_height;
+ gport->view.x0 = save_left;
+ gport->view.y0 = save_top;
+ gport->view.width = save_view_width;
+ gport->view.height = save_view_height;
return pixmap;
}
@@ -1275,13 +1275,13 @@ ghid_request_debug_draw (void)
glDisable (GL_STENCIL_TEST);
glPushMatrix ();
- glScalef ((ghid_flip_x ? -1. : 1.) / port->zoom,
- (ghid_flip_y ? -1. : 1.) / port->zoom,
- (ghid_flip_x == ghid_flip_y) ? 1. : -1.);
- glTranslatef (ghid_flip_x ? port->view_x0 - PCB->MaxWidth :
- -port->view_x0,
- ghid_flip_y ? port->view_y0 - PCB->MaxHeight :
- -port->view_y0, 0);
+ glScalef ((port->view.flip_x ? -1. : 1.) / port->view.coord_per_px,
+ (port->view.flip_y ? -1. : 1.) / port->view.coord_per_px,
+ (port->view.flip_x == port->view.flip_y) ? 1. : -1.);
+ glTranslatef (port->view.flip_x ? port->view.x0 - PCB->MaxWidth :
+ -port->view.x0,
+ port->view.flip_y ? port->view.y0 - PCB->MaxHeight :
+ -port->view.y0, 0);
return &ghid_hid;
}
@@ -1364,7 +1364,7 @@ draw_lead_user (render_priv *priv)
/* Draw an arc at radius */
hidgl_draw_arc (width, priv->lead_user_x, priv->lead_user_y,
- radius, radius, 0, 360, gport->zoom);
+ radius, radius, 0, 360, gport->view.coord_per_px);
}
hidgl_flush_triangles (&buffer);
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index b1af557..0c9019d 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -30,8 +30,6 @@
RCSID ("$Id$");
-bool ghid_flip_x = false, ghid_flip_y = false;
-
static void
pan_common (GHidPort *port)
{
@@ -42,10 +40,10 @@ pan_common (GHidPort *port)
ghid_pcb_to_event_coords (gport->pcb_x, gport->pcb_y, &event_x, &event_y);
/* Don't pan so far the board is completely off the screen */
- port->view_x0 = MAX (-port->view_width, port->view_x0);
- port->view_y0 = MAX (-port->view_height, port->view_y0);
- port->view_x0 = MIN ( port->view_x0, PCB->MaxWidth);
- port->view_y0 = MIN ( port->view_y0, PCB->MaxHeight);
+ port->view.x0 = MAX (-port->view.width, port->view.x0);
+ port->view.y0 = MAX (-port->view.height, port->view.y0);
+ port->view.x0 = MIN ( port->view.x0, PCB->MaxWidth);
+ port->view.y0 = MIN ( port->view.y0, PCB->MaxHeight);
/* Fix up noted event coordinates to match where we clamped. Alternatively
* we could call ghid_note_event_location (NULL); to get a new pointer
@@ -54,8 +52,8 @@ pan_common (GHidPort *port)
ghid_event_to_pcb_coords (event_x, event_y, &gport->pcb_x, &gport->pcb_y);
ghidgui->adjustment_changed_holdoff = TRUE;
- gtk_range_set_value (GTK_RANGE (ghidgui->h_range), gport->view_x0);
- gtk_range_set_value (GTK_RANGE (ghidgui->v_range), gport->view_y0);
+ gtk_range_set_value (GTK_RANGE (ghidgui->h_range), gport->view.x0);
+ gtk_range_set_value (GTK_RANGE (ghidgui->v_range), gport->view.y0);
ghidgui->adjustment_changed_holdoff = FALSE;
ghid_port_ranges_changed();
@@ -64,8 +62,8 @@ pan_common (GHidPort *port)
static void
ghid_pan_view_abs (Coord pcb_x, Coord pcb_y, int widget_x, int widget_y)
{
- gport->view_x0 = SIDE_X (pcb_x) - widget_x * gport->zoom;
- gport->view_y0 = SIDE_Y (pcb_y) - widget_y * gport->zoom;
+ gport->view.x0 = SIDE_X (pcb_x) - widget_x * gport->view.coord_per_px;
+ gport->view.y0 = SIDE_Y (pcb_y) - widget_y * gport->view.coord_per_px;
pan_common (gport);
}
@@ -73,14 +71,14 @@ ghid_pan_view_abs (Coord pcb_x, Coord pcb_y, int widget_x, int widget_y)
void
ghid_pan_view_rel (Coord dx, Coord dy)
{
- gport->view_x0 += dx;
- gport->view_y0 += dy;
+ gport->view.x0 += dx;
+ gport->view.y0 += dy;
pan_common (gport);
}
-/* gport->zoom:
+/* gport->view.coord_per_px:
* zoom value is PCB units per screen pixel. Larger numbers mean zooming
* out - the largest value means you are looking at the whole board.
*
@@ -103,18 +101,18 @@ ghid_zoom_view_abs (Coord center_x, Coord center_y, double new_zoom)
PCB->MaxHeight / gport->height) * ALLOW_ZOOM_OUT_BY;
new_zoom = MIN (MAX (min_zoom, new_zoom), max_zoom);
- if (gport->zoom == new_zoom)
+ if (gport->view.coord_per_px == new_zoom)
return;
- xtmp = (SIDE_X (center_x) - gport->view_x0) / (double)gport->view_width;
- ytmp = (SIDE_Y (center_y) - gport->view_y0) / (double)gport->view_height;
+ xtmp = (SIDE_X (center_x) - gport->view.x0) / (double)gport->view.width;
+ ytmp = (SIDE_Y (center_y) - gport->view.y0) / (double)gport->view.height;
- gport->zoom = new_zoom;
+ gport->view.coord_per_px = new_zoom;
pixel_slop = new_zoom;
ghid_port_ranges_scale ();
- gport->view_x0 = SIDE_X (center_x) - xtmp * gport->view_width;
- gport->view_y0 = SIDE_Y (center_y) - ytmp * gport->view_height;
+ gport->view.x0 = SIDE_X (center_x) - xtmp * gport->view.width;
+ gport->view.y0 = SIDE_Y (center_y) - ytmp * gport->view.height;
pan_common (gport);
@@ -124,7 +122,7 @@ ghid_zoom_view_abs (Coord center_x, Coord center_y, double new_zoom)
static void
ghid_zoom_view_rel (Coord center_x, Coord center_y, double factor)
{
- ghid_zoom_view_abs (center_x, center_y, gport->zoom * factor);
+ ghid_zoom_view_abs (center_x, center_y, gport->view.coord_per_px * factor);
}
static void
@@ -143,8 +141,8 @@ ghid_flip_view (Coord center_x, Coord center_y, bool flip_x, bool flip_y)
/* Work out where on the screen the flip point is */
ghid_pcb_to_event_coords (center_x, center_y, &widget_x, &widget_y);
- ghid_flip_x = ghid_flip_x != flip_x;
- ghid_flip_y = ghid_flip_y != flip_y;
+ gport->view.flip_x = gport->view.flip_x != flip_x;
+ gport->view.flip_y = gport->view.flip_y != flip_y;
/* Pan the board so the center location remains in the same place */
ghid_pan_view_abs (center_x, center_y, widget_x, widget_y);
@@ -1653,13 +1651,13 @@ CursorAction(int argc, char **argv, Coord x, Coord y)
{
UnitList extra_units_x = {
{ "grid", PCB->Grid, 0 },
- { "view", gport->view_width, UNIT_PERCENT },
+ { "view", gport->view.width, UNIT_PERCENT },
{ "board", PCB->MaxWidth, UNIT_PERCENT },
{ "", 0, 0 }
};
UnitList extra_units_y = {
{ "grid", PCB->Grid, 0 },
- { "view", gport->view_height, UNIT_PERCENT },
+ { "view", gport->view.height, UNIT_PERCENT },
{ "board", PCB->MaxHeight, UNIT_PERCENT },
{ "", 0, 0 }
};
@@ -1677,10 +1675,10 @@ CursorAction(int argc, char **argv, Coord x, Coord y)
AFAIL (cursor);
dx = GetValueEx (argv[1], argv[3], NULL, extra_units_x, "");
- if (ghid_flip_x)
+ if (gport->view.flip_x)
dx = -dx;
dy = GetValueEx (argv[2], argv[3], NULL, extra_units_y, "");
- if (!ghid_flip_y)
+ if (!gport->view.flip_y)
dy = -dy;
EventMoveCrosshair (Crosshair.X + dx, Crosshair.Y + dy);
@@ -1848,13 +1846,13 @@ ScrollAction (int argc, char **argv, Coord x, Coord y)
div = atoi(argv[1]);
if (strcasecmp (argv[0], "up") == 0)
- dy = -gport->view_height / div;
+ dy = -gport->view.height / div;
else if (strcasecmp (argv[0], "down") == 0)
- dy = gport->view_height / div;
+ dy = gport->view.height / div;
else if (strcasecmp (argv[0], "right") == 0)
- dx = gport->view_width / div;
+ dx = gport->view.width / div;
else if (strcasecmp (argv[0], "left") == 0)
- dx = -gport->view_width / div;
+ dx = -gport->view.width / div;
else
AFAIL (scroll);
@@ -2064,19 +2062,20 @@ REGISTER_ACTIONS (ghid_main_action_list)
static int
flag_flipx (int x)
-{
- return ghid_flip_x;
-}
-static int
+{
+ return gport->view.flip_x;
+}
+
+static int
flag_flipy (int x)
-{
- return ghid_flip_y;
-}
+{
+ return gport->view.flip_y;
+}
HID_Flag ghid_main_flag_list[] = {
{"flip_x", flag_flipx, 0},
{"flip_y", flag_flipy, 0}
-};
+};
REGISTER_FLAGS (ghid_main_flag_list)
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index 81dcd45..5929a37 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -60,8 +60,8 @@ ghid_port_ranges_changed (void)
h_adj = gtk_range_get_adjustment (GTK_RANGE (ghidgui->h_range));
v_adj = gtk_range_get_adjustment (GTK_RANGE (ghidgui->v_range));
- gport->view_x0 = h_adj->value;
- gport->view_y0 = v_adj->value;
+ gport->view.x0 = h_adj->value;
+ gport->view.y0 = v_adj->value;
ghid_invalidate_all ();
}
@@ -78,21 +78,21 @@ ghid_port_ranges_scale (void)
| drawing area size in pixels to PCB units and that will be
| the page size for the Gtk adjustment.
*/
- gport->view_width = gport->width * gport->zoom;
- gport->view_height = gport->height * gport->zoom;
+ gport->view.width = gport->width * gport->view.coord_per_px;
+ gport->view.height = gport->height * gport->view.coord_per_px;
adj = gtk_range_get_adjustment (GTK_RANGE (ghidgui->h_range));
- adj->page_size = MIN (gport->view_width, PCB->MaxWidth);
+ adj->page_size = MIN (gport->view.width, PCB->MaxWidth);
adj->page_increment = adj->page_size / 10.0;
adj->step_increment = adj->page_size / 100.0;
- adj->lower = -gport->view_width;
+ adj->lower = -gport->view.width;
adj->upper = PCB->MaxWidth + adj->page_size;
adj = gtk_range_get_adjustment (GTK_RANGE (ghidgui->v_range));
- adj->page_size = MIN (gport->view_height, PCB->MaxHeight);
+ adj->page_size = MIN (gport->view.height, PCB->MaxHeight);
adj->page_increment = adj->page_size / 10.0;
adj->step_increment = adj->page_size / 100.0;
- adj->lower = -gport->view_height;
+ adj->lower = -gport->view.height;
adj->upper = PCB->MaxHeight + adj->page_size;
}
@@ -547,8 +547,8 @@ ghid_port_window_motion_cb (GtkWidget * widget,
if (out->panning)
{
- dx = gport->zoom * (x_prev - ev->x);
- dy = gport->zoom * (y_prev - ev->y);
+ dx = gport->view.coord_per_px * (x_prev - ev->x);
+ dy = gport->view.coord_per_px * (y_prev - ev->y);
if (x_prev > 0)
ghid_pan_view_rel (dx, dy);
x_prev = ev->x;
@@ -604,8 +604,8 @@ ghid_pan_idle_cb (gpointer data)
if (gport->has_entered)
return FALSE;
- dy = gport->zoom * y_pan_speed;
- dx = gport->zoom * x_pan_speed;
+ dy = gport->view.coord_per_px * y_pan_speed;
+ dx = gport->view.coord_per_px * x_pan_speed;
ghid_pan_view_rel (dx, dy);
return TRUE;
}
@@ -639,8 +639,8 @@ ghid_port_window_leave_cb (GtkWidget * widget,
/* GdkEvent coords are set to 0,0 at leave events, so must figure
| out edge the cursor left.
*/
- w = ghid_port.width * gport->zoom;
- h = ghid_port.height * gport->zoom;
+ w = ghid_port.width * out->view.coord_per_px;
+ h = ghid_port.height * out->view.coord_per_px;
x0 = EVENT_TO_PCB_X (0);
y0 = EVENT_TO_PCB_Y (0);
@@ -648,9 +648,9 @@ ghid_port_window_leave_cb (GtkWidget * widget,
x -= x0;
y -= y0;
- if (ghid_flip_x )
+ if (gport->view.flip_x)
x = -x;
- if (ghid_flip_y )
+ if (gport->view.flip_y)
y = -y;
dx = w - x;
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index f8674e6..e2beb3c 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -1986,7 +1986,7 @@ ghid_parse_arguments (int *argc, char ***argv)
gtk_init (argc, argv);
gport = &ghid_port;
- gport->zoom = 300.0;
+ gport->view.coord_per_px = 300.0;
pixel_slop = 300;
ghid_init_renderer (argc, argv, gport);
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index c3f00a3..ad2a112 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -62,15 +62,14 @@
#define FROM_PCB_UNITS(v) coord_to_unit (Settings.grid_unit, v)
#define TO_PCB_UNITS(v) unit_to_coord (Settings.grid_unit, v)
-extern bool ghid_flip_x, ghid_flip_y;
-#define SIDE_X(x) ((ghid_flip_x ? PCB->MaxWidth - (x) : (x)))
-#define SIDE_Y(y) ((ghid_flip_y ? PCB->MaxHeight - (y) : (y)))
+#define SIDE_X(x) ((gport->view.flip_x ? PCB->MaxWidth - (x) : (x)))
+#define SIDE_Y(y) ((gport->view.flip_y ? PCB->MaxHeight - (y) : (y)))
-#define DRAW_X(x) (gint)((SIDE_X(x) - gport->view_x0) / gport->zoom)
-#define DRAW_Y(y) (gint)((SIDE_Y(y) - gport->view_y0) / gport->zoom)
+#define DRAW_X(x) (gint)((SIDE_X(x) - gport->view.x0) / gport->view.coord_per_px)
+#define DRAW_Y(y) (gint)((SIDE_Y(y) - gport->view.y0) / gport->view.coord_per_px)
-#define EVENT_TO_PCB_X(x) SIDE_X((gint)((x) * gport->zoom + gport->view_x0))
-#define EVENT_TO_PCB_Y(y) SIDE_Y((gint)((y) * gport->zoom + gport->view_y0))
+#define EVENT_TO_PCB_X(x) SIDE_X((gint)((x) * gport->view.coord_per_px + gport->view.x0))
+#define EVENT_TO_PCB_Y(y) SIDE_Y((gint)((y) * gport->view.coord_per_px + gport->view.y0))
/*
* Used to intercept "special" hotkeys that gtk doesn't usually pass
@@ -145,6 +144,19 @@ GhidGui;
extern GhidGui _ghidgui, *ghidgui;
+typedef struct
+{
+ double coord_per_px; /* Zoom level described as PCB units per screen pixel */
+
+ Coord x0;
+ Coord y0;
+ Coord width;
+ Coord height;
+
+ bool flip_x;
+ bool flip_y;
+
+} view_data;
/* The output viewport
*/
@@ -168,15 +180,9 @@ typedef struct
gboolean has_entered;
gboolean panning;
-/* zoom value is PCB units per screen pixel. Larger numbers mean zooming
-| out - the largest value means you are looking at the whole board.
-*/
- gdouble zoom; /* PCB units per screen pixel. Larger */
- /* numbers mean zooming out. */
- /* Viewport in PCB coordinates */
- Coord view_x0, view_y0, view_width, view_height;
- Coord pcb_x, pcb_y;
- Coord crosshair_x, crosshair_y;
+ view_data view;
+ Coord pcb_x, pcb_y; /* PCB coordinates of the mouse pointer */
+ Coord crosshair_x, crosshair_y; /* PCB coordinates of the crosshair */
}
GHidPort;
@@ -520,10 +526,10 @@ static inline int
Vx (Coord x)
{
int rv;
- if (ghid_flip_x)
- rv = (PCB->MaxWidth - x - gport->view_x0) / gport->zoom + 0.5;
+ if (gport->view.flip_x)
+ rv = (PCB->MaxWidth - x - gport->view.x0) / gport->view.coord_per_px + 0.5;
else
- rv = (x - gport->view_x0) / gport->zoom + 0.5;
+ rv = (x - gport->view.x0) / gport->view.coord_per_px + 0.5;
return rv;
}
@@ -531,41 +537,41 @@ static inline int
Vy (Coord y)
{
int rv;
- if (ghid_flip_y)
- rv = (PCB->MaxHeight - y - gport->view_y0) / gport->zoom + 0.5;
+ if (gport->view.flip_y)
+ rv = (PCB->MaxHeight - y - gport->view.y0) / gport->view.coord_per_px + 0.5;
else
- rv = (y - gport->view_y0) / gport->zoom + 0.5;
+ rv = (y - gport->view.y0) / gport->view.coord_per_px + 0.5;
return rv;
}
static inline int
Vz (Coord z)
{
- return z / gport->zoom + 0.5;
+ return z / gport->view.coord_per_px + 0.5;
}
static inline Coord
Px (int x)
{
- Coord rv = x * gport->zoom + gport->view_x0;
- if (ghid_flip_x)
- rv = PCB->MaxWidth - (x * gport->zoom + gport->view_x0);
+ Coord rv = x * gport->view.coord_per_px + gport->view.x0;
+ if (gport->view.flip_x)
+ rv = PCB->MaxWidth - (x * gport->view.coord_per_px + gport->view.x0);
return rv;
}
static inline Coord
Py (int y)
{
- Coord rv = y * gport->zoom + gport->view_y0;
- if (ghid_flip_y)
- rv = PCB->MaxHeight - (y * gport->zoom + gport->view_y0);
+ Coord rv = y * gport->view.coord_per_px + gport->view.y0;
+ if (gport->view.flip_y)
+ rv = PCB->MaxHeight - (y * gport->view.coord_per_px + gport->view.y0);
return rv;
}
static inline Coord
Pz (int z)
{
- return (z * gport->zoom);
+ return (z * gport->view.coord_per_px);
}
#endif /* PCB_HID_GTK_GHID_H */
|