[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: x_event.c
User: ahvezda
Date: 06/08/06 11:55:57
Modified: . x_event.c x_preview.c
Log:
Applied two patches (scroll button behavior and preview resizable/scrollable)
by Peter Clifton. Thanks.
Revision Changes Path
1.37 +34 -7 eda/geda/gaf/gschem/src/x_event.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_event.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_event.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- x_event.c 24 Jul 2006 03:29:21 -0000 1.36
+++ x_event.c 6 Aug 2006 15:55:56 -0000 1.37
@@ -1553,11 +1553,6 @@
exit_if_null(w_current);
global_window_current = w_current;
- /* You must have scrollbars enabled if you want to use the scroll wheel */
- if (w_current->scrollbars_flag == FALSE) {
- return 0;
- }
-
/* update the state of the modifiers */
w_current->SHIFTKEY = (event->state & GDK_SHIFT_MASK ) ? 1 : 0;
w_current->CONTROLKEY = (event->state & GDK_CONTROL_MASK) ? 1 : 0;
@@ -1565,25 +1560,51 @@
switch (event->direction) {
case(GDK_SCROLL_UP):
- if (!w_current->CONTROLKEY)
+ if (!w_current->CONTROLKEY && !w_current->SHIFTKEY)
{
+ /* turn the up/down scroll wheel into a zoom in / out */
+ /*! \todo Change "HOTKEY" TO new "MOUSE" specifier?
+ */
+ a_zoom(w_current, ZOOM_IN, HOTKEY, 0);
+ o_undo_savestate(w_current, UNDO_VIEWPORT_ONLY);
+ } else if ( !w_current->CONTROLKEY ) {
+ /* if the control key is not held down, scroll up / down */
+ /* You must have scrollbars enabled if you want to use the scroll wheel to pan */
+ if (w_current->scrollbars_flag == FALSE )
+ return 0;
adj = gtk_range_get_adjustment(GTK_RANGE(w_current->v_scrollbar));
gtk_adjustment_set_value(adj, adj->value - (adj->page_increment / 4));
} else {
/* if the control key is held down, then scroll left as well */
+ /* You must have scrollbars enabled if you want to use the scroll wheel to pan */
+ if (w_current->scrollbars_flag == FALSE )
+ return 0;
adj = gtk_range_get_adjustment(GTK_RANGE(w_current->h_scrollbar));
gtk_adjustment_set_value(adj, adj->value - (adj->page_increment / 4));
}
break;
case(GDK_SCROLL_DOWN):
- if (!w_current->CONTROLKEY)
+ if (!w_current->CONTROLKEY && !w_current->SHIFTKEY)
{
+ /* turn the up/down scroll wheel into a zoom in / out */
+ /*! \todo Change "HOTKEY" TO new "MOUSE" specifier?
+ */
+ a_zoom(w_current, ZOOM_OUT, HOTKEY, 0);
+ o_undo_savestate(w_current, UNDO_VIEWPORT_ONLY);
+ } else if ( !w_current->CONTROLKEY ) {
+ /* if the control key is not held down, scroll up / down */
+ /* You must have scrollbars enabled if you want to use the scroll wheel to pan */
+ if (w_current->scrollbars_flag == FALSE )
+ return 0;
adj = gtk_range_get_adjustment(GTK_RANGE(w_current->v_scrollbar));
gtk_adjustment_set_value(adj, min(adj->value + (adj->page_increment / 4),
adj->upper - adj->page_size));
} else {
/* if the control key is held down, then scroll right as well */
+ /* You must have scrollbars enabled if you want to use the scroll wheel to pan */
+ if (w_current->scrollbars_flag == FALSE )
+ return 0;
adj = gtk_range_get_adjustment(GTK_RANGE(w_current->h_scrollbar));
gtk_adjustment_set_value(adj, min(adj->value + (adj->page_increment / 4),
adj->upper - adj->page_size));
@@ -1591,11 +1612,17 @@
break;
case(GDK_SCROLL_LEFT):
+ /* You must have scrollbars enabled if you want to use the scroll wheel to pan */
+ if (w_current->scrollbars_flag == FALSE)
+ return 0;
adj = gtk_range_get_adjustment(GTK_RANGE(w_current->h_scrollbar));
gtk_adjustment_set_value(adj, adj->value - (adj->page_increment / 4));
break;
case(GDK_SCROLL_RIGHT):
+ /* You must have scrollbars enabled if you want to use the scroll wheel to pan */
+ if (w_current->scrollbars_flag == FALSE)
+ return 0;
adj = gtk_range_get_adjustment(GTK_RANGE(w_current->h_scrollbar));
gtk_adjustment_set_value(adj, min(adj->value + (adj->page_increment / 4),
adj->upper - adj->page_size));
1.12 +13 -0 eda/geda/gaf/gschem/src/x_preview.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_preview.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_preview.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- x_preview.c 14 Jul 2006 02:23:55 -0000 1.11
+++ x_preview.c 6 Aug 2006 15:55:56 -0000 1.12
@@ -270,6 +270,7 @@
* 1.3333333 is the desired aspect ratio!
*/
+ /* TODO: BUG: This call is deprecated, and should use gtk_widget_set_size_request() instead */
gtk_drawing_area_size (GTK_DRAWING_AREA (w_current->drawing_area),
w_current->win_width,
w_current->win_height);
@@ -291,6 +292,11 @@
preview->window = preview->drawing_area->window;
gtk_widget_grab_focus (preview->drawing_area);
+ preview->width = preview->drawing_area->allocation.width;
+ preview->height = preview->drawing_area->allocation.height;
+ preview->win_width = preview->width;
+ preview->win_height = preview->height;
+
preview->backingstore = gdk_pixmap_new (
preview->window,
preview->drawing_area->allocation.width,
@@ -307,6 +313,10 @@
We don't want to autosave previews!! */
preview->auto_save_interval = 0;
+ /* i_vars_set will set the scrollbars_flag to TRUE, so we need
+ to re-disable it. (Othewise scroll wheel events cause a crash) */
+ preview->scrollbars_flag = FALSE;
+
/* be sure to turn off the grid */
preview->grid = FALSE;
@@ -352,6 +362,8 @@
{ "key_press_event", G_CALLBACK (x_preview_key_press) },
#endif
{ "motion_notify_event", G_CALLBACK (x_preview_motion) },
+ { "configure_event", G_CALLBACK (x_event_configure) },
+ { "scroll_event", G_CALLBACK (x_event_scroll) },
{ NULL, NULL }
}, *tmp;
TOPLEVEL *preview_toplevel;
@@ -362,6 +374,7 @@
preview_toplevel->init_top = 0;
preview_toplevel->init_right = WIDTH_C;
preview_toplevel->init_bottom = HEIGHT_C;
+ // TODO: BUG - Fixed preview size??
preview_toplevel->width = 160;
preview_toplevel->height = 120;
preview_toplevel->win_width = preview_toplevel->width;
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs