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-09-05 14:29:46
|
The branch, master has been updated
via 9ad2e6ef8da1118911462daf29778dbaf5216312 (commit)
from 718b9c34a4c2e4070436cf8abf756f22c5c74cec (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-drc-window.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
=================
Commit Messages
=================
commit 9ad2e6ef8da1118911462daf29778dbaf5216312
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use gtk_widget_get_style() accessor, rather than direct access
In GTK3.0, direct access to widget->style will be impossible.
Swap out the GTK_WIDGET_STATE() macro for gtk_widget_get_state(), which
does not directly access the GSeal'd member widget->state.
:100644 100644 e7f5c46... 4ab38b1... M src/hid/gtk/gui-drc-window.c
=========
Changes
=========
commit 9ad2e6ef8da1118911462daf29778dbaf5216312
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use gtk_widget_get_style() accessor, rather than direct access
In GTK3.0, direct access to widget->style will be impossible.
Swap out the GTK_WIDGET_STATE() macro for gtk_widget_get_state(), which
does not directly access the GSeal'd member widget->state.
diff --git a/src/hid/gtk/gui-drc-window.c b/src/hid/gtk/gui-drc-window.c
index e7f5c46..4ab38b1 100644
--- a/src/hid/gtk/gui-drc-window.c
+++ b/src/hid/gtk/gui-drc-window.c
@@ -719,6 +719,7 @@ ghid_violation_renderer_render (GtkCellRenderer *cell,
GtkCellRendererState flags)
{
GdkDrawable *mydrawable;
+ GtkStyle *style = gtk_widget_get_style (widget);
GhidViolationRenderer *renderer = GHID_VIOLATION_RENDERER (cell);
GhidDrcViolation *violation = renderer->violation;
int pixmap_size = VIOLATION_PIXMAP_PIXEL_SIZE - 2 * VIOLATION_PIXMAP_PIXEL_BORDER;
@@ -751,7 +752,7 @@ ghid_violation_renderer_render (GtkCellRenderer *cell,
mydrawable = GDK_DRAWABLE (violation->pixmap);
- gdk_draw_drawable (window, widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+ gdk_draw_drawable (window, style->fg_gc[gtk_widget_get_state (widget)],
mydrawable, 0, 0,
cell_area->x + cell_area->width + VIOLATION_PIXMAP_PIXEL_BORDER,
cell_area->y + VIOLATION_PIXMAP_PIXEL_BORDER, -1, -1);
|
|
From: <gi...@gp...> - 2011-09-05 14:06:20
|
The branch, master has been updated
via 718b9c34a4c2e4070436cf8abf756f22c5c74cec (commit)
from ce34fefde11f0b617e1291b27a65aeebe6d3bf6d (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 | 84 +++++++++++++++++++++-----------------
src/hid/gtk/gtkhid-main.c | 18 +++++---
src/hid/gtk/gui-misc.c | 3 +-
src/hid/gtk/gui-output-events.c | 4 +-
src/hid/gtk/gui-pinout-preview.c | 3 +-
src/hid/gtk/gui-top-window.c | 17 +++++---
src/hid/gtk/gui-utils.c | 9 +++-
7 files changed, 81 insertions(+), 57 deletions(-)
=================
Commit Messages
=================
commit 718b9c34a4c2e4070436cf8abf756f22c5c74cec
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use gtk_widget_get_window() accessor
In GTK3.0, direct access to widget->window will be impossible.
:100644 100644 f0ce1ab... 85fd1d6... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 1eed303... 6df553e... M src/hid/gtk/gtkhid-main.c
:100644 100644 dbed88e... 0f8daf7... M src/hid/gtk/gui-misc.c
:100644 100644 b9c5ab3... 22dd54e... M src/hid/gtk/gui-output-events.c
:100644 100644 88576a1... c4bef20... M src/hid/gtk/gui-pinout-preview.c
:100644 100644 f57dd5c... 9c22ea2... M src/hid/gtk/gui-top-window.c
:100644 100644 e9008c6... db61f77... M src/hid/gtk/gui-utils.c
=========
Changes
=========
commit 718b9c34a4c2e4070436cf8abf756f22c5c74cec
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use gtk_widget_get_window() accessor
In GTK3.0, direct access to widget->window will be impossible.
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index f0ce1ab..85fd1d6 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -487,6 +487,7 @@ static int
use_gc (hidGC gc)
{
render_priv *priv = gport->render_priv;
+ GdkWindow *window = gtk_widget_get_window (gport->top_window);
if (gc->me_pointer != &ghid_hid)
{
@@ -498,7 +499,7 @@ use_gc (hidGC gc)
return 0;
if (!gc->gc)
{
- gc->gc = gdk_gc_new (gport->top_window->window);
+ gc->gc = gdk_gc_new (window);
ghid_set_color (gc, gc->colorname);
ghid_set_line_width (gc, gc->width);
ghid_set_line_cap (gc, (EndCapStyle)gc->cap);
@@ -922,13 +923,16 @@ ghid_notify_mark_change (bool changes_complete)
static void
draw_right_cross (GdkGC *xor_gc, gint x, gint y)
{
- gdk_draw_line (gport->drawing_area->window, xor_gc, x, 0, x, gport->height);
- gdk_draw_line (gport->drawing_area->window, xor_gc, 0, y, gport->width, y);
+ GdkWindow *window = gtk_widget_get_window (gport->drawing_area);
+
+ gdk_draw_line (window, xor_gc, x, 0, x, gport->height);
+ gdk_draw_line (window, xor_gc, 0, y, gport->width, y);
}
static void
draw_slanted_cross (GdkGC *xor_gc, gint x, gint y)
{
+ GdkWindow *window = gtk_widget_get_window (gport->drawing_area);
gint x0, y0, x1, y1;
x0 = x + (gport->height - y);
@@ -939,7 +943,7 @@ draw_slanted_cross (GdkGC *xor_gc, gint x, gint y)
y0 = MAX(0, MIN (y0, gport->height));
y1 = y - x;
y1 = MAX(0, MIN (y1, gport->height));
- gdk_draw_line (gport->drawing_area->window, xor_gc, x0, y0, x1, y1);
+ gdk_draw_line (window, xor_gc, x0, y0, x1, y1);
x0 = x - (gport->height - y);
x0 = MAX(0, MIN (x0, gport->width));
@@ -949,12 +953,13 @@ draw_slanted_cross (GdkGC *xor_gc, gint x, gint y)
y0 = MAX(0, MIN (y0, gport->height));
y1 = y - (gport->width - x);
y1 = MAX(0, MIN (y1, gport->height));
- gdk_draw_line (gport->drawing_area->window, xor_gc, x0, y0, x1, y1);
+ gdk_draw_line (window, xor_gc, x0, y0, x1, y1);
}
static void
draw_dozen_cross (GdkGC *xor_gc, gint x, gint y)
{
+ GdkWindow *window = gtk_widget_get_window (gport->drawing_area);
gint x0, y0, x1, y1;
gdouble tan60 = sqrt (3);
@@ -966,7 +971,7 @@ draw_dozen_cross (GdkGC *xor_gc, gint x, gint y)
y0 = MAX(0, MIN (y0, gport->height));
y1 = y - x * tan60;
y1 = MAX(0, MIN (y1, gport->height));
- gdk_draw_line (gport->drawing_area->window, xor_gc, x0, y0, x1, y1);
+ gdk_draw_line (window, xor_gc, x0, y0, x1, y1);
x0 = x + (gport->height - y) * tan60;
x0 = MAX(0, MIN (x0, gport->width));
@@ -976,7 +981,7 @@ draw_dozen_cross (GdkGC *xor_gc, gint x, gint y)
y0 = MAX(0, MIN (y0, gport->height));
y1 = y - x / tan60;
y1 = MAX(0, MIN (y1, gport->height));
- gdk_draw_line (gport->drawing_area->window, xor_gc, x0, y0, x1, y1);
+ gdk_draw_line (window, xor_gc, x0, y0, x1, y1);
x0 = x - (gport->height - y) / tan60;
x0 = MAX(0, MIN (x0, gport->width));
@@ -986,7 +991,7 @@ draw_dozen_cross (GdkGC *xor_gc, gint x, gint y)
y0 = MAX(0, MIN (y0, gport->height));
y1 = y - (gport->width - x) * tan60;
y1 = MAX(0, MIN (y1, gport->height));
- gdk_draw_line (gport->drawing_area->window, xor_gc, x0, y0, x1, y1);
+ gdk_draw_line (window, xor_gc, x0, y0, x1, y1);
x0 = x - (gport->height - y) * tan60;
x0 = MAX(0, MIN (x0, gport->width));
@@ -996,7 +1001,7 @@ draw_dozen_cross (GdkGC *xor_gc, gint x, gint y)
y0 = MAX(0, MIN (y0, gport->height));
y1 = y - (gport->width - x) / tan60;
y1 = MAX(0, MIN (y1, gport->height));
- gdk_draw_line (gport->drawing_area->window, xor_gc, x0, y0, x1, y1);
+ gdk_draw_line (window, xor_gc, x0, y0, x1, y1);
}
static void
@@ -1019,6 +1024,7 @@ static void
show_crosshair (gboolean paint_new_location)
{
render_priv *priv = gport->render_priv;
+ GdkWindow *window = gtk_widget_get_window (gport->drawing_area);
gint x, y;
static gint x_prev = -1, y_prev = -1;
static gboolean draw_markers, draw_markers_prev = FALSE;
@@ -1030,7 +1036,7 @@ show_crosshair (gboolean paint_new_location)
if (!xor_gc)
{
- xor_gc = gdk_gc_new (ghid_port.drawing_area->window);
+ xor_gc = gdk_gc_new (window);
gdk_gc_copy (xor_gc, ghid_port.drawing_area->style->white_gc);
gdk_gc_set_function (xor_gc, GDK_XOR);
gdk_gc_set_clip_origin (xor_gc, 0, 0);
@@ -1047,16 +1053,16 @@ show_crosshair (gboolean paint_new_location)
{
draw_crosshair (xor_gc, x_prev, y_prev);
if (draw_markers_prev)
- {
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- 0, y_prev - VCD, VCD, VCW);
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- gport->width - VCD, y_prev - VCD, VCD, VCW);
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- x_prev - VCD, 0, VCW, VCD);
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- x_prev - VCD, gport->height - VCD, VCW, VCD);
- }
+ {
+ gdk_draw_rectangle (window, xor_gc, TRUE,
+ 0, y_prev - VCD, VCD, VCW);
+ gdk_draw_rectangle (window, xor_gc, TRUE,
+ gport->width - VCD, y_prev - VCD, VCD, VCW);
+ gdk_draw_rectangle (window, xor_gc, TRUE,
+ x_prev - VCD, 0, VCW, VCD);
+ gdk_draw_rectangle (window, xor_gc, TRUE,
+ x_prev - VCD, gport->height - VCD, VCW, VCD);
+ }
}
if (x >= 0 && paint_new_location)
@@ -1064,16 +1070,16 @@ show_crosshair (gboolean paint_new_location)
draw_crosshair (xor_gc, x, y);
draw_markers = ghidgui->auto_pan_on && have_crosshair_attachments ();
if (draw_markers)
- {
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- 0, y - VCD, VCD, VCW);
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- gport->width - VCD, y - VCD, VCD, VCW);
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- x - VCD, 0, VCW, VCD);
- gdk_draw_rectangle (gport->drawing_area->window, xor_gc, TRUE,
- x - VCD, gport->height - VCD, VCW, VCD);
- }
+ {
+ gdk_draw_rectangle (window, xor_gc, TRUE,
+ 0, y - VCD, VCD, VCW);
+ gdk_draw_rectangle (window, xor_gc, TRUE,
+ gport->width - VCD, y - VCD, VCD, VCW);
+ gdk_draw_rectangle (window, xor_gc, TRUE,
+ x - VCD, 0, VCW, VCD);
+ gdk_draw_rectangle (window, xor_gc, TRUE,
+ x - VCD, gport->height - VCD, VCW, VCD);
+ }
x_prev = x;
y_prev = y;
draw_markers_prev = draw_markers;
@@ -1134,11 +1140,12 @@ void
ghid_screen_update (void)
{
render_priv *priv = gport->render_priv;
+ GdkWindow *window = gtk_widget_get_window (gport->drawing_area);
if (gport->pixmap == NULL)
return;
- gdk_draw_drawable (gport->drawing_area->window, priv->bg_gc, gport->pixmap,
+ gdk_draw_drawable (window, priv->bg_gc, gport->pixmap,
0, 0, 0, 0, gport->width, gport->height);
show_crosshair (TRUE);
}
@@ -1149,10 +1156,11 @@ ghid_drawing_area_expose_cb (GtkWidget *widget,
GHidPort *port)
{
render_priv *priv = port->render_priv;
+ GdkWindow *window = gtk_widget_get_window (gport->drawing_area);
- gdk_draw_drawable (widget->window, priv->bg_gc, port->pixmap,
- ev->area.x, ev->area.y, ev->area.x, ev->area.y,
- ev->area.width, ev->area.height);
+ gdk_draw_drawable (window, priv->bg_gc, port->pixmap,
+ ev->area.x, ev->area.y, ev->area.x, ev->area.y,
+ ev->area.width, ev->area.height);
show_crosshair (TRUE);
return FALSE;
}
@@ -1167,6 +1175,7 @@ ghid_pinout_preview_expose (GtkWidget *widget,
GdkEventExpose *ev)
{
GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW (widget);
+ GdkWindow *window = gtk_widget_get_window (widget);
GdkDrawable *save_drawable;
GtkAllocation allocation;
view_data save_view;
@@ -1189,7 +1198,7 @@ ghid_pinout_preview_expose (GtkWidget *widget,
else
gport->view.coord_per_px = yz;
- gport->drawable = widget->window;
+ gport->drawable = window;
gport->width = allocation.width;
gport->height = allocation.height;
gport->view.width = allocation.width * gport->view.coord_per_px;
@@ -1198,7 +1207,7 @@ ghid_pinout_preview_expose (GtkWidget *widget,
gport->view.y0 = (pinout->y_max - gport->view.height) / 2;
/* clear background */
- gdk_draw_rectangle (widget->window, priv->bg_gc, TRUE,
+ gdk_draw_rectangle (window, priv->bg_gc, TRUE,
0, 0, allocation.width, allocation.height);
/* call the drawing routine */
@@ -1322,6 +1331,7 @@ ghid_pcb_to_event_coords (Coord pcb_x, Coord pcb_y, int *event_x, int *event_y)
static void
draw_lead_user (render_priv *priv)
{
+ GdkWindow *window = gtk_widget_get_window (gport->drawing_area);
int i;
Coord radius = priv->lead_user_radius;
Coord width = MM_TO_COORD (LEAD_USER_WIDTH);
@@ -1334,7 +1344,7 @@ draw_lead_user (render_priv *priv)
if (lead_gc == NULL)
{
- lead_gc = gdk_gc_new (ghid_port.drawing_area->window);
+ lead_gc = gdk_gc_new (window);
gdk_gc_copy (lead_gc, ghid_port.drawing_area->style->white_gc);
gdk_gc_set_function (lead_gc, GDK_XOR);
gdk_gc_set_clip_origin (lead_gc, 0, 0);
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 1eed303..6df553e 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -261,7 +261,8 @@ ghid_shift_is_pressed ()
if( ! ghid_gui_is_up )
return 0;
- gdk_window_get_pointer (out->drawing_area->window, NULL, NULL, &mask);
+ gdk_window_get_pointer (gtk_widget_get_window (out->drawing_area),
+ NULL, NULL, &mask);
return (mask & GDK_SHIFT_MASK) ? TRUE : FALSE;
}
@@ -274,7 +275,8 @@ ghid_control_is_pressed ()
if( ! ghid_gui_is_up )
return 0;
- gdk_window_get_pointer (out->drawing_area->window, NULL, NULL, &mask);
+ gdk_window_get_pointer (gtk_widget_get_window (out->drawing_area),
+ NULL, NULL, &mask);
return (mask & GDK_CONTROL_MASK) ? TRUE : FALSE;
}
@@ -287,7 +289,8 @@ ghid_mod1_is_pressed ()
if( ! ghid_gui_is_up )
return 0;
- gdk_window_get_pointer (out->drawing_area->window, NULL, NULL, &mask);
+ gdk_window_get_pointer (gtk_widget_get_window (out->drawing_area),
+ NULL, NULL, &mask);
#ifdef __APPLE__
return (mask & ( 1 << 13 ) ) ? TRUE : FALSE; // The option key is not MOD1, although it should be...
#else
@@ -326,7 +329,8 @@ ghid_set_crosshair (int x, int y, int action)
* and gdk_display_warp_pointer work relative to the whole display, whilst
* our coordinates are relative to the drawing area origin.
*/
- gdk_window_get_origin (gport->drawing_area->window, &offset_x, &offset_y);
+ gdk_window_get_origin (gtk_widget_get_window (gport->drawing_area),
+ &offset_x, &offset_y);
display = gdk_display_get_default ();
switch (action) {
@@ -1544,7 +1548,8 @@ Benchmark (int argc, char **argv, Coord x, Coord y)
do
{
ghid_invalidate_all ();
- gdk_window_process_updates (gport->drawing_area->window, FALSE);
+ gdk_window_process_updates (gtk_widget_get_window (gport->drawing_area),
+ FALSE);
time (&end);
i++;
}
@@ -1595,7 +1600,8 @@ Center(int argc, char **argv, Coord pcb_x, Coord pcb_y)
*/
ghid_pcb_to_event_coords (pcb_x, pcb_y, &widget_x, &widget_y);
- gdk_window_get_origin (gport->drawing_area->window, &offset_x, &offset_y);
+ gdk_window_get_origin (gtk_widget_get_window (gport->drawing_area),
+ &offset_x, &offset_y);
pointer_x = offset_x + widget_x;
pointer_y = offset_y + widget_y;
diff --git a/src/hid/gtk/gui-misc.c b/src/hid/gtk/gui-misc.c
index dbed88e..0f8daf7 100644
--- a/src/hid/gtk/gui-misc.c
+++ b/src/hid/gtk/gui-misc.c
@@ -382,7 +382,8 @@ ghid_get_pointer (int *x, int *y)
{
gint xp, yp;
- gdk_window_get_pointer (gport->drawing_area->window, &xp, &yp, NULL);
+ gdk_window_get_pointer (gtk_widget_get_window (gport->drawing_area),
+ &xp, &yp, NULL);
if (x)
*x = xp;
if (y)
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index b9c5ab3..22dd54e 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -121,7 +121,7 @@ ghid_note_event_location (GdkEventButton * ev)
if (!ev)
{
- gdk_window_get_pointer (ghid_port.drawing_area->window,
+ gdk_window_get_pointer (gtk_widget_get_window (ghid_port.drawing_area),
&event_x, &event_y, NULL);
}
else
@@ -391,7 +391,7 @@ ghid_port_drawing_area_configure_event_cb (GtkWidget * widget,
if (gport->pixmap)
gdk_pixmap_unref (gport->pixmap);
- gport->pixmap = gdk_pixmap_new (widget->window,
+ gport->pixmap = gdk_pixmap_new (gtk_widget_get_window (widget),
gport->width, gport->height, -1);
gport->drawable = gport->pixmap;
diff --git a/src/hid/gtk/gui-pinout-preview.c b/src/hid/gtk/gui-pinout-preview.c
index 88576a1..c4bef20 100644
--- a/src/hid/gtk/gui-pinout-preview.c
+++ b/src/hid/gtk/gui-pinout-preview.c
@@ -197,7 +197,8 @@ ghid_pinout_preview_set_property (GObject * object, guint property_id,
case PROP_ELEMENT_DATA:
pinout_set_data (pinout, (ElementType *)g_value_get_pointer (value));
if (GTK_WIDGET_REALIZED (GTK_WIDGET (pinout)))
- gdk_window_invalidate_rect (GTK_WIDGET (pinout)->window, NULL, FALSE);
+ gdk_window_invalidate_rect (
+ gtk_widget_get_window (GTK_WIDGET (pinout)), NULL, FALSE);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index f57dd5c..9c22ea2 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -1354,7 +1354,8 @@ ghid_build_pcb_top_window (void)
gtk_widget_show_all (gport->top_window);
ghid_pack_mode_buttons ();
- gdk_window_set_back_pixmap (gport->drawing_area->window, NULL, FALSE);
+ gdk_window_set_back_pixmap (gtk_widget_get_window (gport->drawing_area),
+ NULL, FALSE);
}
@@ -1428,28 +1429,30 @@ ghid_interface_set_sensitive (gboolean sensitive)
static void
ghid_init_icons (GHidPort * port)
{
- XC_clock_source = gdk_bitmap_create_from_data (gport->top_window->window,
+ GdkWindow *window = gtk_widget_get_window (gport->top_window);
+
+ XC_clock_source = gdk_bitmap_create_from_data (window,
(char *) rotateIcon_bits,
rotateIcon_width,
rotateIcon_height);
XC_clock_mask =
- gdk_bitmap_create_from_data (gport->top_window->window, (char *) rotateMask_bits,
+ gdk_bitmap_create_from_data (window, (char *) rotateMask_bits,
rotateMask_width, rotateMask_height);
- XC_hand_source = gdk_bitmap_create_from_data (gport->top_window->window,
+ XC_hand_source = gdk_bitmap_create_from_data (window,
(char *) handIcon_bits,
handIcon_width,
handIcon_height);
XC_hand_mask =
- gdk_bitmap_create_from_data (gport->top_window->window, (char *) handMask_bits,
+ gdk_bitmap_create_from_data (window, (char *) handMask_bits,
handMask_width, handMask_height);
- XC_lock_source = gdk_bitmap_create_from_data (gport->top_window->window,
+ XC_lock_source = gdk_bitmap_create_from_data (window,
(char *) lockIcon_bits,
lockIcon_width,
lockIcon_height);
XC_lock_mask =
- gdk_bitmap_create_from_data (gport->top_window->window, (char *) lockMask_bits,
+ gdk_bitmap_create_from_data (window, (char *) lockMask_bits,
lockMask_width, lockMask_height);
}
diff --git a/src/hid/gtk/gui-utils.c b/src/hid/gtk/gui-utils.c
index e9008c6..db61f77 100644
--- a/src/hid/gtk/gui-utils.c
+++ b/src/hid/gtk/gui-utils.c
@@ -92,7 +92,8 @@ ghid_modifier_keys_state (GdkModifierType * state)
GHidPort *out = &ghid_port;
if (!state)
- gdk_window_get_pointer (out->drawing_area->window, NULL, NULL, &mask);
+ gdk_window_get_pointer (gtk_widget_get_window (out->drawing_area),
+ NULL, NULL, &mask);
else
mask = *state;
@@ -129,7 +130,8 @@ ghid_button_state (GdkModifierType * state)
GHidPort *out = &ghid_port;
if (!state)
- gdk_window_get_pointer (out->drawing_area->window, NULL, NULL, &mask);
+ gdk_window_get_pointer (gtk_widget_get_window (out->drawing_area),
+ NULL, NULL, &mask);
else
mask = *state;
@@ -152,7 +154,8 @@ ghid_button_state (GdkModifierType * state)
void
ghid_draw_area_update (GHidPort * port, GdkRectangle * rect)
{
- gdk_window_invalidate_rect (port->drawing_area->window, rect, FALSE);
+ gdk_window_invalidate_rect (gtk_widget_get_window (port->drawing_area),
+ rect, FALSE);
}
|
|
From: <gi...@gp...> - 2011-09-05 13:56:31
|
The branch, master has been updated
via ce34fefde11f0b617e1291b27a65aeebe6d3bf6d (commit)
from 0809a6ec7d32e4acec5a6fcaca8a9fd8ab63e51a (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-gl.c | 22 ++++++++++++++--------
src/hid/gtk/gui-drc-window.c | 7 +++++--
src/hid/gtk/gui-keyref-window.c | 7 +++++--
src/hid/gtk/gui-library-window.c | 7 +++++--
src/hid/gtk/gui-log-window.c | 7 +++++--
src/hid/gtk/gui-netlist-window.c | 5 ++++-
src/hid/gtk/gui-top-window.c | 11 +++++++----
7 files changed, 45 insertions(+), 21 deletions(-)
=================
Commit Messages
=================
commit ce34fefde11f0b617e1291b27a65aeebe6d3bf6d
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use gtk_widget_get_allocation() accessor
In GTK3.0, direct access to widget->allocation will be impossible.
:100644 100644 13c45b0... f5a99a9... M src/hid/gtk/gtkhid-gl.c
:100644 100644 5972467... e7f5c46... M src/hid/gtk/gui-drc-window.c
:100644 100644 801d6d7... 6eaf3eb... M src/hid/gtk/gui-keyref-window.c
:100644 100644 0339cf0... 2cda08e... M src/hid/gtk/gui-library-window.c
:100644 100644 5f6d58f... 41571e0... M src/hid/gtk/gui-log-window.c
:100644 100644 28d0ff2... e05ae57... M src/hid/gtk/gui-netlist-window.c
:100644 100644 f3e95e7... f57dd5c... M src/hid/gtk/gui-top-window.c
=========
Changes
=========
commit ce34fefde11f0b617e1291b27a65aeebe6d3bf6d
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use gtk_widget_get_allocation() accessor
In GTK3.0, direct access to widget->allocation will be impossible.
diff --git a/src/hid/gtk/gtkhid-gl.c b/src/hid/gtk/gtkhid-gl.c
index 13c45b0..f5a99a9 100644
--- a/src/hid/gtk/gtkhid-gl.c
+++ b/src/hid/gtk/gtkhid-gl.c
@@ -904,8 +904,11 @@ ghid_drawing_area_expose_cb (GtkWidget *widget,
GHidPort *port)
{
render_priv *priv = port->render_priv;
+ GtkAllocation allocation;
BoxType region;
+ gtk_widget_get_allocation (widget, &allocation);
+
ghid_start_drawing (port);
hidgl_init ();
@@ -919,16 +922,16 @@ ghid_drawing_area_expose_cb (GtkWidget *widget,
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glViewport (0, 0, widget->allocation.width, widget->allocation.height);
+ glViewport (0, 0, allocation.width, allocation.height);
glEnable (GL_SCISSOR_TEST);
glScissor (ev->area.x,
- widget->allocation.height - ev->area.height - ev->area.y,
+ allocation.height - ev->area.height - ev->area.y,
ev->area.width, ev->area.height);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
- glOrtho (0, widget->allocation.width, widget->allocation.height, 0, 0, 100);
+ glOrtho (0, allocation.width, allocation.height, 0, 0, 100);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
glTranslatef (0.0f, 0.0f, -Z_NEAR);
@@ -1063,16 +1066,16 @@ ghid_pinout_preview_expose (GtkWidget *widget,
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glViewport (0, 0, widget->allocation.width, widget->allocation.height);
+ glViewport (0, 0, allocation.width, allocation.height);
glEnable (GL_SCISSOR_TEST);
glScissor (ev->area.x,
- widget->allocation.height - ev->area.height - ev->area.y,
+ allocation.height - ev->area.height - ev->area.y,
ev->area.width, ev->area.height);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
- glOrtho (0, widget->allocation.width, widget->allocation.height, 0, 0, 100);
+ glOrtho (0, allocation.width, allocation.height, 0, 0, 100);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
glTranslatef (0.0f, 0.0f, -Z_NEAR);
@@ -1236,14 +1239,17 @@ ghid_request_debug_draw (void)
{
GHidPort *port = gport;
GtkWidget *widget = port->drawing_area;
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
ghid_start_drawing (port);
- glViewport (0, 0, widget->allocation.width, widget->allocation.height);
+ glViewport (0, 0, allocation.width, allocation.height);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
- glOrtho (0, widget->allocation.width, widget->allocation.height, 0, 0, 100);
+ glOrtho (0, allocation.width, allocation.height, 0, 0, 100);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
glTranslatef (0.0f, 0.0f, -Z_NEAR);
diff --git a/src/hid/gtk/gui-drc-window.c b/src/hid/gtk/gui-drc-window.c
index 5972467..e7f5c46 100644
--- a/src/hid/gtk/gui-drc-window.c
+++ b/src/hid/gtk/gui-drc-window.c
@@ -58,8 +58,11 @@ static gint
drc_window_configure_event_cb (GtkWidget * widget,
GdkEventConfigure * ev, gpointer data)
{
- ghidgui->drc_window_width = widget->allocation.width;
- ghidgui->drc_window_height = widget->allocation.height;
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+ ghidgui->drc_window_width = allocation.width;
+ ghidgui->drc_window_height = allocation.height;
ghidgui->config_modified = TRUE;
return FALSE;
diff --git a/src/hid/gtk/gui-keyref-window.c b/src/hid/gtk/gui-keyref-window.c
index 801d6d7..6eaf3eb 100644
--- a/src/hid/gtk/gui-keyref-window.c
+++ b/src/hid/gtk/gui-keyref-window.c
@@ -315,8 +315,11 @@ static gint
keyref_window_configure_event_cb (GtkWidget * widget, GdkEventConfigure * ev,
gpointer data)
{
- ghidgui->keyref_window_width = widget->allocation.width;
- ghidgui->keyref_window_height = widget->allocation.height;
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+ ghidgui->keyref_window_width = allocation.width;
+ ghidgui->keyref_window_height = allocation.height;
ghidgui->config_modified = TRUE;
return FALSE;
}
diff --git a/src/hid/gtk/gui-library-window.c b/src/hid/gtk/gui-library-window.c
index 0339cf0..2cda08e 100644
--- a/src/hid/gtk/gui-library-window.c
+++ b/src/hid/gtk/gui-library-window.c
@@ -93,8 +93,11 @@ static gint
library_window_configure_event_cb (GtkWidget * widget, GdkEventConfigure * ev,
gpointer data)
{
- ghidgui->library_window_width = widget->allocation.width;
- ghidgui->library_window_height = widget->allocation.height;
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+ ghidgui->library_window_width = allocation.width;
+ ghidgui->library_window_height = allocation.height;
ghidgui->config_modified = TRUE;
return FALSE;
}
diff --git a/src/hid/gtk/gui-log-window.c b/src/hid/gtk/gui-log-window.c
index 5f6d58f..41571e0 100644
--- a/src/hid/gtk/gui-log-window.c
+++ b/src/hid/gtk/gui-log-window.c
@@ -50,8 +50,11 @@ static gint
log_window_configure_event_cb (GtkWidget * widget,
GdkEventConfigure * ev, gpointer data)
{
- ghidgui->log_window_width = widget->allocation.width;
- ghidgui->log_window_height = widget->allocation.height;
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+ ghidgui->log_window_width = allocation.width;
+ ghidgui->log_window_height = allocation.height;
ghidgui->config_modified = TRUE;
return FALSE;
diff --git a/src/hid/gtk/gui-netlist-window.c b/src/hid/gtk/gui-netlist-window.c
index 28d0ff2..e05ae57 100644
--- a/src/hid/gtk/gui-netlist-window.c
+++ b/src/hid/gtk/gui-netlist-window.c
@@ -668,7 +668,10 @@ static gint
netlist_window_configure_event_cb (GtkWidget * widget, GdkEventConfigure * ev,
gpointer data)
{
- ghidgui->netlist_window_height = widget->allocation.height;
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+ ghidgui->netlist_window_height = allocation.height;
ghidgui->config_modified = TRUE;
return FALSE;
}
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index f3e95e7..f57dd5c 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -194,13 +194,16 @@ static gint
top_window_configure_event_cb (GtkWidget * widget, GdkEventConfigure * ev,
GHidPort * port)
{
+ GtkAllocation allocation;
gboolean new_w, new_h;
- new_w = (ghidgui->top_window_width != widget->allocation.width);
- new_h = (ghidgui->top_window_height != widget->allocation.height);
+ gtk_widget_get_allocation (widget, &allocation);
- ghidgui->top_window_width = widget->allocation.width;
- ghidgui->top_window_height = widget->allocation.height;
+ new_w = (ghidgui->top_window_width != allocation.width);
+ new_h = (ghidgui->top_window_height != allocation.height);
+
+ ghidgui->top_window_width = allocation.width;
+ ghidgui->top_window_height = allocation.height;
if (new_w || new_h)
ghidgui->config_modified = TRUE;
|
|
From: <gi...@gp...> - 2011-09-05 13:55:23
|
The branch, master has been updated
via 0809a6ec7d32e4acec5a6fcaca8a9fd8ab63e51a (commit)
from a369bf7cf2cfffbf9c44fc5ef3be8b0f9beabc0e (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 | 19 ++++++++++---------
src/hid/gtk/gtkhid-gl.c | 16 ++++++++--------
2 files changed, 18 insertions(+), 17 deletions(-)
=================
Commit Messages
=================
commit 0809a6ec7d32e4acec5a6fcaca8a9fd8ab63e51a
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use gtk_widget_get_allocation() not gdk_window_get_geometry()
This avoids an unnecessary round-trip the the X server on X11 platforms.
:100644 100644 ef3b30c... f0ce1ab... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 21a22e8... 13c45b0... M src/hid/gtk/gtkhid-gl.c
=========
Changes
=========
commit 0809a6ec7d32e4acec5a6fcaca8a9fd8ab63e51a
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use gtk_widget_get_allocation() not gdk_window_get_geometry()
This avoids an unnecessary round-trip the the X server on X11 platforms.
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index ef3b30c..f0ce1ab 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -1168,7 +1168,7 @@ ghid_pinout_preview_expose (GtkWidget *widget,
{
GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW (widget);
GdkDrawable *save_drawable;
- int da_w, da_h;
+ GtkAllocation allocation;
view_data save_view;
int save_width, save_height;
double xz, yz;
@@ -1181,24 +1181,25 @@ ghid_pinout_preview_expose (GtkWidget *widget,
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;
- yz = (double) pinout->y_max / da_h;
+ gtk_widget_get_allocation (widget, &allocation);
+ xz = (double) pinout->x_max / allocation.width;
+ yz = (double) pinout->y_max / allocation.height;
if (xz > yz)
gport->view.coord_per_px = xz;
else
gport->view.coord_per_px = yz;
gport->drawable = widget->window;
- gport->width = da_w;
- gport->height = da_h;
- gport->view.width = da_w * gport->view.coord_per_px;
- gport->view.height = da_h * gport->view.coord_per_px;
+ gport->width = allocation.width;
+ gport->height = allocation.height;
+ gport->view.width = allocation.width * gport->view.coord_per_px;
+ gport->view.height = allocation.height * 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);
+ gdk_draw_rectangle (widget->window, priv->bg_gc, TRUE,
+ 0, 0, allocation.width, allocation.height);
/* call the drawing routine */
hid_expose_callback (&ghid_hid, NULL, &pinout->element);
diff --git a/src/hid/gtk/gtkhid-gl.c b/src/hid/gtk/gtkhid-gl.c
index 21a22e8..13c45b0 100644
--- a/src/hid/gtk/gtkhid-gl.c
+++ b/src/hid/gtk/gtkhid-gl.c
@@ -1028,7 +1028,7 @@ 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);
- int da_w, da_h;
+ GtkAllocation allocation;
view_data save_view;
int save_width, save_height;
double xz, yz;
@@ -1039,18 +1039,18 @@ ghid_pinout_preview_expose (GtkWidget *widget,
/* Setup zoom factor for drawing routines */
- gdk_window_get_geometry (widget->window, 0, 0, &da_w, &da_h, 0);
- xz = (double) pinout->x_max / da_w;
- yz = (double) pinout->y_max / da_h;
+ gtk_widget_get_allocation (widget, &allocation);
+ xz = (double) pinout->x_max / allocation.width;
+ yz = (double) pinout->y_max / allocation.height;
if (xz > yz)
gport->view.coord_per_px = xz;
else
gport->view.coord_per_px = yz;
- gport->width = da_w;
- gport->height = da_h;
- gport->view.width = da_w * gport->view.coord_per_px;
- gport->view.height = da_h * gport->view.coord_per_px;
+ gport->width = allocation.width;
+ gport->height = allocation.height;
+ gport->view.width = allocation.width * gport->view.coord_per_px;
+ gport->view.height = allocation.height * 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;
|
|
From: <gi...@gp...> - 2011-09-05 13:54:47
|
The branch, master has been updated
via a369bf7cf2cfffbf9c44fc5ef3be8b0f9beabc0e (commit)
from cbd2f49e3b4f48c45e70b76ce207e9e76a81dcb8 (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 | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
=================
Commit Messages
=================
commit a369bf7cf2cfffbf9c44fc5ef3be8b0f9beabc0e
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Avoid warning caused by early drawing before gport->pixmap is set
Avoids a command line warning:
(pcb:28876): Gdk-CRITICAL **: IA__gdk_draw_drawable: assertion `GDK_IS_DRAWABLE (src)' failed
With the GDK renderer in use.
This trigger appears to be some state changes triggered as the new layer
selector widget initialises.
:100644 100644 4deae2b... ef3b30c... M src/hid/gtk/gtkhid-gdk.c
=========
Changes
=========
commit a369bf7cf2cfffbf9c44fc5ef3be8b0f9beabc0e
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Avoid warning caused by early drawing before gport->pixmap is set
Avoids a command line warning:
(pcb:28876): Gdk-CRITICAL **: IA__gdk_draw_drawable: assertion `GDK_IS_DRAWABLE (src)' failed
With the GDK renderer in use.
This trigger appears to be some state changes triggered as the new layer
selector widget initialises.
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index 4deae2b..ef3b30c 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -1135,8 +1135,11 @@ ghid_screen_update (void)
{
render_priv *priv = gport->render_priv;
+ if (gport->pixmap == NULL)
+ return;
+
gdk_draw_drawable (gport->drawing_area->window, priv->bg_gc, gport->pixmap,
- 0, 0, 0, 0, gport->width, gport->height);
+ 0, 0, 0, 0, gport->width, gport->height);
show_crosshair (TRUE);
}
|
|
From: <gi...@gp...> - 2011-09-05 13:34:15
|
The branch, master has been updated
via cbd2f49e3b4f48c45e70b76ce207e9e76a81dcb8 (commit)
from b372ca668852701f5e19b878ee3aa97361e377c8 (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-misc.c | 59 ++++++++++++++++++++++++-----------------------
1 files changed, 30 insertions(+), 29 deletions(-)
=================
Commit Messages
=================
commit cbd2f49e3b4f48c45e70b76ce207e9e76a81dcb8
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Clean and make gport_set_cursor_type() more GTK3.0 compatible
Also removes the DEFAULT_CURSOR return value (for the case of no window
being setup) to GDK_X_CURSOR (the 0 enum value), as the code path which
returned DEFAULT_CURSOR would never have been hit.
:100644 100644 3ed276c... dbed88e... M src/hid/gtk/gui-misc.c
=========
Changes
=========
commit cbd2f49e3b4f48c45e70b76ce207e9e76a81dcb8
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Clean and make gport_set_cursor_type() more GTK3.0 compatible
Also removes the DEFAULT_CURSOR return value (for the case of no window
being setup) to GDK_X_CURSOR (the 0 enum value), as the code path which
returned DEFAULT_CURSOR would never have been hit.
diff --git a/src/hid/gtk/gui-misc.c b/src/hid/gtk/gui-misc.c
index 3ed276c..dbed88e 100644
--- a/src/hid/gtk/gui-misc.c
+++ b/src/hid/gtk/gui-misc.c
@@ -45,8 +45,6 @@
RCSID ("$Id$");
-#define DEFAULT_CURSORSHAPE GDK_CROSSHAIR
-
#define CUSTOM_CURSOR_CLOCKWISE (GDK_LAST_CURSOR + 10)
#define CUSTOM_CURSOR_DRAG (GDK_LAST_CURSOR + 11)
#define CUSTOM_CURSOR_LOCK (GDK_LAST_CURSOR + 12)
@@ -85,43 +83,46 @@ ghid_cursor_position_relative_label_set_text (gchar * text)
static GdkCursorType
gport_set_cursor (GdkCursorType shape)
{
+ GdkWindow *window;
GdkCursorType old_shape = gport->X_cursor_shape;
GdkColor fg = { 0, 65535, 65535, 65535 }; /* white */
GdkColor bg = { 0, 0, 0, 0 }; /* black */
- if (!gport->drawing_area || !gport->drawing_area->window)
- return (GdkCursorType)0;
+ if (gport->drawing_area == NULL)
+ return GDK_X_CURSOR;
+
+ window = gtk_widget_get_window (gport->drawing_area);
+
if (gport->X_cursor_shape == shape)
return shape;
/* check if window exists to prevent from fatal errors */
- if (gport->drawing_area->window)
+ if (window == NULL)
+ return GDK_X_CURSOR;
+
+ gport->X_cursor_shape = shape;
+ if (shape > GDK_LAST_CURSOR)
{
- gport->X_cursor_shape = shape;
- if (shape > GDK_LAST_CURSOR)
- {
- if (shape == CUSTOM_CURSOR_CLOCKWISE)
- gport->X_cursor =
- gdk_cursor_new_from_pixmap (XC_clock_source, XC_clock_mask, &fg,
- &bg, ICON_X_HOT, ICON_Y_HOT);
- else if (shape == CUSTOM_CURSOR_DRAG)
- gport->X_cursor =
- gdk_cursor_new_from_pixmap (XC_hand_source, XC_hand_mask, &fg,
- &bg, ICON_X_HOT, ICON_Y_HOT);
- else if (shape == CUSTOM_CURSOR_LOCK)
- gport->X_cursor =
- gdk_cursor_new_from_pixmap (XC_lock_source, XC_lock_mask, &fg,
- &bg, ICON_X_HOT, ICON_Y_HOT);
- }
- else
- gport->X_cursor = gdk_cursor_new (shape);
+ if (shape == CUSTOM_CURSOR_CLOCKWISE)
+ gport->X_cursor =
+ gdk_cursor_new_from_pixmap (XC_clock_source, XC_clock_mask, &fg,
+ &bg, ICON_X_HOT, ICON_Y_HOT);
+ else if (shape == CUSTOM_CURSOR_DRAG)
+ gport->X_cursor =
+ gdk_cursor_new_from_pixmap (XC_hand_source, XC_hand_mask, &fg,
+ &bg, ICON_X_HOT, ICON_Y_HOT);
+ else if (shape == CUSTOM_CURSOR_LOCK)
+ gport->X_cursor =
+ gdk_cursor_new_from_pixmap (XC_lock_source, XC_lock_mask, &fg,
+ &bg, ICON_X_HOT, ICON_Y_HOT);
+ }
+ else
+ gport->X_cursor = gdk_cursor_new (shape);
- gdk_window_set_cursor (gport->drawing_area->window, gport->X_cursor);
- gdk_cursor_unref (gport->X_cursor);
+ gdk_window_set_cursor (window, gport->X_cursor);
+ gdk_cursor_unref (gport->X_cursor);
- return (old_shape);
- }
- return (DEFAULT_CURSORSHAPE);
+ return old_shape;
}
void
|
|
From: <gi...@gp...> - 2011-09-05 13:33:46
|
The branch, master has been updated
via b372ca668852701f5e19b878ee3aa97361e377c8 (commit)
from 89ca3994480c74b23f05c4deac0eee24dee0d9b0 (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-cell-renderer-visibility.c | 26 ++++++++++++++++----------
1 files changed, 16 insertions(+), 10 deletions(-)
=================
Commit Messages
=================
commit b372ca668852701f5e19b878ee3aa97361e377c8
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use gtk_cell_renderer_get_{align,pad} accessors
In GTK3.0, direct access to these fields will be impossible.
:100644 100644 ee5f6cb... 6e69744... M src/hid/gtk/ghid-cell-renderer-visibility.c
=========
Changes
=========
commit b372ca668852701f5e19b878ee3aa97361e377c8
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Use gtk_cell_renderer_get_{align,pad} accessors
In GTK3.0, direct access to these fields will be impossible.
diff --git a/src/hid/gtk/ghid-cell-renderer-visibility.c b/src/hid/gtk/ghid-cell-renderer-visibility.c
index ee5f6cb..6e69744 100644
--- a/src/hid/gtk/ghid-cell-renderer-visibility.c
+++ b/src/hid/gtk/ghid-cell-renderer-visibility.c
@@ -54,9 +54,14 @@ ghid_cell_renderer_visibility_get_size (GtkCellRenderer *cell,
{
GtkStyle *style = gtk_widget_get_style (widget);
gint w, h;
+ gint xpad, ypad;
+ gfloat xalign, yalign;
- w = VISIBILITY_TOGGLE_SIZE + 2 * (cell->xpad + style->xthickness);
- h = VISIBILITY_TOGGLE_SIZE + 2 * (cell->ypad + style->ythickness);
+ gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
+ gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
+
+ w = VISIBILITY_TOGGLE_SIZE + 2 * (xpad + style->xthickness);
+ h = VISIBILITY_TOGGLE_SIZE + 2 * (ypad + style->ythickness);
if (width)
*width = w;
@@ -67,13 +72,12 @@ ghid_cell_renderer_visibility_get_size (GtkCellRenderer *cell,
{
if (x_offset)
{
- gint xalign = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- ? 1.0 - cell->xalign
- : cell->xalign;
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ xalign = 1. - xalign;
*x_offset = MAX (0, xalign * (cell_area->width - w));
}
if (y_offset)
- *y_offset = MAX(0, cell->yalign * (cell_area->height - h));
+ *y_offset = MAX(0, yalign * (cell_area->height - h));
}
}
@@ -90,6 +94,7 @@ ghid_cell_renderer_visibility_render (GtkCellRenderer *cell,
GHidCellRendererVisibility *pcb_cell;
GdkRectangle toggle_rect;
GdkRectangle draw_rect;
+ gint xpad, ypad;
pcb_cell = GHID_CELL_RENDERER_VISIBILITY (cell);
ghid_cell_renderer_visibility_get_size (cell, widget, cell_area,
@@ -97,11 +102,12 @@ ghid_cell_renderer_visibility_render (GtkCellRenderer *cell,
&toggle_rect.y,
&toggle_rect.width,
&toggle_rect.height);
+ gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
- toggle_rect.x += cell_area->x + cell->xpad;
- toggle_rect.y += cell_area->y + cell->ypad;
- toggle_rect.width -= cell->xpad * 2;
- toggle_rect.height -= cell->ypad * 2;
+ toggle_rect.x += cell_area->x + xpad;
+ toggle_rect.y += cell_area->y + ypad;
+ toggle_rect.width -= xpad * 2;
+ toggle_rect.height -= ypad * 2;
if (toggle_rect.width <= 0 || toggle_rect.height <= 0)
return;
|
|
From: <gi...@gp...> - 2011-09-05 10:58:09
|
The branch, master has been updated
via 89ca3994480c74b23f05c4deac0eee24dee0d9b0 (commit)
from 9a96cf2fcf79eb7164c4f1e918b71e8fa558d6ca (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 | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
=================
Commit Messages
=================
commit 89ca3994480c74b23f05c4deac0eee24dee0d9b0
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Avoid double-destroying the file-changed info_bar on "Reload"
This was caused by an addition I made in the earlier patch to destroy
the info_bar when the user manually reverts or loads a new file).
The callback on revert button was trying to delete it (again) after
the revert _action_ we call triggered a destroy of the widget. Avoid
this by destroying the info_bar before we call the revert action.
:100644 100644 f713446... f3e95e7... M src/hid/gtk/gui-top-window.c
=========
Changes
=========
commit 89ca3994480c74b23f05c4deac0eee24dee0d9b0
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Avoid double-destroying the file-changed info_bar on "Reload"
This was caused by an addition I made in the earlier patch to destroy
the info_bar when the user manually reverts or loads a new file).
The callback on revert button was trying to delete it (again) after
the revert _action_ we call triggered a destroy of the widget. Avoid
this by destroying the info_bar before we call the revert action.
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index f713446..f3e95e7 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -471,11 +471,11 @@ info_bar_response_cb (GtkInfoBar *info_bar,
{
GhidGui *_gui = (GhidGui *)user_data;
- if (response_id == GTK_RESPONSE_ACCEPT)
- hid_actionl ("LoadFrom", "revert", "none", NULL);
-
gtk_widget_destroy (_gui->info_bar);
_gui->info_bar = NULL;
+
+ if (response_id == GTK_RESPONSE_ACCEPT)
+ hid_actionl ("LoadFrom", "revert", "none", NULL);
}
static void
|
|
From: <gi...@gp...> - 2011-09-05 05:54:17
|
The branch, master has been updated
via 9a96cf2fcf79eb7164c4f1e918b71e8fa558d6ca (commit)
from 5e84cc5f5506958cec38b440a43b23c4227658ad (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 | 23 ++++++++++-------------
1 files changed, 10 insertions(+), 13 deletions(-)
=================
Commit Messages
=================
commit 9a96cf2fcf79eb7164c4f1e918b71e8fa558d6ca
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: use gtk_action_block_activate() in layer selector
The GHidLayerSelector widget now uses gtk_action_block_activate()
instead of storing/blocking signal IDs. This is the proper way
to suppress signal emission since 2.16.
This also fixes the lockup bug that was supposed to be fixed
by the recent commit 8857757, but still occured when using the
menus to toggle layers.
:100644 100644 aa45fc6... a2bb3ff... M src/hid/gtk/ghid-layer-selector.c
=========
Changes
=========
commit 9a96cf2fcf79eb7164c4f1e918b71e8fa558d6ca
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: use gtk_action_block_activate() in layer selector
The GHidLayerSelector widget now uses gtk_action_block_activate()
instead of storing/blocking signal IDs. This is the proper way
to suppress signal emission since 2.16.
This also fixes the lockup bug that was supposed to be fixed
by the recent commit 8857757, but still occured when using the
menus to toggle layers.
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index aa45fc6..a2bb3ff 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -80,8 +80,6 @@ struct _GHidLayerSelectorClass
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;
@@ -127,9 +125,10 @@ set_visibility (GHidLayerSelector *ls, GtkTreeIter *iter,
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_unblock (ldata->view_action, ldata->view_sig_id);
+ gtk_action_block_activate (GTK_ACTION (ldata->view_action));
+ gtk_check_menu_item_set_active
+ (GTK_CHECK_MENU_ITEM (ldata->view_item), state);
+ gtk_action_unblock_activate (GTK_ACTION (ldata->view_action));
}
}
@@ -233,9 +232,9 @@ selection_changed_cb (GtkTreeSelection *selection, GHidLayerSelector *ls)
if (ldata && ldata->pick_action)
{
- g_signal_handler_block (ldata->pick_action, ldata->pick_sig_id);
+ gtk_action_block_activate (GTK_ACTION (ldata->pick_action));
gtk_radio_action_set_current_value (ldata->pick_action, user_id);
- g_signal_handler_unblock (ldata->pick_action, ldata->pick_sig_id);
+ gtk_action_unblock_activate (GTK_ACTION (ldata->pick_action));
}
g_signal_emit (ls, ghid_layer_selector_signals[SELECT_LAYER_SIGNAL],
0, user_id);
@@ -580,18 +579,16 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
action,
accel1);
gtk_action_connect_accelerator (action);
- new_layer->pick_sig_id =
- g_signal_connect (G_OBJECT (action), "activate",
- G_CALLBACK (menu_pick_cb), new_layer);
+ 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));
- new_layer->view_sig_id =
- g_signal_connect (G_OBJECT (new_layer->view_action), "activate",
- G_CALLBACK (menu_view_cb), new_layer);
+ 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;
|
|
From: <gi...@gp...> - 2011-09-05 04:49:23
|
The branch, master has been updated
via 5e84cc5f5506958cec38b440a43b23c4227658ad (commit)
via ca98e2da2b9d0d9fc20afa418d3e2a5f2084418c (commit)
from 1757783e412e38da9a802b904477540466058468 (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
=========
configure.ac | 44 ++++++++++++++++++++++++++++++++++++++++++++
globalconst.h | 10 +++++++++-
src/const.h | 5 +++++
src/draw.c | 18 +++++++++---------
src/global.h | 9 ++++++++-
src/misc.c | 10 +++++-----
src/print.c | 6 +++---
src/report.c | 4 ++--
8 files changed, 85 insertions(+), 21 deletions(-)
=================
Commit Messages
=================
commit 5e84cc5f5506958cec38b440a43b23c4227658ad
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Fix text scaling exceeding Coord max.
The old way of scaling text was to multiply by scale/100 but this could
easily overflow on reasonably sized boards with a 32-bit Coord type.
The new code scales by (double)scale/100.0 instead. Since we don't
store scaled values in the PCB file, a loss of precision won't matter,
but a double has 53 bits of precision - in nanometers, that's a board
about the size of North America.
Closes-bug: lp-832451
:100644 100644 0885871... f029821... M src/const.h
:100644 100644 f8db2ba... deb9e65... M src/draw.c
:100644 100644 1000400... a2a678e... M src/misc.c
:100644 100644 7e7e412... 4c01721... M src/print.c
:100644 100644 f640ef0... 4d5e27b... M src/report.c
commit ca98e2da2b9d0d9fc20afa418d3e2a5f2084418c
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Add configure selection of 32/64 Coord type
--enable-coord64 Force 64-bit coordinate types
--enable-coord32 Force 32-bit coordinate types
Defaults to "long" as before, but if you give one of the above,
the type changes to a suitable 32-bit or 64-bit type. Note
that this is only guaranteed to be the size you choose if you
have <stdint.h> which most OSs provide, else the "int" and "long long"
types are used instead.
:100644 100644 20b5cd3... 71ab1c4... M configure.ac
:100755 100755 e85b360... e8966ff... M globalconst.h
:100644 100644 a3a4ac1... 96c9cc9... M src/global.h
=========
Changes
=========
commit 5e84cc5f5506958cec38b440a43b23c4227658ad
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Fix text scaling exceeding Coord max.
The old way of scaling text was to multiply by scale/100 but this could
easily overflow on reasonably sized boards with a 32-bit Coord type.
The new code scales by (double)scale/100.0 instead. Since we don't
store scaled values in the PCB file, a loss of precision won't matter,
but a double has 53 bits of precision - in nanometers, that's a board
about the size of North America.
Closes-bug: lp-832451
diff --git a/src/const.h b/src/const.h
index 0885871..f029821 100644
--- a/src/const.h
+++ b/src/const.h
@@ -75,6 +75,11 @@
#define COORD_TO_INCH(n) (COORD_TO_MIL(n) / 1000.0)
#define INCH_TO_COORD(n) (MIL_TO_COORD(n) * 1000.0)
+/* These need to be carefully written to avoid overflows, and return
+ a Coord type. */
+#define SCALE_TEXT(COORD,TEXTSCALE) ((Coord)((COORD) * ((double)(TEXTSCALE) / 100.0)))
+#define UNSCALE_TEXT(COORD,TEXTSCALE) ((Coord)((COORD) * (100.0 / (double)(TEXTSCALE))))
+
/* ---------------------------------------------------------------------------
* modes
*/
diff --git a/src/draw.c b/src/draw.c
index f8db2ba..deb9e65 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -1222,11 +1222,11 @@ DrawTextLowLevel (TextTypePtr Text, Coord min_line_width)
{
/* create one line, scale, move, rotate and swap it */
newline = *line;
- newline.Point1.X = (newline.Point1.X + x) * Text->Scale / 100;
- newline.Point1.Y = newline.Point1.Y * Text->Scale / 100;
- newline.Point2.X = (newline.Point2.X + x) * Text->Scale / 100;
- newline.Point2.Y = newline.Point2.Y * Text->Scale / 100;
- newline.Thickness = newline.Thickness * Text->Scale / 200;
+ newline.Point1.X = SCALE_TEXT (newline.Point1.X + x, Text->Scale);
+ newline.Point1.Y = SCALE_TEXT (newline.Point1.Y, Text->Scale);
+ newline.Point2.X = SCALE_TEXT (newline.Point2.X + x, Text->Scale);
+ newline.Point2.Y = SCALE_TEXT (newline.Point2.Y, Text->Scale);
+ newline.Thickness = SCALE_TEXT (newline.Thickness, Text->Scale / 2);
if (newline.Thickness < min_line_width)
newline.Thickness = min_line_width;
@@ -1259,10 +1259,10 @@ DrawTextLowLevel (TextTypePtr Text, Coord min_line_width)
BoxType defaultsymbol = PCB->Font.DefaultSymbol;
Coord size = (defaultsymbol.X2 - defaultsymbol.X1) * 6 / 5;
- defaultsymbol.X1 = (defaultsymbol.X1 + x) * Text->Scale / 100;
- defaultsymbol.Y1 = defaultsymbol.Y1 * Text->Scale / 100;
- defaultsymbol.X2 = (defaultsymbol.X2 + x) * Text->Scale / 100;
- defaultsymbol.Y2 = defaultsymbol.Y2 * Text->Scale / 100;
+ defaultsymbol.X1 = SCALE_TEXT (defaultsymbol.X1 + x, Text->Scale);
+ defaultsymbol.Y1 = SCALE_TEXT (defaultsymbol.Y1, Text->Scale);
+ defaultsymbol.X2 = SCALE_TEXT (defaultsymbol.X2 + x, Text->Scale);
+ defaultsymbol.Y2 = SCALE_TEXT (defaultsymbol.Y2, Text->Scale);
RotateBoxLowLevel (&defaultsymbol, 0, 0, Text->Direction);
diff --git a/src/misc.c b/src/misc.c
index 1000400..a2a678e 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -516,7 +516,7 @@ SetTextBoundingBox (FontTypePtr FontPtr, TextTypePtr Text)
* bounds of the un-scaled text, and the thickness clamping applies to
* scaled text.
*/
- min_unscaled_radius = min_final_radius * 100 / Text->Scale;
+ min_unscaled_radius = UNSCALE_TEXT (min_final_radius, Text->Scale);
/* calculate size of the bounding box */
for (; s && *s; s++)
@@ -572,10 +572,10 @@ SetTextBoundingBox (FontTypePtr FontPtr, TextTypePtr Text)
}
/* scale values */
- minx = minx * Text->Scale / 100;
- miny = miny * Text->Scale / 100;
- maxx = maxx * Text->Scale / 100;
- maxy = maxy * Text->Scale / 100;
+ minx = SCALE_TEXT (minx, Text->Scale);
+ miny = SCALE_TEXT (miny, Text->Scale);
+ maxx = SCALE_TEXT (maxx, Text->Scale);
+ maxy = SCALE_TEXT (maxy, Text->Scale);
/* set upper-left and lower-right corner;
* swap coordinates if necessary (origin is already in 'swapped')
diff --git a/src/print.c b/src/print.c
index 7e7e412..4c01721 100644
--- a/src/print.c
+++ b/src/print.c
@@ -111,16 +111,16 @@ text_at (hidGC gc, int x, int y, int align, char *fmt, ...)
for (i = 0; tmp[i]; i++)
w +=
(font->Symbol[(int) tmp[i]].Width + font->Symbol[(int) tmp[i]].Delta);
- w = w * t.Scale / 100;
+ w = SCALE_TEXT (w, t.Scale);
t.X -= w * (align & 3) / 2;
if (t.X < 0)
t.X = 0;
DrawTextLowLevel (&t, 0);
if (align & 8)
fab_line (gc, t.X,
- t.Y + font->MaxHeight * t.Scale / 100 + MIL_TO_COORD(10),
+ t.Y + SCALE_TEXT (font->MaxHeight, t.Scale) + MIL_TO_COORD(10),
t.X + w,
- t.Y + font->MaxHeight * t.Scale / 100 + MIL_TO_COORD(10));
+ t.Y + SCALE_TEXT (font->MaxHeight, t.Scale) + MIL_TO_COORD(10));
}
/* Y, +, X, circle, square */
diff --git a/src/report.c b/src/report.c
index f640ef0..4d5e27b 100644
--- a/src/report.c
+++ b/src/report.c
@@ -423,7 +423,7 @@ ReportDialog (int argc, char **argv, Coord x, Coord y)
EMPTY (element->Name[0].TextString),
EMPTY (element->Name[1].TextString),
EMPTY (element->Name[2].TextString),
- (Coord) (FONT_CAPHEIGHT * element->Name[1].Scale / 100.),
+ SCALE_TEXT (FONT_CAPHEIGHT, element->Name[1].Scale),
element->Name[1].X, element->Name[1].Y,
TEST_FLAG (HIDENAMEFLAG, element) ? ",\n but it's hidden" : "",
element->MarkX, element->MarkY,
@@ -464,7 +464,7 @@ ReportDialog (int argc, char **argv, Coord x, Coord y)
"The bounding box is %$mD %$mD.\n"
"%s\n"
"%s", USER_UNITMASK, text->ID, flags_to_string (text->Flags, TEXT_TYPE),
- text->X, text->Y, (Coord) (FONT_CAPHEIGHT * (float)text->Scale / 100.),
+ text->X, text->Y, SCALE_TEXT (FONT_CAPHEIGHT, text->Scale),
text->TextString, text->Direction,
text->BoundingBox.X1, text->BoundingBox.Y1,
text->BoundingBox.X2, text->BoundingBox.Y2,
commit ca98e2da2b9d0d9fc20afa418d3e2a5f2084418c
Author: DJ Delorie <dj...@de...>
Commit: DJ Delorie <dj...@de...>
Add configure selection of 32/64 Coord type
--enable-coord64 Force 64-bit coordinate types
--enable-coord32 Force 32-bit coordinate types
Defaults to "long" as before, but if you give one of the above,
the type changes to a suitable 32-bit or 64-bit type. Note
that this is only guaranteed to be the size you choose if you
have <stdint.h> which most OSs provide, else the "int" and "long long"
types are used instead.
diff --git a/configure.ac b/configure.ac
index 20b5cd3..71ab1c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1076,6 +1076,49 @@ AM_CONDITIONAL(DEBUG_BUILD, test x$enable_debug = xyes)
m4_include([m4/m4_ax_func_mkdir.m4])
AX_FUNC_MKDIR
+# ------------- Type used for "Coord" type -------------------
+
+AC_CHECK_HEADERS(stdint.h)
+AC_ARG_ENABLE([coord64],
+[ --enable-coord64 Force 64-bit coordinate types],
+[],[enable_coord64=no])
+AC_ARG_ENABLE([coord32],
+[ --enable-coord32 Force 32-bit coordinate types],
+[],[enable_coord32=no])
+
+COORDTYPE="long"
+
+echo "$enable_coord32:$enable_coord64:$ac_cv_header_stdint_h"
+case "$enable_coord32:$enable_coord64:$ac_cv_header_stdint_h" in
+ yes:no:yes )
+ COORD_TYPE="int32_t"
+ COORD_MAX="INT32_MAX"
+ ;;
+ no:yes:yes )
+ COORD_TYPE="int64_t"
+ COORD_MAX="INT64_MAX"
+ ;;
+ yes:no:no )
+ COORD_TYPE="int"
+ COORD_MAX="INT_MAX"
+ ;;
+ no:yes:no )
+ COORD_TYPE="long long"
+ COORD_MAX="LLONG_MAX"
+ ;;
+ yes:yes:* )
+ AC_MSG_ERROR("*** cannot require both 32 and 64 bit coordinates")
+ ;;
+ *:*:* )
+ COORD_TYPE="long"
+ COORD_MAX="LONG_MAX"
+ ;;
+esac
+AC_DEFINE_UNQUOTED([COORD_TYPE],[$COORD_TYPE],
+ [C type for Coordinates])
+AC_DEFINE_UNQUOTED([COORD_MAX],[$COORD_MAX],
+ [Maximum value of coordinate type])
+
# ------------- Complete set of CFLAGS and LIBS -------------------
CFLAGS="$CFLAGS $X_CFLAGS $DBUS_CFLAGS $GLIB_CFLAGS $GTK_CFLAGS $CAIRO_CFLAGS $GTKGLEXT_CFLAGS $GLU_CFLAGS"
@@ -1306,6 +1349,7 @@ AC_MSG_RESULT([
GUI: $with_gui
Printer: $with_printer
Exporters: $with_exporters
+ Coordinate type: $COORD_TYPE
Source tree distribution: $pcb_sources
Build documentation: $docs_yesno
Build toporouter: $enable_toporouter
diff --git a/globalconst.h b/globalconst.h
index e85b360..e8966ff 100755
--- a/globalconst.h
+++ b/globalconst.h
@@ -33,8 +33,16 @@
#ifndef __GLOBALCONST_INCLUDED__
#define __GLOBALCONST_INCLUDED__
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <limits.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
/* ---------------------------------------------------------------------------
* some file-, directory- and environment names
*/
@@ -60,7 +68,7 @@
/* ---------------------------------------------------------------------------
* some limit specifications
*/
-#define LARGE_VALUE (LONG_MAX / 2 - 1) /* maximum extent of board and elements */
+#define LARGE_VALUE (COORD_MAX / 2 - 1) /* maximum extent of board and elements */
#define MAX_LAYER 16 /* max number of layer, check source */
/* code for more changes, a *lot* more changes */
diff --git a/src/global.h b/src/global.h
index a3a4ac1..96c9cc9 100644
--- a/src/global.h
+++ b/src/global.h
@@ -38,9 +38,16 @@
#ifndef PCB_GLOBAL_H
#define PCB_GLOBAL_H
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "const.h"
#include "macro.h"
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -64,7 +71,7 @@ typedef struct AttributeListType AttributeListType, *AttributeListTypePtr;
typedef struct unit Unit;
typedef struct increments Increments;
-typedef long Coord; /* pcb base unit */
+typedef COORD_TYPE Coord; /* pcb base unit */
typedef double Angle; /* degrees */
#include "hid.h"
|
|
From: <gi...@gp...> - 2011-09-05 04:35:01
|
The branch, master has been updated
via 1757783e412e38da9a802b904477540466058468 (commit)
from 8857757d007305f95b69445ede344a263c90c345 (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 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
=================
Commit Messages
=================
commit 1757783e412e38da9a802b904477540466058468
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: Fix "clicking on layer selector separator bug"
If you click on the selector between real and virtual layers in
the pcb layer selector, it will toggle the first layer. This
patch simply ignores the click.
:100644 100644 6ddbd3f... aa45fc6... M src/hid/gtk/ghid-layer-selector.c
=========
Changes
=========
commit 1757783e412e38da9a802b904477540466058468
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: Fix "clicking on layer selector separator bug"
If you click on the selector between real and virtual layers in
the pcb layer selector, it will toggle the first layer. This
patch simply ignores the click.
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index 6ddbd3f..aa45fc6 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -203,13 +203,14 @@ button_press_cb (GHidLayerSelector *ls, GdkEventButton *event)
&path, &column, NULL, NULL))
{
GtkTreeIter iter;
- gboolean activatable;
+ gboolean activatable, separator;
gtk_tree_model_get_iter (GTK_TREE_MODEL (ls->list_store), &iter, path);
gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store), &iter,
- ACTIVATABLE_COL, &activatable, -1);
+ ACTIVATABLE_COL, &activatable,
+ SEPARATOR_COL, &separator, -1);
/* Toggle visibility for non-activatable layers no matter
* where you click. */
- if (column == ls->visibility_column || !activatable)
+ if (!separator && (column == ls->visibility_column || !activatable))
{
toggle_visibility (ls, &iter, TRUE);
return TRUE;
|
|
From: <gi...@gp...> - 2011-09-05 04:33:39
|
The branch, master has been updated
via 8857757d007305f95b69445ede344a263c90c345 (commit)
via 84b14662b41e5a1309379b063a6628e54ee3cf63 (commit)
from 67de03c8e140500a517220e56dc3ddcff165088d (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 | 4 +++-
src/hid/gtk/gui-top-window.c | 23 +++++++++++++++++------
2 files changed, 20 insertions(+), 7 deletions(-)
=================
Commit Messages
=================
commit 8857757d007305f95b69445ede344a263c90c345
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: fix behavior when hiding the last visible layer
When you try to toggle the last layer invisible, pcb should refuse
to let you do so, since something has to be selected, and we don't
allow selection of invisible layers.
What actually happens is that pcb locks up. This patch fixes that.
:100644 100644 84db76e... 6ddbd3f... M src/hid/gtk/ghid-layer-selector.c
:100644 100644 ca7df6a... f713446... M src/hid/gtk/gui-top-window.c
commit 84b14662b41e5a1309379b063a6628e54ee3cf63
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: Force silk and rat layers visible when they are selected.
:100644 100644 91572fb... ca7df6a... M src/hid/gtk/gui-top-window.c
=========
Changes
=========
commit 8857757d007305f95b69445ede344a263c90c345
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: fix behavior when hiding the last visible layer
When you try to toggle the last layer invisible, pcb should refuse
to let you do so, since something has to be selected, and we don't
allow selection of invisible layers.
What actually happens is that pcb locks up. This patch fixes that.
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index 84db76e..6ddbd3f 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -808,8 +808,10 @@ ghid_layer_selector_select_next_visible (GHidLayerSelector *ls)
}
}
while (gtk_tree_model_iter_next (GTK_TREE_MODEL (ls->list_store), &iter));
- /* If we get here, nothing is selectable, so fail. */
+ /* Failing this, just emit a selected signal on the original layer. */
+ selection_changed_cb (ls->selection, ls);
}
+ /* If we get here, nothing is selectable, so fail. */
return FALSE;
}
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index ca7df6a..f713446 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -420,12 +420,13 @@ layer_selector_toggle_callback (GHidLayerSelector *ls, int layer, gpointer d)
break;
}
- /* Jump through hoops in case we just disabled the active layer
- * (or its group). In this case, select a different one if we
- * can. If we can't, turn the original layer back on.
+ /* Select the next visible layer. (If there is none, this will
+ * select the currently-selected layer, triggering the selection
+ * callback, which will turn the visibility on.) This way we
+ * will never have an invisible layer selected.
*/
- if (!ghid_layer_selector_select_next_visible (ls))
- ChangeGroupVisibility (layer, true, false);
+ if (!active)
+ ghid_layer_selector_select_next_visible (ls);
ignore_layer_update = false;
commit 84b14662b41e5a1309379b063a6628e54ee3cf63
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: Force silk and rat layers visible when they are selected.
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 91572fb..ca7df6a 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -353,7 +353,17 @@ layer_selector_select_callback (GHidLayerSelector *ls, int layer, gpointer d)
/* Select Layer */
PCB->SilkActive = (layer == LAYER_BUTTON_SILK);
PCB->RatDraw = (layer == LAYER_BUTTON_RATS);
- if (layer < max_copper_layer)
+ if (layer == LAYER_BUTTON_SILK)
+ {
+ PCB->ElementOn = true;
+ hid_action ("LayersChanged");
+ }
+ else if (layer == LAYER_BUTTON_RATS)
+ {
+ PCB->RatOn = true;
+ hid_action ("LayersChanged");
+ }
+ else if (layer < max_copper_layer)
ChangeGroupVisibility (layer, TRUE, true);
ignore_layer_update = false;
|
|
From: <gi...@gp...> - 2011-09-05 04:13:27
|
The branch, master has been updated
via 67de03c8e140500a517220e56dc3ddcff165088d (commit)
via 06661490e4b112d277c14afe49d73460c2052baf (commit)
via ffe811f14d8db3aa4539b719b4212bb8f6bfd1d8 (commit)
via a914d5ba58104d8559395b66798b35761afb991a (commit)
via 5ee21ef3feb0f40186617b8c7c5fd71d2902cc89 (commit)
via 705febbdfc68c7638739287b6feb50d625409dc6 (commit)
from 79159d64bff6b84bd7a6565eb517fc656a35156a (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 | 3 +-
src/hid/gtk/ghid-main-menu.c | 26 ++
src/hid/gtk/ghid-main-menu.h | 3 +
src/hid/gtk/ghid-route-style-selector.c | 585 +++++++++++++++++++++++++++++++
src/hid/gtk/ghid-route-style-selector.h | 41 +++
src/hid/gtk/gtkhid-main.c | 11 +-
src/hid/gtk/gui-command-window.c | 14 +-
src/hid/gtk/gui-dialog-size.c | 288 ---------------
src/hid/gtk/gui-top-window.c | 431 ++++-------------------
src/hid/gtk/gui.h | 15 +-
10 files changed, 741 insertions(+), 676 deletions(-)
create mode 100644 src/hid/gtk/ghid-route-style-selector.c
create mode 100644 src/hid/gtk/ghid-route-style-selector.h
delete mode 100644 src/hid/gtk/gui-dialog-size.c
=================
Commit Messages
=================
commit 67de03c8e140500a517220e56dc3ddcff165088d
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Implement RouteStylesChanged action
This action looks at the actual route-style settings (i.e.,
Settings.LineThickness), and gives these to the route style
selector. The selector looks in its list and selects a style,
if one matches. Otherwise, it does nothing.
:100644 100644 b3b5cc1... ad8c26f... M src/hid/gtk/ghid-route-style-selector.c
:100644 100644 48ae032... 53c481f... M src/hid/gtk/ghid-route-style-selector.h
:100644 100644 b1ea4ff... 1eed303... M src/hid/gtk/gtkhid-main.c
commit 06661490e4b112d277c14afe49d73460c2052baf
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Add Ctrl+F1,F2,F3,... accelerators to route style selector
Since we now have three accelerator groups to worry about (those
of the layer selector, route style selector and main menu), I
have moved the hooking/unhooking code into two functions:
ghid_install_accel_groups ()
ghid_remove_accel_groups ()
These should be used whenever accelerators need to be disabled,
for example, when the user has the command box active.
:100644 100644 9178645... b3b5cc1... M src/hid/gtk/ghid-route-style-selector.c
:100644 100644 4823d74... 48ae032... M src/hid/gtk/ghid-route-style-selector.h
:100644 100644 3701853... 310ace8... M src/hid/gtk/gui-command-window.c
:100644 100644 56c31f0... 91572fb... M src/hid/gtk/gui-top-window.c
:100644 100644 e9dbf26... 4fa67a7... M src/hid/gtk/gui.h
commit ffe811f14d8db3aa4539b719b4212bb8f6bfd1d8
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Remove the last of ghidgui->toggle_holdoff
:100644 100644 bed4ea6... 56c31f0... M src/hid/gtk/gui-top-window.c
:100644 100644 316d409... e9dbf26... M src/hid/gtk/gui.h
commit a914d5ba58104d8559395b66798b35761afb991a
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Replace old route style selector with GHidRouteStyleSelector
TODO: The RouteStylesChanged action is now very broken.
Menu accelerators need to be installed
:100644 100644 2e01c31... 7adb424... M src/Makefile.am
:100644 100644 7a6b8a8... b1ea4ff... M src/hid/gtk/gtkhid-main.c
:100644 000000 e3047bb... 0000000... D src/hid/gtk/gui-dialog-size.c
:100644 100644 1352be0... bed4ea6... M src/hid/gtk/gui-top-window.c
:100644 100644 883e803... 316d409... M src/hid/gtk/gui.h
commit 5ee21ef3feb0f40186617b8c7c5fd71d2902cc89
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Introduce functions for GHidRouteStyleSelector handling to menu
:100644 100644 ed4e2e8... 9ac0367... M src/hid/gtk/ghid-main-menu.c
:100644 100644 d667e34... da1fd9c... M src/hid/gtk/ghid-main-menu.h
commit 705febbdfc68c7638739287b6feb50d625409dc6
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Introduce GHidRouteStyleSelector widget, don't use it yet
:100644 100644 a9c51b2... 2e01c31... M src/Makefile.am
:000000 100644 0000000... 9178645... A src/hid/gtk/ghid-route-style-selector.c
:000000 100644 0000000... 4823d74... A src/hid/gtk/ghid-route-style-selector.h
=========
Changes
=========
commit 67de03c8e140500a517220e56dc3ddcff165088d
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Implement RouteStylesChanged action
This action looks at the actual route-style settings (i.e.,
Settings.LineThickness), and gives these to the route style
selector. The selector looks in its list and selects a style,
if one matches. Otherwise, it does nothing.
diff --git a/src/hid/gtk/ghid-route-style-selector.c b/src/hid/gtk/ghid-route-style-selector.c
index b3b5cc1..ad8c26f 100644
--- a/src/hid/gtk/ghid-route-style-selector.c
+++ b/src/hid/gtk/ghid-route-style-selector.c
@@ -543,3 +543,43 @@ ghid_route_style_selector_get_accel_group (GHidRouteStyleSelector *rss)
return rss->accel_group;
}
+/*! \brief Sets a GHidRouteStyleSelector selection to given values
+ * \par Function Description
+ * Given the line thickness, via size and clearance values of a route
+ * style, this function selects a route style with the given values.
+ * If there is no such style registered with the selector, nothing
+ * will happen. This function does not emit any signals.
+ *
+ * \param [in] rss The selector to be acted on
+ * \param [in] Thick Coord to match selection to
+ * \param [in] Diameter Coord to match selection to
+ * \param [in] Hole Coord to match selection to
+ * \param [in] Keepaway Coord to match selection to
+ */
+void
+ghid_route_style_selector_sync (GHidRouteStyleSelector *rss,
+ Coord Thick, Coord Diameter,
+ Coord Hole, Coord Keepaway)
+{
+ GtkTreeIter iter;
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (rss->model), &iter);
+ do
+ {
+ struct _route_style *style;
+ gtk_tree_model_get (GTK_TREE_MODEL (rss->model),
+ &iter, DATA_COL, &style, -1);
+ if (style->rst->Thick == Thick &&
+ style->rst->Diameter == Diameter &&
+ style->rst->Hole == Hole &&
+ style->rst->Keepaway == Keepaway)
+ {
+ g_signal_handler_block (G_OBJECT (style->action), style->sig_id);
+ gtk_toggle_action_set_active
+ (GTK_TOGGLE_ACTION (style->action), TRUE);
+ g_signal_handler_unblock (G_OBJECT (style->action), style->sig_id);
+ rss->active_style = style;
+ }
+ }
+ while (gtk_tree_model_iter_next (GTK_TREE_MODEL (rss->model), &iter));
+}
+
diff --git a/src/hid/gtk/ghid-route-style-selector.h b/src/hid/gtk/ghid-route-style-selector.h
index 48ae032..53c481f 100644
--- a/src/hid/gtk/ghid-route-style-selector.h
+++ b/src/hid/gtk/ghid-route-style-selector.h
@@ -33,5 +33,9 @@ void ghid_route_style_selector_edit_dialog (GHidRouteStyleSelector *rss);
GtkAccelGroup *ghid_route_style_selector_get_accel_group
(GHidRouteStyleSelector *rss);
+void ghid_route_style_selector_sync (GHidRouteStyleSelector *rss,
+ Coord Thick, Coord Diameter,
+ Coord Hole, Coord Keepaway);
+
G_END_DECLS /* keep c++ happy */
#endif
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index b1ea4ff..1eed303 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -1142,7 +1142,14 @@ static int PointCursor (int argc, char **argv, Coord x, Coord y)
static int
RouteStylesChanged (int argc, char **argv, Coord x, Coord y)
{
- /* TODO: handle this, somehow (asp) */
+ if (!ghidgui || !ghidgui->route_style_selector)
+ return 0;
+
+ ghid_route_style_selector_sync
+ (GHID_ROUTE_STYLE_SELECTOR (ghidgui->route_style_selector),
+ Settings.LineThickness, Settings.ViaThickness,
+ Settings.ViaDrillingHole, Settings.Keepaway);
+
return 0;
}
commit 06661490e4b112d277c14afe49d73460c2052baf
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Add Ctrl+F1,F2,F3,... accelerators to route style selector
Since we now have three accelerator groups to worry about (those
of the layer selector, route style selector and main menu), I
have moved the hooking/unhooking code into two functions:
ghid_install_accel_groups ()
ghid_remove_accel_groups ()
These should be used whenever accelerators need to be disabled,
for example, when the user has the command box active.
diff --git a/src/hid/gtk/ghid-route-style-selector.c b/src/hid/gtk/ghid-route-style-selector.c
index 9178645..b3b5cc1 100644
--- a/src/hid/gtk/ghid-route-style-selector.c
+++ b/src/hid/gtk/ghid-route-style-selector.c
@@ -50,6 +50,9 @@ struct _GHidRouteStyleSelector
GSList *action_radio_group;
GtkWidget *edit_button;
+ GtkActionGroup *action_group;
+ GtkAccelGroup *accel_group;
+
GtkListStore *model;
struct _route_style *active_style;
};
@@ -363,6 +366,9 @@ ghid_route_style_selector_new ()
rss->button_radio_group = NULL;
rss->model = gtk_list_store_new (N_COLS, G_TYPE_STRING, G_TYPE_POINTER);
+ rss->accel_group = gtk_accel_group_new ();
+ rss->action_group = gtk_action_group_new ("RouteStyleSelector");
+
/* Create edit button */
rss->edit_button = gtk_button_new_with_label (_("Route Styles"));
g_signal_connect (G_OBJECT (rss->edit_button), "clicked",
@@ -409,6 +415,18 @@ ghid_route_style_selector_real_add_route_style (GHidRouteStyleSelector *rss,
path);
gtk_tree_path_free (path);
+ /* Setup accelerator */
+ if (action_count < 12)
+ {
+ gchar *accel = g_strdup_printf ("<Ctrl>F%d", action_count + 1);
+ gtk_action_set_accel_group (GTK_ACTION (new_style->action),
+ rss->accel_group);
+ gtk_action_group_add_action_with_accel (rss->action_group,
+ GTK_ACTION (new_style->action),
+ accel);
+ g_free (accel);
+ }
+
/* Hookup and install radio button */
g_object_set_data (G_OBJECT (new_style->action), "route-style", new_style);
new_style->sig_id = g_signal_connect (G_OBJECT (new_style->action),
@@ -512,3 +530,16 @@ ghid_route_style_selector_select_style (GHidRouteStyleSelector *rss,
return FALSE;
}
+/*! \brief Returns the GtkAccelGroup of a route style selector
+ * \par Function Description
+ *
+ * \param [in] rss The selector to be acted on
+ *
+ * \return the accel group of the selector
+ */
+GtkAccelGroup *
+ghid_route_style_selector_get_accel_group (GHidRouteStyleSelector *rss)
+{
+ return rss->accel_group;
+}
+
diff --git a/src/hid/gtk/ghid-route-style-selector.h b/src/hid/gtk/ghid-route-style-selector.h
index 4823d74..48ae032 100644
--- a/src/hid/gtk/ghid-route-style-selector.h
+++ b/src/hid/gtk/ghid-route-style-selector.h
@@ -30,5 +30,8 @@ gboolean ghid_route_style_selector_select_style (GHidRouteStyleSelector *rss,
RouteStyleType *rst);
void ghid_route_style_selector_edit_dialog (GHidRouteStyleSelector *rss);
+GtkAccelGroup *ghid_route_style_selector_get_accel_group
+ (GHidRouteStyleSelector *rss);
+
G_END_DECLS /* keep c++ happy */
#endif
diff --git a/src/hid/gtk/gui-command-window.c b/src/hid/gtk/gui-command-window.c
index 3701853..310ace8 100644
--- a/src/hid/gtk/gui-command-window.c
+++ b/src/hid/gtk/gui-command-window.c
@@ -414,12 +414,7 @@ ghid_command_entry_get (gchar * prompt, gchar * command)
| insensitive so all the user can do is enter a command, grab focus
| and connect a handler to look for the escape key.
*/
- 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_remove_accel_groups (GTK_WINDOW (gport->top_window), ghidgui);
ghid_interface_input_signals_disconnect ();
ghid_interface_set_sensitive (FALSE);
gtk_widget_grab_focus (GTK_WIDGET (ghidgui->command_entry));
@@ -440,12 +435,7 @@ ghid_command_entry_get (gchar * prompt, gchar * command)
g_signal_handler_disconnect (ghidgui->command_entry, escape_sig_id);
ghid_interface_input_signals_connect ();
ghid_interface_set_sensitive (TRUE);
- 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)));
+ ghid_install_accel_groups (GTK_WINDOW (gport->top_window), ghidgui);
/* Restore the status line label and give focus back to the drawing area
*/
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 56c31f0..91572fb 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -424,15 +424,33 @@ layer_selector_toggle_callback (GHidLayerSelector *ls, int layer, gpointer d)
}
/*! \brief Install menu bar and accelerator groups */
-static void
-make_actions (GHidPort * port)
+void
+ghid_install_accel_groups (GtkWindow *window, GhidGui *gui)
+{
+ gtk_window_add_accel_group
+ (window, ghid_main_menu_get_accel_group
+ (GHID_MAIN_MENU (gui->menu_bar)));
+ gtk_window_add_accel_group
+ (window, ghid_layer_selector_get_accel_group
+ (GHID_LAYER_SELECTOR (gui->layer_selector)));
+ gtk_window_add_accel_group
+ (window, ghid_route_style_selector_get_accel_group
+ (GHID_ROUTE_STYLE_SELECTOR (gui->route_style_selector)));
+}
+
+/*! \brief Remove menu bar and accelerator groups */
+void
+ghid_remove_accel_groups (GtkWindow *window, GhidGui *gui)
{
- 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 (port->top_window),
- ghid_layer_selector_get_accel_group
- (GHID_LAYER_SELECTOR (ghidgui->layer_selector)));
+ gtk_window_remove_accel_group
+ (window, ghid_main_menu_get_accel_group
+ (GHID_MAIN_MENU (gui->menu_bar)));
+ gtk_window_remove_accel_group
+ (window, ghid_layer_selector_get_accel_group
+ (GHID_LAYER_SELECTOR (gui->layer_selector)));
+ gtk_window_remove_accel_group
+ (window, ghid_route_style_selector_get_accel_group
+ (GHID_ROUTE_STYLE_SELECTOR (gui->route_style_selector)));
}
static void
@@ -1163,7 +1181,6 @@ ghid_build_pcb_top_window (void)
NULL);
/* Build main menu */
ghidgui->menu_bar = ghid_load_menus ();
- make_actions (port);
gtk_box_pack_start (GTK_BOX (ghidgui->menubar_toolbar_vbox),
ghidgui->menu_bar, FALSE, FALSE, 0);
@@ -1436,6 +1453,7 @@ ghid_create_pcb_widgets (void)
g_error_free(err);
}
ghid_build_pcb_top_window ();
+ ghid_install_accel_groups (GTK_WINDOW (port->top_window), ghidgui);
ghid_update_toggle_flags ();
ghid_init_icons (port);
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index e9dbf26..4fa67a7 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -338,6 +338,8 @@ int ghid_drc_window_throw_dialog (void);
/* In gui-top-window.c */
void ghid_update_toggle_flags (void);
+void ghid_install_accel_groups (GtkWindow *window, GhidGui *gui);
+void ghid_remove_accel_groups (GtkWindow *window, GhidGui *gui);
/* gui-utils.c
*/
commit ffe811f14d8db3aa4539b719b4212bb8f6bfd1d8
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Remove the last of ghidgui->toggle_holdoff
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index bed4ea6..56c31f0 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -49,9 +49,6 @@ I NEED TO DO THE STATUS LINE THING. for example shift-alt-v to change the
via size. NOte the status line label does not get updated properly until
a zoom in/out.
-- do not forget I can use
- if (!ghidgui->toggle_holdoff)
-
#endif
/* This file was originally written by Bill Wilson for the PCB Gtk
@@ -169,14 +166,8 @@ menu_toggle_update_cb (GtkAction *act, const char *tflag, const char *aflag)
void
ghid_update_toggle_flags ()
{
- /* mask the callbacks */
- old_holdoff = ghidgui->toggle_holdoff;
- ghidgui->toggle_holdoff = TRUE;
-
ghid_main_menu_update_toggle_state (GHID_MAIN_MENU (ghidgui->menu_bar),
menu_toggle_update_cb);
-
- ghidgui->toggle_holdoff = old_holdoff;
}
static void
@@ -240,10 +231,6 @@ ghid_menu_cb (GtkAction *action, const Resource *node)
if (action == NULL || node == NULL)
return;
- /* Prevent recursion */
- if (ghidgui->toggle_holdoff == TRUE)
- return;
-
for (i = 1; i < node->c; i++)
if (resource_type (node->v[i]) == 10)
{
@@ -278,19 +265,6 @@ void ghid_hotkey_cb (int which)
void
ghid_sync_with_new_layout (void)
{
- gboolean old_holdoff;
-
- /* Just want to update the state of the menus without calling the
- | action functions at this time because causing a toggle action can
- | undo the initial condition set we want here.
- */
- old_holdoff = ghidgui->toggle_holdoff;
- ghidgui->toggle_holdoff = TRUE;
-
- /* FIXME - need toggle_holdoff? Need other calls to sync here? */
-
- ghidgui->toggle_holdoff = old_holdoff;
-
pcb_use_route_style (&PCB->RouteStyle[0]);
ghid_route_style_selector_select_style
(GHID_ROUTE_STYLE_SELECTOR (ghidgui->route_style_selector),
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 316d409..e9dbf26 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -125,7 +125,6 @@ typedef struct
gchar *name_label_string;
gboolean adjustment_changed_holdoff,
- toggle_holdoff,
command_entry_status_line_active,
auto_pan_on, in_popup;
commit a914d5ba58104d8559395b66798b35761afb991a
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Replace old route style selector with GHidRouteStyleSelector
TODO: The RouteStylesChanged action is now very broken.
Menu accelerators need to be installed
diff --git a/src/Makefile.am b/src/Makefile.am
index 2e01c31..7adb424 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -286,7 +286,6 @@ LIBGTK_SRCS = \
hid/gtk/gui-command-window.c \
hid/gtk/gui-config.c \
hid/gtk/gui-dialog-print.c \
- hid/gtk/gui-dialog-size.c \
hid/gtk/gui-dialog.c \
hid/gtk/gui-drc-window.c \
hid/gtk/gui-drc-window.h \
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 7a6b8a8..b1ea4ff 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -1142,11 +1142,7 @@ static int PointCursor (int argc, char **argv, Coord x, Coord y)
static int
RouteStylesChanged (int argc, char **argv, Coord x, Coord y)
{
- gint n;
-
- if (PCB && PCB->RouteStyle[0].Name)
- for (n = 0; n < NUM_STYLES; ++n)
- ghid_route_style_set_button_label ((&PCB->RouteStyle[n])->Name, n);
+ /* TODO: handle this, somehow (asp) */
return 0;
}
diff --git a/src/hid/gtk/gui-dialog-size.c b/src/hid/gtk/gui-dialog-size.c
deleted file mode 100644
index e3047bb..0000000
--- a/src/hid/gtk/gui-dialog-size.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/* $Id$ */
-
-/*
- * COPYRIGHT
- *
- * PCB, interactive printed circuit board design
- * Copyright (C) 1994,1995,1996 Thomas Nau
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Contact addresses for paper mail and Email:
- * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
- * Tho...@rz...
- *
- */
-
-/* This file written by Bill Wilson for the PCB Gtk port. */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "global.h"
-
-#include "change.h"
-#include "crosshair.h"
-#include "data.h"
-#include "error.h"
-#include "misc.h"
-#include "set.h"
-#include "pcb-printf.h"
-
-#include "gui.h"
-
-#ifdef HAVE_LIBDMALLOC
-#include <dmalloc.h>
-#endif
-
-RCSID ("$Id$");
-
-typedef struct
-{
- GtkWidget *name_entry,
- *line_width_coord_entry,
- *via_hole_coord_entry,
- *via_size_coord_entry,
- *clearance_coord_entry, *set_temp1_button, *set_temp2_button;
-}
-SizesDialog;
-
-static SizesDialog route_sizes;
-
-static void
-via_hole_cb (GHidCoordEntry * entry, gpointer data)
-{
- SizesDialog * sd = (SizesDialog *)data;
- gdouble via_hole_size, via_size;
-
- 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)
- ghid_coord_entry_set_value (GHID_COORD_ENTRY (sd->via_size_coord_entry),
- via_hole_size + MIN_PINORVIACOPPER);
-}
-
-static void
-via_size_cb (GHidCoordEntry * entry, gpointer data)
-{
- SizesDialog * sd = (SizesDialog *)data;
- gdouble via_hole_size, via_size;
-
- 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)
- ghid_coord_entry_set_value (GHID_COORD_ENTRY (sd->via_hole_coord_entry),
- via_size - MIN_PINORVIACOPPER);
-}
-
-static void
-use_temp_cb (GtkToggleButton * button, gpointer data)
-{
- gint which = GPOINTER_TO_INT (data);
- gboolean active;
-
- active = gtk_toggle_button_get_active (button);
- if (which == 1 && active)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (route_sizes.set_temp2_button), FALSE);
- else if (which == 2 && active)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (route_sizes.set_temp1_button), FALSE);
-}
-
-
- /* -----------------------------------------------------------------------
- | style sizes dialog
- */
-void
-ghid_route_style_dialog (gint index, RouteStyleType * temp_rst)
-{
- GtkWidget *dialog, *table, *vbox, *vbox1, *hbox, *label;
- GtkWidget *set_default_button = NULL;
- GHidPort *out = &ghid_port;
- RouteStyleType *rst;
- SizesDialog *sd;
- gchar *s, buf[64];
- gboolean set_temp1 = FALSE, set_temp2 = FALSE;
- gboolean editing_temp, set_default = FALSE;
-
- sd = &route_sizes;
-
- editing_temp = (index >= NUM_STYLES);
- rst = editing_temp ? temp_rst : &PCB->RouteStyle[index];
-
- if (!rst)
- return;
-
- snprintf (buf, sizeof (buf), _("%s Sizes"), rst->Name);
- dialog = gtk_dialog_new_with_buttons (buf,
- GTK_WINDOW (out->top_window),
- (GtkDialogFlags)(GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT),
- GTK_STOCK_CANCEL, GTK_RESPONSE_NONE,
- GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
- gtk_window_set_wmclass (GTK_WINDOW (dialog), "Sizes_dialog", "PCB");
-
- vbox = gtk_vbox_new (FALSE, 2);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
-
- hbox = gtk_hbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4);
- label = gtk_label_new (_("Route style name"));
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- sd->name_entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX (hbox), sd->name_entry, FALSE, FALSE, 0);
-
- vbox1 = ghid_category_vbox (vbox, _("Sizes"), 4, 2, TRUE, TRUE);
- table = gtk_table_new (4, 2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
- gtk_table_set_row_spacings (GTK_TABLE (table), 3);
-
- ghid_table_coord_entry (table, 0, 0, &sd->line_width_coord_entry,
- rst->Thick, MIN_LINESIZE, MAX_LINESIZE,
- CE_SMALL, 0, NULL, sd, TRUE,
- _("Line width"));
- ghid_table_coord_entry (table, 1, 0, &sd->via_hole_coord_entry,
- rst->Hole, MIN_PINORVIAHOLE,
- MAX_PINORVIASIZE - MIN_PINORVIACOPPER,
- CE_SMALL, 0, via_hole_cb, sd, TRUE,
- _("Via hole"));
- ghid_table_coord_entry (table, 2, 0, &sd->via_size_coord_entry,
- rst->Diameter, MIN_PINORVIAHOLE + MIN_PINORVIACOPPER,
- MAX_PINORVIASIZE,
- CE_SMALL, 0, via_size_cb, sd, TRUE,
- _("Via size"));
- ghid_table_coord_entry (table, 3, 0, &sd->clearance_coord_entry,
- rst->Keepaway, MIN_LINESIZE, MAX_LINESIZE,
- CE_SMALL, 0, NULL, sd, true,
- _("Clearance"));
- gtk_box_pack_start (GTK_BOX (vbox1), table, FALSE, FALSE, 0);
-
- if (!editing_temp)
- {
- vbox1 = ghid_category_vbox (vbox, _("Temporary Styles"),
- 4, 2, TRUE, TRUE);
- label = gtk_label_new ("");
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- s = g_strdup_printf (_("<small>"
- "Use values in a temporary route style instead of <b>%s</b>."
- "</small>"), rst->Name);
- gtk_label_set_markup (GTK_LABEL (label), s);
- g_free (s);
- gtk_box_pack_start (GTK_BOX (vbox1), label, FALSE, FALSE, 0);
-
- ghid_check_button_connected (vbox1, &sd->set_temp1_button, FALSE,
- TRUE, FALSE, FALSE, 0,
- use_temp_cb, GINT_TO_POINTER (1),
- _("Temp1"));
- ghid_check_button_connected (vbox1, &sd->set_temp2_button, FALSE, TRUE,
- FALSE, FALSE, 0, use_temp_cb,
- GINT_TO_POINTER (2), _("Temp2"));
-
- vbox1 = ghid_category_vbox (vbox, _("Default Style"), 4, 2, TRUE, TRUE);
- label = gtk_label_new ("");
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- s = g_strdup_printf (_("<small>"
- "Use values as the default route style for new layouts."
- "</small>"));
- gtk_label_set_markup (GTK_LABEL (label), s);
- g_free (s);
- gtk_box_pack_start (GTK_BOX (vbox1), label, FALSE, FALSE, 0);
- ghid_check_button_connected (vbox1, &set_default_button, FALSE,
- TRUE, FALSE, FALSE, 0,
- NULL, NULL, _("Set as default"));
-
- }
-
- gtk_entry_set_text (GTK_ENTRY (sd->name_entry), rst->Name);
- if (editing_temp)
- gtk_editable_set_editable (GTK_EDITABLE (sd->name_entry), FALSE);
-
- gtk_widget_show_all (dialog);
-
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
- {
- gchar *string;
- RouteStyleType rst_buf;
-
- if (!editing_temp)
- {
- set_temp1 =
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
- (sd->set_temp1_button));
- set_temp2 =
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
- (sd->set_temp2_button));
- set_default =
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
- (set_default_button));
- }
- if (set_temp1 || set_temp2)
- rst = &rst_buf;
-
- rst->Thick =
- ghid_coord_entry_get_value (GHID_COORD_ENTRY
- (sd->line_width_coord_entry));
- rst->Hole =
- ghid_coord_entry_get_value (GHID_COORD_ENTRY
- (sd->via_hole_coord_entry));
- rst->Diameter =
- ghid_coord_entry_get_value (GHID_COORD_ENTRY
- (sd->via_size_coord_entry));
- rst->Keepaway =
- ghid_coord_entry_get_value (GHID_COORD_ENTRY
- (sd->clearance_coord_entry));
-
- if (index < NUM_STYLES && !set_temp1 && !set_temp2)
- {
- string = ghid_entry_get_text (sd->name_entry);
- free (rst->Name);
- rst->Name = StripWhiteSpaceAndDup (string);
- pcb_use_route_style (rst);
- SetChangedFlag (true);
- ghid_route_style_set_button_label (rst->Name, index);
- }
- else
- {
- pcb_use_route_style (rst);
- ghid_route_style_set_temp_style (rst, set_temp1 ? 0 :
- (set_temp2 ? 1 : index -
- NUM_STYLES));
- }
- if (set_default)
- {
- gchar *s;
-
- Settings.RouteStyle[index] = *rst;
- ghidgui->config_modified = TRUE;
- s = make_route_string (Settings.RouteStyle, NUM_STYLES);
- g_free (Settings.Routes);
- Settings.Routes = s;
- }
- }
-
- gtk_widget_destroy (dialog);
- ghid_window_set_name_label (PCB->Name);
- ghid_set_status_line_label ();
-}
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 1352be0..bed4ea6 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -83,6 +83,7 @@ a zoom in/out.
#endif
#include "ghid-layer-selector.h"
+#include "ghid-route-style-selector.h"
#include "gtkhid.h"
#include "gui.h"
#include "hid.h"
@@ -132,39 +133,10 @@ a zoom in/out.
RCSID ("$Id$");
-/* ---------------------------------------------------------------------------
- * local types
- */
-
-/* Used by the route style buttons and menu */
-typedef struct
-{
- GtkWidget *button;
- RouteStyleType route_style;
- gboolean shown; /* For temp buttons */
-}
-RouteStyleButton;
-
-/* ---------------------------------------------------------------------------
- * local macros
- */
-
-/* ---------------------------------------------------------------------------
- * local prototypes
- */
-
-
-#define N_ROUTE_STYLES (NUM_STYLES + 3)
-
static bool ignore_layer_update;
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 ROUTESTYLE "RouteStyle"
-
GhidGui _ghidgui, *ghidgui = NULL;
GHidPort ghid_port, *gport;
@@ -177,22 +149,6 @@ static struct { GtkAction *action; const Resource *node; }
(sizeof (ghid_hotkey_actions) / sizeof (ghid_hotkey_actions[0]))
-/* ------------------------------------------------------------------
- * Route style buttons
- */
-
-/* Make 3 extra route style radio buttons. 2 for the extra Temp route
- * styles, and the 3rd is an always invisible button selected when the
- * route style settings in use don't match any defined route style (the
- * user can hit 'l', 'v', etc keys to change the settings without selecting
- * a new defined style.
- */
-
-static RouteStyleButton route_style_button[N_ROUTE_STYLES];
-static gint route_style_index;
-
-static GtkWidget *route_style_edit_button;
-
/*! \brief callback for ghid_main_menu_update_toggle_state () */
void
menu_toggle_update_cb (GtkAction *act, const char *tflag, const char *aflag)
@@ -213,13 +169,6 @@ menu_toggle_update_cb (GtkAction *act, const char *tflag, const char *aflag)
void
ghid_update_toggle_flags ()
{
- int i;
-
- GtkAction *a;
- gboolean active;
- gboolean old_holdoff;
- char tmpnm[40];
-
/* mask the callbacks */
old_holdoff = ghidgui->toggle_holdoff;
ghidgui->toggle_holdoff = TRUE;
@@ -227,24 +176,6 @@ ghid_update_toggle_flags ()
ghid_main_menu_update_toggle_state (GHID_MAIN_MENU (ghidgui->menu_bar),
menu_toggle_update_cb);
- for (i = 0; i < N_ROUTE_STYLES; i++)
- {
- sprintf (tmpnm, "%s%d", ROUTESTYLE, i);
- a = gtk_action_group_get_action (ghidgui->main_actions, tmpnm);
- if (i >= NUM_STYLES)
- {
- gtk_action_set_visible (a, FALSE);
- }
-
- /* Update the toggle states */
- active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (route_style_button[i].button));
-#ifdef DEBUG_MENUS
- printf ("ghid_update_toggle_flags(): route style %d, value is %d\n", i, active);
-#endif
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (a), active);
-
- }
-
ghidgui->toggle_holdoff = old_holdoff;
}
@@ -304,7 +235,7 @@ top_window_configure_event_cb (GtkWidget * widget, GdkEventConfigure * ev,
static void
ghid_menu_cb (GtkAction *action, const Resource *node)
{
- const gchar *name = gtk_action_get_name (action);
+ int i;
if (action == NULL || node == NULL)
return;
@@ -313,30 +244,14 @@ ghid_menu_cb (GtkAction *action, const Resource *node)
if (ghidgui->toggle_holdoff == TRUE)
return;
+ for (i = 1; i < node->c; i++)
+ if (resource_type (node->v[i]) == 10)
+ {
#ifdef DEBUG_MENUS
- printf ("ghid_menu_cb(): name = \"%s\"\n", name);
+ printf (" %s\n", node->v[i].value);
#endif
-
- /* Special-case route styles */
- if (strncmp (name, ROUTESTYLE, strlen (ROUTESTYLE)) == 0)
- {
- int id = atoi (name + strlen (ROUTESTYLE));
- if (ghidgui->toggle_holdoff != TRUE)
- ghid_route_style_button_set_active (id);
- node = NULL;
- }
- else
- {
- int vi;
- for (vi = 1; vi < node->c; vi++)
- if (resource_type (node->v[vi]) == 10)
- {
-#ifdef DEBUG_MENUS
- printf (" %s\n", node->v[vi].value);
-#endif
- hid_parse_actions (node->v[vi].value);
- }
- }
+ hid_parse_actions (node->v[i].value);
+ }
/* Sync gui widgets with pcb state */
ghid_update_toggle_flags ();
@@ -377,8 +292,10 @@ ghid_sync_with_new_layout (void)
ghidgui->toggle_holdoff = old_holdoff;
pcb_use_route_style (&PCB->RouteStyle[0]);
+ ghid_route_style_selector_select_style
+ (GHID_ROUTE_STYLE_SELECTOR (ghidgui->route_style_selector),
+ &PCB->RouteStyle[0]);
- ghid_route_style_button_set_active (0);
ghid_config_handle_units_changed ();
ghid_window_set_name_label (PCB->Name);
@@ -532,74 +449,11 @@ layer_selector_toggle_callback (GHidLayerSelector *ls, int layer, gpointer d)
ghid_invalidate_all();
}
-/*
- * The intial loading of all actions at startup.
- */
-static void
-ghid_make_programmed_menu_actions ()
-{
- int i;
- Resource *ar;
- char av[64];
-
- for (i = 0; i < N_ROUTE_STYLES; i++)
- {
- routestyle_toggle_entries[i].name = g_strdup_printf ("%s%d", ROUTESTYLE, i);
- routestyle_toggle_entries[i].stock_id = NULL;
- if (i < NUM_STYLES && PCB)
- {
- routestyle_toggle_entries[i].label = g_strdup ( (PCB->RouteStyle)[i].Name);
- }
- else
- {
- routestyle_toggle_entries[i].label = g_strdup (routestyle_toggle_entries[i].name);
- }
- routestyle_toggle_entries[i].accelerator = NULL;
- routestyle_toggle_entries[i].tooltip = NULL;
- routestyle_toggle_entries[i].callback = G_CALLBACK (ghid_menu_cb);
- routestyle_toggle_entries[i].is_active = FALSE;
-
- ar = resource_create (0);
- sprintf (av, "RouteStyle(%d)", i + 1);
- resource_add_val (ar, 0, strdup (av), 0);
- resource_add_val (ar, 0, strdup (av), 0);
- ar->flags |= FLAG_V;
- routestyle_resources[i] = ar;
-
- // FIXME
- //sprintf (av, "current_style,%d", i + 1);
- //note_toggle_flag (routestyle_toggle_entries[i].name, strdup (av));
-
- }
-}
-
-static void
-make_menu_actions (GtkActionGroup * actions, GHidPort * port)
-{
- ghid_make_programmed_menu_actions ();
-
- gtk_action_group_add_toggle_actions (actions,
- routestyle_toggle_entries,
- N_ROUTE_STYLES, port);
-
-}
-
-
-/*
- * Load in actions for the menus and layer selector
- */
+/*! \brief Install menu bar and accelerator groups */
static void
make_actions (GHidPort * port)
{
- GtkActionGroup *actions;
-
- actions = gtk_action_group_new ("Actions");
- gtk_action_group_set_translation_domain (actions, NULL);
- ghidgui->main_actions = actions;
-
- make_menu_actions (actions, port);
-
- gtk_window_add_accel_group (GTK_WINDOW (port->top_window),
+ 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 (port->top_window),
@@ -946,179 +800,45 @@ ghid_layer_buttons_update (void)
(GHID_LAYER_SELECTOR (ghidgui->layer_selector), layer);
}
-
-static void
-route_style_edit_cb (GtkWidget * widget, GHidPort * port)
-{
- hid_action("AdjustStyle");
-}
-
+/*! \brief Called when user clicks OK on route style dialog */
static void
-route_style_select_button_cb (GtkToggleButton * button, gpointer data)
+route_styles_edited_cb (GHidRouteStyleSelector *rss, gboolean save,
+ gpointer data)
{
- RouteStyleType *rst;
- gchar buf[16];
- gint index = GPOINTER_TO_INT (data);
-
- if (ghidgui->toggle_holdoff || index == NUM_STYLES + 2)
- return;
-
- if (route_style_index == index)
- return;
- route_style_index = index;
-
- if (index < NUM_STYLES)
- {
- snprintf (buf, sizeof (buf), "%d", index + 1);
- if (gtk_toggle_button_get_active (button))
- hid_actionl ("RouteStyle", buf, NULL);
- }
- else if (index < NUM_STYLES + 2)
+ if (save)
{
- rst = &route_style_button[index].route_style;
- SetLineSize (rst->Thick);
- SetViaSize (rst->Diameter, TRUE);
- SetViaDrillingHole (rst->Hole, TRUE);
- SetKeepawayWidth (rst->Keepaway);
+ g_free (Settings.Routes);
+ Settings.Routes = make_route_string (PCB->RouteStyle, NUM_STYLES);
+ ghidgui->config_modified = TRUE;
+ ghid_config_files_write ();
}
- gtk_widget_set_sensitive (route_style_edit_button, TRUE);
- ghid_set_status_line_label();
+ ghid_main_menu_install_route_style_selector
+ (GHID_MAIN_MENU (ghidgui->menu_bar),
+ GHID_ROUTE_STYLE_SELECTOR (ghidgui->route_style_selector));
}
+/*! \brief Called when a route style is selected */
static void
-ghid_route_style_temp_buttons_hide (void)
+route_style_changed_cb (GHidRouteStyleSelector *rss, RouteStyleType *rst,
+ gpointer data)
{
- gtk_widget_hide (route_style_button[NUM_STYLES].button);
- gtk_widget_hide (route_style_button[NUM_STYLES + 1].button);
-
- /* This one never becomes visibile.
- */
- gtk_widget_hide (route_style_button[NUM_STYLES + 2].button);
+ pcb_use_route_style (rst);
+ ghid_set_status_line_label();
}
-
+/*! \brief Configure the route style selector */
static void
-make_route_style_buttons (GtkWidget * vbox, GHidPort * port)
-{
- GtkWidget *button;
- GSList *group = NULL;
- RouteStyleButton *rbut;
- gint i;
-
- button = gtk_button_new_with_label (_("Route Style"));
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 2);
- g_signal_connect (button, "clicked",
- G_CALLBACK (route_style_edit_cb), port);
- route_style_edit_button = button;
-
- for (i = 0; i < N_ROUTE_STYLES; ++i)
- {
- RouteStyleType *rst;
- gchar buf[32];
-
- rbut = &route_style_button[i];
- if (i < NUM_STYLES)
- {
- rst = &PCB->RouteStyle[i];
- button = gtk_radio_button_new_with_label (group, _(rst->Name));
- }
- else
- {
- snprintf (buf, sizeof (buf), _("Temp%d"), i - NUM_STYLES + 1);
- button = gtk_radio_button_new_with_label (group, buf);
- if (!route_style_button[i].route_style.Name)
- route_style_button[i].route_style.Name = g_strdup (buf);
- }
- group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- rbut->button = button;
- if (i < NUM_STYLES + 2)
- g_signal_connect (G_OBJECT (button), "toggled",
- G_CALLBACK (route_style_select_button_cb),
- GINT_TO_POINTER (i));
- }
-}
-
-void
-ghid_route_style_button_set_active (gint n)
-{
- if (n < 0 || n >= N_ROUTE_STYLES)
- return;
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (route_style_button[n].button), TRUE);
-}
-
- /* Upate the route style button selected to match current route settings.
- | If user has changed an in use route setting so they don't match any
- | defined route style, select the invisible dummy route style button.
- */
-void
-ghid_route_style_buttons_update (void)
+make_route_style_buttons (GHidRouteStyleSelector *rss)
{
- RouteStyleType *rst;
- gint i;
-
- for (i = 0; i < NUM_STYLES + 2; ++i)
- {
- if (i < NUM_STYLES)
- rst = &PCB->RouteStyle[i];
- else
- {
- if (!route_style_button[i].shown) /* Temp button shown? */
- continue;
- rst = &route_style_button[i].route_style;
- }
- if (Settings.LineThickness == rst->Thick
- && Settings.ViaThickness == rst->Diameter
- && Settings.ViaDrillingHole == rst->Hole
- && Settings.Keepaway == rst->Keepaway)
- break;
- }
- /* If i == NUM_STYLES + 2 at this point, we activate the invisible button.
- */
- ghidgui->toggle_holdoff = TRUE;
- ghid_route_style_button_set_active (i);
- route_style_index = i;
- ghidgui->toggle_holdoff = FALSE;
-
- gtk_widget_set_sensitive (route_style_edit_button,
- (i == NUM_STYLES + 2) ? FALSE : TRUE);
-}
-
-void
-ghid_route_style_set_button_label (gchar * name, gint index)
-{
- if (index < 0 || index >= NUM_STYLES || !route_style_button[index].button)
- return;
- gtk_button_set_label (GTK_BUTTON (route_style_button[index].button),
- _(name));
-}
-
-void
-ghid_route_style_set_temp_style (RouteStyleType * rst, gint which)
-{
- RouteStyleButton *rsb;
- gchar *tmp;
- gint index = which + NUM_STYLES;
-
- if (which < 0 || which > 1)
- return;
- rsb = &route_style_button[index];
- gtk_widget_show (rsb->button);
- rsb->shown = TRUE;
- tmp = rsb->route_style.Name;
- rsb->route_style = *rst;
- rsb->route_style.Name = tmp;
- if (route_style_index != index)
- {
- route_style_index = index; /* Sets already done */
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rsb->button), TRUE);
- }
+ int i;
+ for (i = 0; i < NUM_STYLES; ++i)
+ ghid_route_style_selector_add_route_style (rss, &PCB->RouteStyle[i]);
+ g_signal_connect (G_OBJECT (rss), "select_style",
+ G_CALLBACK (route_style_changed_cb), NULL);
+ g_signal_connect (G_OBJECT (rss), "style_edited",
+ G_CALLBACK (route_styles_edited_cb), NULL);
}
-
-
/*
* ---------------------------------------------------------------
* Mode buttons
@@ -1516,9 +1236,11 @@ ghid_build_pcb_top_window (void)
gtk_container_add(GTK_CONTAINER(frame), vbox);
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX (vbox), hbox, FALSE, FALSE, 1);
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 4);
- make_route_style_buttons(vbox, port);
+ ghidgui->route_style_selector = ghid_route_style_selector_new ();
+ make_route_style_buttons
+ (GHID_ROUTE_STYLE_SELECTOR (ghidgui->route_style_selector));
+ gtk_box_pack_start(GTK_BOX(hbox), ghidgui->route_style_selector,
+ FALSE, FALSE, 4);
ghidgui->vbox_middle = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox_middle),
@@ -1628,8 +1350,6 @@ ghid_build_pcb_top_window (void)
gtk_widget_show_all (gport->top_window);
ghid_pack_mode_buttons ();
gdk_window_set_back_pixmap (gport->drawing_area->window, NULL, FALSE);
-
- ghid_route_style_temp_buttons_hide ();
}
@@ -1971,6 +1691,9 @@ ghid_do_export (HID_Attr_Val * options)
* are properly initialized and synchronized with the current PCB.
*/
ghid_layer_buttons_update ();
+ ghid_main_menu_install_route_style_selector
+ (GHID_MAIN_MENU (ghidgui->menu_bar),
+ GHID_ROUTE_STYLE_SELECTOR (ghidgui->route_style_selector));
if (stdin_listen)
ghid_create_listener ();
@@ -2337,15 +2060,11 @@ Opens the window which allows editing of the route styles.
static int
AdjustStyle(int argc, char **argv, Coord x, Coord y)
{
- RouteStyleType *rst = NULL;
-
if (argc > 1)
AFAIL (adjuststyle);
- if (route_style_index >= NUM_STYLES)
- rst = &route_style_button[route_style_index].route_style;
- ghid_route_style_dialog (route_style_index, rst);
-
+ ghid_route_style_selector_edit_dialog
+ (GHID_ROUTE_STYLE_SELECTOR (ghidgui->route_style_selector));
return 0;
}
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 883e803..316d409 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -110,7 +110,7 @@ typedef struct
*mode_buttons_frame;
GtkWidget *left_toolbar;
GtkWidget *grid_units_button;
- GtkWidget *menu_bar, *layer_selector;
+ GtkWidget *menu_bar, *layer_selector, *route_style_selector;
GtkWidget *mode_toolbar;
GtkWidget *vbox_middle;
@@ -337,15 +337,7 @@ void ghid_drc_window_append_violation (DrcViolationType *violation);
void ghid_drc_window_append_messagev (const char *fmt, va_list va);
int ghid_drc_window_throw_dialog (void);
-/* gui-route-style function prototypes.
-*/
- /* In gui-dialog-size.c */
-void ghid_route_style_dialog (gint index, RouteStyleType * rst);
- /* In gui-top-window.c */
-void ghid_route_style_set_button_label (gchar * name, gint index);
-void ghid_route_style_set_temp_style (RouteStyleType * rst, gint which);
-void ghid_route_style_button_set_active (gint number);
-void ghid_route_style_buttons_update (void);
+/* In gui-top-window.c */
void ghid_update_toggle_flags (void);
/* gui-utils.c
commit 5ee21ef3feb0f40186617b8c7c5fd71d2902cc89
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Introduce functions for GHidRouteStyleSelector handling to menu
diff --git a/src/hid/gtk/ghid-main-menu.c b/src/hid/gtk/ghid-main-menu.c
index ed4e2e8..9ac0367 100644
--- a/src/hid/gtk/ghid-main-menu.c
+++ b/src/hid/gtk/ghid-main-menu.c
@@ -14,6 +14,7 @@
#include "ghid-main-menu.h"
#include "ghid-layer-selector.h"
+#include "ghid-route-style-selector.h"
void Message (const char *, ...);
@@ -557,6 +558,31 @@ ghid_main_menu_install_layer_selector (GHidMainMenu *mm,
}
}
+/*! \brief Installs or updates route style selector items */
+void
+ghid_main_menu_install_route_style_selector (GHidMainMenu *mm,
+ GHidRouteStyleSelector *rss)
+{
+ GList *children;
+ /* @routestyles */
+ if (mm->route_style_shell)
+ {
+ /* Remove old children */
+ children = gtk_container_get_children
+ (GTK_CONTAINER (mm->route_style_shell));
+ children = g_list_nth (children, mm->route_style_pos);
+ while (children && mm->n_route_styles--)
+ {
+ gtk_container_remove (GTK_CONTAINER (mm->route_style_shell),
+ children->data);
+ children = g_list_next (children);
+ }
+ /* Install new ones */
+ mm->n_route_styles = ghid_route_style_selector_install_items
+ (rss, mm->route_style_shell, mm->route_style_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 d667e34..da1fd9c 100644
--- a/src/hid/gtk/ghid-main-menu.h
+++ b/src/hid/gtk/ghid-main-menu.h
@@ -6,6 +6,7 @@
#include <gtk/gtk.h>
#include "ghid-layer-selector.h"
+#include "ghid-route-style-selector.h"
#include "resource.h"
G_BEGIN_DECLS /* keep c++ happy */
@@ -37,6 +38,8 @@ GtkMenu *ghid_main_menu_get_popup (GHidMainMenu *menu, const char *name);
void ghid_main_menu_install_layer_selector (GHidMainMenu *mm,
GHidLayerSelector *ls);
+void ghid_main_menu_install_route_style_selector (GHidMainMenu *mm,
+ GHidRouteStyleSelector *rss);
G_END_DECLS /* keep c++ happy */
#endif
commit 705febbdfc68c7638739287b6feb50d625409dc6
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Introduce GHidRouteStyleSelector widget, don't use it yet
diff --git a/src/Makefile.am b/src/Makefile.am
index a9c51b2..2e01c31 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -278,6 +278,8 @@ LIBGTK_SRCS = \
hid/gtk/ghid-layer-selector.h \
hid/gtk/ghid-main-menu.c \
hid/gtk/ghid-main-menu.h \
+ hid/gtk/ghid-route-style-selector.c \
+ hid/gtk/ghid-route-style-selector.h \
hid/gtk/gtkhid-main.c \
hid/gtk/gtkhid.h \
hid/gtk/gui.h \
diff --git a/src/hid/gtk/ghid-route-style-selector.c b/src/hid/gtk/ghid-route-style-selector.c
new file mode 100644
index 0000000..9178645
--- /dev/null
+++ b/src/hid/gtk/ghid-route-style-selector.c
@@ -0,0 +1,514 @@
+/*! \file <gtk-pcb-route-style-selector.c>
+ * \brief Implementation of GHidRouteStyleSelector widget
+ * \par Description
+ * Please write description here.
+ */
+
+/* TODO: write finalize function */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+
+#include "global.h"
+#include "gtkhid.h"
+#include "gui.h"
+#include "pcb-printf.h"
+
+#include "ghid-route-style-selector.h"
+
+/* Forward dec'ls */
+struct _route_style;
+struct _route_style *ghid_route_style_selector_real_add_route_style
+ (GHidRouteStyleSelector *, RouteStyleType *, gboolean temp);
+
+/*! \brief Global action creation counter */
+static gint action_count;
+
+/*! \brief Signals exposed by the widget */
+enum {
+ SELECT_STYLE_SIGNAL,
+ STYLE_EDITED_SIGNAL,
+ LAST_SIGNAL
+};
+
+/*! \brief Columns used for internal data store */
+enum {
+ TEXT_COL,
+ DATA_COL,
+ N_COLS
+};
+
+static guint ghid_route_style_selector_signals[LAST_SIGNAL] = { 0 };
+
+struct _GHidRouteStyleSelector
+{
+ GtkVBox parent;
+
+ GSList *button_radio_group;
+ GSList *action_radio_group;
+ GtkWidget *edit_button;
+
+ GtkListStore *model;
+ struct _route_style *active_style;
+};
+
+struct _GHidRouteStyleSelectorClass
+{
+ GtkVBoxClass parent_class;
+
+ void (* select_style) (GHidRouteStyleSelector *, RouteStyleType *);
+ void (* style_edited) (GHidRouteStyleSelector *, gboolean);
+};
+
+struct _route_style
+{
+ gboolean temporary; /* TODO: actually use this for something */
+ GtkRadioAction *action;
+ GtkWidget *button;
+ GtkWidget *menu_item;
+ GtkTreeRowReference *rref;
+ RouteStyleType *rst;
+ gulong sig_id;
+};
+
+/* SIGNAL HANDLERS */
+/*! \brief Callback for user selection of a route style */
+static void
+radio_select_cb (GtkToggleAction *action, GHidRouteStyleSelector *rss)
+{
+ rss->active_style = g_object_get_data (G_OBJECT (action), "route-style");
+ if (gtk_toggle_action_get_active (action))
+ g_signal_emit (rss, ghid_route_style_selector_signals[SELECT_STYLE_SIGNAL],
+ 0, rss->active_style->rst);
+}
+
+/* EDIT DIALOG */
+struct _dialog
+{
+ GHidRouteStyleSelector *rss;
+ GtkWidget *name_entry;
+ GtkWidget *line_entry;
+ GtkWidget *via_hole_entry;
+ GtkWidget *via_size_entry;
+ GtkWidget *clearance_entry;
+};
+
+/*! \brief Callback for dialog box's combobox being changed
+ * \par Function Description
+ * When a different layer is selected, this function loads
+ * that layer's data into the dialog. Alternately, if the
+ * "New layer" option is selected, this loads a new name
+ * but no other data.
+ *
+ * \param [in] combo The combobox
+ * \param [in] dialog The rest of the widgets to be updated
+ */
+static void
+dialog_style_changed_cb (GtkComboBox *combo, struct _dialog *dialog)
+{
+ struct _route_style *style;
+ GtkTreeIter iter;
+ gtk_combo_box_get_active_iter (combo, &iter);
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->rss->model),
+ &iter, DATA_COL, &style, -1);
+
+ if (style == NULL)
+ {
+ gtk_entry_set_text (GTK_ENTRY (dialog->name_entry),
+ _("New Style"));
+ return;
+ }
+
+ gtk_entry_set_text (GTK_ENTRY (dialog->name_entry), style->rst->Name);
+ ghid_coord_entry_set_value (GHID_COORD_ENTRY (dialog->line_entry),
+ style->rst->Thick);
+ ghid_coord_entry_set_value (GHID_COORD_ENTRY (dialog->via_size_entry),
+ style->rst->Diameter);
+ ghid_coord_entry_set_value (GHID_COORD_ENTRY (dialog->via_hole_entry),
+ style->rst->Hole);
+ ghid_coord_entry_set_value (GHID_COORD_ENTRY (dialog->clearance_entry),
+ style->rst->Keepaway);
+
+}
+
+/* \brief Helper for edit_button_cb */
+static void
+_table_attach (GtkWidget *table, gint row, const gchar *label,
+ GtkWidget **entry, Coord min, Coord max)
+{
+ GtkWidget *label_w = gtk_label_new (label);
+ gtk_misc_set_alignment (GTK_MISC (label_w), 1.0, 0.5);
+
+ *entry = ghid_coord_entry_new (min, max, 0, Settings.grid_unit, CE_SMALL);
+ gtk_table_attach (GTK_TABLE (table), label_w, 0, 1, row, row + 1,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
+ gtk_table_attach (GTK_TABLE (table), *entry, 1, 2, row, row + 1,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
+}
+
+/* \brief Builds and runs the "edit route styles" dialog */
+void
+ghid_route_style_selector_edit_dialog (GHidRouteStyleSelector *rss)
+{
+ GtkTreePath *path;
+ GtkTreeIter iter, tmp_iter;
+ struct _dialog dialog_data;
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
+ GtkWidget *window = gtk_widget_get_toplevel (GTK_WIDGET (rss));
+ GtkWidget *dialog, *vbox, *hbox, *sub_vbox, *table;
+ GtkWidget *label, *select_box, *check_box;
+
+ /* Build dialog */
+ dialog = gtk_dialog_new_with_buttons (_("Edit Route Styles"),
+ GTK_WINDOW (window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_NONE,
+ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
+
+ label = gtk_label_new (_("Edit Style:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+
+ select_box = gtk_combo_box_new_with_model (GTK_TREE_MODEL (rss->model));
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (select_box), renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT(select_box), renderer,
+ "text", TEXT_COL, NULL);
+
+ vbox = GTK_DIALOG (dialog)->vbox;
+
+ hbox = gtk_hbox_new (FALSE, 4);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 4);
+ vbox = gtk_vbox_new (FALSE, 4);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 4);
+
+ hbox = gtk_hbox_new (FALSE, 4);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4);
+ gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), select_box, TRUE, TRUE, 0);
+
+ sub_vbox = ghid_category_vbox (vbox, _("Route Style Data"),
+ 4, 2, TRUE, TRUE);
+ table = gtk_table_new (5, 2, FALSE);
+ gtk_box_pack_start (GTK_BOX (sub_vbox), table, TRUE, TRUE, 4);
+ label = gtk_label_new (_("Name:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+ dialog_data.name_entry = gtk_entry_new ();
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
+ gtk_table_attach (GTK_TABLE (table), dialog_data.name_entry, 1, 2, 0, 1,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
+
+ _table_attach (table, 1, _("Line width:"),
+ &dialog_data.line_entry,
+ MIN_LINESIZE, MAX_LINESIZE);
+ _table_attach (table, 2, _("Via hole size:"),
+ &dialog_data.via_hole_entry,
+ MIN_PINORVIAHOLE, MAX_PINORVIASIZE - MIN_PINORVIACOPPER);
+ _table_attach (table, 3, _("Via ring size:"),
+ &dialog_data.via_size_entry,
+ MIN_PINORVIAHOLE + MIN_PINORVIACOPPER, MAX_PINORVIASIZE);
+ _table_attach (table, 4, _("Clearance:"),
+ &dialog_data.clearance_entry,
+ MIN_LINESIZE, MAX_LINESIZE);
+
+ sub_vbox = ghid_category_vbox (vbox, _("Set as Default"),
+ 4, 2, TRUE, TRUE);
+ check_box = gtk_check_button_new_with_label
+ (_("Save route style settings as default"));
+ gtk_box_pack_start (GTK_BOX (sub_vbox), check_box, TRUE, TRUE, 0);
+
+ /* Add "new style" option to list */
+ gtk_list_store_append (rss->model, &tmp_iter);
+ gtk_list_store_set (rss->model, &tmp_iter, TEXT_COL,
+ _("New (this session only)"), DATA_COL, NULL, -1);
+
+ /* Display dialog */
+ dialog_data.rss = rss;
+ path = gtk_tree_row_reference_get_path (rss->active_style->rref);
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (rss->model), &iter, path);
+ g_signal_connect (G_OBJECT (select_box), "changed",
+ G_CALLBACK (dialog_style_changed_cb), &dialog_data);
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (select_box), &iter);
+ gtk_widget_show_all (dialog);
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
+ {
+ RouteStyleType *rst;
+ struct _route_style *style;
+ gboolean save;
+ gtk_combo_box_get_active_iter (GTK_COMBO_BOX (select_box), &iter);
+ gtk_tree_model_get (GTK_TREE_MODEL (rss->model),
+ &iter, DATA_COL, &style, -1);
+ if (style == NULL)
+ rst = g_malloc (sizeof *rst);
+ else
+ {
+ rst = style->rst;
+ free (rst->Name);
+ }
+
+ rst->Name = StripWhiteSpaceAndDup
+ (gtk_entry_get_text (GTK_ENTRY (dialog_data.name_entry)));
+ rst->Thick = ghid_coord_entry_get_value
+ (GHID_COORD_ENTRY (dialog_data.line_entry));
+ rst->Diameter = ghid_coord_entry_get_value
+ (GHID_COORD_ENTRY (dialog_data.via_hole_entry));
+ rst->Hole = ghid_coord_entry_get_value
+ (GHID_COORD_ENTRY (dialog_data.via_size_entry));
+ rst->Keepaway = ghid_coord_entry_get_value
+ (GHID_COORD_ENTRY (dialog_data.clearance_entry));
+ save = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_box));
+
+ if (style == NULL)
+ style = ghid_route_style_selector_real_add_route_style
+ (rss, rst, TRUE);
+ else
+ {
+ gtk_action_set_label (GTK_ACTION (style->action), rst->Name);
+ gtk_list_store_set (rss->model, &iter, TEXT_COL, rst->Name, -1);
+ }
+
+ /* Cleanup */
+ gtk_widget_destroy (dialog);
+ gtk_list_store_remove (rss->model, &tmp_iter);
+ /* Emit change signals */
+ ghid_route_style_selector_select_style (rss, rst);
+ g_signal_emit
+ (rss, ghid_route_style_selector_signals[STYLE_EDITED_SIGNAL],
+ 0, save);
+ }
+ else
+ {
+ gtk_widget_destroy (dialog);
+ gtk_list_store_remove (rss->model, &tmp_iter);
+ }
+}
+/* end EDIT DIALOG */
+
+static void
+edit_button_cb (GtkButton *btn, GHidRouteStyleSelector *rss)
+{
+ ghid_route_style_selector_edit_dialog (rss);
+}
+
+/* CONSTRUCTOR */
+static void
+ghid_route_style_selector_init (GHidRouteStyleSelector *rss)
+{
+}
+
+static void
+ghid_route_style_selector_class_init (GHidRouteStyleSelectorClass *klass)
+{
+ ghid_route_style_selector_signals[SELECT_STYLE_SIGNAL] =
+ g_signal_new ("select-style",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GHidRouteStyleSelectorClass, select_style),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE,
+ 1, G_TYPE_POINTER);
+ ghid_route_style_selector_signals[STYLE_EDITED_SIGNAL] =
+ g_signal_new ("style-edited",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GHidRouteStyleSelectorClass, style_edited),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE,
+ 1, G_TYPE_BOOLEAN);
+}
+
+/* PUBLIC FUNCTIONS */
+G...
[truncated message content] |
|
From: <gi...@gp...> - 2011-09-04 23:16:16
|
The branch, master has been updated
via 79159d64bff6b84bd7a6565eb517fc656a35156a (commit)
via 93c24529851a68ac00ac6b6157aa8696bf1321d6 (commit)
from 33d88cae984a02b036dcabd6fac10a8c33a651c4 (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
=========
configure.ac | 4 +-
src/hid/gtk/gui-top-window.c | 131 ++++++++++++++++++++++++++++++++++++++++--
src/hid/gtk/gui.h | 4 +
3 files changed, 131 insertions(+), 8 deletions(-)
=================
Commit Messages
=================
commit 79159d64bff6b84bd7a6565eb517fc656a35156a
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Add file change notification for the currently open PCB
If the file is modified on disk, a bar appears at the top of the PCB
area offering the user a choice as to whether they wish to reload the
board or cancel (do nothing).
If the user has changes, and hits reload - they are prompted as to
whether they wish to throw away their changes.
Requires GTK 2.18 or higher due to use of the GtkInfoBar widget.
:100644 100644 fae0655... 1352be0... M src/hid/gtk/gui-top-window.c
:100644 100644 8abfd12... 883e803... M src/hid/gtk/gui.h
commit 93c24529851a68ac00ac6b6157aa8696bf1321d6
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Require GTK 2.18 or later for the GTK HID.
This is for some new widgets, like the GtkInfoBar.
:100644 100644 422347a... 20b5cd3... M configure.ac
=========
Changes
=========
commit 79159d64bff6b84bd7a6565eb517fc656a35156a
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Add file change notification for the currently open PCB
If the file is modified on disk, a bar appears at the top of the PCB
area offering the user a choice as to whether they wish to reload the
board or cancel (do nothing).
If the user has changes, and hits reload - they are prompted as to
whether they wish to throw away their changes.
Requires GTK 2.18 or higher due to use of the GtkInfoBar widget.
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index fae0655..1352be0 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -607,6 +607,118 @@ make_actions (GHidPort * port)
(GHID_LAYER_SELECTOR (ghidgui->layer_selector)));
}
+static void
+info_bar_response_cb (GtkInfoBar *info_bar,
+ gint response_id,
+ gpointer user_data)
+{
+ GhidGui *_gui = (GhidGui *)user_data;
+
+ if (response_id == GTK_RESPONSE_ACCEPT)
+ hid_actionl ("LoadFrom", "revert", "none", NULL);
+
+ gtk_widget_destroy (_gui->info_bar);
+ _gui->info_bar = NULL;
+}
+
+static void
+file_changed_cb (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
+ gpointer user_data)
+{
+ GhidGui *_gui = (GhidGui *)user_data;
+ GtkWidget *icon;
+ GtkWidget *label;
+ GtkWidget *content_area;
+ char *file_path;
+ char *file_path_utf8;
+ char *markup;
+
+ if (event_type != G_FILE_MONITOR_EVENT_CHANGED)
+ return;
+
+ /* File has changed on disk */
+
+ if (_gui->info_bar)
+ gtk_widget_destroy (_gui->info_bar);
+
+ _gui->info_bar = gtk_info_bar_new_with_buttons (_("Reload"),
+ GTK_RESPONSE_ACCEPT,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (_gui->vbox_middle),
+ _gui->info_bar, FALSE, FALSE, 0);
+ gtk_box_reorder_child (GTK_BOX (_gui->vbox_middle), _gui->info_bar, 0);
+
+ gtk_info_bar_set_message_type (GTK_INFO_BAR (_gui->info_bar),
+ GTK_MESSAGE_WARNING);
+
+ g_signal_connect (_gui->info_bar, "response",
+ G_CALLBACK (info_bar_response_cb), _gui);
+
+ file_path = g_file_get_path (file);
+ file_path_utf8 = g_filename_to_utf8 (file_path, -1, NULL, NULL, NULL);
+ g_free (file_path);
+ markup =
+ g_markup_printf_escaped (_("<b>The file %s has changed on disk</b>\n"
+ "\n"
+ "Do you want to reload the file?"),
+ file_path_utf8);
+ g_free (file_path_utf8);
+
+ content_area =
+ gtk_info_bar_get_content_area (GTK_INFO_BAR (_gui->info_bar));
+
+ icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
+ GTK_ICON_SIZE_DIALOG);
+ gtk_box_pack_start (GTK_BOX (content_area),
+ icon, FALSE, FALSE, 0);
+
+ label = gtk_label_new ("");
+ gtk_box_pack_start (GTK_BOX (content_area),
+ label, TRUE, TRUE, 6);
+
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ gtk_label_set_markup (GTK_LABEL (label), markup);
+ g_free (markup);
+
+ gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5);
+
+ gtk_widget_show_all (_gui->info_bar);
+}
+
+static void
+connect_file_change_monitor (GhidGui *_gui, char *filename)
+{
+ GFile *file;
+
+ if (_gui->file_monitor != NULL)
+ g_object_unref (_gui->file_monitor);
+ _gui->file_monitor = NULL;
+
+ if (_gui->info_bar != NULL)
+ gtk_widget_destroy (_gui->info_bar);
+ _gui->info_bar = NULL;
+
+ if (filename == NULL)
+ return;
+
+ file = g_file_new_for_path (filename);
+
+ /* XXX: Could hook up more error handling for g_file_monitor_file */
+ _gui->file_monitor = g_file_monitor_file (file,
+ G_FILE_MONITOR_NONE,
+ NULL,
+ NULL);
+ g_object_unref (file);
+
+ g_signal_connect (_gui->file_monitor, "changed",
+ G_CALLBACK (file_changed_cb), _gui);
+}
+
/* Refreshes the window title bar and sets the PCB name to the
* window title bar or to a seperate label
@@ -636,6 +748,11 @@ ghid_window_set_name_label (gchar * name)
gtk_window_set_title (GTK_WINDOW (gport->top_window), str);
g_free (str);
g_free (filename);
+
+ if (PCB->Filename && *PCB->Filename)
+ connect_file_change_monitor (ghidgui, PCB->Filename);
+ else
+ connect_file_change_monitor (ghidgui, NULL);
}
static void
@@ -1403,11 +1520,12 @@ ghid_build_pcb_top_window (void)
gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 4);
make_route_style_buttons(vbox, port);
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox_middle), vbox, TRUE, TRUE, 0);
+ ghidgui->vbox_middle = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox_middle),
+ ghidgui->vbox_middle, TRUE, TRUE, 0);
hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (ghidgui->vbox_middle), hbox, TRUE, TRUE, 0);
/* -- The PCB layout output drawing area */
@@ -1448,15 +1566,16 @@ ghid_build_pcb_top_window (void)
gtk_hscrollbar_new (GTK_ADJUSTMENT (ghidgui->h_adjustment));
gtk_range_set_update_policy (GTK_RANGE (ghidgui->h_range),
GTK_UPDATE_CONTINUOUS);
- gtk_box_pack_start (GTK_BOX (vbox), ghidgui->h_range, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (ghidgui->vbox_middle),
+ ghidgui->h_range, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (ghidgui->h_adjustment), "value_changed",
G_CALLBACK (h_adjustment_changed_cb), ghidgui);
/* -- The bottom status line label */
ghidgui->status_line_hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), ghidgui->status_line_hbox,
- FALSE, FALSE, 2);
+ gtk_box_pack_start (GTK_BOX (ghidgui->vbox_middle),
+ ghidgui->status_line_hbox, FALSE, FALSE, 2);
label = gtk_label_new ("");
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 8abfd12..883e803 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -112,6 +112,10 @@ typedef struct
GtkWidget *grid_units_button;
GtkWidget *menu_bar, *layer_selector;
GtkWidget *mode_toolbar;
+ GtkWidget *vbox_middle;
+
+ GtkWidget *info_bar;
+ GFileMonitor *file_monitor;
GtkWidget *h_range, *v_range;
GtkObject *h_adjustment, *v_adjustment;
commit 93c24529851a68ac00ac6b6157aa8696bf1321d6
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
Require GTK 2.18 or later for the GTK HID.
This is for some new widgets, like the GtkInfoBar.
diff --git a/configure.ac b/configure.ac
index 422347a..20b5cd3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -752,8 +752,8 @@ for e in $HIDLIST; do
AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
fi
- PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.12.0, ,
- [AC_MSG_ERROR([Cannot find gtk+ >= 2.12.0, install it and rerun ./configure
+ PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0, ,
+ [AC_MSG_ERROR([Cannot find gtk+ >= 2.18.0, install it and rerun ./configure
Please review the following errors:
$GTK_PKG_ERRORS])]
)
|
|
From: <gi...@gp...> - 2011-09-04 02:31:44
|
The branch, master has been updated
via 33d88cae984a02b036dcabd6fac10a8c33a651c4 (commit)
via d1037dd11d1f083df268e5abed91524b57189ac2 (commit)
from a7e3de33107c2cb7fa37f9b55af7776c4e4a8937 (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 | 350 ++++++++++++++++++++++++++++--------------
src/hid/gtk/gui.h | 7 +-
2 files changed, 239 insertions(+), 118 deletions(-)
=================
Commit Messages
=================
commit 33d88cae984a02b036dcabd6fac10a8c33a651c4
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Fix styling of menubar area so it is consistent across its width
This relies on some nasty tricks copying GtkStyle's between the menubar
widget and a new GtkEventBox widget we pack the top bar in to give us a
background to paint on. We also adjust the styles of the coordinate read-
out labels and frames to ensure they are legible.
There may still be some inconsistencies, as the coordinate selector button
is themed as if it were a toolbar button, hence the colourings used may
be designed to work with a different background colour than we have.
:100644 100644 3e7666c... fae0655... M src/hid/gtk/gui-top-window.c
:100644 100644 04bfeb6... 8abfd12... M src/hid/gtk/gui.h
commit d1037dd11d1f083df268e5abed91524b57189ac2
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Create a GtkToolbar of mode buttons for compact vertical mode
Rather than packing our mode buttons into an hbox, use a proper GtkToolbar
so theming will match the rest of the user's desktop.
This simplifies code to switch compact mode on and off, as we have two
distinct widgets to show / hide, rather than having to reparent the mode
buttons each time.
It does, however mean we have to be careful not to double-trigger events
when keeping the two sets of mode buttons in sync with each other, so that
isn't ideal.
In the longer term, we probably ought to split out the mode button area
on the left-hand toolbar as a separate self-contained widget.
:100644 100644 07019df... 3e7666c... M src/hid/gtk/gui-top-window.c
:100644 100644 9376605... 04bfeb6... M src/hid/gtk/gui.h
=========
Changes
=========
commit 33d88cae984a02b036dcabd6fac10a8c33a651c4
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Fix styling of menubar area so it is consistent across its width
This relies on some nasty tricks copying GtkStyle's between the menubar
widget and a new GtkEventBox widget we pack the top bar in to give us a
background to paint on. We also adjust the styles of the coordinate read-
out labels and frames to ensure they are legible.
There may still be some inconsistencies, as the coordinate selector button
is themed as if it were a toolbar button, hence the colourings used may
be designed to work with a different background colour than we have.
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 3e7666c..fae0655 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -680,20 +680,20 @@ relative_label_size_req_cb (GtkWidget * widget,
static void
make_cursor_position_labels (GtkWidget * hbox, GHidPort * port)
{
- GtkWidget *frame, *label, *button;
+ GtkWidget *frame, *label;
/* The grid units button next to the cursor position labels.
*/
- button = gtk_button_new ();
+ ghidgui->grid_units_button = gtk_button_new ();
label = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL (label),
Settings.grid_unit->in_suffix);
ghidgui->grid_units_label = label;
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- gtk_container_add (GTK_CONTAINER (button), label);
- gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, TRUE, 0);
- g_signal_connect (G_OBJECT (button), "clicked",
- G_CALLBACK (grid_units_button_cb), NULL);
+ gtk_container_add (GTK_CONTAINER (ghidgui->grid_units_button), label);
+ gtk_box_pack_end (GTK_BOX (hbox), ghidgui->grid_units_button, FALSE, TRUE, 0);
+ g_signal_connect (ghidgui->grid_units_button, "clicked",
+ G_CALLBACK (grid_units_button_cb), NULL);
/* The absolute cursor position label
*/
@@ -1214,6 +1214,92 @@ destroy_chart_cb (GtkWidget * widget, GHidPort * port)
gtk_main_quit ();
}
+static void
+get_widget_styles (GtkStyle **menu_bar_style,
+ GtkStyle **tool_button_style,
+ GtkStyle **tool_button_label_style)
+{
+ GtkWidget *tool_button;
+ GtkWidget *tool_button_label;
+ GtkToolItem *tool_item;
+
+ /* Build a tool item to extract the theme's styling for a toolbar button with text */
+ tool_item = gtk_tool_item_new ();
+ gtk_toolbar_insert (GTK_TOOLBAR (ghidgui->mode_toolbar), tool_item, 0);
+ tool_button = gtk_button_new ();
+ gtk_container_add (GTK_CONTAINER (tool_item), tool_button);
+ tool_button_label = gtk_label_new ("");
+ gtk_container_add (GTK_CONTAINER (tool_button), tool_button_label);
+
+ /* Grab the various styles we need */
+ gtk_widget_ensure_style (ghidgui->menu_bar);
+ *menu_bar_style = gtk_widget_get_style (ghidgui->menu_bar);
+
+ gtk_widget_ensure_style (tool_button);
+ *tool_button_style = gtk_widget_get_style (tool_button);
+
+ gtk_widget_ensure_style (tool_button_label);
+ *tool_button_label_style = gtk_widget_get_style (tool_button_label);
+
+ gtk_widget_destroy (GTK_WIDGET (tool_item));
+}
+
+static void
+do_fix_topbar_theming (void)
+{
+ GtkWidget *rel_pos_frame;
+ GtkWidget *abs_pos_frame;
+ GtkStyle *menu_bar_style;
+ GtkStyle *tool_button_style;
+ GtkStyle *tool_button_label_style;
+
+ get_widget_styles (&menu_bar_style,
+ &tool_button_style,
+ &tool_button_label_style);
+
+ /* Style the top bar background as if it were all a menu bar */
+ gtk_widget_set_style (ghidgui->top_bar_background, menu_bar_style);
+
+ /* Style the cursor position labels using the menu bar style as well.
+ * If this turns out to cause problems with certain gtk themes, we may
+ * need to grab the GtkStyle associated with an actual menu item to
+ * get a text color to render with.
+ */
+ gtk_widget_set_style (ghidgui->cursor_position_relative_label, menu_bar_style);
+ gtk_widget_set_style (ghidgui->cursor_position_absolute_label, menu_bar_style);
+
+ /* Style the units button as if it were a toolbar button - hopefully
+ * this isn't too ugly sitting on a background themed as a menu bar.
+ * It is unlikely any theme defines colours for a GtkButton sitting on
+ * a menu bar.
+ */
+ rel_pos_frame = gtk_widget_get_parent (ghidgui->cursor_position_relative_label);
+ abs_pos_frame = gtk_widget_get_parent (ghidgui->cursor_position_absolute_label);
+ gtk_widget_set_style (rel_pos_frame, menu_bar_style);
+ gtk_widget_set_style (abs_pos_frame, menu_bar_style);
+ gtk_widget_set_style (ghidgui->grid_units_button, tool_button_style);
+ gtk_widget_set_style (ghidgui->grid_units_label, tool_button_label_style);
+}
+
+/* Attempt to produce a conststent style for our extra menu-bar items by
+ * copying aspects from the menu bar style set by the user's GTK theme.
+ * Setup signal handlers to update our efforts if the user changes their
+ * theme whilst we are running.
+ */
+static void
+fix_topbar_theming (void)
+{
+ GtkSettings *settings;
+
+ do_fix_topbar_theming ();
+
+ settings = gtk_widget_get_settings (ghidgui->top_bar_background);
+ g_signal_connect (settings, "notify::gtk-theme-name",
+ G_CALLBACK (do_fix_topbar_theming), NULL);
+ g_signal_connect (settings, "notify::gtk-font-name",
+ G_CALLBACK (do_fix_topbar_theming), NULL);
+}
+
/*
* Create the top_window contents. The config settings should be loaded
* before this is called.
@@ -1234,8 +1320,13 @@ ghid_build_pcb_top_window (void)
gtk_container_add (GTK_CONTAINER (window), vbox_main);
/* -- Top control bar */
+ ghidgui->top_bar_background = gtk_event_box_new ();
+ gtk_box_pack_start (GTK_BOX (vbox_main),
+ ghidgui->top_bar_background, FALSE, FALSE, 0);
+
ghidgui->top_hbox = gtk_hbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (vbox_main), ghidgui->top_hbox, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (ghidgui->top_bar_background),
+ ghidgui->top_hbox);
/*
* menu_hbox will be made insensitive when the gui needs
@@ -1280,6 +1371,7 @@ ghid_build_pcb_top_window (void)
hbox_middle = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox_main), hbox_middle, TRUE, TRUE, 3);
+ fix_topbar_theming (); /* Must be called after toolbar is created */
/* -- Left control bar */
/*
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 04bfeb6..8abfd12 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -104,10 +104,12 @@ typedef struct
GtkEntry *command_entry;
GtkWidget *top_hbox,
+ *top_bar_background,
*menu_hbox, *position_hbox,
*menubar_toolbar_vbox,
*mode_buttons_frame;
GtkWidget *left_toolbar;
+ GtkWidget *grid_units_button;
GtkWidget *menu_bar, *layer_selector;
GtkWidget *mode_toolbar;
commit d1037dd11d1f083df268e5abed91524b57189ac2
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Create a GtkToolbar of mode buttons for compact vertical mode
Rather than packing our mode buttons into an hbox, use a proper GtkToolbar
so theming will match the rest of the user's desktop.
This simplifies code to switch compact mode on and off, as we have two
distinct widgets to show / hide, rather than having to reparent the mode
buttons each time.
It does, however mean we have to be careful not to double-trigger events
when keeping the two sets of mode buttons in sync with each other, so that
isn't ideal.
In the longer term, we probably ought to split out the mode button area
on the left-hand toolbar as a separate self-contained widget.
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 07019df..3e7666c 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -1008,7 +1008,10 @@ ghid_route_style_set_temp_style (RouteStyleType * rst, gint which)
*/
typedef struct
{
- GtkWidget *button, *box0, *box1;
+ GtkWidget *button;
+ GtkWidget *toolbar_button;
+ guint button_cb_id;
+ guint toolbar_button_cb_id;
gchar *name;
gint mode;
gchar **xpm;
@@ -1017,36 +1020,62 @@ ModeButton;
static ModeButton mode_buttons[] = {
- {NULL, NULL, NULL, "via", VIA_MODE, via},
- {NULL, NULL, NULL, "line", LINE_MODE, line},
- {NULL, NULL, NULL, "arc", ARC_MODE, arc},
- {NULL, NULL, NULL, "text", TEXT_MODE, text},
- {NULL, NULL, NULL, "rectangle", RECTANGLE_MODE, rect},
- {NULL, NULL, NULL, "polygon", POLYGON_MODE, poly},
- {NULL, NULL, NULL, "polygonhole", POLYGONHOLE_MODE, polyhole},
- {NULL, NULL, NULL, "buffer", PASTEBUFFER_MODE, buf},
- {NULL, NULL, NULL, "remove", REMOVE_MODE, del},
- {NULL, NULL, NULL, "rotate", ROTATE_MODE, rot},
- {NULL, NULL, NULL, "insertPoint", INSERTPOINT_MODE, ins},
- {NULL, NULL, NULL, "thermal", THERMAL_MODE, thrm},
- {NULL, NULL, NULL, "select", ARROW_MODE, sel},
- {NULL, NULL, NULL, "lock", LOCK_MODE, lock}
+ {NULL, NULL, 0, 0, "via", VIA_MODE, via},
+ {NULL, NULL, 0, 0, "line", LINE_MODE, line},
+ {NULL, NULL, 0, 0, "arc", ARC_MODE, arc},
+ {NULL, NULL, 0, 0, "text", TEXT_MODE, text},
+ {NULL, NULL, 0, 0, "rectangle", RECTANGLE_MODE, rect},
+ {NULL, NULL, 0, 0, "polygon", POLYGON_MODE, poly},
+ {NULL, NULL, 0, 0, "polygonhole", POLYGONHOLE_MODE, polyhole},
+ {NULL, NULL, 0, 0, "buffer", PASTEBUFFER_MODE, buf},
+ {NULL, NULL, 0, 0, "remove", REMOVE_MODE, del},
+ {NULL, NULL, 0, 0, "rotate", ROTATE_MODE, rot},
+ {NULL, NULL, 0, 0, "insertPoint", INSERTPOINT_MODE, ins},
+ {NULL, NULL, 0, 0, "thermal", THERMAL_MODE, thrm},
+ {NULL, NULL, 0, 0, "select", ARROW_MODE, sel},
+ {NULL, NULL, 0, 0, "lock", LOCK_MODE, lock}
};
static gint n_mode_buttons = G_N_ELEMENTS (mode_buttons);
+static void
+do_set_mode (int mode)
+{
+ SetMode (mode);
+ ghid_mode_cursor (mode);
+ ghidgui->settings_mode = mode;
+}
+
+static void
+mode_toolbar_button_toggled_cb (GtkToggleButton *button, ModeButton * mb)
+{
+ gboolean active = gtk_toggle_button_get_active (button);
+
+ if (mb->button != NULL)
+ {
+ g_signal_handler_block (mb->button, mb->button_cb_id);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mb->button), active);
+ g_signal_handler_unblock (mb->button, mb->button_cb_id);
+ }
+
+ if (active)
+ do_set_mode (mb->mode);
+}
static void
mode_button_toggled_cb (GtkWidget * widget, ModeButton * mb)
{
gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
- if (active)
+ if (mb->toolbar_button != NULL)
{
- SetMode (mb->mode);
- ghid_mode_cursor (mb->mode);
- ghidgui->settings_mode = mb->mode;
- }
+ g_signal_handler_block (mb->toolbar_button, mb->toolbar_button_cb_id);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mb->toolbar_button), active);
+ g_signal_handler_unblock (mb->toolbar_button, mb->toolbar_button_cb_id);
+ }
+
+ if (active)
+ do_set_mode (mb->mode);
}
void
@@ -1059,103 +1088,106 @@ ghid_mode_buttons_update (void)
{
mb = &mode_buttons[i];
if (Settings.Mode == mb->mode)
- {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mb->button), TRUE);
- break;
- }
+ {
+ g_signal_handler_block (mb->button, mb->button_cb_id);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mb->button), TRUE);
+ g_signal_handler_unblock (mb->button, mb->button_cb_id);
+
+ g_signal_handler_block (mb->toolbar_button, mb->toolbar_button_cb_id);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mb->toolbar_button), TRUE);
+ g_signal_handler_unblock (mb->toolbar_button, mb->toolbar_button_cb_id);
+ break;
+ }
}
}
void
-ghid_pack_mode_buttons(void)
+ghid_pack_mode_buttons (void)
{
- ModeButton *mb;
- gint i;
- static gint last_pack_compact = -1;
-
- if (last_pack_compact >= 0)
- {
- if (last_pack_compact)
- gtk_container_remove(GTK_CONTAINER(ghidgui->mode_buttons1_vbox),
- ghidgui->mode_buttons1_frame);
- else
- gtk_container_remove(GTK_CONTAINER(ghidgui->mode_buttons0_frame_vbox),
- ghidgui->mode_buttons0_frame);
-
- for (i = 0; i < n_mode_buttons; ++i)
- {
- mb = &mode_buttons[i];
- if (last_pack_compact)
- gtk_container_remove (GTK_CONTAINER (mb->box1), mb->button);
- else
- gtk_container_remove (GTK_CONTAINER (mb->box0), mb->button);
- }
- }
- for (i = 0; i < n_mode_buttons; ++i)
- {
- mb = &mode_buttons[i];
- if (ghidgui->compact_vertical)
- gtk_box_pack_start (GTK_BOX (mb->box1), mb->button, FALSE, FALSE, 0);
- else
- gtk_box_pack_start (GTK_BOX (mb->box0), mb->button, FALSE, FALSE, 0);
- }
- if (ghidgui->compact_vertical)
- {
- gtk_box_pack_start(GTK_BOX(ghidgui->mode_buttons1_vbox),
- ghidgui->mode_buttons1_frame, FALSE, FALSE, 0);
- gtk_widget_show_all(ghidgui->mode_buttons1_frame);
- }
- else
- {
- gtk_box_pack_start(GTK_BOX(ghidgui->mode_buttons0_frame_vbox),
- ghidgui->mode_buttons0_frame, FALSE, FALSE, 0);
- gtk_widget_show_all(ghidgui->mode_buttons0_frame);
- }
- last_pack_compact = ghidgui->compact_vertical;
+ if (ghidgui->compact_vertical)
+ {
+ gtk_widget_hide (ghidgui->mode_buttons_frame);
+ gtk_widget_show_all (ghidgui->mode_toolbar);
+ }
+ else
+ {
+ gtk_widget_hide (ghidgui->mode_toolbar);
+ gtk_widget_show_all (ghidgui->mode_buttons_frame);
+ }
}
static void
-make_mode_buttons (GHidPort * port)
+make_mode_buttons_and_toolbar (GtkWidget **mode_frame,
+ GtkWidget **mode_toolbar)
{
- ModeButton *mb;
- GtkWidget *hbox0 = NULL, *button;
+ GtkToolItem *tool_item;
+ GtkWidget *vbox, *hbox = NULL;
GtkWidget *image;
GdkPixbuf *pixbuf;
GSList *group = NULL;
- gint i;
+ GSList *toolbar_group = NULL;
+ ModeButton *mb;
+ int i;
+
+ *mode_toolbar = gtk_toolbar_new ();
+
+ *mode_frame = gtk_frame_new (NULL);
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (*mode_frame), vbox);
for (i = 0; i < n_mode_buttons; ++i)
{
mb = &mode_buttons[i];
- button = gtk_radio_button_new (group);
- mb->button = button;
- g_object_ref(G_OBJECT(mb->button));
- group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
- gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
+ /* Create tool button for mode frame */
+ mb->button = gtk_radio_button_new (group);
+ group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (mb->button));
+ gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (mb->button), FALSE);
+
+ /* Create tool button for toolbar */
+ mb->toolbar_button = gtk_radio_button_new (toolbar_group);
+ toolbar_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (mb->toolbar_button));
+ gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (mb->toolbar_button), FALSE);
+
+ /* Pack mode-frame button into the frame */
if ((i % ghidgui->n_mode_button_columns) == 0)
{
- hbox0 = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (ghidgui->mode_buttons0_vbox),
- hbox0, FALSE, FALSE, 0);
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
}
- mb->box0 = hbox0;
+ gtk_box_pack_start (GTK_BOX (hbox), mb->button, FALSE, FALSE, 0);
- mb->box1 = ghidgui->mode_buttons1_hbox;
+ /* Create a container for the toolbar button and add that */
+ tool_item = gtk_tool_item_new ();
+ gtk_container_add (GTK_CONTAINER (tool_item), mb->toolbar_button);
+ gtk_toolbar_insert (GTK_TOOLBAR (*mode_toolbar), tool_item, -1);
+ /* Load the image for the button, create GtkImage widgets for both
+ * the grid button and the toolbar button, then pack into the buttons
+ */
pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) mb->xpm);
image = gtk_image_new_from_pixbuf (pixbuf);
- g_object_unref (G_OBJECT (pixbuf));
+ gtk_container_add (GTK_CONTAINER (mb->button), image);
+ image = gtk_image_new_from_pixbuf (pixbuf);
+ gtk_container_add (GTK_CONTAINER (mb->toolbar_button), image);
+ g_object_unref (pixbuf);
- gtk_container_add (GTK_CONTAINER (button), image);
- if (!strcmp (mb->name, "select"))
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
- g_signal_connect (button, "toggled",
- G_CALLBACK (mode_button_toggled_cb), mb);
+ if (strcmp (mb->name, "select") == 0)
+ {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mb->button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mb->toolbar_button), TRUE);
+ }
+
+ mb->button_cb_id =
+ g_signal_connect (mb->button, "toggled",
+ G_CALLBACK (mode_button_toggled_cb), mb);
+ mb->toolbar_button_cb_id =
+ g_signal_connect (mb->toolbar_button, "toggled",
+ G_CALLBACK (mode_toolbar_button_toggled_cb), mb);
}
- ghid_pack_mode_buttons();
}
+
/*
* ---------------------------------------------------------------
* Top window
@@ -1213,9 +1245,9 @@ ghid_build_pcb_top_window (void)
gtk_box_pack_start (GTK_BOX (ghidgui->top_hbox), ghidgui->menu_hbox,
FALSE, FALSE, 0);
- ghidgui->mode_buttons1_vbox = gtk_vbox_new (FALSE, 0);
+ ghidgui->menubar_toolbar_vbox = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (ghidgui->menu_hbox),
- ghidgui->mode_buttons1_vbox, FALSE, FALSE, 0);
+ ghidgui->menubar_toolbar_vbox, FALSE, FALSE, 0);
/* Build layer menus */
ghidgui->layer_selector = ghid_layer_selector_new ();
@@ -1230,15 +1262,14 @@ ghid_build_pcb_top_window (void)
/* Build main menu */
ghidgui->menu_bar = ghid_load_menus ();
make_actions (port);
- gtk_box_pack_start (GTK_BOX (ghidgui->mode_buttons1_vbox),
+ gtk_box_pack_start (GTK_BOX (ghidgui->menubar_toolbar_vbox),
ghidgui->menu_bar, FALSE, FALSE, 0);
- ghidgui->mode_buttons1_frame = gtk_frame_new (NULL);
- gtk_widget_show (ghidgui->mode_buttons1_frame);
- g_object_ref (ghidgui->mode_buttons1_frame);
- ghidgui->mode_buttons1_hbox = gtk_hbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (ghidgui->mode_buttons1_frame),
- ghidgui->mode_buttons1_hbox);
+ make_mode_buttons_and_toolbar (&ghidgui->mode_buttons_frame,
+ &ghidgui->mode_toolbar);
+ gtk_box_pack_start (GTK_BOX (ghidgui->menubar_toolbar_vbox),
+ ghidgui->mode_toolbar, FALSE, FALSE, 0);
+
ghidgui->position_hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_end (GTK_BOX(ghidgui->top_hbox),
@@ -1264,17 +1295,11 @@ ghid_build_pcb_top_window (void)
gtk_box_pack_start (GTK_BOX(vbox), ghidgui->layer_selector,
FALSE, FALSE, 0);
- ghidgui->mode_buttons0_frame_vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX(ghidgui->left_toolbar),
- ghidgui->mode_buttons0_frame_vbox, FALSE, FALSE, 0);
-
- ghidgui->mode_buttons0_frame = gtk_frame_new (NULL);
- gtk_widget_show (ghidgui->mode_buttons0_frame);
- g_object_ref (ghidgui->mode_buttons0_frame);
- ghidgui->mode_buttons0_vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (ghidgui->mode_buttons0_frame),
- ghidgui->mode_buttons0_vbox);
- make_mode_buttons (port);
+ /* ghidgui->mode_buttons_frame was created above in the call to
+ * make_mode_buttons_and_toolbar (...);
+ */
+ gtk_box_pack_start (GTK_BOX (ghidgui->left_toolbar),
+ ghidgui->mode_buttons_frame, FALSE, FALSE, 0);
frame = gtk_frame_new(NULL);
gtk_box_pack_end (GTK_BOX (ghidgui->left_toolbar), frame, FALSE, FALSE, 0);
@@ -1390,6 +1415,7 @@ ghid_build_pcb_top_window (void)
ghidgui->creating = FALSE;
gtk_widget_show_all (gport->top_window);
+ ghid_pack_mode_buttons ();
gdk_window_set_back_pixmap (gport->drawing_area->window, NULL, FALSE);
ghid_route_style_temp_buttons_hide ();
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 9376605..04bfeb6 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -105,10 +105,11 @@ typedef struct
GtkWidget *top_hbox,
*menu_hbox, *position_hbox,
- *mode_buttons0_vbox, *mode_buttons1_hbox, *mode_buttons1_vbox,
- *mode_buttons0_frame, *mode_buttons1_frame, *mode_buttons0_frame_vbox;
+ *menubar_toolbar_vbox,
+ *mode_buttons_frame;
GtkWidget *left_toolbar;
GtkWidget *menu_bar, *layer_selector;
+ GtkWidget *mode_toolbar;
GtkWidget *h_range, *v_range;
GtkObject *h_adjustment, *v_adjustment;
|
|
From: <gi...@gp...> - 2011-09-03 20:01:06
|
The branch, master has been updated
via a7e3de33107c2cb7fa37f9b55af7776c4e4a8937 (commit)
via bb9412c64dac9dca2e2656c225bcd024e618bd04 (commit)
via 4ecf240381ec73359c5d1a7648d9d2c7b0ff460d (commit)
from e24731d843fdff2752a4b0228c533792ba644959 (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-cell-renderer-visibility.c | 6 ++++++
src/hid/gtk/ghid-layer-selector.c | 9 +++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
=================
Commit Messages
=================
commit a7e3de33107c2cb7fa37f9b55af7776c4e4a8937
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: Prelight toggle swatches in layer selector
This brightens the layer visibility swatches subtly when the
mouse hovers over them. IMHO this improves the discoverability
of the widget without being distracting or misleading.
:100644 100644 2e07c67... ee5f6cb... M src/hid/gtk/ghid-cell-renderer-visibility.c
commit bb9412c64dac9dca2e2656c225bcd024e618bd04
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: Don't gray out invisible layers' text in the selector
:100644 100644 032c515... 84db76e... M src/hid/gtk/ghid-layer-selector.c
commit 4ecf240381ec73359c5d1a7648d9d2c7b0ff460d
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: toggle non-activatable layers on click, without checking for swatch
:100644 100644 a3a313e... 032c515... M src/hid/gtk/ghid-layer-selector.c
=========
Changes
=========
commit a7e3de33107c2cb7fa37f9b55af7776c4e4a8937
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: Prelight toggle swatches in layer selector
This brightens the layer visibility swatches subtly when the
mouse hovers over them. IMHO this improves the discoverability
of the widget without being distracting or misleading.
diff --git a/src/hid/gtk/ghid-cell-renderer-visibility.c b/src/hid/gtk/ghid-cell-renderer-visibility.c
index 2e07c67..ee5f6cb 100644
--- a/src/hid/gtk/ghid-cell-renderer-visibility.c
+++ b/src/hid/gtk/ghid-cell-renderer-visibility.c
@@ -125,6 +125,12 @@ ghid_cell_renderer_visibility_render (GtkCellRenderer *cell,
cairo_stroke (cr);
gdk_color_parse (pcb_cell->color, &color);
+ if (flags & GTK_CELL_RENDERER_PRELIT)
+ {
+ color.red = (4*color.red + 65535) / 5;
+ color.green = (4*color.green + 65535) / 5;
+ color.blue = (4*color.blue + 65535) / 5;
+ }
gdk_cairo_set_source_color (cr, &color);
if (pcb_cell->active)
cairo_rectangle (cr, toggle_rect.x + 0.5, toggle_rect.y + 0.5,
commit bb9412c64dac9dca2e2656c225bcd024e618bd04
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: Don't gray out invisible layers' text in the selector
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index 032c515..84db76e 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -391,7 +391,7 @@ ghid_layer_selector_new (void)
gtk_tree_view_column_new_with_attributes ("", renderer2,
"text", TEXT_COL,
"font", FONT_COL,
- "sensitive", VISIBLE_COL, NULL);
+ NULL);
GHidLayerSelector *ls = g_object_new (GHID_LAYER_SELECTOR_TYPE, NULL);
commit 4ecf240381ec73359c5d1a7648d9d2c7b0ff460d
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: toggle non-activatable layers on click, without checking for swatch
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index a3a313e..032c515 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -203,8 +203,13 @@ button_press_cb (GHidLayerSelector *ls, GdkEventButton *event)
&path, &column, NULL, NULL))
{
GtkTreeIter iter;
+ gboolean activatable;
gtk_tree_model_get_iter (GTK_TREE_MODEL (ls->list_store), &iter, path);
- if (column == ls->visibility_column)
+ gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store), &iter,
+ ACTIVATABLE_COL, &activatable, -1);
+ /* Toggle visibility for non-activatable layers no matter
+ * where you click. */
+ if (column == ls->visibility_column || !activatable)
{
toggle_visibility (ls, &iter, TRUE);
return TRUE;
|
|
From: <gi...@gp...> - 2011-09-03 17:20:31
|
The branch, master has been updated
via e24731d843fdff2752a4b0228c533792ba644959 (commit)
via f04e7e9296c9492516c891f07d09fa5430e626f0 (commit)
from a547c905e1c0964f5e99c9723d3e5e564c111a79 (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-config.c | 30 ---------------------
src/hid/gtk/gui-top-window.c | 60 +++---------------------------------------
src/hid/gtk/gui.h | 7 +++--
3 files changed, 8 insertions(+), 89 deletions(-)
=================
Commit Messages
=================
commit e24731d843fdff2752a4b0228c533792ba644959
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove compact_vbox and compact_hbox
:100644 100644 d29d485... 0833486... M src/hid/gtk/gui-config.c
:100644 100644 7ed1d77... 07019df... M src/hid/gtk/gui-top-window.c
:100644 100644 8c6478f... 9376605... M src/hid/gtk/gui.h
commit f04e7e9296c9492516c891f07d09fa5430e626f0
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Always show the PCB name on the title-bar, not the toolbar
This saves space and reduces code complexity
:100644 100644 cbd46a4... d29d485... M src/hid/gtk/gui-config.c
:100644 100644 fb5a32a... 7ed1d77... M src/hid/gtk/gui-top-window.c
:100644 100644 1cb3865... 8c6478f... M src/hid/gtk/gui.h
=========
Changes
=========
commit e24731d843fdff2752a4b0228c533792ba644959
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove compact_vbox and compact_hbox
diff --git a/src/hid/gtk/gui-config.c b/src/hid/gtk/gui-config.c
index d29d485..0833486 100644
--- a/src/hid/gtk/gui-config.c
+++ b/src/hid/gtk/gui-config.c
@@ -829,20 +829,6 @@ config_compact_horizontal_toggle_cb (GtkToggleButton * button, gpointer data)
gboolean active = gtk_toggle_button_get_active (button);
ghidgui->compact_horizontal = active;
- if (active)
- {
- gtk_container_remove (GTK_CONTAINER (ghidgui->compact_hbox),
- ghidgui->position_hbox);
- gtk_box_pack_end (GTK_BOX (ghidgui->compact_vbox),
- ghidgui->position_hbox, TRUE, FALSE, 0);
- }
- else
- {
- gtk_container_remove (GTK_CONTAINER (ghidgui->compact_vbox),
- ghidgui->position_hbox);
- gtk_box_pack_end(GTK_BOX(ghidgui->compact_hbox), ghidgui->position_hbox,
- FALSE, FALSE, 4);
- }
ghid_set_status_line_label ();
ghidgui->config_modified = TRUE;
}
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 7ed1d77..07019df 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -1240,30 +1240,9 @@ ghid_build_pcb_top_window (void)
gtk_container_add (GTK_CONTAINER (ghidgui->mode_buttons1_frame),
ghidgui->mode_buttons1_hbox);
- ghidgui->compact_hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_end (GTK_BOX(ghidgui->top_hbox),
- ghidgui->compact_hbox, FALSE, FALSE, 0);
-
- ghidgui->compact_vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_end (GTK_BOX (ghidgui->top_hbox), ghidgui->compact_vbox,
- FALSE, FALSE, 0);
-
- /*
- * The position_box pack location depends on user setting of
- * compact horizontal mode.
- */
ghidgui->position_hbox = gtk_hbox_new (FALSE, 0);
- g_object_ref(G_OBJECT(ghidgui->position_hbox)); /* so can remove it */
- if (ghidgui->compact_horizontal)
- {
- gtk_box_pack_end (GTK_BOX (ghidgui->compact_vbox),
- ghidgui->position_hbox, TRUE, FALSE, 0);
- }
- else
- {
- gtk_box_pack_end(GTK_BOX(ghidgui->compact_hbox), ghidgui->position_hbox,
- FALSE, FALSE, 4);
- }
+ gtk_box_pack_end (GTK_BOX(ghidgui->top_hbox),
+ ghidgui->position_hbox, FALSE, FALSE, 4);
make_cursor_position_labels (ghidgui->position_hbox, port);
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 8c6478f..9376605 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -104,7 +104,7 @@ typedef struct
GtkEntry *command_entry;
GtkWidget *top_hbox,
- *menu_hbox, *compact_vbox, *compact_hbox, *position_hbox,
+ *menu_hbox, *position_hbox,
*mode_buttons0_vbox, *mode_buttons1_hbox, *mode_buttons1_vbox,
*mode_buttons0_frame, *mode_buttons1_frame, *mode_buttons0_frame_vbox;
GtkWidget *left_toolbar;
commit f04e7e9296c9492516c891f07d09fa5430e626f0
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Always show the PCB name on the title-bar, not the toolbar
This saves space and reduces code complexity
diff --git a/src/hid/gtk/gui-config.c b/src/hid/gtk/gui-config.c
index cbd46a4..d29d485 100644
--- a/src/hid/gtk/gui-config.c
+++ b/src/hid/gtk/gui-config.c
@@ -122,7 +122,6 @@ static gchar *config_dir, *color_dir;
static ConfigAttribute config_attributes[] = {
{"gui-compact-horizontal", CONFIG_Boolean, &_ghidgui.compact_horizontal},
{"gui-compact-vertical", CONFIG_Boolean, &_ghidgui.compact_vertical},
- {"gui-title-window", CONFIG_Boolean, &_ghidgui.ghid_title_window},
{"use-command-window", CONFIG_Boolean, &_ghidgui.use_command_window},
{"save-in-tmp", CONFIG_Unused, NULL},
{"grid-units", CONFIG_Unused, NULL},
@@ -859,16 +858,6 @@ config_compact_vertical_toggle_cb (GtkToggleButton * button, gpointer data)
}
static void
-config_title_window_cb (GtkToggleButton * button, gpointer data)
-{
- gboolean active = gtk_toggle_button_get_active (button);
-
- ghidgui->ghid_title_window = active;
- ghid_window_set_name_label (ghidgui->name_label_string);
- ghidgui->config_modified = TRUE;
-}
-
-static void
config_general_toggle_cb (GtkToggleButton * button, void * setting)
{
*(gint *)setting = gtk_toggle_button_get_active (button);
@@ -922,11 +911,6 @@ config_general_tab_create (GtkWidget * tab_vbox)
config_compact_vertical_toggle_cb, NULL,
_("Alternate window layout to allow smaller vertical size"));
- ghid_check_button_connected (vbox, NULL, ghidgui->ghid_title_window,
- TRUE, FALSE, FALSE, 2,
- config_title_window_cb, NULL,
- _("Put layout name on the window title bar"));
-
vbox = ghid_category_vbox (tab_vbox, _("Backups"), 4, 2, TRUE, TRUE);
ghid_check_button_connected (vbox, NULL, Settings.SaveInTMP,
TRUE, FALSE, FALSE, 2,
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index fb5a32a..7ed1d77 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -626,29 +626,13 @@ ghid_window_set_name_label (gchar * name)
if (!ghidgui->name_label_string || !*ghidgui->name_label_string)
ghidgui->name_label_string = g_strdup (_("Unnamed"));
- if (!ghidgui->name_label)
- return;
-
if (!PCB->Filename || !*PCB->Filename)
filename = g_strdup(_("Unsaved.pcb"));
else
filename = g_strdup(PCB->Filename);
- if (ghidgui->ghid_title_window)
- {
- gtk_widget_hide (ghidgui->name_label);
- str = g_strdup_printf ("%s%s (%s) - PCB", PCB->Changed ? "*": "",
- ghidgui->name_label_string, filename);
- }
- else
- {
- gtk_widget_show (ghidgui->name_label);
- str = g_strdup_printf (" <b><big>%s</big></b> ",
- ghidgui->name_label_string);
- gtk_label_set_markup (GTK_LABEL (ghidgui->name_label), str);
- str = g_strdup_printf ("%s%s - PCB", PCB->Changed ? "*": "",
- filename);
- }
+ str = g_strdup_printf ("%s%s (%s) - PCB", PCB->Changed ? "*": "",
+ ghidgui->name_label_string, filename);
gtk_window_set_title (GTK_WINDOW (gport->top_window), str);
g_free (str);
g_free (filename);
@@ -1210,7 +1194,6 @@ ghid_build_pcb_top_window (void)
GtkWidget *vbox, *frame;
GtkWidget *label;
GHidPort *port = &ghid_port;
- gchar *s;
GtkWidget *scrolled;
window = gport->top_window;
@@ -1266,20 +1249,6 @@ ghid_build_pcb_top_window (void)
FALSE, FALSE, 0);
/*
- * The board name is optionally in compact_vbox and the position
- * labels will be packed below or to the side.
- */
- ghidgui->name_label = gtk_label_new ("");
- gtk_label_set_use_markup (GTK_LABEL (ghidgui->name_label), TRUE);
- if (ghidgui->name_label_string)
- s = g_strdup_printf (" <b><big>%s</big></b> ", ghidgui->name_label_string);
- else
- s = g_strdup ("<b><big>%s</big></b>");
- gtk_label_set_markup (GTK_LABEL (ghidgui->name_label), s);
- g_free (s);
- gtk_box_pack_start (GTK_BOX (ghidgui->compact_vbox), ghidgui->name_label, TRUE, FALSE, 6);
-
- /*
* The position_box pack location depends on user setting of
* compact horizontal mode.
*/
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 1cb3865..8c6478f 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -96,7 +96,7 @@ typedef struct
GtkActionGroup *main_actions,
*change_selected_actions, *displayed_name_actions;
- GtkWidget *name_label,
+ GtkWidget
*status_line_label,
*cursor_position_relative_label,
*cursor_position_absolute_label,
@@ -126,7 +126,8 @@ typedef struct
small_label_markup,
compact_horizontal,
compact_vertical,
- ghid_title_window, use_command_window, creating;
+ use_command_window,
+ creating;
gint n_mode_button_columns,
top_window_width,
|
|
From: <gi...@gp...> - 2011-09-03 14:57:35
|
The branch, master has been updated
via a547c905e1c0964f5e99c9723d3e5e564c111a79 (commit)
from 3738d564a82aef241d7c953d24faa8c73fc419ef (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 | 31 ++++++++++++-------------------
src/hid/gtk/gui.h | 1 +
2 files changed, 13 insertions(+), 19 deletions(-)
=================
Commit Messages
=================
commit a547c905e1c0964f5e99c9723d3e5e564c111a79
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Don't use a GtkEventBox as a container widget
We weren't making use of the events from the event box, and appeared
just to be using it as a convenient container to allow setting the
sensitivity on our entire left hand toolbar at once.
Scrap the event box widget and just store a pointer to the vbox widget
which the left toobar items are packed into. We can set the sensitivity
on this and get the desired effect.
:100644 100644 95f39a2... fb5a32a... M src/hid/gtk/gui-top-window.c
:100644 100644 8dfc203... 1cb3865... M src/hid/gtk/gui.h
=========
Changes
=========
commit a547c905e1c0964f5e99c9723d3e5e564c111a79
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Don't use a GtkEventBox as a container widget
We weren't making use of the events from the event box, and appeared
just to be using it as a convenient container to allow setting the
sensitivity on our entire left hand toolbar at once.
Scrap the event box widget and just store a pointer to the vbox widget
which the left toobar items are packed into. We can set the sensitivity
on this and get the desired effect.
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 95f39a2..fb5a32a 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -1178,8 +1178,6 @@ make_mode_buttons (GHidPort * port)
* ---------------------------------------------------------------
*/
-static GtkWidget *ghid_left_sensitive_box;
-
static gint
delete_chart_cb (GtkWidget * widget, GdkEvent * event, GHidPort * port)
{
@@ -1208,8 +1206,8 @@ static void
ghid_build_pcb_top_window (void)
{
GtkWidget *window;
- GtkWidget *vbox_main, *vbox_left, *hbox_middle, *hbox;
- GtkWidget *ebox, *vbox, *frame;
+ GtkWidget *vbox_main, *hbox_middle, *hbox;
+ GtkWidget *vbox, *frame;
GtkWidget *label;
GHidPort *port = &ghid_port;
gchar *s;
@@ -1305,26 +1303,21 @@ ghid_build_pcb_top_window (void)
/* -- Left control bar */
- ebox = gtk_event_box_new ();
- gtk_widget_set_events (ebox, GDK_EXPOSURE_MASK);
- gtk_box_pack_start (GTK_BOX (hbox_middle), ebox, FALSE, FALSE, 3);
-
- /*
- * This box will also be made insensitive when the gui needs
+ /*
+ * This box will be made insensitive when the gui needs
* a modal button GetLocation button press.
*/
- ghid_left_sensitive_box = ebox;
-
- vbox_left = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (ebox), vbox_left);
+ ghidgui->left_toolbar = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox_middle),
+ ghidgui->left_toolbar, FALSE, FALSE, 3);
- vbox = ghid_scrolled_vbox(vbox_left, &scrolled,
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ vbox = ghid_scrolled_vbox (ghidgui->left_toolbar, &scrolled,
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX(vbox), ghidgui->layer_selector,
FALSE, FALSE, 0);
ghidgui->mode_buttons0_frame_vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX(vbox_left),
+ gtk_box_pack_start (GTK_BOX(ghidgui->left_toolbar),
ghidgui->mode_buttons0_frame_vbox, FALSE, FALSE, 0);
ghidgui->mode_buttons0_frame = gtk_frame_new (NULL);
@@ -1336,7 +1329,7 @@ ghid_build_pcb_top_window (void)
make_mode_buttons (port);
frame = gtk_frame_new(NULL);
- gtk_box_pack_end(GTK_BOX(vbox_left), frame, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (ghidgui->left_toolbar), frame, FALSE, FALSE, 0);
vbox = gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(frame), vbox);
hbox = gtk_hbox_new(FALSE, 0);
@@ -1514,7 +1507,7 @@ ghid_interface_input_signals_disconnect (void)
void
ghid_interface_set_sensitive (gboolean sensitive)
{
- gtk_widget_set_sensitive (ghid_left_sensitive_box, sensitive);
+ gtk_widget_set_sensitive (ghidgui->left_toolbar, sensitive);
gtk_widget_set_sensitive (ghidgui->menu_hbox, sensitive);
}
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 8dfc203..1cb3865 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -107,6 +107,7 @@ typedef struct
*menu_hbox, *compact_vbox, *compact_hbox, *position_hbox,
*mode_buttons0_vbox, *mode_buttons1_hbox, *mode_buttons1_vbox,
*mode_buttons0_frame, *mode_buttons1_frame, *mode_buttons0_frame_vbox;
+ GtkWidget *left_toolbar;
GtkWidget *menu_bar, *layer_selector;
GtkWidget *h_range, *v_range;
|
|
From: <gi...@gp...> - 2011-09-03 14:41:20
|
The branch, master has been updated
via 3738d564a82aef241d7c953d24faa8c73fc419ef (commit)
from b5ec76a85d0566ef536ea12eac83ba5cda615415 (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-pinout-window.c | 7 ++-----
src/hid/gtk/gui-top-window.c | 7 ++-----
2 files changed, 4 insertions(+), 10 deletions(-)
=================
Commit Messages
=================
commit 3738d564a82aef241d7c953d24faa8c73fc419ef
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Don't pack the drawing area in a GtkViewport widget
(For both the main window and the pinout preview). The GtkViewport
widget is designed to add scroll bars to a widget which doesn't have
native scroll capabilities. We are handling out own scroll-bars, so
the only gain we had from the GtkViewport we added was a shadow
around the widget.
If we decide we want the shadow back, a more appropriate widget to
pack the drawing area with might be a GtkFrame.
:100644 100644 8bd7193... 5b0feef... M src/hid/gtk/gui-pinout-window.c
:100644 100644 1aab00e... 95f39a2... M src/hid/gtk/gui-top-window.c
=========
Changes
=========
commit 3738d564a82aef241d7c953d24faa8c73fc419ef
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Don't pack the drawing area in a GtkViewport widget
(For both the main window and the pinout preview). The GtkViewport
widget is designed to add scroll bars to a widget which doesn't have
native scroll capabilities. We are handling out own scroll-bars, so
the only gain we had from the GtkViewport we added was a shadow
around the widget.
If we decide we want the shadow back, a more appropriate widget to
pack the drawing area with might be a GtkFrame.
diff --git a/src/hid/gtk/gui-pinout-window.c b/src/hid/gtk/gui-pinout-window.c
index 8bd7193..5b0feef 100644
--- a/src/hid/gtk/gui-pinout-window.c
+++ b/src/hid/gtk/gui-pinout-window.c
@@ -62,7 +62,7 @@ pinout_close_cb (GtkWidget * widget, GtkWidget *top_window)
void
ghid_pinout_window_show (GHidPort * out, ElementType * element)
{
- GtkWidget *button, *viewport, *vbox, *hbox, *preview, *top_window;
+ GtkWidget *button, *vbox, *hbox, *preview, *top_window;
gchar *title;
int width, height;
@@ -82,12 +82,9 @@ ghid_pinout_window_show (GHidPort * out, ElementType * element)
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (top_window), vbox);
- viewport = gtk_viewport_new (NULL, NULL);
- gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_IN);
- gtk_box_pack_start (GTK_BOX (vbox), viewport, TRUE, TRUE, 0);
preview = ghid_pinout_preview_new (element);
- gtk_container_add (GTK_CONTAINER (viewport), preview);
+ gtk_box_pack_start (GTK_BOX (vbox), preview, TRUE, TRUE, 0);
ghid_pinout_preview_get_natural_size (GHID_PINOUT_PREVIEW (preview),
&width, &height);
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 1aab00e..95f39a2 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -1209,7 +1209,7 @@ ghid_build_pcb_top_window (void)
{
GtkWidget *window;
GtkWidget *vbox_main, *vbox_left, *hbox_middle, *hbox;
- GtkWidget *viewport, *ebox, *vbox, *frame;
+ GtkWidget *ebox, *vbox, *frame;
GtkWidget *label;
GHidPort *port = &ghid_port;
gchar *s;
@@ -1352,9 +1352,6 @@ ghid_build_pcb_top_window (void)
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
/* -- The PCB layout output drawing area */
- viewport = gtk_viewport_new (NULL, NULL);
- gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_IN);
- gtk_box_pack_start (GTK_BOX (hbox), viewport, TRUE, TRUE, 0);
gport->drawing_area = gtk_drawing_area_new ();
ghid_init_drawing_widget (gport->drawing_area, gport);
@@ -1373,7 +1370,7 @@ ghid_build_pcb_top_window (void)
*/
GTK_WIDGET_SET_FLAGS (gport->drawing_area, GTK_CAN_FOCUS);
- gtk_container_add (GTK_CONTAINER (viewport), gport->drawing_area);
+ gtk_box_pack_start (GTK_BOX (hbox), gport->drawing_area, TRUE, TRUE, 0);
ghidgui->v_adjustment = gtk_adjustment_new (0.0, 0.0, 100.0,
10.0, 10.0, 10.0);
|
|
From: <gi...@gp...> - 2011-09-03 14:21:51
|
The branch, master has been updated
via b5ec76a85d0566ef536ea12eac83ba5cda615415 (commit)
from 57eabeda63fd819fa34d240b41c3f4cbc8f2a20a (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 | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
=================
Commit Messages
=================
commit b5ec76a85d0566ef536ea12eac83ba5cda615415
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove the vbox used to pack ghidgui->compact_hbox
The main effect here is that the contents of the compact_hbox
will get more vertical space assigned to them if the menu bar
section is taller than the natural size of those widgets.
The visual change seems acceptable, and we could use every bit of
code-cleanup in ghid_build_pcb_top_window()
:100644 100644 5c78543... 1aab00e... M src/hid/gtk/gui-top-window.c
=========
Changes
=========
commit b5ec76a85d0566ef536ea12eac83ba5cda615415
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove the vbox used to pack ghidgui->compact_hbox
The main effect here is that the contents of the compact_hbox
will get more vertical space assigned to them if the menu bar
section is taller than the natural size of those widgets.
The visual change seems acceptable, and we could use every bit of
code-cleanup in ghid_build_pcb_top_window()
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 5c78543..1aab00e 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -1259,16 +1259,13 @@ ghid_build_pcb_top_window (void)
gtk_container_add (GTK_CONTAINER (ghidgui->mode_buttons1_frame),
ghidgui->mode_buttons1_hbox);
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_end(GTK_BOX(ghidgui->top_hbox), vbox,
- FALSE, FALSE, 0);
+ ghidgui->compact_hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_end (GTK_BOX(ghidgui->top_hbox),
+ ghidgui->compact_hbox, FALSE, FALSE, 0);
ghidgui->compact_vbox = gtk_vbox_new (FALSE, 0);
gtk_box_pack_end (GTK_BOX (ghidgui->top_hbox), ghidgui->compact_vbox,
- FALSE, FALSE, 0);
-
- ghidgui->compact_hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), ghidgui->compact_hbox, TRUE, FALSE, 0);
+ FALSE, FALSE, 0);
/*
* The board name is optionally in compact_vbox and the position
|
|
From: <gi...@gp...> - 2011-09-03 14:07:34
|
The branch, master has been updated
via 57eabeda63fd819fa34d240b41c3f4cbc8f2a20a (commit)
via abe9eee3c7ad1f9534ca8d81dc4fcd659e67c4fa (commit)
via 807bd0c38968e7df755df3f90935e5f8e640eecb (commit)
via 8eec5e608210cfd6dd6742392cadf80f80617634 (commit)
from 3258110fb9d36ceb0519271a42b09f9213192211 (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 | 87 ++++++++++++++++++------------------------
src/hid/gtk/gui.h | 2 +-
2 files changed, 38 insertions(+), 51 deletions(-)
=================
Commit Messages
=================
commit 57eabeda63fd819fa34d240b41c3f4cbc8f2a20a
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove some more temporary variable assignments
These make the code harder to follow, as the same temporary variable
is used again and again to refer to different widgets.
:100644 100644 283b345... 5c78543... M src/hid/gtk/gui-top-window.c
commit abe9eee3c7ad1f9534ca8d81dc4fcd659e67c4fa
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Don't use an hbox to pack the board name label
The hbox only has one child, so use the name label directly.
:100644 100644 651f7f5... 283b345... M src/hid/gtk/gui-top-window.c
:100644 100644 e7e5f55... 8dfc203... M src/hid/gtk/gui.h
commit 807bd0c38968e7df755df3f90935e5f8e640eecb
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Skip the generic "hbox" variable when storing the widget anyway
For widgets we keep references to in the ghidgui structure, we avoid
confusion by assigning directly to the more descriptive ghidgui variable.
:100644 100644 badc61b... 651f7f5... M src/hid/gtk/gui-top-window.c
commit 8eec5e608210cfd6dd6742392cadf80f80617634
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Don't pack a frame around the menu bar
:100644 100644 d08a960... badc61b... M src/hid/gtk/gui-top-window.c
=========
Changes
=========
commit 57eabeda63fd819fa34d240b41c3f4cbc8f2a20a
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Remove some more temporary variable assignments
These make the code harder to follow, as the same temporary variable
is used again and again to refer to different widgets.
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 283b345..5c78543 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -1231,8 +1231,10 @@ ghid_build_pcb_top_window (void)
ghidgui->menu_hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (ghidgui->top_hbox), ghidgui->menu_hbox,
FALSE, FALSE, 0);
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(ghidgui->menu_hbox), vbox, FALSE, FALSE, 0);
+
+ ghidgui->mode_buttons1_vbox = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (ghidgui->menu_hbox),
+ ghidgui->mode_buttons1_vbox, FALSE, FALSE, 0);
/* Build layer menus */
ghidgui->layer_selector = ghid_layer_selector_new ();
@@ -1247,19 +1249,20 @@ ghid_build_pcb_top_window (void)
/* Build main menu */
ghidgui->menu_bar = ghid_load_menus ();
make_actions (port);
- gtk_box_pack_start(GTK_BOX(vbox), ghidgui->menu_bar, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (ghidgui->mode_buttons1_vbox),
+ ghidgui->menu_bar, FALSE, FALSE, 0);
- frame = gtk_frame_new(NULL);
- gtk_widget_show(frame);
- g_object_ref(G_OBJECT(frame));
- ghidgui->mode_buttons1_vbox = vbox;
- ghidgui->mode_buttons1_frame = frame;
+ ghidgui->mode_buttons1_frame = gtk_frame_new (NULL);
+ gtk_widget_show (ghidgui->mode_buttons1_frame);
+ g_object_ref (ghidgui->mode_buttons1_frame);
ghidgui->mode_buttons1_hbox = gtk_hbox_new (FALSE, 0);
- gtk_container_add(GTK_CONTAINER(frame), ghidgui->mode_buttons1_hbox);
+ gtk_container_add (GTK_CONTAINER (ghidgui->mode_buttons1_frame),
+ ghidgui->mode_buttons1_hbox);
vbox = gtk_vbox_new(FALSE, 0);
gtk_box_pack_end(GTK_BOX(ghidgui->top_hbox), vbox,
FALSE, FALSE, 0);
+
ghidgui->compact_vbox = gtk_vbox_new (FALSE, 0);
gtk_box_pack_end (GTK_BOX (ghidgui->top_hbox), ghidgui->compact_vbox,
FALSE, FALSE, 0);
@@ -1323,15 +1326,16 @@ ghid_build_pcb_top_window (void)
gtk_box_pack_start (GTK_BOX(vbox), ghidgui->layer_selector,
FALSE, FALSE, 0);
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox_left), vbox, FALSE, FALSE, 0);
- ghidgui->mode_buttons0_frame_vbox = vbox;
- frame = gtk_frame_new(NULL);
- ghidgui->mode_buttons0_frame = frame;
- gtk_widget_show(frame);
- g_object_ref(G_OBJECT(frame));
- ghidgui->mode_buttons0_vbox = gtk_vbox_new(FALSE, 0);
- gtk_container_add(GTK_CONTAINER(frame), ghidgui->mode_buttons0_vbox);
+ ghidgui->mode_buttons0_frame_vbox = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(vbox_left),
+ ghidgui->mode_buttons0_frame_vbox, FALSE, FALSE, 0);
+
+ ghidgui->mode_buttons0_frame = gtk_frame_new (NULL);
+ gtk_widget_show (ghidgui->mode_buttons0_frame);
+ g_object_ref (ghidgui->mode_buttons0_frame);
+ ghidgui->mode_buttons0_vbox = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (ghidgui->mode_buttons0_frame),
+ ghidgui->mode_buttons0_vbox);
make_mode_buttons (port);
frame = gtk_frame_new(NULL);
commit abe9eee3c7ad1f9534ca8d81dc4fcd659e67c4fa
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Don't use an hbox to pack the board name label
The hbox only has one child, so use the name label directly.
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 651f7f5..283b345 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -636,13 +636,13 @@ ghid_window_set_name_label (gchar * name)
if (ghidgui->ghid_title_window)
{
- gtk_widget_hide (ghidgui->label_hbox);
+ gtk_widget_hide (ghidgui->name_label);
str = g_strdup_printf ("%s%s (%s) - PCB", PCB->Changed ? "*": "",
ghidgui->name_label_string, filename);
}
else
{
- gtk_widget_show (ghidgui->label_hbox);
+ gtk_widget_show (ghidgui->name_label);
str = g_strdup_printf (" <b><big>%s</big></b> ",
ghidgui->name_label_string);
gtk_label_set_markup (GTK_LABEL (ghidgui->name_label), str);
@@ -1271,20 +1271,15 @@ ghid_build_pcb_top_window (void)
* The board name is optionally in compact_vbox and the position
* labels will be packed below or to the side.
*/
- ghidgui->label_hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (ghidgui->compact_vbox), ghidgui->label_hbox, TRUE, FALSE, 2);
-
- label = gtk_label_new ("");
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ ghidgui->name_label = gtk_label_new ("");
+ gtk_label_set_use_markup (GTK_LABEL (ghidgui->name_label), TRUE);
if (ghidgui->name_label_string)
- s =
- g_strdup_printf (" <b><big>%s</big></b> ", ghidgui->name_label_string);
+ s = g_strdup_printf (" <b><big>%s</big></b> ", ghidgui->name_label_string);
else
s = g_strdup ("<b><big>%s</big></b>");
- gtk_label_set_markup (GTK_LABEL (label), s);
+ gtk_label_set_markup (GTK_LABEL (ghidgui->name_label), s);
g_free (s);
- gtk_box_pack_start (GTK_BOX (ghidgui->label_hbox), label, FALSE, TRUE, 4);
- ghidgui->name_label = label;
+ gtk_box_pack_start (GTK_BOX (ghidgui->compact_vbox), ghidgui->name_label, TRUE, FALSE, 6);
/*
* The position_box pack location depends on user setting of
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index e7e5f55..8dfc203 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -104,7 +104,7 @@ typedef struct
GtkEntry *command_entry;
GtkWidget *top_hbox,
- *menu_hbox, *compact_vbox, *compact_hbox, *position_hbox, *label_hbox,
+ *menu_hbox, *compact_vbox, *compact_hbox, *position_hbox,
*mode_buttons0_vbox, *mode_buttons1_hbox, *mode_buttons1_vbox,
*mode_buttons0_frame, *mode_buttons1_frame, *mode_buttons0_frame_vbox;
GtkWidget *menu_bar, *layer_selector;
commit 807bd0c38968e7df755df3f90935e5f8e640eecb
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Skip the generic "hbox" variable when storing the widget anyway
For widgets we keep references to in the ghidgui structure, we avoid
confusion by assigning directly to the more descriptive ghidgui variable.
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index badc61b..651f7f5 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -1208,7 +1208,7 @@ static void
ghid_build_pcb_top_window (void)
{
GtkWidget *window;
- GtkWidget *vbox_main, *vbox_left, *hbox_middle, *hbox = NULL;
+ GtkWidget *vbox_main, *vbox_left, *hbox_middle, *hbox;
GtkWidget *viewport, *ebox, *vbox, *frame;
GtkWidget *label;
GHidPort *port = &ghid_port;
@@ -1221,9 +1221,8 @@ ghid_build_pcb_top_window (void)
gtk_container_add (GTK_CONTAINER (window), vbox_main);
/* -- Top control bar */
- hbox = gtk_hbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (vbox_main), hbox, FALSE, FALSE, 0);
- ghidgui->top_hbox = hbox;
+ ghidgui->top_hbox = gtk_hbox_new (FALSE, 4);
+ gtk_box_pack_start (GTK_BOX (vbox_main), ghidgui->top_hbox, FALSE, FALSE, 0);
/*
* menu_hbox will be made insensitive when the gui needs
@@ -1272,9 +1271,8 @@ ghid_build_pcb_top_window (void)
* The board name is optionally in compact_vbox and the position
* labels will be packed below or to the side.
*/
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (ghidgui->compact_vbox), hbox, TRUE, FALSE, 2);
- ghidgui->label_hbox = hbox;
+ ghidgui->label_hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (ghidgui->compact_vbox), ghidgui->label_hbox, TRUE, FALSE, 2);
label = gtk_label_new ("");
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
@@ -1285,7 +1283,7 @@ ghid_build_pcb_top_window (void)
s = g_strdup ("<b><big>%s</big></b>");
gtk_label_set_markup (GTK_LABEL (label), s);
g_free (s);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 4);
+ gtk_box_pack_start (GTK_BOX (ghidgui->label_hbox), label, FALSE, TRUE, 4);
ghidgui->name_label = label;
/*
commit 8eec5e608210cfd6dd6742392cadf80f80617634
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Don't pack a frame around the menu bar
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index d08a960..badc61b 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -586,34 +586,25 @@ make_menu_actions (GtkActionGroup * actions, GHidPort * port)
/*
- * Make a frame for the top menubar, load in actions for the menus and
- * load the ui_manager string.
+ * Load in actions for the menus and layer selector
*/
static void
-make_top_menubar (GtkWidget *menu_bar, GtkWidget * hbox, GHidPort * port)
+make_actions (GHidPort * port)
{
- GtkWidget *frame;
GtkActionGroup *actions;
- frame = gtk_frame_new (NULL);
- gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, TRUE, 0);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
-
actions = gtk_action_group_new ("Actions");
gtk_action_group_set_translation_domain (actions, NULL);
ghidgui->main_actions = actions;
make_menu_actions (actions, port);
- gtk_window_add_accel_group (GTK_WINDOW (gport->top_window),
+ gtk_window_add_accel_group (GTK_WINDOW (port->top_window),
ghid_main_menu_get_accel_group
(GHID_MAIN_MENU (ghidgui->menu_bar)));
- gtk_window_add_accel_group (GTK_WINDOW (gport->top_window),
+ gtk_window_add_accel_group (GTK_WINDOW (port->top_window),
ghid_layer_selector_get_accel_group
(GHID_LAYER_SELECTOR (ghidgui->layer_selector)));
-
- gtk_container_add (GTK_CONTAINER (frame), menu_bar);
-
}
@@ -1243,8 +1234,6 @@ ghid_build_pcb_top_window (void)
FALSE, FALSE, 0);
vbox = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(ghidgui->menu_hbox), vbox, FALSE, FALSE, 0);
- hbox = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
/* Build layer menus */
ghidgui->layer_selector = ghid_layer_selector_new ();
@@ -1258,7 +1247,8 @@ ghid_build_pcb_top_window (void)
NULL);
/* Build main menu */
ghidgui->menu_bar = ghid_load_menus ();
- make_top_menubar (ghidgui->menu_bar, hbox, port);
+ make_actions (port);
+ gtk_box_pack_start(GTK_BOX(vbox), ghidgui->menu_bar, FALSE, FALSE, 0);
frame = gtk_frame_new(NULL);
gtk_widget_show(frame);
|
|
From: <gi...@gp...> - 2011-09-03 01:06:45
|
The branch, master has been updated
via 3258110fb9d36ceb0519271a42b09f9213192211 (commit)
via 6c89151f6c60d2025d7e1e40e482df142483cf48 (commit)
from acbf10c2bf1814c5ffbe13dbcfd03fc9ffcaca89 (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-dialog-size.c | 21 +--------------------
src/misc.c | 23 +++++++++++++++++++++++
src/misc.h | 1 +
src/mymem.c | 13 +++++++------
src/mymem.h | 2 +-
5 files changed, 33 insertions(+), 27 deletions(-)
=================
Commit Messages
=================
commit 3258110fb9d36ceb0519271a42b09f9213192211
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Move make_route_string() from gtk into misc.c
:100644 100644 8cc9185... e3047bb... M src/hid/gtk/gui-dialog-size.c
:100644 100644 ee7e26d... 1000400... M src/misc.c
:100644 100644 49246f1... a0220c0... M src/misc.h
commit 6c89151f6c60d2025d7e1e40e482df142483cf48
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Const-correct StripWhiteSpaceAndDup in mymem.c
:100644 100644 1feb2ef... 73b3ef7... M src/mymem.c
:100644 100644 cbfd47e... a66e349... M src/mymem.h
=========
Changes
=========
commit 3258110fb9d36ceb0519271a42b09f9213192211
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Move make_route_string() from gtk into misc.c
diff --git a/src/hid/gtk/gui-dialog-size.c b/src/hid/gtk/gui-dialog-size.c
index 8cc9185..e3047bb 100644
--- a/src/hid/gtk/gui-dialog-size.c
+++ b/src/hid/gtk/gui-dialog-size.c
@@ -65,25 +65,6 @@ SizesDialog;
static SizesDialog route_sizes;
-static gchar *
-make_route_string(RouteStyleType * rs)
-{
- gchar *str, *s, *t, *colon;
- gint i;
-
- str = g_strdup("");
- for (i = 0; i < NUM_STYLES; ++i, ++rs)
- {
- s = pcb_g_strdup_printf ("%s,%mc,%mc,%mc,%mc", rs->Name,
- rs->Thick, rs->Diameter, rs->Hole, rs->Keepaway);
- colon = (i == NUM_STYLES - 1) ? NULL : (gchar *)":";
- t = str;
- str = g_strconcat (str, s, colon, NULL);
- g_free (t);
- }
- return str;
-}
-
static void
via_hole_cb (GHidCoordEntry * entry, gpointer data)
{
@@ -295,7 +276,7 @@ ghid_route_style_dialog (gint index, RouteStyleType * temp_rst)
Settings.RouteStyle[index] = *rst;
ghidgui->config_modified = TRUE;
- s = make_route_string (&Settings.RouteStyle[0]);
+ s = make_route_string (Settings.RouteStyle, NUM_STYLES);
g_free (Settings.Routes);
Settings.Routes = s;
}
diff --git a/src/misc.c b/src/misc.c
index ee7e26d..1000400 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -890,6 +890,29 @@ GetNum (char **s, const char *default_unit)
return ret_val;
}
+/*! \brief Serializes the route style list
+ * \par Function Description
+ * Right now n_styles should always be set to NUM_STYLES,
+ * since that is the number of route styles ParseRouteString()
+ * expects to parse.
+ */
+char *
+make_route_string (RouteStyleType rs[], int n_styles)
+{
+ GString *str = g_string_new ("");
+ gint i;
+
+ for (i = 0; i < n_styles; ++i)
+ {
+ char *r_string = pcb_g_strdup_printf ("%s,%mc,%mc,%mc,%mc", rs[i].Name,
+ rs[i].Thick, rs[i].Diameter,
+ rs[i].Hole, rs[i].Keepaway);
+ if (i > 0)
+ g_string_append_c (str, ':');
+ g_string_append (str, r_string);
+ }
+ return g_string_free (str, FALSE);
+}
/* ----------------------------------------------------------------------
* parses the routes definition string which is a colon separated list of
diff --git a/src/misc.h b/src/misc.h
index 49246f1..a0220c0 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -63,6 +63,7 @@ void CountHoles (int *, int *, const BoxType *);
BoxTypePtr GetDataBoundingBox (DataTypePtr);
void CenterDisplay (Coord, Coord);
void SetFontInfo (FontTypePtr);
+char *make_route_string (RouteStyleType rs[], int n_styles);
int ParseGroupString (char *, LayerGroupTypePtr, int /* LayerN */);
int ParseRouteString (char *, RouteStyleTypePtr, const char *);
void QuitApplication (void);
commit 6c89151f6c60d2025d7e1e40e482df142483cf48
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Const-correct StripWhiteSpaceAndDup in mymem.c
diff --git a/src/mymem.c b/src/mymem.c
index 1feb2ef..73b3ef7 100644
--- a/src/mymem.c
+++ b/src/mymem.c
@@ -848,9 +848,10 @@ DSClearString (DynamicStringTypePtr Ptr)
* holds only white space characters
*/
char *
-StripWhiteSpaceAndDup (char *S)
+StripWhiteSpaceAndDup (const char *S)
{
- char *p1, *p2;
+ const char *p1, *p2;
+ char *copy;
size_t length;
if (!S || !*S)
@@ -866,10 +867,10 @@ StripWhiteSpaceAndDup (char *S)
/* string is not empty -> allocate memory */
if (length)
{
- p2 = (char *)realloc (NULL, length + 1);
- strncpy (p2, p1, length);
- *(p2 + length) = '\0';
- return (p2);
+ copy = (char *)realloc (NULL, length + 1);
+ strncpy (copy, p1, length);
+ copy[length] = '\0';
+ return (copy);
}
else
return (NULL);
diff --git a/src/mymem.h b/src/mymem.h
index cbfd47e..a66e349 100644
--- a/src/mymem.h
+++ b/src/mymem.h
@@ -100,7 +100,7 @@ void FreePointerListMemory (PointerListTypePtr);
void DSAddCharacter (DynamicStringTypePtr, char);
void DSAddString (DynamicStringTypePtr, const char *);
void DSClearString (DynamicStringTypePtr);
-char *StripWhiteSpaceAndDup (char *);
+char *StripWhiteSpaceAndDup (const char *);
#ifdef NEED_STRDUP
char *strdup (const char *);
|
|
From: <gi...@gp...> - 2011-09-01 00:57:57
|
The branch, master has been updated
via acbf10c2bf1814c5ffbe13dbcfd03fc9ffcaca89 (commit)
from 067143f2d8f7e2f7f90bed5d24801332d8cc08f3 (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 | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
=================
Commit Messages
=================
commit acbf10c2bf1814c5ffbe13dbcfd03fc9ffcaca89
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Attempt to fix logic to flip component / solder group visibility on flip
Should get back to better behaviour. I probably broke this somewhat with
commit f903b4be6b85efc110852f7be40edf8245f0a513, which attempted to
re-state the previous logic in a clearer fashon.
The logic now should:
If flipping sides, and only ONE of the solder / component layers (groups)
is visible, and that layer (group) is _active_, then swap the visibilities
of the component / solder layers (groups), and make the newly visible
layer (group) active.
There are still bugs in this code relating to the assumption that the
first entry in the layer group is the one which is being toggled. This
breaks if the first entry in the group is that corresponding to the silk
for that side of the board.
:100644 100644 4d9fdbe... 7a6b8a8... M src/hid/gtk/gtkhid-main.c
=========
Changes
=========
commit acbf10c2bf1814c5ffbe13dbcfd03fc9ffcaca89
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
hid/gtk: Attempt to fix logic to flip component / solder group visibility on flip
Should get back to better behaviour. I probably broke this somewhat with
commit f903b4be6b85efc110852f7be40edf8245f0a513, which attempted to
re-state the previous logic in a clearer fashon.
The logic now should:
If flipping sides, and only ONE of the solder / component layers (groups)
is visible, and that layer (group) is _active_, then swap the visibilities
of the component / solder layers (groups), and make the newly visible
layer (group) active.
There are still bugs in this code relating to the assumption that the
first entry in the layer group is the one which is being toggled. This
breaks if the first entry in the group is that corresponding to the silk
for that side of the board.
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 4d9fdbe..7a6b8a8 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -1408,12 +1408,12 @@ SwapSides (int argc, char **argv, Coord x, Coord y)
if ((active_group == comp_group && comp_on && !solder_on) ||
(active_group == solder_group && solder_on && !comp_on))
{
- bool new_comp_vis = Settings.ShowSolderSide && active_group == comp_group;
+ bool new_solder_vis = Settings.ShowSolderSide;
ChangeGroupVisibility (PCB->LayerGroups.Entries[comp_group][0],
- new_comp_vis, new_comp_vis);
+ !new_solder_vis, !new_solder_vis);
ChangeGroupVisibility (PCB->LayerGroups.Entries[solder_group][0],
- !new_comp_vis, !new_comp_vis);
+ new_solder_vis, new_solder_vis);
}
return 0;
|
|
From: <gi...@gp...> - 2011-08-31 20:48:43
|
The branch, master has been updated
via 067143f2d8f7e2f7f90bed5d24801332d8cc08f3 (commit)
via 99dcd9a583defebded353ac908c355f95b8ffa53 (commit)
from efe692e8e7539b5bc52a3734da6764bd41826ff8 (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 | 2 +-
src/hid/gtk/gui-top-window.c | 16 +---------------
2 files changed, 2 insertions(+), 16 deletions(-)
=================
Commit Messages
=================
commit 067143f2d8f7e2f7f90bed5d24801332d8cc08f3
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: fix typo preventing layer selector menu items from working
:100644 100644 c7d7030... a3a313e... M src/hid/gtk/ghid-layer-selector.c
commit 99dcd9a583defebded353ac908c355f95b8ffa53
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: remove in_toggle_view recursion-prevention flag
We don't call ToggleView programmatically anywhere, so it is
impossible for there to be recursion.
:100644 100644 7b3e228... d08a960... M src/hid/gtk/gui-top-window.c
=========
Changes
=========
commit 067143f2d8f7e2f7f90bed5d24801332d8cc08f3
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: fix typo preventing layer selector menu items from working
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index c7d7030..a3a313e 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -129,7 +129,7 @@ set_visibility (GHidLayerSelector *ls, GtkTreeIter *iter,
{
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);
+ g_signal_handler_unblock (ldata->view_action, ldata->view_sig_id);
}
}
commit 99dcd9a583defebded353ac908c355f95b8ffa53
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
gtk: remove in_toggle_view recursion-prevention flag
We don't call ToggleView programmatically anywhere, so it is
impossible for there to be recursion.
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 7b3e228..d08a960 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -1877,23 +1877,13 @@ static int
ToggleView (int argc, char **argv, Coord x, Coord y)
{
int i, l;
- static gboolean in_toggle_view = 0;
#ifdef DEBUG_MENUS
- printf ("Starting ToggleView(). in_toggle_view = %d\n", in_toggle_view);
+ puts ("Starting ToggleView().");
#endif
- if (in_toggle_view)
- {
- fprintf (stderr, "ToggleView() called on top of another ToggleView()\n"
- "Please report this and how it happened\n");
- return 0;
- }
-
- in_toggle_view = 1;
if (argc == 0)
{
- in_toggle_view = 0;
AFAIL (toggleview);
}
if (isdigit ((int) argv[0][0]))
@@ -1923,20 +1913,16 @@ ToggleView (int argc, char **argv, Coord x, Coord y)
}
if (l == -1)
{
- in_toggle_view = 0;
AFAIL (toggleview);
}
}
- printf ("ToggleView(): l = %d\n", l);
-
/* Now that we've figured out which toggle button ought to control
* this layer, simply hit the button and let the pre-existing code deal
*/
ghid_layer_selector_toggle_layer
(GHID_LAYER_SELECTOR (ghidgui->layer_selector), l);
- in_toggle_view = 0;
return 0;
}
|
|
From: <gi...@gp...> - 2011-08-31 20:04:42
|
The branch, master has been updated
via efe692e8e7539b5bc52a3734da6764bd41826ff8 (commit)
from c07a6f7bd679489c7430b6b398e9afa926282b08 (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-main-menu.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
=================
Commit Messages
=================
commit efe692e8e7539b5bc52a3734da6764bd41826ff8
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Block signals in ghid_main_menu_update_toggle_state()
The function ghid_main_menu_update_toggle_state() is supposed to
sync the menu checkboxes to the actual state of pcb, by checking
the flags given in the resource file.
If this function is emitting signals and changing pcb's state,
this is a bug. Fortunately, this appears not to be the case, so
the effect of this commit is to eliminate one more use of
ghidgui->toggle_holdoff.
:100644 100644 5693c56... ed4e2e8... M src/hid/gtk/ghid-main-menu.c
=========
Changes
=========
commit efe692e8e7539b5bc52a3734da6764bd41826ff8
Author: Andrew Poelstra <as...@sf...>
Commit: Andrew Poelstra <as...@sf...>
Block signals in ghid_main_menu_update_toggle_state()
The function ghid_main_menu_update_toggle_state() is supposed to
sync the menu checkboxes to the actual state of pcb, by checking
the flags given in the resource file.
If this function is emitting signals and changing pcb's state,
this is a bug. Fortunately, this appears not to be the case, so
the effect of this commit is to eliminate one more use of
ghidgui->toggle_holdoff.
diff --git a/src/hid/gtk/ghid-main-menu.c b/src/hid/gtk/ghid-main-menu.c
index 5693c56..ed4e2e8 100644
--- a/src/hid/gtk/ghid-main-menu.c
+++ b/src/hid/gtk/ghid-main-menu.c
@@ -294,6 +294,8 @@ ghid_main_menu_real_add_resource (GHidMainMenu *menu, GtkMenuShell *shell,
gtk_action_connect_accelerator (action);
g_signal_connect (G_OBJECT (action), "activate", menu->action_cb,
(gpointer) sub_res);
+ g_object_set_data (G_OBJECT (action), "resource",
+ (gpointer) sub_res);
item = gtk_action_create_menu_item (action);
gtk_menu_shell_append (shell, item);
menu->actions = g_list_append (menu->actions, action);
@@ -498,11 +500,16 @@ ghid_main_menu_update_toggle_state (GHidMainMenu *menu,
GList *list;
for (list = menu->actions; list; list = list->next)
{
+ Resource *res = g_object_get_data (G_OBJECT (list->data), "resource");
const char *tf = g_object_get_data (G_OBJECT (list->data),
"checked-flag");
const char *af = g_object_get_data (G_OBJECT (list->data),
"active-flag");
+ g_signal_handlers_block_by_func (G_OBJECT (list->data),
+ menu->action_cb, res);
cb (GTK_ACTION (list->data), tf, af);
+ g_signal_handlers_unblock_by_func (G_OBJECT (list->data),
+ menu->action_cb, res);
}
}
|