1 /* gEDA - GPL Electronic Design Automation
2 * gschem - gEDA Schematic Capture
3 * Copyright (C) 1998-2007 Ales Hvezda
4 * Copyright (C) 1998-2007 gEDA Contributors (see ChangeLog for details)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
27 #ifdef HAVE_LIBDMALLOC
31 /*! \todo Finish function documentation!!!
33 * \par Function Description
36 void x_repaint_background(GSCHEM_TOPLEVEL
*w_current
)
38 TOPLEVEL
*toplevel
= w_current
->toplevel
;
39 if (!w_current
->inside_redraw
) {
40 gdk_gc_set_foreground(
42 x_get_color(toplevel
->background_color
));
44 gdk_draw_rectangle(w_current
->backingstore
,
45 w_current
->gc
, TRUE
, 0, 0,
47 w_current
->win_height
);
48 o_invalidate_all (w_current
);
50 x_grid_draw(w_current
);
56 /*! \todo Finish function documentation!!!
58 * \par Function Description
61 void x_hscrollbar_update(GSCHEM_TOPLEVEL
*w_current
)
63 TOPLEVEL
*toplevel
= w_current
->toplevel
;
64 GtkAdjustment
*hadjustment
;
66 if (w_current
->scrollbars_flag
== FALSE
) {
70 if (w_current
->h_scrollbar
== NULL
) {
74 hadjustment
= gtk_range_get_adjustment (GTK_RANGE (
75 w_current
->h_scrollbar
));
77 hadjustment
->value
= toplevel
->page_current
->left
;
79 hadjustment
->page_size
= fabs(toplevel
->page_current
->right
-
80 toplevel
->page_current
->left
);
82 hadjustment
->page_increment
= hadjustment
->page_size
- 100.0;
85 printf("H %f %f\n", hadjustment
->lower
, hadjustment
->upper
);
86 printf("Hp %f\n", hadjustment
->page_size
);
89 gtk_signal_emit_by_name(GTK_OBJECT(hadjustment
), "changed");
90 gtk_signal_emit_by_name(GTK_OBJECT(hadjustment
), "value_changed");
93 /*! \todo Finish function documentation!!!
95 * \par Function Description
98 void x_vscrollbar_update(GSCHEM_TOPLEVEL
*w_current
)
100 TOPLEVEL
*toplevel
= w_current
->toplevel
;
101 GtkAdjustment
*vadjustment
;
103 if (w_current
->scrollbars_flag
== FALSE
) {
107 if (w_current
->v_scrollbar
== NULL
) {
112 gtk_range_get_adjustment(GTK_RANGE(w_current
->v_scrollbar
));
114 vadjustment
->page_size
= fabs(toplevel
->page_current
->bottom
-
115 toplevel
->page_current
->top
);
117 vadjustment
->page_increment
= vadjustment
->page_size
- 100.0;
120 toplevel
->init_bottom
- toplevel
->page_current
->bottom
;
123 printf("V %f %f\n", vadjustment
->lower
, vadjustment
->upper
);
124 printf("Vp %f\n", vadjustment
->page_size
);
127 gtk_signal_emit_by_name(GTK_OBJECT(vadjustment
), "changed");
128 gtk_signal_emit_by_name(GTK_OBJECT(vadjustment
), "value_changed");
131 /*! \todo Finish function documentation!!!
133 * \par Function Description
136 void x_scrollbars_update(GSCHEM_TOPLEVEL
*w_current
)
138 TOPLEVEL
*toplevel
= w_current
->toplevel
;
139 if (w_current
->scrollbars_flag
== FALSE
) {
143 toplevel
->DONT_REDRAW
= 1;
144 x_hscrollbar_update(w_current
);
145 x_vscrollbar_update(w_current
);
146 toplevel
->DONT_REDRAW
= 0;
150 /*! \todo Finish function documentation!!!
152 * \par Function Description
155 void x_basic_warp_cursor (GtkWidget
* widget
, gint x
, gint y
)
159 int window_x
, window_y
;
161 gdk_window_get_origin (widget
->window
, &window_x
, &window_y
);
163 screen
= gtk_widget_get_screen (widget
);
164 display
= gdk_screen_get_display (screen
);
166 gdk_display_warp_pointer (display
, screen
, window_x
+ x
, window_y
+ y
);