[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (e256b71f5e53d5fe4e2f20c3563c1dc20a17b3a9)
The branch, master has been updated
via e256b71f5e53d5fe4e2f20c3563c1dc20a17b3a9 (commit)
via fc24e82cb90dc29f8d94ab3f8f742e3331eb28cd (commit)
via 68557094b889226e96fdc8b0532c738aa4d321c2 (commit)
via da4dfc2098aaaeaaae0163c1216180b63e2529f6 (commit)
via 30f661098d4a1ae07a55eeab61efdd3cf5c24ecf (commit)
from d78a5ad30f1ad2d183306ec0b4c0e75d9db02ef9 (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 | 45 ++++++++++++++++++++------
src/hid/gtk/gui-output-events.c | 65 ++++++++------------------------------
src/hid/gtk/gui.h | 3 +-
3 files changed, 49 insertions(+), 64 deletions(-)
=================
Commit Messages
=================
commit e256b71f5e53d5fe4e2f20c3563c1dc20a17b3a9
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Allow zooming out past the board size (up to 1/10 viewport size)
The 1/10 viewport size should be the same as the Lesstif HID allows. The
purpose of the limit is to avoid zooming in so small the PCB is lost as a
tiny dot, and also to avoid coodinate overflows when representing screen
coordinats in PCB Coords. (Since we switched to nanometers, this could
potentially raise its head more readily until we move to 64bit integers).
The explicit pan fixup added to ghid_view_zoom_fit() is required as
pan_common() no longer clamps the view back to the origin.
:100644 100644 2e258d1... f5c836c... M src/hid/gtk/gtkhid-main.c
:100644 100644 1c5327d... 81dcd45... M src/hid/gtk/gui-output-events.c
commit fc24e82cb90dc29f8d94ab3f8f742e3331eb28cd
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Remove ghid_port_ranges_pan for new replacement ghid_pan_view_rel
ghid_pan_view_rel() does less heavy lifting directly, sharing common
code with the other view altering routines for zooming and panning.
:100644 100644 cfb75f2... 2e258d1... M src/hid/gtk/gtkhid-main.c
:100644 100644 ba637c3... 1c5327d... M src/hid/gtk/gui-output-events.c
:100644 100644 782b147... 6fe3a04... M src/hid/gtk/gui.h
commit 68557094b889226e96fdc8b0532c738aa4d321c2
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Remove prototype for non-existant ghid_port_ranges_update_ranges
The functionality this prototype implies is in ghid_port_ranges_scale().
:100644 100644 134d2fb... 782b147... M src/hid/gtk/gui.h
commit da4dfc2098aaaeaaae0163c1216180b63e2529f6
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Don't recompute view size in PCB coords in ScrollAction()
We aleady keep around the view size in PCB coords, so use it directly.
:100644 100644 f5deb16... cfb75f2... M src/hid/gtk/gtkhid-main.c
commit 30f661098d4a1ae07a55eeab61efdd3cf5c24ecf
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Add fixup for stored gport->pcb_{x,y} coords when changing view
This updates the stored (in PCB coordinates) mouse pointer location on
the board as we perform a pan / zoom. This is mostly relevant to panning
and clipped zoom operations, as non-clipped zoom operations aim to leave
the mouse pointer at the same PCB coordinate anyway.
:100644 100644 dc2ea56... f5deb16... M src/hid/gtk/gtkhid-main.c
=========
Changes
=========
commit e256b71f5e53d5fe4e2f20c3563c1dc20a17b3a9
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Allow zooming out past the board size (up to 1/10 viewport size)
The 1/10 viewport size should be the same as the Lesstif HID allows. The
purpose of the limit is to avoid zooming in so small the PCB is lost as a
tiny dot, and also to avoid coodinate overflows when representing screen
coordinats in PCB Coords. (Since we switched to nanometers, this could
potentially raise its head more readily until we move to 64bit integers).
The explicit pan fixup added to ghid_view_zoom_fit() is required as
pan_common() no longer clamps the view back to the origin.
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 2e258d1..f5c836c 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -43,11 +43,11 @@ pan_common (GHidPort *port)
* event so convert it back to event coordinates temporarily. */
ghid_pcb_to_event_coords (gport->pcb_x, gport->pcb_y, &event_x, &event_y);
- /* Don't pan so far that we see past the board edges */
- gport->view_x0 = MAX (0, gport->view_x0);
- gport->view_y0 = MAX (0, gport->view_y0);
- gport->view_x0 = MIN (gport->view_x0, PCB->MaxWidth - gport->view_width);
- gport->view_y0 = MIN (gport->view_y0, PCB->MaxHeight - gport->view_height);
+ /* Don't pan so far the board is completely off the screen */
+ port->view_x0 = MAX (-port->view_width, port->view_x0);
+ port->view_y0 = MAX (-port->view_height, port->view_y0);
+ port->view_x0 = MIN ( port->view_x0, PCB->MaxWidth);
+ port->view_y0 = MIN ( port->view_y0, PCB->MaxHeight);
/* Fix up noted event coordinates to match where we clamped. Alternatively
* we could call ghid_note_event_location (NULL); to get a new pointer
@@ -89,6 +89,7 @@ ghid_pan_view_rel (Coord dx, Coord dy)
* gport->view_width and gport->view_height are in PCB coordinates
*/
+#define ALLOW_ZOOM_OUT_BY 10 /* Arbitrary, and same as the lesstif HID */
static void
ghid_zoom_view_abs (Coord center_x, Coord center_y, double new_zoom)
{
@@ -101,7 +102,7 @@ ghid_zoom_view_abs (Coord center_x, Coord center_y, double new_zoom)
*/
min_zoom = 1;
max_zoom = MAX (PCB->MaxWidth / gport->width,
- PCB->MaxHeight / gport->height);
+ PCB->MaxHeight / gport->height) * ALLOW_ZOOM_OUT_BY;
new_zoom = MIN (MAX (min_zoom, new_zoom), max_zoom);
if (gport->zoom == new_zoom)
@@ -131,6 +132,7 @@ ghid_zoom_view_rel (Coord center_x, Coord center_y, double factor)
static void
ghid_zoom_view_fit (void)
{
+ ghid_pan_view_abs (0, 0, 0, 0);
ghid_zoom_view_abs (0, 0, MAX (PCB->MaxWidth / gport->width,
PCB->MaxHeight / gport->height));
}
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index 1c5327d..81dcd45 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -81,22 +81,19 @@ ghid_port_ranges_scale (void)
gport->view_width = gport->width * gport->zoom;
gport->view_height = gport->height * gport->zoom;
- if (gport->view_width >= PCB->MaxWidth)
- gport->view_width = PCB->MaxWidth;
- if (gport->view_height >= PCB->MaxHeight)
- gport->view_height = PCB->MaxHeight;
-
adj = gtk_range_get_adjustment (GTK_RANGE (ghidgui->h_range));
- adj->page_size = gport->view_width;
- adj->page_increment = adj->page_size/10.0;
- adj->step_increment = adj->page_size/100.0;
- adj->upper = PCB->MaxWidth;
+ adj->page_size = MIN (gport->view_width, PCB->MaxWidth);
+ adj->page_increment = adj->page_size / 10.0;
+ adj->step_increment = adj->page_size / 100.0;
+ adj->lower = -gport->view_width;
+ adj->upper = PCB->MaxWidth + adj->page_size;
adj = gtk_range_get_adjustment (GTK_RANGE (ghidgui->v_range));
- adj->page_size = gport->view_height;
- adj->page_increment = adj->page_size/10.0;
- adj->step_increment = adj->page_size/100.0;
- adj->upper = PCB->MaxHeight;
+ adj->page_size = MIN (gport->view_height, PCB->MaxHeight);
+ adj->page_increment = adj->page_size / 10.0;
+ adj->step_increment = adj->page_size / 100.0;
+ adj->lower = -gport->view_height;
+ adj->upper = PCB->MaxHeight + adj->page_size;
}
commit fc24e82cb90dc29f8d94ab3f8f742e3331eb28cd
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Remove ghid_port_ranges_pan for new replacement ghid_pan_view_rel
ghid_pan_view_rel() does less heavy lifting directly, sharing common
code with the other view altering routines for zooming and panning.
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index cfb75f2..2e258d1 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -72,6 +72,15 @@ ghid_pan_view_abs (Coord pcb_x, Coord pcb_y, int widget_x, int widget_y)
pan_common (gport);
}
+void
+ghid_pan_view_rel (Coord dx, Coord dy)
+{
+ gport->view_x0 += dx;
+ gport->view_y0 += dy;
+
+ pan_common (gport);
+}
+
/* gport->zoom:
* zoom value is PCB units per screen pixel. Larger numbers mean zooming
@@ -1849,7 +1858,7 @@ ScrollAction (int argc, char **argv, Coord x, Coord y)
else
AFAIL (scroll);
- ghid_port_ranges_pan (dx, dy, TRUE);
+ ghid_pan_view_rel (dx, dy);
return 0;
}
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index ba637c3..1c5327d 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -66,42 +66,6 @@ ghid_port_ranges_changed (void)
ghid_invalidate_all ();
}
-gboolean
-ghid_port_ranges_pan (gdouble x, gdouble y, gboolean relative)
-{
- GtkAdjustment *h_adj, *v_adj;
- gdouble x0, y0, x1, y1;
-
- h_adj = gtk_range_get_adjustment (GTK_RANGE (ghidgui->h_range));
- v_adj = gtk_range_get_adjustment (GTK_RANGE (ghidgui->v_range));
- x0 = h_adj->value;
- y0 = v_adj->value;
-
- x1 = relative ? x + x0 : x;
- y1 = relative ? y + y0 : y;
-
- if (x1 < h_adj->lower)
- x1 = h_adj->lower;
- if (x1 > h_adj->upper - h_adj->page_size)
- x1 = h_adj->upper - h_adj->page_size;
-
- if (y1 < v_adj->lower)
- y1 = v_adj->lower;
- if (y1 > v_adj->upper - v_adj->page_size)
- y1 = v_adj->upper - v_adj->page_size;
-
- ghidgui->adjustment_changed_holdoff = TRUE;
- gtk_range_set_value (GTK_RANGE (ghidgui->h_range), x1);
- gtk_range_set_value (GTK_RANGE (ghidgui->v_range), y1);
- ghidgui->adjustment_changed_holdoff = FALSE;
-
- if ((x0 != x1) || (y0 != y1))
- ghid_port_ranges_changed();
-
- ghid_note_event_location (NULL);
- return ((x0 != x1) || (y0 != y1));
-}
-
/* Do scrollbar scaling based on current port drawing area size and
| overall PCB board size.
*/
@@ -589,7 +553,7 @@ ghid_port_window_motion_cb (GtkWidget * widget,
dx = gport->zoom * (x_prev - ev->x);
dy = gport->zoom * (y_prev - ev->y);
if (x_prev > 0)
- ghid_port_ranges_pan (dx, dy, TRUE);
+ ghid_pan_view_rel (dx, dy);
x_prev = ev->x;
y_prev = ev->y;
return FALSE;
@@ -642,9 +606,11 @@ ghid_pan_idle_cb (gpointer data)
if (gport->has_entered)
return FALSE;
+
dy = gport->zoom * y_pan_speed;
dx = gport->zoom * x_pan_speed;
- return (ghid_port_ranges_pan (dx, dy, TRUE));
+ ghid_pan_view_rel (dx, dy);
+ return TRUE;
}
gint
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 782b147..6fe3a04 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -262,7 +262,6 @@ void ghid_get_pointer (gint *, gint *);
/* gui-output-events.c function prototypes.
*/
void ghid_port_ranges_changed (void);
-gboolean ghid_port_ranges_pan (gdouble x, gdouble y, gboolean relative);
void ghid_port_ranges_scale (void);
gboolean ghid_note_event_location (GdkEventButton * ev);
@@ -504,6 +503,7 @@ void ghid_lead_user_to_location (Coord x, Coord y);
void ghid_cancel_lead_user (void);
/* gtkhid-main.c */
+void ghid_pan_view_rel (Coord dx, Coord dy);
void ghid_get_coords (const char *msg, Coord *x, Coord *y);
gint PCBChanged (int argc, char **argv, Coord x, Coord y);
commit 68557094b889226e96fdc8b0532c738aa4d321c2
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Remove prototype for non-existant ghid_port_ranges_update_ranges
The functionality this prototype implies is in ghid_port_ranges_scale().
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 134d2fb..782b147 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -264,7 +264,6 @@ void ghid_get_pointer (gint *, gint *);
void ghid_port_ranges_changed (void);
gboolean ghid_port_ranges_pan (gdouble x, gdouble y, gboolean relative);
void ghid_port_ranges_scale (void);
-void ghid_port_ranges_update_ranges (void);
gboolean ghid_note_event_location (GdkEventButton * ev);
gboolean have_crosshair_attachments (void);
commit da4dfc2098aaaeaaae0163c1216180b63e2529f6
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Don't recompute view size in PCB coords in ScrollAction()
We aleady keep around the view size in PCB coords, so use it directly.
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index f5deb16..cfb75f2 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -1839,13 +1839,13 @@ ScrollAction (int argc, char **argv, Coord x, Coord y)
div = atoi(argv[1]);
if (strcasecmp (argv[0], "up") == 0)
- dy = -(ghid_port.height * gport->zoom / div);
+ dy = -gport->view_height / div;
else if (strcasecmp (argv[0], "down") == 0)
- dy = ghid_port.height * gport->zoom / div;
+ dy = gport->view_height / div;
else if (strcasecmp (argv[0], "right") == 0)
- dx = ghid_port.width * gport->zoom / div;
+ dx = gport->view_width / div;
else if (strcasecmp (argv[0], "left") == 0)
- dx = -(ghid_port.width * gport->zoom / div);
+ dx = -gport->view_width / div;
else
AFAIL (scroll);
commit 30f661098d4a1ae07a55eeab61efdd3cf5c24ecf
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Add fixup for stored gport->pcb_{x,y} coords when changing view
This updates the stored (in PCB coordinates) mouse pointer location on
the board as we perform a pan / zoom. This is mostly relevant to panning
and clipped zoom operations, as non-clipped zoom operations aim to leave
the mouse pointer at the same PCB coordinate anyway.
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index dc2ea56..f5deb16 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -37,12 +37,24 @@ static void ghid_zoom_view_fit (void);
static void
pan_common (GHidPort *port)
{
+ int event_x, event_y;
+
+ /* We need to fix up the PCB coordinates corresponding to the last
+ * event so convert it back to event coordinates temporarily. */
+ ghid_pcb_to_event_coords (gport->pcb_x, gport->pcb_y, &event_x, &event_y);
+
/* Don't pan so far that we see past the board edges */
gport->view_x0 = MAX (0, gport->view_x0);
gport->view_y0 = MAX (0, gport->view_y0);
gport->view_x0 = MIN (gport->view_x0, PCB->MaxWidth - gport->view_width);
gport->view_y0 = MIN (gport->view_y0, PCB->MaxHeight - gport->view_height);
+ /* Fix up noted event coordinates to match where we clamped. Alternatively
+ * we could call ghid_note_event_location (NULL); to get a new pointer
+ * location, but this costs us an xserver round-trip (on X11 platforms)
+ */
+ ghid_event_to_pcb_coords (event_x, event_y, &gport->pcb_x, &gport->pcb_y);
+
ghidgui->adjustment_changed_holdoff = TRUE;
gtk_range_set_value (GTK_RANGE (ghidgui->h_range), gport->view_x0);
gtk_range_set_value (GTK_RANGE (ghidgui->v_range), gport->view_y0);
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs