[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: branch: master updated (1.1.2.20070818-76-gf914d43)
The branch, master has been updated
via f914d437f4a76df5ba28e80e7dab6f55996a8b59 (commit)
from 3da83d39b58ab2cb642b93b798ec31be0a725d81 (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
=========
gschem/include/Makefile.am | 3 +-
gschem/include/globals.h | 2 +-
gschem/include/gschem_dialog.h | 4 +-
gschem/include/gschem_struct.h | 200 +++++++++++++
gschem/include/prototype.h | 641 ++++++++++++++++++++--------------------
gschem/include/x_preview.h | 2 +-
gschem/src/Makefile.am | 3 +-
gschem/src/a_pan.c | 106 ++++----
gschem/src/a_zoom.c | 87 +++---
gschem/src/g_funcs.c | 27 +-
gschem/src/g_hook.c | 94 +++---
gschem/src/g_keys.c | 9 +-
gschem/src/g_rc.c | 1 +
gschem/src/g_register.c | 1 +
gschem/src/globals.c | 3 +-
gschem/src/gschem.c | 14 +-
gschem/src/gschem_dialog.c | 27 +-
gschem/src/gschem_toplevel.c | 210 +++++++++++++
gschem/src/i_basic.c | 54 ++--
gschem/src/i_callbacks.c | 545 +++++++++++++++++-----------------
gschem/src/i_vars.c | 66 +++--
gschem/src/o_arc.c | 139 +++++----
gschem/src/o_attrib.c | 72 +++---
gschem/src/o_basic.c | 112 ++++----
gschem/src/o_box.c | 133 +++++----
gschem/src/o_buffer.c | 96 ++++---
gschem/src/o_bus.c | 132 +++++----
gschem/src/o_circle.c | 123 ++++----
gschem/src/o_complex.c | 222 +++++++-------
gschem/src/o_copy.c | 167 ++++++-----
gschem/src/o_cue.c | 112 ++++----
gschem/src/o_delete.c | 98 ++++---
gschem/src/o_find.c | 39 ++--
gschem/src/o_grips.c | 366 ++++++++++++-----------
gschem/src/o_line.c | 120 ++++----
gschem/src/o_misc.c | 251 ++++++++--------
gschem/src/o_move.c | 127 +++++----
gschem/src/o_net.c | 203 +++++++------
gschem/src/o_picture.c | 170 ++++++-----
gschem/src/o_pin.c | 116 ++++----
gschem/src/o_select.c | 83 +++---
gschem/src/o_slot.c | 30 +-
gschem/src/o_text.c | 168 ++++++-----
gschem/src/o_undo.c | 220 +++++++-------
gschem/src/parsecmd.c | 1 +
gschem/src/x_attribedit.c | 29 +-
gschem/src/x_autonumber.c | 69 +++---
gschem/src/x_basic.c | 45 ++--
gschem/src/x_color.c | 1 +
gschem/src/x_compselect.c | 74 +++---
gschem/src/x_dialog.c | 203 +++++++-------
gschem/src/x_event.c | 222 +++++++-------
gschem/src/x_fileselect.c | 48 ++-
gschem/src/x_grid.c | 47 ++--
gschem/src/x_image.c | 368 ++++++++++++-----------
gschem/src/x_log.c | 1 +
gschem/src/x_menus.c | 30 +-
gschem/src/x_multiattrib.c | 155 +++++-----
gschem/src/x_pagesel.c | 93 +++---
gschem/src/x_preview.c | 146 +++++-----
gschem/src/x_print.c | 32 +-
gschem/src/x_script.c | 3 +-
gschem/src/x_stroke.c | 7 +-
gschem/src/x_window.c | 123 ++++----
libgeda/include/struct.h | 270 +-----------------
libgeda/src/s_toplevel.c | 209 +-------------
66 files changed, 3913 insertions(+), 3661 deletions(-)
create mode 100644 gschem/include/gschem_struct.h
create mode 100644 gschem/src/gschem_toplevel.c
=================
Commit Messages
=================
commit f914d437f4a76df5ba28e80e7dab6f55996a8b59
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date: Tue Oct 9 22:05:21 2007 +0100
Split out gschem specific TOPLEVEL variables into a new GSCHEM_TOPLEVEL
GSCHEM_TOPLEVEL has a TOPLEVEL *toplevel pointer as its first elelment,
gschem uses this to call libgeda functions. (Almost) all gschem functions
now take the GSCHEM_TOPLEVEL as their first argument.
:100644 100644 61e4c5b... c893c6b... M gschem/include/Makefile.am
:100644 100644 8075a25... ddc5720... M gschem/include/globals.h
:100644 100644 bf49e4f... 9e1fdf9... M gschem/include/gschem_dialog.h
:000000 100644 0000000... 6ba4d94... A gschem/include/gschem_struct.h
:100644 100644 e9c78a5... 27557a7... M gschem/include/prototype.h
:100644 100644 a24e650... 6a72065... M gschem/include/x_preview.h
:100644 100644 f99ee92... 8072874... M gschem/src/Makefile.am
:100644 100644 4519e46... f9ba6b1... M gschem/src/a_pan.c
:100644 100644 21d244d... e54189f... M gschem/src/a_zoom.c
:100644 100644 231d2f8... 0705d70... M gschem/src/g_funcs.c
:100644 100644 345d737... 88681eb... M gschem/src/g_hook.c
:100644 100644 5e06c75... b01db41... M gschem/src/g_keys.c
:100644 100644 4dafaa6... 0df725a... M gschem/src/g_rc.c
:100644 100644 781a3cb... d4d68e4... M gschem/src/g_register.c
:100644 100644 c7c10d2... 23644d7... M gschem/src/globals.c
:100644 100644 c0aab55... 91ea7de... M gschem/src/gschem.c
:100644 100644 b4eefd0... 0daadbc... M gschem/src/gschem_dialog.c
:000000 100644 0000000... bc8493c... A gschem/src/gschem_toplevel.c
:100644 100644 2397782... 9a6a3c4... M gschem/src/i_basic.c
:100644 100644 0ed83ab... f73b350... M gschem/src/i_callbacks.c
:100644 100644 03be196... ecd5fd4... M gschem/src/i_vars.c
:100644 100644 4a1fddd... 8d93658... M gschem/src/o_arc.c
:100644 100644 6127d64... 2abee7f... M gschem/src/o_attrib.c
:100644 100644 de4f00b... 51ea8ae... M gschem/src/o_basic.c
:100644 100644 a59a0f3... d756534... M gschem/src/o_box.c
:100644 100644 85cfac4... e7d2285... M gschem/src/o_buffer.c
:100644 100644 908f489... 72e7a46... M gschem/src/o_bus.c
:100644 100644 3295fcb... 07cdc26... M gschem/src/o_circle.c
:100644 100644 8e8c736... b8b08cd... M gschem/src/o_complex.c
:100644 100644 0e4656f... 24d1a0c... M gschem/src/o_copy.c
:100644 100644 f60b9fb... 7e75248... M gschem/src/o_cue.c
:100644 100644 535527f... d1046bc... M gschem/src/o_delete.c
:100644 100644 336a190... 192843d... M gschem/src/o_find.c
:100644 100644 c2b893a... 4926a26... M gschem/src/o_grips.c
:100644 100644 bb549ba... 3cda8e9... M gschem/src/o_line.c
:100644 100644 48b28a4... 80c134b... M gschem/src/o_misc.c
:100644 100644 bb9e3da... 4534c09... M gschem/src/o_move.c
:100644 100644 ae8e7b0... 220675c... M gschem/src/o_net.c
:100644 100644 b0462e3... ccb8d2f... M gschem/src/o_picture.c
:100644 100644 ec871ec... 851d986... M gschem/src/o_pin.c
:100644 100644 49a3571... 422c31a... M gschem/src/o_select.c
:100644 100644 da09198... e857d0b... M gschem/src/o_slot.c
:100644 100644 509b31d... 4512867... M gschem/src/o_text.c
:100644 100644 5b60b17... 1d9ab68... M gschem/src/o_undo.c
:100644 100644 3a13f4c... c0888b8... M gschem/src/parsecmd.c
:100644 100644 97a5c42... fd7d23f... M gschem/src/x_attribedit.c
:100644 100644 4e18b1c... 9142a4f... M gschem/src/x_autonumber.c
:100644 100644 3e6b156... adfd031... M gschem/src/x_basic.c
:100644 100644 d411de1... 8205c65... M gschem/src/x_color.c
:100644 100644 9ed8c3d... 3db1db0... M gschem/src/x_compselect.c
:100644 100644 ac78d81... 717a7b6... M gschem/src/x_dialog.c
:100644 100644 0f95cba... 2a9d071... M gschem/src/x_event.c
:100644 100644 adc491f... c23c39d... M gschem/src/x_fileselect.c
:100644 100644 58a0666... 29aba56... M gschem/src/x_grid.c
:100644 100644 2ed738f... af3db6a... M gschem/src/x_image.c
:100644 100644 d209f19... 2c6ac85... M gschem/src/x_log.c
:100644 100644 7256bc6... 2fd0ed3... M gschem/src/x_menus.c
:100644 100644 97c7119... 1f48ccf... M gschem/src/x_multiattrib.c
:100644 100644 2aad9c7... 926622b... M gschem/src/x_pagesel.c
:100644 100644 3791d74... c6f7663... M gschem/src/x_preview.c
:100644 100644 9679b9c... 750d2f0... M gschem/src/x_print.c
:100644 100644 e4a46de... c1508e1... M gschem/src/x_script.c
:100644 100644 1351ba2... 3ee3b8e... M gschem/src/x_stroke.c
:100644 100644 8db910b... de2645f... M gschem/src/x_window.c
:100644 100644 1a677f1... 49a8b2a... M libgeda/include/struct.h
:100644 100644 b53040a... e97a298... M libgeda/src/s_toplevel.c
=========
Changes
=========
commit f914d437f4a76df5ba28e80e7dab6f55996a8b59
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date: Tue Oct 9 22:05:21 2007 +0100
Split out gschem specific TOPLEVEL variables into a new GSCHEM_TOPLEVEL
GSCHEM_TOPLEVEL has a TOPLEVEL *toplevel pointer as its first elelment,
gschem uses this to call libgeda functions. (Almost) all gschem functions
now take the GSCHEM_TOPLEVEL as their first argument.
diff --git a/gschem/include/Makefile.am b/gschem/include/Makefile.am
index 61e4c5b..c893c6b 100644
--- a/gschem/include/Makefile.am
+++ b/gschem/include/Makefile.am
@@ -7,7 +7,8 @@ noinst_HEADERS = \
gettext.h \
x_compselect.h \
x_log.h x_multiattrib.h x_pagesel.h x_print.h x_preview.h \
- gschem_dialog.h
+ gschem_dialog.h \
+ gschem_struct.h
MOSTLYCLEANFILES = *.log core FILE *~
CLEANFILES = *.log core FILE *~
diff --git a/gschem/include/globals.h b/gschem/include/globals.h
index 8075a25..ddc5720 100644
--- a/gschem/include/globals.h
+++ b/gschem/include/globals.h
@@ -19,7 +19,7 @@
*/
/* used by various guile functions, set in x_event* functions */
-extern TOPLEVEL *global_window_current;
+extern GSCHEM_TOPLEVEL *global_window_current;
/* window list */
extern GList *global_window_list;
diff --git a/gschem/include/gschem_dialog.h b/gschem/include/gschem_dialog.h
index bf49e4f..9e1fdf9 100644
--- a/gschem/include/gschem_dialog.h
+++ b/gschem/include/gschem_dialog.h
@@ -50,14 +50,14 @@ struct _GschemDialog {
GtkDialog parent_instance;
gchar *settings_name;
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current;
};
GType gschem_dialog_get_type (void);
GtkWidget* gschem_dialog_new_with_buttons (const gchar *title, GtkWindow *parent, GtkDialogFlags flags,
- const gchar *settings_name, TOPLEVEL *toplevel,
+ const gchar *settings_name, GSCHEM_TOPLEVEL *w_current,
const gchar *first_button_text, ...);
diff --git a/gschem/include/gschem_struct.h b/gschem/include/gschem_struct.h
new file mode 100644
index 0000000..6ba4d94
--- /dev/null
+++ b/gschem/include/gschem_struct.h
@@ -0,0 +1,200 @@
+typedef struct st_gschem_toplevel GSCHEM_TOPLEVEL;
+
+struct st_gschem_toplevel {
+
+ TOPLEVEL *toplevel;
+
+ /* ------------------- */
+ /* main window widgets */
+ /* ------------------- */
+ GtkWidget *main_window;
+
+ GtkWidget *drawing_area;
+ GtkWidget *menubar;
+ GtkWidget *popup_menu;
+
+ GtkWidget *h_scrollbar;
+ GtkWidget *v_scrollbar;
+ GtkObject *h_adjustment;
+ GtkObject *v_adjustment;
+
+ GtkWidget *left_label;
+ GtkWidget *middle_label;
+ GtkWidget *right_label;
+ GtkWidget *grid_label;
+ GtkWidget *status_label;
+
+ GtkWidget *toolbar_select;
+ GtkWidget *toolbar_net;
+ GtkWidget *toolbar_bus;
+
+ gchar *keyaccel_string; /* visual feedback when pressing
+ keyboard accelerators */
+
+ /* ------------ */
+ /* Dialog boxes */
+ /* ------------ */
+ GtkWidget *sowindow; /* Script open */
+ GtkWidget *pfswindow; /* Picture File Selection window */
+ GtkWidget *cswindow; /* component select */
+ GtkWidget *iwindow; /* image write dialog box */
+ GtkWidget *pswindow; /* page select */
+ GtkWidget *tiwindow; /* text input */
+ GtkWidget *tewindow; /* text edit */
+ GtkWidget *sewindow; /* slot edit */
+ GtkWidget *aawindow; /* arc attribs */
+ GtkWidget *mawindow; /* multi attribute */
+ GtkWidget *aewindow; /* attribute edit */
+ GtkWidget *trwindow; /* translate */
+ GtkWidget *tswindow; /* text size */
+ GtkWidget *tshowwindow; /* text show window */
+ GtkWidget *thidewindow; /* text hide window */
+ GtkWidget *tfindwindow; /* text find window */
+ GtkWidget *abwindow; /* Help/About... dialog*/
+ GtkWidget *hkwindow; /* Help/Hotkeys... dialog*/
+ GtkWidget *clwindow; /* Color edit dialog */
+ int edit_color; /* Used by the color edit dialog */
+ GtkWidget *cowindow; /* Coordinate window */
+ GtkWidget *coord_world; /* World coordinate label */
+ GtkWidget *coord_screen; /* Screen coordinate window */
+
+ /* ----------------- */
+ /* Picture placement */
+ /* ----------------- */
+ GdkPixbuf *current_pixbuf; /* used by add picture dialog */
+ double pixbuf_wh_ratio; /* width/height ratio of the pixbuf */
+ char *pixbuf_filename;
+
+
+ /* ---------------- */
+ /* graphics context */
+ /* ---------------- */
+ GdkGC *gc;
+ GdkGC *xor_gc;
+ GdkGC *outline_xor_gc;
+ GdkGC *bounding_xor_gc;
+ GdkGC *bus_gc;
+
+ /* ---------------- */
+ /* Drawing surfaces */
+ /* ---------------- */
+ GdkWindow *window; /* drawing_area's X drawable */
+ GdkPixmap *backingstore; /* backingstore pixmap */
+ int win_width, win_height; /* Actual size of window (?) */
+
+ /* ------------- */
+ /* Drawing state */
+ /* ------------- */
+ int start_x;
+ int start_y;
+ int save_x;
+ int save_y;
+ int last_x;
+ int last_y;
+ int second_x;
+ int second_y;
+ int loc_x, loc_y;
+ int distance;
+ int inside_action; /* Are we doing an action? */
+ int rotated_inside; /* Was the selection rotated
+ inside an action? */
+
+ /* --------------------- */
+ /* Gschem internal state */
+ /* --------------------- */
+ int num_untitled; /* keep track of untitled wins */
+ int event_state; /* Current event state */
+ int image_width, image_height; /* h, w of image write */
+ int grid; /* Grid on/off*/
+ int min_zoom; /* minimum zoom factor */
+ int max_zoom; /* maximum zoom factor */
+ int text_alignment; /* current alignment of text */
+ int inside_redraw; /* complex vs list redrawing */
+ int drawbounding_action_mode; /* outline vs bounding box */
+ int last_drawb_mode; /* last above mode */
+ int CONTROLKEY; /* control key pressed? */
+ int SHIFTKEY; /* shift key pressed? */
+ int ALTKEY; /* alt key pressed? */
+ int doing_pan; /* mouse pan status flag */
+ int buffer_number; /* current paste buffer in use */
+ int complex_rotate; /* Rotation of an object being placed */
+ void (*last_callback)(); /* Last i_call* cmd executed */
+
+ /* ------------------ */
+ /* rc/user parameters */
+ /* ------------------ */
+ int graphic_color;
+ int net_color;
+ int bus_color;
+ int pin_color;
+ int text_color;
+
+ /* not used anywhere yet, but will be */
+ int logic_bubble_color;
+ int zoom_box_color;
+ int grid_color;
+ int select_color;
+ int bb_color;
+ int lock_color;
+ int stroke_color; /* color of the stroke points */
+
+ int text_caps;
+ int text_size;
+
+ int zoom_with_pan;
+
+ int actionfeedback_mode; /* can be either OUTLINE or BOUNDINGBOX */
+ int text_feedback; /* is text is drawn or not in copy/move/place ops */
+ int text_display_zoomfactor; /* zoom factor at which text is displayed completely */
+ int net_endpoint_mode; /* can be either NONE, FILLEDBOX, EMPTYBOX, X */
+ int net_midpoint_mode; /* can be either NONE or FILLED or EMPTY */
+ int embed_complex; /* controls if complex objects are embedded */
+ int include_complex; /* controls if complex objects are included */
+ int scrollbars_flag; /* controls if scrollbars are displayed */
+ int log_window; /* controls if the log windows mapped on startup */
+ int log_window_type; /* controls if the log window is decorated or not */
+ int third_button; /* controls what the third mouse button does */
+ int middle_button; /* controls what the third mouse button does */
+ int file_preview; /* controls if the preview area is enabled or not */
+ int enforce_hierarchy; /* controls how much freedom user has when traversing the hierarchy */
+ int text_origin_marker; /* controls if text origin marker is displayed or not */
+ int fast_mousepan; /* controls if text is completely drawn during mouse pan */
+ int raise_dialog_boxes; /*controls if expose events raise dialog boxes*/
+
+ /* controls if after doing a place the same component can be placed again */
+ int continue_component_place;
+
+ int undo_levels; /* number of undo levels stored on disk */
+ int undo_control; /* sets if undo is enabled or not */
+ int undo_type; /* type of undo (disk/memory) */
+ int undo_panzoom; /* sets if pan / zoom info is saved in undo */
+ int draw_grips; /* sets if grips are enabled or not */
+
+ /* sets whether nets rubberband as you move them (or connecting comps) */
+ int netconn_rubberband;
+
+ int sort_component_library; /* sort the component library */
+ int warp_cursor; /* warp the cursor when zooming */
+ int toolbars; /* sets if the toolbar(s) are enabled or disabled */
+ int handleboxes; /* sets if the handleboxes are enabled or disabled */
+ int bus_ripper_size; /* sets size of the bus rippers */
+ int bus_ripper_type; /* sets type of the bus ripper (component or net) */
+ int bus_ripper_rotation; /* sets if the the bus ripper is symmetric or not */
+ int grid_dot_size; /* sets the grid dot size */
+ int grid_mode; /* sets the mode of the grid (either variable or fixed) */
+
+ /* sets the mininum number of pixels necessary for the grid to be */
+ /* displayed */
+ int grid_fixed_threshold;
+
+ /* sets the offset (in world coordinates) that are added to netname */
+ /* attributes when they are attached to vertical or horizontal nets */
+ int add_attribute_offset;
+
+ int drag_can_move; /* Controls if drag can move objects or not */
+ int mousepan_gain; /* Controls the gain of the mouse pan */
+ int keyboardpan_gain; /* Controls the gain of the keyboard pan */
+ int select_slack_pixels; /* Number of pixels around an object we can still select it with */
+
+};
+
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index e9c78a5..27557a7 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -1,18 +1,20 @@
/* $Id$ */
+/* gschem_toplevel.c */
+GSCHEM_TOPLEVEL *gschem_toplevel_new();
/* a_pan.c */
-void a_pan_general(TOPLEVEL *w_current, double world_cx, double world_cy,
+void a_pan_general(GSCHEM_TOPLEVEL *w_current, double world_cx, double world_cy,
double relativ_zoom_factor, int flags);
-void a_pan(TOPLEVEL *w_current, int x, int y);
-void a_pan_mouse(TOPLEVEL *w_current, int diff_x, int diff_y);
+void a_pan(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void a_pan_mouse(GSCHEM_TOPLEVEL *w_current, int diff_x, int diff_y);
/* a_zoom.c */
-void a_zoom(TOPLEVEL *w_current, int dir, int selected_from, int pan_flags);
-void a_zoom_extents(TOPLEVEL *w_current, OBJECT *o_current, int pan_flags);
-void a_zoom_box(TOPLEVEL *w_current, int pan_flags);
-void a_zoom_box_start(TOPLEVEL *w_current, int x, int y);
-void a_zoom_box_end(TOPLEVEL *w_current, int x, int y);
-void a_zoom_box_rubberband(TOPLEVEL *w_current, int x, int y);
-void correct_aspect(TOPLEVEL *w_current);
+void a_zoom(GSCHEM_TOPLEVEL *w_current, int dir, int selected_from, int pan_flags);
+void a_zoom_extents(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int pan_flags);
+void a_zoom_box(GSCHEM_TOPLEVEL *w_current, int pan_flags);
+void a_zoom_box_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void a_zoom_box_end(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void a_zoom_box_rubberband(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void correct_aspect(GSCHEM_TOPLEVEL *w_current);
/* g_funcs.c */
SCM g_funcs_print(SCM filename);
SCM g_funcs_postscript(SCM filename);
@@ -24,10 +26,10 @@ SCM g_funcs_confirm(SCM msg);
SCM g_funcs_filesel(SCM msg, SCM templ, SCM flags);
SCM g_funcs_browse_wiki(SCM wikiname);
SCM g_funcs_use_rc_values(void);
-SCM get_selected_component_attributes(TOPLEVEL *toplevel);
-SCM get_selected_filename(TOPLEVEL *toplevel);
+SCM get_selected_component_attributes(GSCHEM_TOPLEVEL *w_current);
+SCM get_selected_filename(GSCHEM_TOPLEVEL *w_current);
/* g_hook.c */
-SCM g_make_attrib_smob_list(TOPLEVEL *curr_w, OBJECT *curr_object);
+SCM g_make_attrib_smob_list(GSCHEM_TOPLEVEL *w_current, OBJECT *curr_object);
SCM g_set_attrib_value_x(SCM attrib_smob, SCM scm_value);
SCM g_add_attrib(SCM object, SCM attrib_name,
SCM attrib_value, SCM scm_vis, SCM scm_show);
@@ -42,7 +44,7 @@ SCM g_add_component(SCM page_smob, SCM scm_comp_name, SCM scm_x, SCM scm_y,
SCM scm_angle, SCM scm_selectable, SCM scm_mirror);
SCM g_get_objects_in_page(SCM page_smob);
/* g_keys.c */
-int g_keys_execute(TOPLEVEL *w_current, int state, int keyval);
+int g_keys_execute(GSCHEM_TOPLEVEL *w_current, int state, int keyval);
GArray *g_keys_dump_keymap (void);
SCM g_keys_file_new(void);
SCM g_keys_file_new_window(void);
@@ -285,14 +287,14 @@ void gschem_quit(void);
void main_prog(void *closure, int argc, char *argv[]);
int main(int argc, char *argv[]);
/* i_basic.c */
-void i_show_state(TOPLEVEL *w_current, const char *message);
-void i_set_state(TOPLEVEL *w_current, enum x_states newstate);
-void i_set_state_msg(TOPLEVEL *w_current, enum x_states newstate, const char *message);
-void i_update_middle_button(TOPLEVEL *w_current, void (*func_ptr)(gpointer, guint, GtkWidget*), const char *string);
-void i_update_toolbar(TOPLEVEL *w_current);
-void i_update_menus(TOPLEVEL *w_current);
-void i_set_filename(TOPLEVEL *w_current, const gchar *string);
-void i_set_grid(TOPLEVEL *w_current, int visible_grid);
+void i_show_state(GSCHEM_TOPLEVEL *w_current, const char *message);
+void i_set_state(GSCHEM_TOPLEVEL *w_current, enum x_states newstate);
+void i_set_state_msg(GSCHEM_TOPLEVEL *w_current, enum x_states newstate, const char *message);
+void i_update_middle_button(GSCHEM_TOPLEVEL *w_current, void (*func_ptr)(gpointer, guint, GtkWidget*), const char *string);
+void i_update_toolbar(GSCHEM_TOPLEVEL *w_current);
+void i_update_menus(GSCHEM_TOPLEVEL *w_current);
+void i_set_filename(GSCHEM_TOPLEVEL *w_current, const gchar *string);
+void i_set_grid(GSCHEM_TOPLEVEL *w_current, int visible_grid);
/* i_callbacks.c */
void i_callback_file_new(gpointer data, guint callback_action, GtkWidget *widget);
void i_callback_toolbar_file_new(GtkWidget *widget, gpointer data);
@@ -441,45 +443,45 @@ void i_callback_help_hotkeys(gpointer data, guint callback_action, GtkWidget *wi
void i_callback_options_show_coord_window(gpointer data, guint callback_action, GtkWidget *widget);
gboolean i_callback_close_wm(GtkWidget *widget, GdkEvent *event, gpointer data);
/* i_vars.c */
-void i_vars_set(TOPLEVEL *w_current);
+void i_vars_set(GSCHEM_TOPLEVEL *w_current);
/* o_arc.c */
-void o_arc_draw(TOPLEVEL *w_current, OBJECT *o_current);
+void o_arc_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
void o_arc_draw_solid(GdkWindow *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint x, gint y, gint radius, gint angle1, gint angle2, gint arc_width, gint length, gint space);
void o_arc_draw_dotted(GdkWindow *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint x, gint y, gint radius, gint angle1, gint angle2, gint arc_width, gint length, gint space);
void o_arc_draw_dashed(GdkWindow *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint x, gint y, gint radius, gint angle1, gint angle2, gint arc_width, gint length, gint space);
void o_arc_draw_center(GdkWindow *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint x, gint y, gint radius, gint angle1, gint angle2, gint arc_width, gint length, gint space);
void o_arc_draw_phantom(GdkWindow *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint x, gint y, gint radius, gint angle1, gint angle2, gint arc_width, gint length, gint space);
-void o_arc_erase(TOPLEVEL *w_current, OBJECT *o_current);
-void o_arc_eraserubber(TOPLEVEL *w_current);
-void o_arc_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
-void o_arc_start(TOPLEVEL *w_current, int x, int y);
-void o_arc_end1(TOPLEVEL *w_current, int x, int y);
-void o_arc_end2(TOPLEVEL *w_current, int x, int y);
-void o_arc_end3(TOPLEVEL *w_current, int x, int y);
-void o_arc_end4(TOPLEVEL *w_current, int start_angle, int end_angle);
-void o_arc_rubberarc(TOPLEVEL *w_current, int x, int y, int whichone);
-void o_arc_rubberarc_xor(TOPLEVEL *w_current);
-void o_arc_draw_grips(TOPLEVEL *w_current, OBJECT *o_current);
-void o_arc_erase_grips(TOPLEVEL *w_current, OBJECT *o_current);
+void o_arc_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_arc_eraserubber(GSCHEM_TOPLEVEL *w_current);
+void o_arc_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
+void o_arc_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_arc_end1(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_arc_end2(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_arc_end3(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_arc_end4(GSCHEM_TOPLEVEL *w_current, int start_angle, int end_angle);
+void o_arc_rubberarc(GSCHEM_TOPLEVEL *w_current, int x, int y, int whichone);
+void o_arc_rubberarc_xor(GSCHEM_TOPLEVEL *w_current);
+void o_arc_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_arc_erase_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
/* o_attrib.c */
-void o_attrib_add_selected(TOPLEVEL *w_current, SELECTION *selection, OBJECT *selected);
-void o_attrib_toggle_visibility(TOPLEVEL *w_current, GList *list);
-void o_attrib_toggle_show_name_value(TOPLEVEL *w_current, GList *list, int new_show_name_value);
-OBJECT *o_attrib_add_attrib(TOPLEVEL *w_current, char *text_string, int visibility, int show_name_value, OBJECT *object);
+void o_attrib_add_selected(GSCHEM_TOPLEVEL *w_current, SELECTION *selection, OBJECT *selected);
+void o_attrib_toggle_visibility(GSCHEM_TOPLEVEL *w_current, GList *list);
+void o_attrib_toggle_show_name_value(GSCHEM_TOPLEVEL *w_current, GList *list, int new_show_name_value);
+OBJECT *o_attrib_add_attrib(GSCHEM_TOPLEVEL *w_current, char *text_string, int visibility, int show_name_value, OBJECT *object);
/* o_basic.c */
-void o_redraw_all(TOPLEVEL *w_current);
-void o_redraw_all_fast(TOPLEVEL *w_current);
-void o_redraw(TOPLEVEL *w_current, OBJECT *object_list, gboolean draw_selected);
-void o_redraw_single(TOPLEVEL *w_current, OBJECT *o_current);
-void o_draw_list(TOPLEVEL *w_current, GList *list);
-void o_draw_selected(TOPLEVEL *w_current);
-void o_erase_selected(TOPLEVEL *w_current);
-void o_erase_single(TOPLEVEL *w_current, OBJECT *object);
-void o_drawbounding(TOPLEVEL *w_current, GList *o_glist, GdkColor *color, int firsttime);
-int o_erase_rubber(TOPLEVEL *w_current);
-int o_redraw_cleanstates(TOPLEVEL *w_current);
+void o_redraw_all(GSCHEM_TOPLEVEL *w_current);
+void o_redraw_all_fast(GSCHEM_TOPLEVEL *w_current);
+void o_redraw(GSCHEM_TOPLEVEL *w_current, OBJECT *object_list, gboolean draw_selected);
+void o_redraw_single(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_draw_list(GSCHEM_TOPLEVEL *w_current, GList *list);
+void o_draw_selected(GSCHEM_TOPLEVEL *w_current);
+void o_erase_selected(GSCHEM_TOPLEVEL *w_current);
+void o_erase_single(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
+void o_drawbounding(GSCHEM_TOPLEVEL *w_current, GList *o_glist, GdkColor *color, int firsttime);
+int o_erase_rubber(GSCHEM_TOPLEVEL *w_current);
+int o_redraw_cleanstates(GSCHEM_TOPLEVEL *w_current);
/* o_box.c */
-void o_box_draw(TOPLEVEL *w_current, OBJECT *o_current);
+void o_box_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
void o_box_draw_solid(GdkDrawable *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint filled, gint x, gint y, gint width, gint height, gint line_width, gint length, gint space);
void o_box_draw_dotted(GdkDrawable *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint filled, gint x, gint y, gint width, gint height, gint line_width, gint length, gint space);
void o_box_draw_dashed(GdkDrawable *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint filled, gint x, gint y, gint width, gint height, gint line_width, gint length, gint space);
@@ -489,248 +491,247 @@ void o_box_fill_hollow(GdkDrawable *w, GdkGC *gc, GdkColor *color, gint x, gint
void o_box_fill_fill(GdkDrawable *w, GdkGC *gc, GdkColor *color, gint x, gint y, gint width, gint height, gint fill_width, gint angle1, gint pitch1, gint angle2, gint pitch2);
void o_box_fill_hatch(GdkDrawable *w, GdkGC *gc, GdkColor *color, gint x, gint y, gint width, gint height, gint fill_width, gint angle1, gint pitch1, gint angle2, gint pitch2);
void o_box_fill_mesh(GdkDrawable *w, GdkGC *gc, GdkColor *color, gint x, gint y, gint width, gint height, gint fill_width, gint angle1, gint pitch1, gint angle2, gint pitch2);
-void o_box_erase(TOPLEVEL *w_current, OBJECT *o_current);
-void o_box_eraserubber(TOPLEVEL *w_current);
-void o_box_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
-void o_box_start(TOPLEVEL *w_current, int x, int y);
-void o_box_end(TOPLEVEL *w_current, int x, int y);
-void o_box_rubberbox(TOPLEVEL *w_current, int x, int y);
-void o_box_rubberbox_xor(TOPLEVEL *w_current);
-void o_box_draw_grips(TOPLEVEL *w_current, OBJECT *o_current);
-void o_box_erase_grips(TOPLEVEL *w_current, OBJECT *o_current);
+void o_box_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_box_eraserubber(GSCHEM_TOPLEVEL *w_current);
+void o_box_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
+void o_box_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_box_end(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_box_rubberbox(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_box_rubberbox_xor(GSCHEM_TOPLEVEL *w_current);
+void o_box_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_box_erase_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
/* o_buffer.c */
-void o_buffer_copy(TOPLEVEL *w_current, int buf_num);
-void o_buffer_cut(TOPLEVEL *w_current, int buf_num);
-void o_buffer_paste_start(TOPLEVEL *w_current, int screen_x, int screen_y, int buf_num);
-void o_buffer_paste_end(TOPLEVEL *w_current, int screen_x, int screen_y, int buf_num);
-void o_buffer_paste_rubberpaste(TOPLEVEL *w_current, int buf_num);
+void o_buffer_copy(GSCHEM_TOPLEVEL *w_current, int buf_num);
+void o_buffer_cut(GSCHEM_TOPLEVEL *w_current, int buf_num);
+void o_buffer_paste_start(GSCHEM_TOPLEVEL *w_current, int screen_x, int screen_y, int buf_num);
+void o_buffer_paste_end(GSCHEM_TOPLEVEL *w_current, int screen_x, int screen_y, int buf_num);
+void o_buffer_paste_rubberpaste(GSCHEM_TOPLEVEL *w_current, int buf_num);
void o_buffer_init(void);
-void o_buffer_free(TOPLEVEL *w_current);
+void o_buffer_free(GSCHEM_TOPLEVEL *w_current);
/* o_bus.c */
-void o_bus_draw(TOPLEVEL *w_current, OBJECT *o_current);
-void o_bus_erase(TOPLEVEL *w_current, OBJECT *o_current);
-void o_bus_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
-void o_bus_draw_xor_single(TOPLEVEL *w_current, int dx, int dy, int whichone, OBJECT *o_current);
-void o_bus_start(TOPLEVEL *w_current, int x, int y);
-int o_bus_end(TOPLEVEL *w_current, int x, int y);
-void o_bus_rubberbus(TOPLEVEL *w_current, int x, int y);
-void o_bus_eraserubber(TOPLEVEL *w_current);
-void o_bus_xorrubber(TOPLEVEL *w_current);
+void o_bus_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_bus_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_bus_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
+void o_bus_draw_xor_single(GSCHEM_TOPLEVEL *w_current, int dx, int dy, int whichone, OBJECT *o_current);
+void o_bus_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
+int o_bus_end(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_bus_rubberbus(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_bus_eraserubber(GSCHEM_TOPLEVEL *w_current);
+void o_bus_xorrubber(GSCHEM_TOPLEVEL *w_current);
/* o_circle.c */
-void o_circle_draw(TOPLEVEL *w_current, OBJECT *o_current);
+void o_circle_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
void o_circle_fill_hollow(GdkDrawable *w, GdkGC *gc, GdkColor *color, gint x, gint y, gint radius, gint width, gint angle1, gint pitch1, gint angle2, gint pitch2);
void o_circle_fill_fill(GdkDrawable *w, GdkGC *gc, GdkColor *color, gint x, gint y, gint radius, gint width, gint angle1, gint pitch1, gint angle2, gint pitch2);
void o_circle_fill_hatch(GdkDrawable *w, GdkGC *gc, GdkColor *color, gint x, gint y, gint radius, gint width, gint angle1, gint pitch1, gint angle2, gint pitch2);
void o_circle_fill_mesh(GdkDrawable *w, GdkGC *gc, GdkColor *color, gint x, gint y, gint radius, gint width, gint angle1, gint pitch1, gint angle2, gint pitch2);
-void o_circle_erase(TOPLEVEL *w_current, OBJECT *o_current);
-void o_circle_eraserubber(TOPLEVEL *w_current);
-void o_circle_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
-void o_circle_start(TOPLEVEL *w_current, int x, int y);
-void o_circle_end(TOPLEVEL *w_current, int x, int y);
-void o_circle_rubbercircle(TOPLEVEL *w_current, int x, int y);
-void o_circle_rubbercircle_xor(TOPLEVEL *w_current);
-void o_circle_draw_grips(TOPLEVEL *w_current, OBJECT *o_current);
-void o_circle_erase_grips(TOPLEVEL *w_current, OBJECT *o_current);
+void o_circle_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_circle_eraserubber(GSCHEM_TOPLEVEL *w_current);
+void o_circle_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
+void o_circle_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_circle_end(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_circle_rubbercircle(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_circle_rubbercircle_xor(GSCHEM_TOPLEVEL *w_current);
+void o_circle_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_circle_erase_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
/* o_complex.c */
-void o_complex_draw(TOPLEVEL *w_current, OBJECT *o_current);
-void o_complex_erase(TOPLEVEL *w_current, OBJECT *o_current);
-void o_complex_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *complex);
-void o_complex_start(TOPLEVEL *w_current, int screen_x, int screen_y);
-void o_complex_place_changed_run_hook(TOPLEVEL *w_current);
-void o_complex_place_rotate(TOPLEVEL *w_current);
-void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y);
-void o_complex_rubbercomplex(TOPLEVEL *w_current);
-void o_complex_translate_display_single_object(TOPLEVEL *w_current,
+void o_complex_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_complex_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_complex_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *complex);
+void o_complex_start(GSCHEM_TOPLEVEL *w_current, int screen_x, int screen_y);
+void o_complex_place_changed_run_hook(GSCHEM_TOPLEVEL *w_current);
+void o_complex_place_rotate(GSCHEM_TOPLEVEL *w_current);
+void o_complex_end(GSCHEM_TOPLEVEL *w_current, int screen_x, int screen_y);
+void o_complex_rubbercomplex(GSCHEM_TOPLEVEL *w_current);
+void o_complex_translate_display_single_object(GSCHEM_TOPLEVEL *w_current,
int x1, int y1,
OBJECT *o_current);
-void o_complex_translate_display_object_glist(TOPLEVEL *w_current,
+void o_complex_translate_display_object_glist(GSCHEM_TOPLEVEL *w_current,
int x1, int y1,
GList *object_list);
-void o_complex_translate_display(TOPLEVEL *w_current, int x1, int y1, OBJECT *complex);
-void o_complex_translate_all(TOPLEVEL *w_current, int offset);
-void o_complex_rotate_world(TOPLEVEL *w_current, int centerx, int centery, int angle, OBJECT *object);
-int o_complex_mirror_world(TOPLEVEL *w_current, int centerx, int centery, OBJECT *object);
+void o_complex_translate_display(GSCHEM_TOPLEVEL *w_current, int x1, int y1, OBJECT *complex);
+void o_complex_translate_all(GSCHEM_TOPLEVEL *w_current, int offset);
+void o_complex_rotate_world(TOPLEVEL *toplevel, int centerx, int centery, int angle, OBJECT *object);
+int o_complex_mirror_world(TOPLEVEL *toplevel, int centerx, int centery, OBJECT *object);
/* o_copy.c */
-void o_copy_start(TOPLEVEL *w_current, int x, int y);
-void o_copy_end(TOPLEVEL *w_current);
+void o_copy_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_copy_end(GSCHEM_TOPLEVEL *w_current);
/* o_cue.c */
-void o_cue_redraw_all(TOPLEVEL *w_current, OBJECT *head, gboolean draw_selected);
-void o_cue_draw_lowlevel(TOPLEVEL *w_current, OBJECT *object, int whichone);
-void o_cue_erase_lowlevel(TOPLEVEL *w_current, OBJECT *object, int whichone);
-void o_cue_draw_lowlevel_midpoints(TOPLEVEL *w_current, OBJECT *object);
-void o_cue_draw_single(TOPLEVEL *w_current, OBJECT *object);
-void o_cue_erase_single(TOPLEVEL *w_current, OBJECT *object);
-void o_cue_undraw(TOPLEVEL *w_current, OBJECT *object);
-void o_cue_undraw_complex(TOPLEVEL *w_current, OBJECT *object);
-void o_cue_draw_list(TOPLEVEL *w_current, GList *object_list);
-void o_cue_undraw_list(TOPLEVEL *w_current, GList *object_list);
-void o_cue_undraw_objects(TOPLEVEL *w_current, OBJECT *list);
+void o_cue_redraw_all(GSCHEM_TOPLEVEL *w_current, OBJECT *head, gboolean draw_selected);
+void o_cue_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int whichone);
+void o_cue_erase_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int whichone);
+void o_cue_draw_lowlevel_midpoints(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
+void o_cue_draw_single(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
+void o_cue_erase_single(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
+void o_cue_undraw(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
+void o_cue_undraw_complex(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
+void o_cue_draw_list(GSCHEM_TOPLEVEL *w_current, GList *object_list);
+void o_cue_undraw_list(GSCHEM_TOPLEVEL *w_current, GList *object_list);
+void o_cue_undraw_objects(GSCHEM_TOPLEVEL *w_current, OBJECT *list);
/* o_delete.c */
-void o_delete_net(TOPLEVEL *w_current, OBJECT *obj);
-void o_delete_bus(TOPLEVEL *w_current, OBJECT *obj);
-void o_delete_complex(TOPLEVEL *w_current, OBJECT *obj);
-void o_delete_text(TOPLEVEL *w_current, OBJECT *obj);
-void o_delete(TOPLEVEL *w_current);
+void o_delete_net(GSCHEM_TOPLEVEL *w_current, OBJECT *obj);
+void o_delete_bus(GSCHEM_TOPLEVEL *w_current, OBJECT *obj);
+void o_delete_complex(GSCHEM_TOPLEVEL *w_current, OBJECT *obj);
+void o_delete_text(GSCHEM_TOPLEVEL *w_current, OBJECT *obj);
+void o_delete(GSCHEM_TOPLEVEL *w_current);
/* o_find.c */
-gboolean o_find_object(TOPLEVEL *w_current, int screen_x, int screen_y,
+gboolean o_find_object(GSCHEM_TOPLEVEL *w_current, int screen_x, int screen_y,
gboolean deselect_afterwards);
-gboolean o_find_selected_object(TOPLEVEL *w_current, int screen_x, int screen_y);
+gboolean o_find_selected_object(GSCHEM_TOPLEVEL *w_current, int screen_x, int screen_y);
/* o_grips.c */
-OBJECT *o_grips_search_world(TOPLEVEL *w_current, int x, int y, int *whichone);
-OBJECT *o_grips_search_arc_world(TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int size, int *whichone);
-OBJECT *o_grips_search_box_world(TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int size, int *whichone);
-OBJECT *o_grips_search_picture_world(TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int size, int *whichone);
-OBJECT *o_grips_search_circle_world(TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int size, int *whichone);
-OBJECT *o_grips_search_line_world(TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int size, int *whichone);
-int o_grips_start(TOPLEVEL *w_current, int x, int y);
-void o_grips_start_arc(TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int whichone);
-void o_grips_start_box(TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int whichone);
-void o_grips_start_picture(TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int whichone);
-void o_grips_start_circle(TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int whichone);
-void o_grips_start_line(TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int whichone);
-void o_grips_motion(TOPLEVEL *w_current, int x, int y);
-void o_grips_motion_arc(TOPLEVEL *w_current, int x, int y, int whichone);
-void o_grips_motion_box(TOPLEVEL *w_current, int x, int y, int whichone);
-void o_grips_motion_picture(TOPLEVEL *w_current, int x, int y, int whichone);
-void o_grips_motion_circle(TOPLEVEL *w_current, int x, int y, int whichone);
-void o_grips_motion_line(TOPLEVEL *w_current, int x, int y, int whichone);
-void o_grips_end(TOPLEVEL *w_current);
-void o_grips_end_arc(TOPLEVEL *w_current, OBJECT *o_current, int whichone);
-void o_grips_end_box(TOPLEVEL *w_current, OBJECT *o_current, int whichone);
-void o_grips_end_picture(TOPLEVEL *w_current, OBJECT *o_current, int whichone);
-void o_grips_end_circle(TOPLEVEL *w_current, OBJECT *o_current, int whichone);
-void o_grips_end_line(TOPLEVEL *w_current, OBJECT *o_current, int whichone);
-int o_grips_size(TOPLEVEL *w_current);
-void o_grips_draw(TOPLEVEL *w_current, int x, int y);
-void o_grips_erase(TOPLEVEL *w_current, int x, int y);
+OBJECT *o_grips_search_world(GSCHEM_TOPLEVEL *w_current, int x, int y, int *whichone);
+OBJECT *o_grips_search_arc_world(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int size, int *whichone);
+OBJECT *o_grips_search_box_world(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int size, int *whichone);
+OBJECT *o_grips_search_picture_world(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int size, int *whichone);
+OBJECT *o_grips_search_circle_world(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int size, int *whichone);
+OBJECT *o_grips_search_line_world(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int size, int *whichone);
+int o_grips_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_grips_start_arc(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int whichone);
+void o_grips_start_box(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int whichone);
+void o_grips_start_picture(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int whichone);
+void o_grips_start_circle(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int whichone);
+void o_grips_start_line(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int x, int y, int whichone);
+void o_grips_motion(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_grips_motion_arc(GSCHEM_TOPLEVEL *w_current, int x, int y, int whichone);
+void o_grips_motion_box(GSCHEM_TOPLEVEL *w_current, int x, int y, int whichone);
+void o_grips_motion_picture(GSCHEM_TOPLEVEL *w_current, int x, int y, int whichone);
+void o_grips_motion_circle(GSCHEM_TOPLEVEL *w_current, int x, int y, int whichone);
+void o_grips_motion_line(GSCHEM_TOPLEVEL *w_current, int x, int y, int whichone);
+void o_grips_end(GSCHEM_TOPLEVEL *w_current);
+void o_grips_end_arc(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int whichone);
+void o_grips_end_box(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int whichone);
+void o_grips_end_picture(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int whichone);
+void o_grips_end_circle(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int whichone);
+void o_grips_end_line(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int whichone);
+int o_grips_size(GSCHEM_TOPLEVEL *w_current);
+void o_grips_draw(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_grips_erase(GSCHEM_TOPLEVEL *w_current, int x, int y);
/* o_line.c */
-void o_line_draw(TOPLEVEL *w_current, OBJECT *o_current);
+void o_line_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
void o_line_draw_solid(GdkWindow *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint x1, gint y1, gint x2, gint y2, gint line_width, gint length, gint space);
void o_line_draw_dotted(GdkWindow *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint x1, gint y1, gint x2, gint y2, gint line_width, gint length, gint space);
void o_line_draw_dashed(GdkWindow *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint x1, gint y1, gint x2, gint y2, gint line_width, gint length, gint space);
void o_line_draw_center(GdkWindow *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint x1, gint y1, gint x2, gint y2, gint line_width, gint length, gint space);
void o_line_draw_phantom(GdkWindow *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint x1, gint y1, gint x2, gint y2, gint line_width, gint length, gint space);
-void o_line_erase(TOPLEVEL *w_current, OBJECT *o_current);
-void o_line_eraserubber(TOPLEVEL *w_current);
-void o_line_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
-void o_line_start(TOPLEVEL *w_current, int x, int y);
-void o_line_end(TOPLEVEL *w_current, int x, int y);
-void o_line_rubberline(TOPLEVEL *w_current, int x, int y);
-void o_line_rubberline_xor(TOPLEVEL *w_current);
-void o_line_draw_grips(TOPLEVEL *w_current, OBJECT *o_current);
-void o_line_erase_grips(TOPLEVEL *w_current, OBJECT *o_current);
+void o_line_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_line_eraserubber(GSCHEM_TOPLEVEL *w_current);
+void o_line_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
+void o_line_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_line_end(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_line_rubberline(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_line_rubberline_xor(GSCHEM_TOPLEVEL *w_current);
+void o_line_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_line_erase_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
/* o_misc.c */
-void o_edit(TOPLEVEL *w_current, GList *list);
-void o_lock(TOPLEVEL *w_current);
-void o_unlock(TOPLEVEL *w_current);
-void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
- int centerx, int centery);
-void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery);
-void o_edit_show_hidden_lowlevel(TOPLEVEL *w_current, OBJECT *o_list);
-void o_edit_show_hidden(TOPLEVEL *w_current, OBJECT *o_list);
-void o_edit_make_visible(TOPLEVEL *w_current, OBJECT *o_list);
-int o_edit_find_text(TOPLEVEL *w_current, OBJECT *o_list, char *stext, int descend, int skip);
-void o_edit_hide_specific_text(TOPLEVEL *w_current, OBJECT *o_list, char *stext);
-void o_edit_show_specific_text(TOPLEVEL *w_current, OBJECT *o_list, char *stext);
-void o_update_component(TOPLEVEL *w_current, OBJECT *o_current);
-void o_autosave_backups(TOPLEVEL *toplevel);
+void o_edit(GSCHEM_TOPLEVEL *w_current, GList *list);
+void o_lock(GSCHEM_TOPLEVEL *w_current);
+void o_unlock(GSCHEM_TOPLEVEL *w_current);
+void o_rotate_90_world(GSCHEM_TOPLEVEL *w_current, GList *list, int centerx, int centery);
+void o_mirror_world(GSCHEM_TOPLEVEL *w_current, GList *list, int centerx, int centery);
+void o_edit_show_hidden_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list);
+void o_edit_show_hidden(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list);
+void o_edit_make_visible(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list);
+int o_edit_find_text(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list, char *stext, int descend, int skip);
+void o_edit_hide_specific_text(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list, char *stext);
+void o_edit_show_specific_text(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list, char *stext);
+void o_update_component(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_autosave_backups(GSCHEM_TOPLEVEL *w_current);
/* o_move.c */
-void o_move_start(TOPLEVEL *w_current, int x, int y);
-void o_move_end_lowlevel(TOPLEVEL *w_current, OBJECT *list, int type, int diff_x, int diff_y, GList **other_objects, GList **connected_objects);
-void o_move_end(TOPLEVEL *w_current);
+void o_move_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_move_end_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *list, int type, int diff_x, int diff_y, GList **other_objects, GList **connected_objects);
+void o_move_end(GSCHEM_TOPLEVEL *w_current);
int o_move_return_whichone(OBJECT *object, int x, int y);
-void o_move_check_endpoint(TOPLEVEL *w_current, OBJECT *object);
-void o_move_prep_rubberband(TOPLEVEL *w_current);
+void o_move_check_endpoint(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
+void o_move_prep_rubberband(GSCHEM_TOPLEVEL *w_current);
int o_move_zero_length(OBJECT *object);
-void o_move_end_rubberband(TOPLEVEL *w_current, int world_diff_x, int world_diff_y, GList **objects, GList **other_objects, GList **connected_objects);
-void o_move_stretch_rubberband(TOPLEVEL *w_current);
+void o_move_end_rubberband(GSCHEM_TOPLEVEL *w_current, int world_diff_x, int world_diff_y, GList **objects, GList **other_objects, GList **connected_objects);
+void o_move_stretch_rubberband(GSCHEM_TOPLEVEL *w_current);
/* o_net.c */
-void o_net_draw(TOPLEVEL *w_current, OBJECT *o_current);
-void o_net_erase(TOPLEVEL *w_current, OBJECT *o_current);
-void o_net_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
-void o_net_draw_xor_single(TOPLEVEL *w_current, int dx, int dy, int whichone, OBJECT *o_current);
-void o_net_start(TOPLEVEL *w_current, int x, int y);
-int o_net_end(TOPLEVEL *w_current, int x, int y);
-void o_net_rubbernet(TOPLEVEL *w_current, int x, int y);
-void o_net_eraserubber(TOPLEVEL *w_current);
-void o_net_xorrubber(TOPLEVEL *w_current);
-int o_net_add_busrippers(TOPLEVEL *w_current, OBJECT *net_obj, GList *other_objects);
+void o_net_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_net_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_net_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
+void o_net_draw_xor_single(GSCHEM_TOPLEVEL *w_current, int dx, int dy, int whichone, OBJECT *o_current);
+void o_net_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
+int o_net_end(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_net_rubbernet(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_net_eraserubber(GSCHEM_TOPLEVEL *w_current);
+void o_net_xorrubber(GSCHEM_TOPLEVEL *w_current);
+int o_net_add_busrippers(GSCHEM_TOPLEVEL *w_current, OBJECT *net_obj, GList *other_objects);
/* o_picture.c */
-void o_picture_start(TOPLEVEL *w_current, int x, int y);
-void o_picture_end(TOPLEVEL *w_current, int x, int y);
-void picture_selection_dialog (TOPLEVEL *w_current);
-void o_picture_eraserubber(TOPLEVEL *w_current);
-void o_picture_rubberbox_xor(TOPLEVEL *w_current);
-void o_picture_rubberbox(TOPLEVEL *w_current, int x, int y);
-void o_picture_draw(TOPLEVEL *w_current, OBJECT *o_current);
-void o_picture_draw_grips(TOPLEVEL *w_current, OBJECT *o_current);
-void o_picture_erase_grips(TOPLEVEL *w_current, OBJECT *o_current);
-void o_picture_erase(TOPLEVEL *w_current, OBJECT *o_current);
-void o_picture_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
-void o_picture_exchange(TOPLEVEL *w_current, GdkPixbuf *pixbuf, const gchar *filename);
-void picture_change_filename_dialog (TOPLEVEL *w_current);
-void o_picture_set_pixbuf(TOPLEVEL *toplevel, GdkPixbuf *pixbuf, char *filename);
+void o_picture_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_picture_end(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void picture_selection_dialog (GSCHEM_TOPLEVEL *w_current);
+void o_picture_eraserubber(GSCHEM_TOPLEVEL *w_current);
+void o_picture_rubberbox_xor(GSCHEM_TOPLEVEL *w_current);
+void o_picture_rubberbox(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_picture_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_picture_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_picture_erase_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_picture_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_picture_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
+void o_picture_exchange(GSCHEM_TOPLEVEL *w_current, GdkPixbuf *pixbuf, const gchar *filename);
+void picture_change_filename_dialog (GSCHEM_TOPLEVEL *w_current);
+void o_picture_set_pixbuf(GSCHEM_TOPLEVEL *w_current, GdkPixbuf *pixbuf, char *filename);
/* o_pin.c */
-void o_pin_draw(TOPLEVEL *w_current, OBJECT *o_current);
-void o_pin_erase(TOPLEVEL *w_current, OBJECT *o_current);
-void o_pin_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
-void o_pin_start(TOPLEVEL *w_current, int x, int y);
-void o_pin_end(TOPLEVEL *w_current, int x, int y);
-void o_pin_rubberpin(TOPLEVEL *w_current, int x, int y);
-void o_pin_eraserubber(TOPLEVEL *w_current);
+void o_pin_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_pin_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_pin_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
+void o_pin_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_pin_end(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_pin_rubberpin(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_pin_eraserubber(GSCHEM_TOPLEVEL *w_current);
/* o_select.c */
-void o_select_run_hooks(TOPLEVEL *w_current, OBJECT *o_current, int flag);
-void o_select_object(TOPLEVEL *w_current, OBJECT *o_current, int type, int count);
-void o_select_box_start(TOPLEVEL *w_current, int x, int y);
-void o_select_box_end(TOPLEVEL *w_current, int x, int y);
-void o_select_box_rubberband(TOPLEVEL *w_current, int x, int y);
-void o_select_box_search(TOPLEVEL *w_current);
-OBJECT *o_select_return_first_object(TOPLEVEL *w_current);
-int o_select_selected(TOPLEVEL *w_current);
-void o_select_unselect_list(TOPLEVEL *w_current, SELECTION *selection);
-void o_select_unselect_all(TOPLEVEL *w_current);
-void o_select_move_to_place_list(TOPLEVEL *w_current);
+void o_select_run_hooks(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int flag);
+void o_select_object(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int type, int count);
+void o_select_box_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_select_box_end(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_select_box_rubberband(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void o_select_box_search(GSCHEM_TOPLEVEL *w_current);
+OBJECT *o_select_return_first_object(GSCHEM_TOPLEVEL *w_current);
+int o_select_selected(GSCHEM_TOPLEVEL *w_current);
+void o_select_unselect_list(GSCHEM_TOPLEVEL *w_current, SELECTION *selection);
+void o_select_unselect_all(GSCHEM_TOPLEVEL *w_current);
+void o_select_move_to_place_list(GSCHEM_TOPLEVEL *w_current);
/* o_slot.c */
-void o_slot_start(TOPLEVEL *w_current, OBJECT *list);
-void o_slot_end(TOPLEVEL *w_current, char *string, int len);
+void o_slot_start(GSCHEM_TOPLEVEL *w_current, OBJECT *list);
+void o_slot_end(GSCHEM_TOPLEVEL *w_current, char *string, int len);
/* o_text.c */
-void o_text_draw_lowlevel(TOPLEVEL *w_current, OBJECT *o_current);
-void o_text_draw_rectangle(TOPLEVEL *w_current, OBJECT *o_current);
-void o_text_draw(TOPLEVEL *w_current, OBJECT *o_current);
-void o_text_erase(TOPLEVEL *w_current, OBJECT *o_current);
-void o_text_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
-void o_text_start(TOPLEVEL *w_current, int screen_x, int screen_y);
-void o_text_end(TOPLEVEL *w_current);
-void o_text_rubberattrib(TOPLEVEL *w_current);
-void o_text_edit(TOPLEVEL *w_current, OBJECT *o_current);
-void o_text_edit_end(TOPLEVEL *w_current, char *string, int len, int text_size, int text_alignment);
-void o_text_change(TOPLEVEL *w_current, OBJECT *object, char *string, int visibility, int show);
-void o_text_place_rotate(TOPLEVEL *w_current);
+void o_text_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_text_draw_rectangle(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_text_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_text_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_text_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current);
+void o_text_start(GSCHEM_TOPLEVEL *w_current, int screen_x, int screen_y);
+void o_text_end(GSCHEM_TOPLEVEL *w_current);
+void o_text_rubberattrib(GSCHEM_TOPLEVEL *w_current);
+void o_text_edit(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
+void o_text_edit_end(GSCHEM_TOPLEVEL *w_current, char *string, int len, int text_size, int text_alignment);
+void o_text_change(GSCHEM_TOPLEVEL *w_current, OBJECT *object, char *string, int visibility, int show);
+void o_text_place_rotate(GSCHEM_TOPLEVEL *w_current);
/* o_undo.c */
void o_undo_init(void);
-void o_undo_savestate(TOPLEVEL *w_current, int flag);
+void o_undo_savestate(GSCHEM_TOPLEVEL *w_current, int flag);
char *o_undo_find_prev_filename(UNDO *start);
OBJECT *o_undo_find_prev_object_head(UNDO *start);
-void o_undo_callback(TOPLEVEL *w_current, int type);
+void o_undo_callback(GSCHEM_TOPLEVEL *w_current, int type);
void o_undo_cleanup(void);
-void o_undo_remove_last_undo(TOPLEVEL *w_current);
+void o_undo_remove_last_undo(GSCHEM_TOPLEVEL *w_current);
/* parsecmd.c */
void usage(char *cmd);
int parse_commandline(int argc, char *argv[]);
/* x_attribedit.c */
gint option_menu_get_history(GtkOptionMenu *option_menu);
-void attrib_edit_dialog_ok(GtkWidget *w, TOPLEVEL *w_current);
-void attrib_edit_dialog(TOPLEVEL *w_current, OBJECT *list, int flag);
+void attrib_edit_dialog_ok(GtkWidget *w, GSCHEM_TOPLEVEL *w_current);
+void attrib_edit_dialog(GSCHEM_TOPLEVEL *w_current, OBJECT *list, int flag);
/* x_autonumber.c */
-void autonumber_text_dialog(TOPLEVEL *w_current);
+void autonumber_text_dialog(GSCHEM_TOPLEVEL *w_current);
/* x_basic.c */
-void x_repaint_background(TOPLEVEL *w_current);
-void x_hscrollbar_set_ranges(TOPLEVEL *w_current);
-void x_hscrollbar_update(TOPLEVEL *w_current);
-void x_vscrollbar_set_ranges(TOPLEVEL *w_current);
-void x_vscrollbar_update(TOPLEVEL *w_current);
-void x_scrollbars_update(TOPLEVEL *w_current);
+void x_repaint_background(GSCHEM_TOPLEVEL *w_current);
+void x_hscrollbar_set_ranges(GSCHEM_TOPLEVEL *w_current);
+void x_hscrollbar_update(GSCHEM_TOPLEVEL *w_current);
+void x_vscrollbar_set_ranges(GSCHEM_TOPLEVEL *w_current);
+void x_vscrollbar_update(GSCHEM_TOPLEVEL *w_current);
+void x_scrollbars_update(GSCHEM_TOPLEVEL *w_current);
void x_basic_warp_cursor(GtkWidget *widget, gint x, gint y, gboolean relative);
/* x_color.c */
void x_color_allocate_all(void);
@@ -741,77 +742,77 @@ gchar *x_color_get_name(int index);
int text_view_calculate_real_tab_width(GtkTextView *textview, int tab_size);
void select_all_text_in_textview(GtkTextView *textview);
void destroy_window(GtkWidget *widget, GtkWidget **window);
-void text_input_dialog_apply(GtkWidget *w, TOPLEVEL *w_current);
-void text_input_dialog(TOPLEVEL *w_current);
-gint change_alignment(GtkWidget *w, TOPLEVEL *w_current);
-void text_edit_dialog_ok(GtkWidget *w, TOPLEVEL *w_current);
-void text_edit_dialog(TOPLEVEL *w_current, char *string, int text_size, int text_alignment);
-void line_type_dialog(TOPLEVEL *w_current, GList *objects);
-void fill_type_dialog(TOPLEVEL *w_current, GList *objects);
-void arc_angle_dialog(TOPLEVEL *w_current);
-void translate_dialog(TOPLEVEL *w_current);
-void text_size_dialog(TOPLEVEL *w_current);
-void snap_size_dialog(TOPLEVEL *w_current);
-void slot_edit_dialog(TOPLEVEL *w_current, char *string);
-void about_dialog(TOPLEVEL *w_current);
-void coord_display_update(TOPLEVEL *w_current, int x, int y);
-void coord_dialog(TOPLEVEL *w_current, int x, int y);
+void text_input_dialog_apply(GtkWidget *w, GSCHEM_TOPLEVEL *w_current);
+void text_input_dialog(GSCHEM_TOPLEVEL *w_current);
+gint change_alignment(GtkWidget *w, GSCHEM_TOPLEVEL *w_current);
+void text_edit_dialog_ok(GtkWidget *w, GSCHEM_TOPLEVEL *w_current);
+void text_edit_dialog(GSCHEM_TOPLEVEL *w_current, char *string, int text_size, int text_alignment);
+void line_type_dialog(GSCHEM_TOPLEVEL *w_current, GList *objects);
+void fill_type_dialog(GSCHEM_TOPLEVEL *w_current, GList *objects);
+void arc_angle_dialog(GSCHEM_TOPLEVEL *w_current);
+void translate_dialog(GSCHEM_TOPLEVEL *w_current);
+void text_size_dialog(GSCHEM_TOPLEVEL *w_current);
+void snap_size_dialog(GSCHEM_TOPLEVEL *w_current);
+void slot_edit_dialog(GSCHEM_TOPLEVEL *w_current, char *string);
+void about_dialog(GSCHEM_TOPLEVEL *w_current);
+void coord_display_update(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void coord_dialog(GSCHEM_TOPLEVEL *w_current, int x, int y);
gint color_set(GtkWidget *w, gpointer data);
char *index2functionstring(int index);
-void color_edit_dialog_apply(GtkWidget *w, TOPLEVEL *w_current);
-void color_edit_dialog(TOPLEVEL *w_current);
-void x_dialog_hotkeys(TOPLEVEL *w_current);
-void x_dialog_raise_all(TOPLEVEL *w_current);
+void color_edit_dialog_apply(GtkWidget *w, GSCHEM_TOPLEVEL *w_current);
+void color_edit_dialog(GSCHEM_TOPLEVEL *w_current);
+void x_dialog_hotkeys(GSCHEM_TOPLEVEL *w_current);
+void x_dialog_raise_all(GSCHEM_TOPLEVEL *w_current);
void generic_msg_dialog(const char *);
int generic_confirm_dialog(const char *);
char * generic_filesel_dialog(const char *, const char *, gint);
-void find_text_dialog(TOPLEVEL *w_current);
-void hide_text_dialog(TOPLEVEL *w_current);
-void show_text_dialog(TOPLEVEL *w_current);
-void major_changed_dialog(TOPLEVEL* w_current);
-void x_dialog_close_changed_page (TOPLEVEL *toplevel, PAGE *page);
-gboolean x_dialog_close_window (TOPLEVEL *toplevel);
+void find_text_dialog(GSCHEM_TOPLEVEL *w_current);
+void hide_text_dialog(GSCHEM_TOPLEVEL *w_current);
+void show_text_dialog(GSCHEM_TOPLEVEL *w_current);
+void major_changed_dialog(GSCHEM_TOPLEVEL* w_current);
+void x_dialog_close_changed_page (GSCHEM_TOPLEVEL *w_current, PAGE *page);
+gboolean x_dialog_close_window (GSCHEM_TOPLEVEL *w_current);
int x_dialog_validate_attribute(GtkWindow* parent, char *attribute);
/* x_event.c */
-gint x_event_expose(GtkWidget *widget, GdkEventExpose *event, TOPLEVEL *w_current);
-gint x_event_button_pressed(GtkWidget *widget, GdkEventButton *event, TOPLEVEL *w_current);
-gint x_event_button_released(GtkWidget *widget, GdkEventButton *event, TOPLEVEL *w_current);
-gint x_event_motion(GtkWidget *widget, GdkEventMotion *event, TOPLEVEL *w_current);
+gint x_event_expose(GtkWidget *widget, GdkEventExpose *event, GSCHEM_TOPLEVEL *w_current);
+gint x_event_button_pressed(GtkWidget *widget, GdkEventButton *event, GSCHEM_TOPLEVEL *w_current);
+gint x_event_button_released(GtkWidget *widget, GdkEventButton *event, GSCHEM_TOPLEVEL *w_current);
+gint x_event_motion(GtkWidget *widget, GdkEventMotion *event, GSCHEM_TOPLEVEL *w_current);
gboolean x_event_configure (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data);
-void x_manual_resize(TOPLEVEL *w_current);
-void x_event_hschanged(GtkAdjustment *adj, TOPLEVEL *w_current);
-void x_event_vschanged(GtkAdjustment *adj, TOPLEVEL *w_current);
-gint x_event_enter(GtkWidget *widget, GdkEventCrossing *event, TOPLEVEL *w_current);
-gboolean x_event_key_press(GtkWidget *widget, GdkEventKey *event, TOPLEVEL *w_current);
-gint x_event_scroll(GtkWidget *widget, GdkEventScroll *event, TOPLEVEL *w_current);
+void x_manual_resize(GSCHEM_TOPLEVEL *w_current);
+void x_event_hschanged(GtkAdjustment *adj, GSCHEM_TOPLEVEL *w_current);
+void x_event_vschanged(GtkAdjustment *adj, GSCHEM_TOPLEVEL *w_current);
+gint x_event_enter(GtkWidget *widget, GdkEventCrossing *event, GSCHEM_TOPLEVEL *w_current);
+gboolean x_event_key_press(GtkWidget *widget, GdkEventKey *event, GSCHEM_TOPLEVEL *w_current);
+gint x_event_scroll(GtkWidget *widget, GdkEventScroll *event, GSCHEM_TOPLEVEL *w_current);
/* x_compselect.c */
-void x_compselect_open (TOPLEVEL *toplevel);
-void x_compselect_close (TOPLEVEL *toplevel);
+void x_compselect_open (GSCHEM_TOPLEVEL *w_current);
+void x_compselect_close (GSCHEM_TOPLEVEL *w_current);
/* x_fileselect.c */
-void x_fileselect_open(TOPLEVEL *toplevel);
-void x_fileselect_save(TOPLEVEL *toplevel);
+void x_fileselect_open(GSCHEM_TOPLEVEL *w_current);
+void x_fileselect_save(GSCHEM_TOPLEVEL *w_current);
int x_fileselect_load_backup(TOPLEVEL *toplevel, GString *message);
/* x_grid.c */
-void x_grid_draw(TOPLEVEL *w_current);
-void x_draw_tiles(TOPLEVEL *w_current);
+void x_grid_draw(GSCHEM_TOPLEVEL *w_current);
+void x_draw_tiles(GSCHEM_TOPLEVEL *w_current);
/* x_image.c */
-void x_image_lowlevel(TOPLEVEL *w_current, const char* filename,
+void x_image_lowlevel(GSCHEM_TOPLEVEL *w_current, const char* filename,
int desired_width, int desired_height, char *filetype);
-void x_image_setup(TOPLEVEL *w_current);
-GdkPixbuf *x_image_get_pixbuf (TOPLEVEL *w_current);
+void x_image_setup(GSCHEM_TOPLEVEL *w_current);
+GdkPixbuf *x_image_get_pixbuf (GSCHEM_TOPLEVEL *w_current);
/* x_log.c */
void x_log_open ();
void x_log_close ();
void x_log_message (const gchar *message);
/* x_menus.c */
-void get_main_menu(TOPLEVEL *w_current, GtkWidget **menubar);
-GtkWidget *get_main_popup(TOPLEVEL *w_current);
-gint do_popup(TOPLEVEL *w_current, GdkEventButton *event);
-void x_menus_sensitivity(TOPLEVEL *w_current, const char *buf, int flag);
-void x_menus_popup_sensitivity(TOPLEVEL *w_current, const char *buf, int flag);
-void x_menu_attach_recent_files_submenu(TOPLEVEL *w_current);
+void get_main_menu(GtkWidget **menubar);
+GtkWidget *get_main_popup(GSCHEM_TOPLEVEL *w_current);
+gint do_popup(GSCHEM_TOPLEVEL *w_current, GdkEventButton *event);
+void x_menus_sensitivity(GSCHEM_TOPLEVEL *w_current, const char *buf, int flag);
+void x_menus_popup_sensitivity(GSCHEM_TOPLEVEL *w_current, const char *buf, int flag);
+void x_menu_attach_recent_files_submenu(GSCHEM_TOPLEVEL *w_current);
void recent_files_load();
void recent_files_save(gpointer user_data);
void recent_files_add(const char *filename);
@@ -820,37 +821,37 @@ gboolean g_file_set_contents(const gchar *filename, const gchar *contents,
gssize length, GError **error);
#endif
/* x_multiattrib.c */
-void x_multiattrib_open (TOPLEVEL *toplevel);
-void x_multiattrib_close (TOPLEVEL *toplevel);
-void x_multiattrib_update (TOPLEVEL *toplevel);
+void x_multiattrib_open (GSCHEM_TOPLEVEL *w_current);
+void x_multiattrib_close (GSCHEM_TOPLEVEL *w_current);
+void x_multiattrib_update (GSCHEM_TOPLEVEL *w_current);
/* x_multimulti.c */
/* x_pagesel.c */
-void x_pagesel_open (TOPLEVEL *toplevel);
-void x_pagesel_close (TOPLEVEL *toplevel);
-void x_pagesel_update (TOPLEVEL *toplevel);
+void x_pagesel_open (GSCHEM_TOPLEVEL *w_current);
+void x_pagesel_close (GSCHEM_TOPLEVEL *w_current);
+void x_pagesel_update (GSCHEM_TOPLEVEL *w_current);
/* x_preview.c */
/* x_print.c */
-void x_print_setup(TOPLEVEL *w_current, char *filename);
+void x_print_setup(GSCHEM_TOPLEVEL *w_current, char *filename);
/* x_script.c */
-void setup_script_selector(TOPLEVEL *w_current);
+void setup_script_selector(GSCHEM_TOPLEVEL *w_current);
/* x_stroke.c */
-void x_stroke_add_point(TOPLEVEL *w_current, int x, int y);
-void x_stroke_erase_all(TOPLEVEL *w_current);
+void x_stroke_add_point(GSCHEM_TOPLEVEL *w_current, int x, int y);
+void x_stroke_erase_all(GSCHEM_TOPLEVEL *w_current);
void x_stroke_free_all(void);
int x_stroke_search_execute(char *sequence);
/* x_window.c */
-void x_window_setup (TOPLEVEL *toplevel);
+void x_window_setup (GSCHEM_TOPLEVEL *w_current);
void x_window_setup_colors(void);
-void x_window_free_colors(TOPLEVEL *w_current);
-void x_window_setup_gc(TOPLEVEL *w_current);
-void x_window_free_gc(TOPLEVEL *w_current);
-void x_window_create_drawing(GtkWidget *drawbox, TOPLEVEL *w_current);
-void x_window_setup_draw_events(TOPLEVEL *w_current);
-void x_window_create_main(TOPLEVEL *w_current);
-void x_window_close(TOPLEVEL *w_current);
-void x_window_close_all(TOPLEVEL *w_current);
-PAGE *x_window_open_untitled_page (TOPLEVEL *toplevel);
-PAGE *x_window_open_page (TOPLEVEL *toplevel, const gchar *filename);
-void x_window_set_current_page (TOPLEVEL *toplevel, PAGE *page);
-gint x_window_save_page (TOPLEVEL *toplevel, PAGE *page, const gchar *filename);
-void x_window_close_page (TOPLEVEL *toplevel, PAGE *page);
+void x_window_free_colors();
+void x_window_setup_gc(GSCHEM_TOPLEVEL *w_current);
+void x_window_free_gc(GSCHEM_TOPLEVEL *w_current);
+void x_window_create_drawing(GtkWidget *drawbox, GSCHEM_TOPLEVEL *w_current);
+void x_window_setup_draw_events(GSCHEM_TOPLEVEL *w_current);
+void x_window_create_main(GSCHEM_TOPLEVEL *w_current);
+void x_window_close(GSCHEM_TOPLEVEL *w_current);
+void x_window_close_all(GSCHEM_TOPLEVEL *w_current);
+PAGE *x_window_open_untitled_page (GSCHEM_TOPLEVEL *w_current);
+PAGE *x_window_open_page (GSCHEM_TOPLEVEL *w_current, const gchar *filename);
+void x_window_set_current_page (GSCHEM_TOPLEVEL *w_current, PAGE *page);
+gint x_window_save_page (GSCHEM_TOPLEVEL *w_current, PAGE *page, const gchar *filename);
+void x_window_close_page (GSCHEM_TOPLEVEL *w_current, PAGE *page);
diff --git a/gschem/include/x_preview.h b/gschem/include/x_preview.h
index a24e650..6a72065 100644
--- a/gschem/include/x_preview.h
+++ b/gschem/include/x_preview.h
@@ -44,7 +44,7 @@ struct _PreviewClass {
struct _Preview {
GtkDrawingArea parent_instance;
- TOPLEVEL *preview_toplevel;
+ GSCHEM_TOPLEVEL *preview_w_current;
gchar *filename;
gchar *buffer;
diff --git a/gschem/src/Makefile.am b/gschem/src/Makefile.am
index f99ee92..8072874 100644
--- a/gschem/src/Makefile.am
+++ b/gschem/src/Makefile.am
@@ -23,7 +23,8 @@ gschem_SOURCES = \
x_compselect.c x_fileselect.c x_preview.c x_attribedit.c \
x_multiattrib.c \
parsecmd.c o_cue.c \
- gschem_dialog.c
+ gschem_dialog.c \
+ gschem_toplevel.c
if CCISGCC
AM_CFLAGS = -Wall
diff --git a/gschem/src/a_pan.c b/gschem/src/a_pan.c
index 4519e46..f9ba6b1 100644
--- a/gschem/src/a_pan.c
+++ b/gschem/src/a_pan.c
@@ -24,6 +24,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/x_states.h"
#include "../include/prototype.h"
@@ -59,9 +60,10 @@
* */
/* this code is not longer experimental an is used by several functions
like every zooming-function and the x_event_configure (Werner Hoch,(hw))*/
-void a_pan_general(TOPLEVEL *w_current, double world_cx, double world_cy,
+void a_pan_general(GSCHEM_TOPLEVEL *w_current, double world_cx, double world_cy,
double relativ_zoom_factor,int flags)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
/* see libgeda/include/defines.h for flags */
/*if the borders should be ignored always, remove, outcomment or changes
the flags in the function-calls*/
@@ -80,10 +82,10 @@ void a_pan_general(TOPLEVEL *w_current, double world_cx, double world_cy,
/* calc minimum zoomfactors and choose the smaller one. They are equal
if the aspectratio of the world is the same as the screen ratio */
- zx = (double) w_current->width / (w_current->init_right -
- w_current->init_left);
- zy = (double) w_current->height / (w_current->init_bottom -
- w_current->init_top);
+ zx = (double) toplevel->width / (toplevel->init_right -
+ toplevel->init_left);
+ zy = (double) toplevel->height / (toplevel->init_bottom -
+ toplevel->init_top);
zoom_min = zx < zy ? zx : zy;
#if DEBUG
@@ -92,7 +94,7 @@ void a_pan_general(TOPLEVEL *w_current, double world_cx, double world_cy,
/* to_screen_x_constant and to_screen_y_constant are almost the same.
lets use to_screen_y_constant */
- zoom_old = w_current->page_current->to_screen_y_constant;
+ zoom_old = toplevel->page_current->to_screen_y_constant;
/* calc new zooming factor */
/* check if there's a zoom_full (relativ_zoom_factor == -1) */
@@ -110,67 +112,67 @@ void a_pan_general(TOPLEVEL *w_current, double world_cx, double world_cy,
/* check to see if we are inside an action draw net, etc. If
* yes, convert the start screen coords to world coords */
if (w_current->inside_action) {
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->start_x, w_current->start_y,
&start_x, &start_y);
- start_x = snap_grid(w_current, start_x);
- start_y = snap_grid(w_current, start_y);
+ start_x = snap_grid(toplevel, start_x);
+ start_y = snap_grid(toplevel, start_y);
}
/* calculate the new visible area; adding 0.5 to round */
- w_current->page_current->left = world_cx - (double) w_current->width
+ toplevel->page_current->left = world_cx - (double) toplevel->width
/ 2 / zoom_new + 0.5;
- w_current->page_current->right = world_cx + (double) w_current->width
+ toplevel->page_current->right = world_cx + (double) toplevel->width
/ 2 / zoom_new + 0.5;
- w_current->page_current->top = world_cy - (double) w_current->height
+ toplevel->page_current->top = world_cy - (double) toplevel->height
/ 2 / zoom_new + 0.5;
- w_current->page_current->bottom = world_cy + (double) w_current->height
+ toplevel->page_current->bottom = world_cy + (double) toplevel->height
/ 2 / zoom_new + 0.5;
/* and put it back to the borders */
if (!(flags & A_PAN_IGNORE_BORDERS)) {
/* check right border */
- if (w_current->page_current->right > w_current->init_right) {
- w_current->page_current->left += w_current->init_right -
- w_current->page_current->right;
- w_current->page_current->right = w_current->init_right;
+ if (toplevel->page_current->right > toplevel->init_right) {
+ toplevel->page_current->left += toplevel->init_right -
+ toplevel->page_current->right;
+ toplevel->page_current->right = toplevel->init_right;
}
/* check left border */
- if (w_current->page_current->left < w_current->init_left) {
- w_current->page_current->right += w_current->init_left -
- w_current->page_current->left;
- w_current->page_current->left = w_current->init_left;
+ if (toplevel->page_current->left < toplevel->init_left) {
+ toplevel->page_current->right += toplevel->init_left -
+ toplevel->page_current->left;
+ toplevel->page_current->left = toplevel->init_left;
}
/* If there is any slack, center the view */
- diff = (w_current->page_current->right -
- w_current->page_current->left) -
- (w_current->init_right - w_current->init_left);
+ diff = (toplevel->page_current->right -
+ toplevel->page_current->left) -
+ (toplevel->init_right - toplevel->init_left);
if (diff > 0) {
- w_current->page_current->left -= diff / 2;
- w_current->page_current->right -= diff / 2;
+ toplevel->page_current->left -= diff / 2;
+ toplevel->page_current->right -= diff / 2;
}
/* check bottom border */
- if (w_current->page_current->bottom > w_current->init_bottom) {
- w_current->page_current->top += w_current->init_bottom -
- w_current->page_current->bottom;
- w_current->page_current->bottom = w_current->init_bottom;
+ if (toplevel->page_current->bottom > toplevel->init_bottom) {
+ toplevel->page_current->top += toplevel->init_bottom -
+ toplevel->page_current->bottom;
+ toplevel->page_current->bottom = toplevel->init_bottom;
}
/* check top border */
- if (w_current->page_current->top < w_current->init_top) {
- w_current->page_current->bottom += w_current->init_top -
- w_current->page_current->top;
- w_current->page_current->top = w_current->init_top;
+ if (toplevel->page_current->top < toplevel->init_top) {
+ toplevel->page_current->bottom += toplevel->init_top -
+ toplevel->page_current->top;
+ toplevel->page_current->top = toplevel->init_top;
}
/* If there is any slack, center the view */
- diff = (w_current->page_current->bottom -
- w_current->page_current->top) -
- (w_current->init_bottom - w_current->init_top);
+ diff = (toplevel->page_current->bottom -
+ toplevel->page_current->top) -
+ (toplevel->init_bottom - toplevel->init_top);
if (diff > 0) {
- w_current->page_current->top -= diff / 2;
- w_current->page_current->bottom -= diff / 2;
+ toplevel->page_current->top -= diff / 2;
+ toplevel->page_current->bottom -= diff / 2;
}
}
@@ -188,15 +190,15 @@ void a_pan_general(TOPLEVEL *w_current, double world_cx, double world_cy,
#endif
/* set_window */
- set_window(w_current, w_current->page_current,
- w_current->page_current->left ,
- w_current->page_current->right ,
- w_current->page_current->top ,
- w_current->page_current->bottom);
+ set_window(toplevel, toplevel->page_current,
+ toplevel->page_current->left ,
+ toplevel->page_current->right ,
+ toplevel->page_current->top ,
+ toplevel->page_current->bottom);
/* convert world coords back to screen coords */
if (w_current->inside_action) {
- WORLDtoSCREEN(w_current,
+ WORLDtoSCREEN(toplevel,
start_x, start_y,
&(w_current->start_x), &(w_current->start_y));
/* set all rubberband points to it's start values:
@@ -224,8 +226,9 @@ void a_pan_general(TOPLEVEL *w_current, double world_cx, double world_cy,
* \todo Kazu on July 8, 1999 - distill common part from a_pan() and
* a_pan_mouse() because they are doing basically the same thing
*/
-void a_pan(TOPLEVEL *w_current, int x, int y)
+void a_pan(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
double world_cx, world_cy;
#if DEBUG
@@ -235,8 +238,8 @@ void a_pan(TOPLEVEL *w_current, int x, int y)
/* make mouse to the new world-center;
attention: there are information looses because of type cast in mil_x */
- world_cx = mil_x(w_current, x);
- world_cy = mil_y(w_current, y);
+ world_cx = mil_x(toplevel, x);
+ world_cy = mil_y(toplevel, y);
a_pan_general(w_current, world_cx, world_cy, 1, 0);
@@ -253,16 +256,17 @@ void a_pan(TOPLEVEL *w_current, int x, int y)
* \par Function Description
*
*/
-void a_pan_mouse(TOPLEVEL *w_current, int diff_x, int diff_y)
+void a_pan_mouse(GSCHEM_TOPLEVEL *w_current, int diff_x, int diff_y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
double world_cx, world_cy;
#if DEBUG
printf("a_pan_mouse(): diff_x=%d, diff_y=%d\n", diff_x, diff_y);
#endif
- world_cx=GET_PAGE_CENTER_X(w_current) - WORLDabs(w_current, diff_x);
- world_cy=GET_PAGE_CENTER_Y(w_current) + WORLDabs(w_current, diff_y);
+ world_cx=GET_PAGE_CENTER_X(toplevel) - WORLDabs(toplevel, diff_x);
+ world_cy=GET_PAGE_CENTER_Y(toplevel) + WORLDabs(toplevel, diff_y);
#if DEBUG
printf(" world_cx=%f, world_cy=%f, world_dx=%d, world_dy=%d\n",
diff --git a/gschem/src/a_zoom.c b/gschem/src/a_zoom.c
index 21d244d..e54189f 100644
--- a/gschem/src/a_zoom.c
+++ b/gschem/src/a_zoom.c
@@ -24,6 +24,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -86,24 +87,25 @@
*
*/
/* dir is either ZOOM_IN, ZOOM_OUT or ZOOM_FULL which are defined in globals.h */
-void a_zoom(TOPLEVEL *w_current, int dir, int selected_from, int pan_flags)
+void a_zoom(GSCHEM_TOPLEVEL *w_current, int dir, int selected_from, int pan_flags)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
double world_pan_center_x,world_pan_center_y,relativ_zoom_factor = - 1;
int start_x, start_y;
/*calc center: either "mouse_to_world" or center=center */
if (w_current->zoom_with_pan == TRUE && selected_from == HOTKEY) {
world_pan_center_x = (double) mouse_x *
- w_current->page_current->to_world_x_constant +
- w_current->page_current->left;
- world_pan_center_y = (double) w_current->page_current->bottom - mouse_y *
- w_current->page_current->to_world_y_constant;
+ toplevel->page_current->to_world_x_constant +
+ toplevel->page_current->left;
+ world_pan_center_y = (double) toplevel->page_current->bottom - mouse_y *
+ toplevel->page_current->to_world_y_constant;
}
else {
- world_pan_center_x = (double) (w_current->page_current->left +
- w_current->page_current->right ) / 2;
- world_pan_center_y = (double) (w_current->page_current->top +
- w_current->page_current->bottom ) / 2;
+ world_pan_center_x = (double) (toplevel->page_current->left +
+ toplevel->page_current->right ) / 2;
+ world_pan_center_y = (double) (toplevel->page_current->top +
+ toplevel->page_current->bottom ) / 2;
}
switch(dir) {
@@ -153,7 +155,7 @@ void a_zoom(TOPLEVEL *w_current, int dir, int selected_from, int pan_flags)
/* warp the cursor to the right position */
if (w_current->warp_cursor) {
- WORLDtoSCREEN(w_current, world_pan_center_x, world_pan_center_y,
+ WORLDtoSCREEN(toplevel, world_pan_center_x, world_pan_center_y,
&start_x, &start_y);
x_basic_warp_cursor(w_current->drawing_area, start_x, start_y, 0);
}
@@ -172,8 +174,9 @@ void a_zoom(TOPLEVEL *w_current, int dir, int selected_from, int pan_flags)
* \par Function Description
*
*/
-void a_zoom_extents(TOPLEVEL *w_current, OBJECT *o_current, int pan_flags)
+void a_zoom_extents(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int pan_flags)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int lleft, lright, ltop, lbottom;
double zx, zy, relativ_zoom_factor;
double world_pan_center_x,world_pan_center_y;
@@ -189,7 +192,7 @@ void a_zoom_extents(TOPLEVEL *w_current, OBJECT *o_current, int pan_flags)
return;
}
- if ( !world_get_object_list_bounds(w_current, o_current,
+ if ( !world_get_object_list_bounds(toplevel, o_current,
&lleft, <op,
&lright, &lbottom)) {
return;
@@ -204,11 +207,11 @@ void a_zoom_extents(TOPLEVEL *w_current, OBJECT *o_current, int pan_flags)
* Start with the windows width and height, then scale back to world
* coordinates with the to_screen_y_constant as the initial page data
* may not have the correct aspect ratio. */
- zx = (double)w_current->width / (lright-lleft);
- zy = (double)w_current->height / (lbottom-ltop);
+ zx = (double)toplevel->width / (lright-lleft);
+ zy = (double)toplevel->height / (lbottom-ltop);
/* choose the smaller one, 0.9 for paddings on all side*/
relativ_zoom_factor = (zx < zy ? zx : zy) * 0.9
- / w_current->page_current->to_screen_y_constant;
+ / toplevel->page_current->to_screen_y_constant;
/*get the center of the objects*/
world_pan_center_x = (double) (lright + lleft) /2.0;
@@ -233,8 +236,9 @@ void a_zoom_extents(TOPLEVEL *w_current, OBJECT *o_current, int pan_flags)
*
*/
/* made a rewrite (hw) */
-void a_zoom_box(TOPLEVEL *w_current, int pan_flags)
+void a_zoom_box(GSCHEM_TOPLEVEL *w_current, int pan_flags)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
double cx,cy;
double zx, zy, relativ_zoom_factor;
double world_pan_center_x,world_pan_center_y;
@@ -247,9 +251,9 @@ void a_zoom_box(TOPLEVEL *w_current, int pan_flags)
}
/*calc new zoomfactors and choose the smaller one*/
- zx = (double) w_current->width /
+ zx = (double) toplevel->width /
abs(w_current->start_x - w_current->last_x);
- zy = (double) w_current->height /
+ zy = (double) toplevel->height /
abs(w_current->start_y - w_current->last_y);
relativ_zoom_factor = (zx < zy ? zx : zy);
@@ -259,10 +263,10 @@ void a_zoom_box(TOPLEVEL *w_current, int pan_flags)
/* and translate that point to world */
world_pan_center_x = (double) cx *
- w_current->page_current->to_world_x_constant +
- w_current->page_current->left;
- world_pan_center_y = (double) w_current->page_current->bottom -
- cy * w_current->page_current->to_world_y_constant;
+ toplevel->page_current->to_world_x_constant +
+ toplevel->page_current->left;
+ world_pan_center_y = (double) toplevel->page_current->bottom -
+ cy * toplevel->page_current->to_world_y_constant;
/* and create the new window*/
a_pan_general(w_current, world_pan_center_x, world_pan_center_y,
@@ -274,7 +278,7 @@ void a_zoom_box(TOPLEVEL *w_current, int pan_flags)
* \par Function Description
*
*/
-void a_zoom_box_start(TOPLEVEL *w_current, int x, int y)
+void a_zoom_box_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
int box_left, box_top;
int box_width, box_height;
@@ -294,13 +298,14 @@ void a_zoom_box_start(TOPLEVEL *w_current, int x, int y)
* \par Function Description
*
*/
-void a_zoom_box_end(TOPLEVEL *w_current, int x, int y)
+void a_zoom_box_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int box_width, box_height;
int box_left, box_top;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
@@ -325,13 +330,14 @@ void a_zoom_box_end(TOPLEVEL *w_current, int x, int y)
* \par Function Description
*
*/
-void a_zoom_box_rubberband(TOPLEVEL *w_current, int x, int y)
+void a_zoom_box_rubberband(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int box_width, box_height;
int box_left, box_top;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
@@ -361,25 +367,26 @@ void a_zoom_box_rubberband(TOPLEVEL *w_current, int x, int y)
* \par Function Description
*
*/
-void correct_aspect(TOPLEVEL *w_current)
+void correct_aspect(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
double new_aspect;
- new_aspect = GET_PAGE_ASPECT_RATIO(w_current);
+ new_aspect = GET_PAGE_ASPECT_RATIO(toplevel);
/* Make sure aspect ratio is correct */
- if (fabs(new_aspect - w_current->page_current->coord_aspectratio)) {
+ if (fabs(new_aspect - toplevel->page_current->coord_aspectratio)) {
/* sign was > */
- if (new_aspect > w_current->page_current->coord_aspectratio) {
+ if (new_aspect > toplevel->page_current->coord_aspectratio) {
#if DEBUG
printf("new larger then coord\n");
printf("implies that height is too large\n");
#endif
/* calculate neccesary padding on Y */
- w_current->page_current->bottom =
- w_current->page_current->top +
- GET_PAGE_WIDTH(w_current) /
- w_current->page_current->coord_aspectratio;
+ toplevel->page_current->bottom =
+ toplevel->page_current->top +
+ GET_PAGE_WIDTH(toplevel) /
+ toplevel->page_current->coord_aspectratio;
} else {
#if DEBUG
@@ -387,17 +394,17 @@ void correct_aspect(TOPLEVEL *w_current)
printf("implies that width is too small\n");
#endif
/* calculate necessary padding on X */
- w_current->page_current->right =
- w_current->page_current->left +
- GET_PAGE_HEIGHT(w_current) *
- w_current->page_current->coord_aspectratio;
+ toplevel->page_current->right =
+ toplevel->page_current->left +
+ GET_PAGE_HEIGHT(toplevel) *
+ toplevel->page_current->coord_aspectratio;
}
#if DEBUG
printf("invalid aspectratio corrected\n");
#endif
}
- new_aspect = GET_PAGE_ASPECT_RATIO(w_current);
+ new_aspect = GET_PAGE_ASPECT_RATIO(toplevel);
#if DEBUG
printf("final %f\n", new_aspect);
diff --git a/gschem/src/g_funcs.c b/gschem/src/g_funcs.c
index 231d2f8..0705d70 100644
--- a/gschem/src/g_funcs.c
+++ b/gschem/src/g_funcs.c
@@ -34,6 +34,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
#include "../include/x_dialog.h"
@@ -53,10 +54,10 @@ SCM g_funcs_print(SCM filename)
SCM_ARG1, "gschem-print");
if (output_filename) {
- if (f_print_file (global_window_current, output_filename))
+ if (f_print_file (global_window_current->toplevel, output_filename))
return SCM_BOOL_F;
} else {
- if (f_print_file (global_window_current, SCM_STRING_CHARS (filename)))
+ if (f_print_file (global_window_current->toplevel, SCM_STRING_CHARS (filename)))
return SCM_BOOL_F;
}
@@ -74,10 +75,10 @@ SCM g_funcs_postscript(SCM filename)
SCM_ARG1, "gschem-postscript");
if (output_filename) {
- if (f_print_file (global_window_current, output_filename))
+ if (f_print_file (global_window_current->toplevel, output_filename))
return SCM_BOOL_F;
} else {
- if (f_print_file (global_window_current, SCM_STRING_CHARS (filename)))
+ if (f_print_file (global_window_current->toplevel, SCM_STRING_CHARS (filename)))
return SCM_BOOL_F;
}
@@ -96,13 +97,13 @@ SCM g_funcs_image(SCM filename)
if (output_filename) {
x_image_lowlevel (global_window_current, output_filename,
- global_window_current->image_width,
- global_window_current->image_height,
+ global_window_current->image_width,
+ global_window_current->image_height,
"png");
} else {
x_image_lowlevel (global_window_current, SCM_STRING_CHARS (filename),
- global_window_current->image_width,
- global_window_current->image_height,
+ global_window_current->image_width,
+ global_window_current->image_height,
"png");
}
@@ -263,7 +264,7 @@ hash_table_2_list (gpointer key,
* \par Function Description
*
*/
-SCM get_selected_component_attributes(TOPLEVEL *toplevel)
+SCM get_selected_component_attributes(GSCHEM_TOPLEVEL *w_current)
{
SCM list = SCM_EOL;
OBJECT *obj;
@@ -271,7 +272,7 @@ SCM get_selected_component_attributes(TOPLEVEL *toplevel)
/* build a hash table */
ht = g_hash_table_new (g_str_hash, g_str_equal);
- for (obj = toplevel->page_current->object_head; obj != NULL;
+ for (obj = w_current->toplevel->page_current->object_head; obj != NULL;
obj = obj->next) {
if (obj->selected &&
obj->type == OBJ_TEXT &&
@@ -296,16 +297,16 @@ SCM get_selected_component_attributes(TOPLEVEL *toplevel)
* This function gets the whole filename of the current schematic.
* Specifically, the <B>page_filename</B> of the current page.
*
- * \param [in] w_current The TOPLEVEL object to get filename from.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object to get filename from.
* \return whole filename of current schematic.
*/
-SCM get_selected_filename(TOPLEVEL *w_current)
+SCM get_selected_filename(GSCHEM_TOPLEVEL *w_current)
{
SCM return_value;
exit_if_null(w_current);
- return_value = scm_take0str (w_current->page_current->page_filename);
+ return_value = scm_take0str (w_current->toplevel->page_current->page_filename);
return(return_value);
}
diff --git a/gschem/src/g_hook.c b/gschem/src/g_hook.c
index 345d737..88681eb 100644
--- a/gschem/src/g_hook.c
+++ b/gschem/src/g_hook.c
@@ -26,6 +26,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -35,14 +36,14 @@
/* Private function declarations */
static void custom_world_get_single_object_bounds
- (TOPLEVEL *w_current, OBJECT *o_current,
+ (TOPLEVEL *toplevel, OBJECT *o_current,
int *left, int *top,
int *right, int *bottom,
GList *exclude_attrib_list,
GList *exclude_obj_type_list);
static void custom_world_get_object_list_bounds
- (TOPLEVEL *w_current, OBJECT *o_current,
+ (TOPLEVEL *toplevel, OBJECT *o_current,
int *left, int *top,
int *right, int *bottom,
GList *exclude_attrib_list,
@@ -55,7 +56,7 @@ static void custom_world_get_object_list_bounds
*/
/* Makes a list of all attributes currently connected to curr_object. *
* Principle stolen from o_attrib_return_attribs */
-SCM g_make_attrib_smob_list(TOPLEVEL *curr_w, OBJECT *curr_object)
+SCM g_make_attrib_smob_list(GSCHEM_TOPLEVEL *w_current, OBJECT *curr_object)
{
ATTRIB *a_current;
OBJECT *object;
@@ -81,7 +82,7 @@ SCM g_make_attrib_smob_list(TOPLEVEL *curr_w, OBJECT *curr_object)
if (a_current->object->type == OBJ_TEXT &&
a_current->object->text) {
if (a_current->object->text->string) {
- smob_list = scm_cons (g_make_attrib_smob (curr_w, a_current),
+ smob_list = scm_cons (g_make_attrib_smob (w_current->toplevel, a_current),
smob_list);
}
} else {
@@ -106,14 +107,15 @@ SCM g_make_attrib_smob_list(TOPLEVEL *curr_w, OBJECT *curr_object)
SCM g_set_attrib_value_x(SCM attrib_smob, SCM scm_value)
{
SCM returned;
- TOPLEVEL *world;
+ TOPLEVEL *toplevel;
OBJECT *o_attrib;
char *new_string;
returned = g_set_attrib_value_internal(attrib_smob, scm_value,
- &world, &o_attrib, &new_string);
+ &toplevel, &o_attrib, &new_string);
- o_text_change(world, o_attrib, new_string, o_attrib->visibility, o_attrib->show_name_value);
+ o_text_change(global_window_current, o_attrib, new_string,
+ o_attrib->visibility, o_attrib->show_name_value);
g_free(new_string);
@@ -136,7 +138,8 @@ The return value is always TRUE.
SCM g_add_attrib(SCM object, SCM scm_attrib_name,
SCM scm_attrib_value, SCM scm_vis, SCM scm_show)
{
- TOPLEVEL *w_current=NULL;
+ GSCHEM_TOPLEVEL *w_current=global_window_current;
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current=NULL;
gboolean vis;
int show=0;
@@ -155,8 +158,8 @@ SCM g_add_attrib(SCM object, SCM scm_attrib_name,
SCM_ASSERT (scm_list_p(scm_show), scm_show,
SCM_ARG5, "add-attribute-to-object");
- /* Get w_current and o_current */
- SCM_ASSERT (g_get_data_from_object_smob (object, &w_current, &o_current),
+ /* Get toplevel and o_current */
+ SCM_ASSERT (g_get_data_from_object_smob (object, &toplevel, &o_current),
object, SCM_ARG1, "add-attribute-to-object");
/* Get parameters */
@@ -218,14 +221,14 @@ The active connection end of the pin is the beginning, so this function cares ab
*/
SCM g_get_pin_ends(SCM object)
{
- TOPLEVEL *w_current;
+ TOPLEVEL *toplevel;
OBJECT *o_current;
SCM coord1 = SCM_EOL;
SCM coord2 = SCM_EOL;
SCM coords = SCM_EOL;
- /* Get w_current and o_current */
- SCM_ASSERT (g_get_data_from_object_smob (object, &w_current, &o_current),
+ /* Get toplevel and o_current */
+ SCM_ASSERT (g_get_data_from_object_smob (object, &toplevel, &o_current),
object, SCM_ARG1, "get-pin-ends");
/* Check that it is a pin object */
@@ -279,7 +282,8 @@ SCM g_set_attrib_text_properties(SCM attrib_smob, SCM scm_colorname,
struct st_attrib_smob *attribute =
(struct st_attrib_smob *)SCM_CDR(attrib_smob);
OBJECT *object;
- TOPLEVEL *w_current = (TOPLEVEL *) attribute->world;
+ GSCHEM_TOPLEVEL *w_current = global_window_current;
+ TOPLEVEL *toplevel = w_current->toplevel;
char *colorname=NULL;
int color=0;
@@ -377,8 +381,8 @@ SCM g_set_attrib_text_properties(SCM attrib_smob, SCM scm_colorname,
if (rotation != -1) {
object->text->angle = rotation;
}
- o_text_recreate(w_current, object);
- if (!w_current->DONT_REDRAW) {
+ o_text_recreate(toplevel, object);
+ if (!toplevel->DONT_REDRAW) {
o_text_draw(w_current, object);
}
}
@@ -392,7 +396,7 @@ SCM g_set_attrib_text_properties(SCM attrib_smob, SCM scm_colorname,
* Get the object bounds without considering the attributes in
* exclude_attrib_list, neither the object types included in
* exclude_obj_type_list
- * \param [in] w_current TOPLEVEL structure.
+ * \param [in] toplevel TOPLEVEL structure.
* \param [in] o_current The object we want to know the bounds of.
* \param [in] exclude_attrib_list A list with the attribute names we don't
* want to include when calculing the bounds.
@@ -406,7 +410,7 @@ SCM g_set_attrib_text_properties(SCM attrib_smob, SCM scm_colorname,
*
*/
static void custom_world_get_single_object_bounds
- (TOPLEVEL *w_current, OBJECT *o_current,
+ (TOPLEVEL *toplevel, OBJECT *o_current,
int *left, int *top,
int *right, int *bottom,
GList *exclude_attrib_list,
@@ -417,8 +421,8 @@ static void custom_world_get_single_object_bounds
char *name_ptr, *value_ptr, aux_ptr[2];
gboolean include_text;
- *left = rleft = w_current->init_right;
- *top = rtop = w_current->init_bottom;;
+ *left = rleft = toplevel->init_right;
+ *top = rtop = toplevel->init_bottom;;
*right = *bottom = rright = rbottom = 0;
obj_ptr = o_current;
@@ -429,7 +433,7 @@ static void custom_world_get_single_object_bounds
switch(obj_ptr->type) {
case (OBJ_PIN):
- world_get_single_object_bounds (w_current, obj_ptr,
+ world_get_single_object_bounds (toplevel, obj_ptr,
&rleft, &rtop, &rright, &rbottom);
break;
case (OBJ_TEXT):
@@ -444,7 +448,7 @@ static void custom_world_get_single_object_bounds
include_text = FALSE;
}
if (include_text) {
- world_get_single_object_bounds (w_current, obj_ptr,
+ world_get_single_object_bounds (toplevel, obj_ptr,
&rleft, &rtop, &rright, &rbottom);
}
g_free(name_ptr);
@@ -453,7 +457,7 @@ static void custom_world_get_single_object_bounds
break;
case (OBJ_COMPLEX):
case (OBJ_PLACEHOLDER):
- custom_world_get_object_list_bounds(w_current,
+ custom_world_get_object_list_bounds(toplevel,
o_current->complex->prim_objs,
left, top, right, bottom,
exclude_attrib_list,
@@ -461,7 +465,7 @@ static void custom_world_get_single_object_bounds
break;
default:
- world_get_single_object_bounds (w_current, obj_ptr,
+ world_get_single_object_bounds (toplevel, obj_ptr,
&rleft, &rtop, &rright, &rbottom);
break;
}
@@ -478,7 +482,7 @@ static void custom_world_get_single_object_bounds
g_assert(a_current->object);
if (a_current->object->type == OBJ_TEXT) {
- custom_world_get_single_object_bounds(w_current,
+ custom_world_get_single_object_bounds(toplevel,
a_current->object,
&rleft, &rtop,
&rright, &rbottom,
@@ -497,7 +501,7 @@ static void custom_world_get_single_object_bounds
}
static void custom_world_get_object_list_bounds
- (TOPLEVEL *w_current, OBJECT *o_current,
+ (TOPLEVEL *toplevel, OBJECT *o_current,
int *left, int *top,
int *right, int *bottom,
GList *exclude_attrib_list,
@@ -515,7 +519,7 @@ static void custom_world_get_object_list_bounds
obj_ptr = o_current;
while ( obj_ptr != NULL ) {
- custom_world_get_single_object_bounds(w_current, obj_ptr, &rleft, &rtop,
+ custom_world_get_single_object_bounds(toplevel, obj_ptr, &rleft, &rtop,
&rright, &rbottom,
exclude_attrib_list,
exclude_obj_type_list);
@@ -551,7 +555,7 @@ static void custom_world_get_object_list_bounds
SCM g_get_object_bounds (SCM object_smob, SCM scm_exclude_attribs, SCM scm_exclude_object_type)
{
- TOPLEVEL *w_current=NULL;
+ TOPLEVEL *toplevel=NULL;
OBJECT *object=NULL;
int left=0, right=0, bottom=0, top=0;
SCM returned = SCM_EOL;
@@ -586,16 +590,16 @@ SCM g_get_object_bounds (SCM object_smob, SCM scm_exclude_attribs, SCM scm_exclu
scm_from_int(i))));
}
- /* Get w_current and o_current. */
- g_get_data_from_object_smob (object_smob, &w_current, &object);
+ /* Get toplevel and o_current. */
+ g_get_data_from_object_smob (object_smob, &toplevel, &object);
- SCM_ASSERT (w_current && object,
+ SCM_ASSERT (toplevel && object,
object_smob, SCM_ARG1, "get-object-bounds");
if (g_list_find_custom(exclude_attrib_list, "all", (GCompareFunc) &strcmp))
exclude_all_attribs = TRUE;
- custom_world_get_single_object_bounds (w_current, object,
+ custom_world_get_single_object_bounds (toplevel, object,
&left, &top,
&right, &bottom,
exclude_attrib_list,
@@ -623,13 +627,13 @@ SCM g_get_object_bounds (SCM object_smob, SCM scm_exclude_attribs, SCM scm_exclu
*/
SCM g_get_object_pins (SCM object_smob)
{
- TOPLEVEL *w_current=NULL;
+ TOPLEVEL *toplevel=NULL;
OBJECT *object=NULL;
OBJECT *prim_obj;
SCM returned=SCM_EOL;
- /* Get w_current and o_current */
- SCM_ASSERT (g_get_data_from_object_smob (object_smob, &w_current, &object),
+ /* Get toplevel and o_current */
+ SCM_ASSERT (g_get_data_from_object_smob (object_smob, &toplevel, &object),
object_smob, SCM_ARG1, "get-object-pins");
if (!object) {
@@ -639,7 +643,7 @@ SCM g_get_object_pins (SCM object_smob)
prim_obj = object->complex->prim_objs;
while (prim_obj != NULL) {
if (prim_obj->type == OBJ_PIN) {
- returned = scm_cons (g_make_object_smob(w_current, prim_obj),returned);
+ returned = scm_cons (g_make_object_smob(toplevel, prim_obj),returned);
}
prim_obj = prim_obj->next;
}
@@ -667,7 +671,7 @@ SCM g_get_object_pins (SCM object_smob)
SCM g_add_component(SCM page_smob, SCM scm_comp_name, SCM scm_x, SCM scm_y,
SCM scm_angle, SCM scm_selectable, SCM scm_mirror)
{
- TOPLEVEL *w_current;
+ TOPLEVEL *toplevel;
PAGE *page;
gboolean selectable, mirror;
gchar *comp_name;
@@ -681,8 +685,8 @@ SCM g_add_component(SCM page_smob, SCM scm_comp_name, SCM scm_x, SCM scm_y,
return SCM_BOOL_F;
}
- /* Get w_current and the page */
- SCM_ASSERT (g_get_data_from_page_smob (page_smob, &w_current, &page),
+ /* Get toplevel and the page */
+ SCM_ASSERT (g_get_data_from_page_smob (page_smob, &toplevel, &page),
page_smob, SCM_ARG1, "add-component-at-xy");
/* Check the arguments */
SCM_ASSERT (scm_is_string(scm_comp_name), scm_comp_name,
@@ -717,7 +721,7 @@ SCM g_add_component(SCM page_smob, SCM scm_comp_name, SCM scm_x, SCM scm_y,
new_object
= page->object_tail
- = o_complex_add(w_current,
+ = o_complex_add(toplevel,
page->object_tail, NULL,
'C',
WHITE,
@@ -733,7 +737,7 @@ SCM g_add_component(SCM page_smob, SCM scm_comp_name, SCM scm_x, SCM scm_y,
#if 0
/* Now the new component should be added to the object's list and
drawn in the screen */
- o_redraw_single(w_current, new_object);
+ o_redraw_single(toplevel, new_object);
#endif
return SCM_BOOL_T;
@@ -748,19 +752,19 @@ SCM g_add_component(SCM page_smob, SCM scm_comp_name, SCM scm_x, SCM scm_y,
*/
SCM g_get_objects_in_page(SCM page_smob) {
- TOPLEVEL *w_current;
+ TOPLEVEL *toplevel;
PAGE *page;
OBJECT *object;
SCM return_list=SCM_EOL;
- /* Get w_current and the page */
- SCM_ASSERT (g_get_data_from_page_smob (page_smob, &w_current, &page),
+ /* Get toplevel and the page */
+ SCM_ASSERT (g_get_data_from_page_smob (page_smob, &toplevel, &page),
page_smob, SCM_ARG1, "add-component");
if (page && page->object_head && page->object_head->next) {
object = page->object_head->next;
while (object) {
- return_list = scm_cons (g_make_object_smob(w_current, object),
+ return_list = scm_cons (g_make_object_smob(toplevel, object),
return_list);
object = object->next;
}
diff --git a/gschem/src/g_keys.c b/gschem/src/g_keys.c
index 5e06c75..b01db41 100644
--- a/gschem/src/g_keys.c
+++ b/gschem/src/g_keys.c
@@ -34,6 +34,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -47,7 +48,7 @@
*
*/
/* for now this only supports single chars, not shift/alt/ctrl etc... */
-int g_keys_execute(TOPLEVEL *w_current, int state, int keyval)
+int g_keys_execute(GSCHEM_TOPLEVEL *w_current, int state, int keyval)
{
char *guile_string = NULL;
char *modifier = NULL;
@@ -168,13 +169,13 @@ g_keys_dump_keymap (void)
* accelerator is executed and the associated timeout interval
* has passed.
*
- * \param [in] data a pointer to the toplevel
+ * \param [in] data a pointer to the GSCHEM_TOPLEVEL
*/
static gboolean clear_keyaccel_string(gpointer data)
{
- TOPLEVEL *w_current = data;
+ GSCHEM_TOPLEVEL *w_current = data;
- /* Find out if the toplevel is present... */
+ /* Find out if the GSCHEM_TOPLEVEL is present... */
if (g_list_find(global_window_list, w_current) != NULL) {
g_free(w_current->keyaccel_string);
w_current->keyaccel_string = NULL;
diff --git a/gschem/src/g_rc.c b/gschem/src/g_rc.c
index 4dafaa6..0df725a 100644
--- a/gschem/src/g_rc.c
+++ b/gschem/src/g_rc.c
@@ -37,6 +37,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/i_vars.h"
#include "../include/globals.h"
#include "../include/prototype.h"
diff --git a/gschem/src/g_register.c b/gschem/src/g_register.c
index 781a3cb..d4d68e4 100644
--- a/gschem/src/g_register.c
+++ b/gschem/src/g_register.c
@@ -33,6 +33,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
diff --git a/gschem/src/globals.c b/gschem/src/globals.c
index c7c10d2..23644d7 100644
--- a/gschem/src/globals.c
+++ b/gschem/src/globals.c
@@ -25,6 +25,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -34,7 +35,7 @@
/* this is needed since guile scripts only deal with the current
* window set in x_event* functions */
-TOPLEVEL *global_window_current = NULL;
+GSCHEM_TOPLEVEL *global_window_current = NULL;
/* window list */
GList *global_window_list = NULL;
diff --git a/gschem/src/gschem.c b/gschem/src/gschem.c
index c0aab55..91ea7de 100644
--- a/gschem/src/gschem.c
+++ b/gschem/src/gschem.c
@@ -31,6 +31,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/i_vars.h"
#include "../include/prototype.h"
@@ -131,7 +132,7 @@ void main_prog(void *closure, int argc, char *argv[])
{
int i;
char *cwd = NULL;
- TOPLEVEL *w_current = NULL;
+ GSCHEM_TOPLEVEL *w_current = NULL;
char *input_str = NULL;
int argv_index;
int first_page = 1;
@@ -232,13 +233,14 @@ void main_prog(void *closure, int argc, char *argv[])
exit(-1);
}
- /* Allocate w_current. */
- w_current = s_toplevel_new ();
+ /* Allocate w_current */
+ w_current = gschem_toplevel_new ();
+ w_current->toplevel = s_toplevel_new ();
global_window_current = w_current;
/* Now read in RC files. */
g_rc_parse_gtkrc();
- g_rc_parse(w_current, "gschemrc", rc_filename);
+ g_rc_parse(w_current->toplevel, "gschemrc", rc_filename);
input_str = g_strdup_printf("%s%cgschem.scm", default_scheme_directory,
G_DIR_SEPARATOR);
@@ -312,14 +314,14 @@ void main_prog(void *closure, int argc, char *argv[])
}
/* Update the window to show the current page */
- x_window_set_current_page( w_current, w_current->page_current );
+ x_window_set_current_page( w_current, w_current->toplevel->page_current );
#if DEBUG
scm_c_eval_string ("(display \"hello guile\n\")");
#endif
- if (w_current->scheme_directory == NULL) {
+ if (w_current->toplevel->scheme_directory == NULL) {
fprintf(stderr, _("Scheme directory NOT set!\n"));
exit(-1);
}
diff --git a/gschem/src/gschem_dialog.c b/gschem/src/gschem_dialog.c
index b4eefd0..0daadbc 100644
--- a/gschem/src/gschem_dialog.c
+++ b/gschem/src/gschem_dialog.c
@@ -30,6 +30,7 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -78,7 +79,7 @@ gschem_marshal_VOID__POINTER_STRING (GClosure *closure,
enum {
PROP_SETTINGS_NAME = 1,
- PROP_TOPLEVEL
+ PROP_GSCHEM_TOPLEVEL
};
@@ -305,8 +306,8 @@ static void gschem_dialog_set_property (GObject *object, guint property_id, cons
if (dialog->settings_name) g_free (dialog->settings_name);
dialog->settings_name = g_strdup (g_value_get_string (value));
break;
- case PROP_TOPLEVEL:
- dialog->toplevel = (TOPLEVEL*)g_value_get_pointer (value);
+ case PROP_GSCHEM_TOPLEVEL:
+ dialog->w_current = (GSCHEM_TOPLEVEL*)g_value_get_pointer (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -335,8 +336,8 @@ static void gschem_dialog_get_property (GObject *object, guint property_id, GVal
case PROP_SETTINGS_NAME:
g_value_set_string (value, dialog->settings_name);
break;
- case PROP_TOPLEVEL:
- g_value_set_pointer (value, (gpointer)dialog->toplevel);
+ case PROP_GSCHEM_TOPLEVEL:
+ g_value_set_pointer (value, (gpointer)dialog->w_current);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -411,8 +412,8 @@ static void gschem_dialog_class_init (GschemDialogClass *klass)
NULL,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
g_object_class_install_property (
- gobject_class, PROP_TOPLEVEL,
- g_param_spec_pointer ("toplevel",
+ gobject_class, PROP_GSCHEM_TOPLEVEL,
+ g_param_spec_pointer ("gschem-toplevel",
"",
"",
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
@@ -501,7 +502,7 @@ static void gschem_dialog_add_buttons_valist (GtkDialog *dialog,
* \param [in] parent The GtkWindow which will parent this dialog
* \param [in] flags The GtkDialogFlags to use when setting up the dialog
* \param [in] settings_name The name gschem should use to store this dialog's settings
- * \param [in] toplevel The TOPLEVEL object this dialog is associated with
+ * \param [in] w_current The GSCHEM_TOPLEVEL object this dialog is associated with
*
* \return The GschemDialog created.
*/
@@ -509,13 +510,13 @@ static GtkWidget* gschem_dialog_new_empty (const gchar *title,
GtkWindow *parent,
GtkDialogFlags flags,
const gchar *settings_name,
- TOPLEVEL *toplevel)
+ GSCHEM_TOPLEVEL *w_current)
{
GschemDialog *dialog;
dialog = g_object_new (GSCHEM_TYPE_DIALOG,
"settings-name", settings_name,
- "toplevel", toplevel,
+ "gschem-toplevel", w_current,
NULL);
if (title)
@@ -548,20 +549,20 @@ static GtkWidget* gschem_dialog_new_empty (const gchar *title,
* \param [in] parent The GtkWindow which will parent this dialog
* \param [in] flags The GtkDialogFlags to use when setting up the dialog
* \param [in] settings_name The name gschem should use to store this dialog's settings
- * \param [in] toplevel The TOPLEVEL object this dialog is associated with
+ * \param [in] w_current The GSCHEM_TOPLEVEL object this dialog is associated with
* \param [in] first_button_text The text string for the first button
* \param [in] ... A variable number of arguments with the remaining button strings
*
* \return The GschemDialog created.
*/
GtkWidget* gschem_dialog_new_with_buttons (const gchar *title, GtkWindow *parent, GtkDialogFlags flags,
- const gchar *settings_name, TOPLEVEL *toplevel,
+ const gchar *settings_name, GSCHEM_TOPLEVEL *w_current,
const gchar *first_button_text, ...)
{
GschemDialog *dialog;
va_list args;
- dialog = GSCHEM_DIALOG (gschem_dialog_new_empty (title, parent, flags, settings_name, toplevel));
+ dialog = GSCHEM_DIALOG (gschem_dialog_new_empty (title, parent, flags, settings_name, w_current));
va_start (args, first_button_text);
diff --git a/gschem/src/gschem_toplevel.c b/gschem/src/gschem_toplevel.c
new file mode 100644
index 0000000..bc8493c
--- /dev/null
+++ b/gschem/src/gschem_toplevel.c
@@ -0,0 +1,210 @@
+/* gEDA - GPL Electronic Design Automation
+ * gschem - gEDA Schematic Capture
+ * Copyright (C) 1998-2007 Ales Hvezda
+ * Copyright (C) 1998-2007 gEDA Contributors (see ChangeLog for details)
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA
+ */
+#include <config.h>
+
+#include <libgeda/libgeda.h>
+
+#include "../include/gschem_struct.h"
+#include "../include/x_states.h"
+
+GSCHEM_TOPLEVEL *gschem_toplevel_new ()
+{
+ GSCHEM_TOPLEVEL *w_current;
+
+ w_current = g_new0 (GSCHEM_TOPLEVEL, 1);
+
+ w_current->toplevel = NULL;
+
+ /* ------------------- */
+ /* main window widgets */
+ /* ------------------- */
+ w_current->main_window = NULL;
+ w_current->drawing_area = NULL;
+ w_current->menubar = NULL;
+ w_current->popup_menu = NULL;
+ w_current->h_scrollbar = NULL;
+ w_current->v_scrollbar = NULL;
+ w_current->h_adjustment = NULL;
+ w_current->v_adjustment = NULL;
+ w_current->left_label = NULL;
+ w_current->middle_label = NULL;
+ w_current->right_label = NULL;
+ w_current->grid_label = NULL;
+ w_current->status_label = NULL;
+
+ w_current->toolbar_select = NULL;
+ w_current->toolbar_net = NULL;
+ w_current->toolbar_bus = NULL;
+
+ w_current->keyaccel_string = NULL;
+
+ /* ------------ */
+ /* Dialog boxes */
+ /* ------------ */
+ w_current->sowindow = NULL;
+ w_current->pfswindow = NULL;
+ w_current->cswindow = NULL;
+ w_current->iwindow = NULL;
+ w_current->pswindow = NULL;
+ w_current->tiwindow = NULL;
+ w_current->tewindow = NULL;
+ w_current->sewindow = NULL;
+ w_current->aawindow = NULL;
+ w_current->mawindow = NULL;
+ w_current->aewindow = NULL;
+ w_current->trwindow = NULL;
+ w_current->tswindow = NULL;
+ w_current->tshowwindow = NULL;
+ w_current->thidewindow = NULL;
+ w_current->tfindwindow = NULL;
+ w_current->abwindow = NULL;
+ w_current->hkwindow = NULL;
+ w_current->clwindow = NULL;
+ w_current->edit_color = 0;
+ w_current->cowindow = NULL;
+ w_current->coord_world = NULL;
+ w_current->coord_screen = NULL;
+
+ /* ----------------- */
+ /* Picture placement */
+ /* ----------------- */
+ w_current->current_pixbuf = NULL;
+ w_current->pixbuf_filename = NULL;
+ w_current->pixbuf_wh_ratio = 0;
+
+ /* ---------------------- */
+ /* graphics context stuff */
+ /* ---------------------- */
+ w_current->gc = NULL;
+ w_current->xor_gc = NULL;
+ w_current->outline_xor_gc = NULL;
+ w_current->bounding_xor_gc = NULL;
+ w_current->bus_gc = NULL;
+
+ /* ---------------- */
+ /* Drawing surfaces */
+ /* ---------------- */
+ w_current->window = NULL;
+ w_current->backingstore = NULL;
+ w_current->win_width = 0;
+ w_current->win_height = 0;
+
+ /* ------------- */
+ /* Drawing state */
+ /* ------------- */
+ w_current->start_x = -1;
+ w_current->start_y = -1;
+ w_current->save_x = -1;
+ w_current->save_y = -1;
+ w_current->last_x = -1;
+ w_current->last_y = -1;
+ w_current->second_x = -1;
+ w_current->second_y = -1;
+ w_current->loc_x = -1;
+ w_current->loc_y = -1;
+ w_current->distance = -1;
+ w_current->inside_action = 0;
+ w_current->rotated_inside = 0;
+
+ /* --------------------- */
+ /* Gschem internal state */
+ /* --------------------- */
+ w_current->num_untitled = 0;
+ w_current->event_state = SELECT;
+ w_current->image_width = 0;
+ w_current->image_height = 0;
+ w_current->grid = 1;
+ w_current->min_zoom = 0;
+ w_current->max_zoom = 8;
+ w_current->text_alignment = 0;
+ w_current->inside_redraw = 0;
+ w_current->drawbounding_action_mode = FREE;
+ w_current->last_drawb_mode = -1;
+ w_current->CONTROLKEY = 0;
+ w_current->SHIFTKEY = 0;
+ w_current->ALTKEY = 0;
+ w_current->doing_pan = 0;
+ w_current->buffer_number = 0;
+ w_current->complex_rotate = 0;
+ w_current->last_callback = NULL;
+
+ /* ------------------ */
+ /* rc/user parameters */
+ /* ------------------ */
+ w_current->graphic_color = 0;
+ w_current->net_color = 0;
+ w_current->bus_color = 0;
+ w_current->pin_color = 0;
+ w_current->text_color = 0;
+
+ w_current->logic_bubble_color = 0;
+ w_current->zoom_box_color = 0;
+ w_current->grid_color = 0;
+ w_current->select_color = 0;
+ w_current->bb_color = 0;
+ w_current->lock_color = 0;
+ w_current->stroke_color = 0;
+
+ w_current->text_caps = 0;
+ w_current->text_size = 0;
+
+ w_current->zoom_with_pan = 0;
+ w_current->actionfeedback_mode = OUTLINE;
+ w_current->text_feedback = 0;
+ w_current->text_display_zoomfactor = 0;
+ w_current->net_endpoint_mode = NONE;
+ w_current->net_midpoint_mode = NONE;
+ w_current->embed_complex = 0;
+ w_current->include_complex = 0;
+ w_current->scrollbars_flag = 0;
+ w_current->log_window = 0;
+ w_current->log_window_type = 0;
+ w_current->third_button = 0;
+ w_current->middle_button = 0;
+ w_current->file_preview = 0;
+ w_current->enforce_hierarchy = 0;
+ w_current->text_origin_marker = 0;
+ w_current->fast_mousepan = 0;
+ w_current->raise_dialog_boxes = 0;
+ w_current->continue_component_place = 0;
+ w_current->undo_levels = 0;
+ w_current->undo_control = 0;
+ w_current->undo_type = 0;
+ w_current->undo_panzoom = 0;
+ w_current->draw_grips = 0;
+ w_current->netconn_rubberband = 0;
+ w_current->sort_component_library = 0;
+ w_current->warp_cursor = 0;
+ w_current->toolbars = 0;
+ w_current->handleboxes = 0;
+ w_current->bus_ripper_size = 0;
+ w_current->bus_ripper_type = 0;
+ w_current->bus_ripper_rotation = 0;
+ w_current->grid_dot_size = 1;
+ w_current->grid_mode = GRID_VARIABLE_MODE;
+ w_current->grid_fixed_threshold = 10;
+ w_current->add_attribute_offset = 50;
+ w_current->drag_can_move = TRUE;
+ w_current->mousepan_gain = 5;
+ w_current->keyboardpan_gain = 10;
+ w_current->select_slack_pixels = 4;
+
+ return w_current;
+}
diff --git a/gschem/src/i_basic.c b/gschem/src/i_basic.c
index 2397782..9a6a3c4 100644
--- a/gschem/src/i_basic.c
+++ b/gschem/src/i_basic.c
@@ -25,6 +25,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -38,10 +39,10 @@
* This function actually updates the status bar
* widget with the new string.
*
- * \param [in] w_current TOPLEVEL structure
+ * \param [in] w_current GSCHEM_TOPLEVEL structure
* \param [in] string The new string to be shown in the status bar
*/
-static void i_update_status(TOPLEVEL *w_current, const char *string)
+static void i_update_status(GSCHEM_TOPLEVEL *w_current, const char *string)
{
if (!w_current->status_label)
return;
@@ -59,12 +60,12 @@ static void i_update_status(TOPLEVEL *w_current, const char *string)
* Returns a string describing the currently
* selected mode.
*
- * \param [in] w_current TOPLEVEL structure
+ * \param [in] w_current GSCHEM_TOPLEVEL structure
* \returns a string that will only last until the next time
* the function is called (which is probably just fine, really)
* *EK* Egil Kvaleberg
*/
-static const char *i_status_string(TOPLEVEL *w_current)
+static const char *i_status_string(GSCHEM_TOPLEVEL *w_current)
{
static char *buf = 0;
@@ -154,11 +155,12 @@ static const char *i_status_string(TOPLEVEL *w_current)
* Show state field on screen, possibly with the
* addition of an extra message
*
- * \param [in] w_current TOPLEVEL structure
+ * \param [in] w_current GSCHEM_TOPLEVEL structure
* \param [in] message The string to be displayed
*/
-void i_show_state(TOPLEVEL *w_current, const char *message)
+void i_show_state(GSCHEM_TOPLEVEL *w_current, const char *message)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
gchar *what_to_say;
const gchar *array[5] = { NULL };
int i = 3; /* array[4] must be NULL */
@@ -166,10 +168,10 @@ void i_show_state(TOPLEVEL *w_current, const char *message)
/* Fill in the string array */
array[i--] = i_status_string(w_current);
- if(w_current->show_hidden_text)
+ if(toplevel->show_hidden_text)
array[i--] = _("Show Hidden");
- if(!w_current->snap)
+ if(!toplevel->snap)
array[i--] = _("Snap Off");
if(message && message[0])
@@ -198,11 +200,11 @@ void i_show_state(TOPLEVEL *w_current, const char *message)
* \par Function Description
* Set new state, then show state field.
*
- * \param [in] w_current TOPLEVEL structure
+ * \param [in] w_current GSCHEM_TOPLEVEL structure
* \param [in] newstate The new state
* *EK* Egil Kvaleberg
*/
-void i_set_state(TOPLEVEL *w_current, enum x_states newstate)
+void i_set_state(GSCHEM_TOPLEVEL *w_current, enum x_states newstate)
{
i_set_state_msg(w_current, newstate, NULL);
}
@@ -214,12 +216,12 @@ void i_set_state(TOPLEVEL *w_current, enum x_states newstate)
* Set new state, then show state field including some
* message.
*
- * \param [in] w_current TOPLEVEL structure
+ * \param [in] w_current GSCHEM_TOPLEVEL structure
* \param [in] newstate The new state
* \param [in] message Message to be shown
* *EK* Egil Kvaleberg
*/
-void i_set_state_msg(TOPLEVEL *w_current, enum x_states newstate,
+void i_set_state_msg(GSCHEM_TOPLEVEL *w_current, enum x_states newstate,
const char *message)
{
w_current->event_state = newstate;
@@ -231,7 +233,7 @@ void i_set_state_msg(TOPLEVEL *w_current, enum x_states newstate,
* \par Function Description
*
*/
-void i_update_middle_button(TOPLEVEL *w_current,
+void i_update_middle_button(GSCHEM_TOPLEVEL *w_current,
void (*func_ptr)(gpointer, guint, GtkWidget*),
const char *string)
{
@@ -281,10 +283,10 @@ void i_update_middle_button(TOPLEVEL *w_current,
/*! \todo Finish function documentation!!!
* \brief
- * \param [in] w_current TOPLEVEL structure
+ * \param [in] w_current GSCHEM_TOPLEVEL structure
*
*/
-void i_update_toolbar(TOPLEVEL *w_current)
+void i_update_toolbar(GSCHEM_TOPLEVEL *w_current)
{
if (!w_current->toolbars)
return;
@@ -362,10 +364,11 @@ void i_update_toolbar(TOPLEVEL *w_current)
* \par Function Description
* Update sensitivity of relevant menu items.
*
- * \param [in] w_current TOPLEVEL structure
+ * \param [in] w_current GSCHEM_TOPLEVEL structure
*/
-void i_update_menus(TOPLEVEL *w_current)
+void i_update_menus(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
/*
* This is very simplistic. Right now it just disables all menu
* items which get greyed out when a component is not selected.
@@ -374,9 +377,9 @@ void i_update_menus(TOPLEVEL *w_current)
*/
g_assert(w_current != NULL);
- g_assert(w_current->page_current != NULL);
+ g_assert(toplevel->page_current != NULL);
- if ( geda_list_get_glist( w_current->page_current->selection_list ) != NULL ) {
+ if ( geda_list_get_glist( toplevel->page_current->selection_list ) != NULL ) {
/* since one or more things are selected, we set these TRUE */
/* These strings should NOT be internationalized */
x_menus_sensitivity(w_current, "Edit/Cut Buffer", TRUE);
@@ -486,10 +489,10 @@ void i_update_menus(TOPLEVEL *w_current)
* Set filename as gschem window title using
* the gnome HID format style.
*
- * \param [in] w_current TOPLEVEL structure
+ * \param [in] w_current GSCHEM_TOPLEVEL structure
* \param [in] string The filename
*/
-void i_set_filename(TOPLEVEL *w_current, const gchar *string)
+void i_set_filename(GSCHEM_TOPLEVEL *w_current, const gchar *string)
{
gchar *print_string=NULL;
gchar *filename=NULL;
@@ -518,11 +521,12 @@ void i_set_filename(TOPLEVEL *w_current, const gchar *string)
* and prints it to the status bar.
* The format is "Grid([SnapGridSize],[CurrentGridSize])"
*
- * \param [in] w_current TOPLEVEL structure
+ * \param [in] w_current GSCHEM_TOPLEVEL structure
* \param [in] visible_grid Visible grid size
*/
-void i_set_grid(TOPLEVEL *w_current, int visible_grid)
+void i_set_grid(GSCHEM_TOPLEVEL *w_current, int visible_grid)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
gchar *print_string=NULL;
gchar *snap=NULL;
gchar *grid=NULL;
@@ -530,10 +534,10 @@ void i_set_grid(TOPLEVEL *w_current, int visible_grid)
if (!w_current->grid_label)
return;
- if (!w_current->snap)
+ if (!toplevel->snap)
snap = g_strdup(_("OFF"));
else
- snap = g_strdup_printf("%d", w_current->snap_size);
+ snap = g_strdup_printf("%d", toplevel->snap_size);
if (!w_current->grid)
grid = g_strdup(_("OFF"));
diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index 0ed83ab..f73b350 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -29,6 +29,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -181,14 +182,14 @@ static void initiate_gschemdoc(const char* documentation,const char *device,
*/
DEFINE_I_CALLBACK(file_new)
{
- TOPLEVEL *toplevel = (TOPLEVEL*)data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*)data;
PAGE *page;
- exit_if_null (toplevel);
+ exit_if_null (w_current);
/* create a new page */
- page = x_window_open_untitled_page (toplevel);
- x_window_set_current_page (toplevel, page);
+ page = x_window_open_untitled_page (w_current);
+ x_window_set_current_page (w_current, page);
s_log_message (_("New page created [%s]\n"), page->page_filename);
}
@@ -202,11 +203,11 @@ DEFINE_I_CALLBACK(file_new)
*/
void i_callback_toolbar_file_new(GtkWidget* widget, gpointer data)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
if (!w_current->window) return;
- i_callback_file_new((TOPLEVEL*) data, 0, NULL);
+ i_callback_file_new(data, 0, NULL);
}
/*! \todo Finish function documentation!!!
@@ -216,14 +217,15 @@ void i_callback_toolbar_file_new(GtkWidget* widget, gpointer data)
*/
DEFINE_I_CALLBACK(file_new_window)
{
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current;
PAGE *page;
- toplevel = s_toplevel_new ();
- x_window_setup (toplevel);
+ w_current = gschem_toplevel_new ();
+ w_current->toplevel = s_toplevel_new ();
+ x_window_setup (w_current);
- page = x_window_open_untitled_page (toplevel);
- x_window_set_current_page (toplevel, page);
+ page = x_window_open_untitled_page (w_current);
+ x_window_set_current_page (w_current, page);
s_log_message (_("New Window created [%s]\n"), page->page_filename);
}
@@ -239,7 +241,7 @@ DEFINE_I_CALLBACK(file_new_window)
*/
DEFINE_I_CALLBACK(file_open)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -258,11 +260,11 @@ DEFINE_I_CALLBACK(file_open)
*/
void i_callback_toolbar_file_open(GtkWidget* widget, gpointer data)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
if (!w_current->window) return;
- i_callback_file_open((TOPLEVEL*) data, 0, NULL);
+ i_callback_file_open(data, 0, NULL);
}
/*! \todo Finish function documentation!!!
@@ -272,7 +274,7 @@ void i_callback_toolbar_file_open(GtkWidget* widget, gpointer data)
*/
DEFINE_I_CALLBACK(file_script)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
setup_script_selector(w_current);
@@ -289,7 +291,7 @@ DEFINE_I_CALLBACK(file_script)
*/
DEFINE_I_CALLBACK(file_save)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -298,13 +300,13 @@ DEFINE_I_CALLBACK(file_save)
* a user. Some twisted people might name their files like
* untitled_name. :-)
*/
- if (strstr(w_current->page_current->page_filename,
- w_current->untitled_name)) {
+ if (strstr(w_current->toplevel->page_current->page_filename,
+ w_current->toplevel->untitled_name)) {
x_fileselect_save (w_current);
} else {
x_window_save_page (w_current,
- w_current->page_current,
- w_current->page_current->page_filename);
+ w_current->toplevel->page_current,
+ w_current->toplevel->page_current->page_filename);
}
}
@@ -320,11 +322,11 @@ DEFINE_I_CALLBACK(file_save)
*/
void i_callback_toolbar_file_save(GtkWidget* widget, gpointer data)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
if (!w_current->window) return;
- i_callback_file_save((TOPLEVEL*) data, 0, NULL);
+ i_callback_file_save(data, 0, NULL);
}
/*! \todo Finish function documentation!!!
@@ -337,11 +339,11 @@ void i_callback_toolbar_file_save(GtkWidget* widget, gpointer data)
*/
DEFINE_I_CALLBACK(file_save_all)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- if (s_page_save_all(w_current)) {
+ if (s_page_save_all(w_current->toplevel)) {
i_set_state_msg(w_current, SELECT, _("Failed to Save All"));
} else {
i_set_state_msg(w_current, SELECT, _("Saved All"));
@@ -359,7 +361,7 @@ DEFINE_I_CALLBACK(file_save_all)
*/
DEFINE_I_CALLBACK(file_save_as)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
x_fileselect_save (w_current);
@@ -372,20 +374,20 @@ DEFINE_I_CALLBACK(file_save_as)
*/
DEFINE_I_CALLBACK(file_print)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
char *base=NULL;
char *ps_filename=NULL;
exit_if_null(w_current);
/* get the base file name */
- if (strcmp(fnameext_get(w_current->page_current->page_filename),
+ if (strcmp(fnameext_get(w_current->toplevel->page_current->page_filename),
".sch") == 0) {
/* the filename ends with .sch */
- base = fnameext_remove(w_current->page_current->page_filename);
+ base = fnameext_remove(w_current->toplevel->page_current->page_filename);
} else {
/* the filename does not end with .sch */
- base = g_strdup (w_current->page_current->page_filename);
+ base = g_strdup (w_current->toplevel->page_current->page_filename);
}
if(base == NULL) {
/*! \todo do something */
@@ -413,7 +415,7 @@ DEFINE_I_CALLBACK(file_print)
*/
DEFINE_I_CALLBACK(file_write_png)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -432,7 +434,7 @@ DEFINE_I_CALLBACK(file_write_png)
*/
DEFINE_I_CALLBACK(file_close)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -452,7 +454,7 @@ DEFINE_I_CALLBACK(file_close)
*/
int i_callback_close(gpointer data, guint callback_action, GtkWidget *widget)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
i_callback_file_close(w_current, 0, widget);
@@ -466,7 +468,7 @@ int i_callback_close(gpointer data, guint callback_action, GtkWidget *widget)
*/
DEFINE_I_CALLBACK(file_quit)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
x_window_close_all(w_current);
@@ -480,9 +482,9 @@ DEFINE_I_CALLBACK(file_quit)
*/
DEFINE_I_CALLBACK(edit_undo)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
- w_current->DONT_REDRAW = 0;
+ w_current->toplevel->DONT_REDRAW = 0;
o_undo_callback(w_current, UNDO_ACTION);
}
@@ -496,11 +498,11 @@ DEFINE_I_CALLBACK(edit_undo)
*/
void i_callback_toolbar_edit_undo(GtkWidget* widget, gpointer data)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
if (!w_current->window) return;
- i_callback_edit_undo((TOPLEVEL*) data, 0, NULL);
+ i_callback_edit_undo(data, 0, NULL);
}
/*! \todo Finish function documentation!!!
@@ -510,9 +512,9 @@ void i_callback_toolbar_edit_undo(GtkWidget* widget, gpointer data)
*/
DEFINE_I_CALLBACK(edit_redo)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
- w_current->DONT_REDRAW = 0;
+ w_current->toplevel->DONT_REDRAW = 0;
o_undo_callback(w_current, REDO_ACTION);
}
@@ -526,11 +528,11 @@ DEFINE_I_CALLBACK(edit_redo)
*/
void i_callback_toolbar_edit_redo(GtkWidget* widget, gpointer data)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
if (!w_current->window) return;
- i_callback_edit_redo((TOPLEVEL*) data, 0, NULL);
+ i_callback_edit_redo(data, 0, NULL);
}
/*! \todo Finish function documentation!!!
@@ -542,7 +544,7 @@ void i_callback_toolbar_edit_redo(GtkWidget* widget, gpointer data)
*/
DEFINE_I_CALLBACK(edit_select)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
o_redraw_cleanstates(w_current);
/* this is probably the only place this should be */
@@ -561,7 +563,7 @@ DEFINE_I_CALLBACK(edit_select)
*/
void i_callback_toolbar_edit_select(GtkWidget* widget, gpointer data)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
if (!w_current->window) return;
@@ -569,7 +571,7 @@ void i_callback_toolbar_edit_select(GtkWidget* widget, gpointer data)
if (!o_erase_rubber(w_current)) {
i_callback_cancel(w_current, 0, NULL);
}
- i_callback_edit_select((TOPLEVEL*) data, 0, NULL);
+ i_callback_edit_select(data, 0, NULL);
}
}
@@ -580,7 +582,7 @@ void i_callback_toolbar_edit_select(GtkWidget* widget, gpointer data)
*/
DEFINE_I_CALLBACK(edit_copy)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -599,7 +601,7 @@ DEFINE_I_CALLBACK(edit_copy)
*/
DEFINE_I_CALLBACK(edit_copy_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -620,7 +622,7 @@ DEFINE_I_CALLBACK(edit_copy_hotkey)
*/
DEFINE_I_CALLBACK(edit_mcopy)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -639,7 +641,7 @@ DEFINE_I_CALLBACK(edit_mcopy)
*/
DEFINE_I_CALLBACK(edit_mcopy_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -660,7 +662,7 @@ DEFINE_I_CALLBACK(edit_mcopy_hotkey)
*/
DEFINE_I_CALLBACK(edit_move)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -679,7 +681,7 @@ DEFINE_I_CALLBACK(edit_move)
*/
DEFINE_I_CALLBACK(edit_move_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -699,7 +701,7 @@ DEFINE_I_CALLBACK(edit_move_hotkey)
*/
DEFINE_I_CALLBACK(edit_delete)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -723,12 +725,12 @@ DEFINE_I_CALLBACK(edit_delete)
*/
DEFINE_I_CALLBACK(edit_edit)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
i_update_middle_button(w_current, i_callback_edit_edit, _("Edit"));
- o_edit(w_current, geda_list_get_glist( w_current->page_current->selection_list ) );
+ o_edit(w_current, geda_list_get_glist( w_current->toplevel->page_current->selection_list ) );
}
/*! \todo Finish function documentation!!!
@@ -738,7 +740,7 @@ DEFINE_I_CALLBACK(edit_edit)
*/
DEFINE_I_CALLBACK(edit_text)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
OBJECT *object;
exit_if_null(w_current);
@@ -759,7 +761,7 @@ DEFINE_I_CALLBACK(edit_text)
*/
DEFINE_I_CALLBACK(edit_slot)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
OBJECT *object;
exit_if_null(w_current);
@@ -779,7 +781,7 @@ DEFINE_I_CALLBACK(edit_slot)
*/
DEFINE_I_CALLBACK(edit_color)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -796,7 +798,7 @@ DEFINE_I_CALLBACK(edit_color)
*/
DEFINE_I_CALLBACK(edit_rotate_90)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -836,7 +838,7 @@ DEFINE_I_CALLBACK(edit_rotate_90)
*/
DEFINE_I_CALLBACK(edit_rotate_90_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
GList *object_list;
int w_x, w_y;
@@ -868,16 +870,16 @@ DEFINE_I_CALLBACK(edit_rotate_90_hotkey)
o_redraw_cleanstates(w_current);
- object_list = geda_list_get_glist( w_current->page_current->selection_list );
+ object_list = geda_list_get_glist( w_current->toplevel->page_current->selection_list );
if (object_list) {
i_update_middle_button(w_current,
i_callback_edit_rotate_90_hotkey, _("Rotate"));
/* Allow o_rotate_90_world to redraw the objects */
- w_current->DONT_REDRAW = 0;
- SCREENtoWORLD( w_current, mouse_x, mouse_y, &w_x, &w_y );
- w_x = snap_grid(w_current, w_x);
- w_y = snap_grid(w_current, w_y);
+ w_current->toplevel->DONT_REDRAW = 0;
+ SCREENtoWORLD( w_current->toplevel, mouse_x, mouse_y, &w_x, &w_y );
+ w_x = snap_grid(w_current->toplevel, w_x);
+ w_y = snap_grid(w_current->toplevel, w_y);
o_rotate_90_world(w_current, object_list, w_x, w_y);
}
@@ -894,7 +896,7 @@ DEFINE_I_CALLBACK(edit_rotate_90_hotkey)
*/
DEFINE_I_CALLBACK(edit_mirror)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -909,7 +911,7 @@ DEFINE_I_CALLBACK(edit_mirror)
*/
DEFINE_I_CALLBACK(edit_mirror_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
GList *object_list;
int w_x, w_y;
@@ -917,17 +919,17 @@ DEFINE_I_CALLBACK(edit_mirror_hotkey)
o_redraw_cleanstates(w_current);
- object_list = geda_list_get_glist( w_current->page_current->selection_list );
+ object_list = geda_list_get_glist( w_current->toplevel->page_current->selection_list );
if (object_list) {
i_update_middle_button(w_current,
i_callback_edit_mirror_hotkey, _("Mirror"));
- SCREENtoWORLD( w_current, mouse_x, mouse_y, &w_x, &w_y );
- w_x = snap_grid(w_current, w_x);
- w_y = snap_grid(w_current, w_y);
+ SCREENtoWORLD( w_current->toplevel, mouse_x, mouse_y, &w_x, &w_y );
+ w_x = snap_grid(w_current->toplevel, w_x);
+ w_y = snap_grid(w_current->toplevel, w_y);
- o_mirror_world(w_current,
+ o_mirror_world(w_current,
object_list,
w_x, w_y);
}
@@ -945,7 +947,7 @@ DEFINE_I_CALLBACK(edit_mirror_hotkey)
*/
DEFINE_I_CALLBACK(edit_lock)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -963,7 +965,7 @@ DEFINE_I_CALLBACK(edit_lock)
*/
DEFINE_I_CALLBACK(edit_unlock)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -980,22 +982,22 @@ DEFINE_I_CALLBACK(edit_unlock)
*/
DEFINE_I_CALLBACK(edit_translate)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
i_update_middle_button(w_current,
i_callback_edit_translate, _("Translate"));
- if (w_current->snap == 0) {
+ if (w_current->toplevel->snap == 0) {
s_log_message(_("WARNING: Do not translate with snap off!\n"));
s_log_message(_("WARNING: Turning snap on and continuing "
"with translate.\n"));
- w_current->snap = 1;
+ w_current->toplevel->snap = 1;
i_show_state(w_current, NULL); /* update status on screen */
}
- if (w_current->snap_size != 100) {
+ if (w_current->toplevel->snap_size != 100) {
s_log_message(_("WARNING: Snap grid size is "
"not equal to 100!\n"));
s_log_message(_("WARNING: If you are translating a symbol "
@@ -1014,7 +1016,7 @@ DEFINE_I_CALLBACK(edit_translate)
*/
DEFINE_I_CALLBACK(edit_embed)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
OBJECT *o_current;
exit_if_null(w_current);
@@ -1024,14 +1026,14 @@ DEFINE_I_CALLBACK(edit_embed)
if (o_select_selected(w_current)) {
/* yes, embed each selected component */
GList *s_current =
- geda_list_get_glist( w_current->page_current->selection_list );
+ geda_list_get_glist( w_current->toplevel->page_current->selection_list );
while (s_current != NULL) {
o_current = (OBJECT *) s_current->data;
g_assert (o_current != NULL);
if ( (o_current->type == OBJ_COMPLEX) ||
(o_current->type == OBJ_PICTURE) ) {
- o_embed (w_current, o_current);
+ o_embed (w_current->toplevel, o_current);
}
s_current = g_list_next(s_current);
}
@@ -1052,7 +1054,7 @@ DEFINE_I_CALLBACK(edit_embed)
*/
DEFINE_I_CALLBACK(edit_unembed)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
OBJECT *o_current;
exit_if_null(w_current);
@@ -1062,14 +1064,14 @@ DEFINE_I_CALLBACK(edit_unembed)
if (o_select_selected(w_current)) {
/* yes, unembed each selected component */
GList *s_current =
- geda_list_get_glist( w_current->page_current->selection_list );
+ geda_list_get_glist( w_current->toplevel->page_current->selection_list );
while (s_current != NULL) {
o_current = (OBJECT *) s_current->data;
g_assert (o_current != NULL);
if ( (o_current->type == OBJ_COMPLEX) ||
(o_current->type == OBJ_PICTURE) ) {
- o_unembed (w_current, o_current);
+ o_unembed (w_current->toplevel, o_current);
}
s_current = g_list_next(s_current);
}
@@ -1090,7 +1092,7 @@ DEFINE_I_CALLBACK(edit_unembed)
*/
DEFINE_I_CALLBACK(edit_update)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
OBJECT *o_current;
GList* selection_copy;
GList* s_current;
@@ -1108,7 +1110,7 @@ DEFINE_I_CALLBACK(edit_update)
/* left selected. */
/* g_list_copy does a shallow copy which is exactly what we need here */
- selection_copy = g_list_copy( geda_list_get_glist( w_current->page_current->selection_list ));
+ selection_copy = g_list_copy( geda_list_get_glist( w_current->toplevel->page_current->selection_list ));
s_current = selection_copy;
while (s_current != NULL) {
o_current = (OBJECT *) s_current->data;
@@ -1119,7 +1121,7 @@ DEFINE_I_CALLBACK(edit_update)
else
{
/* object was not a OBJ_COMPLEX, so unselect it. */
- o_selection_remove( w_current->page_current->selection_list, o_current);
+ o_selection_remove( w_current->toplevel->page_current->selection_list, o_current);
}
s_current = g_list_next(s_current);
}
@@ -1143,7 +1145,7 @@ DEFINE_I_CALLBACK(edit_update)
*/
DEFINE_I_CALLBACK(edit_show_hidden)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1156,7 +1158,7 @@ DEFINE_I_CALLBACK(edit_show_hidden)
i_callback_edit_show_hidden,
_("ShowHidden"));
- o_edit_show_hidden(w_current, w_current->page_current->object_head);
+ o_edit_show_hidden(w_current, w_current->toplevel->page_current->object_head);
}
/*! \todo Finish function documentation!!!
@@ -1166,7 +1168,7 @@ DEFINE_I_CALLBACK(edit_show_hidden)
*/
DEFINE_I_CALLBACK(edit_make_visible)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1179,7 +1181,7 @@ DEFINE_I_CALLBACK(edit_make_visible)
i_callback_edit_make_visible,
_("MakeVisible"));
- o_edit_make_visible(w_current, w_current->page_current->object_head);
+ o_edit_make_visible(w_current, w_current->toplevel->page_current->object_head);
}
/*! \todo Finish function documentation!!!
@@ -1189,7 +1191,7 @@ DEFINE_I_CALLBACK(edit_make_visible)
*/
DEFINE_I_CALLBACK(edit_find)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1208,7 +1210,7 @@ DEFINE_I_CALLBACK(edit_find)
*/
DEFINE_I_CALLBACK(edit_hide_text)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1227,7 +1229,7 @@ DEFINE_I_CALLBACK(edit_hide_text)
*/
DEFINE_I_CALLBACK(edit_show_text)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1246,7 +1248,7 @@ DEFINE_I_CALLBACK(edit_show_text)
*/
DEFINE_I_CALLBACK(edit_autonumber_text)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1265,14 +1267,14 @@ DEFINE_I_CALLBACK(edit_autonumber_text)
*/
DEFINE_I_CALLBACK(edit_linetype)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
/* anything selected ? */
if (o_select_selected(w_current)) {
GList *s_current =
- geda_list_get_glist( w_current->page_current->selection_list );
+ geda_list_get_glist( w_current->toplevel->page_current->selection_list );
GList *objects = NULL;
/* yes, build a list of relevant objects */
@@ -1308,14 +1310,14 @@ DEFINE_I_CALLBACK(edit_linetype)
*/
DEFINE_I_CALLBACK(edit_filltype)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
/* anything selected ? */
if (o_select_selected(w_current)) {
GList *s_current =
- geda_list_get_glist( w_current->page_current->selection_list );
+ geda_list_get_glist( w_current->toplevel->page_current->selection_list );
GList *objects = NULL;
/* yes, build a list of relevant objects */
@@ -1353,7 +1355,7 @@ DEFINE_I_CALLBACK(edit_filltype)
*/
DEFINE_I_CALLBACK(view_redraw)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
o_redraw_all(w_current);
@@ -1368,7 +1370,7 @@ DEFINE_I_CALLBACK(view_redraw)
*/
DEFINE_I_CALLBACK(view_zoom_full)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1389,15 +1391,14 @@ DEFINE_I_CALLBACK(view_zoom_full)
*/
DEFINE_I_CALLBACK(view_zoom_extents)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
/* scroll bar stuff */
- a_zoom_extents(w_current, w_current->page_current->object_head, 0);
-
+ a_zoom_extents(w_current, w_current->toplevel->page_current->object_head, 0);
if (w_current->undo_panzoom) {
- o_undo_savestate(w_current, UNDO_VIEWPORT_ONLY);
+ o_undo_savestate(w_current, UNDO_VIEWPORT_ONLY);
}
}
@@ -1410,7 +1411,7 @@ DEFINE_I_CALLBACK(view_zoom_extents)
*/
DEFINE_I_CALLBACK(view_zoom_box)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1426,7 +1427,7 @@ DEFINE_I_CALLBACK(view_zoom_box)
*/
DEFINE_I_CALLBACK(view_zoom_box_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1446,7 +1447,7 @@ DEFINE_I_CALLBACK(view_zoom_box_hotkey)
*/
DEFINE_I_CALLBACK(view_zoom_in)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1466,7 +1467,7 @@ DEFINE_I_CALLBACK(view_zoom_in)
*/
DEFINE_I_CALLBACK(view_zoom_out)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1487,7 +1488,7 @@ DEFINE_I_CALLBACK(view_zoom_out)
*/
DEFINE_I_CALLBACK(view_zoom_in_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1507,7 +1508,7 @@ DEFINE_I_CALLBACK(view_zoom_in_hotkey)
*/
DEFINE_I_CALLBACK(view_zoom_out_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1525,7 +1526,7 @@ DEFINE_I_CALLBACK(view_zoom_out_hotkey)
*/
DEFINE_I_CALLBACK(view_pan)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1543,7 +1544,7 @@ DEFINE_I_CALLBACK(view_pan)
*/
DEFINE_I_CALLBACK(view_pan_left)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1556,7 +1557,7 @@ DEFINE_I_CALLBACK(view_pan_left)
*/
DEFINE_I_CALLBACK(view_pan_right)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1570,7 +1571,7 @@ DEFINE_I_CALLBACK(view_pan_right)
*/
DEFINE_I_CALLBACK(view_pan_up)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1583,7 +1584,7 @@ DEFINE_I_CALLBACK(view_pan_up)
*/
DEFINE_I_CALLBACK(view_pan_down)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1598,7 +1599,7 @@ DEFINE_I_CALLBACK(view_pan_down)
*/
DEFINE_I_CALLBACK(view_pan_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1637,7 +1638,7 @@ DEFINE_I_CALLBACK(view_pan_hotkey)
*/
DEFINE_I_CALLBACK(view_update_cues)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
i_update_middle_button(w_current,
i_callback_view_update_cues, _("Update Cues"));
@@ -1653,7 +1654,7 @@ DEFINE_I_CALLBACK(view_update_cues)
*/
DEFINE_I_CALLBACK(page_manager)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -1667,14 +1668,15 @@ DEFINE_I_CALLBACK(page_manager)
*/
DEFINE_I_CALLBACK(page_next)
{
- TOPLEVEL *w_current = (TOPLEVEL*)data;
- PAGE *p_current = w_current->page_current;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*)data;
+ TOPLEVEL *toplevel = w_current->toplevel;
+ PAGE *p_current = toplevel->page_current;
PAGE *p_new;
GList *iter;
exit_if_null(w_current);
- iter = g_list_find( geda_list_get_glist( w_current->pages ), p_current );
+ iter = g_list_find( geda_list_get_glist( toplevel->pages ), p_current );
iter = g_list_next( iter );
if (iter == NULL) {
@@ -1682,7 +1684,7 @@ DEFINE_I_CALLBACK(page_next)
}
if (w_current->enforce_hierarchy) {
- p_new = s_hierarchy_find_next_page(w_current->pages, p_current, p_current->page_control);
+ p_new = s_hierarchy_find_next_page(toplevel->pages, p_current, p_current->page_control);
} else {
p_new = (PAGE *)iter->data;
}
@@ -1701,14 +1703,15 @@ DEFINE_I_CALLBACK(page_next)
*/
DEFINE_I_CALLBACK(page_prev)
{
- TOPLEVEL *w_current = (TOPLEVEL*)data;
- PAGE *p_current = w_current->page_current;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*)data;
+ TOPLEVEL *toplevel = w_current->toplevel;
+ PAGE *p_current = toplevel->page_current;
PAGE *p_new;
GList *iter;
exit_if_null(w_current);
- iter = g_list_find( geda_list_get_glist( w_current->pages ), p_current );
+ iter = g_list_find( geda_list_get_glist( toplevel->pages ), p_current );
iter = g_list_previous( iter );
if ( iter == NULL )
@@ -1717,7 +1720,7 @@ DEFINE_I_CALLBACK(page_prev)
p_new = (PAGE *)iter->data;
if (w_current->enforce_hierarchy) {
- p_new = s_hierarchy_find_prev_page(w_current->pages, p_current, p_current->page_control);
+ p_new = s_hierarchy_find_prev_page(toplevel->pages, p_current, p_current->page_control);
} else {
p_new = (PAGE *)iter->data;
}
@@ -1736,14 +1739,14 @@ DEFINE_I_CALLBACK(page_prev)
*/
DEFINE_I_CALLBACK(page_new)
{
- TOPLEVEL *toplevel = (TOPLEVEL*)data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*)data;
PAGE *page;
- exit_if_null(toplevel);
+ exit_if_null(w_current);
/* create a new page */
- page = x_window_open_untitled_page (toplevel);
- x_window_set_current_page (toplevel, page);
+ page = x_window_open_untitled_page (w_current);
+ x_window_set_current_page (w_current, page);
s_log_message (_("New page created [%s]\n"), page->page_filename);
}
@@ -1754,14 +1757,14 @@ DEFINE_I_CALLBACK(page_new)
*/
DEFINE_I_CALLBACK(page_close)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- if (w_current->page_current->CHANGED) {
- x_dialog_close_changed_page (w_current, w_current->page_current);
+ if (w_current->toplevel->page_current->CHANGED) {
+ x_dialog_close_changed_page (w_current, w_current->toplevel->page_current);
} else {
- x_window_close_page (w_current, w_current->page_current);
+ x_window_close_page (w_current, w_current->toplevel->page_current);
}
}
@@ -1774,7 +1777,7 @@ DEFINE_I_CALLBACK(page_close)
*/
DEFINE_I_CALLBACK(page_revert)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
PAGE *page;
gchar *filename;
int page_control;
@@ -1805,12 +1808,12 @@ DEFINE_I_CALLBACK(page_revert)
return;
/* save this for later */
- filename = g_strdup (w_current->page_current->page_filename);
- page_control = w_current->page_current->page_control;
- up = w_current->page_current->up;
+ filename = g_strdup (w_current->toplevel->page_current->page_filename);
+ page_control = w_current->toplevel->page_current->page_control;
+ up = w_current->toplevel->page_current->up;
/* delete the page, then re-open the file as a new page */
- s_page_delete (w_current, w_current->page_current);
+ s_page_delete (w_current->toplevel, w_current->toplevel->page_current);
page = x_window_open_page (w_current, filename);
@@ -1828,11 +1831,11 @@ DEFINE_I_CALLBACK(page_revert)
*/
DEFINE_I_CALLBACK(page_discard)
{
- TOPLEVEL *w_current = (TOPLEVEL*)data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*)data;
exit_if_null(w_current);
- x_window_close_page (w_current, w_current->page_current);
+ x_window_close_page (w_current, w_current->toplevel->page_current);
}
/*! \todo Finish function documentation!!!
@@ -1842,9 +1845,9 @@ DEFINE_I_CALLBACK(page_discard)
*/
DEFINE_I_CALLBACK(page_print)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
- s_page_print_all(w_current);
+ s_page_print_all(w_current->toplevel);
}
/*! \section buffer-menu Buffer Menu Callback Functions */
@@ -1855,11 +1858,11 @@ DEFINE_I_CALLBACK(page_print)
*/
DEFINE_I_CALLBACK(buffer_copy1)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- if ( geda_list_get_glist( w_current->page_current->selection_list ) == NULL )
+ if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list ) == NULL )
return;
i_update_middle_button(w_current, i_callback_buffer_copy1, _("Copy 1"));
@@ -1874,11 +1877,11 @@ DEFINE_I_CALLBACK(buffer_copy1)
*/
DEFINE_I_CALLBACK(buffer_copy2)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- if ( geda_list_get_glist( w_current->page_current->selection_list ) == NULL )
+ if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list ) == NULL )
return;
i_update_middle_button(w_current, i_callback_buffer_copy2, _("Copy 2"));
@@ -1893,11 +1896,11 @@ DEFINE_I_CALLBACK(buffer_copy2)
*/
DEFINE_I_CALLBACK(buffer_copy3)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- if ( geda_list_get_glist( w_current->page_current->selection_list ) == NULL )
+ if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list ) == NULL )
return;
i_update_middle_button(w_current, i_callback_buffer_copy3, _("Copy 3"));
@@ -1912,11 +1915,11 @@ DEFINE_I_CALLBACK(buffer_copy3)
*/
DEFINE_I_CALLBACK(buffer_copy4)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- if ( geda_list_get_glist( w_current->page_current->selection_list ) == NULL )
+ if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list ) == NULL )
return;
i_update_middle_button(w_current, i_callback_buffer_copy4, _("Copy 4"));
@@ -1931,11 +1934,11 @@ DEFINE_I_CALLBACK(buffer_copy4)
*/
DEFINE_I_CALLBACK(buffer_copy5)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- if ( geda_list_get_glist( w_current->page_current->selection_list ) == NULL )
+ if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list ) == NULL )
return;
i_update_middle_button(w_current, i_callback_buffer_copy5, _("Copy 5"));
@@ -1950,11 +1953,11 @@ DEFINE_I_CALLBACK(buffer_copy5)
*/
DEFINE_I_CALLBACK(buffer_cut1)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- if ( geda_list_get_glist( w_current->page_current->selection_list ) == NULL )
+ if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list ) == NULL )
return;
i_update_middle_button(w_current, i_callback_buffer_cut1, _("Cut 1"));
@@ -1969,11 +1972,11 @@ DEFINE_I_CALLBACK(buffer_cut1)
*/
DEFINE_I_CALLBACK(buffer_cut2)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- if ( geda_list_get_glist( w_current->page_current->selection_list ) == NULL )
+ if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list ) == NULL )
return;
i_update_middle_button(w_current, i_callback_buffer_cut2, _("Cut 2"));
@@ -1988,11 +1991,11 @@ DEFINE_I_CALLBACK(buffer_cut2)
*/
DEFINE_I_CALLBACK(buffer_cut3)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- if ( geda_list_get_glist( w_current->page_current->selection_list ) == NULL )
+ if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list ) == NULL )
return;
i_update_middle_button(w_current, i_callback_buffer_cut3, _("Cut 3"));
@@ -2007,11 +2010,11 @@ DEFINE_I_CALLBACK(buffer_cut3)
*/
DEFINE_I_CALLBACK(buffer_cut4)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- if ( geda_list_get_glist( w_current->page_current->selection_list ) == NULL )
+ if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list ) == NULL )
return;
i_update_middle_button(w_current, i_callback_buffer_cut4, _("Cut 4"));
@@ -2026,11 +2029,11 @@ DEFINE_I_CALLBACK(buffer_cut4)
*/
DEFINE_I_CALLBACK(buffer_cut5)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- if ( geda_list_get_glist( w_current->page_current->selection_list ) == NULL )
+ if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list ) == NULL )
return;
i_update_middle_button(w_current, i_callback_buffer_cut5, _("Cut 5"));
@@ -2045,7 +2048,7 @@ DEFINE_I_CALLBACK(buffer_cut5)
*/
DEFINE_I_CALLBACK(buffer_paste1)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2067,7 +2070,7 @@ DEFINE_I_CALLBACK(buffer_paste1)
*/
DEFINE_I_CALLBACK(buffer_paste2)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2089,7 +2092,7 @@ DEFINE_I_CALLBACK(buffer_paste2)
*/
DEFINE_I_CALLBACK(buffer_paste3)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2111,7 +2114,7 @@ DEFINE_I_CALLBACK(buffer_paste3)
*/
DEFINE_I_CALLBACK(buffer_paste4)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2133,7 +2136,7 @@ DEFINE_I_CALLBACK(buffer_paste4)
*/
DEFINE_I_CALLBACK(buffer_paste5)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2155,7 +2158,7 @@ DEFINE_I_CALLBACK(buffer_paste5)
*/
DEFINE_I_CALLBACK(buffer_paste1_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2173,7 +2176,7 @@ DEFINE_I_CALLBACK(buffer_paste1_hotkey)
*/
DEFINE_I_CALLBACK(buffer_paste2_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2191,7 +2194,7 @@ DEFINE_I_CALLBACK(buffer_paste2_hotkey)
*/
DEFINE_I_CALLBACK(buffer_paste3_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2209,7 +2212,7 @@ DEFINE_I_CALLBACK(buffer_paste3_hotkey)
*/
DEFINE_I_CALLBACK(buffer_paste4_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2227,7 +2230,7 @@ DEFINE_I_CALLBACK(buffer_paste4_hotkey)
*/
DEFINE_I_CALLBACK(buffer_paste5_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2246,7 +2249,7 @@ DEFINE_I_CALLBACK(buffer_paste5_hotkey)
*/
DEFINE_I_CALLBACK(add_component)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2269,11 +2272,11 @@ DEFINE_I_CALLBACK(add_component)
*/
void i_callback_toolbar_add_component(GtkWidget* widget, gpointer data)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
if (!w_current->window) return;
- i_callback_add_component((TOPLEVEL*) data, 0, NULL);
+ i_callback_add_component(data, 0, NULL);
}
/*! \todo Finish function documentation!!!
@@ -2283,7 +2286,7 @@ void i_callback_toolbar_add_component(GtkWidget* widget, gpointer data)
*/
DEFINE_I_CALLBACK(add_attribute)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2302,7 +2305,7 @@ DEFINE_I_CALLBACK(add_attribute)
*/
DEFINE_I_CALLBACK(add_attribute_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2321,7 +2324,7 @@ DEFINE_I_CALLBACK(add_attribute_hotkey)
*/
DEFINE_I_CALLBACK(add_net)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2343,7 +2346,7 @@ DEFINE_I_CALLBACK(add_net)
*/
DEFINE_I_CALLBACK(add_net_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2371,12 +2374,12 @@ DEFINE_I_CALLBACK(add_net_hotkey)
*/
void i_callback_toolbar_add_net(GtkWidget* widget, gpointer data)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
if (!w_current->window) return;
if (GTK_TOGGLE_BUTTON (widget)->active) {
- i_callback_add_net((TOPLEVEL*) data, 0, NULL);
+ i_callback_add_net(data, 0, NULL);
}
}
@@ -2387,7 +2390,7 @@ void i_callback_toolbar_add_net(GtkWidget* widget, gpointer data)
*/
DEFINE_I_CALLBACK(add_bus)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2410,7 +2413,7 @@ DEFINE_I_CALLBACK(add_bus)
*/
DEFINE_I_CALLBACK(add_bus_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2438,12 +2441,12 @@ DEFINE_I_CALLBACK(add_bus_hotkey)
*/
void i_callback_toolbar_add_bus(GtkWidget* widget, gpointer data)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
if (!w_current->window) return;
if (GTK_TOGGLE_BUTTON (widget)->active) {
- i_callback_add_bus((TOPLEVEL*) data, 0, NULL);
+ i_callback_add_bus(data, 0, NULL);
}
}
@@ -2454,7 +2457,7 @@ void i_callback_toolbar_add_bus(GtkWidget* widget, gpointer data)
*/
DEFINE_I_CALLBACK(add_text)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2478,11 +2481,11 @@ DEFINE_I_CALLBACK(add_text)
*/
void i_callback_toolbar_add_text(GtkWidget* widget, gpointer data)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
if (!w_current->window) return;
- i_callback_add_text((TOPLEVEL*) data, 0, NULL);
+ i_callback_add_text(data, 0, NULL);
}
/*! \todo Finish function documentation!!!
@@ -2492,7 +2495,7 @@ void i_callback_toolbar_add_text(GtkWidget* widget, gpointer data)
*/
DEFINE_I_CALLBACK(add_line)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2511,7 +2514,7 @@ DEFINE_I_CALLBACK(add_line)
*/
DEFINE_I_CALLBACK(add_line_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2533,7 +2536,7 @@ DEFINE_I_CALLBACK(add_line_hotkey)
*/
DEFINE_I_CALLBACK(add_box)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2552,7 +2555,7 @@ DEFINE_I_CALLBACK(add_box)
*/
DEFINE_I_CALLBACK(add_box_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2574,7 +2577,7 @@ DEFINE_I_CALLBACK(add_box_hotkey)
*/
DEFINE_I_CALLBACK(add_picture)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2595,7 +2598,7 @@ DEFINE_I_CALLBACK(add_picture)
*/
DEFINE_I_CALLBACK(add_picture_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
/* If this function necessary? Yes, if you want the hotkey to work. */
i_callback_add_picture(w_current, 0, NULL);
@@ -2608,7 +2611,7 @@ DEFINE_I_CALLBACK(add_picture_hotkey)
*/
DEFINE_I_CALLBACK(add_circle)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2627,7 +2630,7 @@ DEFINE_I_CALLBACK(add_circle)
*/
DEFINE_I_CALLBACK(add_circle_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2650,7 +2653,7 @@ DEFINE_I_CALLBACK(add_circle_hotkey)
*/
DEFINE_I_CALLBACK(add_arc)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2669,7 +2672,7 @@ DEFINE_I_CALLBACK(add_arc)
*/
DEFINE_I_CALLBACK(add_arc_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2691,7 +2694,7 @@ DEFINE_I_CALLBACK(add_arc_hotkey)
*/
DEFINE_I_CALLBACK(add_pin)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2710,7 +2713,7 @@ DEFINE_I_CALLBACK(add_pin)
*/
DEFINE_I_CALLBACK(add_pin_hotkey)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -2733,7 +2736,7 @@ DEFINE_I_CALLBACK(add_pin_hotkey)
*/
DEFINE_I_CALLBACK(hierarchy_down_schematic)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
char *attrib=NULL;
char *current_filename=NULL;
int count=0;
@@ -2754,7 +2757,7 @@ DEFINE_I_CALLBACK(hierarchy_down_schematic)
if (object == NULL || object->type != OBJ_COMPLEX)
return;
- parent = w_current->page_current;
+ parent = w_current->toplevel->page_current;
attrib = o_attrib_search_name_single_count(object, "source", count);
/* if above is null, then look inside symbol */
@@ -2778,7 +2781,7 @@ DEFINE_I_CALLBACK(hierarchy_down_schematic)
s_log_message(_("Searching for source [%s]\n"), current_filename);
saved_page_control = page_control;
page_control =
- s_hierarchy_down_schematic_single(w_current,
+ s_hierarchy_down_schematic_single(w_current->toplevel,
current_filename,
parent,
page_control,
@@ -2787,14 +2790,14 @@ DEFINE_I_CALLBACK(hierarchy_down_schematic)
/* s_hierarchy_down_schematic_single() will not zoom the loaded page */
if (page_control != -1) {
a_zoom_extents(w_current,
- w_current->page_current->object_head,
+ w_current->toplevel->page_current->object_head,
A_PAN_DONT_REDRAW);
o_undo_savestate(w_current, UNDO_ALL);
}
/* save the first page */
if ( !loaded_flag && page_control > 0 ) {
- save_first_page = w_current->page_current;
+ save_first_page = w_current->toplevel->page_current;
}
/* now do some error fixing */
@@ -2844,9 +2847,9 @@ DEFINE_I_CALLBACK(hierarchy_down_schematic)
if (loaded_flag) {
if (save_first_page) {
- w_current->page_current = save_first_page;
+ w_current->toplevel->page_current = save_first_page;
}
- x_window_set_current_page( w_current, w_current->page_current );
+ x_window_set_current_page( w_current, w_current->toplevel->page_current );
}
}
@@ -2857,7 +2860,7 @@ DEFINE_I_CALLBACK(hierarchy_down_schematic)
*/
DEFINE_I_CALLBACK(hierarchy_down_symbol)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
OBJECT *object;
const CLibSymbol *sym;
@@ -2870,14 +2873,14 @@ DEFINE_I_CALLBACK(hierarchy_down_symbol)
s_log_message(_("Searching for symbol [%s]\n"),
object->complex_basename);
sym = s_clib_get_symbol_by_name (object->complex_basename);
- s_hierarchy_down_symbol(w_current, sym,
- w_current->page_current);
+ s_hierarchy_down_symbol(w_current->toplevel, sym,
+ w_current->toplevel->page_current);
/* s_hierarchy_down_symbol() will not zoom the loaded page */
a_zoom_extents(w_current,
- w_current->page_current->object_head,
+ w_current->toplevel->page_current->object_head,
A_PAN_DONT_REDRAW);
o_undo_savestate(w_current, UNDO_ALL);
- x_window_set_current_page(w_current, w_current->page_current);
+ x_window_set_current_page(w_current, w_current->toplevel->page_current);
}
}
}
@@ -2889,12 +2892,12 @@ DEFINE_I_CALLBACK(hierarchy_down_symbol)
*/
DEFINE_I_CALLBACK(hierarchy_up)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- s_hierarchy_up(w_current, w_current->page_current->up);
- x_window_set_current_page(w_current, w_current->page_current);
+ s_hierarchy_up(w_current->toplevel, w_current->toplevel->page_current->up);
+ x_window_set_current_page(w_current, w_current->toplevel->page_current);
}
/*! \todo Finish function documentation!!!
@@ -2907,7 +2910,7 @@ DEFINE_I_CALLBACK(hierarchy_up)
*/
DEFINE_I_CALLBACK(hierarchy_documentation)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
char *attrib_doc = NULL;
char *attrib_device = NULL;
char *attrib_value = NULL;
@@ -2967,7 +2970,7 @@ DEFINE_I_CALLBACK(hierarchy_documentation)
*/
DEFINE_I_CALLBACK(attributes_attach)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
OBJECT *first_object;
GList *s_current;
@@ -2985,7 +2988,7 @@ DEFINE_I_CALLBACK(attributes_attach)
_("Attach"));
/* skip over head */
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( w_current->toplevel->page_current->selection_list );
if (!s_current) {
return;
}
@@ -2999,11 +3002,11 @@ DEFINE_I_CALLBACK(attributes_attach)
s_current = g_list_next(s_current);
while (s_current != NULL) {
if (s_current->data) {
- o_attrib_attach(w_current,
- w_current->page_current->object_head,
+ o_attrib_attach(w_current->toplevel,
+ w_current->toplevel->page_current->object_head,
(OBJECT *)s_current->data,
first_object);
- w_current->page_current->CHANGED=1;
+ w_current->toplevel->page_current->CHANGED=1;
}
s_current = g_list_next(s_current);
}
@@ -3017,7 +3020,7 @@ DEFINE_I_CALLBACK(attributes_attach)
*/
DEFINE_I_CALLBACK(attributes_detach)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
GList *s_current;
OBJECT *o_current;
@@ -3034,15 +3037,15 @@ DEFINE_I_CALLBACK(attributes_detach)
_("Detach"));
/* skip over head */
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( w_current->toplevel->page_current->selection_list );
while (s_current != NULL) {
o_current = (OBJECT *) s_current->data;
if (o_current) {
if (o_current->attribs) {
- o_attrib_free_all(w_current,
+ o_attrib_free_all(w_current->toplevel,
o_current->attribs);
o_current->attribs = NULL;
- w_current->page_current->CHANGED=1;
+ w_current->toplevel->page_current->CHANGED=1;
}
}
s_current = g_list_next(s_current);
@@ -3057,7 +3060,7 @@ DEFINE_I_CALLBACK(attributes_detach)
*/
DEFINE_I_CALLBACK(attributes_show_name)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
OBJECT *object;
exit_if_null(w_current);
@@ -3075,7 +3078,7 @@ DEFINE_I_CALLBACK(attributes_show_name)
if (object != NULL) {
o_attrib_toggle_show_name_value(w_current,
- geda_list_get_glist( w_current->page_current->selection_list ),
+ geda_list_get_glist( w_current->toplevel->page_current->selection_list ),
SHOW_NAME);
}
}
@@ -3087,7 +3090,7 @@ DEFINE_I_CALLBACK(attributes_show_name)
*/
DEFINE_I_CALLBACK(attributes_show_value)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
OBJECT *object;
exit_if_null(w_current);
@@ -3105,7 +3108,7 @@ DEFINE_I_CALLBACK(attributes_show_value)
if (object != NULL) {
o_attrib_toggle_show_name_value(w_current,
- geda_list_get_glist( w_current->page_current->selection_list ),
+ geda_list_get_glist( w_current->toplevel->page_current->selection_list ),
SHOW_VALUE);
}
}
@@ -3117,7 +3120,7 @@ DEFINE_I_CALLBACK(attributes_show_value)
*/
DEFINE_I_CALLBACK(attributes_show_both)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
OBJECT *object;
exit_if_null(w_current);
@@ -3135,7 +3138,7 @@ DEFINE_I_CALLBACK(attributes_show_both)
if (object != NULL) {
o_attrib_toggle_show_name_value(w_current,
- geda_list_get_glist( w_current->page_current->selection_list ),
+ geda_list_get_glist( w_current->toplevel->page_current->selection_list ),
SHOW_NAME_VALUE);
}
}
@@ -3147,7 +3150,7 @@ DEFINE_I_CALLBACK(attributes_show_both)
*/
DEFINE_I_CALLBACK(attributes_visibility_toggle)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
OBJECT *object;
exit_if_null(w_current);
@@ -3166,7 +3169,7 @@ DEFINE_I_CALLBACK(attributes_visibility_toggle)
if (object != NULL) {
o_attrib_toggle_visibility(w_current,
- geda_list_get_glist( w_current->page_current->selection_list ) );
+ geda_list_get_glist( w_current->toplevel->page_current->selection_list ) );
}
}
@@ -3180,7 +3183,7 @@ DEFINE_I_CALLBACK(attributes_visibility_toggle)
*/
DEFINE_I_CALLBACK(script_console)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
printf(_("Sorry but this is a non-functioning menu option\n"));
@@ -3198,7 +3201,7 @@ DEFINE_I_CALLBACK(script_console)
*/
DEFINE_I_CALLBACK(options_text_size)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
text_size_dialog(w_current);
@@ -3211,7 +3214,7 @@ DEFINE_I_CALLBACK(options_text_size)
*/
DEFINE_I_CALLBACK(options_snap_size)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
snap_size_dialog(w_current);
@@ -3224,12 +3227,12 @@ DEFINE_I_CALLBACK(options_snap_size)
*/
DEFINE_I_CALLBACK(options_scale_up_snap_size)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- w_current->snap_size *= 2;
- w_current->page_current->CHANGED=1; /* maybe remove those two lines */
+ w_current->toplevel->snap_size *= 2;
+ w_current->toplevel->page_current->CHANGED=1; /* maybe remove those two lines */
o_undo_savestate(w_current, UNDO_ALL);
o_redraw_all(w_current);
@@ -3242,13 +3245,13 @@ DEFINE_I_CALLBACK(options_scale_up_snap_size)
*/
DEFINE_I_CALLBACK(options_scale_down_snap_size)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
- if (w_current->snap_size % 2 == 0)
- w_current->snap_size /= 2;
- w_current->page_current->CHANGED=1; /* maybe remove those two lines */
+ if (w_current->toplevel->snap_size % 2 == 0)
+ w_current->toplevel->snap_size /= 2;
+ w_current->toplevel->page_current->CHANGED=1; /* maybe remove those two lines */
o_undo_savestate(w_current, UNDO_ALL);
o_redraw_all(w_current);
@@ -3265,7 +3268,7 @@ DEFINE_I_CALLBACK(options_scale_down_snap_size)
*/
DEFINE_I_CALLBACK(options_afeedback)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -3285,7 +3288,7 @@ DEFINE_I_CALLBACK(options_afeedback)
*/
DEFINE_I_CALLBACK(options_grid)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
@@ -3307,13 +3310,13 @@ DEFINE_I_CALLBACK(options_grid)
*/
DEFINE_I_CALLBACK(options_snap)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
- if (w_current->snap) {
- w_current->snap = 0;
+ if (w_current->toplevel->snap) {
+ w_current->toplevel->snap = 0;
s_log_message(_("Snap OFF (CAUTION!)\n"));
} else {
- w_current->snap = 1;
+ w_current->toplevel->snap = 1;
s_log_message(_("Snap ON\n"));
}
i_show_state(w_current, NULL); /* update status on screen */
@@ -3330,7 +3333,7 @@ DEFINE_I_CALLBACK(options_snap)
*/
DEFINE_I_CALLBACK(options_rubberband)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
if (w_current->netconn_rubberband) {
w_current->netconn_rubberband = 0;
@@ -3348,7 +3351,7 @@ DEFINE_I_CALLBACK(options_rubberband)
*/
DEFINE_I_CALLBACK(options_show_log_window)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
x_log_open ();
@@ -3363,9 +3366,9 @@ DEFINE_I_CALLBACK(options_show_log_window)
*/
DEFINE_I_CALLBACK(misc)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
- s_tile_print(w_current);
+ s_tile_print(w_current->toplevel);
}
/*! \todo Finish function documentation!!!
@@ -3377,7 +3380,7 @@ DEFINE_I_CALLBACK(misc)
*/
DEFINE_I_CALLBACK(misc2)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
OBJECT *first = o_select_return_first_object(w_current);
if (first) {
@@ -3410,7 +3413,7 @@ DEFINE_I_CALLBACK(misc3)
*/
DEFINE_I_CALLBACK(cancel)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
GValue value = { 0, };
exit_if_null(w_current);
@@ -3420,9 +3423,9 @@ DEFINE_I_CALLBACK(cancel)
/* user hit escape key when placing components */
/* Free the complex place list and its contents */
- s_delete_object_glist(w_current,
- w_current->page_current->complex_place_list);
- w_current->page_current->complex_place_list = NULL;
+ s_delete_object_glist(w_current->toplevel,
+ w_current->toplevel->page_current->complex_place_list);
+ w_current->toplevel->page_current->complex_place_list = NULL;
o_redraw_all(w_current);
/* Present the component selector again */
@@ -3460,21 +3463,21 @@ DEFINE_I_CALLBACK(cancel)
if ( (w_current->inside_action) &&
((w_current->event_state == ENDCOPY) ||
(w_current->event_state == ENDMCOPY)) ) {
- s_delete_object_glist(w_current,
- w_current->page_current->complex_place_list);
- w_current->page_current->complex_place_list = NULL;
+ s_delete_object_glist(w_current->toplevel,
+ w_current->toplevel->page_current->complex_place_list);
+ w_current->toplevel->page_current->complex_place_list = NULL;
}
else {
- g_list_free(w_current->page_current->complex_place_list);
+ g_list_free(w_current->toplevel->page_current->complex_place_list);
}
- w_current->page_current->complex_place_list = NULL;
+ w_current->toplevel->page_current->complex_place_list = NULL;
- s_delete_object_glist(w_current,
- w_current->page_current->attrib_place_list);
- w_current->page_current->attrib_place_list = NULL;
+ s_delete_object_glist(w_current->toplevel,
+ w_current->toplevel->page_current->attrib_place_list);
+ w_current->toplevel->page_current->attrib_place_list = NULL;
/* also free internal current_attribute */
- o_attrib_free_current(w_current);
+ o_attrib_free_current(w_current->toplevel);
w_current->inside_action=0;
}
@@ -3487,7 +3490,7 @@ DEFINE_I_CALLBACK(cancel)
*/
DEFINE_I_CALLBACK(help_about)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
about_dialog(w_current);
@@ -3500,7 +3503,7 @@ DEFINE_I_CALLBACK(help_about)
*/
DEFINE_I_CALLBACK(help_hotkeys)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
x_dialog_hotkeys(w_current);
@@ -3513,7 +3516,7 @@ DEFINE_I_CALLBACK(help_hotkeys)
*/
DEFINE_I_CALLBACK(options_show_coord_window)
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
coord_dialog (w_current, mouse_x, mouse_y);
@@ -3536,7 +3539,7 @@ gboolean i_callback_close_wm ( GtkWidget *widget, GdkEvent *event,
gpointer data )
{
- TOPLEVEL *w_current = (TOPLEVEL *) data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*) data;
exit_if_null(w_current);
x_window_close(w_current);
diff --git a/gschem/src/i_vars.c b/gschem/src/i_vars.c
index 03be196..ecd5fd4 100644
--- a/gschem/src/i_vars.c
+++ b/gschem/src/i_vars.c
@@ -22,6 +22,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/x_states.h"
#include "../include/prototype.h"
@@ -136,9 +137,10 @@ int default_select_slack_pixels = 4;
* \par Function Description
*
*/
-void i_vars_set(TOPLEVEL *w_current)
+void i_vars_set(GSCHEM_TOPLEVEL *w_current)
{
- i_vars_libgeda_set(w_current);
+ TOPLEVEL *toplevel = w_current->toplevel;
+ i_vars_libgeda_set(toplevel);
/* this will be false if logging cannot be enabled */
if (do_logging != FALSE) {
@@ -151,14 +153,14 @@ void i_vars_set(TOPLEVEL *w_current)
w_current->text_color = default_text_color;
w_current->text_size = default_text_size;
w_current->text_caps = default_text_caps;
- w_current->postscript_font_scale = default_postscript_font_scale;
+ toplevel->postscript_font_scale = default_postscript_font_scale;
- w_current->attribute_color = default_attribute_color;
- w_current->detachedattr_color = default_detachattr_color;
+ toplevel->attribute_color = default_attribute_color;
+ toplevel->detachedattr_color = default_detachattr_color;
w_current->logic_bubble_color = default_logic_bubble_color;
w_current->grid_color = default_grid_color;
- w_current->background_color = default_background_color;
+ toplevel->background_color = default_background_color;
w_current->select_color = default_select_color;
w_current->stroke_color = default_stroke_color;
@@ -167,23 +169,23 @@ void i_vars_set(TOPLEVEL *w_current)
w_current->lock_color = default_lock_color;
w_current->net_color = default_net_color;
- w_current->net_style = default_net_style;
- w_current->net_endpoint_color = default_net_endpoint_color;
+ toplevel->net_style = default_net_style;
+ toplevel->net_endpoint_color = default_net_endpoint_color;
w_current->net_endpoint_mode = default_net_endpoint_mode;
w_current->net_midpoint_mode = default_net_midpoint_mode;
- w_current->override_net_color = default_override_net_color;
+ toplevel->override_net_color = default_override_net_color;
- w_current->junction_color = default_junction_color;
+ toplevel->junction_color = default_junction_color;
w_current->bus_color = default_bus_color;
- w_current->bus_style = default_bus_style;
- w_current->override_bus_color = default_override_bus_color;
+ toplevel->bus_style = default_bus_style;
+ toplevel->override_bus_color = default_override_bus_color;
w_current->pin_color = default_pin_color;
- w_current->pin_style = default_pin_style;
- w_current->override_pin_color = default_override_pin_color;
+ toplevel->pin_style = default_pin_style;
+ toplevel->override_pin_color = default_override_pin_color;
- w_current->line_style = default_line_style;
+ toplevel->line_style = default_line_style;
w_current->zoom_with_pan = default_zoom_with_pan;
w_current->actionfeedback_mode = default_actionfeedback_mode;
@@ -191,28 +193,28 @@ void i_vars_set(TOPLEVEL *w_current)
w_current->text_feedback = default_text_feedback;
w_current->scrollbars_flag = default_scrollbars_flag;
- w_current->object_clipping = default_object_clipping;
+ toplevel->object_clipping = default_object_clipping;
w_current->embed_complex = default_embed_complex;
w_current->include_complex = default_include_complex;
- w_current->text_output = default_text_output;
- w_current->snap_size = default_snap_size;
+ toplevel->text_output = default_text_output;
+ toplevel->snap_size = default_snap_size;
w_current->log_window = default_log_window;
w_current->log_window_type = default_log_window_type;
- w_current->print_output_type = default_print_output_type;
- w_current->print_output_capstyle = default_print_output_capstyle;
- w_current->print_orientation = default_print_orientation;
- w_current->print_color = default_print_color;
- w_current->print_color_background = default_print_color_background;
- w_current->setpagedevice_orientation = default_setpagedevice_orientation;
- w_current->setpagedevice_pagesize = default_setpagedevice_pagesize;
+ toplevel->print_output_type = default_print_output_type;
+ toplevel->print_output_capstyle = default_print_output_capstyle;
+ toplevel->print_orientation = default_print_orientation;
+ toplevel->print_color = default_print_color;
+ toplevel->print_color_background = default_print_color_background;
+ toplevel->setpagedevice_orientation = default_setpagedevice_orientation;
+ toplevel->setpagedevice_pagesize = default_setpagedevice_pagesize;
- w_current->image_color = default_image_color;
+ toplevel->image_color = default_image_color;
w_current->image_width = default_image_width;
w_current->image_height = default_image_height;
w_current->third_button = default_third_button;
w_current->middle_button = default_middle_button;
- w_current->net_consolidate = default_net_consolidate;
+ toplevel->net_consolidate = default_net_consolidate;
w_current->file_preview = default_file_preview;
w_current->enforce_hierarchy = default_enforce_hierarchy;
w_current->text_origin_marker = default_text_origin_marker;
@@ -231,18 +233,18 @@ void i_vars_set(TOPLEVEL *w_current)
w_current->toolbars = default_toolbars;
w_current->handleboxes = default_handleboxes;
- w_current->paper_width = default_paper_width;
- w_current->paper_height = default_paper_height;
+ toplevel->paper_width = default_paper_width;
+ toplevel->paper_height = default_paper_height;
w_current->bus_ripper_size = default_bus_ripper_size;
w_current->bus_ripper_type = default_bus_ripper_type;
w_current->bus_ripper_rotation = default_bus_ripper_rotation;
- w_current->force_boundingbox = default_force_boundingbox;
+ toplevel->force_boundingbox = default_force_boundingbox;
w_current->grid_dot_size = default_grid_dot_size;
w_current->grid_mode = default_grid_mode;
w_current->grid_fixed_threshold = default_grid_fixed_threshold;
- w_current->print_vector_threshold = default_print_vector_threshold;
+ toplevel->print_vector_threshold = default_print_vector_threshold;
w_current->add_attribute_offset = default_add_attribute_offset;
w_current->drag_can_move = default_drag_can_move;
@@ -252,5 +254,5 @@ void i_vars_set(TOPLEVEL *w_current)
w_current->select_slack_pixels = default_select_slack_pixels;
- w_current->auto_save_interval = default_auto_save_interval;
+ toplevel->auto_save_interval = default_auto_save_interval;
}
diff --git a/gschem/src/o_arc.c b/gschem/src/o_arc.c
index 4a1fddd..8d93658 100644
--- a/gschem/src/o_arc.c
+++ b/gschem/src/o_arc.c
@@ -23,6 +23,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -53,17 +54,18 @@ typedef void (*DRAW_FUNC)( GdkDrawable *w, GdkGC *gc, GdkColor *color,
* \par Function Description
* This function is used to draw an arc on screen. The arc is described
* in the object which is referred by <B>o_current</B>. The arc is displayed
- * according to the current state, described in the TOPLEVEL object
+ * according to the current state, described in the GSCHEM_TOPLEVEL object
* pointed by <B>w_current</B>.
*
* It first checkes if the object is valid or not. If not it returns
* and do not output anything. That should never happen though.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current The arc OBJECT to draw.
*/
-void o_arc_draw(TOPLEVEL *w_current, OBJECT *o_current)
+void o_arc_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int wleft, wright, wtop, wbottom;
int x, y, radius, start_angle, end_angle;
int arc_width;
@@ -76,11 +78,11 @@ void o_arc_draw(TOPLEVEL *w_current, OBJECT *o_current)
return;
}
- world_get_arc_bounds(w_current, o_current,
+ world_get_arc_bounds(toplevel, o_current,
&wleft, &wtop, &wright, &wbottom);
- if ( (w_current->DONT_REDRAW == 1) ||
- (!visible(w_current, wleft, wtop, wright, wbottom)) ) {
+ if ( (toplevel->DONT_REDRAW == 1) ||
+ (!visible(toplevel, wleft, wtop, wright, wbottom)) ) {
return;
}
@@ -105,8 +107,8 @@ void o_arc_draw(TOPLEVEL *w_current, OBJECT *o_current)
* encountered the arc is drawn as a solid arc independently of its
* initial type.
*/
- WORLDtoSCREEN( w_current, o_current->arc->x, o_current->arc->y, &x, &y );
- radius = SCREENabs( w_current, o_current->arc->width / 2 );
+ WORLDtoSCREEN( toplevel, o_current->arc->x, o_current->arc->y, &x, &y );
+ radius = SCREENabs( toplevel, o_current->arc->width / 2 );
start_angle = o_current->arc->start_angle;
end_angle = o_current->arc->end_angle;
@@ -120,12 +122,12 @@ void o_arc_draw(TOPLEVEL *w_current, OBJECT *o_current)
radius);
#endif
- if (w_current->override_color != -1 )
- color = x_get_color(w_current->override_color);
+ if (toplevel->override_color != -1 )
+ color = x_get_color(toplevel->override_color);
else
color = x_get_color(o_current->color);
- arc_width = SCREENabs( w_current, o_current->line_width );
+ arc_width = SCREENabs( toplevel, o_current->line_width );
if(arc_width <= 0) {
arc_width = 1;
}
@@ -139,8 +141,8 @@ void o_arc_draw(TOPLEVEL *w_current, OBJECT *o_current)
break;
}
- length = SCREENabs( w_current, o_current->line_length );
- space = SCREENabs( w_current, o_current->line_space );
+ length = SCREENabs( toplevel, o_current->line_length );
+ space = SCREENabs( toplevel, o_current->line_space );
switch(o_current->line_type) {
case TYPE_SOLID:
@@ -811,14 +813,15 @@ void o_arc_draw_phantom(GdkWindow *w, GdkGC *gc,
* pointed by <B>o_current</B>.
*
* It makes a call to the #o_box_draw() function after setting the
- * special color. Therefore an arc is drawn with the background color
+ * special color. Therefo re an arc is drawn with the background color
* over the previous one.
*/
-void o_arc_erase(TOPLEVEL *w_current, OBJECT *o_current)
+void o_arc_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
- w_current->override_color = w_current->background_color;
+ TOPLEVEL *toplevel = w_current->toplevel;
+ toplevel->override_color = toplevel->background_color;
o_arc_draw(w_current, o_current);
- w_current->override_color = -1;
+ toplevel->override_color = -1;
}
/*! \todo Finish function documentation!!!
@@ -826,7 +829,7 @@ void o_arc_erase(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_arc_eraserubber(TOPLEVEL *w_current)
+void o_arc_eraserubber(GSCHEM_TOPLEVEL *w_current)
{
o_arc_rubberarc_xor(w_current);
}
@@ -840,13 +843,14 @@ void o_arc_eraserubber(TOPLEVEL *w_current)
*
* The arc is displayed with the color of the object.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] dx Delta x coordinate for arc.
* \param [in] dy Delta y coordinate for arc.
* \param [in] o_current Arc OBJECT to draw.
*/
-void o_arc_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
+void o_arc_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x, y, width, height, start_angle, end_angle;
int color;
@@ -855,11 +859,11 @@ void o_arc_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
}
/* diameter */
- width = SCREENabs( w_current, o_current->arc->width );
+ width = SCREENabs( toplevel, o_current->arc->width );
/* height MUST be equal to width, just another name for diameter */
- height = SCREENabs( w_current, o_current->arc->height );
+ height = SCREENabs( toplevel, o_current->arc->height );
/* center */
- WORLDtoSCREEN( w_current, o_current->arc->x, o_current->arc->y, &x, &y );
+ WORLDtoSCREEN( toplevel, o_current->arc->x, o_current->arc->y, &x, &y );
x -= (width / 2);
y -= (height / 2);
/* start and end angles */
@@ -904,15 +908,16 @@ void o_arc_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
* (<B>w_current->last_x</B>,<B>w_current->last_y</B>). The radius of the arc is
* in <B>w_current->distance</B>.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_arc_start(TOPLEVEL *w_current, int x, int y)
+void o_arc_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
/* set the center of the arc */
- w_current->last_x = w_current->start_x = fix_x(w_current, x);
- w_current->last_y = w_current->start_y = fix_y(w_current, y);
+ w_current->last_x = w_current->start_x = fix_x(toplevel, x);
+ w_current->last_y = w_current->start_y = fix_y(toplevel, y);
/* set the radius */
w_current->distance = 0;
@@ -938,24 +943,25 @@ void o_arc_start(TOPLEVEL *w_current, int x, int y)
*
* The two angles needs to be input to fully define the arc.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_arc_end1(TOPLEVEL *w_current, int x, int y)
+void o_arc_end1(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int diff_x, diff_y;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
/* erases the previous temporary radius segment */
o_arc_rubberarc_xor(w_current);
- w_current->last_x = fix_x(w_current, x);
- w_current->last_y = fix_y(w_current, y);
+ w_current->last_x = fix_x(toplevel, x);
+ w_current->last_y = fix_y(toplevel, y);
/* compute the radius */
diff_x = GET_BOX_WIDTH (w_current);
diff_y = GET_BOX_HEIGHT(w_current);
@@ -992,11 +998,11 @@ void o_arc_end1(TOPLEVEL *w_current, int x, int y)
* This function is used when the input of an arc is fully interactive,
* not through a dialog box.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_arc_end2(TOPLEVEL *w_current, int x, int y)
+void o_arc_end2(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
double dx, dy, d, cos_a_, sin_a_, a;
@@ -1044,12 +1050,13 @@ void o_arc_end2(TOPLEVEL *w_current, int x, int y)
* This function is used when the input of an arc is fully interactive,
* i.e. not through a dialog box.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current x coordinate of pointer in screen units.
*/
-void o_arc_end3(TOPLEVEL *w_current, int x, int y)
+void o_arc_end3(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
double d, dx, dy, cos_a_, sin_a_, a;
/* erase the previous temporary arc */
@@ -1078,15 +1085,15 @@ void o_arc_end3(TOPLEVEL *w_current, int x, int y)
w_current->loc_y = (int) a;
/* create, initialize and link the new arc object */
- w_current->page_current->object_tail =
- o_arc_add(w_current, w_current->page_current->object_tail,
+ toplevel->page_current->object_tail =
+ o_arc_add(toplevel, toplevel->page_current->object_tail,
OBJ_ARC, w_current->graphic_color,
w_current->start_x, w_current->start_y,
w_current->distance,
w_current->loc_x, w_current->loc_y);
/* draw the new object */
- o_redraw_single(w_current, w_current->page_current->object_tail);
+ o_redraw_single(w_current, toplevel->page_current->object_tail);
w_current->start_x = (-1);
w_current->start_y = (-1);
@@ -1096,7 +1103,7 @@ void o_arc_end3(TOPLEVEL *w_current, int x, int y)
w_current->loc_y = -1;
w_current->distance = -1;
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
@@ -1110,31 +1117,32 @@ void o_arc_end3(TOPLEVEL *w_current, int x, int y)
* the center and the radius of the arc, are converted in world units.
* A new object is created and linked to the object list.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] start_angle Start of angle in degrees.
* \param [in] end_angle End of angle in degrees.
*/
-void o_arc_end4(TOPLEVEL *w_current, int start_angle, int end_angle)
+void o_arc_end4(GSCHEM_TOPLEVEL *w_current, int start_angle, int end_angle)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x1, y1;
int radius;
/* get the center in world coords */
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->start_x, w_current->start_y,
&x1, &y1);
/* get the radius in world coords */
- radius = snap_grid(w_current, WORLDabs(w_current, w_current->distance));
+ radius = snap_grid(toplevel, WORLDabs(toplevel, w_current->distance));
/* create, initialize and link the new arc object */
- w_current->page_current->object_tail =
- o_arc_add(w_current, w_current->page_current->object_tail,
+ toplevel->page_current->object_tail =
+ o_arc_add(toplevel, toplevel->page_current->object_tail,
OBJ_ARC, w_current->graphic_color,
x1, y1, radius, start_angle, end_angle);
/* draw the new object */
- o_redraw_single(w_current, w_current->page_current->object_tail);
+ o_redraw_single(w_current, toplevel->page_current->object_tail);
w_current->start_x = (-1);
w_current->start_y = (-1);
@@ -1144,7 +1152,7 @@ void o_arc_end4(TOPLEVEL *w_current, int start_angle, int end_angle)
w_current->loc_y = -1;
w_current->distance = -1;
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
@@ -1169,7 +1177,7 @@ void o_arc_end4(TOPLEVEL *w_current, int start_angle, int end_angle)
* start and end angle respectively.
* </DL>
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
* \param [in] whichone Which angle to change.
@@ -1180,8 +1188,9 @@ void o_arc_end4(TOPLEVEL *w_current, int start_angle, int end_angle)
* <DT>*</DT><DD>ARC_END_ANGLE
* </DL>
*/
-void o_arc_rubberarc(TOPLEVEL *w_current, int x, int y, int whichone)
+void o_arc_rubberarc(GSCHEM_TOPLEVEL *w_current, int x, int y, int whichone)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
double dx, dy, a;
int diff_x, diff_y;
@@ -1195,8 +1204,8 @@ void o_arc_rubberarc(TOPLEVEL *w_current, int x, int y, int whichone)
* axis between the center of the arc and the mouse position.
*/
/* update the radius */
- w_current->last_x = fix_x(w_current, x);
- w_current->last_y = fix_y(w_current, y);
+ w_current->last_x = fix_x(toplevel, x);
+ w_current->last_y = fix_y(toplevel, y);
diff_x = GET_BOX_WIDTH (w_current);
diff_y = GET_BOX_HEIGHT(w_current);
@@ -1235,9 +1244,9 @@ void o_arc_rubberarc(TOPLEVEL *w_current, int x, int y, int whichone)
}
-/*! \brief Draw arc from TOPLEVEL object.
+/*! \brief Draw arc from GSCHEM_TOPLEVEL object.
* \par Function Description
- * This function draws the arc from the variables in the toplevel
+ * This function draws the arc from the variables in the GSCHEM_TOPLEVEL
* structure <B>*w_current</B>.
* The center of the arc is at (<B>w_current->start_x</B>,
* <B>w_current->start_y</B>), its radius equal to <B>w_current->radius</B>,
@@ -1247,9 +1256,9 @@ void o_arc_rubberarc(TOPLEVEL *w_current, int x, int y, int whichone)
* The arc is drawn with a xor function over the current sheet with the
* selection color.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
*/
-void o_arc_rubberarc_xor(TOPLEVEL *w_current)
+void o_arc_rubberarc_xor(GSCHEM_TOPLEVEL *w_current)
{
double tmp;
int x1, y1;
@@ -1282,11 +1291,12 @@ void o_arc_rubberarc_xor(TOPLEVEL *w_current)
* This function draws three grips on the center and on the ends of
* the arc object described by <B>*o_current</B>.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHE_TOPLEVEL object.
* \param [in] o_current Arc OBJECT to draw grip points on.
*/
-void o_arc_draw_grips(TOPLEVEL *w_current, OBJECT *o_current)
+void o_arc_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int radius, x, y, start_angle, end_angle;
int x1, y1, x2, y2;
@@ -1302,8 +1312,8 @@ void o_arc_draw_grips(TOPLEVEL *w_current, OBJECT *o_current)
* <DT>*</DT><DD>one at the end of the arc - at (<B>x2</B>,<B>y2</B>).
*/
- WORLDtoSCREEN( w_current, o_current->arc->x, o_current->arc->y, &x, &y );
- radius = SCREENabs( w_current, o_current->arc->width / 2 );
+ WORLDtoSCREEN( toplevel, o_current->arc->x, o_current->arc->y, &x, &y );
+ radius = SCREENabs( toplevel, o_current->arc->width / 2 );
start_angle = o_current->arc->start_angle;
end_angle = o_current->arc->end_angle;
@@ -1329,11 +1339,12 @@ void o_arc_draw_grips(TOPLEVEL *w_current, OBJECT *o_current)
* arc object. These grips are on the center of the arc and on each end
* of the arc.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Arc OBJECT to remove grip marks from.
*/
-void o_arc_erase_grips(TOPLEVEL *w_current, OBJECT *o_current)
+void o_arc_erase_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int radius, x, y, start_angle, end_angle;
int x1, y1, x2, y2;
@@ -1346,8 +1357,8 @@ void o_arc_erase_grips(TOPLEVEL *w_current, OBJECT *o_current)
* and (<B>x2</B>,<B>y2</B>).
*/
- WORLDtoSCREEN( w_current, o_current->arc->x, o_current->arc->y, &x, &y );
- radius = SCREENabs( w_current, o_current->arc->width / 2 );
+ WORLDtoSCREEN( toplevel, o_current->arc->x, o_current->arc->y, &x, &y );
+ radius = SCREENabs( toplevel, o_current->arc->width / 2 );
start_angle = o_current->arc->start_angle;
end_angle = o_current->arc->end_angle;
diff --git a/gschem/src/o_attrib.c b/gschem/src/o_attrib.c
index 6127d64..2abee7f 100644
--- a/gschem/src/o_attrib.c
+++ b/gschem/src/o_attrib.c
@@ -27,6 +27,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -52,7 +53,7 @@
*
* \todo get a better name
*/
-void o_attrib_add_selected(TOPLEVEL *w_current, SELECTION *selection,
+void o_attrib_add_selected(GSCHEM_TOPLEVEL *w_current, SELECTION *selection,
OBJECT *selected)
{
ATTRIB *a_current;
@@ -88,8 +89,9 @@ void o_attrib_add_selected(TOPLEVEL *w_current, SELECTION *selection,
* \par Function Description
*
*/
-void o_attrib_toggle_visibility(TOPLEVEL *w_current, GList *list)
+void o_attrib_toggle_visibility(GSCHEM_TOPLEVEL *w_current, GList *list)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *s_current = NULL;
OBJECT *object = NULL;
@@ -110,22 +112,22 @@ void o_attrib_toggle_visibility(TOPLEVEL *w_current, GList *list)
if (object->visibility == VISIBLE) {
/* only erase if we are not showing hidden text */
- if (!w_current->show_hidden_text) {
+ if (!toplevel->show_hidden_text) {
o_text_erase(w_current, object);
}
object->visibility = INVISIBLE;
- if (w_current->show_hidden_text) {
+ if (toplevel->show_hidden_text) {
/* draw text so that little I is drawn */
o_text_draw(w_current, object);
}
- w_current->page_current->CHANGED=1;
+ toplevel->page_current->CHANGED=1;
} else {
/* if we are in the special show hidden mode, then erase text first */
/* to get rid of the little I */
- if (w_current->show_hidden_text) {
+ if (toplevel->show_hidden_text) {
o_text_erase(w_current, object);
}
@@ -134,11 +136,11 @@ void o_attrib_toggle_visibility(TOPLEVEL *w_current, GList *list)
/* you must do this since real->text->complex */
/* might be null when text is invisible */
if (object->text->prim_objs == NULL)
- o_text_recreate(w_current, object);
+ o_text_recreate(toplevel, object);
o_text_draw(w_current, object);
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
}
}
s_current = g_list_next(s_current);
@@ -151,9 +153,10 @@ void o_attrib_toggle_visibility(TOPLEVEL *w_current, GList *list)
* \par Function Description
*
*/
-void o_attrib_toggle_show_name_value(TOPLEVEL *w_current,
+void o_attrib_toggle_show_name_value(GSCHEM_TOPLEVEL *w_current,
GList *list, int new_show_name_value)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *s_current = NULL;
OBJECT *object = NULL;
@@ -174,9 +177,9 @@ void o_attrib_toggle_show_name_value(TOPLEVEL *w_current,
if (object->type == OBJ_TEXT) {
o_text_erase(w_current, object);
object->show_name_value = new_show_name_value;
- o_text_recreate(w_current, object);
+ o_text_recreate(toplevel, object);
o_text_draw(w_current, object);
- w_current->page_current->CHANGED=1;
+ toplevel->page_current->CHANGED=1;
}
s_current = g_list_next(s_current);
}
@@ -191,16 +194,17 @@ void o_attrib_toggle_show_name_value(TOPLEVEL *w_current,
*/
/* This function no longer returns NULL, but will always return the new */
/* text item */
-OBJECT *o_attrib_add_attrib(TOPLEVEL *w_current,
+OBJECT *o_attrib_add_attrib(GSCHEM_TOPLEVEL *w_current,
char *text_string, int visibility,
int show_name_value, OBJECT *object)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int world_x = - 1, world_y = -1;
int color;
int left, right, top, bottom;
OBJECT *o_current;
- color = w_current->detachedattr_color;
+ color = toplevel->detachedattr_color;
o_current = object;
@@ -212,25 +216,25 @@ OBJECT *o_attrib_add_attrib(TOPLEVEL *w_current,
case(OBJ_PLACEHOLDER):
world_x = o_current->complex->x;
world_y = o_current->complex->y;
- color = w_current->attribute_color;
+ color = toplevel->attribute_color;
break;
case(OBJ_ARC):
world_x = o_current->arc->x;
world_y = o_current->arc->y;
- color = w_current->attribute_color;
+ color = toplevel->attribute_color;
break;
case(OBJ_CIRCLE):
world_x = o_current->circle->center_x;
world_y = o_current->circle->center_y;
- color = w_current->attribute_color;
+ color = toplevel->attribute_color;
break;
case(OBJ_BOX):
world_x = o_current->box->upper_x;
world_y = o_current->box->upper_y;
- color = w_current->attribute_color;
+ color = toplevel->attribute_color;
break;
case(OBJ_LINE):
@@ -239,7 +243,7 @@ OBJECT *o_attrib_add_attrib(TOPLEVEL *w_current,
case(OBJ_BUS):
world_x = o_current->line->x[0];
world_y = o_current->line->y[0];
- color = w_current->attribute_color;
+ color = toplevel->attribute_color;
break;
case(OBJ_TEXT):
@@ -247,14 +251,14 @@ OBJECT *o_attrib_add_attrib(TOPLEVEL *w_current,
world_x = o_current->text->x;
world_y = o_current->text->y;
- color = w_current->detachedattr_color;
+ color = toplevel->detachedattr_color;
o_current = NULL;
break;
}
} else {
- world_get_object_list_bounds(w_current,
- w_current->page_current->object_head,
+ world_get_object_list_bounds(toplevel,
+ toplevel->page_current->object_head,
&left, &top, &right, &bottom);
/* this really is the lower left hand corner */
@@ -262,12 +266,12 @@ OBJECT *o_attrib_add_attrib(TOPLEVEL *w_current,
world_y = top;
/* printf("%d %d\n", world_x, world_y); */
- color = w_current->detachedattr_color;
+ color = toplevel->detachedattr_color;
}
/* first create text item */
- w_current->page_current->object_tail =
- o_text_add(w_current, w_current->page_current->object_tail,
+ toplevel->page_current->object_tail =
+ o_text_add(toplevel, toplevel->page_current->object_tail,
OBJ_TEXT, color,
world_x,
world_y,
@@ -277,21 +281,21 @@ OBJECT *o_attrib_add_attrib(TOPLEVEL *w_current,
w_current->text_size, /* current text size */
visibility, show_name_value);
- /* now w_current->page_current->object_tail contains new text item */
+ /* now toplevel->page_current->object_tail contains new text item */
/* now attach the attribute to the object (if o_current is not NULL) */
/* remember that o_current contains the object to get the attribute */
if (o_current) {
- o_attrib_attach(w_current, w_current->page_current->object_head,
- w_current->page_current->object_tail,
+ o_attrib_attach(toplevel, toplevel->page_current->object_head,
+ toplevel->page_current->object_tail,
o_current);
}
- o_selection_add( w_current->page_current->selection_list,
- w_current->page_current->object_tail );
+ o_selection_add( toplevel->page_current->selection_list,
+ toplevel->page_current->object_tail );
- o_text_erase(w_current, w_current->page_current->object_tail);
- o_text_draw(w_current, w_current->page_current->object_tail);
+ o_text_erase(w_current, toplevel->page_current->object_tail);
+ o_text_draw(w_current, toplevel->page_current->object_tail);
/* handle slot= attribute, it's a special case */
if (g_ascii_strncasecmp (text_string, "slot=", 5) == 0) {
@@ -302,12 +306,12 @@ OBJECT *o_attrib_add_attrib(TOPLEVEL *w_current,
if (scm_hook_empty_p(add_attribute_hook) == SCM_BOOL_F &&
o_current != NULL) {
scm_run_hook(add_attribute_hook,
- scm_cons(g_make_object_smob(w_current,
+ scm_cons(g_make_object_smob(toplevel,
o_current),
SCM_EOL));
}
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
- return(w_current->page_current->object_tail);
+ return(toplevel->page_current->object_tail);
}
diff --git a/gschem/src/o_basic.c b/gschem/src/o_basic.c
index de4f00b..51ea8ae 100644
--- a/gschem/src/o_basic.c
+++ b/gschem/src/o_basic.c
@@ -22,6 +22,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/x_states.h"
#include "../include/prototype.h"
@@ -44,8 +45,9 @@
* \par Function Description
*
*/
-void o_redraw_all(TOPLEVEL *w_current)
+void o_redraw_all(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
o_redraw_all_fast(w_current);
if (w_current->inside_action) {
@@ -57,20 +59,20 @@ void o_redraw_all(TOPLEVEL *w_current)
case(ENDCOPY):
case(ENDMCOPY):
o_drawbounding(w_current,
- geda_list_get_glist( w_current->page_current->selection_list ),
+ geda_list_get_glist( toplevel->page_current->selection_list ),
x_get_darkcolor(w_current->bb_color), FALSE);
break;
case(DRAWCOMP):
case(ENDCOMP):
- o_drawbounding(w_current, w_current->page_current->complex_place_list,
+ o_drawbounding(w_current, toplevel->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), FALSE);
break;
case(DRAWTEXT):
case(ENDTEXT):
- o_drawbounding(w_current, w_current->page_current->attrib_place_list,
+ o_drawbounding(w_current, toplevel->page_current->attrib_place_list,
x_get_darkcolor(w_current->bb_color), FALSE);
break;
case (GRIPS):
@@ -86,20 +88,21 @@ void o_redraw_all(TOPLEVEL *w_current)
*
*/
/* basically like above but doesn't do the o_conn_disconnect_update */
-void o_redraw_all_fast(TOPLEVEL *w_current)
+void o_redraw_all_fast(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
gboolean draw_selected = TRUE;
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
x_repaint_background(w_current);
}
draw_selected = !(w_current->inside_action &&
((w_current->event_state == MOVE) ||
(w_current->event_state == ENDMOVE)));
- o_redraw(w_current, w_current->page_current->object_head, draw_selected);
+ o_redraw(w_current, toplevel->page_current->object_head, draw_selected);
o_cue_redraw_all(w_current,
- w_current->page_current->object_head, draw_selected);
+ toplevel->page_current->object_head, draw_selected);
}
/*! \todo Finish function documentation!!!
@@ -107,19 +110,20 @@ void o_redraw_all_fast(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void o_redraw(TOPLEVEL *w_current, OBJECT *object_list, gboolean draw_selected)
+void o_redraw(GSCHEM_TOPLEVEL *w_current, OBJECT *object_list, gboolean draw_selected)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current = object_list;
- int redraw_state = w_current->DONT_REDRAW;
+ int redraw_state = toplevel->DONT_REDRAW;
while (o_current != NULL) {
if ((o_current->draw_func != NULL) &&
(o_current->type != OBJ_HEAD)) {
if (o_current->selected && !draw_selected) {
- w_current->DONT_REDRAW = 1 || redraw_state;
+ toplevel->DONT_REDRAW = 1 || redraw_state;
}
else {
- w_current->DONT_REDRAW = 0 || redraw_state;
+ toplevel->DONT_REDRAW = 0 || redraw_state;
}
w_current->inside_redraw = 1;
(*o_current->draw_func)(w_current, o_current);
@@ -128,23 +132,23 @@ void o_redraw(TOPLEVEL *w_current, OBJECT *object_list, gboolean draw_selected)
o_current = o_current->next;
}
- w_current->DONT_REDRAW = redraw_state;
+ toplevel->DONT_REDRAW = redraw_state;
}
/*! \brief Redraw an object on the screen.
* \par Function Description
* This function will redraw a single object on the screen.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current The OBJECT to redraw.
*
*/
-void o_redraw_single(TOPLEVEL *w_current, OBJECT *o_current)
+void o_redraw_single(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
if (o_current == NULL)
return;
- if (w_current->DONT_REDRAW) /* highly experimental */
+ if (w_current->toplevel->DONT_REDRAW) /* highly experimental */
return;
if (o_current->draw_func != NULL && o_current->type != OBJ_HEAD) {
@@ -159,7 +163,7 @@ void o_redraw_single(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_draw_list(TOPLEVEL *w_current, GList* list)
+void o_draw_list(GSCHEM_TOPLEVEL *w_current, GList* list)
{
OBJECT* o_current;
GList *l_current;
@@ -186,15 +190,16 @@ void o_draw_list(TOPLEVEL *w_current, GList* list)
* \par Function Description
*
*/
-void o_draw_selected(TOPLEVEL *w_current)
+void o_draw_selected(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList* s_current;
OBJECT* o_current;
if (w_current->inside_redraw) {
return;
}
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
while (s_current != NULL) {
o_current = (OBJECT *) s_current->data;
@@ -212,15 +217,16 @@ void o_draw_selected(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void o_erase_selected(TOPLEVEL *w_current)
+void o_erase_selected(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList* s_current;
OBJECT* o_current;
if (w_current->inside_redraw) {
return;
}
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
while (s_current != NULL) {
o_current = (OBJECT *) s_current->data;
@@ -239,8 +245,9 @@ void o_erase_selected(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void o_erase_single(TOPLEVEL *w_current, OBJECT *object)
+void o_erase_single(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current;
if (w_current->inside_redraw) {
@@ -249,14 +256,14 @@ void o_erase_single(TOPLEVEL *w_current, OBJECT *object)
o_current = object;
- w_current->override_color = w_current->background_color;
+ toplevel->override_color = toplevel->background_color;
if (o_current != NULL) {
if (o_current->draw_func &&
o_current->type != OBJ_HEAD) {
(*o_current->draw_func)(w_current, o_current);
}
}
- w_current->override_color = -1;
+ toplevel->override_color = -1;
}
/*! \todo Finish function documentation!!!
@@ -266,9 +273,10 @@ void o_erase_single(TOPLEVEL *w_current, OBJECT *object)
*/
/* both outline and boundingbox work! */
/* name is blah */
-void o_drawbounding(TOPLEVEL *w_current, GList *o_glist,
+void o_drawbounding(GSCHEM_TOPLEVEL *w_current, GList *o_glist,
GdkColor *color, int firsttime)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int diff_x, diff_y;
int test_x, test_y;
@@ -291,21 +299,20 @@ void o_drawbounding(TOPLEVEL *w_current, GList *o_glist,
diff_y = w_current->last_y - w_current->start_y;
gdk_gc_set_foreground(w_current->bounding_xor_gc,
- x_get_color(
- w_current->background_color));
+ x_get_color(toplevel->background_color));
o_complex_translate_display_object_glist(w_current, diff_x, diff_y, o_glist);
gdk_gc_set_foreground(w_current->bounding_xor_gc, color);
- world_get_object_glist_bounds(w_current, o_glist,
+ world_get_object_glist_bounds(toplevel, o_glist,
&w_rleft ,
&w_rtop ,
&w_rright ,
&w_rbottom);
- WORLDtoSCREEN( w_current, w_rleft, w_rtop,
+ WORLDtoSCREEN( toplevel, w_rleft, w_rtop,
&rleft, &rtop );
- WORLDtoSCREEN( w_current, w_rright, w_rbottom,
+ WORLDtoSCREEN( toplevel, w_rright, w_rbottom,
&rright, &rbottom );
gdk_draw_rectangle(w_current->window,
@@ -323,7 +330,7 @@ void o_drawbounding(TOPLEVEL *w_current, GList *o_glist,
printf("going to outline\n");
#endif
- world_get_object_glist_bounds(w_current, o_glist,
+ world_get_object_glist_bounds(toplevel, o_glist,
&w_rleft ,
&w_rtop ,
&w_rright ,
@@ -332,11 +339,11 @@ void o_drawbounding(TOPLEVEL *w_current, GList *o_glist,
diff_x = w_current->last_x - w_current->start_x;
diff_y = w_current->last_y - w_current->start_y;
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->background_color));
+ x_get_color(toplevel->background_color));
- WORLDtoSCREEN( w_current, w_rleft, w_rtop,
+ WORLDtoSCREEN( toplevel, w_rleft, w_rtop,
&rleft, &rtop );
- WORLDtoSCREEN( w_current, w_rright, w_rbottom,
+ WORLDtoSCREEN( toplevel, w_rright, w_rbottom,
&rright, &rbottom );
gdk_draw_rectangle(w_current->window,
w_current->gc, FALSE,
@@ -371,7 +378,7 @@ void o_drawbounding(TOPLEVEL *w_current, GList *o_glist,
diff_x, diff_y, o_glist);
} else {
- world_get_object_glist_bounds(w_current, o_glist,
+ world_get_object_glist_bounds(toplevel, o_glist,
&w_rleft ,
&w_rtop ,
&w_rright ,
@@ -379,9 +386,9 @@ void o_drawbounding(TOPLEVEL *w_current, GList *o_glist,
gdk_gc_set_foreground(w_current->bounding_xor_gc,
color);
- WORLDtoSCREEN( w_current, w_rleft, w_rtop,
+ WORLDtoSCREEN( toplevel, w_rleft, w_rtop,
&rleft, &rtop );
- WORLDtoSCREEN( w_current, w_rright, w_rbottom,
+ WORLDtoSCREEN( toplevel, w_rright, w_rbottom,
&rright, &rbottom );
gdk_draw_rectangle(w_current->window,
w_current->bounding_xor_gc, FALSE,
@@ -407,7 +414,7 @@ void o_drawbounding(TOPLEVEL *w_current, GList *o_glist,
diff_x, diff_y, o_glist);
} else {
- world_get_object_glist_bounds(w_current, o_glist,
+ world_get_object_glist_bounds(toplevel, o_glist,
&w_rleft ,
&w_rtop ,
&w_rright ,
@@ -415,9 +422,9 @@ void o_drawbounding(TOPLEVEL *w_current, GList *o_glist,
gdk_gc_set_foreground(w_current->bounding_xor_gc,
color);
- WORLDtoSCREEN( w_current, w_rleft, w_rtop,
+ WORLDtoSCREEN( toplevel, w_rleft, w_rtop,
&rleft, &rtop );
- WORLDtoSCREEN( w_current, w_rright, w_rbottom,
+ WORLDtoSCREEN( toplevel, w_rright, w_rbottom,
&rright, &rbottom );
gdk_draw_rectangle(w_current->window,
w_current->bounding_xor_gc,
@@ -451,7 +458,7 @@ void o_drawbounding(TOPLEVEL *w_current, GList *o_glist,
} else {
/*! \todo why are we doing this here...?
* probably a reason */
- world_get_object_glist_bounds(w_current, o_glist,
+ world_get_object_glist_bounds(toplevel, o_glist,
&w_rleft ,
&w_rtop ,
&w_rright ,
@@ -477,7 +484,7 @@ void o_drawbounding(TOPLEVEL *w_current, GList *o_glist,
if (w_current->actionfeedback_mode == BOUNDINGBOX) {
if (firsttime == TRUE) {
- world_get_object_glist_bounds(w_current, o_glist,
+ world_get_object_glist_bounds(toplevel, o_glist,
&w_rleft ,
&w_rtop ,
&w_rright ,
@@ -489,9 +496,9 @@ void o_drawbounding(TOPLEVEL *w_current, GList *o_glist,
diff_x = w_current->last_x - w_current->start_x;
diff_y = w_current->last_y - w_current->start_y;
gdk_gc_set_foreground(w_current->bounding_xor_gc, color);
- WORLDtoSCREEN( w_current, w_rleft, w_rtop,
+ WORLDtoSCREEN( toplevel, w_rleft, w_rtop,
&rleft, &rtop );
- WORLDtoSCREEN( w_current, w_rright, w_rbottom,
+ WORLDtoSCREEN( toplevel, w_rright, w_rbottom,
&rright, &rbottom );
gdk_draw_rectangle(w_current->window,
w_current->bounding_xor_gc, FALSE,
@@ -519,7 +526,7 @@ void o_drawbounding(TOPLEVEL *w_current, GList *o_glist,
* \par Function Description
*
*/
-int o_erase_rubber(TOPLEVEL *w_current)
+int o_erase_rubber(GSCHEM_TOPLEVEL *w_current)
{
/* return FALSE if it did not erase anything */
@@ -588,8 +595,9 @@ int o_erase_rubber(TOPLEVEL *w_current)
* screen.
* Usually a intermediate select state would clean (redraw) the screen.
*/
-int o_redraw_cleanstates(TOPLEVEL *w_current)
+int o_redraw_cleanstates(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
/* returns FALSE if the function was'nt nessecary */
if (w_current->inside_action == 0) {
return FALSE;
@@ -631,15 +639,15 @@ int o_redraw_cleanstates(TOPLEVEL *w_current)
* remember these don't remove the head structure */
/* The complex place is a reference to the real objects, so don't
free the objects here */
- g_list_free (w_current->page_current->complex_place_list);
- w_current->page_current->complex_place_list = NULL;
+ g_list_free (toplevel->page_current->complex_place_list);
+ toplevel->page_current->complex_place_list = NULL;
- s_delete_object_glist (w_current,
- w_current->page_current->attrib_place_list);
- w_current->page_current->attrib_place_list = NULL;
+ s_delete_object_glist (toplevel,
+ toplevel->page_current->attrib_place_list);
+ toplevel->page_current->attrib_place_list = NULL;
/* also free internal current_attribute */
- o_attrib_free_current(w_current);
+ o_attrib_free_current(toplevel);
w_current->inside_action = 0;
return TRUE;
diff --git a/gschem/src/o_box.c b/gschem/src/o_box.c
index a59a0f3..d756534 100644
--- a/gschem/src/o_box.c
+++ b/gschem/src/o_box.c
@@ -23,6 +23,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -54,17 +55,18 @@ typedef void (*FILL_FUNC)( GdkDrawable *w, GdkGC *gc, GdkColor *color,
* \par Function Description
* This function is used to draw a box on screen. The box is described in
* the OBJECT which is referred by <B>o_current</B>. The box is displayed
- * according to the current state, described in the TOPLEVEL object
+ * according to the current state, described in the GSCHEM_TOPLEVEL object
* pointed by <B>w_current</B>.
*
* It first checks if the OBJECT pointed is valid or not. If not it
* returns and do not output anything. That should never happen though.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current BOX OBJECT to draw.
*/
-void o_box_draw(TOPLEVEL *w_current, OBJECT *o_current)
+void o_box_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int wleft, wright, wtop, wbottom; /* world bounds */
int s_upper_x, s_upper_y, s_lower_x, s_lower_y;
int line_width, length, space;
@@ -80,11 +82,11 @@ void o_box_draw(TOPLEVEL *w_current, OBJECT *o_current)
/* Get read to check for visibility of this line by using it's
* bounding box */
- world_get_box_bounds(w_current, o_current,
+ world_get_box_bounds(toplevel, o_current,
&wleft, &wtop, &wright, &wbottom);
- if ( (w_current->DONT_REDRAW == 1) ||
- (!visible(w_current, wleft, wtop, wright, wbottom)) ) {
+ if ( (toplevel->DONT_REDRAW == 1) ||
+ (!visible(toplevel, wleft, wtop, wright, wbottom)) ) {
return;
}
@@ -107,8 +109,8 @@ void o_box_draw(TOPLEVEL *w_current, OBJECT *o_current)
* draw the outline, the second is to draw the filling pattern inside
* (if any). Finally the function takes care of the grips.
*/
- if (w_current->override_color != -1 ) { /* Override */
- color = x_get_color(w_current->override_color);
+ if (toplevel->override_color != -1 ) { /* Override */
+ color = x_get_color(toplevel->override_color);
} else {
color = x_get_color(o_current->color);
}
@@ -129,7 +131,7 @@ void o_box_draw(TOPLEVEL *w_current, OBJECT *o_current)
* encountered the box is drawn as a solid box independently of its
* initial type.
*/
- line_width = SCREENabs( w_current, o_current->line_width );
+ line_width = SCREENabs( toplevel, o_current->line_width );
if(line_width <= 0) {
line_width = 1;
}
@@ -143,8 +145,8 @@ void o_box_draw(TOPLEVEL *w_current, OBJECT *o_current)
break;
}
- length = SCREENabs( w_current, o_current->line_length );
- space = SCREENabs( w_current, o_current->line_space );
+ length = SCREENabs( toplevel, o_current->line_length );
+ space = SCREENabs( toplevel, o_current->line_space );
switch(o_current->line_type) {
case TYPE_SOLID:
@@ -185,9 +187,9 @@ void o_box_draw(TOPLEVEL *w_current, OBJECT *o_current)
if((length == 0) || (space == 0))
draw_func = o_box_draw_solid;
- WORLDtoSCREEN( w_current, o_current->box->upper_x, o_current->box->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->box->upper_x, o_current->box->upper_y,
&s_upper_x, &s_upper_y );
- WORLDtoSCREEN( w_current, o_current->box->lower_x, o_current->box->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->box->lower_x, o_current->box->lower_y,
&s_lower_x, &s_lower_y );
(*draw_func)(w_current->window, w_current->gc, color, box_end,
@@ -225,15 +227,15 @@ void o_box_draw(TOPLEVEL *w_current, OBJECT *o_current)
* to be distinct. If such a case is encountered the circle is filled
* hollow (e.q. not filled).
*/
- fill_width = SCREENabs( w_current, o_current->fill_width );
+ fill_width = SCREENabs( toplevel, o_current->fill_width );
if(fill_width <= 0) {
fill_width = 1;
}
angle1 = o_current->fill_angle1;
- pitch1 = SCREENabs( w_current, o_current->fill_pitch1 );
+ pitch1 = SCREENabs( toplevel, o_current->fill_pitch1 );
angle2 = o_current->fill_angle2;
- pitch2 = SCREENabs( w_current, o_current->fill_pitch2 );
+ pitch2 = SCREENabs( toplevel, o_current->fill_pitch2 );
switch(o_current->fill_type) {
case FILLING_HOLLOW:
@@ -821,14 +823,15 @@ void o_box_fill_mesh(GdkDrawable *w, GdkGC *gc, GdkColor *color,
* color. Therefore a box is drawn with background color over the previous
* one.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Box OBJECT to erase.
*/
-void o_box_erase(TOPLEVEL *w_current, OBJECT *o_current)
+void o_box_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
- w_current->override_color = w_current->background_color;
+ TOPLEVEL *toplevel = w_current->toplevel;
+ toplevel->override_color = toplevel->background_color;
o_box_draw(w_current, o_current);
- w_current->override_color = -1;
+ toplevel->override_color = -1;
}
/*! \todo Finish function documentation!!!
@@ -838,7 +841,7 @@ void o_box_erase(TOPLEVEL *w_current, OBJECT *o_current)
* \note
* used in button cancel code in x_events.c
*/
-void o_box_eraserubber(TOPLEVEL *w_current)
+void o_box_eraserubber(GSCHEM_TOPLEVEL *w_current)
{
o_box_rubberbox_xor(w_current);
}
@@ -851,13 +854,14 @@ void o_box_eraserubber(TOPLEVEL *w_current)
*
* The box is displayed with the color of the object.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] dx Delta x coordinate for box.
* \param [in] dy Delta y coordinate for box.
* \param [in] o_current Box OBJECT to draw.
*/
-void o_box_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
+void o_box_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int screen_x1, screen_y1;
int screen_x2, screen_y2;
int color;
@@ -866,9 +870,9 @@ void o_box_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
return;
}
- WORLDtoSCREEN( w_current, o_current->box->upper_x, o_current->box->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->box->upper_x, o_current->box->upper_y,
&screen_x1, &screen_y1 );
- WORLDtoSCREEN( w_current, o_current->box->lower_x, o_current->box->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->box->lower_x, o_current->box->lower_y,
&screen_x2, &screen_y2 );
if (o_current->saved_color != -1) {
@@ -901,15 +905,16 @@ void o_box_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
* The other corner will be saved in (<B>w_current->last_x</B>,
* <B>w_current->last_y</B>).
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_box_start(TOPLEVEL *w_current, int x, int y)
+void o_box_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
/* init start_[x|y], last_[x|y] to describe box */
- w_current->last_x = w_current->start_x = fix_x(w_current, x);
- w_current->last_y = w_current->start_y = fix_y(w_current, y);
+ w_current->last_x = w_current->start_x = fix_x(toplevel, x);
+ w_current->last_y = w_current->start_y = fix_y(toplevel, y);
/* start to draw the box */
o_box_rubberbox_xor(w_current);
@@ -929,25 +934,26 @@ void o_box_start(TOPLEVEL *w_current, int x, int y)
* and linked to the object list ; The object is finally drawn on the
* current sheet.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_box_end(TOPLEVEL *w_current, int x, int y)
+void o_box_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x1, y1;
int x2, y2;
int box_width, box_height;
int box_left, box_top;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
/* get the last coords of the pointer */
- w_current->last_x = fix_x(w_current, x);
- w_current->last_y = fix_y(w_current, y);
+ w_current->last_x = fix_x(toplevel, x);
+ w_current->last_y = fix_y(toplevel, y);
/* erase the temporary box */
o_box_rubberbox_xor(w_current);
@@ -968,22 +974,22 @@ void o_box_end(TOPLEVEL *w_current, int x, int y)
}
/* calculate the world coords of the upper left and lower right corners */
- SCREENtoWORLD(w_current, box_left, box_top, &x1, &y1);
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel, box_left, box_top, &x1, &y1);
+ SCREENtoWORLD(toplevel,
box_left + box_width, box_top + box_height, &x2, &y2);
- x1 = snap_grid(w_current, x1);
- y1 = snap_grid(w_current, y1);
- x2 = snap_grid(w_current, x2);
- y2 = snap_grid(w_current, y2);
+ x1 = snap_grid(toplevel, x1);
+ y1 = snap_grid(toplevel, y1);
+ x2 = snap_grid(toplevel, x2);
+ y2 = snap_grid(toplevel, y2);
/* create the object */
- w_current->page_current->object_tail =
- o_box_add(w_current,
- w_current->page_current->object_tail,
+ toplevel->page_current->object_tail =
+ o_box_add(toplevel,
+ toplevel->page_current->object_tail,
OBJ_BOX, w_current->graphic_color, x1, y1, x2, y2);
/* draw it */
- o_redraw_single(w_current, w_current->page_current->object_tail);
+ o_redraw_single(w_current, toplevel->page_current->object_tail);
#if DEBUG
printf("coords: %d %d %d %d\n", x1, y2, x2, y2);
@@ -994,7 +1000,7 @@ void o_box_end(TOPLEVEL *w_current, int x, int y)
w_current->last_x = (-1);
w_current->last_y = (-1);
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
}
@@ -1010,14 +1016,15 @@ void o_box_end(TOPLEVEL *w_current, int x, int y)
* height and left and top values are recomputed by the corresponding macros.
* The box is then erased by performing a xor-drawing over the box.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_box_rubberbox(TOPLEVEL *w_current, int x, int y)
+void o_box_rubberbox(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
@@ -1031,17 +1038,17 @@ void o_box_rubberbox(TOPLEVEL *w_current, int x, int y)
*/
/* update the coords of the corner */
- w_current->last_x = fix_x(w_current, x);
- w_current->last_y = fix_y(w_current, y);
+ w_current->last_x = fix_x(toplevel, x);
+ w_current->last_y = fix_y(toplevel, y);
/* draw the new temporary box */
o_box_rubberbox_xor(w_current);
}
-/*! \brief Draw box from TOPLEVEL object.
+/*! \brief Draw box from GSCHEM_TOPLEVEL object.
* \par Function Description
- * This function draws the box from the variables in the toplevel
+ * This function draws the box from the variables in the GSCHEM_TOPLEVEL
* structure <B>*w_current</B>.
* One corner of the box is at (<B>w_current->start_x</B>,
* <B>w_current->start_y</B>) and the second corner is at
@@ -1050,9 +1057,9 @@ void o_box_rubberbox(TOPLEVEL *w_current, int x, int y)
* The box is drawn with a xor-function over the current sheet with the
* selection color.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
*/
-void o_box_rubberbox_xor(TOPLEVEL *w_current)
+void o_box_rubberbox_xor(GSCHEM_TOPLEVEL *w_current)
{
int box_width, box_height, box_left, box_top;
@@ -1078,22 +1085,23 @@ void o_box_rubberbox_xor(TOPLEVEL *w_current)
* This function draws four grips on the corners of the box described
* by <B>*o_current</B>.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Box OBJECT to draw grip points on.
*
* \par Author's note
* p20011003 - modified the prototype : removed parameter 'GdkWindow *w'
*/
-void o_box_draw_grips(TOPLEVEL *w_current, OBJECT *o_current)
+void o_box_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int s_upper_x, s_upper_y, s_lower_x, s_lower_y;
if (w_current->draw_grips == FALSE)
return;
- WORLDtoSCREEN( w_current, o_current->box->upper_x, o_current->box->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->box->upper_x, o_current->box->upper_y,
&s_upper_x, &s_upper_y );
- WORLDtoSCREEN( w_current, o_current->box->lower_x, o_current->box->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->box->lower_x, o_current->box->lower_y,
&s_lower_x, &s_lower_y );
/* grip on upper left corner (whichone = BOX_UPPER_LEFT) */
@@ -1115,19 +1123,20 @@ void o_box_draw_grips(TOPLEVEL *w_current, OBJECT *o_current)
* This function erases the four grips displayed on the <B>*o_current</B>
* box object. These grips are on each of the corner.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Box OBJECT to erase grip marks from.
*/
-void o_box_erase_grips(TOPLEVEL *w_current, OBJECT *o_current)
+void o_box_erase_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int s_upper_x, s_upper_y, s_lower_x, s_lower_y;
if (w_current->draw_grips == FALSE)
return;
- WORLDtoSCREEN( w_current, o_current->box->upper_x, o_current->box->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->box->upper_x, o_current->box->upper_y,
&s_upper_x, &s_upper_y );
- WORLDtoSCREEN( w_current, o_current->box->lower_x, o_current->box->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->box->lower_x, o_current->box->lower_y,
&s_lower_x, &s_lower_y );
/* grip on upper left corner (whichone = BOX_UPPER_LEFT) */
diff --git a/gschem/src/o_buffer.c b/gschem/src/o_buffer.c
index 85cfac4..e7d2285 100644
--- a/gschem/src/o_buffer.c
+++ b/gschem/src/o_buffer.c
@@ -22,6 +22,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -34,8 +35,9 @@
* \par Function Description
*
*/
-void o_buffer_copy(TOPLEVEL *w_current, int buf_num)
+void o_buffer_copy(GSCHEM_TOPLEVEL *w_current, int buf_num)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *s_current = NULL;
if (buf_num < 0 || buf_num > MAX_BUFFERS) {
@@ -43,18 +45,18 @@ void o_buffer_copy(TOPLEVEL *w_current, int buf_num)
return;
}
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
if (object_buffer[buf_num] != NULL) {
- s_delete_object_glist(w_current, object_buffer[buf_num]);
+ s_delete_object_glist(toplevel, object_buffer[buf_num]);
object_buffer[buf_num] = NULL;
}
- w_current->ADDING_SEL = 1;
+ toplevel->ADDING_SEL = 1;
object_buffer[buf_num] =
- o_glist_copy_all_to_glist(w_current, s_current,
+ o_glist_copy_all_to_glist(toplevel, s_current,
object_buffer[buf_num], SELECTION_FLAG);
- w_current->ADDING_SEL = 0;
+ toplevel->ADDING_SEL = 0;
}
/*! \todo Finish function documentation!!!
@@ -62,8 +64,9 @@ void o_buffer_copy(TOPLEVEL *w_current, int buf_num)
* \par Function Description
*
*/
-void o_buffer_cut(TOPLEVEL *w_current, int buf_num)
+void o_buffer_cut(GSCHEM_TOPLEVEL *w_current, int buf_num)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *s_current = NULL;
if (buf_num < 0 || buf_num > MAX_BUFFERS) {
@@ -71,18 +74,18 @@ void o_buffer_cut(TOPLEVEL *w_current, int buf_num)
return;
}
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
if (object_buffer[buf_num] != NULL) {
- s_delete_object_glist(w_current, object_buffer[buf_num]);
+ s_delete_object_glist(toplevel, object_buffer[buf_num]);
object_buffer[buf_num] = NULL;
}
- w_current->ADDING_SEL = 1;
+ toplevel->ADDING_SEL = 1;
object_buffer[buf_num] =
- o_glist_copy_all_to_glist(w_current, s_current,
+ o_glist_copy_all_to_glist(toplevel, s_current,
object_buffer[buf_num], SELECTION_FLAG);
- w_current->ADDING_SEL = 0;
+ toplevel->ADDING_SEL = 0;
o_delete(w_current);
}
@@ -91,9 +94,10 @@ void o_buffer_cut(TOPLEVEL *w_current, int buf_num)
* \par Function Description
*
*/
-void o_buffer_paste_start(TOPLEVEL *w_current, int screen_x, int screen_y,
+void o_buffer_paste_start(GSCHEM_TOPLEVEL *w_current, int screen_x, int screen_y,
int buf_num)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int rleft, rtop, rbottom, rright;
int x, y;
@@ -102,7 +106,7 @@ void o_buffer_paste_start(TOPLEVEL *w_current, int screen_x, int screen_y,
return;
}
- if (!world_get_object_glist_bounds(w_current, object_buffer[buf_num],
+ if (!world_get_object_glist_bounds(toplevel, object_buffer[buf_num],
&rleft, &rtop,
&rright, &rbottom)) {
/* If the paste buffer doesn't have any objects
@@ -111,24 +115,24 @@ void o_buffer_paste_start(TOPLEVEL *w_current, int screen_x, int screen_y,
}
/* snap x and y to the grid, pointed out by Martin Benes */
- x = snap_grid(w_current, rleft);
- y = snap_grid(w_current, rtop);
+ x = snap_grid(toplevel, rleft);
+ y = snap_grid(toplevel, rtop);
- w_current->ADDING_SEL = 1;
- o_glist_translate_world(w_current, -x, -y, object_buffer[buf_num]);
- w_current->ADDING_SEL = 0;
+ toplevel->ADDING_SEL = 1;
+ o_glist_translate_world(toplevel, -x, -y, object_buffer[buf_num]);
+ toplevel->ADDING_SEL = 0;
/* now translate selection to current position */
- SCREENtoWORLD(w_current, screen_x, screen_y, &x, &y);
- x = snap_grid(w_current, x);
- y = snap_grid(w_current, y);
+ SCREENtoWORLD(toplevel, screen_x, screen_y, &x, &y);
+ x = snap_grid(toplevel, x);
+ y = snap_grid(toplevel, y);
- w_current->ADDING_SEL = 1;
- o_glist_translate_world(w_current, x, y, object_buffer[buf_num]);
- w_current->ADDING_SEL = 0;
+ toplevel->ADDING_SEL = 1;
+ o_glist_translate_world(toplevel, x, y, object_buffer[buf_num]);
+ toplevel->ADDING_SEL = 0;
- w_current->last_x = w_current->start_x = fix_x(w_current, screen_x);
- w_current->last_y = w_current->start_y = fix_y(w_current, screen_y);
+ w_current->last_x = w_current->start_x = fix_x(toplevel, screen_x);
+ w_current->last_y = w_current->start_y = fix_y(toplevel, screen_y);
w_current->event_state = ENDPASTE;
/* store the buffer number for future use */
@@ -143,9 +147,10 @@ void o_buffer_paste_start(TOPLEVEL *w_current, int screen_x, int screen_y,
* \par Function Description
*
*/
-void o_buffer_paste_end(TOPLEVEL *w_current, int screen_x, int screen_y,
+void o_buffer_paste_end(GSCHEM_TOPLEVEL *w_current, int screen_x, int screen_y,
int buf_num)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int w_x, w_y;
int w_start_x, w_start_y;
int w_diff_x, w_diff_y;
@@ -165,13 +170,13 @@ void o_buffer_paste_end(TOPLEVEL *w_current, int screen_x, int screen_y,
x_get_darkcolor(w_current->bb_color), FALSE);
/* get the location where we ended */
- SCREENtoWORLD(w_current, screen_x, screen_y, &w_x, &w_y);
- SCREENtoWORLD(w_current, w_current->start_x, w_current->start_y,
+ SCREENtoWORLD(toplevel, screen_x, screen_y, &w_x, &w_y);
+ SCREENtoWORLD(toplevel, w_current->start_x, w_current->start_y,
&w_start_x, &w_start_y);
- w_x = snap_grid(w_current, w_x);
- w_y = snap_grid(w_current, w_y);
- w_start_x = snap_grid(w_current, w_start_x);
- w_start_y = snap_grid(w_current, w_start_y);
+ w_x = snap_grid(toplevel, w_x);
+ w_y = snap_grid(toplevel, w_y);
+ w_start_x = snap_grid(toplevel, w_start_x);
+ w_start_y = snap_grid(toplevel, w_start_y);
#if DEBUG
printf("%d %d\n", w_x - w_start_x, w_y - w_start_y);
@@ -179,16 +184,16 @@ void o_buffer_paste_end(TOPLEVEL *w_current, int screen_x, int screen_y,
/* calc and translate objects to their final position */
w_diff_x = w_x - w_start_x;
w_diff_y = w_y - w_start_y;
- w_current->ADDING_SEL = 1;
- o_glist_translate_world(w_current, w_diff_x, w_diff_y,
+ toplevel->ADDING_SEL = 1;
+ o_glist_translate_world(toplevel, w_diff_x, w_diff_y,
object_buffer[buf_num]);
- w_current->ADDING_SEL = 0;
+ toplevel->ADDING_SEL = 0;
o_current = object_buffer[buf_num]->data;
- p_current = w_current->page_current;
+ p_current = toplevel->page_current;
o_saved = p_current->object_tail;
- o_list_copy_all(w_current, o_current, p_current->object_tail,
+ o_list_copy_all(toplevel, o_current, p_current->object_tail,
NORMAL_FLAG);
p_current->object_tail = return_tail(p_current->object_head);
@@ -197,7 +202,7 @@ void o_buffer_paste_end(TOPLEVEL *w_current, int screen_x, int screen_y,
/* now add new objects to the selection list */
while (o_current != NULL) {
o_selection_add( temp_list, o_current );
- s_conn_update_object(w_current, o_current);
+ s_conn_update_object(toplevel, o_current);
if (o_current->type == OBJ_COMPLEX || o_current->type == OBJ_PLACEHOLDER) {
connected_objects = s_conn_return_complex_others(
connected_objects,
@@ -216,11 +221,11 @@ void o_buffer_paste_end(TOPLEVEL *w_current, int screen_x, int screen_y,
connected_objects = NULL;
o_select_unselect_all( w_current );
- geda_list_add_glist( w_current->page_current->selection_list, geda_list_get_glist( temp_list ) );
+ geda_list_add_glist( toplevel->page_current->selection_list, geda_list_get_glist( temp_list ) );
g_object_unref( temp_list );
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
o_redraw(w_current, o_saved->next, TRUE); /* only redraw new objects */
o_undo_savestate(w_current, UNDO_ALL);
i_update_menus(w_current);
@@ -231,7 +236,7 @@ void o_buffer_paste_end(TOPLEVEL *w_current, int screen_x, int screen_y,
* \par Function Description
*
*/
-void o_buffer_paste_rubberpaste(TOPLEVEL *w_current, int buf_num)
+void o_buffer_paste_rubberpaste(GSCHEM_TOPLEVEL *w_current, int buf_num)
{
o_drawbounding(w_current, object_buffer[buf_num],
x_get_darkcolor(w_current->bb_color), FALSE);
@@ -256,13 +261,14 @@ void o_buffer_init(void)
* \par Function Description
*
*/
-void o_buffer_free(TOPLEVEL *w_current)
+void o_buffer_free(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int i;
for (i = 0 ; i < MAX_BUFFERS; i++) {
if (object_buffer[i]) {
- s_delete_object_glist(w_current, object_buffer[i]);
+ s_delete_object_glist(toplevel, object_buffer[i]);
object_buffer[i] = NULL;
}
}
diff --git a/gschem/src/o_bus.c b/gschem/src/o_bus.c
index 908f489..72e7a46 100644
--- a/gschem/src/o_bus.c
+++ b/gschem/src/o_bus.c
@@ -23,6 +23,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -35,8 +36,9 @@
* \par Function Description
*
*/
-void o_bus_draw(TOPLEVEL *w_current, OBJECT *o_current)
+void o_bus_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
int x1, y1, x2, y2; /* screen coords */
@@ -49,8 +51,8 @@ void o_bus_draw(TOPLEVEL *w_current, OBJECT *o_current)
}
/* reuse line's routine */
- if ( (w_current->DONT_REDRAW == 1) ||
- (!o_line_visible(w_current, o_current->line, &x1, &y1, &x2, &y2)) ) {
+ if ( (toplevel->DONT_REDRAW == 1) ||
+ (!o_line_visible(toplevel, o_current->line, &x1, &y1, &x2, &y2)) ) {
return;
}
@@ -58,8 +60,8 @@ void o_bus_draw(TOPLEVEL *w_current, OBJECT *o_current)
printf("drawing bus\n\n");
#endif
- if (w_current->bus_style == THICK ) {
- size = SCREENabs(w_current, BUS_WIDTH);
+ if (toplevel->bus_style == THICK ) {
+ size = SCREENabs(toplevel, BUS_WIDTH);
if (size < 0)
size=0;
@@ -69,9 +71,9 @@ void o_bus_draw(TOPLEVEL *w_current, OBJECT *o_current)
GDK_JOIN_MITER);
}
- if (w_current->override_color != -1 ) {
+ if (toplevel->override_color != -1 ) {
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->override_color));
+ x_get_color(toplevel->override_color));
gdk_draw_line(w_current->window, w_current->gc,
x1, y1, x2, y2);
gdk_draw_line(w_current->backingstore, w_current->gc,
@@ -86,7 +88,7 @@ void o_bus_draw(TOPLEVEL *w_current, OBJECT *o_current)
}
/* yes zero is right for the width -> use hardware lines */
- if (w_current->bus_style == THICK ) {
+ if (toplevel->bus_style == THICK ) {
gdk_gc_set_line_attributes(w_current->gc, 0, GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
GDK_JOIN_MITER);
@@ -115,11 +117,12 @@ void o_bus_draw(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_bus_erase(TOPLEVEL *w_current, OBJECT *o_current)
+void o_bus_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
- w_current->override_color = w_current->background_color;
+ TOPLEVEL *toplevel = w_current->toplevel;
+ toplevel->override_color = toplevel->background_color;
o_bus_draw(w_current, o_current);
- w_current->override_color = -1;
+ toplevel->override_color = -1;
}
/*! \todo Finish function documentation!!!
@@ -127,8 +130,9 @@ void o_bus_erase(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_bus_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
+void o_bus_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
int color;
int sx[2], sy[2];
@@ -146,16 +150,16 @@ void o_bus_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
gdk_gc_set_foreground(w_current->outline_xor_gc,
x_get_darkcolor(color));
- if (w_current->bus_style == THICK ) {
- size = SCREENabs(w_current, BUS_WIDTH);
+ if (toplevel->bus_style == THICK ) {
+ size = SCREENabs(toplevel, BUS_WIDTH);
gdk_gc_set_line_attributes(w_current->outline_xor_gc, size+1,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
GDK_JOIN_MITER);
}
- WORLDtoSCREEN( w_current, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
- WORLDtoSCREEN( w_current, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
gdk_draw_line(w_current->window, w_current->outline_xor_gc,
sx[0]+dx, sy[0]+dy,
@@ -163,7 +167,7 @@ void o_bus_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
/* backing store ? not approriate here */
- if (w_current->bus_style == THICK ) {
+ if (toplevel->bus_style == THICK ) {
gdk_gc_set_line_attributes(w_current->outline_xor_gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -176,9 +180,10 @@ void o_bus_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
* \par Function Description
*
*/
-void o_bus_draw_xor_single(TOPLEVEL *w_current,
+void o_bus_draw_xor_single(GSCHEM_TOPLEVEL *w_current,
int dx, int dy, int whichone, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int color;
int dx1= - 1, dy1 = - 1, dx2 = -1, dy2 = -1;
int sx[2], sy[2];
@@ -210,8 +215,8 @@ void o_bus_draw_xor_single(TOPLEVEL *w_current,
fprintf(stderr, _("Got an invalid which one in o_bus_draw_xor_single\n"));
}
- WORLDtoSCREEN( w_current, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
- WORLDtoSCREEN( w_current, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
gdk_draw_line(w_current->window, w_current->outline_xor_gc,
sx[0]+dx1, sy[0]+dy1,
@@ -225,15 +230,16 @@ void o_bus_draw_xor_single(TOPLEVEL *w_current,
* \par Function Description
*
*/
-void o_bus_start(TOPLEVEL *w_current, int x, int y)
+void o_bus_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
- w_current->last_x = w_current->start_x = fix_x(w_current, x);
- w_current->last_y = w_current->start_y = fix_y(w_current, y);
+ w_current->last_x = w_current->start_x = fix_x(toplevel, x);
+ w_current->last_y = w_current->start_y = fix_y(toplevel, y);
- if (w_current->bus_style == THICK ) {
- size = SCREENabs(w_current, BUS_WIDTH);
+ if (toplevel->bus_style == THICK ) {
+ size = SCREENabs(toplevel, BUS_WIDTH);
gdk_gc_set_line_attributes(w_current->xor_gc, size,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -244,7 +250,7 @@ void o_bus_start(TOPLEVEL *w_current, int x, int y)
x_get_darkcolor(w_current->select_color) );
gdk_draw_line(w_current->window, w_current->xor_gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
- if (w_current->bus_style == THICK ) {
+ if (toplevel->bus_style == THICK ) {
gdk_gc_set_line_attributes(w_current->xor_gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -257,8 +263,9 @@ void o_bus_start(TOPLEVEL *w_current, int x, int y)
* \par Function Description
*
*/
-int o_bus_end(TOPLEVEL *w_current, int x, int y)
+int o_bus_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x1, y1;
int x2, y2;
int color;
@@ -266,19 +273,19 @@ int o_bus_end(TOPLEVEL *w_current, int x, int y)
GList *other_objects = NULL;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return(FALSE);
}
- if (w_current->override_bus_color == -1) {
+ if (toplevel->override_bus_color == -1) {
color = w_current->bus_color;
} else {
- color = w_current->override_bus_color;
+ color = toplevel->override_bus_color;
}
- size = SCREENabs(w_current, BUS_WIDTH);
+ size = SCREENabs(toplevel, BUS_WIDTH);
- if (w_current->bus_style == THICK ) {
+ if (toplevel->bus_style == THICK ) {
gdk_gc_set_line_attributes(w_current->xor_gc, size,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -291,7 +298,7 @@ int o_bus_end(TOPLEVEL *w_current, int x, int y)
w_current->start_x, w_current->start_y,
w_current->last_x, w_current->last_y);
- if (w_current->bus_style == THICK ) {
+ if (toplevel->bus_style == THICK ) {
gdk_gc_set_line_attributes(w_current->xor_gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -321,40 +328,40 @@ int o_bus_end(TOPLEVEL *w_current, int x, int y)
gdk_draw_line(w_current->window, w_current->gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
gdk_draw_line(w_current->backingstore, w_current->gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
- if (w_current->bus_style == THICK ) {
+ if (toplevel->bus_style == THICK ) {
gdk_gc_set_line_attributes(w_current->gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
GDK_JOIN_MITER);
}
- SCREENtoWORLD(w_current, w_current->start_x, w_current->start_y, &x1, &y1);
- SCREENtoWORLD(w_current, w_current->last_x, w_current->last_y, &x2, &y2);
- x1 = snap_grid(w_current, x1);
- y1 = snap_grid(w_current, y1);
- x2 = snap_grid(w_current, x2);
- y2 = snap_grid(w_current, y2);
+ SCREENtoWORLD(toplevel, w_current->start_x, w_current->start_y, &x1, &y1);
+ SCREENtoWORLD(toplevel, w_current->last_x, w_current->last_y, &x2, &y2);
+ x1 = snap_grid(toplevel, x1);
+ y1 = snap_grid(toplevel, y1);
+ x2 = snap_grid(toplevel, x2);
+ y2 = snap_grid(toplevel, y2);
w_current->save_x = w_current->last_x;
w_current->save_y = w_current->last_y;
- w_current->page_current->object_tail =
- o_bus_add(w_current,
- w_current->page_current->object_tail,
+ toplevel->page_current->object_tail =
+ o_bus_add(toplevel,
+ toplevel->page_current->object_tail,
OBJ_BUS,
color,
x1, y1, x2, y2, 0);
/* conn stuff */
other_objects = s_conn_return_others(other_objects,
- w_current->page_current->
+ toplevel->page_current->
object_tail);
o_cue_undraw_list(w_current, other_objects);
o_cue_draw_list(w_current, other_objects);
g_list_free(other_objects);
- o_cue_draw_single(w_current, w_current->page_current->object_tail);
+ o_cue_draw_single(w_current, toplevel->page_current->object_tail);
- w_current->page_current->CHANGED=1;
+ toplevel->page_current->CHANGED=1;
w_current->start_x = w_current->save_x;
w_current->start_y = w_current->save_y;
o_undo_savestate(w_current, UNDO_ALL);
@@ -366,18 +373,19 @@ int o_bus_end(TOPLEVEL *w_current, int x, int y)
* \par Function Description
*
*/
-void o_bus_rubberbus(TOPLEVEL *w_current, int x, int y)
+void o_bus_rubberbus(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int diff_x, diff_y;
int size;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
- if (w_current->bus_style == THICK ) {
- size = SCREENabs(w_current, BUS_WIDTH);
+ if (toplevel->bus_style == THICK ) {
+ size = SCREENabs(toplevel, BUS_WIDTH);
gdk_gc_set_line_attributes(w_current->xor_gc, size,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -394,8 +402,8 @@ void o_bus_rubberbus(TOPLEVEL *w_current, int x, int y)
/* going into non-ortho mode (control key pressed) */
/* erase ortho line */
- w_current->last_x = fix_x(w_current, x);
- w_current->last_y = fix_y(w_current, y);
+ w_current->last_x = fix_x(toplevel, x);
+ w_current->last_y = fix_y(toplevel, y);
/* If you press the control key then you can draw non-ortho bus */
if (!w_current->CONTROLKEY) {
@@ -413,7 +421,7 @@ void o_bus_rubberbus(TOPLEVEL *w_current, int x, int y)
x_get_darkcolor(w_current->select_color) );
gdk_draw_line(w_current->window, w_current->xor_gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
- if (w_current->bus_style == THICK ) {
+ if (toplevel->bus_style == THICK ) {
gdk_gc_set_line_attributes(w_current->xor_gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -428,12 +436,13 @@ void o_bus_rubberbus(TOPLEVEL *w_current, int x, int y)
* \note
* used in button cancel code in x_events.c
*/
-void o_bus_eraserubber(TOPLEVEL *w_current)
+void o_bus_eraserubber(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
- if (w_current->bus_style == THICK ) {
- size = SCREENabs(w_current, BUS_WIDTH);
+ if (toplevel->bus_style == THICK ) {
+ size = SCREENabs(toplevel, BUS_WIDTH);
if (size < 0)
size=0;
@@ -446,7 +455,7 @@ void o_bus_eraserubber(TOPLEVEL *w_current)
gdk_draw_line(w_current->window, w_current->xor_gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
- if (w_current->bus_style == THICK ) {
+ if (toplevel->bus_style == THICK ) {
gdk_gc_set_line_attributes(w_current->xor_gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -461,13 +470,14 @@ void o_bus_eraserubber(TOPLEVEL *w_current)
* \note
* used in button cancel code in x_events.c
*/
-void o_bus_xorrubber(TOPLEVEL *w_current)
+void o_bus_xorrubber(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
- if (w_current->bus_style == THICK ) {
+ if (toplevel->bus_style == THICK ) {
- size = SCREENabs(w_current, BUS_WIDTH);
+ size = SCREENabs(toplevel, BUS_WIDTH);
if (size < 0)
size=0;
@@ -482,7 +492,7 @@ void o_bus_xorrubber(TOPLEVEL *w_current)
x_get_darkcolor(w_current->select_color) );
gdk_draw_line(w_current->window, w_current->gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
- if (w_current->bus_style == THICK ) {
+ if (toplevel->bus_style == THICK ) {
gdk_gc_set_line_attributes(w_current->gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
diff --git a/gschem/src/o_circle.c b/gschem/src/o_circle.c
index 3295fcb..07cdc26 100644
--- a/gschem/src/o_circle.c
+++ b/gschem/src/o_circle.c
@@ -23,6 +23,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -50,17 +51,18 @@ typedef void (*FILL_FUNC)( GdkDrawable *w, GdkGC *gc, GdkColor *color,
* \par Function Description
* This function is used to draw a circle on screen. The circle is described
* by the OBJECT which is referred by <B>o_current</B>. The display is done
- * according to the current state, given by the TOPLEVEL object pointed by
+ * according to the current state, given by the GSCHEM_TOPLEVEL object pointed by
* <B>w_current</B>.
*
* It first checks if the OBJECT pointed is valid or not. If not it
* returns and do not output anything. That should never happen though.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Circle OBJECT to draw.
*/
-void o_circle_draw(TOPLEVEL *w_current, OBJECT *o_current)
+void o_circle_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int wleft, wright, wtop, wbottom; /* world bounds */
int s_x, s_y;
int radius;
@@ -79,11 +81,11 @@ void o_circle_draw(TOPLEVEL *w_current, OBJECT *o_current)
* Get read to check for visibility of this line by using it's
* bounding box
*/
- world_get_circle_bounds(w_current, o_current,
+ world_get_circle_bounds(toplevel, o_current,
&wleft, &wtop, &wright, &wbottom);
- if ( (w_current->DONT_REDRAW == 1) ||
- (!visible(w_current, wleft, wtop, wright, wbottom)) ) {
+ if ( (toplevel->DONT_REDRAW == 1) ||
+ (!visible(toplevel, wleft, wtop, wright, wbottom)) ) {
return;
}
@@ -97,13 +99,13 @@ void o_circle_draw(TOPLEVEL *w_current, OBJECT *o_current)
*
* Finally the function takes care of the grips.
*/
- if (w_current->override_color != -1 ) {
- color = x_get_color(w_current->override_color);
+ if (toplevel->override_color != -1 ) {
+ color = x_get_color(toplevel->override_color);
} else {
color = x_get_color(o_current->color);
}
- radius = SCREENabs( w_current, o_current->circle->radius );
+ radius = SCREENabs( toplevel, o_current->circle->radius );
/*
* The values describing the line type are extracted from the
@@ -121,13 +123,13 @@ void o_circle_draw(TOPLEVEL *w_current, OBJECT *o_current)
* to an endless loop in function called after. If such a case is encountered
* the circle is drawn as a solid circle independently of its initial type.
*/
- circle_width = SCREENabs( w_current, o_current->line_width );
+ circle_width = SCREENabs( toplevel, o_current->line_width );
if(circle_width <= 0) {
circle_width = 1;
}
- length = SCREENabs( w_current, o_current->line_length );
- space = SCREENabs( w_current, o_current->line_space );
+ length = SCREENabs( toplevel, o_current->line_length );
+ space = SCREENabs( toplevel, o_current->line_space );
switch(o_current->line_end) {
case END_NONE: circle_end = GDK_CAP_BUTT; break;
@@ -177,7 +179,7 @@ void o_circle_draw(TOPLEVEL *w_current, OBJECT *o_current)
if((length == 0) || (space == 0))
draw_func = o_arc_draw_solid;
- WORLDtoSCREEN( w_current, o_current->circle->center_x, o_current->circle->center_y,
+ WORLDtoSCREEN( toplevel, o_current->circle->center_x, o_current->circle->center_y,
&s_x, &s_y );
(*draw_func)(w_current->window, w_current->gc, color,
@@ -214,15 +216,15 @@ void o_circle_draw(TOPLEVEL *w_current, OBJECT *o_current)
* distinct. If such a case is encountered the circle is filled hollow
* (e.q. not filled).
*/
- fill_width = SCREENabs( w_current, o_current->fill_width );
+ fill_width = SCREENabs( toplevel, o_current->fill_width );
if( fill_width <= 0) {
fill_width = 1;
}
angle1 = o_current->fill_angle1;
- pitch1 = SCREENabs( w_current, o_current->fill_pitch1 );
+ pitch1 = SCREENabs( toplevel, o_current->fill_pitch1 );
angle2 = o_current->fill_angle2;
- pitch2 = SCREENabs( w_current, o_current->fill_pitch2 );
+ pitch2 = SCREENabs( toplevel, o_current->fill_pitch2 );
switch(o_current->fill_type) {
case FILLING_HOLLOW:
@@ -514,14 +516,15 @@ void o_circle_fill_mesh(GdkDrawable *w, GdkGC *gc, GdkColor *color,
* special color. Therefore a circle is drawn with background color over
* the previous one.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Circle OBJECT to erase.
*/
-void o_circle_erase(TOPLEVEL *w_current, OBJECT *o_current)
+void o_circle_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
- w_current->override_color = w_current->background_color;
+ TOPLEVEL *toplevel = w_current->toplevel;
+ toplevel->override_color = toplevel->background_color;
o_circle_draw(w_current, o_current);
- w_current->override_color = -1;
+ toplevel->override_color = -1;
}
/*! \todo Finish function documentation!!!
@@ -529,7 +532,7 @@ void o_circle_erase(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_circle_eraserubber(TOPLEVEL *w_current)
+void o_circle_eraserubber(GSCHEM_TOPLEVEL *w_current)
{
o_circle_rubbercircle_xor(w_current);
}
@@ -543,7 +546,7 @@ void o_circle_eraserubber(TOPLEVEL *w_current)
*
* The circle is displayed with the color of the object.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] dx Delta x coordinate for circle.
* \param [in] dy Delta y coordinate for circle.
* \param [in] o_current Circle OBJECT to draw.
@@ -551,8 +554,9 @@ void o_circle_eraserubber(TOPLEVEL *w_current)
* \todo
* add in offsets, get rid of global diffs_x,y
*/
-void o_circle_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
+void o_circle_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x, y, radius;
int color;
@@ -567,10 +571,10 @@ void o_circle_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
}
/* radius of the circle */
- radius = SCREENabs( w_current, o_current->circle->radius );
+ radius = SCREENabs( toplevel, o_current->circle->radius );
/* upper left corner of the square the circle is inscribed in */
/* gdk coords system */
- WORLDtoSCREEN( w_current,
+ WORLDtoSCREEN( toplevel,
o_current->circle->center_x - o_current->circle->radius,
o_current->circle->center_y + o_current->circle->radius,
&x, &y );
@@ -602,15 +606,16 @@ void o_circle_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
* The first step of the circle input is to set the center of the arc.
* This center is kept in (<B>w_current->start_x</B>,<B>w_current->start_y</B>).
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_circle_start(TOPLEVEL *w_current, int x, int y)
+void o_circle_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
/* center of circle */
- w_current->last_x = w_current->start_x = fix_x(w_current, x);
- w_current->last_y = w_current->start_y = fix_y(w_current, y);
+ w_current->last_x = w_current->start_x = fix_x(toplevel, x);
+ w_current->last_y = w_current->start_y = fix_y(toplevel, y);
/* radius */
w_current->distance = 0;
@@ -634,18 +639,19 @@ void o_circle_start(TOPLEVEL *w_current, int x, int y)
* A new object is allocated, initialized and linked in the object list.
* This new object is finally drawn.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_circle_end(TOPLEVEL *w_current, int x, int y)
+void o_circle_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int center_x, center_y;
int fx, fy;
int radius;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
@@ -653,8 +659,8 @@ void o_circle_end(TOPLEVEL *w_current, int x, int y)
o_circle_rubbercircle_xor(w_current);
/* get the last coords of the pointer */
- fx = fix_x(w_current, x);
- fy = fix_y(w_current, y);
+ fx = fix_x(toplevel, x);
+ fy = fix_y(toplevel, y);
/* compute the radius in screen unit */
w_current->distance = dist(w_current->start_x, w_current->start_y,
fx, fy);
@@ -671,22 +677,22 @@ void o_circle_end(TOPLEVEL *w_current, int x, int y)
}
/* get center coords in world unit */
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->start_x, w_current->start_y,
¢er_x, ¢er_y);
/* get radius in world unit */
- radius = snap_grid(w_current,
- WORLDabs(w_current, w_current->distance));
+ radius = snap_grid(toplevel,
+ WORLDabs(toplevel, w_current->distance));
/* create the object */
- w_current->page_current->object_tail =
- o_circle_add(w_current,
- w_current->page_current->object_tail,
+ toplevel->page_current->object_tail =
+ o_circle_add(toplevel,
+ toplevel->page_current->object_tail,
OBJ_CIRCLE, w_current->graphic_color,
center_x, center_y, radius);
/* draw it */
- o_redraw_single(w_current, w_current->page_current->object_tail);
+ o_redraw_single(w_current, toplevel->page_current->object_tail);
w_current->start_x = (-1);
w_current->start_y = (-1);
@@ -696,7 +702,7 @@ void o_circle_end(TOPLEVEL *w_current, int x, int y)
w_current->loc_y = (-1);
w_current->distance = (-1);
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
}
@@ -719,16 +725,17 @@ void o_circle_end(TOPLEVEL *w_current, int x, int y)
* <DT>*</DT><DD><B>w_current->distance</B> as its radius.
* </DL>
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_circle_rubbercircle(TOPLEVEL *w_current, int x, int y)
+void o_circle_rubbercircle(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int diff_x, diff_y;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
@@ -740,8 +747,8 @@ void o_circle_rubbercircle(TOPLEVEL *w_current, int x, int y)
* the center of the circle and the mouse position.
*/
/* update the radius */
- w_current->last_x = fix_x(w_current, x);
- w_current->last_y = fix_y(w_current, y);
+ w_current->last_x = fix_x(toplevel, x);
+ w_current->last_y = fix_y(toplevel, y);
diff_x = GET_BOX_WIDTH (w_current);
diff_y = GET_BOX_HEIGHT(w_current);
@@ -758,9 +765,9 @@ void o_circle_rubbercircle(TOPLEVEL *w_current, int x, int y)
}
-/*! \brief Draw circle from TOPLEVEL object.
+/*! \brief Draw circle from GSCHEM_TOPLEVEL object.
* \par Function Description
- * This function draws the circle from the variables in the toplevel
+ * This function draws the circle from the variables in the GSCHEM_TOPLEVEL
* structure <B>*w_current</B>.
* The center of the circle is at (<B>w_current->start_x</B>,
* <B>w_current->start_y</B>) and its radius is in <B>w_current->distance</B>.
@@ -769,9 +776,9 @@ void o_circle_rubbercircle(TOPLEVEL *w_current, int x, int y)
* the circle with the selection color and an xor-function over the current
* sheet..
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
*/
-void o_circle_rubbercircle_xor(TOPLEVEL *w_current)
+void o_circle_rubbercircle_xor(GSCHEM_TOPLEVEL *w_current)
{
/* draw the circle from the w_current variables */
gdk_gc_set_foreground(w_current->xor_gc,
@@ -792,18 +799,19 @@ void o_circle_rubbercircle_xor(TOPLEVEL *w_current)
* \par Function Description
* This function draws the grip that match the circle object <B>*o_current</B>.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Circle OBJECT to draw grip points on.
*/
-void o_circle_draw_grips(TOPLEVEL *w_current, OBJECT *o_current)
+void o_circle_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x, y;
if (w_current->draw_grips == FALSE)
return;
/* coords of the lower right corner of the square */
- WORLDtoSCREEN( w_current,
+ WORLDtoSCREEN( toplevel,
o_current->circle->center_x + o_current->circle->radius,
o_current->circle->center_y - o_current->circle->radius,
&x, &y );
@@ -820,18 +828,19 @@ void o_circle_draw_grips(TOPLEVEL *w_current, OBJECT *o_current)
* A circle has a single grip on the lower right corner of the square it
* is inscribed in.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Circle OBJECT to erase grip marks from.
*/
-void o_circle_erase_grips(TOPLEVEL *w_current, OBJECT *o_current)
+void o_circle_erase_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x, y;
if (w_current->draw_grips == FALSE)
return;
/* coords of the lower right corner of square */
- WORLDtoSCREEN( w_current,
+ WORLDtoSCREEN( toplevel,
o_current->circle->center_x + o_current->circle->radius,
o_current->circle->center_y - o_current->circle->radius,
&x, &y );
diff --git a/gschem/src/o_complex.c b/gschem/src/o_complex.c
index 8e8c736..b8b08cd 100644
--- a/gschem/src/o_complex.c
+++ b/gschem/src/o_complex.c
@@ -27,6 +27,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -39,13 +40,13 @@
* \par Function Description
*
*/
-void o_complex_draw(TOPLEVEL *w_current, OBJECT *o_current)
+void o_complex_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
g_return_if_fail (o_current != NULL);
g_return_if_fail (o_current->complex != NULL);
g_return_if_fail (o_current->complex->prim_objs != NULL);
- if (!w_current->DONT_REDRAW) {
+ if (!w_current->toplevel->DONT_REDRAW) {
o_redraw(w_current, o_current->complex->prim_objs, TRUE);
}
}
@@ -55,11 +56,12 @@ void o_complex_draw(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_complex_erase(TOPLEVEL *w_current, OBJECT *o_current)
+void o_complex_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
- w_current->override_color = w_current->background_color;
+ TOPLEVEL *toplevel = w_current->toplevel;
+ toplevel->override_color = toplevel->background_color;
o_complex_draw(w_current, o_current);
- w_current->override_color = -1;
+ toplevel->override_color = -1;
}
/*! \todo Finish function documentation!!!
@@ -67,7 +69,7 @@ void o_complex_erase(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_complex_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *complex)
+void o_complex_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *complex)
{
OBJECT *o_current = complex;
@@ -124,34 +126,35 @@ void o_complex_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *complex)
* \par Function Description
*
*/
-void o_complex_start(TOPLEVEL *w_current, int screen_x, int screen_y)
+void o_complex_start(GSCHEM_TOPLEVEL *w_current, int screen_x, int screen_y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x, y;
int i, temp;
const CLibSymbol *sym;
int redraw_state;
- w_current->last_x = w_current->start_x = fix_x(w_current, screen_x);
- w_current->last_y = w_current->start_y = fix_y(w_current, screen_y);
+ w_current->last_x = w_current->start_x = fix_x(toplevel, screen_x);
+ w_current->last_y = w_current->start_y = fix_y(toplevel, screen_y);
w_current->last_drawb_mode = -1;
/* make sure list is null first, so that you don't have a mem
* leak */
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->start_x,
w_current->start_y,
&x,
&y);
- w_current->ADDING_SEL = 1; /* reuse this flag, rename later hack */
- sym = s_clib_get_symbol_by_name (w_current->internal_symbol_name);
- o_complex_add(w_current, NULL,
- &(w_current->page_current->complex_place_list),
+ toplevel->ADDING_SEL = 1; /* reuse this flag, rename later hack */
+ sym = s_clib_get_symbol_by_name (toplevel->internal_symbol_name);
+ o_complex_add(toplevel, NULL,
+ &(toplevel->page_current->complex_place_list),
OBJ_COMPLEX, WHITE, x, y, 0, 0,
- sym, w_current->internal_symbol_name,
+ sym, toplevel->internal_symbol_name,
1, TRUE);
- w_current->ADDING_SEL = 0;
+ toplevel->ADDING_SEL = 0;
if (w_current->complex_rotate) {
temp = w_current->complex_rotate / 90;
@@ -162,12 +165,12 @@ void o_complex_start(TOPLEVEL *w_current, int screen_x, int screen_y)
/* Run the complex place list changed hook without redrawing */
/* since the complex place list is going to be redrawn afterwards */
- redraw_state = w_current->DONT_REDRAW;
- w_current->DONT_REDRAW = 1;
+ redraw_state = toplevel->DONT_REDRAW;
+ toplevel->DONT_REDRAW = 1;
o_complex_place_changed_run_hook (w_current);
- w_current->DONT_REDRAW = redraw_state;
+ toplevel->DONT_REDRAW = redraw_state;
- o_drawbounding(w_current, w_current->page_current->complex_place_list,
+ o_drawbounding(w_current, toplevel->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), TRUE);
}
@@ -176,20 +179,21 @@ void o_complex_start(TOPLEVEL *w_current, int screen_x, int screen_y)
* The complex place list is usually used when placing new components
* in the schematic. This function should be called whenever that list
* is modified.
- * \param [in] w_current TOPLEVEL structure.
+ * \param [in] w_current GSCHEM_TOPLEVEL structure.
*
*/
-void o_complex_place_changed_run_hook(TOPLEVEL *w_current) {
+void o_complex_place_changed_run_hook(GSCHEM_TOPLEVEL *w_current) {
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *ptr = NULL;
/* Run the complex place list changed hook */
if (scm_hook_empty_p(complex_place_list_changed_hook) == SCM_BOOL_F &&
- w_current->page_current->complex_place_list != NULL) {
- ptr = w_current->page_current->complex_place_list;
+ toplevel->page_current->complex_place_list != NULL) {
+ ptr = toplevel->page_current->complex_place_list;
while (ptr) {
scm_run_hook(complex_place_list_changed_hook,
scm_cons (g_make_object_smob
- (w_current,
+ (toplevel,
(OBJECT *) ptr->data), SCM_EOL));
ptr = g_list_next(ptr);
}
@@ -202,14 +206,15 @@ void o_complex_place_changed_run_hook(TOPLEVEL *w_current) {
* \par Function Description
*
*/
-void o_complex_place_rotate(TOPLEVEL *w_current)
+void o_complex_place_rotate(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current;
GList *ptr;
int x_local = -1;
int y_local = -1;
- ptr = w_current->page_current->complex_place_list;
+ ptr = toplevel->page_current->complex_place_list;
while(ptr) {
o_current = (OBJECT *) ptr->data;
switch(o_current->type) {
@@ -226,17 +231,17 @@ void o_complex_place_rotate(TOPLEVEL *w_current)
return;
}
- ptr = w_current->page_current->complex_place_list;
+ ptr = toplevel->page_current->complex_place_list;
while(ptr) {
o_current = (OBJECT *) ptr->data;
switch(o_current->type) {
case(OBJ_TEXT):
- o_text_rotate_world(w_current, x_local, y_local, 90, o_current);
+ o_text_rotate_world(toplevel, x_local, y_local, 90, o_current);
break;
case(OBJ_COMPLEX):
- o_complex_rotate_world(w_current, x_local, y_local, 90, o_current);
+ o_complex_rotate_world(toplevel, x_local, y_local, 90, o_current);
break;
}
@@ -250,8 +255,9 @@ void o_complex_place_rotate(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y)
+void o_complex_end(GSCHEM_TOPLEVEL *w_current, int screen_x, int screen_y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int diff_x, diff_y;
int x, y;
int rleft, rtop, rbottom, rright;
@@ -267,9 +273,9 @@ void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y)
diff_x = w_current->last_x - w_current->start_x;
diff_y = w_current->last_y - w_current->start_y;
- SCREENtoWORLD(w_current, screen_x, screen_y, &x, &y);
- x = snap_grid(w_current, x);
- y = snap_grid(w_current, y);
+ SCREENtoWORLD(toplevel, screen_x, screen_y, &x, &y);
+ x = snap_grid(toplevel, x);
+ y = snap_grid(toplevel, y);
#if DEBUG
printf("place_basename: %s\n",internal_basename);
@@ -277,25 +283,25 @@ void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y)
#endif
if (w_current->include_complex) {
- buffer = s_clib_symbol_get_data_by_name (w_current->internal_symbol_name);
+ buffer = s_clib_symbol_get_data_by_name (toplevel->internal_symbol_name);
- w_current->ADDING_SEL=1;
- o_start = w_current->page_current->object_tail;
- w_current->page_current->object_tail =
- o_read_buffer(w_current,
- w_current->page_current->object_tail,
+ toplevel->ADDING_SEL=1;
+ o_start = toplevel->page_current->object_tail;
+ toplevel->page_current->object_tail =
+ o_read_buffer(toplevel,
+ toplevel->page_current->object_tail,
buffer, -1,
- w_current->internal_symbol_name);
+ toplevel->internal_symbol_name);
o_start = o_start->next;
- w_current->ADDING_SEL=0;
+ toplevel->ADDING_SEL=0;
- o_list_translate_world(w_current, x, y, o_start);
+ o_list_translate_world(toplevel, x, y, o_start);
o_temp = o_start;
while (o_temp != NULL) {
if (o_temp->type == OBJ_NET || o_temp->type == OBJ_PIN ||
o_temp->type == OBJ_BUS) {
- s_conn_update_object(w_current, o_temp);
+ s_conn_update_object(toplevel, o_temp);
connected_objects = s_conn_return_others(connected_objects,
o_temp);
@@ -313,20 +319,20 @@ void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y)
o_complex_translate_display_object_glist(w_current,
diff_x, diff_y,
- w_current->page_current->
+ toplevel->page_current->
complex_place_list);
} else {
- world_get_object_glist_bounds(w_current,
- w_current->page_current->
+ world_get_object_glist_bounds(toplevel,
+ toplevel->page_current->
complex_place_list,
&w_rleft, &w_rtop, &w_rright, &w_rbottom);
- WORLDtoSCREEN( w_current, w_rleft, w_rtop, &rleft, &rtop );
- WORLDtoSCREEN( w_current, w_rright, w_rbottom, &rright, &rbottom );
+ WORLDtoSCREEN( toplevel, w_rleft, w_rtop, &rleft, &rtop );
+ WORLDtoSCREEN( toplevel, w_rright, w_rbottom, &rright, &rbottom );
gdk_gc_set_foreground(
w_current->gc,
- x_get_color(w_current->background_color));
+ x_get_color(toplevel->background_color));
gdk_draw_rectangle(w_current->window, w_current->gc,
FALSE,
rleft + diff_x,
@@ -336,22 +342,22 @@ void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y)
}
o_redraw(w_current, o_start, TRUE);
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
i_update_menus(w_current);
- s_delete_object_glist(w_current, w_current->page_current->
+ s_delete_object_glist(toplevel, toplevel->page_current->
complex_place_list);
- w_current->page_current->complex_place_list = NULL;
+ toplevel->page_current->complex_place_list = NULL;
return;
}
- o_temp = w_current->page_current->object_tail;
- sym = s_clib_get_symbol_by_name (w_current->internal_symbol_name);
- w_current->page_current->object_tail =
- o_complex_add(w_current,
- w_current->page_current->object_tail, NULL,
+ o_temp = toplevel->page_current->object_tail;
+ sym = s_clib_get_symbol_by_name (toplevel->internal_symbol_name);
+ toplevel->page_current->object_tail =
+ o_complex_add(toplevel,
+ toplevel->page_current->object_tail, NULL,
OBJ_COMPLEX, WHITE, x, y, w_current->complex_rotate, 0,
- sym, w_current->internal_symbol_name,
+ sym, toplevel->internal_symbol_name,
1, TRUE);
/* complex rotate post processing */
@@ -361,7 +367,7 @@ void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y)
case(OBJ_TEXT):
temp = w_current->complex_rotate / 90;
for (i = 0; i < temp; i++) {
- o_text_rotate_world(w_current, x, y, 90, o_temp);
+ o_text_rotate_world(toplevel, x, y, 90, o_temp);
}
break;
}
@@ -370,7 +376,7 @@ void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y)
}
/* 1 should be define fix everywhere hack */
- o_current = w_current->page_current->object_tail;
+ o_current = toplevel->page_current->object_tail;
if (scm_hook_empty_p(add_component_hook) == SCM_BOOL_F &&
o_current != NULL) {
@@ -382,7 +388,7 @@ void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y)
if (scm_hook_empty_p(add_component_object_hook) == SCM_BOOL_F &&
o_current != NULL) {
scm_run_hook(add_component_object_hook,
- scm_cons(g_make_object_smob(w_current, o_current),
+ scm_cons(g_make_object_smob(toplevel, o_current),
SCM_EOL));
}
@@ -396,19 +402,19 @@ void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y)
/* erase outline */
o_complex_translate_display_object_glist(w_current,
diff_x, diff_y,
- w_current->page_current->complex_place_list);
+ toplevel->page_current->complex_place_list);
} else {
- world_get_object_glist_bounds(w_current,
- w_current->page_current->complex_place_list,
+ world_get_object_glist_bounds(toplevel,
+ toplevel->page_current->complex_place_list,
&w_rleft, &w_rtop,
&w_rright, &w_rbottom);
- WORLDtoSCREEN( w_current, w_rleft, w_rtop, &rleft, &rtop );
- WORLDtoSCREEN( w_current, w_rright, w_rbottom, &rright, &rbottom );
+ WORLDtoSCREEN( toplevel, w_rleft, w_rtop, &rleft, &rtop );
+ WORLDtoSCREEN( toplevel, w_rright, w_rbottom, &rright, &rbottom );
gdk_gc_set_foreground(
w_current->gc,
- x_get_color(w_current->background_color));
+ x_get_color(toplevel->background_color));
gdk_draw_rectangle(w_current->window, w_current->gc, FALSE,
rleft + diff_x,
rtop + diff_y,
@@ -418,29 +424,29 @@ void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y)
/*! \todo redraw has to happen at the end of all this hack or
* maybe not? */
- s_delete_object_glist(w_current, w_current->page_current->
+ s_delete_object_glist(toplevel, toplevel->page_current->
complex_place_list);
- w_current->page_current->complex_place_list = NULL;
+ toplevel->page_current->complex_place_list = NULL;
/* This doesn't allow anything else to be in the selection
* list when you add a component */
- o_select_unselect_list( w_current, w_current->page_current->selection_list );
- o_selection_add( w_current->page_current->selection_list, w_current->page_current->object_tail);
+ o_select_unselect_list( w_current, toplevel->page_current->selection_list );
+ o_selection_add( toplevel->page_current->selection_list, toplevel->page_current->object_tail);
/* the o_redraw_selected is in x_events.c after this call
* returns */
- o_attrib_add_selected(w_current, w_current->page_current->selection_list,
- w_current->page_current->object_tail);
+ o_attrib_add_selected(w_current, toplevel->page_current->selection_list,
+ toplevel->page_current->object_tail);
- s_conn_update_complex(w_current, o_current->complex->prim_objs);
+ s_conn_update_complex(toplevel, o_current->complex->prim_objs);
connected_objects = s_conn_return_complex_others(connected_objects,
o_current);
o_cue_undraw_list(w_current, connected_objects);
o_cue_draw_list(w_current, connected_objects);
g_list_free(connected_objects);
- o_cue_draw_single(w_current, w_current->page_current->object_tail);
+ o_cue_draw_single(w_current, toplevel->page_current->object_tail);
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
i_update_menus(w_current);
}
@@ -450,10 +456,10 @@ void o_complex_end(TOPLEVEL *w_current, int screen_x, int screen_y)
* \par Function Description
*
*/
-void o_complex_rubbercomplex(TOPLEVEL *w_current)
+void o_complex_rubbercomplex(GSCHEM_TOPLEVEL *w_current)
{
o_drawbounding(w_current,
- w_current->page_current->complex_place_list,
+ w_current->toplevel->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), FALSE);
}
@@ -463,7 +469,7 @@ void o_complex_rubbercomplex(TOPLEVEL *w_current)
*
*/
void
-o_complex_translate_display_single_object(TOPLEVEL *w_current,
+o_complex_translate_display_single_object(GSCHEM_TOPLEVEL *w_current,
int x1, int y1, OBJECT *o_current)
{
if (o_current != NULL) {
@@ -519,7 +525,7 @@ o_complex_translate_display_single_object(TOPLEVEL *w_current,
*
*/
void
-o_complex_translate_display_object_glist(TOPLEVEL *w_current,
+o_complex_translate_display_object_glist(GSCHEM_TOPLEVEL *w_current,
int x1, int y1, GList *object_list)
{
GList *ptr = object_list;
@@ -538,7 +544,7 @@ o_complex_translate_display_object_glist(TOPLEVEL *w_current,
*
*/
void
-o_complex_translate_display(TOPLEVEL *w_current,
+o_complex_translate_display(GSCHEM_TOPLEVEL *w_current,
int x1, int y1, OBJECT *complex)
{
OBJECT *o_current = complex;
@@ -556,69 +562,70 @@ o_complex_translate_display(TOPLEVEL *w_current,
* \note
* don't know if this belongs yet
*/
-void o_complex_translate_all(TOPLEVEL *w_current, int offset)
+void o_complex_translate_all(GSCHEM_TOPLEVEL *w_current, int offset)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int w_rleft, w_rtop, w_rright, w_rbottom;
OBJECT *o_current;
int x, y;
/* first zoom extents */
- a_zoom_extents(w_current, w_current->page_current->object_head,
+ a_zoom_extents(w_current, toplevel->page_current->object_head,
A_PAN_DONT_REDRAW);
o_redraw_all(w_current);
- world_get_object_list_bounds(w_current, w_current->page_current->object_head,
+ world_get_object_list_bounds(toplevel, toplevel->page_current->object_head,
&w_rleft,
&w_rtop,
&w_rright,
&w_rbottom);
/*! \todo do we want snap grid here? */
- x = snap_grid( w_current, w_rleft );
+ x = snap_grid( toplevel, w_rleft );
/* WARNING: w_rtop isn't the top of the bounds, it is the smaller
* y_coordinate, which represents in the bottom in world coords.
* These variables are as named from when screen-coords (which had
* the correct sense) were in use . */
- y = snap_grid( w_current, w_rtop );
+ y = snap_grid( toplevel, w_rtop );
- o_current = w_current->page_current->object_head;
+ o_current = toplevel->page_current->object_head;
while(o_current != NULL) {
if (o_current->type != OBJ_COMPLEX && o_current->type != OBJ_PLACEHOLDER) {
- s_conn_remove(w_current, o_current);
+ s_conn_remove(toplevel, o_current);
} else {
- s_conn_remove_complex(w_current, o_current);
+ s_conn_remove_complex(toplevel, o_current);
}
o_current = o_current->next;
}
if (offset == 0) {
s_log_message(_("Translating schematic [%d %d]\n"), -x, -y);
- o_list_translate_world(w_current, -x, -y,
- w_current->page_current->object_head);
+ o_list_translate_world(toplevel, -x, -y,
+ toplevel->page_current->object_head);
} else {
s_log_message(_("Translating schematic [%d %d]\n"),
offset, offset);
- o_list_translate_world(w_current, offset, offset,
- w_current->page_current->object_head);
+ o_list_translate_world(toplevel, offset, offset,
+ toplevel->page_current->object_head);
}
- o_current = w_current->page_current->object_head;
+ o_current = toplevel->page_current->object_head;
while(o_current != NULL) {
if (o_current->type != OBJ_COMPLEX && o_current->type != OBJ_PLACEHOLDER) {
- s_conn_update_object(w_current, o_current);
+ s_conn_update_object(toplevel, o_current);
} else {
- s_conn_update_complex(w_current, o_current->complex->prim_objs);
+ s_conn_update_complex(toplevel, o_current->complex->prim_objs);
}
o_current = o_current->next;
}
/* this is an experimental mod, to be able to translate to all
* places */
- a_zoom_extents(w_current, w_current->page_current->object_head,
+ a_zoom_extents(w_current, toplevel->page_current->object_head,
A_PAN_DONT_REDRAW);
if (!w_current->SHIFTKEY) o_select_unselect_all(w_current);
o_redraw_all(w_current);
- w_current->page_current->CHANGED=1;
+ toplevel->page_current->CHANGED=1;
o_undo_savestate(w_current, UNDO_ALL);
i_update_menus(w_current);
}
@@ -628,7 +635,8 @@ void o_complex_translate_all(TOPLEVEL *w_current, int offset)
* \par Function Description
*
*/
-void o_complex_rotate_world(TOPLEVEL *w_current, int centerx, int centery,
+void o_complex_rotate_world(TOPLEVEL *toplevel,
+ int centerx, int centery,
int angle, OBJECT *object)
{
int x, y;
@@ -642,15 +650,15 @@ void o_complex_rotate_world(TOPLEVEL *w_current, int centerx, int centery,
x = newx + (centerx);
y = newy + (centery);
- o_complex_translate_world(w_current,
+ o_complex_translate_world(toplevel,
-object->complex->x,
-object->complex->y, object);
- o_complex_rotate_lowlevel(w_current, 0, 0, angle, object);
+ o_complex_rotate_lowlevel(toplevel, 0, 0, angle, object);
object->complex->x = 0;
object->complex->y = 0;
- o_complex_translate_world(w_current, x, y, object);
+ o_complex_translate_world(toplevel, x, y, object);
object->complex->angle = ( object->complex->angle + angle ) % 360;
@@ -664,7 +672,7 @@ void o_complex_rotate_world(TOPLEVEL *w_current, int centerx, int centery,
* \par Function Description
*
*/
-int o_complex_mirror_world(TOPLEVEL *w_current, int world_centerx, int world_centery,
+int o_complex_mirror_world(TOPLEVEL *toplevel, int world_centerx, int world_centery,
OBJECT *object)
{
int x, y;
@@ -684,11 +692,11 @@ int o_complex_mirror_world(TOPLEVEL *w_current, int world_centerx, int world_cen
x = newx + (world_centerx);
y = newy + (world_centery);
- o_complex_translate_world(w_current,
+ o_complex_translate_world(toplevel,
-object->complex->x,
-object->complex->y, object);
- o_complex_mirror_lowlevel(w_current, 0, 0, object);
+ o_complex_mirror_lowlevel(toplevel, 0, 0, object);
switch(object->complex->angle) {
case(90):
@@ -705,7 +713,7 @@ int o_complex_mirror_world(TOPLEVEL *w_current, int world_centerx, int world_cen
object->complex->mirror = !object->complex->mirror;
- o_complex_translate_world(w_current, x, y, object);
+ o_complex_translate_world(toplevel, x, y, object);
#if DEBUG
printf("final res %d %d\n", object->complex->x, object->complex->y);
diff --git a/gschem/src/o_copy.c b/gschem/src/o_copy.c
index 0e4656f..24d1a0c 100644
--- a/gschem/src/o_copy.c
+++ b/gschem/src/o_copy.c
@@ -24,6 +24,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -36,9 +37,10 @@
* \par Function Description
*
*/
-void o_copy_start(TOPLEVEL *w_current, int x, int y)
+void o_copy_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
- if (geda_list_get_glist( w_current->page_current->selection_list ) != NULL) {
+ TOPLEVEL *toplevel = w_current->toplevel;
+ if (geda_list_get_glist( toplevel->page_current->selection_list ) != NULL) {
/* This is commented out since it breaks the copy of objects. See below. */
#if 0
@@ -51,10 +53,10 @@ void o_copy_start(TOPLEVEL *w_current, int x, int y)
/* Shouldn't this set by the caller ? */
/* w_current->event_state = COPY; */
- w_current->last_x = w_current->start_x = fix_x(w_current, x);
- w_current->last_y = w_current->start_y = fix_y(w_current, y);
+ w_current->last_x = w_current->start_x = fix_x(toplevel, x);
+ w_current->last_y = w_current->start_y = fix_y(toplevel, y);
o_drawbounding(w_current,
- geda_list_get_glist( w_current->page_current->selection_list ),
+ geda_list_get_glist( toplevel->page_current->selection_list ),
x_get_darkcolor(w_current->bb_color), TRUE);
w_current->inside_action = 1;
}
@@ -65,8 +67,9 @@ void o_copy_start(TOPLEVEL *w_current, int x, int y)
* \par Function Description
*
*/
-void o_copy_end(TOPLEVEL *w_current)
+void o_copy_end(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
SELECTION *temp_list = o_selection_new();
GList *s_current = NULL;
GList *new_objects = NULL;
@@ -94,21 +97,21 @@ void o_copy_end(TOPLEVEL *w_current)
screen_diff_x = w_current->last_x - w_current->start_x;
screen_diff_y = w_current->last_y - w_current->start_y;
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->last_x, w_current->last_y,
&lx, &ly);
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->start_x, w_current->start_y,
&sx, &sy);
- lx = snap_grid(w_current,lx);
- ly = snap_grid(w_current,ly);
- sx = snap_grid(w_current,sx);
- sy = snap_grid(w_current,sy);
+ lx = snap_grid(toplevel,lx);
+ ly = snap_grid(toplevel,ly);
+ sx = snap_grid(toplevel,sx);
+ sy = snap_grid(toplevel,sy);
diff_x = lx - sx;
diff_y = ly - sy;
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
new_objects_head = s_basic_init_object("object_head");
while(s_current != NULL) {
@@ -127,11 +130,11 @@ void o_copy_end(TOPLEVEL *w_current)
/* ADDING_SEL is a bad name, rename hack */
/* basically I don't want to add the */
/* connections till much later */
- w_current->ADDING_SEL=1;
- new_object = (OBJECT *) o_net_copy( w_current,
+ toplevel->ADDING_SEL=1;
+ new_object = (OBJECT *) o_net_copy( toplevel,
return_tail(new_objects_head),
object );
- w_current->ADDING_SEL=0;
+ toplevel->ADDING_SEL=0;
if (w_current->actionfeedback_mode == OUTLINE) {
o_net_draw_xor(w_current,
@@ -139,7 +142,7 @@ void o_copy_end(TOPLEVEL *w_current)
object);
}
- o_net_translate_world(w_current,
+ o_net_translate_world(toplevel,
diff_x, diff_y,
new_object);
@@ -147,7 +150,7 @@ void o_copy_end(TOPLEVEL *w_current)
new_object->saved_color = object->saved_color;
o_net_draw(w_current, new_object);
- s_conn_update_object(w_current, new_object);
+ s_conn_update_object(toplevel, new_object);
new_objects = g_list_append(new_objects, new_object);
connected_objects = s_conn_return_others(connected_objects,
new_object);
@@ -157,11 +160,11 @@ void o_copy_end(TOPLEVEL *w_current)
/* ADDING_SEL is a bad name, rename hack */
/* basically I don't want to add the */
/* connections till much later */
- w_current->ADDING_SEL=1;
- new_object = (OBJECT *) o_pin_copy(w_current,
+ toplevel->ADDING_SEL=1;
+ new_object = (OBJECT *) o_pin_copy(toplevel,
return_tail(new_objects_head),
object);
- w_current->ADDING_SEL=0;
+ toplevel->ADDING_SEL=0;
if (w_current->actionfeedback_mode == OUTLINE) {
o_pin_draw_xor(w_current,
@@ -169,7 +172,7 @@ void o_copy_end(TOPLEVEL *w_current)
object);
}
- o_pin_translate_world(w_current,
+ o_pin_translate_world(toplevel,
diff_x, diff_y,
new_object);
@@ -177,7 +180,7 @@ void o_copy_end(TOPLEVEL *w_current)
new_object->saved_color = object->saved_color;
o_pin_draw(w_current, new_object);
- s_conn_update_object(w_current, new_object);
+ s_conn_update_object(toplevel, new_object);
new_objects = g_list_append(new_objects, new_object);
connected_objects = s_conn_return_others(connected_objects,
new_object);
@@ -187,11 +190,11 @@ void o_copy_end(TOPLEVEL *w_current)
/* ADDING_SEL is a bad name, rename hack */
/* basically I don't want to add the */
/* connections till much later */
- w_current->ADDING_SEL=1;
- new_object = (OBJECT *) o_bus_copy(w_current,
+ toplevel->ADDING_SEL=1;
+ new_object = (OBJECT *) o_bus_copy(toplevel,
return_tail(new_objects_head),
object);
- w_current->ADDING_SEL=0;
+ toplevel->ADDING_SEL=0;
if (w_current->actionfeedback_mode == OUTLINE) {
o_bus_draw_xor(w_current,
@@ -199,7 +202,7 @@ void o_copy_end(TOPLEVEL *w_current)
object);
}
- o_bus_translate_world(w_current,
+ o_bus_translate_world(toplevel,
diff_x, diff_y,
new_object);
@@ -207,7 +210,7 @@ void o_copy_end(TOPLEVEL *w_current)
new_object->saved_color = object->saved_color;
o_bus_draw(w_current, new_object);
- s_conn_update_object(w_current, new_object);
+ s_conn_update_object(toplevel, new_object);
new_objects = g_list_append(new_objects, new_object);
connected_objects = s_conn_return_others(connected_objects,
new_object);
@@ -215,20 +218,20 @@ void o_copy_end(TOPLEVEL *w_current)
case(OBJ_COMPLEX):
case(OBJ_PLACEHOLDER):
- w_current->ADDING_SEL=1;
+ toplevel->ADDING_SEL=1;
if (o_complex_is_embedded(object)) {
new_object = (OBJECT *)
- o_complex_copy_embedded(w_current,
+ o_complex_copy_embedded(toplevel,
return_tail(new_objects_head),
object);
} else {
- new_object = (OBJECT *) o_complex_copy(w_current,
+ new_object = (OBJECT *) o_complex_copy(toplevel,
return_tail(new_objects_head),
object);
}
- w_current->ADDING_SEL=0;
+ toplevel->ADDING_SEL=0;
complex_object = new_object;
@@ -237,25 +240,25 @@ void o_copy_end(TOPLEVEL *w_current)
object->complex->prim_objs);
}
- o_complex_translate_world(w_current, diff_x, diff_y, new_object);
+ o_complex_translate_world(toplevel, diff_x, diff_y, new_object);
o_selection_add( temp_list, new_object );
/* NEWSEL: this needs to be fixed too */
/* this may not be needed anymore? */
- o_attrib_slot_copy(w_current, object,
+ o_attrib_slot_copy(toplevel, object,
new_object);
new_object->saved_color = object->saved_color;
o_redraw_single(w_current, new_object);
- s_conn_update_complex(w_current, new_object->complex->prim_objs);
+ s_conn_update_complex(toplevel, new_object->complex->prim_objs);
new_objects = g_list_append(new_objects, new_object);
connected_objects = s_conn_return_complex_others(connected_objects,
new_object);
break;
case(OBJ_LINE):
- new_object = (OBJECT *) o_line_copy(w_current,
+ new_object = (OBJECT *) o_line_copy(toplevel,
return_tail(new_objects_head),
object);
if (w_current->actionfeedback_mode == OUTLINE) {
@@ -264,11 +267,11 @@ void o_copy_end(TOPLEVEL *w_current)
object);
}
- w_current->ADDING_SEL=1;
- o_line_translate_world(w_current,
+ toplevel->ADDING_SEL=1;
+ o_line_translate_world(toplevel,
diff_x, diff_y,
new_object);
- w_current->ADDING_SEL=0;
+ toplevel->ADDING_SEL=0;
o_selection_add( temp_list, new_object );
new_object->saved_color = object->saved_color;
@@ -276,7 +279,7 @@ void o_copy_end(TOPLEVEL *w_current)
break;
case(OBJ_BOX):
- new_object = (OBJECT *) o_box_copy(w_current,
+ new_object = (OBJECT *) o_box_copy(toplevel,
return_tail(new_objects_head),
object);
if (w_current->actionfeedback_mode == OUTLINE) {
@@ -285,11 +288,11 @@ void o_copy_end(TOPLEVEL *w_current)
object);
}
- w_current->ADDING_SEL=1;
- o_box_translate_world(w_current,
+ toplevel->ADDING_SEL=1;
+ o_box_translate_world(toplevel,
diff_x, diff_y,
new_object);
- w_current->ADDING_SEL=0;
+ toplevel->ADDING_SEL=0;
o_selection_add( temp_list, new_object );
new_object->saved_color = object->saved_color;
@@ -298,7 +301,7 @@ void o_copy_end(TOPLEVEL *w_current)
break;
case(OBJ_PICTURE):
- new_object = (OBJECT *) o_picture_copy(w_current,
+ new_object = (OBJECT *) o_picture_copy(toplevel,
return_tail(new_objects_head),
object);
if (w_current->actionfeedback_mode == OUTLINE) {
@@ -307,11 +310,11 @@ void o_copy_end(TOPLEVEL *w_current)
object);
}
- w_current->ADDING_SEL=1;
- o_picture_translate_world(w_current,
+ toplevel->ADDING_SEL=1;
+ o_picture_translate_world(toplevel,
diff_x, diff_y,
new_object);
- w_current->ADDING_SEL=0;
+ toplevel->ADDING_SEL=0;
o_selection_add( temp_list, new_object );
new_object->saved_color = object->saved_color;
@@ -320,7 +323,7 @@ void o_copy_end(TOPLEVEL *w_current)
break;
case(OBJ_CIRCLE):
- new_object = (OBJECT *) o_circle_copy(w_current,
+ new_object = (OBJECT *) o_circle_copy(toplevel,
return_tail(new_objects_head),
object);
@@ -330,11 +333,11 @@ void o_copy_end(TOPLEVEL *w_current)
object);
}
- w_current->ADDING_SEL=1;
- o_circle_translate_world(w_current,
+ toplevel->ADDING_SEL=1;
+ o_circle_translate_world(toplevel,
diff_x, diff_y,
new_object);
- w_current->ADDING_SEL=0;
+ toplevel->ADDING_SEL=0;
o_selection_add( temp_list, new_object );
new_object->saved_color = object->saved_color;
@@ -342,7 +345,7 @@ void o_copy_end(TOPLEVEL *w_current)
break;
case(OBJ_ARC):
- new_object = (OBJECT *) o_arc_copy( w_current,
+ new_object = (OBJECT *) o_arc_copy( toplevel,
return_tail(new_objects_head),
object );
@@ -352,11 +355,11 @@ void o_copy_end(TOPLEVEL *w_current)
object);
}
- w_current->ADDING_SEL=1;
- o_arc_translate_world(w_current,
+ toplevel->ADDING_SEL=1;
+ o_arc_translate_world(toplevel,
diff_x, diff_y,
new_object);
- w_current->ADDING_SEL=0;
+ toplevel->ADDING_SEL=0;
o_selection_add( temp_list, new_object );
new_object->saved_color = object->saved_color;
@@ -365,13 +368,13 @@ void o_copy_end(TOPLEVEL *w_current)
}
- w_current->page_current->object_tail =
- (OBJECT *) return_tail(w_current->page_current->
+ toplevel->page_current->object_tail =
+ (OBJECT *) return_tail(toplevel->page_current->
object_head);
s_current = g_list_next(s_current);
}
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
while(s_current != NULL) {
object = (OBJECT *) s_current->data;
@@ -384,16 +387,16 @@ void o_copy_end(TOPLEVEL *w_current)
switch(object->type) {
case(OBJ_TEXT):
- w_current->ADDING_SEL=1;
- new_object = (OBJECT *) o_text_copy(w_current,
+ toplevel->ADDING_SEL=1;
+ new_object = (OBJECT *) o_text_copy(toplevel,
return_tail(new_objects_head),
object);
- w_current->ADDING_SEL=0;
+ toplevel->ADDING_SEL=0;
/* this is also okay NEWSEL new_obj is single */
if (object->attached_to) {
if (object->attached_to->copied_to) {
- o_attrib_attach(w_current, new_objects_head,
+ o_attrib_attach(toplevel, new_objects_head,
new_object, object->attached_to-> copied_to);
/*! \todo I have no idea if this is
@@ -413,14 +416,14 @@ void o_copy_end(TOPLEVEL *w_current)
object);
}
- w_current->ADDING_SEL=1;
- o_text_translate_world(w_current, diff_x, diff_y, new_object);
- w_current->ADDING_SEL=0;
+ toplevel->ADDING_SEL=1;
+ o_text_translate_world(toplevel, diff_x, diff_y, new_object);
+ toplevel->ADDING_SEL=0;
/* old object was attr */
if (!new_object->attribute &&
object->attribute) {
- new_object->color = w_current-> detachedattr_color;
+ new_object->color = toplevel->detachedattr_color;
o_complex_set_color(new_object, new_object->color);
new_object->visibility = VISIBLE;
color = new_object->color;
@@ -439,13 +442,13 @@ void o_copy_end(TOPLEVEL *w_current)
break;
}
- w_current->page_current->object_tail =
- (OBJECT *) return_tail( w_current->page_current->object_head );
+ toplevel->page_current->object_tail =
+ (OBJECT *) return_tail( toplevel->page_current->object_head );
s_current = g_list_next(s_current);
}
/* Clean up dangling ATTRIB.copied_to pointers */
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
while(s_current != NULL) {
object = s_current->data;
o_attrib_list_copied_to (object->attribs, NULL);
@@ -459,17 +462,17 @@ void o_copy_end(TOPLEVEL *w_current)
#if 0
/* Go back to the state before copying, to restore possible rotations
of the selection */
- redraw_state = w_current->DONT_REDRAW;
- w_current->DONT_REDRAW = 0;
+ redraw_state = toplevel->DONT_REDRAW;
+ toplevel->DONT_REDRAW = 0;
o_undo_callback(w_current, UNDO_ACTION);
- w_current->DONT_REDRAW = redraw_state;
+ toplevel->DONT_REDRAW = redraw_state;
#endif
/* Add the new objects */
- w_current->page_current->object_tail = (OBJECT *)
- return_tail(w_current->page_current->object_head);
+ toplevel->page_current->object_tail = (OBJECT *)
+ return_tail(toplevel->page_current->object_head);
- s_basic_link_object(new_objects_head, w_current->page_current->object_tail);
+ s_basic_link_object(new_objects_head, toplevel->page_current->object_tail);
/* Run the copy component hook */
object = new_objects_head->next;
@@ -492,26 +495,26 @@ void o_copy_end(TOPLEVEL *w_current)
/* Delete the new object head */
/* new_objects_head->next = NULL;
- s_delete_list_fromstart(w_current, new_objects_head); */
+ s_delete_list_fromstart(toplevel, new_objects_head); */
- w_current->page_current->object_tail = (OBJECT *)
- return_tail(w_current->page_current->object_head);
+ toplevel->page_current->object_tail = (OBJECT *)
+ return_tail(toplevel->page_current->object_head);
/* erase the bounding box */
if (w_current->actionfeedback_mode == BOUNDINGBOX) {
o_drawbounding(w_current,
- geda_list_get_glist( w_current->page_current->selection_list ),
+ geda_list_get_glist( toplevel->page_current->selection_list ),
x_get_darkcolor(w_current->bb_color), TRUE);
}
o_select_unselect_all( w_current );
- geda_list_add_glist( w_current->page_current->selection_list, geda_list_get_glist( temp_list ) );
+ geda_list_add_glist( toplevel->page_current->selection_list, geda_list_get_glist( temp_list ) );
g_object_unref( temp_list );
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
- /* not needed o_redraw(w_current, w_current->page_current->object_head); */
+ /* not needed o_redraw(w_current, toplevel->page_current->object_head); */
o_cue_draw_list(w_current, new_objects);
o_cue_undraw_list(w_current, connected_objects);
o_cue_draw_list(w_current, connected_objects);
diff --git a/gschem/src/o_cue.c b/gschem/src/o_cue.c
index f60b9fb..7e75248 100644
--- a/gschem/src/o_cue.c
+++ b/gschem/src/o_cue.c
@@ -24,6 +24,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -36,10 +37,11 @@
* \par Function Description
*
*/
-void o_cue_redraw_all(TOPLEVEL *w_current, OBJECT *head, gboolean draw_selected)
+void o_cue_redraw_all(GSCHEM_TOPLEVEL *w_current, OBJECT *head, gboolean draw_selected)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current;
- int redraw_state = w_current->DONT_REDRAW;
+ int redraw_state = w_current->toplevel->DONT_REDRAW;
o_current = head;
while(o_current != NULL) {
@@ -48,10 +50,10 @@ void o_cue_redraw_all(TOPLEVEL *w_current, OBJECT *head, gboolean draw_selected)
case(OBJ_BUS):
case(OBJ_PIN):
if (o_current->selected && !draw_selected) {
- w_current->DONT_REDRAW = 1 || redraw_state;
+ w_current->toplevel->DONT_REDRAW = 1 || redraw_state;
}
else {
- w_current->DONT_REDRAW = 0 || redraw_state;
+ w_current->toplevel->DONT_REDRAW = 0 || redraw_state;
}
o_cue_draw_single(w_current, o_current);
break;
@@ -59,10 +61,10 @@ void o_cue_redraw_all(TOPLEVEL *w_current, OBJECT *head, gboolean draw_selected)
case(OBJ_COMPLEX):
case(OBJ_PLACEHOLDER):
if (o_current->selected && !draw_selected) {
- w_current->DONT_REDRAW = 1 || redraw_state;
+ toplevel->DONT_REDRAW = 1 || redraw_state;
}
else {
- w_current->DONT_REDRAW = 0 || redraw_state;
+ toplevel->DONT_REDRAW = 0 || redraw_state;
}
o_cue_redraw_all(w_current, o_current->complex->prim_objs,
draw_selected);
@@ -72,18 +74,18 @@ void o_cue_redraw_all(TOPLEVEL *w_current, OBJECT *head, gboolean draw_selected)
o_current = o_current->next;
}
- w_current->DONT_REDRAW = redraw_state;
+ toplevel->DONT_REDRAW = redraw_state;
}
/*!
* \brief Set the color on the gc depending on the passed in color id
*/
-static void o_cue_set_color(TOPLEVEL *w_current, int color)
+static void o_cue_set_color(GSCHEM_TOPLEVEL *w_current, int color)
{
- if (w_current->override_color != -1 ) {
+ if (w_current->toplevel->override_color != -1 ) {
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->override_color));
+ x_get_color(w_current->toplevel->override_color));
} else {
gdk_gc_set_foreground(w_current->gc, x_get_color(color));
}
@@ -95,8 +97,9 @@ static void o_cue_set_color(TOPLEVEL *w_current, int color)
* \par Function Description
*
*/
-void o_cue_draw_lowlevel(TOPLEVEL *w_current, OBJECT *object, int whichone)
+void o_cue_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int whichone)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x, y, screen_x, screen_y;
GList *cl_current;
CONN *conn;
@@ -153,18 +156,18 @@ void o_cue_draw_lowlevel(TOPLEVEL *w_current, OBJECT *object, int whichone)
printf("type: %d count: %d\n", type, count);
#endif
- size = SCREENabs(w_current, CUE_BOX_SIZE);
+ size = SCREENabs(toplevel, CUE_BOX_SIZE);
x2size = 2 * size;
- WORLDtoSCREEN(w_current, x, y, &screen_x, &screen_y);
+ WORLDtoSCREEN(toplevel, x, y, &screen_x, &screen_y);
switch(type) {
case(CONN_ENDPOINT):
if (object->type == OBJ_NET) { /* only nets have these cues */
if (count < 1) { /* Didn't find anything connected there */
- if (w_current->DONT_REDRAW == 0) {
- o_cue_set_color(w_current, w_current->net_endpoint_color);
+ if (toplevel->DONT_REDRAW == 0) {
+ o_cue_set_color(w_current, toplevel->net_endpoint_color);
gdk_draw_rectangle(w_current->window,
w_current->gc, TRUE,
screen_x - size,
@@ -183,12 +186,12 @@ void o_cue_draw_lowlevel(TOPLEVEL *w_current, OBJECT *object, int whichone)
/* draw circle */
if (bus_involved) {
- size = SCREENabs(w_current, CUE_CIRCLE_SMALL_SIZE);
+ size = SCREENabs(toplevel, CUE_CIRCLE_SMALL_SIZE);
} else {
- size = SCREENabs(w_current, CUE_CIRCLE_LARGE_SIZE);
+ size = SCREENabs(toplevel, CUE_CIRCLE_LARGE_SIZE);
}
- if (w_current->DONT_REDRAW == 0) {
- o_cue_set_color(w_current, w_current->junction_color);
+ if (toplevel->DONT_REDRAW == 0) {
+ o_cue_set_color(w_current, toplevel->junction_color);
gdk_draw_arc(w_current->window, w_current->gc,
TRUE,
screen_x - size / 2,
@@ -207,16 +210,16 @@ void o_cue_draw_lowlevel(TOPLEVEL *w_current, OBJECT *object, int whichone)
otherone = !whichone;
- pinsize = SCREENabs(w_current, 10);
- if (w_current->pin_style == THICK ) {
+ pinsize = SCREENabs(toplevel, 10);
+ if (toplevel->pin_style == THICK ) {
gdk_gc_set_line_attributes(w_current->gc, pinsize,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
GDK_JOIN_MITER);
}
- if (w_current->DONT_REDRAW == 0) {
- o_cue_set_color(w_current, w_current->net_endpoint_color);
+ if (toplevel->DONT_REDRAW == 0) {
+ o_cue_set_color(w_current, toplevel->net_endpoint_color);
if (object->line->y[whichone] == object->line->y[otherone]) {
/* horizontal line */
if (object->line->x[whichone] <= object->line->x[otherone]) {
@@ -249,7 +252,7 @@ void o_cue_draw_lowlevel(TOPLEVEL *w_current, OBJECT *object, int whichone)
}
}
- if (w_current->pin_style == THICK ) {
+ if (toplevel->pin_style == THICK ) {
gdk_gc_set_line_attributes(w_current->gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -263,13 +266,13 @@ void o_cue_draw_lowlevel(TOPLEVEL *w_current, OBJECT *object, int whichone)
/* draw circle */
if (bus_involved) {
- size = SCREENabs(w_current, CUE_CIRCLE_SMALL_SIZE);
+ size = SCREENabs(toplevel, CUE_CIRCLE_SMALL_SIZE);
} else {
- size = SCREENabs(w_current, CUE_CIRCLE_LARGE_SIZE);
+ size = SCREENabs(toplevel, CUE_CIRCLE_LARGE_SIZE);
}
- if (w_current->DONT_REDRAW == 0) {
- o_cue_set_color(w_current, w_current->junction_color);
+ if (toplevel->DONT_REDRAW == 0) {
+ o_cue_set_color(w_current, toplevel->junction_color);
gdk_draw_arc(w_current->window, w_current->gc,
TRUE,
screen_x - size / 2,
@@ -293,27 +296,28 @@ void o_cue_draw_lowlevel(TOPLEVEL *w_current, OBJECT *object, int whichone)
* \par Function Description
* This function erases OBJECT endpoints forceably.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] object OBJECT to forceably erase endpoint from.
* \param [in] whichone Which endpoint to erase from OBJECT.
*/
-void o_cue_erase_lowlevel(TOPLEVEL *w_current, OBJECT *object, int whichone)
+void o_cue_erase_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int whichone)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x, y, screen_x, screen_y;
int size, x2size;
x = object->line->x[whichone];
y = object->line->y[whichone];
- size = SCREENabs(w_current, CUE_BOX_SIZE);
+ size = SCREENabs(toplevel, CUE_BOX_SIZE);
x2size = 2 * size;
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->background_color));
+ x_get_color(toplevel->background_color));
- WORLDtoSCREEN(w_current, x, y, &screen_x, &screen_y);
+ WORLDtoSCREEN(toplevel, x, y, &screen_x, &screen_y);
- if (w_current->DONT_REDRAW == 0) {
+ if (toplevel->DONT_REDRAW == 0) {
gdk_draw_rectangle(w_current->window,
w_current->gc, TRUE,
screen_x - size,
@@ -335,19 +339,20 @@ void o_cue_erase_lowlevel(TOPLEVEL *w_current, OBJECT *object, int whichone)
* \par Function Description
*
*/
-void o_cue_draw_lowlevel_midpoints(TOPLEVEL *w_current, OBJECT *object)
+void o_cue_draw_lowlevel_midpoints(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x, y, screen_x, screen_y;
GList *cl_current;
CONN *conn;
int size;
- if (w_current->override_color != -1 ) {
+ if (toplevel->override_color != -1 ) {
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->override_color));
+ x_get_color(toplevel->override_color));
} else {
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->junction_color));
+ x_get_color(toplevel->junction_color));
}
cl_current = object->conn_list;
@@ -360,7 +365,7 @@ void o_cue_draw_lowlevel_midpoints(TOPLEVEL *w_current, OBJECT *object)
x = conn->x;
y = conn->y;
- WORLDtoSCREEN(w_current, x, y, &screen_x, &screen_y);
+ WORLDtoSCREEN(toplevel, x, y, &screen_x, &screen_y);
/* draw circle */
if (conn->other_object &&
@@ -368,12 +373,12 @@ void o_cue_draw_lowlevel_midpoints(TOPLEVEL *w_current, OBJECT *object)
conn->other_object->type == OBJ_NET) ||
(object->type == OBJ_NET &&
conn->other_object->type == OBJ_BUS))) {
- size = SCREENabs(w_current, CUE_CIRCLE_SMALL_SIZE);
+ size = SCREENabs(toplevel, CUE_CIRCLE_SMALL_SIZE);
} else {
- size = SCREENabs(w_current, CUE_CIRCLE_LARGE_SIZE);
+ size = SCREENabs(toplevel, CUE_CIRCLE_LARGE_SIZE);
}
- if (w_current->DONT_REDRAW == 0) {
+ if (toplevel->DONT_REDRAW == 0) {
gdk_draw_arc(w_current->window, w_current->gc,
TRUE,
screen_x - size / 2,
@@ -398,7 +403,7 @@ void o_cue_draw_lowlevel_midpoints(TOPLEVEL *w_current, OBJECT *object)
* \par Function Description
*
*/
-void o_cue_draw_single(TOPLEVEL *w_current, OBJECT *object)
+void o_cue_draw_single(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
{
if (!object) {
return;
@@ -423,8 +428,9 @@ void o_cue_draw_single(TOPLEVEL *w_current, OBJECT *object)
* \par Function Description
*
*/
-void o_cue_erase_single(TOPLEVEL *w_current, OBJECT *object)
+void o_cue_erase_single(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
if (!object) {
return;
}
@@ -438,9 +444,9 @@ void o_cue_erase_single(TOPLEVEL *w_current, OBJECT *object)
if (object->type != OBJ_PIN) {
o_cue_erase_lowlevel(w_current, object, 0);
o_cue_erase_lowlevel(w_current, object, 1);
- w_current->override_color = w_current->background_color;
+ toplevel->override_color = toplevel->background_color;
o_cue_draw_lowlevel_midpoints(w_current, object);
- w_current->override_color = -1;
+ toplevel->override_color = -1;
} else {
o_cue_erase_lowlevel(w_current, object, object->whichend);
}
@@ -451,7 +457,7 @@ void o_cue_erase_single(TOPLEVEL *w_current, OBJECT *object)
* \par Function Description
*
*/
-void o_cue_undraw(TOPLEVEL *w_current, OBJECT *object)
+void o_cue_undraw(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
{
GList *cl_current;
CONN *conn;
@@ -474,12 +480,12 @@ void o_cue_undraw(TOPLEVEL *w_current, OBJECT *object)
/*! \brief Undraw complex OBJECT.
* \par Function Description
- * This function undraws complex objects (pass in the toplevel object)
+ * This function undraws complex objects (pass in the GSCHEM_TOPLEVEL object)
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] object OBJECT to undraw.
*/
-void o_cue_undraw_complex(TOPLEVEL *w_current, OBJECT *object)
+void o_cue_undraw_complex(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
{
GList *cl_current;
CONN *conn;
@@ -519,7 +525,7 @@ void o_cue_undraw_complex(TOPLEVEL *w_current, OBJECT *object)
* \par Function Description
*
*/
-void o_cue_draw_list(TOPLEVEL *w_current, GList *object_list)
+void o_cue_draw_list(GSCHEM_TOPLEVEL *w_current, GList *object_list)
{
OBJECT *object;
GList *ol_current;
@@ -539,7 +545,7 @@ void o_cue_draw_list(TOPLEVEL *w_current, GList *object_list)
* \par Function Description
*
*/
-void o_cue_undraw_list(TOPLEVEL *w_current, GList *object_list)
+void o_cue_undraw_list(GSCHEM_TOPLEVEL *w_current, GList *object_list)
{
OBJECT *object;
GList *ol_current;
@@ -559,7 +565,7 @@ void o_cue_undraw_list(TOPLEVEL *w_current, GList *object_list)
* \par Function Description
*
*/
-void o_cue_undraw_objects(TOPLEVEL *w_current, OBJECT *list)
+void o_cue_undraw_objects(GSCHEM_TOPLEVEL *w_current, OBJECT *list)
{
OBJECT *o_current;
diff --git a/gschem/src/o_delete.c b/gschem/src/o_delete.c
index 535527f..d1046bc 100644
--- a/gschem/src/o_delete.c
+++ b/gschem/src/o_delete.c
@@ -23,6 +23,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -35,8 +36,9 @@
* \par Function Description
*
*/
-void o_delete_net(TOPLEVEL *w_current, OBJECT *obj)
+void o_delete_net(GSCHEM_TOPLEVEL *w_current, OBJECT *obj)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *other_objects = NULL;
o_cue_undraw(w_current, obj);
@@ -45,10 +47,10 @@ void o_delete_net(TOPLEVEL *w_current, OBJECT *obj)
other_objects = s_conn_return_others(other_objects, obj);
- s_delete(w_current, obj);
+ s_delete(toplevel, obj);
- w_current->page_current->object_tail =
- (OBJECT *) return_tail(w_current->page_current->object_head);
+ toplevel->page_current->object_tail =
+ (OBJECT *) return_tail(toplevel->page_current->object_head);
o_cue_undraw_list(w_current, other_objects);
o_cue_draw_list(w_current, other_objects);
@@ -60,8 +62,9 @@ void o_delete_net(TOPLEVEL *w_current, OBJECT *obj)
* \par Function Description
*
*/
-void o_delete_bus(TOPLEVEL *w_current, OBJECT *obj)
+void o_delete_bus(GSCHEM_TOPLEVEL *w_current, OBJECT *obj)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *other_objects = NULL;
o_cue_undraw(w_current, obj);
@@ -70,10 +73,10 @@ void o_delete_bus(TOPLEVEL *w_current, OBJECT *obj)
other_objects = s_conn_return_others(other_objects, obj);
- s_delete(w_current, obj);
+ s_delete(toplevel, obj);
- w_current->page_current->object_tail =
- (OBJECT *) return_tail(w_current->page_current->object_head);
+ toplevel->page_current->object_tail =
+ (OBJECT *) return_tail(toplevel->page_current->object_head);
o_cue_undraw_list(w_current, other_objects);
o_cue_draw_list(w_current, other_objects);
@@ -86,8 +89,9 @@ void o_delete_bus(TOPLEVEL *w_current, OBJECT *obj)
* \par Function Description
*
*/
-static void o_delete_pin(TOPLEVEL *w_current, OBJECT *obj)
+static void o_delete_pin(GSCHEM_TOPLEVEL *w_current, OBJECT *obj)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *other_objects = NULL;
o_cue_undraw(w_current, obj);
@@ -96,9 +100,9 @@ static void o_delete_pin(TOPLEVEL *w_current, OBJECT *obj)
other_objects = s_conn_return_others(other_objects, obj);
- s_delete(w_current, obj);
- w_current->page_current->object_tail =
- (OBJECT *) return_tail(w_current->page_current->object_head);
+ s_delete(toplevel, obj);
+ toplevel->page_current->object_tail =
+ (OBJECT *) return_tail(toplevel->page_current->object_head);
o_cue_undraw_list(w_current, other_objects);
o_cue_draw_list(w_current, other_objects);
@@ -111,8 +115,9 @@ static void o_delete_pin(TOPLEVEL *w_current, OBJECT *obj)
* \par Function Description
*
*/
-void o_delete_complex(TOPLEVEL *w_current, OBJECT *obj)
+void o_delete_complex(GSCHEM_TOPLEVEL *w_current, OBJECT *obj)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *other_objects = NULL;
o_cue_undraw_complex(w_current, obj);
@@ -120,7 +125,7 @@ void o_delete_complex(TOPLEVEL *w_current, OBJECT *obj)
other_objects = s_conn_return_complex_others(other_objects, obj);
- o_complex_delete(w_current, obj);
+ o_complex_delete(toplevel, obj);
/*! \todo special case hack no return_tail. why? */
o_cue_undraw_list(w_current, other_objects);
@@ -133,14 +138,15 @@ void o_delete_complex(TOPLEVEL *w_current, OBJECT *obj)
* \par Function Description
*
*/
-static void o_delete_line(TOPLEVEL *w_current, OBJECT *obj)
+static void o_delete_line(GSCHEM_TOPLEVEL *w_current, OBJECT *obj)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
o_line_erase(w_current, obj);
o_line_erase_grips(w_current, obj);
- s_delete(w_current, obj);
- w_current->page_current->object_tail =
- (OBJECT *) return_tail(w_current->page_current->object_head);
+ s_delete(toplevel, obj);
+ toplevel->page_current->object_tail =
+ (OBJECT *) return_tail(toplevel->page_current->object_head);
}
/*! \todo Finish function documentation!!!
@@ -148,14 +154,15 @@ static void o_delete_line(TOPLEVEL *w_current, OBJECT *obj)
* \par Function Description
*
*/
-static void o_delete_box(TOPLEVEL *w_current, OBJECT *obj)
+static void o_delete_box(GSCHEM_TOPLEVEL *w_current, OBJECT *obj)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
o_box_erase(w_current, obj);
o_box_erase_grips(w_current, obj);
- s_delete(w_current, obj);
- w_current->page_current->object_tail =
- (OBJECT *) return_tail(w_current->page_current->object_head);
+ s_delete(toplevel, obj);
+ toplevel->page_current->object_tail =
+ (OBJECT *) return_tail(toplevel->page_current->object_head);
}
@@ -164,14 +171,15 @@ static void o_delete_box(TOPLEVEL *w_current, OBJECT *obj)
* \par Function Description
*
*/
-static void o_delete_picture(TOPLEVEL *w_current, OBJECT *obj)
+static void o_delete_picture(GSCHEM_TOPLEVEL *w_current, OBJECT *obj)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
o_picture_erase(w_current, obj);
o_picture_erase_grips(w_current, obj);
- s_delete(w_current, obj);
- w_current->page_current->object_tail =
- (OBJECT *) return_tail(w_current->page_current->object_head);
+ s_delete(toplevel, obj);
+ toplevel->page_current->object_tail =
+ (OBJECT *) return_tail(toplevel->page_current->object_head);
}
/*! \todo Finish function documentation!!!
@@ -179,15 +187,16 @@ static void o_delete_picture(TOPLEVEL *w_current, OBJECT *obj)
* \par Function Description
*
*/
-static void o_delete_circle(TOPLEVEL *w_current, OBJECT *obj)
+static void o_delete_circle(GSCHEM_TOPLEVEL *w_current, OBJECT *obj)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
o_circle_erase(w_current, obj);
o_circle_erase_grips(w_current, obj);
- s_delete(w_current, obj);
+ s_delete(toplevel, obj);
- w_current->page_current->object_tail =
- (OBJECT *) return_tail(w_current->page_current->object_head);
+ toplevel->page_current->object_tail =
+ (OBJECT *) return_tail(toplevel->page_current->object_head);
}
/*! \todo Finish function documentation!!!
@@ -195,13 +204,14 @@ static void o_delete_circle(TOPLEVEL *w_current, OBJECT *obj)
* \par Function Description
*
*/
-void o_delete_text(TOPLEVEL *w_current, OBJECT *obj)
+void o_delete_text(GSCHEM_TOPLEVEL *w_current, OBJECT *obj)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
o_text_erase(w_current, obj);
- s_delete(w_current, obj);
- w_current->page_current->object_tail =
- (OBJECT *) return_tail(w_current->page_current->object_head);
+ s_delete(toplevel, obj);
+ toplevel->page_current->object_tail =
+ (OBJECT *) return_tail(toplevel->page_current->object_head);
}
/*! \todo Finish function documentation!!!
@@ -209,13 +219,14 @@ void o_delete_text(TOPLEVEL *w_current, OBJECT *obj)
* \par Function Description
*
*/
-static void o_delete_arc(TOPLEVEL *w_current, OBJECT *obj)
+static void o_delete_arc(GSCHEM_TOPLEVEL *w_current, OBJECT *obj)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
o_arc_erase(w_current, obj);
- s_delete(w_current, obj);
- w_current->page_current->object_tail =
- (OBJECT *) return_tail(w_current->page_current->object_head);
+ s_delete(toplevel, obj);
+ toplevel->page_current->object_tail =
+ (OBJECT *) return_tail(toplevel->page_current->object_head);
}
/*! \todo Finish function documentation!!!
@@ -223,8 +234,9 @@ static void o_delete_arc(TOPLEVEL *w_current, OBJECT *obj)
* \par Function Description
*
*/
-void o_delete(TOPLEVEL *w_current)
+void o_delete(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *s_current = NULL;
OBJECT *object = NULL;
@@ -238,7 +250,7 @@ void o_delete(TOPLEVEL *w_current)
/* skip over head node */
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
while(s_current != NULL) {
@@ -293,12 +305,12 @@ void o_delete(TOPLEVEL *w_current)
w_current->inside_action = 0;
/* Objects in the selection list have been deleted. Empty the list without touching the objects */
- geda_list_remove_all( w_current->page_current->selection_list );
+ geda_list_remove_all( toplevel->page_current->selection_list );
- w_current->page_current->CHANGED=1;
+ toplevel->page_current->CHANGED=1;
/* no longer needed */
- /* o_redraw(w_current, w_current->page_current->object_head);*/
+ /* o_redraw(w_current, toplevel->page_current->object_head);*/
o_undo_savestate(w_current, UNDO_ALL);
i_update_menus(w_current);
diff --git a/gschem/src/o_find.c b/gschem/src/o_find.c
index 336a190..192843d 100644
--- a/gschem/src/o_find.c
+++ b/gschem/src/o_find.c
@@ -24,6 +24,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/x_states.h"
#include "../include/prototype.h"
@@ -36,20 +37,21 @@
* \par Function Description
*
*/
-gboolean o_find_object(TOPLEVEL *w_current, int screen_x, int screen_y,
+gboolean o_find_object(GSCHEM_TOPLEVEL *w_current, int screen_x, int screen_y,
gboolean change_selection)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current=NULL;
gboolean object_found = FALSE;
int w_x, w_y, w_slack;
- SCREENtoWORLD( w_current, screen_x, screen_y, &w_x, &w_y );
- w_slack = WORLDabs( w_current, w_current->select_slack_pixels );
+ SCREENtoWORLD( toplevel, screen_x, screen_y, &w_x, &w_y );
+ w_slack = WORLDabs( toplevel, w_current->select_slack_pixels );
- if (w_current->page_current->object_lastplace == NULL) {
- o_current = w_current->page_current->object_head;
+ if (toplevel->page_current->object_lastplace == NULL) {
+ o_current = toplevel->page_current->object_head;
} else {
- o_current = w_current->page_current->object_lastplace;
+ o_current = toplevel->page_current->object_lastplace;
}
/* do first search */
@@ -61,14 +63,14 @@ gboolean o_find_object(TOPLEVEL *w_current, int screen_x, int screen_y,
o_current->type != OBJ_HEAD &&
(o_current->visibility == VISIBLE ||
(o_current->visibility == INVISIBLE &&
- w_current->show_hidden_text))) {
+ toplevel->show_hidden_text))) {
if (change_selection) {
(*o_current->sel_func)(
w_current, o_current,
SINGLE, 0); /* 0 is count */
}
object_found = TRUE;
- w_current->page_current-> object_lastplace =
+ toplevel->page_current-> object_lastplace =
o_current->next;
i_update_menus(w_current);
return object_found;
@@ -83,9 +85,9 @@ gboolean o_find_object(TOPLEVEL *w_current, int screen_x, int screen_y,
/* now search again since we didn't find anything starting at start
just in case we started last time at object_lastplace */
- o_current = w_current->page_current->object_head;
+ o_current = toplevel->page_current->object_head;
while (o_current != NULL &&
- o_current != w_current->page_current->object_lastplace) {
+ o_current != toplevel->page_current->object_lastplace) {
if (inside_region(o_current->w_left - w_slack, o_current->w_top - w_slack,
o_current->w_right + w_slack, o_current->w_bottom + w_slack,
w_x, w_y)) {
@@ -94,12 +96,12 @@ gboolean o_find_object(TOPLEVEL *w_current, int screen_x, int screen_y,
o_current->type != OBJ_HEAD &&
(o_current->visibility == VISIBLE ||
(o_current->visibility == INVISIBLE &&
- w_current->show_hidden_text))) {
+ toplevel->show_hidden_text))) {
if (change_selection) {
/* 0 is count */
(*o_current->sel_func)(w_current, o_current, SINGLE, 0);
}
- w_current->page_current->object_lastplace = o_current;
+ toplevel->page_current->object_lastplace = o_current;
object_found = TRUE;
i_update_menus(w_current);
@@ -110,7 +112,7 @@ gboolean o_find_object(TOPLEVEL *w_current, int screen_x, int screen_y,
}
/* didn't find anything.... reset lastplace */
- w_current->page_current->object_lastplace = NULL;
+ toplevel->page_current->object_lastplace = NULL;
/* deselect everything only if shift key isn't pressed and
the caller allows it */
@@ -128,17 +130,18 @@ gboolean o_find_object(TOPLEVEL *w_current, int screen_x, int screen_y,
* \par Function Description
*
*/
-gboolean o_find_selected_object(TOPLEVEL *w_current,
+gboolean o_find_selected_object(GSCHEM_TOPLEVEL *w_current,
int screen_x, int screen_y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current=NULL;
GList *s_current;
int w_x, w_y, w_slack;
- SCREENtoWORLD( w_current, screen_x, screen_y, &w_x, &w_y );
- w_slack = WORLDabs( w_current, w_current->select_slack_pixels );
+ SCREENtoWORLD( toplevel, screen_x, screen_y, &w_x, &w_y );
+ w_slack = WORLDabs( toplevel, w_current->select_slack_pixels );
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
/* do first search */
while (s_current != NULL) {
o_current = (OBJECT *) s_current->data;
@@ -156,7 +159,7 @@ gboolean o_find_selected_object(TOPLEVEL *w_current,
o_current->type != OBJ_HEAD &&
(o_current->visibility == VISIBLE ||
(o_current->visibility == INVISIBLE &&
- w_current->show_hidden_text))) {
+ toplevel->show_hidden_text))) {
return TRUE;
}
}
diff --git a/gschem/src/o_grips.c b/gschem/src/o_grips.c
index c2b893a..4926a26 100644
--- a/gschem/src/o_grips.c
+++ b/gschem/src/o_grips.c
@@ -24,6 +24,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -58,7 +59,7 @@ static OBJECT *object_changing;
* This function is used to determine if the (<B>x</B>,<B>y</B>) point is
* inside a grip of one of the selected object on the current sheet.
* The selected object are in a list starting at
- * <B>w_current->page_current->selection2_head</B>.
+ * <B>w_current->toplevel->page_current->selection2_head</B>.
* The <B>x</B> and <B>y</B> parameters are in world units.
* If the point is inside one grip, a pointer on the object it belongs to is
* returned and <B>*whichone</B> is set according to the position of the grip
@@ -69,14 +70,15 @@ static OBJECT *object_changing;
* The list of selected object is covered : each object is tested with the
* appropriate function.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in world units.
* \param [in] y Current y coordinate of pointer in world units.
* \param [out] whichone Which grip point is selected.
* \return Pointer to OBJECT the grip is on, NULL otherwise.
*/
-OBJECT *o_grips_search_world(TOPLEVEL *w_current, int x, int y, int *whichone)
+OBJECT *o_grips_search_world(GSCHEM_TOPLEVEL *w_current, int x, int y, int *whichone)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *object=NULL;
OBJECT *found=NULL;
GList *s_current;
@@ -89,9 +91,9 @@ OBJECT *o_grips_search_world(TOPLEVEL *w_current, int x, int y, int *whichone)
/* get the size of the grip according to zoom level */
size = o_grips_size(w_current);
- w_size = WORLDabs( w_current, size );
+ w_size = WORLDabs(toplevel, size );
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
while (s_current != NULL) {
object = (OBJECT *) s_current->data;
if (object) {
@@ -198,7 +200,7 @@ static gboolean inside_grip( int x, int y, int grip_x, int grip_y, int size )
* The <B>size</B> parameter is the width (and height) of the square
* representing a grip in world units.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Arc OBJECT to check.
* \param [in] x Current x coordinate of pointer in world units.
* \param [in] y Current y coordinate of pointer in world units.
@@ -206,7 +208,7 @@ static gboolean inside_grip( int x, int y, int grip_x, int grip_y, int size )
* \param [out] whichone Which grip point is selected.
* \return Pointer to OBJECT the grip is on, NULL otherwise.
*/
-OBJECT *o_grips_search_arc_world(TOPLEVEL *w_current, OBJECT *o_current,
+OBJECT *o_grips_search_arc_world(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
int x, int y, int size, int *whichone)
{
int centerx, centery, radius, start_angle, end_angle;
@@ -263,7 +265,7 @@ OBJECT *o_grips_search_arc_world(TOPLEVEL *w_current, OBJECT *o_current,
* The <B>size</B> parameter is half the width (and half the height) of
* the square representing a grip in world units.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Box OBJECT to check.
* \param [in] x Current x coordinate of pointer in world units.
* \param [in] y Current y coordinate of pointer in world units.
@@ -271,7 +273,7 @@ OBJECT *o_grips_search_arc_world(TOPLEVEL *w_current, OBJECT *o_current,
* \param [out] whichone Which grip point is selected.
* \return Pointer to OBJECT the grip is on, NULL otherwise.
*/
-OBJECT *o_grips_search_box_world(TOPLEVEL *w_current, OBJECT *o_current,
+OBJECT *o_grips_search_box_world(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
int x, int y, int size, int *whichone)
{
/* inside upper left grip ? */
@@ -328,7 +330,7 @@ OBJECT *o_grips_search_box_world(TOPLEVEL *w_current, OBJECT *o_current,
* The <B>size</B> parameter is half the width (and half the height) of the
* square representing a grip in world units.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Picture OBJECT to check.
* \param [in] x Current x coordinate of pointer in world units.
* \param [in] y Current y coordinate of pointer in world units.
@@ -336,7 +338,7 @@ OBJECT *o_grips_search_box_world(TOPLEVEL *w_current, OBJECT *o_current,
* \param [out] whichone Which grip point is selected.
* \return Pointer to OBJECT the grip is on, NULL otherwise.
*/
-OBJECT *o_grips_search_picture_world(TOPLEVEL *w_current, OBJECT *o_current,
+OBJECT *o_grips_search_picture_world(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
int x, int y, int size, int *whichone)
{
/* inside upper left grip ? */
@@ -391,7 +393,7 @@ OBJECT *o_grips_search_picture_world(TOPLEVEL *w_current, OBJECT *o_current,
* is inscribed in. Moving this grip change the radius of the circle.
* The identifier of this grip is <B>CIRCLE_RADIUS</B>.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Circle OBJECT to check.
* \param [in] x Current x coordinate of pointer in world units.
* \param [in] y Current y coordinate of pointer in world units.
@@ -399,7 +401,7 @@ OBJECT *o_grips_search_picture_world(TOPLEVEL *w_current, OBJECT *o_current,
* \param [out] whichone Which grip point is selected.
* \return Pointer to OBJECT the grip is on, NULL otherwise.
*/
-OBJECT *o_grips_search_circle_world(TOPLEVEL *w_current, OBJECT *o_current,
+OBJECT *o_grips_search_circle_world(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
int x, int y, int size, int *whichone)
{
/* check the grip for radius */
@@ -426,7 +428,7 @@ OBJECT *o_grips_search_circle_world(TOPLEVEL *w_current, OBJECT *o_current,
*
* The parameter <B>size</B> is half the size of the grip in world units.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Line OBJECT to check.
* \param [in] x Current x coordinate of pointer in world units.
* \param [in] y Current y coordinate of pointer in world units.
@@ -434,7 +436,7 @@ OBJECT *o_grips_search_circle_world(TOPLEVEL *w_current, OBJECT *o_current,
* \param [out] whichone Which grip point is selected.
* \return Pointer to OBJECT the grip is on, NULL otherwise.
*/
-OBJECT *o_grips_search_line_world(TOPLEVEL *w_current, OBJECT *o_current,
+OBJECT *o_grips_search_line_world(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
int x, int y, int size, int *whichone)
{
/* check the grip on the end of line 1 */
@@ -471,13 +473,14 @@ OBJECT *o_grips_search_line_world(TOPLEVEL *w_current, OBJECT *o_current,
* <B>whichone_changing</B> and <B>object_changing</B> with respectively the
* identifier of the grip and the object it belongs to.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
* \return FALSE if an error occurred or no grip was found, TRUE otherwise.
*/
-int o_grips_start(TOPLEVEL *w_current, int x, int y)
+int o_grips_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int w_x, w_y;
OBJECT *object;
int whichone;
@@ -486,7 +489,7 @@ int o_grips_start(TOPLEVEL *w_current, int x, int y)
return(FALSE);
}
- SCREENtoWORLD( w_current, x, y, &w_x, &w_y );
+ SCREENtoWORLD( toplevel, x, y, &w_x, &w_y );
/* search if there is a grip on a selected object at (x,y) */
object = o_grips_search_world(w_current, w_x, w_y, &whichone);
@@ -524,9 +527,9 @@ int o_grips_start(TOPLEVEL *w_current, int x, int y)
case(OBJ_NET):
w_current->last_drawb_mode = -1;
- WORLDtoSCREEN( w_current, object->line->x[whichone], object->line->y[whichone],
+ WORLDtoSCREEN( toplevel, object->line->x[whichone], object->line->y[whichone],
&w_current->last_x, &w_current->last_y );
- WORLDtoSCREEN( w_current, object->line->x[!whichone], object->line->y[!whichone],
+ WORLDtoSCREEN( toplevel, object->line->x[!whichone], object->line->y[!whichone],
&w_current->start_x, &w_current->start_y );
o_net_erase(w_current, object);
@@ -538,14 +541,14 @@ int o_grips_start(TOPLEVEL *w_current, int x, int y)
o_line_erase_grips(w_current, object);
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->background_color));
+ x_get_color(toplevel->background_color));
return(TRUE);
case(OBJ_PIN):
w_current->last_drawb_mode = -1;
- WORLDtoSCREEN( w_current, object->line->x[whichone], object->line->y[whichone],
+ WORLDtoSCREEN( toplevel, object->line->x[whichone], object->line->y[whichone],
&w_current->last_x, &w_current->last_y );
- WORLDtoSCREEN( w_current, object->line->x[!whichone], object->line->y[!whichone],
+ WORLDtoSCREEN( toplevel, object->line->x[!whichone], object->line->y[!whichone],
&w_current->start_x, &w_current->start_y );
o_pin_erase(w_current, object);
@@ -559,9 +562,9 @@ int o_grips_start(TOPLEVEL *w_current, int x, int y)
case(OBJ_BUS):
w_current->last_drawb_mode = -1;
- WORLDtoSCREEN( w_current, object->line->x[whichone], object->line->y[whichone],
+ WORLDtoSCREEN( toplevel, object->line->x[whichone], object->line->y[whichone],
&w_current->last_x, &w_current->last_y );
- WORLDtoSCREEN( w_current, object->line->x[!whichone], object->line->y[!whichone],
+ WORLDtoSCREEN( toplevel, object->line->x[!whichone], object->line->y[!whichone],
&w_current->start_x, &w_current->start_y );
o_bus_erase(w_current, object);
@@ -573,7 +576,7 @@ int o_grips_start(TOPLEVEL *w_current, int x, int y)
o_line_erase_grips(w_current, object);
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->background_color));
+ x_get_color(toplevel->background_color));
return(TRUE);
default:
@@ -587,16 +590,17 @@ int o_grips_start(TOPLEVEL *w_current, int x, int y)
/*! \brief Initialize grip motion process for an arc.
* \par Function Description
* This function initializes the grip motion process for an arc.
- * From the <B>o_current</B> pointed object, it stores into the TOPLEVEL
- * structure the coordinates of the center, the radius and the two angle
- * that describes an arc. These variables are used in the grip process.
+ * From the <B>o_current</B> pointed object, it stores into the
+ * GSCHEM_TOPLEVEL structure the coordinates of the center, the radius
+ * and the two angle that describes an arc. These variables are used in
+ * the grip process.
*
* The coordinates of the center of the arc on x- and y-axis are stored
- * into the <B>loc_x</B> and <B>loc_y</B> fields of the TOPLEVEL structure
- * in screen unit.
+ * into the <B>loc_x</B> and <B>loc_y</B> fields of the GSCHEM_TOPLEVEL
+ * structure in screen units.
*
* The radius of the center is stored into the <B>distance</B> field of
- * the TOPLEVEL structure in screen unit.
+ * the GSCHEM_TOPLEVEL structure in screen units.
*
* The two angles describing the arc on a circle are stored into the
* <B>start_x</B> for the starting angle and <B>start_y</B> for the ending angle.
@@ -604,27 +608,28 @@ int o_grips_start(TOPLEVEL *w_current, int x, int y)
*
* Depending on which grips has been selected on the arc, the
* corresponding variables in its original state is duplicated in
- * <B>last_x</B> and/or <B>last_y</B> of the TOPLEVEL structure.
+ * <B>last_x</B> and/or <B>last_y</B> of the GSCHEM_TOPLEVEL structure.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Arc OBJECT to check.
* \param [in] x (unused)
* \param [in] y (unused)
* \param [out] whichone (unused)
*/
-void o_grips_start_arc(TOPLEVEL *w_current, OBJECT *o_current,
+void o_grips_start_arc(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
int x, int y, int whichone)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
w_current->last_drawb_mode = -1;
/* erase the arc before */
o_arc_erase(w_current, o_current);
- /* describe the arc with TOPLEVEL variables */
+ /* describe the arc with GSCHEM_TOPLEVEL variables */
/* center */
- WORLDtoSCREEN( w_current, o_current->arc->x, o_current->arc->y, &w_current->start_x, &w_current->start_y );
+ WORLDtoSCREEN( toplevel, o_current->arc->x, o_current->arc->y, &w_current->start_x, &w_current->start_y );
/* radius */
- w_current->distance = SCREENabs( w_current, o_current->arc->width / 2 );
+ w_current->distance = SCREENabs( toplevel, o_current->arc->width / 2 );
/* angles */
w_current->loc_x = o_current->arc->start_angle;
w_current->loc_y = o_current->arc->end_angle;
@@ -637,8 +642,8 @@ void o_grips_start_arc(TOPLEVEL *w_current, OBJECT *o_current,
/*! \brief Initialize grip motion process for a box.
* \par Function Description
* This function initializes the grip motion process for a box. From the
- * <B>o_current</B> pointed object, it stores into the TOPLEVEL structure
- * the .... These variables are used in the grip process.
+ * <B>o_current</B> pointed object, it stores into the GSCHEM_TOPLEVEL
+ * structure the .... These variables are used in the grip process.
*
* The function first erases the grips.
*
@@ -649,15 +654,16 @@ void o_grips_start_arc(TOPLEVEL *w_current, OBJECT *o_current,
* (<B>w_current->start_x</B>,<B>w_current->start_y</B>). They are not suppose
* to change during the action.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Box OBJECT to check.
* \param [in] x (unused)
* \param [in] y (unused)
* \param [out] whichone Which coordinate to check.
*/
-void o_grips_start_box(TOPLEVEL *w_current, OBJECT *o_current,
+void o_grips_start_box(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
int x, int y, int whichone)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
w_current->last_drawb_mode = -1;
/* erase the box before */
@@ -667,27 +673,27 @@ void o_grips_start_box(TOPLEVEL *w_current, OBJECT *o_current,
/* (start_x, start_y) is the opposite corner */
switch(whichone) {
case BOX_UPPER_LEFT:
- WORLDtoSCREEN( w_current, o_current->box->upper_x, o_current->box->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->box->upper_x, o_current->box->upper_y,
&w_current->last_x, &w_current->last_y );
- WORLDtoSCREEN( w_current, o_current->box->lower_x, o_current->box->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->box->lower_x, o_current->box->lower_y,
&w_current->start_x, &w_current->start_y );
break;
case BOX_LOWER_RIGHT:
- WORLDtoSCREEN( w_current, o_current->box->lower_x, o_current->box->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->box->lower_x, o_current->box->lower_y,
&w_current->last_x, &w_current->last_y );
- WORLDtoSCREEN( w_current, o_current->box->upper_x, o_current->box->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->box->upper_x, o_current->box->upper_y,
&w_current->start_x, &w_current->start_y );
break;
case BOX_UPPER_RIGHT:
- WORLDtoSCREEN( w_current, o_current->box->lower_x, o_current->box->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->box->lower_x, o_current->box->upper_y,
&w_current->last_x, &w_current->last_y );
- WORLDtoSCREEN( w_current, o_current->box->upper_x, o_current->box->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->box->upper_x, o_current->box->lower_y,
&w_current->start_x, &w_current->start_y );
break;
case BOX_LOWER_LEFT:
- WORLDtoSCREEN( w_current, o_current->box->upper_x, o_current->box->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->box->upper_x, o_current->box->lower_y,
&w_current->last_x, &w_current->last_y );
- WORLDtoSCREEN( w_current, o_current->box->lower_x, o_current->box->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->box->lower_x, o_current->box->upper_y,
&w_current->start_x, &w_current->start_y );
break;
default:
@@ -702,8 +708,9 @@ void o_grips_start_box(TOPLEVEL *w_current, OBJECT *o_current,
/*! \brief Initialize grip motion process for a picture.
* \par Function Description
* This function initializes the grip motion process for a picture.
- * From the <B>o_current</B> pointed object, it stores into the TOPLEVEL
- * structure the .... These variables are used in the grip process.
+ * From the <B>o_current</B> pointed object, it stores into the
+ * GSCHEM_TOPLEVEL structure the ....
+ * These variables are used in the grip process.
*
* The function first erases the grips.
*
@@ -714,15 +721,16 @@ void o_grips_start_box(TOPLEVEL *w_current, OBJECT *o_current,
* (<B>w_current->start_x</B>,<B>w_current->start_y</B>). They are not
* suppose to change during the action.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Picture OBJECT to check.
* \param [in] x (unused)
* \param [in] y (unused)
* \param [out] whichone Which coordinate to check.
*/
-void o_grips_start_picture(TOPLEVEL *w_current, OBJECT *o_current,
+void o_grips_start_picture(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
int x, int y, int whichone)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
w_current->last_drawb_mode = -1;
/* erase the picture before */
@@ -735,27 +743,27 @@ void o_grips_start_picture(TOPLEVEL *w_current, OBJECT *o_current,
/* (start_x, start_y) is the opposite corner */
switch(whichone) {
case PICTURE_UPPER_LEFT:
- WORLDtoSCREEN( w_current, o_current->picture->upper_x, o_current->picture->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->upper_x, o_current->picture->upper_y,
&w_current->last_x, &w_current->last_y );
- WORLDtoSCREEN( w_current, o_current->picture->lower_x, o_current->picture->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->lower_x, o_current->picture->lower_y,
&w_current->start_x, &w_current->start_y );
break;
case PICTURE_LOWER_RIGHT:
- WORLDtoSCREEN( w_current, o_current->picture->lower_x, o_current->picture->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->lower_x, o_current->picture->lower_y,
&w_current->last_x, &w_current->last_y );
- WORLDtoSCREEN( w_current, o_current->picture->upper_x, o_current->picture->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->upper_x, o_current->picture->upper_y,
&w_current->start_x, &w_current->start_y );
break;
case PICTURE_UPPER_RIGHT:
- WORLDtoSCREEN( w_current, o_current->picture->lower_x, o_current->picture->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->lower_x, o_current->picture->upper_y,
&w_current->last_x, &w_current->last_y );
- WORLDtoSCREEN( w_current, o_current->picture->upper_x, o_current->picture->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->upper_x, o_current->picture->lower_y,
&w_current->start_x, &w_current->start_y );
break;
case PICTURE_LOWER_LEFT:
- WORLDtoSCREEN( w_current, o_current->picture->upper_x, o_current->picture->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->upper_x, o_current->picture->lower_y,
&w_current->last_x, &w_current->last_y );
- WORLDtoSCREEN( w_current, o_current->picture->lower_x, o_current->picture->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->lower_x, o_current->picture->upper_y,
&w_current->start_x, &w_current->start_y );
break;
default:
@@ -770,9 +778,9 @@ void o_grips_start_picture(TOPLEVEL *w_current, OBJECT *o_current,
/*! \brief Initialize grip motion process for a circle.
* \par Function Description
* This function initializes the grip motion process for a circle.
- * From the <B>o_current</B> pointed object, it stores into the TOPLEVEL
- * structure the coordinate of the center and the radius. These variables
- * are used in the grip process.
+ * From the <B>o_current</B> pointed object, it stores into the
+ * GSCHEM_TOPLEVEL structure the coordinate of the center and the radius.
+ * These variables are used in the grip process.
*
* The function first erases the grips.
*
@@ -783,29 +791,30 @@ void o_grips_start_picture(TOPLEVEL *w_current, OBJECT *o_current,
* The coordinates of the point on the circle to the right of the center
* go in (<B>w_current->last_x</B>,<B>w_current->last_y</B>).
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Circle OBJECT to check.
* \param [in] x (unused)
* \param [in] y (unused)
* \param [out] whichone Which coordinate to check.
*/
-void o_grips_start_circle(TOPLEVEL *w_current, OBJECT *o_current,
+void o_grips_start_circle(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
int x, int y, int whichone)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
w_current->last_drawb_mode = -1;
/* erase the circle before */
o_circle_erase(w_current, o_current);
- /* describe the circle with TOPLEVEL variables */
+ /* describe the circle with GSCHEM_TOPLEVEL variables */
/* (start_x, start_y) is the center of the circle */
- WORLDtoSCREEN( w_current, o_current->circle->center_x, o_current->circle->center_y,
+ WORLDtoSCREEN( toplevel, o_current->circle->center_x, o_current->circle->center_y,
&w_current->start_x, &w_current->start_y );
/* (last_x,last_y) is the point on circle on the right of center */
- WORLDtoSCREEN( w_current, o_current->circle->center_x + o_current->circle->radius, o_current->circle->center_y,
+ WORLDtoSCREEN( toplevel, o_current->circle->center_x + o_current->circle->radius, o_current->circle->center_y,
&w_current->last_x, &w_current->last_y );
/* distance is the radius of the circle */
- w_current->distance = SCREENabs( w_current, o_current->circle->radius );
+ w_current->distance = SCREENabs( toplevel, o_current->circle->radius );
/* draw the first temporary circle */
o_circle_rubbercircle_xor(w_current);
@@ -826,24 +835,25 @@ void o_grips_start_circle(TOPLEVEL *w_current, OBJECT *o_current,
* The line end that corresponds to the moving grip is in
* (<B>w_current->last_x</B>,<B>w_current->last_y</B>).
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Line OBJECT to check.
* \param [in] x (unused)
* \param [in] y (unused)
* \param [out] whichone Which coordinate to check.
*/
-void o_grips_start_line(TOPLEVEL *w_current, OBJECT *o_current,
+void o_grips_start_line(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
int x, int y, int whichone)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
w_current->last_drawb_mode = -1;
/* erase the line before */
o_line_erase(w_current, o_current);
- /* describe the line with TOPLEVEL variables */
- WORLDtoSCREEN( w_current, o_current->line->x[whichone], o_current->line->y[whichone],
+ /* describe the line with GSCHEM_TOPLEVEL variables */
+ WORLDtoSCREEN( toplevel, o_current->line->x[whichone], o_current->line->y[whichone],
&w_current->last_x, &w_current->last_y );
- WORLDtoSCREEN( w_current, o_current->line->x[!whichone], o_current->line->y[!whichone],
+ WORLDtoSCREEN( toplevel, o_current->line->x[!whichone], o_current->line->y[!whichone],
&w_current->start_x, &w_current->start_y );
/* draw the first temporary line */
@@ -863,22 +873,23 @@ void o_grips_start_line(TOPLEVEL *w_current, OBJECT *o_current,
* It erases the temporary object, updates its internal representation,
* and draws it again.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_grips_motion(TOPLEVEL *w_current, int x, int y)
+void o_grips_motion(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
/* no object changing */
if (object_changing == NULL) {
/* stop grip process */
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
@@ -921,8 +932,8 @@ void o_grips_motion(TOPLEVEL *w_current, int x, int y)
* \par Function Description
* This function is the refreshing part of the grip motion process.
* It is called whenever the position of the pointer is changed,
- * therefore requiring the TOPLEVEL variables to be updated.
- * Depending on the grip selected and moved, the temporary TOPLEVEL
+ * therefore requiring the GSCHEM_TOPLEVEL variables to be updated.
+ * Depending on the grip selected and moved, the temporary GSCHEM_TOPLEVEL
* variables are changed according to the current position of the pointer.
*
* If the grip at the center of the arc has been moved - modifying the
@@ -937,12 +948,12 @@ void o_grips_motion(TOPLEVEL *w_current, int x, int y)
* <B>w_current->start_y</B> are updated according to which of the grip
* has been selected.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
* \param [in] whichone Which grip to start motion with.
*/
-void o_grips_motion_arc(TOPLEVEL *w_current, int x, int y, int whichone)
+void o_grips_motion_arc(GSCHEM_TOPLEVEL *w_current, int x, int y, int whichone)
{
o_arc_rubberarc(w_current, x, y, whichone);
}
@@ -951,21 +962,21 @@ void o_grips_motion_arc(TOPLEVEL *w_current, int x, int y, int whichone)
* \par Function Description
* This function is the refreshing part of the grip motion process. It is
* called whenever the position of the pointer is changed, therefore
- * requiring the TOPLEVEL variables to be updated.
- * Depending on the grip selected and moved, the temporary TOPLEVEL
+ * requiring the GSCHEM_TOPLEVEL variables to be updated.
+ * Depending on the grip selected and moved, the temporary GSCHEM_TOPLEVEL
* variables are changed according to the current position of the pointer
* and the modifications temporary drawn.
*
* This function only makes a call to #o_box_rubberbox() that updates
- * the TOPLEVEL variables, erase the previous temporary box and draw the
- * new temporary box.
+ * the GSCHEM_TOPLEVEL variables, erase the previous temporary box and draw
+ * the new temporary box.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
* \param [in] whichone Which grip to start motion with.
*/
-void o_grips_motion_box(TOPLEVEL *w_current, int x, int y, int whichone)
+void o_grips_motion_box(GSCHEM_TOPLEVEL *w_current, int x, int y, int whichone)
{
/* erase, update and draw the temporary box */
o_box_rubberbox(w_current, x, y);
@@ -975,21 +986,21 @@ void o_grips_motion_box(TOPLEVEL *w_current, int x, int y, int whichone)
* \par Function Description
* This function is the refreshing part of the grip motion process. It is
* called whenever the position of the pointer is changed, therefore
- * requiring the TOPLEVEL variables to be updated.
- * Depending on the grip selected and moved, the temporary TOPLEVEL
+ * requiring the GSCHEM_TOPLEVEL variables to be updated.
+ * Depending on the grip selected and moved, the temporary GSCHEM_TOPLEVEL
* variables are changed according to the current position of the pointer
* and the modifications temporary drawn.
*
* This function only makes a call to #o_picture_rubberbox() that
- * updates the TOPLEVEL variables, erase the previous temporary picture
- * and draw the new temporary picture.
+ * updates the GSCHEM_TOPLEVEL variables, erase the previous temporary
+ * picture and draw the new temporary picture.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
* \param [in] whichone Which grip to start motion with.
*/
-void o_grips_motion_picture(TOPLEVEL *w_current, int x, int y, int whichone)
+void o_grips_motion_picture(GSCHEM_TOPLEVEL *w_current, int x, int y, int whichone)
{
/* erase, update and draw the temporary picture */
o_picture_rubberbox(w_current, x, y);
@@ -999,21 +1010,21 @@ void o_grips_motion_picture(TOPLEVEL *w_current, int x, int y, int whichone)
* \par Function Description
* This function is the refreshing part of the grip motion process. It is
* called whenever the position of the pointer is changed, therefore
- * requiring the TOPLEVEL variables to be updated.
- * Depending on the grip selected and moved, the temporary TOPLEVEL
+ * requiring the GSCHEM_TOPLEVEL variables to be updated.
+ * Depending on the grip selected and moved, the temporary GSCHEM_TOPLEVEL
* variables are changed according to the current position of the pointer
* and the modifications temporary drawn.
*
* This function only makes a call to #o_circle_rubbercircle() that updates
- * the TOPLEVEL variables, erase the previous temporary circle and draw
- * the new temporary circle.
+ * the GSCHEM_TOPLEVEL variables, erase the previous temporary circle and
+ * draw the new temporary circle.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
* \param [in] whichone Which grip to start motion with.
*/
-void o_grips_motion_circle(TOPLEVEL *w_current, int x, int y, int whichone)
+void o_grips_motion_circle(GSCHEM_TOPLEVEL *w_current, int x, int y, int whichone)
{
/* erase, update and draw the temporary circle */
o_circle_rubbercircle(w_current, x, y);
@@ -1025,12 +1036,12 @@ void o_grips_motion_circle(TOPLEVEL *w_current, int x, int y, int whichone)
* temporary line drawn under the mouse pointer.
* The current position of the mouse is in <B>x</B> and <B>y</B> in screen coords.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
* \param [in] whichone Which grip to start motion with.
*/
-void o_grips_motion_line(TOPLEVEL *w_current, int x, int y, int whichone)
+void o_grips_motion_line(GSCHEM_TOPLEVEL *w_current, int x, int y, int whichone)
{
/* erase, update and draw the temporary line */
o_line_rubberline(w_current, x, y);
@@ -1050,10 +1061,11 @@ void o_grips_motion_line(TOPLEVEL *w_current, int x, int y, int whichone)
* the temporary object, updates the object and draws the modified object
* normally.
*
- * \param [in,out] w_current The TOPLEVEL object.
+ * \param [in,out] w_current The GSCHEM_TOPLEVEL object.
*/
-void o_grips_end(TOPLEVEL *w_current)
+void o_grips_end(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *object=NULL;
int x, y;
GList *other_objects = NULL;
@@ -1113,12 +1125,12 @@ void o_grips_end(TOPLEVEL *w_current)
return;
}
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->last_x,
w_current->last_y, &x, &y);
- x = snap_grid(w_current, x);
- y = snap_grid(w_current, y);
+ x = snap_grid(toplevel, x);
+ y = snap_grid(toplevel, y);
o_cue_undraw(w_current, object);
o_net_erase(w_current, object);
@@ -1131,11 +1143,11 @@ void o_grips_end(TOPLEVEL *w_current)
o_line_erase_grips(w_current, object);
other_objects = s_conn_return_others(other_objects, object);
- s_conn_remove(w_current, object);
+ s_conn_remove(toplevel, object);
- o_net_modify(w_current, object, x, y, whichone_changing);
+ o_net_modify(toplevel, object, x, y, whichone_changing);
- s_conn_update_object(w_current, object);
+ s_conn_update_object(toplevel, object);
/* get the other connected objects and redraw them */
connected_objects = s_conn_return_others(connected_objects,
@@ -1147,8 +1159,8 @@ void o_grips_end(TOPLEVEL *w_current)
o_net_erase(w_current, object);
/*o_line_erase_grips(w_current, object); */
- if (w_current->net_style == THICK ) {
- size = SCREENabs(w_current, 10);
+ if (toplevel->net_style == THICK ) {
+ size = SCREENabs(toplevel, 10);
if (size < 0)
size=0;
@@ -1160,7 +1172,7 @@ void o_grips_end(TOPLEVEL *w_current)
}
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->background_color));
+ x_get_color(toplevel->background_color));
gdk_draw_line(w_current->window, w_current->gc,
w_current->start_x, w_current->start_y,
w_current->last_x, w_current->last_y);
@@ -1169,7 +1181,7 @@ void o_grips_end(TOPLEVEL *w_current)
o_net_draw(w_current, object);
o_cue_draw_single(w_current, object);
- if (w_current->net_style == THICK ) {
+ if (toplevel->net_style == THICK ) {
gdk_gc_set_line_attributes(w_current->gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -1215,12 +1227,12 @@ void o_grips_end(TOPLEVEL *w_current)
return;
}
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->last_x,
w_current->last_y, &x, &y);
- x = snap_grid(w_current, x);
- y = snap_grid(w_current, y);
+ x = snap_grid(toplevel, x);
+ y = snap_grid(toplevel, y);
o_cue_undraw(w_current, object);
o_pin_erase(w_current, object);
@@ -1233,11 +1245,11 @@ void o_grips_end(TOPLEVEL *w_current)
o_line_erase_grips(w_current, object);
other_objects = s_conn_return_others(other_objects, object);
- s_conn_remove(w_current, object);
+ s_conn_remove(toplevel, object);
- o_pin_modify(w_current, object, x, y,
+ o_pin_modify(toplevel, object, x, y,
whichone_changing);
- s_conn_update_object(w_current, object);
+ s_conn_update_object(toplevel, object);
o_redraw_single(w_current, object);
/* draw the object objects */
@@ -1271,12 +1283,12 @@ void o_grips_end(TOPLEVEL *w_current)
return;
}
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->last_x,
w_current->last_y, &x, &y);
- x = snap_grid(w_current, x);
- y = snap_grid(w_current, y);
+ x = snap_grid(toplevel, x);
+ y = snap_grid(toplevel, y);
o_cue_undraw(w_current, object);
o_bus_erase(w_current, object);
@@ -1289,11 +1301,11 @@ void o_grips_end(TOPLEVEL *w_current)
o_line_erase_grips(w_current, object);
other_objects = s_conn_return_others(other_objects, object);
- s_conn_remove(w_current, object);
+ s_conn_remove(toplevel, object);
- o_bus_modify(w_current, object, x, y,
+ o_bus_modify(toplevel, object, x, y,
whichone_changing);
- s_conn_update_object(w_current, object);
+ s_conn_update_object(toplevel, object);
o_redraw_single(w_current, object);
/* draw the object objects */
@@ -1314,7 +1326,7 @@ void o_grips_end(TOPLEVEL *w_current)
return;
}
- w_current->page_current->CHANGED=1;
+ toplevel->page_current->CHANGED=1;
g_list_free(other_objects);
other_objects = NULL;
@@ -1344,12 +1356,13 @@ void o_grips_end(TOPLEVEL *w_current)
* angles describing the arc -, this angle is updated with the
* #o_arc_modify() function.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Arc OBJECT to end modification on.
* \param [in] whichone Which grip is pointed to.
*/
-void o_grips_end_arc(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
+void o_grips_end_arc(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int whichone)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int arg1, arg2;
/* erase the temporary arc */
@@ -1359,7 +1372,7 @@ void o_grips_end_arc(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
switch(whichone) {
case ARC_RADIUS:
/* convert the radius in world coords */
- arg1 = WORLDabs(w_current, w_current->distance);
+ arg1 = WORLDabs(toplevel, w_current->distance);
/* second parameter is not used */
arg2 = -1;
break;
@@ -1383,7 +1396,7 @@ void o_grips_end_arc(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
}
/* modify the arc with the parameters determined above */
- o_arc_modify(w_current, o_current, arg1, arg2, whichone);
+ o_arc_modify(toplevel, o_current, arg1, arg2, whichone);
/* display the new arc */
o_redraw_single(w_current, o_current);
@@ -1394,12 +1407,13 @@ void o_grips_end_arc(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
* \brief End process of modifying box object with grip.
* \par Function Description
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Box OBJECT to end modification on.
* \param [in] whichone Which grip is pointed to.
*/
-void o_grips_end_box(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
+void o_grips_end_box(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int whichone)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int box_width, box_height;
int x, y;
@@ -1424,13 +1438,13 @@ void o_grips_end_box(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
return;
}
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->last_x, w_current->last_y,
&x, &y);
- x = snap_grid(w_current, x);
- y = snap_grid(w_current, y);
+ x = snap_grid(toplevel, x);
+ y = snap_grid(toplevel, y);
- o_box_modify(w_current, o_current, x, y, whichone);
+ o_box_modify(toplevel, o_current, x, y, whichone);
/* erase the temporary box */
o_box_rubberbox_xor(w_current);
@@ -1443,12 +1457,13 @@ void o_grips_end_box(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
* \brief End process of modifying picture object with grip.
* \par Function Description
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Picture OBJECT to end modification on.
* \param [in] whichone Which grip is pointed to.
*/
-void o_grips_end_picture(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
+void o_grips_end_picture(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int whichone)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int picture_width, picture_height;
int x, y;
@@ -1473,13 +1488,13 @@ void o_grips_end_picture(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
return;
}
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->last_x, w_current->last_y,
&x, &y);
- x = snap_grid(w_current, x);
- y = snap_grid(w_current, y);
+ x = snap_grid(toplevel, x);
+ y = snap_grid(toplevel, y);
- o_picture_modify(w_current, o_current, x, y, whichone);
+ o_picture_modify(toplevel, o_current, x, y, whichone);
/* erase the temporary picture */
o_picture_rubberbox_xor(w_current);
@@ -1503,12 +1518,13 @@ void o_grips_end_picture(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
*
* The last value of the radius is in <B>w_current->distance</B> in screen units.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Circle OBJECT to end modification on.
* \param [in] whichone Which grip is pointed to.
*/
-void o_grips_end_circle(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
+void o_grips_end_circle(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int whichone)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int radius;
/* erase the temporary circle */
@@ -1534,10 +1550,10 @@ void o_grips_end_circle(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
}
/* convert the radius in world unit */
- radius = WORLDabs(w_current, w_current->distance);
+ radius = WORLDabs(toplevel, w_current->distance);
/* modify the radius of the circle */
- o_circle_modify(w_current, o_current, radius, -1, CIRCLE_RADIUS);
+ o_circle_modify(toplevel, o_current, radius, -1, CIRCLE_RADIUS);
/* display the new circle */
o_redraw_single(w_current, o_current);
@@ -1555,12 +1571,13 @@ void o_grips_end_circle(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
* A line with a null width, i.e. when both ends are identical, is not
* allowed. In this case, the process is stopped and the line unchanged.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Circle OBJECT to end modification on.
* \param [in] whichone Which grip is pointed to.
*/
-void o_grips_end_line(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
+void o_grips_end_line(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int whichone)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x, y;
/* erase the temporary line */
@@ -1586,14 +1603,14 @@ void o_grips_end_line(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
}
/* convert the line end coords in world unit */
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->last_x, w_current->last_y,
&x, &y);
- x = snap_grid(w_current, x);
- y = snap_grid(w_current, y);
+ x = snap_grid(toplevel, x);
+ y = snap_grid(toplevel, y);
/* modify the right line end according to whichone */
- o_line_modify(w_current, o_current, x, y, whichone);
+ o_line_modify(toplevel, o_current, x, y, whichone);
/* display the new line */
o_redraw_single(w_current, o_current);
@@ -1608,23 +1625,24 @@ void o_grips_end_line(TOPLEVEL *w_current, OBJECT *o_current, int whichone)
* in libgeda #defines.h. They are the half width/height of a grip in
* world unit for a determined range of zoom factors.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \return Half grip size in screen units.
*/
-int o_grips_size(TOPLEVEL *w_current)
+int o_grips_size(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int factor, size;
- factor = (int) w_current->page_current->to_world_x_constant;
+ factor = (int) toplevel->page_current->to_world_x_constant;
if (factor > SMALL_ZOOMFACTOR1) {
/* big zoom factor : small size converted to screen unit */
- size = SCREENabs(w_current, GRIP_SIZE1);
+ size = SCREENabs(toplevel, GRIP_SIZE1);
} else if (factor > SMALL_ZOOMFACTOR2) {
/* medium zoom factor : medium size converted to screen unit */
- size = SCREENabs(w_current, GRIP_SIZE2);
+ size = SCREENabs(toplevel, GRIP_SIZE2);
} else {
/* small zoom factor : big size converted to screen unit */
- size = SCREENabs(w_current, GRIP_SIZE3);
+ size = SCREENabs(toplevel, GRIP_SIZE3);
}
return size;
@@ -1634,18 +1652,19 @@ int o_grips_size(TOPLEVEL *w_current)
* \par Function Description
* This function draws a grip centered at (<B>x</B>,<B>y</B>). Its color is
* either the selection color or the overriding color from
- * <B>w_current->override_color</B>.
+ * <B>toplevel->override_color</B>.
*
* The size of the grip depends on the current zoom factor.
*
* <B>x</B> and <B>y</B> are in screen unit.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Center x screen coordinate for drawing grip.
* \param [in] y Center y screen coordinate for drawing grip.
*/
-void o_grips_draw(TOPLEVEL *w_current, int x, int y)
+void o_grips_draw(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GdkColor *color;
int size, x2size;
@@ -1660,15 +1679,15 @@ void o_grips_draw(TOPLEVEL *w_current, int x, int y)
x2size = 2 * size;
/*
- * The grip can be displayed or erased : if <B>w_current->override_color</B>
+ * The grip can be displayed or erased : if <B>toplevel->override_color</B>
* is not set the grip is drawn with the selection color ; if
- * <B>w_current->override_color</B> is set then the color it refers it
+ * <B>toplevel->override_color</B> is set then the color it refers it
* is used. This way the grip can be erased if this color is the
* background color.
*/
- if (w_current->override_color != -1 ) {
+ if (toplevel->override_color != -1 ) {
/* override : use the override_color instead */
- color = x_get_color(w_current->override_color);
+ color = x_get_color(toplevel->override_color);
} else {
/* use the normal selection color */
color = x_get_color(w_current->select_color);
@@ -1684,7 +1703,7 @@ void o_grips_draw(TOPLEVEL *w_current, int x, int y)
* A grip is a hollow square centered at (<B>x</B>,<B>y</B>) with a
* width/height of <B>x2size</B>.
*/
- if (w_current->DONT_REDRAW == 0) {
+ if (toplevel->DONT_REDRAW == 0) {
/* draw the grip in window */
gdk_draw_rectangle(w_current->window, w_current->gc, FALSE,
x - size, y - size, x2size, x2size);
@@ -1702,16 +1721,17 @@ void o_grips_draw(TOPLEVEL *w_current, int x, int y)
* The grip is erased by drawing with the background color over the
* visible grip.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Center x screen coordinate for drawing grip.
* \param [in] y Center y screen coordinate for drawing grip.
*/
-void o_grips_erase(TOPLEVEL *w_current, int x, int y)
+void o_grips_erase(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
/* set overriding color */
- w_current->override_color = w_current->background_color;
+ toplevel->override_color = toplevel->background_color;
/* draw a grip with backgound color : erase grip */
o_grips_draw(w_current, x, y);
/* return to default */
- w_current->override_color = -1;
+ toplevel->override_color = -1;
}
diff --git a/gschem/src/o_line.c b/gschem/src/o_line.c
index bb549ba..3cda8e9 100644
--- a/gschem/src/o_line.c
+++ b/gschem/src/o_line.c
@@ -24,6 +24,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -40,17 +41,18 @@ typedef void (*DRAW_FUNC)( GdkDrawable *w, GdkGC *gc, GdkColor *color,
* \par Function Description
* This function is used to draw a line on screen. The line is described
* in the object which is referred by <B>o_current</B>. The line is displayed
- * according to the current state, described in the TOPLEVEL object pointed
+ * according to the current state, described in the GSCHEM_TOPLEVEL object pointed
* by <B>w_current</B>.
*
* It first checks if the object is valid or not. If not it returns and do
* not output anything. That should never happen though.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current The line OBJECT to draw.
*/
-void o_line_draw(TOPLEVEL *w_current, OBJECT *o_current)
+void o_line_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x1, y1, x2, y2;
int line_width, length, space;
GdkColor *color;
@@ -61,8 +63,8 @@ void o_line_draw(TOPLEVEL *w_current, OBJECT *o_current)
return;
}
- if ( (w_current->DONT_REDRAW == 1) ||
- (!o_line_visible(w_current, o_current->line, &x1, &y1, &x2, &y2)) ) {
+ if ( (toplevel->DONT_REDRAW == 1) ||
+ (!o_line_visible(toplevel, o_current->line, &x1, &y1, &x2, &y2)) ) {
return;
}
@@ -96,12 +98,12 @@ void o_line_draw(TOPLEVEL *w_current, OBJECT *o_current)
*
* Finally the function takes care of the grips.
*/
- if (w_current->override_color != -1 )
- color = x_get_color(w_current->override_color);
+ if (toplevel->override_color != -1 )
+ color = x_get_color(toplevel->override_color);
else
color = x_get_color(o_current->color);
- line_width = SCREENabs( w_current, o_current->line_width );
+ line_width = SCREENabs( toplevel, o_current->line_width );
if( line_width <= 0) {
line_width = 1;
}
@@ -116,8 +118,8 @@ void o_line_draw(TOPLEVEL *w_current, OBJECT *o_current)
break;
}
- length = SCREENabs( w_current, o_current->line_length );
- space = SCREENabs( w_current, o_current->line_space );
+ length = SCREENabs( toplevel, o_current->line_length );
+ space = SCREENabs( toplevel, o_current->line_space );
switch(o_current->line_type) {
case TYPE_SOLID:
@@ -733,14 +735,15 @@ void o_line_draw_phantom(GdkWindow *w, GdkGC *gc, GdkColor *color,
*
* It draws the line over the sheet with the background color.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_ TOPLEVEL object.
* \param [in] o_current Line OBJECT to erase.
*/
-void o_line_erase(TOPLEVEL *w_current, OBJECT *o_current)
+void o_line_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
- w_current->override_color = w_current->background_color;
+ TOPLEVEL *toplevel = w_current->toplevel;
+ toplevel->override_color = toplevel->background_color;
o_line_draw(w_current, o_current);
- w_current->override_color = -1;
+ toplevel->override_color = -1;
}
/*! \todo Finish function documentation
@@ -750,10 +753,11 @@ void o_line_erase(TOPLEVEL *w_current, OBJECT *o_current)
* \note
* used in button cancel code in x_events.c
*/
-void o_line_eraserubber(TOPLEVEL *w_current)
+void o_line_eraserubber(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->background_color) );
+ x_get_color(toplevel->background_color) );
gdk_draw_line(w_current->window, w_current->gc, w_current->start_x,
w_current->start_y, w_current->last_x, w_current->last_y);
}
@@ -765,13 +769,14 @@ void o_line_eraserubber(TOPLEVEL *w_current)
* <B>dx</B> and <B>dy</B> in screen unit. It uses and XOR function to draw the
* translated line over the current sheet.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] dx Delta x coordinate for line.
* \param [in] dy Delta y coordinate for line.
* \param [in] o_current Line OBJECT to draw.
*/
-void o_line_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
+void o_line_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int color;
int sx[2], sy[2];
@@ -789,8 +794,8 @@ void o_line_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
gdk_gc_set_foreground(w_current->outline_xor_gc,
x_get_darkcolor(color));
- WORLDtoSCREEN( w_current, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
- WORLDtoSCREEN( w_current, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
gdk_draw_line(w_current->window, w_current->outline_xor_gc,
sx[0]+dx, sy[0]+dy,
@@ -811,11 +816,12 @@ void o_line_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
* A temporary line is xor-drawn during the process with the selection color
* and changed according to the position of the mouse pointer.
*/
-void o_line_start(TOPLEVEL *w_current, int x, int y)
+void o_line_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
/* init start_[x|y], last_[x|y] to describe line */
- w_current->last_x = w_current->start_x = fix_x(w_current, x);
- w_current->last_y = w_current->start_y = fix_y(w_current, y);
+ w_current->last_x = w_current->start_x = fix_x(toplevel, x);
+ w_current->last_y = w_current->start_y = fix_y(toplevel, y);
/* draw init xor */
o_line_rubberline_xor(w_current);
@@ -831,24 +837,25 @@ void o_line_start(TOPLEVEL *w_current, int x, int y)
* adds a new initialized line object to the list of object of the current
* sheet.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_line_end(TOPLEVEL *w_current, int x, int y)
+void o_line_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x1, y1;
int x2, y2;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
/* Use last_x and _y from the last time you moved the mouse from the
rubber function, so in otherwords... comment these out...
- w_current->last_x = fix_x(w_current, x);
- w_current->last_y = fix_y(w_current, y);
+ w_current->last_x = fix_x(toplevel, x);
+ w_current->last_y = fix_y(toplevel, y);
*/
/* erase xor image */
@@ -865,33 +872,33 @@ void o_line_end(TOPLEVEL *w_current, int x, int y)
}
/* calculate the world coords of the two ends of the line */
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->start_x, w_current->start_y,
&x1, &y1);
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->last_x, w_current->last_y,
&x2, &y2);
- x1 = snap_grid(w_current, x1);
- y1 = snap_grid(w_current, y1);
- x2 = snap_grid(w_current, x2);
- y2 = snap_grid(w_current, y2);
+ x1 = snap_grid(toplevel, x1);
+ y1 = snap_grid(toplevel, y1);
+ x2 = snap_grid(toplevel, x2);
+ y2 = snap_grid(toplevel, y2);
/* create the object */
/* PB : modification in o_line_add() prototype */
- w_current->page_current->object_tail =
- o_line_add(w_current,
- w_current->page_current->object_tail,
+ toplevel->page_current->object_tail =
+ o_line_add(toplevel,
+ toplevel->page_current->object_tail,
OBJ_LINE, w_current->graphic_color, x1, y1, x2, y2);
/* draw it */
- o_redraw_single(w_current, w_current->page_current->object_tail);
+ o_redraw_single(w_current, toplevel->page_current->object_tail);
w_current->start_x = (-1);
w_current->start_y = (-1);
w_current->last_x = (-1);
w_current->last_y = (-1);
- w_current->page_current->CHANGED=1;
+ toplevel->page_current->CHANGED=1;
o_undo_savestate(w_current, UNDO_ALL);
}
@@ -905,16 +912,17 @@ void o_line_end(TOPLEVEL *w_current, int x, int y)
* (<B>last_x</B>,<B>last_y</B>).
* The first end is constant. The second end is updated to the (<B>x</B>,<B>y</B>).
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_line_rubberline(TOPLEVEL *w_current, int x, int y)
+void o_line_rubberline(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int diff_x, diff_y;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
@@ -936,8 +944,8 @@ void o_line_rubberline(TOPLEVEL *w_current, int x, int y)
* being snapped to grid.
*/
/* update the coordinate of the modified end */
- w_current->last_x = fix_x(w_current, x);
- w_current->last_y = fix_y(w_current, y);
+ w_current->last_x = fix_x(toplevel, x);
+ w_current->last_y = fix_y(toplevel, y);
/* if the control key was pressed then draw ortho lines */
if (w_current->CONTROLKEY) {
@@ -960,16 +968,16 @@ void o_line_rubberline(TOPLEVEL *w_current, int x, int y)
o_line_rubberline_xor(w_current);
}
-/*! \brief Draw line from TOPLEVEL object.
+/*! \brief Draw line from GSCHEM_TOPLEVEL object.
* \par Function Description
* This function draws a line with an exclusive or function over the sheet.
* The color of the box is <B>w_current->select_color</B>. The line is
* described by the two points (<B>w_current->start_x</B>,
* <B>w_current->start_y</B>) and (<B>w_current->last_x</B>,<B>w_current->last_y</B>).
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
*/
-void o_line_rubberline_xor(TOPLEVEL *w_current)
+void o_line_rubberline_xor(GSCHEM_TOPLEVEL *w_current)
{
/* draw the circle from the w_current variables */
/* with xor-function */
@@ -989,18 +997,19 @@ void o_line_rubberline_xor(TOPLEVEL *w_current)
*
* A line has a grip at each end.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Line OBJECT to draw grip points on.
*/
-void o_line_draw_grips(TOPLEVEL *w_current, OBJECT *o_current)
+void o_line_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x[2], y[2];
if (w_current->draw_grips == FALSE)
return;
- WORLDtoSCREEN( w_current, o_current->line->x[0], o_current->line->y[0], &x[0], &y[0] );
- WORLDtoSCREEN( w_current, o_current->line->x[1], o_current->line->y[1], &x[1], &y[1] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[0], o_current->line->y[0], &x[0], &y[0] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[1], o_current->line->y[1], &x[1], &y[1] );
/* draw the grip on line end 1 */
o_grips_draw(w_current, x[LINE_END1], y[LINE_END1]);
@@ -1015,18 +1024,19 @@ void o_line_draw_grips(TOPLEVEL *w_current, OBJECT *o_current)
*
* A line has a grip at each end.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Line OBJECT to erase grip marks from.
*/
-void o_line_erase_grips(TOPLEVEL *w_current, OBJECT *o_current)
+void o_line_erase_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x[2], y[2];
if (w_current->draw_grips == FALSE)
return;
- WORLDtoSCREEN( w_current, o_current->line->x[0], o_current->line->y[0], &x[0], &y[0] );
- WORLDtoSCREEN( w_current, o_current->line->x[1], o_current->line->y[1], &x[1], &y[1] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[0], o_current->line->y[0], &x[0], &y[0] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[1], o_current->line->y[1], &x[1], &y[1] );
/* erase the grip on line end 1 */
o_grips_erase(w_current, x[LINE_END1], y[LINE_END1]);
diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index 48b28a4..80c134b 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -32,6 +32,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -48,7 +49,7 @@
* \par Function Description
*
*/
-void o_edit(TOPLEVEL *w_current, GList *list)
+void o_edit(GSCHEM_TOPLEVEL *w_current, GList *list)
{
char *equal_ptr;
OBJECT *o_current;
@@ -123,13 +124,13 @@ void o_edit(TOPLEVEL *w_current, GList *list)
/* This locks the entire selected list. It does lock components, but does NOT
* change the color (of primatives of the components) though
* this cannot be called recursively */
-void o_lock(TOPLEVEL *w_current)
+void o_lock(GSCHEM_TOPLEVEL *w_current)
{
OBJECT *object = NULL;
GList *s_current = NULL;
/* skip over head */
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( w_current->toplevel->page_current->selection_list );
while(s_current != NULL) {
object = (OBJECT *) s_current->data;
@@ -139,7 +140,7 @@ void o_lock(TOPLEVEL *w_current)
object->sel_func = NULL;
object->locked_color = object->color;
object->color = w_current->lock_color;
- w_current->page_current->CHANGED=1;
+ w_current->toplevel->page_current->CHANGED=1;
} else {
s_log_message(_("Object already locked\n"));
}
@@ -162,12 +163,12 @@ void o_lock(TOPLEVEL *w_current)
/* this will probably change in the future, but for now it's a
something.. :-) */
/* this cannot be called recursively */
-void o_unlock(TOPLEVEL *w_current)
+void o_unlock(GSCHEM_TOPLEVEL *w_current)
{
OBJECT *object = NULL;
GList *s_current = NULL;
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( w_current->toplevel->page_current->selection_list );
while(s_current != NULL) {
object = (OBJECT *) s_current->data;
@@ -177,7 +178,7 @@ void o_unlock(TOPLEVEL *w_current)
object->sel_func = select_func;
object->color = object->locked_color;
object->locked_color = -1;
- w_current->page_current->CHANGED = 1;
+ w_current->toplevel->page_current->CHANGED = 1;
} else {
s_log_message(_("Object already unlocked\n"));
}
@@ -198,14 +199,15 @@ void o_unlock(TOPLEVEL *w_current)
* There is a second pass to run the rotate hooks of non-simple objects,
* like pin or complex objects, for example.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] list The list of objects to rotate.
* \param [in] centerx Center x coordinate of rotation.
* \param [in] centery Center y coordinate of rotation.
*/
-void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
+void o_rotate_90_world(GSCHEM_TOPLEVEL *w_current, GList *list,
int centerx, int centery)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *object;
GList *s_current;
GList *other_objects=NULL;
@@ -238,7 +240,7 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
case(OBJ_NET):
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_cue_undraw(w_current, object);
o_net_erase(w_current, object);
o_line_erase_grips(w_current, object);
@@ -246,11 +248,11 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
/* save the other objects */
other_objects = s_conn_return_others(other_objects, object);
- s_conn_remove(w_current, object);
+ s_conn_remove(toplevel, object);
- o_net_rotate_world(w_current, centerx, centery, 90, object);
- s_conn_update_object(w_current, object);
- if (!w_current->DONT_REDRAW) {
+ o_net_rotate_world(toplevel, centerx, centery, 90, object);
+ s_conn_update_object(toplevel, object);
+ if (!toplevel->DONT_REDRAW) {
o_net_draw(w_current, object);
/* draw the other objects */
@@ -260,7 +262,7 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
/* get other connected objects and redraw */
connected_objects = s_conn_return_others(connected_objects, object);
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_cue_undraw_list(w_current, connected_objects);
o_cue_draw_list(w_current, connected_objects);
@@ -270,18 +272,18 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
break;
case(OBJ_BUS):
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_cue_undraw(w_current, object);
o_bus_erase(w_current, object);
o_line_erase_grips(w_current, object);
}
other_objects = s_conn_return_others(other_objects, object);
- s_conn_remove(w_current, object);
+ s_conn_remove(toplevel, object);
- o_bus_rotate_world(w_current, centerx, centery, 90, object);
- s_conn_update_object(w_current, object);
- if (!w_current->DONT_REDRAW) {
+ o_bus_rotate_world(toplevel, centerx, centery, 90, object);
+ s_conn_update_object(toplevel, object);
+ if (!toplevel->DONT_REDRAW) {
o_bus_draw(w_current, object);
/* draw the other objects */
@@ -291,7 +293,7 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
/* get other connected objects and redraw */
connected_objects = s_conn_return_others(connected_objects, object);
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_cue_undraw_list(w_current, connected_objects);
o_cue_draw_list(w_current, connected_objects);
@@ -301,18 +303,18 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
break;
case(OBJ_PIN):
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_cue_undraw(w_current, object);
o_pin_erase(w_current, object);
o_line_erase_grips(w_current, object);
}
other_objects = s_conn_return_others(other_objects, object);
- s_conn_remove(w_current, object);
+ s_conn_remove(toplevel, object);
- o_pin_rotate_world(w_current, centerx, centery, 90, object);
- s_conn_update_object(w_current, object);
- if (!w_current->DONT_REDRAW) {
+ o_pin_rotate_world(toplevel, centerx, centery, 90, object);
+ s_conn_update_object(toplevel, object);
+ if (!toplevel->DONT_REDRAW) {
o_pin_draw(w_current, object);
/* draw the other objects */
@@ -322,7 +324,7 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
/* get other connected objects and redraw */
connected_objects = s_conn_return_others(connected_objects, object);
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_cue_undraw_list(w_current, connected_objects);
o_cue_draw_list(w_current, connected_objects);
@@ -332,7 +334,7 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
break;
case(OBJ_COMPLEX):
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_cue_undraw_objects(w_current, object->complex->prim_objs);
/* erase the current selection */
o_complex_erase(w_current, object);
@@ -343,16 +345,16 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
/* remove all conn references */
o_current = object->complex->prim_objs;
while(o_current != NULL) {
- s_conn_remove(w_current, o_current);
+ s_conn_remove(toplevel, o_current);
o_current = o_current->next;
}
/* do the rotate */
- /*w_current->ADDING_SEL=1; NEWSEL: needed? */
- o_complex_rotate_world(w_current, centerx, centery, 90, object);
- /*w_current->ADDING_SEL = 0; NEWSEL: needed? */
- s_conn_update_complex(w_current, object->complex->prim_objs);
- if (!w_current->DONT_REDRAW) {
+ /*toplevel->ADDING_SEL=1; NEWSEL: needed? */
+ o_complex_rotate_world(toplevel, centerx, centery, 90, object);
+ /*toplevel->ADDING_SEL = 0; NEWSEL: needed? */
+ s_conn_update_complex(toplevel, object->complex->prim_objs);
+ if (!toplevel->DONT_REDRAW) {
o_complex_draw(w_current, object);
o_cue_undraw_list(w_current, other_objects);
@@ -362,37 +364,37 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
/* now draw the newly connected objects */
connected_objects = s_conn_return_complex_others(connected_objects,
object);
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_cue_undraw_list(w_current, connected_objects);
o_cue_draw_list(w_current, connected_objects);
}
break;
case(OBJ_LINE):
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_line_erase_grips(w_current, object);
o_line_erase(w_current, object);
}
- o_line_rotate_world(w_current, centerx, centery,
+ o_line_rotate_world(toplevel, centerx, centery,
90, object);
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_line_draw(w_current, object);
}
break;
case(OBJ_BOX):
/* erase the current selection */
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_box_erase_grips(w_current, object);
o_box_erase(w_current, object);
}
- o_box_rotate_world(w_current, centerx, centery,
+ o_box_rotate_world(toplevel, centerx, centery,
90, object);
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_box_draw(w_current, object);
}
break;
@@ -400,53 +402,53 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
case(OBJ_PICTURE):
/* erase the current selection */
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_picture_erase_grips(w_current, object);
o_picture_erase(w_current, object);
}
- o_picture_rotate_world(w_current, centerx, centery,
+ o_picture_rotate_world(toplevel, centerx, centery,
90, object);
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_picture_draw(w_current, object);
}
break;
case(OBJ_CIRCLE):
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_circle_erase_grips(w_current, object);
o_circle_erase(w_current, object);
}
- o_circle_rotate_world(w_current, centerx, centery,
+ o_circle_rotate_world(toplevel, centerx, centery,
90, object);
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_circle_draw(w_current, object);
}
break;
case(OBJ_ARC):
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_arc_erase(w_current, object);
}
- o_arc_rotate_world(w_current, centerx, centery, 90, object);
- if (!w_current->DONT_REDRAW) {
+ o_arc_rotate_world(toplevel, centerx, centery, 90, object);
+ if (!toplevel->DONT_REDRAW) {
o_arc_draw(w_current, object);
}
break;
case(OBJ_TEXT):
/* erase the current selection */
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_text_erase(w_current, object);
}
- o_text_rotate_world(w_current, centerx, centery, 90, object);
+ o_text_rotate_world(toplevel, centerx, centery, 90, object);
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_text_draw(w_current, object);
}
break;
@@ -473,7 +475,7 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
if (scm_hook_empty_p(rotate_pin_hook) == SCM_BOOL_F &&
object != NULL) {
scm_run_hook(rotate_pin_hook,
- scm_cons(g_make_object_smob(w_current, object),
+ scm_cons(g_make_object_smob(toplevel, object),
SCM_EOL));
}
break;
@@ -483,7 +485,7 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
if (scm_hook_empty_p(rotate_component_object_hook) == SCM_BOOL_F &&
object != NULL) {
scm_run_hook(rotate_component_object_hook,
- scm_cons(g_make_object_smob(w_current, object),
+ scm_cons(g_make_object_smob(toplevel, object),
SCM_EOL));
}
break;
@@ -496,7 +498,7 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
/* Don't save the undo state if we are inside an action */
/* This is useful when rotating the selection while moving, for example */
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
if (!w_current->inside_action) {
o_undo_savestate(w_current, UNDO_ALL);
}
@@ -508,8 +510,9 @@ void o_rotate_90_world(TOPLEVEL *w_current, GList *list,
* \par Function Description
*
*/
-void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
+void o_mirror_world(GSCHEM_TOPLEVEL *w_current, GList *list, int centerx, int centery)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *object;
GList *s_current;
OBJECT *o_current = NULL;
@@ -547,10 +550,10 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
o_line_erase_grips(w_current, object);
other_objects = s_conn_return_others(other_objects, object);
- s_conn_remove(w_current, object);
+ s_conn_remove(toplevel, object);
- o_net_mirror_world(w_current, centerx, centery, object);
- s_conn_update_object(w_current, object);
+ o_net_mirror_world(toplevel, centerx, centery, object);
+ s_conn_update_object(toplevel, object);
o_net_draw(w_current, object);
/* draw the other objects */
@@ -572,10 +575,10 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
o_line_erase_grips(w_current, object);
other_objects = s_conn_return_others(other_objects, object);
- s_conn_remove(w_current, object);
+ s_conn_remove(toplevel, object);
- o_pin_mirror_world(w_current, centerx, centery, object);
- s_conn_update_object(w_current, object);
+ o_pin_mirror_world(toplevel, centerx, centery, object);
+ s_conn_update_object(toplevel, object);
o_pin_draw(w_current, object);
/* draw the other objects */
@@ -596,10 +599,10 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
o_line_erase_grips(w_current, object);
other_objects = s_conn_return_others(other_objects, object);
- s_conn_remove(w_current, object);
+ s_conn_remove(toplevel, object);
- o_bus_mirror_world(w_current, centerx, centery, object);
- s_conn_update_object(w_current, object);
+ o_bus_mirror_world(toplevel, centerx, centery, object);
+ s_conn_update_object(toplevel, object);
o_bus_draw(w_current, object);
/* draw the other objects */
@@ -625,12 +628,12 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
/* remove all conn references */
o_current = object->complex->prim_objs;
while(o_current != NULL) {
- s_conn_remove(w_current, o_current);
+ s_conn_remove(toplevel, o_current);
o_current = o_current->next;
}
- o_complex_mirror_world(w_current, centerx, centery, object);
- s_conn_update_complex(w_current, object->complex->prim_objs);
+ o_complex_mirror_world(toplevel, centerx, centery, object);
+ s_conn_update_complex(toplevel, object->complex->prim_objs);
o_complex_draw(w_current, object);
o_cue_undraw_list(w_current, other_objects);
@@ -646,40 +649,40 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
case(OBJ_LINE):
o_line_erase_grips(w_current, object);
o_line_erase(w_current, object);
- o_line_mirror_world(w_current, centerx, centery, object);
+ o_line_mirror_world(toplevel, centerx, centery, object);
o_line_draw(w_current, object);
break;
case(OBJ_BOX):
o_box_erase_grips(w_current, object);
o_box_erase(w_current, object);
- o_box_mirror_world(w_current, centerx, centery, object);
+ o_box_mirror_world(toplevel, centerx, centery, object);
o_box_draw(w_current, object);
break;
case(OBJ_PICTURE):
o_picture_erase_grips(w_current, object);
o_picture_erase(w_current, object);
- o_picture_mirror_world(w_current, centerx, centery, object);
+ o_picture_mirror_world(toplevel, centerx, centery, object);
o_picture_draw(w_current, object);
break;
case(OBJ_CIRCLE):
o_circle_erase_grips(w_current, object);
o_circle_erase(w_current, object);
- o_circle_mirror_world(w_current, centerx, centery, object);
+ o_circle_mirror_world(toplevel, centerx, centery, object);
o_circle_draw(w_current, object);
break;
case(OBJ_ARC):
o_arc_erase(w_current, object);
- o_arc_mirror_world(w_current, centerx, centery, object);
+ o_arc_mirror_world(toplevel, centerx, centery, object);
o_arc_draw(w_current, object);
break;
case(OBJ_TEXT):
o_text_erase(w_current, object);
- o_text_mirror_world(w_current,
+ o_text_mirror_world(toplevel,
centerx, centery, object);
o_text_draw(w_current, object);
break;
@@ -709,7 +712,7 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
if (scm_hook_empty_p(mirror_pin_hook) == SCM_BOOL_F &&
object != NULL) {
scm_run_hook(rotate_pin_hook,
- scm_cons(g_make_object_smob(w_current, object),
+ scm_cons(g_make_object_smob(toplevel, object),
SCM_EOL));
}
break;
@@ -719,7 +722,7 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
if (scm_hook_empty_p(rotate_component_object_hook) == SCM_BOOL_F &&
object != NULL) {
scm_run_hook(mirror_component_object_hook,
- scm_cons(g_make_object_smob(w_current, object),
+ scm_cons(g_make_object_smob(toplevel, object),
SCM_EOL));
}
break;
@@ -731,7 +734,7 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
}
- w_current->page_current->CHANGED=1;
+ toplevel->page_current->CHANGED=1;
o_undo_savestate(w_current, UNDO_ALL);
}
@@ -740,8 +743,9 @@ void o_mirror_world(TOPLEVEL *w_current, GList *list, int centerx, int centery)
* \par Function Description
*
*/
-void o_edit_show_hidden_lowlevel(TOPLEVEL *w_current, OBJECT *o_list)
+void o_edit_show_hidden_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current = o_list;
if (o_current == NULL) {
@@ -753,18 +757,18 @@ void o_edit_show_hidden_lowlevel(TOPLEVEL *w_current, OBJECT *o_list)
/* don't toggle the visibility flag */
- if (w_current->show_hidden_text) {
+ if (toplevel->show_hidden_text) {
/* draw the text object if it hidden */
if (o_current->text->prim_objs == NULL) {
- o_text_recreate(w_current, o_current);
+ o_text_recreate(toplevel, o_current);
}
- o_text_recalc(w_current, o_current);
+ o_text_recalc(toplevel, o_current);
o_text_draw(w_current, o_current);
} else {
/* object is hidden and we are now NOT drawing it, so */
/* get rid of the extra primitive data */
- o_text_recreate(w_current, o_current);
- o_text_recalc(w_current, o_current);
+ o_text_recreate(toplevel, o_current);
+ o_text_recalc(toplevel, o_current);
/* unfortunately, you cannot erase the old visible text here */
/* because o_text_draw will just return */
}
@@ -772,7 +776,7 @@ void o_edit_show_hidden_lowlevel(TOPLEVEL *w_current, OBJECT *o_list)
if (o_current->type == OBJ_COMPLEX || o_current->type == OBJ_PLACEHOLDER) {
o_edit_show_hidden_lowlevel(w_current, o_current->complex->prim_objs);
- o_complex_recalc(w_current, o_current);
+ o_complex_recalc(toplevel, o_current);
}
o_current = o_current->next;
@@ -784,7 +788,7 @@ void o_edit_show_hidden_lowlevel(TOPLEVEL *w_current, OBJECT *o_list)
* \par Function Description
*
*/
-void o_edit_show_hidden(TOPLEVEL *w_current, OBJECT *o_list)
+void o_edit_show_hidden(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list)
{
/* this function just shows the hidden text, but doesn't toggle it */
/* this function does not change the CHANGED bit, no real changes are */
@@ -792,13 +796,13 @@ void o_edit_show_hidden(TOPLEVEL *w_current, OBJECT *o_list)
/* toggle show_hidden_text variable, which when it is true */
/* means that hidden text IS drawn */
- w_current->show_hidden_text = !w_current->show_hidden_text;
+ w_current->toplevel->show_hidden_text = !w_current->toplevel->show_hidden_text;
i_show_state(w_current, NULL); /* update screen status */
o_edit_show_hidden_lowlevel(w_current, o_list);
o_redraw_all_fast(w_current);
- if (w_current->show_hidden_text) {
+ if (w_current->toplevel->show_hidden_text) {
s_log_message(_("Hidden text is now visible\n"));
} else {
s_log_message(_("Hidden text is now invisible\n"));
@@ -810,9 +814,10 @@ void o_edit_show_hidden(TOPLEVEL *w_current, OBJECT *o_list)
* \par Function Description
*
*/
-void o_edit_make_visible(TOPLEVEL *w_current, OBJECT *o_list)
+void o_edit_make_visible(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list)
{
/* this function actually changes the visibility flag */
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current = NULL;
if (o_list == NULL)
@@ -826,12 +831,12 @@ void o_edit_make_visible(TOPLEVEL *w_current, OBJECT *o_list)
o_current->visibility = VISIBLE;
if (o_current->text->prim_objs == NULL) {
- o_text_recreate(w_current, o_current);
+ o_text_recreate(toplevel, o_current);
}
o_text_draw(w_current, o_current);
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
}
}
o_current = o_current->next;
@@ -850,10 +855,10 @@ int skiplast;
* \par Function Description
*
*/
-int o_edit_find_text(TOPLEVEL * w_current, OBJECT * o_list, char *stext,
+int o_edit_find_text(GSCHEM_TOPLEVEL *w_current, OBJECT * o_list, char *stext,
int descend, int skip)
{
-
+ TOPLEVEL *toplevel = w_current->toplevel;
char *attrib = NULL;
int count = 0;
PAGE *parent = NULL;
@@ -876,7 +881,7 @@ int o_edit_find_text(TOPLEVEL * w_current, OBJECT * o_list, char *stext,
if (descend) {
if (o_current->type == OBJ_COMPLEX) {
- parent = w_current->page_current;
+ parent = toplevel->page_current;
attrib = o_attrib_search_name_single_count(o_current, "source", count);
/* if above is null, then look inside symbol */
@@ -891,7 +896,7 @@ int o_edit_find_text(TOPLEVEL * w_current, OBJECT * o_list, char *stext,
current_filename = u_basic_breakup_string(attrib, ',', pcount);
if (current_filename != NULL) {
page_control =
- s_hierarchy_down_schematic_single(w_current,
+ s_hierarchy_down_schematic_single(toplevel,
current_filename,
parent,
page_control,
@@ -899,12 +904,12 @@ int o_edit_find_text(TOPLEVEL * w_current, OBJECT * o_list, char *stext,
/* o_redraw_all(w_current); */
rv = o_edit_find_text(w_current,
- w_current->page_current->object_head,
+ toplevel->page_current->object_head,
stext, descend, skiplast);
if (!rv) {
return 0;
}
- s_page_goto( w_current, parent );
+ s_page_goto( toplevel, parent );
}
}
}
@@ -916,16 +921,16 @@ int o_edit_find_text(TOPLEVEL * w_current, OBJECT * o_list, char *stext,
if (!skiplast) {
a_zoom(w_current, ZOOM_FULL, DONTCARE, A_PAN_DONT_REDRAW);
text_screen_height =
- SCREENabs(w_current, o_text_height(o_current->text->string,
- o_current->text->size));
+ SCREENabs(toplevel, o_text_height(o_current->text->string,
+ o_current->text->size));
/* this code will zoom/pan till the text screen height is about */
/* 50 pixels high, perhaps a future enhancement will be to make */
/* this number configurable */
while (text_screen_height < 50) {
a_zoom(w_current, ZOOM_IN, DONTCARE, A_PAN_DONT_REDRAW);
text_screen_height =
- SCREENabs(w_current, o_text_height(o_current->text->string,
- o_current->text->size));
+ SCREENabs(toplevel, o_text_height(o_current->text->string,
+ o_current->text->size));
}
a_pan_general(w_current,
o_current->text->x, o_current->text->y,
@@ -955,9 +960,10 @@ int o_edit_find_text(TOPLEVEL * w_current, OBJECT * o_list, char *stext,
* \par Function Description
*
*/
-void o_edit_hide_specific_text(TOPLEVEL * w_current, OBJECT * o_list,
+void o_edit_hide_specific_text(GSCHEM_TOPLEVEL *w_current, OBJECT * o_list,
char *stext)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current = NULL;
if (o_list == NULL)
@@ -973,9 +979,9 @@ void o_edit_hide_specific_text(TOPLEVEL * w_current, OBJECT * o_list,
o_current->visibility = INVISIBLE;
if (o_current->text->prim_objs == NULL) {
- o_text_recreate(w_current, o_current);
+ o_text_recreate(toplevel, o_current);
}
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
}
}
}
@@ -990,9 +996,10 @@ void o_edit_hide_specific_text(TOPLEVEL * w_current, OBJECT * o_list,
* \par Function Description
*
*/
-void o_edit_show_specific_text(TOPLEVEL * w_current, OBJECT * o_list,
+void o_edit_show_specific_text(GSCHEM_TOPLEVEL *w_current, OBJECT * o_list,
char *stext)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current = NULL;
if (o_list == NULL)
@@ -1008,10 +1015,10 @@ void o_edit_show_specific_text(TOPLEVEL * w_current, OBJECT * o_list,
o_current->visibility = VISIBLE;
if (o_current->text->prim_objs == NULL) {
- o_text_recreate(w_current, o_current);
+ o_text_recreate(toplevel, o_current);
}
o_text_draw(w_current, o_current);
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
}
}
}
@@ -1025,8 +1032,9 @@ void o_edit_show_specific_text(TOPLEVEL * w_current, OBJECT * o_list,
* \par Function Description
*
*/
-void o_update_component(TOPLEVEL *w_current, OBJECT *o_current)
+void o_update_component(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *tmp_list, *new_complex;
ATTRIB *new_attribs, *a_current;
gboolean is_embedded;
@@ -1048,13 +1056,13 @@ void o_update_component(TOPLEVEL *w_current, OBJECT *o_current)
/* erase the complex object */
o_erase_single (w_current, o_current);
/* delete its connections */
- s_conn_remove_complex (w_current, o_current);
+ s_conn_remove_complex (toplevel, o_current);
/* and unselect it */
- o_selection_remove( w_current->page_current->selection_list, o_current);
+ o_selection_remove( toplevel->page_current->selection_list, o_current);
/* build a temporary list and add a complex to this list */
tmp_list = s_basic_init_object ("update component");
- new_complex = o_complex_add (w_current,
+ new_complex = o_complex_add (toplevel,
tmp_list, NULL,
OBJ_COMPLEX,
WHITE,
@@ -1068,7 +1076,7 @@ void o_update_component(TOPLEVEL *w_current, OBJECT *o_current)
/* updating the old complex with data from the new one */
/* first process the prim_objs: */
/* - delete the prim_objs of the old component */
- s_delete_list_fromstart (w_current,
+ s_delete_list_fromstart (toplevel,
o_current->complex->prim_objs);
/* - put the prim_objs of the new component in the old one */
o_current->complex->prim_objs = new_complex->complex->prim_objs;
@@ -1098,14 +1106,14 @@ void o_update_component(TOPLEVEL *w_current, OBJECT *o_current)
/* add new attribute to old component */
/* make a copy of the attribute object */
- o_list_copy_to (w_current, o_current,
+ o_list_copy_to (toplevel, o_current,
a_current->object, NORMAL_FLAG, &o_attrib);
if (o_current->attribs == NULL) {
/* object has no attribute list: create it */
o_current->attribs = add_attrib_head(o_current);
}
/* add the attribute to old */
- o_attrib_add (w_current, o_current->attribs, o_attrib);
+ o_attrib_add (toplevel, o_current->attribs, o_attrib);
/* redraw the attribute object */
o_redraw_single (w_current, o_attrib);
/* note: this object is unselected (not added to selection). */
@@ -1120,21 +1128,21 @@ void o_update_component(TOPLEVEL *w_current, OBJECT *o_current)
}
/* finally delete the temp list with the updated complex */
- s_delete_list_fromstart (w_current, tmp_list);
+ s_delete_list_fromstart (toplevel, tmp_list);
/* Recalculate the bounds of the object */
- o_complex_recalc(w_current, o_current);
+ o_complex_recalc(toplevel, o_current);
/* reconnect, re-select and redraw */
- s_conn_update_complex (w_current, o_current->complex->prim_objs);
- o_selection_add( w_current->page_current->selection_list, o_current );
+ s_conn_update_complex (toplevel, o_current->complex->prim_objs);
+ o_selection_add( toplevel->page_current->selection_list, o_current );
o_redraw_single (w_current, o_current);
/* Re-flag as embedded if necessary */
o_current->complex_embedded = is_embedded;
/* mark the page as modified */
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
o_undo_savestate (w_current, UNDO_ALL);
}
@@ -1144,10 +1152,11 @@ void o_update_component(TOPLEVEL *w_current, OBJECT *o_current)
* Looks for pages with the do_autosave_backup flag activated and
* autosaves them.
*
- * \param [in] toplevel The TOPLEVEL object to search for autosave's.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object to search for autosave's.
*/
-void o_autosave_backups(TOPLEVEL *toplevel)
+void o_autosave_backups(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *iter;
PAGE *p_save, *p_current;
gchar *backup_filename;
diff --git a/gschem/src/o_move.c b/gschem/src/o_move.c
index bb9e3da..4534c09 100644
--- a/gschem/src/o_move.c
+++ b/gschem/src/o_move.c
@@ -23,6 +23,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -35,9 +36,10 @@
* \par Function Description
*
*/
-void o_move_start(TOPLEVEL * w_current, int x, int y)
+void o_move_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
- if ( geda_list_get_glist( w_current->page_current->selection_list ) != NULL) {
+ TOPLEVEL *toplevel = w_current->toplevel;
+ if ( geda_list_get_glist( toplevel->page_current->selection_list ) != NULL) {
/* Save the current state. When rotating the selection when moving,
we have to come back to here */
@@ -45,13 +47,13 @@ void o_move_start(TOPLEVEL * w_current, int x, int y)
w_current->last_drawb_mode = -1;
w_current->event_state = MOVE;
- w_current->last_x = w_current->start_x = fix_x(w_current, x);
- w_current->last_y = w_current->start_y = fix_y(w_current, y);
+ w_current->last_x = w_current->start_x = fix_x(toplevel, x);
+ w_current->last_y = w_current->start_y = fix_y(toplevel, y);
o_erase_selected(w_current);
o_drawbounding(w_current,
- geda_list_get_glist( w_current->page_current->selection_list ),
+ geda_list_get_glist( toplevel->page_current->selection_list ),
x_get_darkcolor(w_current->bb_color), TRUE);
if (w_current->netconn_rubberband) {
@@ -75,10 +77,11 @@ void o_move_start(TOPLEVEL * w_current, int x, int y)
* type can be SINGLE or COMPLEX
* which basically controls if this is a single object or a complex
*/
-void o_move_end_lowlevel(TOPLEVEL * w_current, OBJECT * list, int type,
+void o_move_end_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT * list, int type,
int diff_x, int diff_y,
GList** other_objects, GList** connected_objects)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current;
OBJECT *object;
@@ -91,61 +94,61 @@ void o_move_end_lowlevel(TOPLEVEL * w_current, OBJECT * list, int type,
case (OBJ_NET):
/* save the other objects and remove object's connections */
*other_objects = s_conn_return_others(*other_objects, object);
- s_conn_remove(w_current, object);
+ s_conn_remove(toplevel, object);
/* do the actual translation */
- o_net_translate_world(w_current, diff_x, diff_y, object);
- s_conn_update_object(w_current, object);
+ o_net_translate_world(toplevel, diff_x, diff_y, object);
+ s_conn_update_object(toplevel, object);
*connected_objects = s_conn_return_others(*connected_objects, object);
break;
case (OBJ_BUS):
/* save the other objects and remove object's connections */
*other_objects = s_conn_return_others(*other_objects, object);
- s_conn_remove(w_current, object);
+ s_conn_remove(toplevel, object);
- o_bus_translate_world(w_current, diff_x, diff_y, object);
- s_conn_update_object(w_current, object);
+ o_bus_translate_world(toplevel, diff_x, diff_y, object);
+ s_conn_update_object(toplevel, object);
*connected_objects = s_conn_return_others(*connected_objects, object);
break;
case (OBJ_PIN):
/* save the other objects and remove object's connections */
*other_objects = s_conn_return_others(*other_objects, object);
- s_conn_remove(w_current, object);
+ s_conn_remove(toplevel, object);
- o_pin_translate_world(w_current, diff_x, diff_y, object);
- s_conn_update_object(w_current, object);
+ o_pin_translate_world(toplevel, diff_x, diff_y, object);
+ s_conn_update_object(toplevel, object);
*connected_objects = s_conn_return_others(*connected_objects, object);
break;
case (OBJ_LINE):
- o_line_translate_world(w_current, diff_x, diff_y, object);
+ o_line_translate_world(toplevel, diff_x, diff_y, object);
break;
case (OBJ_BOX):
- o_box_translate_world(w_current, diff_x, diff_y, object);
+ o_box_translate_world(toplevel, diff_x, diff_y, object);
break;
case (OBJ_PICTURE):
- o_picture_translate_world(w_current, diff_x, diff_y, object);
+ o_picture_translate_world(toplevel, diff_x, diff_y, object);
break;
case (OBJ_CIRCLE):
- o_circle_translate_world(w_current, diff_x, diff_y, object);
+ o_circle_translate_world(toplevel, diff_x, diff_y, object);
break;
case (OBJ_TEXT):
- o_text_translate_world(w_current, diff_x, diff_y, object);
+ o_text_translate_world(toplevel, diff_x, diff_y, object);
break;
case (OBJ_ARC):
- o_arc_translate_world(w_current, diff_x, diff_y, object);
+ o_arc_translate_world(toplevel, diff_x, diff_y, object);
break;
case (OBJ_COMPLEX):
case (OBJ_PLACEHOLDER):
- o_complex_translate_world(w_current, diff_x, diff_y, object);
+ o_complex_translate_world(toplevel, diff_x, diff_y, object);
break;
}
@@ -163,8 +166,9 @@ void o_move_end_lowlevel(TOPLEVEL * w_current, OBJECT * list, int type,
* \par Function Description
*
*/
-void o_move_end(TOPLEVEL * w_current)
+void o_move_end(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *s_current = NULL;
OBJECT *object;
int diff_x, diff_y;
@@ -187,14 +191,14 @@ void o_move_end(TOPLEVEL * w_current)
}
- SCREENtoWORLD(w_current, w_current->last_x, w_current->last_y,
+ SCREENtoWORLD(toplevel, w_current->last_x, w_current->last_y,
&lx, &ly);
- SCREENtoWORLD(w_current, w_current->start_x, w_current->start_y,
+ SCREENtoWORLD(toplevel, w_current->start_x, w_current->start_y,
&sx, &sy);
- lx = snap_grid(w_current, lx);
- ly = snap_grid(w_current, ly);
- sx = snap_grid(w_current, sx);
- sy = snap_grid(w_current, sy);
+ lx = snap_grid(toplevel, lx);
+ ly = snap_grid(toplevel, ly);
+ sx = snap_grid(toplevel, sx);
+ sy = snap_grid(toplevel, sy);
diff_x = lx - sx;
diff_y = ly - sy;
@@ -208,12 +212,12 @@ void o_move_end(TOPLEVEL * w_current)
if (w_current->actionfeedback_mode == OUTLINE) {
o_drawbounding(w_current,
- geda_list_get_glist( w_current->page_current->selection_list ),
+ geda_list_get_glist( toplevel->page_current->selection_list ),
x_get_darkcolor(w_current->bb_color), TRUE);
}
/* skip over head node */
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
while (s_current != NULL) {
@@ -259,7 +263,7 @@ void o_move_end(TOPLEVEL * w_current)
&other_objects, &connected_objects);
- world_get_object_list_bounds(w_current, object->complex->prim_objs,
+ world_get_object_list_bounds(toplevel, object->complex->prim_objs,
&left, &top, &right, &bottom);
object->w_left = left;
@@ -279,7 +283,7 @@ void o_move_end(TOPLEVEL * w_current)
/* erase the bounding box */
if (w_current->actionfeedback_mode == BOUNDINGBOX) {
o_drawbounding(w_current,
- geda_list_get_glist( w_current->page_current->selection_list ),
+ geda_list_get_glist( toplevel->page_current->selection_list ),
x_get_darkcolor(w_current->bb_color), FALSE);
}
@@ -299,7 +303,7 @@ void o_move_end(TOPLEVEL * w_current)
o_cue_undraw_list(w_current, rubbernet_connected_objects);
o_cue_draw_list(w_current, rubbernet_connected_objects);
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
g_list_free(other_objects);
@@ -308,8 +312,8 @@ void o_move_end(TOPLEVEL * w_current)
g_list_free(rubbernet_other_objects);
g_list_free(rubbernet_connected_objects);
- g_list_free(w_current->page_current->complex_place_list);
- w_current->page_current->complex_place_list = NULL;
+ g_list_free(toplevel->page_current->complex_place_list);
+ toplevel->page_current->complex_place_list = NULL;
}
/*! \todo Finish function documentation!!!
@@ -337,8 +341,9 @@ int o_move_return_whichone(OBJECT * object, int x, int y)
* \par Function Description
*
*/
-void o_move_check_endpoint(TOPLEVEL * w_current, OBJECT * object)
+void o_move_check_endpoint(GSCHEM_TOPLEVEL *w_current, OBJECT * object)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *cl_current;
CONN *c_current;
int whichone;
@@ -388,8 +393,8 @@ void o_move_check_endpoint(TOPLEVEL * w_current, OBJECT * object)
#endif
if (whichone >= 0 && whichone <= 1) {
- w_current->page_current->stretch_tail =
- s_stretch_add(w_current->page_current->
+ toplevel->page_current->stretch_tail =
+ s_stretch_add(toplevel->page_current->
stretch_head,
c_current->other_object,
c_current, whichone);
@@ -413,24 +418,25 @@ void o_move_check_endpoint(TOPLEVEL * w_current, OBJECT * object)
* \par Function Description
*
*/
-void o_move_prep_rubberband(TOPLEVEL * w_current)
+void o_move_prep_rubberband(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *s_current;
OBJECT *object;
OBJECT *o_current;
- s_stretch_remove_most(w_current,
- w_current->page_current->stretch_head);
- w_current->page_current->stretch_tail =
- w_current->page_current->stretch_head;
+ s_stretch_remove_most(toplevel,
+ toplevel->page_current->stretch_head);
+ toplevel->page_current->stretch_tail =
+ toplevel->page_current->stretch_head;
#if DEBUG
printf("\n\n\n");
- s_stretch_print_all(w_current->page_current->stretch_head);
+ s_stretch_print_all(toplevel->page_current->stretch_head);
printf("\n\n\n");
#endif
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
while (s_current != NULL) {
object = (OBJECT *) s_current->data;
if (object) {
@@ -462,7 +468,7 @@ void o_move_prep_rubberband(TOPLEVEL * w_current)
#if DEBUG
printf("\n\n\n\nfinished building scretch list:\n");
- s_stretch_print_all(w_current->page_current->stretch_head);
+ s_stretch_print_all(toplevel->page_current->stretch_head);
#endif
}
@@ -492,18 +498,19 @@ int o_move_zero_length(OBJECT * object)
* \par Function Description
*
*/
-void o_move_end_rubberband(TOPLEVEL * w_current, int world_diff_x,
+void o_move_end_rubberband(GSCHEM_TOPLEVEL *w_current, int world_diff_x,
int world_diff_y,
GList** objects,
GList** other_objects, GList** connected_objects)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
STRETCH *s_current;
OBJECT *object;
int x, y;
int whichone;
/* skip over head */
- s_current = w_current->page_current->stretch_head->next;
+ s_current = toplevel->page_current->stretch_head->next;
while (s_current != NULL) {
@@ -518,7 +525,7 @@ void o_move_end_rubberband(TOPLEVEL * w_current, int world_diff_x,
/* save the other objects and remove object's connections */
*other_objects =
s_conn_return_others(*other_objects, object);
- s_conn_remove(w_current, object);
+ s_conn_remove(toplevel, object);
x = object->line->x[whichone];
y = object->line->y[whichone];
@@ -542,9 +549,9 @@ void o_move_end_rubberband(TOPLEVEL * w_current, int world_diff_x,
if (o_move_zero_length(object)) {
o_delete_net(w_current, object);
} else {
- o_net_recalc(w_current, object);
- s_tile_update_object(w_current, object);
- s_conn_update_object(w_current, object);
+ o_net_recalc(toplevel, object);
+ s_tile_update_object(toplevel, object);
+ s_conn_update_object(toplevel, object);
*connected_objects =
s_conn_return_others(*connected_objects, object);
*objects = g_list_append(*objects, object);
@@ -563,7 +570,7 @@ void o_move_end_rubberband(TOPLEVEL * w_current, int world_diff_x,
/* save the other objects and remove object's connections */
*other_objects =
s_conn_return_others(*other_objects, object);
- s_conn_remove(w_current, object);
+ s_conn_remove(toplevel, object);
x = object->line->x[whichone];
y = object->line->y[whichone];
@@ -584,9 +591,9 @@ void o_move_end_rubberband(TOPLEVEL * w_current, int world_diff_x,
if (o_move_zero_length(object)) {
o_delete_bus(w_current, object);
} else {
- o_bus_recalc(w_current, object);
- s_tile_update_object(w_current, object);
- s_conn_update_object(w_current, object);
+ o_bus_recalc(toplevel, object);
+ s_tile_update_object(toplevel, object);
+ s_conn_update_object(toplevel, object);
*connected_objects =
s_conn_return_others(*connected_objects, object);
*objects = g_list_append(*objects, object);
@@ -613,9 +620,9 @@ void o_move_end_rubberband(TOPLEVEL * w_current, int world_diff_x,
* \par Function Description
*
*/
-void o_move_stretch_rubberband(TOPLEVEL * w_current)
+void o_move_stretch_rubberband(GSCHEM_TOPLEVEL *w_current)
{
-
+ TOPLEVEL *toplevel = w_current->toplevel;
STRETCH *s_current;
OBJECT *object;
int diff_x, diff_y;
@@ -626,7 +633,7 @@ void o_move_stretch_rubberband(TOPLEVEL * w_current)
/* skip over head */
- s_current = w_current->page_current->stretch_head->next;
+ s_current = toplevel->page_current->stretch_head->next;
while (s_current != NULL) {
object = s_current->object;
diff --git a/gschem/src/o_net.c b/gschem/src/o_net.c
index ae8e7b0..220675c 100644
--- a/gschem/src/o_net.c
+++ b/gschem/src/o_net.c
@@ -24,6 +24,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -36,8 +37,9 @@
* \par Function Description
*
*/
-void o_net_draw(TOPLEVEL *w_current, OBJECT *o_current)
+void o_net_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
int x1, y1, x2, y2; /* screen coords */
@@ -55,8 +57,8 @@ void o_net_draw(TOPLEVEL *w_current, OBJECT *o_current)
}
/* reuse line's routine */
- if ( (w_current->DONT_REDRAW == 1) ||
- (!o_line_visible(w_current, o_current->line, &x1, &y1, &x2, &y2)) ) {
+ if ( (toplevel->DONT_REDRAW == 1) ||
+ (!o_line_visible(toplevel, o_current->line, &x1, &y1, &x2, &y2)) ) {
return;
}
@@ -64,8 +66,8 @@ void o_net_draw(TOPLEVEL *w_current, OBJECT *o_current)
printf("drawing net\n\n");
#endif
- if (w_current->net_style == THICK ) {
- size = SCREENabs(w_current, NET_WIDTH);
+ if (toplevel->net_style == THICK ) {
+ size = SCREENabs(toplevel, NET_WIDTH);
if (size < 0)
size=0;
@@ -81,10 +83,10 @@ void o_net_draw(TOPLEVEL *w_current, OBJECT *o_current)
GDK_JOIN_MITER);
}
- if (w_current->override_color != -1 ) {
+ if (toplevel->override_color != -1 ) {
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->override_color));
+ x_get_color(toplevel->override_color));
gdk_draw_line(w_current->window, w_current->gc,
x1, y1, x2, y2);
@@ -126,7 +128,7 @@ void o_net_draw(TOPLEVEL *w_current, OBJECT *o_current)
#endif
/* yes zero is right for the width -> use hardware lines */
- if (w_current->net_style == THICK ) {
+ if (toplevel->net_style == THICK ) {
gdk_gc_set_line_attributes(w_current->gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -159,11 +161,12 @@ void o_net_draw(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_net_erase(TOPLEVEL *w_current, OBJECT *o_current)
+void o_net_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
- w_current->override_color = w_current->background_color;
+ TOPLEVEL *toplevel = w_current->toplevel;
+ toplevel->override_color = toplevel->background_color;
o_net_draw(w_current, o_current);
- w_current->override_color = -1;
+ toplevel->override_color = -1;
}
/*! \todo Finish function documentation!!!
@@ -171,8 +174,9 @@ void o_net_erase(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_net_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
+void o_net_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
int color;
int sx[2], sy[2];
@@ -190,16 +194,16 @@ void o_net_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
gdk_gc_set_foreground(w_current->outline_xor_gc,
x_get_darkcolor(color));
- if (w_current->net_style == THICK ) {
- size = SCREENabs(w_current, NET_WIDTH);
+ if (toplevel->net_style == THICK ) {
+ size = SCREENabs(toplevel, NET_WIDTH);
gdk_gc_set_line_attributes(w_current->outline_xor_gc, size+1,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
GDK_JOIN_MITER);
}
- WORLDtoSCREEN( w_current, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
- WORLDtoSCREEN( w_current, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
gdk_draw_line(w_current->window, w_current->outline_xor_gc,
sx[0]+dx, sy[0]+dy,
@@ -208,7 +212,7 @@ void o_net_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
/* backing store ? not approriate here */
- if (w_current->net_style == THICK ) {
+ if (toplevel->net_style == THICK ) {
gdk_gc_set_line_attributes(w_current->outline_xor_gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -221,9 +225,10 @@ void o_net_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
* \par Function Description
*
*/
-void o_net_draw_xor_single(TOPLEVEL *w_current, int dx, int dy, int whichone,
+void o_net_draw_xor_single(GSCHEM_TOPLEVEL *w_current, int dx, int dy, int whichone,
OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int color;
int dx1 = -1, dx2 = -1, dy1 = -1,dy2 = -1;
int sx[2], sy[2];
@@ -255,8 +260,8 @@ void o_net_draw_xor_single(TOPLEVEL *w_current, int dx, int dy, int whichone,
fprintf(stderr, _("Got an invalid which one in o_net_draw_xor_single\n"));
}
- WORLDtoSCREEN( w_current, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
- WORLDtoSCREEN( w_current, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
gdk_draw_line(w_current->window, w_current->outline_xor_gc,
sx[0]+dx1, sy[0]+dy1,
@@ -270,18 +275,19 @@ void o_net_draw_xor_single(TOPLEVEL *w_current, int dx, int dy, int whichone,
* \par Function Description
*
*/
-void o_net_start(TOPLEVEL *w_current, int x, int y)
+void o_net_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
/* initalize all parameters used when drawing the new net */
w_current->last_x = w_current->start_x = w_current->second_x =
- fix_x(w_current, x);
+ fix_x(toplevel, x);
w_current->last_y = w_current->start_y = w_current->second_y =
- fix_y(w_current, y);
+ fix_y(toplevel, y);
- if (w_current->net_style == THICK ) {
- size = SCREENabs(w_current, NET_WIDTH);
+ if (toplevel->net_style == THICK ) {
+ size = SCREENabs(toplevel, NET_WIDTH);
gdk_gc_set_line_attributes(w_current->xor_gc, size,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -294,7 +300,7 @@ void o_net_start(TOPLEVEL *w_current, int x, int y)
w_current->start_x, w_current->start_y,
w_current->last_x, w_current->last_y);
- if (w_current->net_style == THICK ) {
+ if (toplevel->net_style == THICK ) {
gdk_gc_set_line_attributes(w_current->xor_gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -307,8 +313,9 @@ void o_net_start(TOPLEVEL *w_current, int x, int y)
* \par Function Description
*
*/
-int o_net_end(TOPLEVEL *w_current, int x, int y)
+int o_net_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x1, y1;
int x2, y2;
int x3, y3;
@@ -324,19 +331,19 @@ int o_net_end(TOPLEVEL *w_current, int x, int y)
OBJECT *new_net = NULL;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return(FALSE);
}
- if (w_current->override_net_color == -1) {
+ if (toplevel->override_net_color == -1) {
color = w_current->net_color;
} else {
- color = w_current->override_net_color;
+ color = toplevel->override_net_color;
}
- size = SCREENabs(w_current, NET_WIDTH);
+ size = SCREENabs(toplevel, NET_WIDTH);
- if (w_current->net_style == THICK ) {
+ if (toplevel->net_style == THICK ) {
gdk_gc_set_line_attributes(w_current->xor_gc, size,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -356,7 +363,7 @@ int o_net_end(TOPLEVEL *w_current, int x, int y)
w_current->last_x, w_current->last_y,
w_current->second_x, w_current->second_y);
- if (w_current->net_style == THICK) {
+ if (toplevel->net_style == THICK) {
gdk_gc_set_line_attributes(w_current->xor_gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
@@ -392,32 +399,32 @@ int o_net_end(TOPLEVEL *w_current, int x, int y)
/* Primary net runs from (x1,y1)-(x2,y2) */
/* Secondary net from (x2,y2)-(x3,y3) */
- SCREENtoWORLD(w_current, w_current->start_x, w_current->start_y, &x1, &y1);
- SCREENtoWORLD(w_current, w_current->last_x, w_current->last_y, &x2, &y2);
- SCREENtoWORLD(w_current, w_current->second_x, w_current->second_y, &x3, &y3);
+ SCREENtoWORLD(toplevel, w_current->start_x, w_current->start_y, &x1, &y1);
+ SCREENtoWORLD(toplevel, w_current->last_x, w_current->last_y, &x2, &y2);
+ SCREENtoWORLD(toplevel, w_current->second_x, w_current->second_y, &x3, &y3);
/* Snap points to closest grid location */
- x1 = snap_grid(w_current, x1);
- y1 = snap_grid(w_current, y1);
- x2 = snap_grid(w_current, x2);
- y2 = snap_grid(w_current, y2);
- x3 = snap_grid(w_current, x3);
- y3 = snap_grid(w_current, y3);
+ x1 = snap_grid(toplevel, x1);
+ y1 = snap_grid(toplevel, y1);
+ x2 = snap_grid(toplevel, x2);
+ y2 = snap_grid(toplevel, y2);
+ x3 = snap_grid(toplevel, x3);
+ y3 = snap_grid(toplevel, y3);
w_current->save_x = w_current->second_x;
w_current->save_y = w_current->second_y;
if (!primary_zero_length ) {
/* create primary net */
- w_current->page_current->object_tail =
- new_net = o_net_add(w_current,
- w_current->page_current->object_tail,
+ toplevel->page_current->object_tail =
+ new_net = o_net_add(toplevel,
+ toplevel->page_current->object_tail,
OBJ_NET, color, x1, y1, x2, y2);
/* conn stuff */
/* LEAK CHECK 1 */
other_objects = s_conn_return_others(other_objects,
- w_current->page_current->
+ toplevel->page_current->
object_tail);
if (o_net_add_busrippers(w_current, new_net, other_objects)) {
@@ -431,8 +438,8 @@ int o_net_end(TOPLEVEL *w_current, int x, int y)
s_conn_print(new_net->conn_list);
#endif
- WORLDtoSCREEN( w_current, new_net->line->x[0], new_net->line->y[0], &sx[0], &sy[0] );
- WORLDtoSCREEN( w_current, new_net->line->x[1], new_net->line->y[1], &sx[1], &sy[1] );
+ WORLDtoSCREEN( toplevel, new_net->line->x[0], new_net->line->y[0], &sx[0], &sy[0] );
+ WORLDtoSCREEN( toplevel, new_net->line->x[1], new_net->line->y[1], &sx[1], &sy[1] );
gdk_gc_set_foreground(w_current->gc, x_get_color(color));
gdk_draw_line(w_current->window, w_current->gc,
@@ -442,7 +449,7 @@ int o_net_end(TOPLEVEL *w_current, int x, int y)
sx[0], sy[0],
sx[1], sy[1]);
- if (w_current->net_style == THICK) {
+ if (toplevel->net_style == THICK) {
gdk_gc_set_line_attributes(w_current->gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
@@ -463,8 +470,8 @@ int o_net_end(TOPLEVEL *w_current, int x, int y)
}
/* you don't want to consolidate nets which are drawn non-ortho */
- if (w_current->net_consolidate == TRUE && !w_current->CONTROLKEY) {
- o_net_consolidate_segments(w_current, new_net);
+ if (toplevel->net_consolidate == TRUE && !w_current->CONTROLKEY) {
+ o_net_consolidate_segments(toplevel, new_net);
}
}
@@ -474,15 +481,15 @@ int o_net_end(TOPLEVEL *w_current, int x, int y)
if (!secondary_zero_length && !found_primary_connection) {
/* Add secondary net */
- w_current->page_current->object_tail =
- new_net = o_net_add(w_current,
- w_current->page_current->object_tail,
+ toplevel->page_current->object_tail =
+ new_net = o_net_add(toplevel,
+ toplevel->page_current->object_tail,
OBJ_NET, color, x2, y2, x3, y3);
/* conn stuff */
/* LEAK CHECK 2 */
other_objects = s_conn_return_others(other_objects,
- w_current->page_current->
+ toplevel->page_current->
object_tail);
if (o_net_add_busrippers(w_current, new_net, other_objects)) {
@@ -494,8 +501,8 @@ int o_net_end(TOPLEVEL *w_current, int x, int y)
s_conn_print(new_net->conn_list);
#endif
- WORLDtoSCREEN( w_current, new_net->line->x[0], new_net->line->y[0], &sx[0], &sy[0] );
- WORLDtoSCREEN( w_current, new_net->line->x[1], new_net->line->y[1], &sx[1], &sy[1] );
+ WORLDtoSCREEN( toplevel, new_net->line->x[0], new_net->line->y[0], &sx[0], &sy[0] );
+ WORLDtoSCREEN( toplevel, new_net->line->x[1], new_net->line->y[1], &sx[1], &sy[1] );
gdk_gc_set_foreground(w_current->gc, x_get_color(color));
gdk_draw_line(w_current->window, w_current->gc,
@@ -505,7 +512,7 @@ int o_net_end(TOPLEVEL *w_current, int x, int y)
sx[0], sy[0],
sx[1], sy[1]);
- if (w_current->net_style == THICK) {
+ if (toplevel->net_style == THICK) {
gdk_gc_set_line_attributes(w_current->gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
@@ -516,15 +523,15 @@ int o_net_end(TOPLEVEL *w_current, int x, int y)
o_cue_draw_single(w_current, new_net);
/* you don't want to consolidate nets which are drawn non-ortho */
- if (w_current->net_consolidate == TRUE && !w_current->CONTROLKEY) {
- o_net_consolidate_segments(w_current, new_net);
+ if (toplevel->net_consolidate == TRUE && !w_current->CONTROLKEY) {
+ o_net_consolidate_segments(toplevel, new_net);
}
}
/* LEAK CHECK 3 */
g_list_free(other_objects);
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
w_current->start_x = w_current->save_x;
w_current->start_y = w_current->save_y;
o_undo_savestate(w_current, UNDO_ALL);
@@ -537,19 +544,20 @@ int o_net_end(TOPLEVEL *w_current, int x, int y)
* \par Function Description
*
*/
-void o_net_rubbernet(TOPLEVEL *w_current, int x, int y)
+void o_net_rubbernet(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int diff_x, diff_y;
int size;
int ortho;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
- if (w_current->net_style == THICK) {
- size = SCREENabs(w_current, NET_WIDTH);
+ if (toplevel->net_style == THICK) {
+ size = SCREENabs(toplevel, NET_WIDTH);
gdk_gc_set_line_attributes(w_current->xor_gc, size,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
@@ -578,8 +586,8 @@ void o_net_rubbernet(TOPLEVEL *w_current, int x, int y)
w_current->second_y = w_current->last_y;
}
- w_current->last_x = fix_x(w_current, x);
- w_current->last_y = fix_y(w_current, y);
+ w_current->last_x = fix_x(toplevel, x);
+ w_current->last_y = fix_y(toplevel, y);
/* If you press the control key then you can draw non-ortho nets */
if (ortho) {
@@ -591,10 +599,10 @@ void o_net_rubbernet(TOPLEVEL *w_current, int x, int y)
if ( !w_current->SHIFTKEY ) {
w_current->last_y = w_current->start_y;
w_current->second_x = w_current->last_x;
- w_current->second_y = fix_y(w_current,y);
+ w_current->second_y = fix_y(toplevel,y);
} else {
w_current->last_x = w_current->start_x;
- w_current->second_x = fix_x(w_current,x);
+ w_current->second_x = fix_x(toplevel,x);
w_current->second_y = w_current->last_y;
}
}
@@ -612,7 +620,7 @@ void o_net_rubbernet(TOPLEVEL *w_current, int x, int y)
w_current->last_x, w_current->last_y,
w_current->second_x, w_current->second_y);
- if (w_current->net_style == THICK) {
+ if (toplevel->net_style == THICK) {
gdk_gc_set_line_attributes(w_current->xor_gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
@@ -626,12 +634,13 @@ void o_net_rubbernet(TOPLEVEL *w_current, int x, int y)
* \note
* used in button cancel code in x_events.c
*/
-void o_net_eraserubber(TOPLEVEL *w_current)
+void o_net_eraserubber(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
- if (w_current->net_style == THICK) {
- size = SCREENabs(w_current, NET_WIDTH);
+ if (toplevel->net_style == THICK) {
+ size = SCREENabs(toplevel, NET_WIDTH);
if (size < 0)
size = 0;
@@ -650,7 +659,7 @@ void o_net_eraserubber(TOPLEVEL *w_current)
w_current->last_x, w_current->last_y,
w_current->second_x, w_current->second_y);
- if (w_current->net_style == THICK) {
+ if (toplevel->net_style == THICK) {
gdk_gc_set_line_attributes(w_current->xor_gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
@@ -664,13 +673,14 @@ void o_net_eraserubber(TOPLEVEL *w_current)
* \note
* used in x_event_expose() in x_events.c
*/
-void o_net_xorrubber(TOPLEVEL *w_current)
+void o_net_xorrubber(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
- if (w_current->net_style == THICK ) {
+ if (toplevel->net_style == THICK ) {
- size = SCREENabs(w_current, NET_WIDTH);
+ size = SCREENabs(toplevel, NET_WIDTH);
if (size < 0)
size=0;
@@ -690,7 +700,7 @@ void o_net_xorrubber(TOPLEVEL *w_current)
w_current->second_x, w_current->second_y,
w_current->last_x, w_current->last_y);
- if (w_current->net_style == THICK ) {
+ if (toplevel->net_style == THICK ) {
gdk_gc_set_line_attributes(w_current->gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -703,10 +713,11 @@ void o_net_xorrubber(TOPLEVEL *w_current)
* \par Function Description
*
*/
-int o_net_add_busrippers(TOPLEVEL *w_current, OBJECT *net_obj,
+int o_net_add_busrippers(GSCHEM_TOPLEVEL *w_current, OBJECT *net_obj,
GList *other_objects)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int color;
GList *cl_current = NULL;
OBJECT *bus_object = NULL;
@@ -735,10 +746,10 @@ int o_net_add_busrippers(TOPLEVEL *w_current, OBJECT *net_obj,
return(FALSE);
}
- if (w_current->override_net_color == -1) {
+ if (toplevel->override_net_color == -1) {
color = w_current->net_color;
} else {
- color = w_current->override_net_color;
+ color = toplevel->override_net_color;
}
@@ -827,7 +838,7 @@ int o_net_add_busrippers(TOPLEVEL *w_current, OBJECT *net_obj,
}
net_obj->line->y[found_conn->whichone] -= ripper_size;
- o_net_recalc(w_current, net_obj);
+ o_net_recalc(toplevel, net_obj);
rippers[ripper_count].x[0] =
net_obj->line->x[found_conn->whichone];
rippers[ripper_count].y[0] =
@@ -864,7 +875,7 @@ int o_net_add_busrippers(TOPLEVEL *w_current, OBJECT *net_obj,
}
net_obj->line->y[found_conn->whichone] += ripper_size;
- o_net_recalc(w_current, net_obj);
+ o_net_recalc(toplevel, net_obj);
rippers[ripper_count].x[0] =
net_obj->line->x[found_conn->whichone];
rippers[ripper_count].y[0] =
@@ -935,7 +946,7 @@ int o_net_add_busrippers(TOPLEVEL *w_current, OBJECT *net_obj,
}
net_obj->line->x[found_conn->whichone] -= ripper_size;
- o_net_recalc(w_current, net_obj);
+ o_net_recalc(toplevel, net_obj);
rippers[ripper_count].x[0] =
net_obj->line->x[found_conn->whichone];
rippers[ripper_count].y[0] =
@@ -971,7 +982,7 @@ int o_net_add_busrippers(TOPLEVEL *w_current, OBJECT *net_obj,
}
net_obj->line->x[found_conn->whichone] += ripper_size;
- o_net_recalc(w_current, net_obj);
+ o_net_recalc(toplevel, net_obj);
rippers[ripper_count].x[0] =
net_obj->line->x[found_conn->whichone];
rippers[ripper_count].y[0] =
@@ -992,11 +1003,11 @@ int o_net_add_busrippers(TOPLEVEL *w_current, OBJECT *net_obj,
}
if (made_changes) {
- s_conn_remove(w_current, net_obj);
+ s_conn_remove(toplevel, net_obj);
if (w_current->bus_ripper_type == COMP_BUS_RIPPER) {
GList *symlist =
- s_clib_search (w_current->bus_ripper_symname, CLIB_EXACT);
+ s_clib_search (toplevel->bus_ripper_symname, CLIB_EXACT);
if (symlist != NULL) {
rippersym = (CLibSymbol *) symlist->data;
}
@@ -1005,34 +1016,34 @@ int o_net_add_busrippers(TOPLEVEL *w_current, OBJECT *net_obj,
for (i = 0; i < ripper_count; i++) {
if (w_current->bus_ripper_type == NET_BUS_RIPPER) {
- w_current->page_current->object_tail =
- o_net_add(w_current, w_current->page_current->object_tail,
+ toplevel->page_current->object_tail =
+ o_net_add(toplevel, toplevel->page_current->object_tail,
OBJ_NET, color,
rippers[i].x[0], rippers[i].y[0],
rippers[i].x[1], rippers[i].y[1]);
} else {
if (rippersym != NULL) {
- w_current->page_current->object_tail =
+ toplevel->page_current->object_tail =
(OBJECT *) o_complex_add(
- w_current,
- w_current->page_current->object_tail,
+ toplevel,
+ toplevel->page_current->object_tail,
NULL,
OBJ_COMPLEX, WHITE,
rippers[i].x[0], rippers[i].y[0],
complex_angle, 0,
rippersym,
- w_current->bus_ripper_symname, 1, TRUE);
+ toplevel->bus_ripper_symname, 1, TRUE);
- o_complex_draw(w_current,w_current->page_current->object_tail);
+ o_complex_draw(w_current,toplevel->page_current->object_tail);
} else {
s_log_message(_("Bus ripper symbol [%s] was not found in any component library\n"),
- w_current->bus_ripper_symname);
+ toplevel->bus_ripper_symname);
}
}
}
- s_conn_update_object(w_current, net_obj);
+ s_conn_update_object(toplevel, net_obj);
return(TRUE);
}
diff --git a/gschem/src/o_picture.c b/gschem/src/o_picture.c
index b0462e3..ccb8d2f 100644
--- a/gschem/src/o_picture.c
+++ b/gschem/src/o_picture.c
@@ -23,6 +23,7 @@
#include <libgeda/libgeda.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -52,18 +53,19 @@
* The other corner will be saved in (<B>w_current->last_x</B>,
* <B>w_current->last_y</B>).
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_picture_start(TOPLEVEL *w_current, int x, int y)
+void o_picture_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
#if DEBUG
printf("o_picture_start called\n");
#endif
/* init start_[x|y], last_[x|y] to describe box */
- w_current->last_x = w_current->start_x = fix_x(w_current, x);
- w_current->last_y = w_current->start_y = fix_y(w_current, y);
+ w_current->last_x = w_current->start_x = fix_x(toplevel, x);
+ w_current->last_y = w_current->start_y = fix_y(toplevel, y);
/* start to draw the box */
o_picture_rubberbox_xor(w_current);
@@ -83,25 +85,26 @@ void o_picture_start(TOPLEVEL *w_current, int x, int y)
* initialized and linked to the object list ; The object is finally
* drawn on the current sheet.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_picture_end(TOPLEVEL *w_current, int x, int y)
+void o_picture_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x1, y1;
int x2, y2;
int picture_width, picture_height;
int picture_left, picture_top;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
/* get the last coords of the pointer */
- w_current->last_x = fix_x(w_current, x);
- w_current->last_y = fix_y(w_current, y);
+ w_current->last_x = fix_x(toplevel, x);
+ w_current->last_y = fix_y(toplevel, y);
/* erase the temporary picture */
o_picture_rubberbox_xor(w_current);
@@ -122,26 +125,26 @@ void o_picture_end(TOPLEVEL *w_current, int x, int y)
}
/* calculate the world coords of the upper left and lower right corners */
- SCREENtoWORLD(w_current, picture_left, picture_top, &x1, &y1);
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel, picture_left, picture_top, &x1, &y1);
+ SCREENtoWORLD(toplevel,
picture_left + picture_width,
picture_top + picture_height, &x2, &y2);
- x1 = snap_grid(w_current, x1);
- y1 = snap_grid(w_current, y1);
- x2 = snap_grid(w_current, x2);
- y2 = snap_grid(w_current, y2);
+ x1 = snap_grid(toplevel, x1);
+ y1 = snap_grid(toplevel, y1);
+ x2 = snap_grid(toplevel, x2);
+ y2 = snap_grid(toplevel, y2);
/* create the object */
- w_current->page_current->object_tail =
- o_picture_add(w_current,
- w_current->page_current->object_tail,
+ toplevel->page_current->object_tail =
+ o_picture_add(toplevel,
+ toplevel->page_current->object_tail,
w_current->current_pixbuf,
w_current->pixbuf_filename,
w_current->pixbuf_wh_ratio,
OBJ_PICTURE, x1, y1, x2, y2, 0, FALSE, FALSE);
/* draw it */
- o_redraw_single(w_current, w_current->page_current->object_tail);
+ o_redraw_single(w_current, toplevel->page_current->object_tail);
#if DEBUG
printf("coords: %d %d %d %d\n", x1, y2, x2, y2);
@@ -152,7 +155,7 @@ void o_picture_end(TOPLEVEL *w_current, int x, int y)
w_current->last_x = (-1);
w_current->last_y = (-1);
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
@@ -162,8 +165,9 @@ void o_picture_end(TOPLEVEL *w_current, int x, int y)
* \par Function Description
* This function creates the add image dialog and loads the selected picture.
*/
-void picture_selection_dialog (TOPLEVEL *w_current)
+void picture_selection_dialog (GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
gchar *filename;
GdkPixbuf *pixbuf;
GError *error = NULL;
@@ -222,7 +226,7 @@ void picture_selection_dialog (TOPLEVEL *w_current)
o_picture_set_pixbuf(w_current, pixbuf, filename);
- w_current->page_current->CHANGED=1;
+ toplevel->page_current->CHANGED=1;
i_set_state(w_current, DRAWPICTURE);
}
g_free (filename);
@@ -242,7 +246,7 @@ void picture_selection_dialog (TOPLEVEL *w_current)
* \note
* used in button cancel code in x_events.c
*/
-void o_picture_eraserubber(TOPLEVEL *w_current)
+void o_picture_eraserubber(GSCHEM_TOPLEVEL *w_current)
{
#if DEBUG
printf("o_picture_eraserubber called\n");
@@ -261,17 +265,18 @@ void o_picture_eraserubber(TOPLEVEL *w_current)
* width, height and left and top values are recomputed by the corresponding
* macros. The box is then erased by performing a xor-drawing over the box.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] x Current x coordinate of pointer in screen units.
* \param [in] y Current y coordinate of pointer in screen units.
*/
-void o_picture_rubberbox(TOPLEVEL *w_current, int x, int y)
+void o_picture_rubberbox(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
#if DEBUG
printf("o_picture_rubberbox called\n");
#endif
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
@@ -284,17 +289,17 @@ void o_picture_rubberbox(TOPLEVEL *w_current, int x, int y)
*/
/* update the coords of the corner */
- w_current->last_x = fix_x(w_current, x);
- w_current->last_y = fix_y(w_current, y);
+ w_current->last_x = fix_x(toplevel, x);
+ w_current->last_y = fix_y(toplevel, y);
/* draw the new temporary box */
o_picture_rubberbox_xor(w_current);
}
-/*! \brief Draw picture from TOPLEVEL object.
+/*! \brief Draw picture from GSCHEM_TOPLEVEL object.
* \par Function Description
- * This function draws the box from the variables in the toplevel
+ * This function draws the box from the variables in the GSCHEM_TOPLEVEL
* structure <B>*w_current</B>.
* One corner of the box is at (<B>w_current->start_x</B>,
* <B>w_current->start_y</B>) and the second corner is at
@@ -303,9 +308,9 @@ void o_picture_rubberbox(TOPLEVEL *w_current, int x, int y)
* The box is drawn with a xor-function over the current sheet with the
* selection color.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
*/
-void o_picture_rubberbox_xor(TOPLEVEL *w_current)
+void o_picture_rubberbox_xor(GSCHEM_TOPLEVEL *w_current)
{
int picture_width, picture_height, picture_left, picture_top;
@@ -339,16 +344,17 @@ void o_picture_rubberbox_xor(TOPLEVEL *w_current)
* This function is used to draw a picture on screen. The picture is
* described in the OBJECT which is referred by <B>o_current</B>. The picture
* is displayed according to the current state, described in the
- * TOPLEVEL object pointed by <B>w_current</B>.
+ * GSCHEM_TOPLEVEL object pointed by <B>w_current</B>.
*
* It first checks if the OBJECT pointed is valid or not. If not it
* returns and do not output anything. That should never happen though.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Picture OBJECT to draw.
*/
-void o_picture_draw(TOPLEVEL *w_current, OBJECT *o_current)
+void o_picture_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int wleft, wright, wtop, wbottom; /* world bounds */
int s_upper_x, s_upper_y, s_lower_x, s_lower_y;
@@ -359,16 +365,16 @@ void o_picture_draw(TOPLEVEL *w_current, OBJECT *o_current)
/* Get read to check for visibility of this line by using it's
* bounding picture
*/
- world_get_picture_bounds(w_current, o_current,
+ world_get_picture_bounds(toplevel, o_current,
&wleft, &wtop, &wright, &wbottom);
- if (!visible(w_current, wleft, wtop, wright, wbottom)) {
+ if (!visible(toplevel, wleft, wtop, wright, wbottom)) {
return;
}
- WORLDtoSCREEN( w_current, o_current->picture->upper_x, o_current->picture->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->upper_x, o_current->picture->upper_y,
&s_upper_x, &s_upper_y );
- WORLDtoSCREEN( w_current, o_current->picture->lower_x, o_current->picture->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->lower_x, o_current->picture->lower_y,
&s_lower_x, &s_lower_y );
#if DEBUG
@@ -390,7 +396,7 @@ void o_picture_draw(TOPLEVEL *w_current, OBJECT *o_current)
o_current->picture->displayed_picture = NULL;
}
/* If it's not drawing using the background color then draw the image */
- if (w_current->override_color != w_current->background_color) {
+ if (toplevel->override_color != toplevel->background_color) {
GdkPixbuf *temp_pixbuf1, *temp_pixbuf2;
/* Create a copy of the pixbuf rotated */
@@ -423,7 +429,7 @@ void o_picture_draw(TOPLEVEL *w_current, OBJECT *o_current)
return;
}
- if (w_current->DONT_REDRAW == 0) {
+ if (toplevel->DONT_REDRAW == 0) {
gdk_draw_pixbuf(w_current->window, w_current->gc,
o_current->picture->displayed_picture,
0, 0, s_upper_x, s_upper_y,
@@ -435,10 +441,10 @@ void o_picture_draw(TOPLEVEL *w_current, OBJECT *o_current)
}
}
else {
- if (w_current->DONT_REDRAW == 0) {
+ if (toplevel->DONT_REDRAW == 0) {
/* Erase the picture, drawing a rectangle with the background color */
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->background_color));
+ x_get_color(toplevel->background_color));
gdk_draw_rectangle(w_current->window, w_current->gc, TRUE,
s_upper_x, s_upper_y,
abs(s_lower_x - s_upper_x),
@@ -455,12 +461,12 @@ void o_picture_draw(TOPLEVEL *w_current, OBJECT *o_current)
if (!o_current->selected) {
/* object is no more selected, erase the grips */
o_current->draw_grips = FALSE;
- if (w_current->DONT_REDRAW == 0) {
+ if (toplevel->DONT_REDRAW == 0) {
o_picture_erase_grips(w_current, o_current);
}
} else {
/* object is selected, draw the grips on the picture */
- if (w_current->DONT_REDRAW == 0) {
+ if (toplevel->DONT_REDRAW == 0) {
o_picture_draw_grips(w_current, o_current);
}
}
@@ -472,11 +478,12 @@ void o_picture_draw(TOPLEVEL *w_current, OBJECT *o_current)
* This function draws four grips on the corners of the picture described
* by <B>*o_current</B>.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Picture OBJECT to draw grip points on.
*/
-void o_picture_draw_grips(TOPLEVEL *w_current, OBJECT *o_current)
+void o_picture_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int s_upper_x, s_upper_y, s_lower_x, s_lower_y;
#if DEBUG
@@ -485,9 +492,9 @@ void o_picture_draw_grips(TOPLEVEL *w_current, OBJECT *o_current)
if (w_current->draw_grips == FALSE)
return;
- WORLDtoSCREEN( w_current, o_current->picture->upper_x, o_current->picture->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->upper_x, o_current->picture->upper_y,
&s_upper_x, &s_upper_y );
- WORLDtoSCREEN( w_current, o_current->picture->lower_x, o_current->picture->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->lower_x, o_current->picture->lower_y,
&s_lower_x, &s_lower_y );
@@ -519,11 +526,12 @@ void o_picture_draw_grips(TOPLEVEL *w_current, OBJECT *o_current)
* This function erases the four grips displayed on the <B>*o_current</B>
* picture object. These grips are on each of the corner.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Picture OBJECT to erase grip marks from.
*/
-void o_picture_erase_grips(TOPLEVEL *w_current, OBJECT *o_current)
+void o_picture_erase_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int s_upper_x, s_upper_y, s_lower_x, s_lower_y;
#if DEBUG
@@ -532,9 +540,9 @@ void o_picture_erase_grips(TOPLEVEL *w_current, OBJECT *o_current)
if (w_current->draw_grips == FALSE)
return;
- WORLDtoSCREEN( w_current, o_current->picture->upper_x, o_current->picture->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->upper_x, o_current->picture->upper_y,
&s_upper_x, &s_upper_y );
- WORLDtoSCREEN( w_current, o_current->picture->lower_x, o_current->picture->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->lower_x, o_current->picture->lower_y,
&s_lower_x, &s_lower_y );
/* grip on upper left corner (whichone = PICTURE_UPPER_LEFT) */
@@ -570,19 +578,20 @@ void o_picture_erase_grips(TOPLEVEL *w_current, OBJECT *o_current)
* the special color. Therefore a picture is drawn with background color
* over the previous one.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] o_current Picture OBJECT to erase.
*/
-void o_picture_erase(TOPLEVEL *w_current, OBJECT *o_current)
+void o_picture_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
#if DEBUG
printf("o_picture_erase called\n");
#endif
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->background_color));
- w_current->override_color = w_current->background_color;
+ x_get_color(toplevel->background_color));
+ toplevel->override_color = toplevel->background_color;
o_picture_draw(w_current, o_current);
- w_current->override_color = -1;
+ toplevel->override_color = -1;
}
/*! \brief Draw a picture described by OBJECT with translation
@@ -594,13 +603,14 @@ void o_picture_erase(TOPLEVEL *w_current, OBJECT *o_current)
*
* The picture is displayed with the color of the object.
*
- * \param [in] w_current The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] dx Delta x coordinate for picture.
* \param [in] dy Delta y coordinate for picture.
* \param [in] o_current Picture OBJECT to draw.
*/
-void o_picture_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
+void o_picture_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int screen_x1, screen_y1;
int screen_x2, screen_y2;
int color;
@@ -612,9 +622,9 @@ void o_picture_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
return;
}
- WORLDtoSCREEN( w_current, o_current->picture->upper_x, o_current->picture->upper_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->upper_x, o_current->picture->upper_y,
&screen_x1, &screen_y1 );
- WORLDtoSCREEN( w_current, o_current->picture->lower_x, o_current->picture->lower_y,
+ WORLDtoSCREEN( toplevel, o_current->picture->lower_x, o_current->picture->lower_y,
&screen_x2, &screen_y2 );
if (o_current->saved_color != -1) {
@@ -639,17 +649,18 @@ void o_picture_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
* This function replaces all pictures in the current selection with a
* new image.
*
- * \param [in] w_current The TOPLEVEL object
+ * \param [in] w_current The GSCHEM_TOPLEVEL object
* \param [in] pixbuf New GdkPixbuf object
* \param [in] filename The filename of the new picture
*
*/
-void o_picture_exchange (TOPLEVEL *w_current, GdkPixbuf *pixbuf,
+void o_picture_exchange (GSCHEM_TOPLEVEL *w_current, GdkPixbuf *pixbuf,
const gchar *filename)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *list;
- list = geda_list_get_glist( w_current->page_current->selection_list );
+ list = geda_list_get_glist( toplevel->page_current->selection_list );
while (list != NULL) {
OBJECT *object;
@@ -701,8 +712,9 @@ void o_picture_exchange (TOPLEVEL *w_current, GdkPixbuf *pixbuf,
*
* \todo Maybe merge this dialog function with picture_selection_dialog()
*/
-void picture_change_filename_dialog (TOPLEVEL *w_current)
+void picture_change_filename_dialog (GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
gchar *filename;
GdkPixbuf *pixbuf;
GError *error = NULL;
@@ -759,14 +771,14 @@ void picture_change_filename_dialog (TOPLEVEL *w_current)
o_erase_rubber(w_current);
w_current->inside_action = 0;
- /* \FIXME Should we set the pixbuf buffer in TOPLEVEL to store
+ /* \FIXME Should we set the pixbuf buffer in GSCHEM_TOPLEVEL to store
the current pixbuf? (Werner)
o_picture_set_pixbuf(w_current, pixbuf, filename); */
o_picture_exchange(w_current, pixbuf, filename);
g_object_unref(pixbuf);
- w_current->page_current->CHANGED=1;
+ toplevel->page_current->CHANGED=1;
}
g_free (filename);
}
@@ -782,11 +794,11 @@ void picture_change_filename_dialog (TOPLEVEL *w_current)
* \brief
* \par Function Description
*
- * \param [in] toplevel The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
* \param [in] pixbuf
* \param [in] filename
*/
-void o_picture_set_pixbuf(TOPLEVEL *toplevel,
+void o_picture_set_pixbuf(GSCHEM_TOPLEVEL *w_current,
GdkPixbuf *pixbuf, char *filename)
{
@@ -796,20 +808,20 @@ void o_picture_set_pixbuf(TOPLEVEL *toplevel,
return;
}
- if (toplevel->current_pixbuf != NULL) {
- g_object_unref(toplevel->current_pixbuf);
- toplevel->current_pixbuf=NULL;
+ if (w_current->current_pixbuf != NULL) {
+ g_object_unref(w_current->current_pixbuf);
+ w_current->current_pixbuf=NULL;
}
- if (toplevel->pixbuf_filename != NULL) {
- g_free(toplevel->pixbuf_filename);
- toplevel->pixbuf_filename=NULL;
+ if (w_current->pixbuf_filename != NULL) {
+ g_free(w_current->pixbuf_filename);
+ w_current->pixbuf_filename=NULL;
}
- toplevel->current_pixbuf = pixbuf;
- toplevel->pixbuf_filename = (char *) g_strdup(filename);
+ w_current->current_pixbuf = pixbuf;
+ w_current->pixbuf_filename = (char *) g_strdup(filename);
- toplevel->pixbuf_wh_ratio = (double) gdk_pixbuf_get_width(pixbuf) /
+ w_current->pixbuf_wh_ratio = (double) gdk_pixbuf_get_width(pixbuf) /
gdk_pixbuf_get_height(pixbuf);
/* be sure to free this pixbuf somewhere */
diff --git a/gschem/src/o_pin.c b/gschem/src/o_pin.c
index ec871ec..851d986 100644
--- a/gschem/src/o_pin.c
+++ b/gschem/src/o_pin.c
@@ -24,6 +24,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/x_states.h"
#include "../include/prototype.h"
@@ -37,8 +38,9 @@
* \par Function Description
*
*/
-void o_pin_draw(TOPLEVEL *w_current, OBJECT *o_current)
+void o_pin_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
int x1, y1, x2, y2; /* screen coords */
@@ -47,8 +49,8 @@ void o_pin_draw(TOPLEVEL *w_current, OBJECT *o_current)
}
/* reuse line's routine */
- if ( (w_current->DONT_REDRAW == 1) ||
- (!o_line_visible(w_current, o_current->line, &x1, &y1, &x2, &y2)) ) {
+ if ( (toplevel->DONT_REDRAW == 1) ||
+ (!o_line_visible(toplevel, o_current->line, &x1, &y1, &x2, &y2)) ) {
return;
}
@@ -56,24 +58,24 @@ void o_pin_draw(TOPLEVEL *w_current, OBJECT *o_current)
printf("drawing pin\n\n");
#endif
- if (w_current->pin_style == THICK ) {
- size = SCREENabs(w_current, PIN_WIDTH);
+ if (toplevel->pin_style == THICK ) {
+ size = SCREENabs(toplevel, PIN_WIDTH);
gdk_gc_set_line_attributes(w_current->gc, size, GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
GDK_JOIN_MITER);
}
- if (w_current->override_color != -1 ) {
+ if (toplevel->override_color != -1 ) {
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->override_color));
- if (w_current->DONT_REDRAW == 0) {
+ x_get_color(toplevel->override_color));
+ if (toplevel->DONT_REDRAW == 0) {
gdk_draw_line(w_current->window, w_current->gc,
x1, y1, x2, y2);
gdk_draw_line(w_current->backingstore, w_current->gc,
x1, y1, x2, y2);
}
} else {
- if (w_current->DONT_REDRAW == 0) {
+ if (toplevel->DONT_REDRAW == 0) {
gdk_gc_set_foreground(w_current->gc, x_get_color(o_current->color));
gdk_draw_line(w_current->window, w_current->gc,
x1, y1, x2, y2);
@@ -86,7 +88,7 @@ void o_pin_draw(TOPLEVEL *w_current, OBJECT *o_current)
o_cue_draw_lowlevel(w_current, o_current, o_current->whichend);
/* yes zero is right for the width -> use hardware lines */
- if (w_current->pin_style == THICK ) {
+ if (toplevel->pin_style == THICK ) {
gdk_gc_set_line_attributes(w_current->gc, 0, GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
GDK_JOIN_MITER);
@@ -115,11 +117,12 @@ void o_pin_draw(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_pin_erase(TOPLEVEL *w_current, OBJECT *o_current)
+void o_pin_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
- w_current->override_color = w_current->background_color;
+ TOPLEVEL *toplevel = w_current->toplevel;
+ toplevel->override_color = toplevel->background_color;
o_pin_draw(w_current, o_current);
- w_current->override_color = -1;
+ toplevel->override_color = -1;
}
/*! \todo Finish function documentation!!!
@@ -127,8 +130,9 @@ void o_pin_erase(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_pin_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
+void o_pin_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
int color;
int sx[2], sy[2];
@@ -145,22 +149,22 @@ void o_pin_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
gdk_gc_set_foreground(w_current->xor_gc, x_get_darkcolor(color));
- if (w_current->pin_style == THICK ) {
- size = SCREENabs(w_current, PIN_WIDTH);
+ if (toplevel->pin_style == THICK ) {
+ size = SCREENabs(toplevel, PIN_WIDTH);
gdk_gc_set_line_attributes(w_current->xor_gc, size,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
GDK_JOIN_MITER);
}
- WORLDtoSCREEN( w_current, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
- WORLDtoSCREEN( w_current, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
+ WORLDtoSCREEN( toplevel, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
gdk_draw_line(w_current->window, w_current->xor_gc,
sx[0]+dx, sy[0]+dy,
sx[1]+dx, sy[1]+dy);
- if (w_current->pin_style == THICK ) {
+ if (toplevel->pin_style == THICK ) {
gdk_gc_set_line_attributes(w_current->xor_gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -173,14 +177,15 @@ void o_pin_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
* \par Function Description
*
*/
-void o_pin_start(TOPLEVEL *w_current, int x, int y)
+void o_pin_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
- w_current->last_x = w_current->start_x = fix_x(w_current, x);
- w_current->last_y = w_current->start_y = fix_y(w_current, y);
+ w_current->last_x = w_current->start_x = fix_x(toplevel, x);
+ w_current->last_y = w_current->start_y = fix_y(toplevel, y);
- if (w_current->pin_style == THICK ) {
- size = SCREENabs(w_current, PIN_WIDTH);
+ if (toplevel->pin_style == THICK ) {
+ size = SCREENabs(toplevel, PIN_WIDTH);
gdk_gc_set_line_attributes(w_current->xor_gc, size,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -193,7 +198,7 @@ void o_pin_start(TOPLEVEL *w_current, int x, int y)
w_current->start_x, w_current->start_y,
w_current->last_x, w_current->last_y);
- if (w_current->pin_style == THICK ) {
+ if (toplevel->pin_style == THICK ) {
gdk_gc_set_line_attributes(w_current->xor_gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -206,8 +211,9 @@ void o_pin_start(TOPLEVEL *w_current, int x, int y)
* \par Function Description
*
*/
-void o_pin_end(TOPLEVEL *w_current, int x, int y)
+void o_pin_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x1, y1;
int x2, y2;
int color;
@@ -215,19 +221,19 @@ void o_pin_end(TOPLEVEL *w_current, int x, int y)
OBJECT *o_current, *o_current_pin;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
- if (w_current->override_pin_color == -1) {
+ if (toplevel->override_pin_color == -1) {
color = w_current->pin_color;
} else {
- color = w_current->override_pin_color;
+ color = toplevel->override_pin_color;
}
/* removed 3/15 to see if we can get pins to be ortho only */
- /* w_current->last_x = fix_x(w_current, x);
- w_current->last_y = fix_y(w_current, y);*/
+ /* w_current->last_x = fix_x(toplevel, x);
+ w_current->last_y = fix_y(toplevel, y);*/
/* don't allow zero length pins */
if ( (w_current->start_x == w_current->last_x) &&
@@ -239,26 +245,26 @@ void o_pin_end(TOPLEVEL *w_current, int x, int y)
return;
}
- SCREENtoWORLD(w_current, w_current->start_x,w_current->start_y, &x1, &y1);
- SCREENtoWORLD(w_current, w_current->last_x, w_current->last_y, &x2, &y2);
- x1 = snap_grid(w_current, x1);
- y1 = snap_grid(w_current, y1);
- x2 = snap_grid(w_current, x2);
- y2 = snap_grid(w_current, y2);
+ SCREENtoWORLD(toplevel, w_current->start_x,w_current->start_y, &x1, &y1);
+ SCREENtoWORLD(toplevel, w_current->last_x, w_current->last_y, &x2, &y2);
+ x1 = snap_grid(toplevel, x1);
+ y1 = snap_grid(toplevel, y1);
+ x2 = snap_grid(toplevel, x2);
+ y2 = snap_grid(toplevel, y2);
- w_current->page_current->object_tail =
- o_pin_add(w_current,
- w_current->page_current->object_tail,
+ toplevel->page_current->object_tail =
+ o_pin_add(toplevel,
+ toplevel->page_current->object_tail,
OBJ_PIN, color,
x1, y1, x2, y2,
PIN_TYPE_NET, 0);
- o_current = o_current_pin = w_current->page_current->object_tail;
+ o_current = o_current_pin = toplevel->page_current->object_tail;
if (scm_hook_empty_p(add_pin_hook) == SCM_BOOL_F &&
o_current != NULL) {
scm_run_hook(add_pin_hook,
- scm_cons(g_make_object_smob(w_current, o_current),
+ scm_cons(g_make_object_smob(toplevel, o_current),
SCM_EOL));
}
@@ -273,7 +279,7 @@ void o_pin_end(TOPLEVEL *w_current, int x, int y)
w_current->start_y = (-1);
w_current->last_x = (-1);
w_current->last_y = (-1);
- w_current->page_current->CHANGED=1;
+ toplevel->page_current->CHANGED=1;
o_undo_savestate(w_current, UNDO_ALL);
}
@@ -283,19 +289,20 @@ void o_pin_end(TOPLEVEL *w_current, int x, int y)
* \par Function Description
*
*/
-void o_pin_rubberpin(TOPLEVEL *w_current, int x, int y)
+void o_pin_rubberpin(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
int diff_x, diff_y;
if (w_current->inside_action == 0) {
- o_redraw(w_current, w_current->page_current->object_head, TRUE);
+ o_redraw(w_current, toplevel->page_current->object_head, TRUE);
return;
}
- size = SCREENabs(w_current, PIN_WIDTH);
+ size = SCREENabs(toplevel, PIN_WIDTH);
- if (w_current->pin_style == THICK ) {
+ if (toplevel->pin_style == THICK ) {
gdk_gc_set_line_attributes(w_current->xor_gc, size,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -308,8 +315,8 @@ void o_pin_rubberpin(TOPLEVEL *w_current, int x, int y)
w_current->start_x, w_current->start_y,
w_current->last_x, w_current->last_y);
- w_current->last_x = fix_x(w_current, x);
- w_current->last_y = fix_y(w_current, y);
+ w_current->last_x = fix_x(toplevel, x);
+ w_current->last_y = fix_y(toplevel, y);
diff_x = abs(w_current->last_x - w_current->start_x);
diff_y = abs(w_current->last_y - w_current->start_y);
@@ -326,7 +333,7 @@ void o_pin_rubberpin(TOPLEVEL *w_current, int x, int y)
w_current->start_x, w_current->start_y,
w_current->last_x, w_current->last_y);
- if (w_current->pin_style == THICK ) {
+ if (toplevel->pin_style == THICK ) {
gdk_gc_set_line_attributes(w_current->xor_gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
@@ -341,12 +348,13 @@ void o_pin_rubberpin(TOPLEVEL *w_current, int x, int y)
* \note
* used in o_stretch.c
*/
-void o_pin_eraserubber(TOPLEVEL *w_current)
+void o_pin_eraserubber(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int size;
- if (w_current->net_style == THICK ) {
- size = SCREENabs(w_current, PIN_WIDTH);
+ if (toplevel->net_style == THICK ) {
+ size = SCREENabs(toplevel, PIN_WIDTH);
if (size < 0)
size=0;
@@ -359,7 +367,7 @@ void o_pin_eraserubber(TOPLEVEL *w_current)
gdk_draw_line(w_current->window, w_current->xor_gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
- if (w_current->net_style == THICK ) {
+ if (toplevel->net_style == THICK ) {
gdk_gc_set_line_attributes(w_current->xor_gc, 0,
GDK_LINE_SOLID,
GDK_CAP_NOT_LAST,
diff --git a/gschem/src/o_select.c b/gschem/src/o_select.c
index 49a3571..422c31a 100644
--- a/gschem/src/o_select.c
+++ b/gschem/src/o_select.c
@@ -35,6 +35,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/x_states.h"
#include "../include/prototype.h"
@@ -48,7 +49,7 @@
* \par Function Description
*
*/
-void o_select_run_hooks(TOPLEVEL *w_current, OBJECT *o_current, int flag)
+void o_select_run_hooks(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int flag)
{
/*
* Run the select_component_hook if the hook has been defined and we
@@ -59,7 +60,7 @@ void o_select_run_hooks(TOPLEVEL *w_current, OBJECT *o_current, int flag)
&& flag == 2 )
{
scm_run_hook(deselect_all_hook,
- scm_cons (g_make_attrib_smob_list(w_current, o_current),
+ scm_cons (g_make_attrib_smob_list(w_current, o_current),
SCM_EOL));
}
@@ -74,7 +75,7 @@ void o_select_run_hooks(TOPLEVEL *w_current, OBJECT *o_current, int flag)
&& flag == 1 )
{
scm_run_hook(select_component_hook,
- scm_cons (g_make_attrib_smob_list(w_current, o_current),
+ scm_cons (g_make_attrib_smob_list(w_current, o_current),
SCM_EOL));
}
@@ -89,7 +90,7 @@ void o_select_run_hooks(TOPLEVEL *w_current, OBJECT *o_current, int flag)
&& flag == 0 )
{
scm_run_hook(deselect_component_hook,
- scm_cons (g_make_attrib_smob_list(w_current, o_current),
+ scm_cons (g_make_attrib_smob_list(w_current, o_current),
SCM_EOL));
}
@@ -104,7 +105,7 @@ void o_select_run_hooks(TOPLEVEL *w_current, OBJECT *o_current, int flag)
&& flag == 1)
{
scm_run_hook(select_net_hook,
- scm_cons (g_make_attrib_smob_list(w_current, o_current),
+ scm_cons (g_make_attrib_smob_list(w_current, o_current),
SCM_EOL));
}
@@ -119,7 +120,7 @@ void o_select_run_hooks(TOPLEVEL *w_current, OBJECT *o_current, int flag)
&& flag == 0)
{
scm_run_hook(deselect_net_hook,
- scm_cons (g_make_attrib_smob_list(w_current, o_current),
+ scm_cons (g_make_attrib_smob_list(w_current, o_current),
SCM_EOL));
}
}
@@ -132,9 +133,10 @@ void o_select_run_hooks(TOPLEVEL *w_current, OBJECT *o_current, int flag)
* type can be either SINGLE meaning selection is a single mouse click
* or it can be MULTIPLE meaning selection is a selection box
*/
-void o_select_object(TOPLEVEL *w_current, OBJECT *o_current,
+void o_select_object(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
int type, int count)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int SHIFTKEY;
int CONTROLKEY;
@@ -163,7 +165,7 @@ void o_select_object(TOPLEVEL *w_current, OBJECT *o_current,
/* result: remove all objects from selection */
if (count == 0 && !CONTROLKEY) {
o_select_run_hooks( w_current, NULL, 2 );
- o_select_unselect_list( w_current, w_current->page_current->selection_list );
+ o_select_unselect_list( w_current, toplevel->page_current->selection_list );
}
break;
@@ -171,7 +173,7 @@ void o_select_object(TOPLEVEL *w_current, OBJECT *o_current,
/* object not select, add it to the selection list */
o_select_run_hooks( w_current, o_current, 1 );
- o_selection_add( w_current->page_current->selection_list, o_current);
+ o_selection_add( toplevel->page_current->selection_list, o_current);
break;
@@ -186,7 +188,7 @@ void o_select_object(TOPLEVEL *w_current, OBJECT *o_current,
/* result: remove object from selection */
if (type != MULTIPLE) {
o_select_run_hooks( w_current, o_current, 0 );
- o_selection_remove( w_current->page_current->selection_list, o_current );
+ o_selection_remove( toplevel->page_current->selection_list, o_current );
}
break;
@@ -200,10 +202,10 @@ void o_select_object(TOPLEVEL *w_current, OBJECT *o_current,
/* 2nd result: add object to selection */
if (type == MULTIPLE && count == 0 && !CONTROLKEY) {
o_select_run_hooks( w_current, NULL, 2 );
- o_select_unselect_list( w_current, w_current->page_current->selection_list );
+ o_select_unselect_list( w_current, toplevel->page_current->selection_list );
o_select_run_hooks( w_current, o_current, 1 );
- o_selection_add( w_current->page_current->selection_list, o_current);
+ o_selection_add( toplevel->page_current->selection_list, o_current);
}
/* condition: doing single object add */
@@ -212,15 +214,15 @@ void o_select_object(TOPLEVEL *w_current, OBJECT *o_current,
/* 2nd result: add object to selection list */
if (type == SINGLE && !CONTROLKEY) {
o_select_run_hooks( w_current, NULL, 2 );
- o_select_unselect_list( w_current, w_current->page_current->selection_list );
+ o_select_unselect_list( w_current, toplevel->page_current->selection_list );
o_select_run_hooks (w_current, o_current, 1);
- o_selection_add( w_current->page_current->selection_list, o_current);
+ o_selection_add( toplevel->page_current->selection_list, o_current);
}
if (CONTROLKEY) {
o_select_run_hooks(w_current, o_current, 0);
- o_selection_remove( w_current->page_current->selection_list, o_current);
+ o_selection_remove( toplevel->page_current->selection_list, o_current);
}
break;
@@ -229,7 +231,7 @@ void o_select_object(TOPLEVEL *w_current, OBJECT *o_current,
}
/* do the attributes */
- o_attrib_add_selected(w_current, w_current->page_current->selection_list, o_current);
+ o_attrib_add_selected(w_current, toplevel->page_current->selection_list, o_current);
/* finally redraw object */
o_redraw_single(w_current, o_current);
@@ -240,7 +242,7 @@ void o_select_object(TOPLEVEL *w_current, OBJECT *o_current,
* \par Function Description
*
*/
-void o_select_box_start(TOPLEVEL *w_current, int x, int y)
+void o_select_box_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
int box_width, box_height;
@@ -266,7 +268,7 @@ void o_select_box_start(TOPLEVEL *w_current, int x, int y)
* \par Function Description
*
*/
-void o_select_box_end(TOPLEVEL *w_current, int x, int y)
+void o_select_box_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
int box_width, box_height;
int box_left, box_top;
@@ -301,7 +303,7 @@ void o_select_box_end(TOPLEVEL *w_current, int x, int y)
* \par Function Description
*
*/
-void o_select_box_rubberband(TOPLEVEL *w_current, int x, int y)
+void o_select_box_rubberband(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
int box_width, box_height;
int box_left, box_top;
@@ -361,8 +363,9 @@ void o_select_box_rubberband(TOPLEVEL *w_current, int x, int y)
* \par Function Description
*
*/
-void o_select_box_search(TOPLEVEL *w_current)
+void o_select_box_search(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current=NULL;
int count = 0; /* object count */
int SHIFTKEY = w_current->SHIFTKEY;
@@ -382,16 +385,16 @@ void o_select_box_search(TOPLEVEL *w_current)
w_current->start_y = tmp;
}
- SCREENtoWORLD( w_current, w_current->start_x, w_current->start_y, &w_start_x, &w_start_y );
- SCREENtoWORLD( w_current, w_current->last_x, w_current->last_y, &w_last_x, &w_last_y );
+ SCREENtoWORLD( toplevel, w_current->start_x, w_current->start_y, &w_start_x, &w_start_y );
+ SCREENtoWORLD( toplevel, w_current->last_x, w_current->last_y, &w_last_x, &w_last_y );
- o_current = w_current->page_current->object_head;
+ o_current = toplevel->page_current->object_head;
while (o_current != NULL) {
/* only select visible objects */
if (o_current->type != OBJ_HEAD &&
(o_current->visibility == VISIBLE ||
- (o_current->visibility == INVISIBLE && w_current->show_hidden_text))) {
+ (o_current->visibility == INVISIBLE && toplevel->show_hidden_text))) {
if ( o_current->w_left >= w_start_x &&
o_current->w_right <= w_last_x &&
@@ -410,19 +413,20 @@ void o_select_box_search(TOPLEVEL *w_current)
/* key was pressed */
if (count == 0 && !SHIFTKEY) {
o_select_run_hooks( w_current, NULL, 2 );
- o_select_unselect_list( w_current, w_current->page_current->selection_list );
+ o_select_unselect_list( w_current, toplevel->page_current->selection_list );
}
i_update_menus(w_current);
}
/* This is a wrapper for o_selection_return_first_object */
/* This function always looks at the current page selection list */
-OBJECT *o_select_return_first_object(TOPLEVEL *w_current)
+OBJECT *o_select_return_first_object(GSCHEM_TOPLEVEL *w_current)
{
- if (! (w_current && w_current->page_current && geda_list_get_glist( w_current->page_current->selection_list )))
+ TOPLEVEL *toplevel = w_current->toplevel;
+ if (! (w_current && toplevel->page_current && geda_list_get_glist( toplevel->page_current->selection_list )))
return NULL;
else
- return (OBJECT *)g_list_first( geda_list_get_glist( w_current->page_current->selection_list ))->data;
+ return (OBJECT *)g_list_first( geda_list_get_glist( toplevel->page_current->selection_list ))->data;
}
/*! \todo Finish function documentation!!!
@@ -432,9 +436,10 @@ OBJECT *o_select_return_first_object(TOPLEVEL *w_current)
* \return TRUE if the selection list is not empty, otherwise false.
* also make sure item is valid
*/
-int o_select_selected(TOPLEVEL *w_current)
+int o_select_selected(GSCHEM_TOPLEVEL *w_current)
{
- if ( geda_list_get_glist( w_current->page_current->selection_list )) {
+ TOPLEVEL *toplevel = w_current->toplevel;
+ if ( geda_list_get_glist( toplevel->page_current->selection_list )) {
return(TRUE);
}
return(FALSE);
@@ -444,10 +449,10 @@ int o_select_selected(TOPLEVEL *w_current)
/*! \brief Unselects all the objects in the given list.
* \par Unselects all objects in the given list, does the
* needed work to make the objects visually unselected, and redraw them.
- * \param [in] toplevel TOPLEVEL struct.
- * \param [in] head Pointer to the selection list
+ * \param [in] w_current GSCHEM_TOPLEVEL struct.
+ * \param [in] head Pointer to the selection list
*/
-void o_select_unselect_list(TOPLEVEL *w_current, SELECTION *selection)
+void o_select_unselect_list(GSCHEM_TOPLEVEL *w_current, SELECTION *selection)
{
const GList *list = geda_list_get_glist( selection );
@@ -466,10 +471,11 @@ void o_select_unselect_list(TOPLEVEL *w_current, SELECTION *selection)
* \par Function Description
*
*/
-void o_select_unselect_all(TOPLEVEL *w_current)
+void o_select_unselect_all(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
o_select_run_hooks( w_current, NULL, 2 );
- o_select_unselect_list( w_current, w_current->page_current->selection_list );
+ o_select_unselect_list( w_current, toplevel->page_current->selection_list );
}
/*! \todo Finish function documentation!!!
@@ -478,12 +484,13 @@ void o_select_unselect_all(TOPLEVEL *w_current)
*
*/
void
-o_select_move_to_place_list(TOPLEVEL *w_current)
+o_select_move_to_place_list(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *selection;
OBJECT *o_current;
- selection = geda_list_get_glist( w_current->page_current->selection_list );
+ selection = geda_list_get_glist( toplevel->page_current->selection_list );
if (!selection) {
return;
@@ -492,7 +499,7 @@ o_select_move_to_place_list(TOPLEVEL *w_current)
while (selection) {
o_current = (OBJECT *) selection->data;
if (o_current) {
- w_current->page_current->complex_place_list = g_list_append(w_current->page_current->complex_place_list,
+ toplevel->page_current->complex_place_list = g_list_append(toplevel->page_current->complex_place_list,
o_current);
}
selection = g_list_next(selection);
diff --git a/gschem/src/o_slot.c b/gschem/src/o_slot.c
index da09198..e857d0b 100644
--- a/gschem/src/o_slot.c
+++ b/gschem/src/o_slot.c
@@ -26,6 +26,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -40,7 +41,7 @@
* \par Function Description
*
*/
-void o_slot_start(TOPLEVEL *w_current, OBJECT *list)
+void o_slot_start(GSCHEM_TOPLEVEL *w_current, OBJECT *list)
{
OBJECT *object;
OBJECT *slot_text_object;
@@ -110,8 +111,9 @@ void o_slot_start(TOPLEVEL *w_current, OBJECT *list)
* \par Function Description
*
*/
-void o_slot_end(TOPLEVEL *w_current, char *string, int len)
+void o_slot_end(GSCHEM_TOPLEVEL *w_current, char *string, int len)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *object;
OBJECT *temp;
char *slot_value;
@@ -181,16 +183,16 @@ void o_slot_end(TOPLEVEL *w_current, char *string, int len)
temp = slot_text_object;
if (temp->visibility == VISIBLE ||
- (temp->visibility == INVISIBLE && w_current->show_hidden_text)) {
+ (temp->visibility == INVISIBLE && toplevel->show_hidden_text)) {
o_erase_single(w_current,temp);
}
- o_text_recreate(w_current, temp);
+ o_text_recreate(toplevel, temp);
/* this doesn't deal with the selection list
* item */
if (temp->visibility == VISIBLE ||
- (temp->visibility == INVISIBLE && w_current->show_hidden_text)) {
+ (temp->visibility == INVISIBLE && toplevel->show_hidden_text)) {
o_redraw_single(w_current,temp);
}
@@ -199,10 +201,10 @@ void o_slot_end(TOPLEVEL *w_current, char *string, int len)
} else {
/* here you need to do the add the slot
attribute since it doesn't exist */
- w_current->page_current->object_tail =
+ toplevel->page_current->object_tail =
(OBJECT *) o_text_add(
- w_current,
- w_current->page_current->object_tail,
+ toplevel,
+ toplevel->page_current->object_tail,
OBJ_TEXT, w_current->text_color,
object->complex->x, object->complex->y,
LOWER_LEFT,
@@ -214,21 +216,21 @@ void o_slot_end(TOPLEVEL *w_current, char *string, int len)
/* manually attach attribute */
/* NEWSEL this is okay too, since tail is single obj */
- o_attrib_attach(w_current,
- w_current->page_current->object_head,
- w_current->page_current->object_tail,
+ o_attrib_attach(toplevel,
+ toplevel->page_current->object_head,
+ toplevel->page_current->object_tail,
object);
slot_text_object =
- w_current->page_current->object_tail;
+ toplevel->page_current->object_tail;
}
o_erase_single(w_current, object);
- o_attrib_slot_update(w_current, object);
+ o_attrib_slot_update(toplevel, object);
o_redraw_single(w_current,object);
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
if (name) g_free(name);
if (value) g_free(value);
diff --git a/gschem/src/o_text.c b/gschem/src/o_text.c
index 509b31d..4512867 100644
--- a/gschem/src/o_text.c
+++ b/gschem/src/o_text.c
@@ -31,6 +31,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -49,21 +50,22 @@
* \par Function Description
*
*/
-void o_text_draw_lowlevel(TOPLEVEL *w_current, OBJECT *o_current)
+void o_text_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int left, right, top, bottom;
g_return_if_fail (o_current != NULL);
g_return_if_fail (o_current->text != NULL);
- if (o_current->visibility == INVISIBLE && w_current->show_hidden_text &&
+ if (o_current->visibility == INVISIBLE && toplevel->show_hidden_text &&
o_current->text->prim_objs == NULL) {
- o_text_recreate(w_current, o_current);
+ o_text_recreate(toplevel, o_current);
}
o_redraw(w_current, o_current->text->prim_objs, TRUE);
- world_get_object_list_bounds(w_current, o_current->text->prim_objs,
+ world_get_object_list_bounds(toplevel, o_current->text->prim_objs,
&left, &top, &right, &bottom);
o_current->w_left = left;
o_current->w_top = top;
@@ -77,31 +79,32 @@ void o_text_draw_lowlevel(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_text_draw_rectangle(TOPLEVEL *w_current, OBJECT *o_current)
+void o_text_draw_rectangle(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int left=0, right=0, top=0, bottom=0;
GdkColor *color;
- if (o_current->visibility == INVISIBLE && w_current->show_hidden_text &&
+ if (o_current->visibility == INVISIBLE && toplevel->show_hidden_text &&
o_current->text->prim_objs == NULL) {
- o_text_recreate(w_current, o_current);
+ o_text_recreate(toplevel, o_current);
}
/* text is too small so go through and draw a rectangle in
it's place */
/* NOTE THAT THE TOP AND BOTTOM ARE REVERSED THROUGHT THE WHOLE OF GEDA FOR WORLD COORDS */
- WORLDtoSCREEN( w_current, o_current->w_left, o_current->w_bottom, &left, &top );
- WORLDtoSCREEN( w_current, o_current->w_right, o_current->w_top, &right, &bottom );
+ WORLDtoSCREEN( toplevel, o_current->w_left, o_current->w_bottom, &left, &top );
+ WORLDtoSCREEN( toplevel, o_current->w_right, o_current->w_top, &right, &bottom );
- if (w_current->override_color != -1 ) { /* Override */
- color = x_get_color(w_current->override_color);
+ if (toplevel->override_color != -1 ) { /* Override */
+ color = x_get_color(toplevel->override_color);
} else {
color = x_get_color(o_current->color);
}
gdk_gc_set_foreground(w_current->gc, color);
- if (w_current->DONT_REDRAW == 0) {
+ if (toplevel->DONT_REDRAW == 0) {
gdk_draw_rectangle( w_current->window,
w_current->gc,
FALSE,
@@ -124,8 +127,9 @@ void o_text_draw_rectangle(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_text_draw(TOPLEVEL *w_current, OBJECT *o_current)
+void o_text_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int screen_x1, screen_y1;
int small_dist, offset;
@@ -133,7 +137,7 @@ void o_text_draw(TOPLEVEL *w_current, OBJECT *o_current)
g_return_if_fail (o_current->type == OBJ_TEXT);
g_return_if_fail (o_current->text != NULL);
- if (o_current->visibility == INVISIBLE && !w_current->show_hidden_text) {
+ if (o_current->visibility == INVISIBLE && !toplevel->show_hidden_text) {
return;
}
@@ -142,22 +146,22 @@ void o_text_draw(TOPLEVEL *w_current, OBJECT *o_current)
/* Indicate on the schematic that the text is invisible by */
/* drawing a little I on the screen at the origin */
- if (o_current->visibility == INVISIBLE && w_current->show_hidden_text) {
- if (w_current->override_color != -1 ) {
+ if (o_current->visibility == INVISIBLE && toplevel->show_hidden_text) {
+ if (toplevel->override_color != -1 ) {
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->override_color));
+ x_get_color(toplevel->override_color));
} else {
gdk_gc_set_foreground(w_current->gc,
x_get_color(w_current->lock_color));
}
- offset = SCREENabs(w_current, 10);
- small_dist = SCREENabs(w_current, 20);
- WORLDtoSCREEN( w_current, o_current->text->x, o_current->text->y, &screen_x1, &screen_y1 );
+ offset = SCREENabs(toplevel, 10);
+ small_dist = SCREENabs(toplevel, 20);
+ WORLDtoSCREEN( toplevel, o_current->text->x, o_current->text->y, &screen_x1, &screen_y1 );
screen_x1 += offset;
screen_y1 += offset;
- if (w_current->DONT_REDRAW == 0) {
+ if (toplevel->DONT_REDRAW == 0) {
/* Top part of the I */
gdk_draw_line(w_current->window, w_current->gc,
screen_x1,
@@ -206,9 +210,9 @@ void o_text_draw(TOPLEVEL *w_current, OBJECT *o_current)
return;
}
- small_dist = SCREENabs(w_current, 10);
+ small_dist = SCREENabs(toplevel, 10);
- WORLDtoSCREEN( w_current, o_current->text->x, o_current->text->y, &screen_x1, &screen_y1 );
+ WORLDtoSCREEN( toplevel, o_current->text->x, o_current->text->y, &screen_x1, &screen_y1 );
/* this is not really a fix, but a lame patch */
/* not having this will cause a bad draw of things when coords */
@@ -217,16 +221,16 @@ void o_text_draw(TOPLEVEL *w_current, OBJECT *o_current)
return;
}
- if (w_current->override_color != -1 ) {
+ if (toplevel->override_color != -1 ) {
gdk_gc_set_foreground(w_current->gc,
- x_get_color(w_current->override_color));
+ x_get_color(toplevel->override_color));
} else {
gdk_gc_set_foreground(w_current->gc,
x_get_color(w_current->lock_color));
}
- if (w_current->DONT_REDRAW == 0) {
+ if (toplevel->DONT_REDRAW == 0) {
gdk_draw_line(w_current->window, w_current->gc,
screen_x1-small_dist,
screen_y1+small_dist,
@@ -256,11 +260,12 @@ void o_text_draw(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_text_erase(TOPLEVEL *w_current, OBJECT *o_current)
+void o_text_erase(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
- w_current->override_color = w_current->background_color;
+ TOPLEVEL *toplevel = w_current->toplevel;
+ toplevel->override_color = toplevel->background_color;
o_text_draw(w_current, o_current);
- w_current->override_color = -1;
+ toplevel->override_color = -1;
}
/*! \todo Finish function documentation!!!
@@ -268,17 +273,18 @@ void o_text_erase(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_text_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
+void o_text_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int top, bottom, left, right;
int color, factor;
- if (o_current->visibility == INVISIBLE && !w_current->show_hidden_text) {
+ if (o_current->visibility == INVISIBLE && !toplevel->show_hidden_text) {
return;
}
/* always display text which is 12 or larger */
- factor = (int) w_current->page_current->to_world_x_constant;
+ factor = (int) toplevel->page_current->to_world_x_constant;
if ((factor < w_current->text_display_zoomfactor) ||
o_current->text->size >= 12 ||
w_current->text_feedback == ALWAYS) {
@@ -288,8 +294,8 @@ void o_text_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
it's place */
/* NOTE THAT THE TOP AND BOTTOM ARE REVERSED THROUGHT THE WHOLE OF GEDA FOR WORLD COORDS */
- WORLDtoSCREEN( w_current, o_current->w_left, o_current->w_bottom, &left, &top );
- WORLDtoSCREEN( w_current, o_current->w_right, o_current->w_top, &right, &bottom );
+ WORLDtoSCREEN( toplevel, o_current->w_left, o_current->w_bottom, &left, &top );
+ WORLDtoSCREEN( toplevel, o_current->w_right, o_current->w_top, &right, &bottom );
if (o_current->saved_color != -1) {
color = o_current->saved_color;
@@ -316,29 +322,30 @@ void o_text_draw_xor(TOPLEVEL *w_current, int dx, int dy, OBJECT *o_current)
* \par Function Description
*
*/
-void o_text_start(TOPLEVEL *w_current, int screen_x, int screen_y)
+void o_text_start(GSCHEM_TOPLEVEL *w_current, int screen_x, int screen_y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int x, y;
int temp, i;
char *value;
- w_current->last_x = w_current->start_x = fix_x(w_current, screen_x);
- w_current->last_y = w_current->start_y = fix_y(w_current, screen_y);
+ w_current->last_x = w_current->start_x = fix_x(toplevel, screen_x);
+ w_current->last_y = w_current->start_y = fix_y(toplevel, screen_y);
w_current->last_drawb_mode = -1;
/* make sure list is null first, so that you don't have a mem leak */
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->start_x,
w_current->start_y,
&x,
&y);
/* remove the old attrib list if it exists */
- s_delete_object_glist(w_current, w_current->page_current->attrib_place_list);
- w_current->page_current->attrib_place_list = NULL;
+ s_delete_object_glist(toplevel, toplevel->page_current->attrib_place_list);
+ toplevel->page_current->attrib_place_list = NULL;
- value = w_current->current_attribute;
+ value = toplevel->current_attribute;
switch(w_current->text_caps) {
case(LOWER):
@@ -356,13 +363,13 @@ void o_text_start(TOPLEVEL *w_current, int screen_x, int screen_y)
}
/* here you need to add OBJ_TEXT when it's done */
- w_current->page_current->attrib_place_list =
- g_list_append(w_current->page_current->attrib_place_list,
- o_text_add(w_current, NULL,
+ toplevel->page_current->attrib_place_list =
+ g_list_append(toplevel->page_current->attrib_place_list,
+ o_text_add(toplevel, NULL,
/* type changed from TEXT to TEXT */
OBJ_TEXT, w_current->text_color,
x, y, LOWER_LEFT, 0, /* zero is angle */
- w_current->current_attribute,
+ toplevel->current_attribute,
w_current->text_size,
/* has to be visible so you can place it */
/* visibility is set when you create the object */
@@ -375,7 +382,7 @@ void o_text_start(TOPLEVEL *w_current, int screen_x, int screen_y)
}
}
- o_drawbounding(w_current, w_current->page_current->attrib_place_list,
+ o_drawbounding(w_current, toplevel->page_current->attrib_place_list,
x_get_darkcolor(w_current->bb_color), TRUE);
}
@@ -384,30 +391,31 @@ void o_text_start(TOPLEVEL *w_current, int screen_x, int screen_y)
* \par Function Description
*
*/
-void o_text_end(TOPLEVEL *w_current)
+void o_text_end(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
/*! \todo get consistant names */
int world_x, world_y;
- SCREENtoWORLD(w_current,
+ SCREENtoWORLD(toplevel,
w_current->last_x,
w_current->last_y,
&world_x,
&world_y);
- world_x = snap_grid(w_current, world_x);
- world_y = snap_grid(w_current, world_y);
+ world_x = snap_grid(toplevel, world_x);
+ world_y = snap_grid(toplevel, world_y);
/* here you need to add OBJ_TEXT when it's done */
/*! \todo make this VIS and SHOW default configurable */
- w_current->page_current->object_tail =
- o_text_add(w_current, w_current->page_current->object_tail,
+ toplevel->page_current->object_tail =
+ o_text_add(toplevel, toplevel->page_current->object_tail,
/* type changed from TEXT to TEXT */
OBJ_TEXT,
w_current->text_color,
world_x, world_y, LOWER_LEFT,
w_current->complex_rotate,
- w_current->current_attribute,
+ toplevel->current_attribute,
w_current->text_size,
VISIBLE, SHOW_NAME_VALUE);
@@ -416,28 +424,28 @@ void o_text_end(TOPLEVEL *w_current)
/* erase the old bounding box / outline */
if (w_current->actionfeedback_mode == OUTLINE) {
- o_drawbounding(w_current, w_current->page_current->attrib_place_list,
+ o_drawbounding(w_current, toplevel->page_current->attrib_place_list,
x_get_color(w_current->text_color), FALSE);
} else {
- o_drawbounding(w_current, w_current->page_current->attrib_place_list,
+ o_drawbounding(w_current, toplevel->page_current->attrib_place_list,
x_get_darkcolor(w_current->select_color), FALSE);
}
- w_current->override_color = -1;
+ toplevel->override_color = -1;
- w_current->page_current->CHANGED=1;
+ toplevel->page_current->CHANGED=1;
o_select_unselect_all( w_current );
- o_selection_add( w_current->page_current->selection_list, w_current->page_current->object_tail );
+ o_selection_add( toplevel->page_current->selection_list, toplevel->page_current->object_tail );
/* object_tail is the object that was just added */
- if (w_current->page_current->object_tail->draw_func != NULL &&
- w_current->page_current->object_tail->type != OBJ_HEAD) {
- (*w_current->page_current->object_tail->draw_func)(
+ if (toplevel->page_current->object_tail->draw_func != NULL &&
+ toplevel->page_current->object_tail->type != OBJ_HEAD) {
+ (*toplevel->page_current->object_tail->draw_func)(
w_current,
- w_current->page_current->object_tail);
+ toplevel->page_current->object_tail);
}
- w_current->override_color = -1;
+ toplevel->override_color = -1;
o_undo_savestate(w_current, UNDO_ALL);
i_update_menus(w_current);
}
@@ -447,9 +455,10 @@ void o_text_end(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void o_text_rubberattrib(TOPLEVEL *w_current)
+void o_text_rubberattrib(GSCHEM_TOPLEVEL *w_current)
{
- o_drawbounding(w_current, w_current->page_current->attrib_place_list,
+ o_drawbounding(w_current,
+ w_current->toplevel->page_current->attrib_place_list,
x_get_darkcolor(w_current->bb_color), FALSE);
}
@@ -458,7 +467,7 @@ void o_text_rubberattrib(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void o_text_edit(TOPLEVEL *w_current, OBJECT *o_current)
+void o_text_edit(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
/* you need to check to make sure only one object is selected */
/* no actually this is okay... not here in o_edit */
@@ -472,16 +481,17 @@ void o_text_edit(TOPLEVEL *w_current, OBJECT *o_current)
* \par Function Description
*
*/
-void o_text_edit_end(TOPLEVEL *w_current, char *string, int len, int text_size,
+void o_text_edit_end(GSCHEM_TOPLEVEL *w_current, char *string, int len, int text_size,
int text_alignment)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *object;
GList *s_current;
int numselect;
/* skip over head */
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
- numselect = g_list_length( geda_list_get_glist( w_current->page_current->selection_list ));
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
+ numselect = g_list_length( geda_list_get_glist( toplevel->page_current->selection_list ));
while(s_current != NULL) {
object = (OBJECT *) s_current->data;
@@ -509,7 +519,7 @@ void o_text_edit_end(TOPLEVEL *w_current, char *string, int len, int text_size,
object->saved_color = w_current->edit_color;
o_text_erase(w_current, object);
- o_text_recreate(w_current, object);
+ o_text_recreate(toplevel, object);
o_text_draw(w_current, object);
}
@@ -518,7 +528,7 @@ void o_text_edit_end(TOPLEVEL *w_current, char *string, int len, int text_size,
s_current = g_list_next(s_current);
}
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
}
@@ -530,9 +540,10 @@ void o_text_edit_end(TOPLEVEL *w_current, char *string, int len, int text_size,
* The object passed in should be the REAL object, NOT any copy in any
* selection list
*/
-void o_text_change(TOPLEVEL *w_current, OBJECT *object, char *string,
+void o_text_change(GSCHEM_TOPLEVEL *w_current, OBJECT *object, char *string,
int visibility, int show)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
if (object == NULL) {
return;
}
@@ -552,7 +563,7 @@ void o_text_change(TOPLEVEL *w_current, OBJECT *object, char *string,
object->text->string = g_strdup (string);
object->visibility = visibility;
object->show_name_value = show;
- o_text_recreate(w_current, object);
+ o_text_recreate(toplevel, object);
o_text_draw(w_current, object);
/* handle slot= attribute, it's a special case */
@@ -560,7 +571,7 @@ void o_text_change(TOPLEVEL *w_current, OBJECT *object, char *string,
o_slot_end (w_current, string, strlen (string));
}
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
}
/*! \todo Finish function documentation!!!
@@ -568,15 +579,16 @@ void o_text_change(TOPLEVEL *w_current, OBJECT *object, char *string,
* \par Function Description
*
*/
-void o_text_place_rotate(TOPLEVEL *w_current)
+void o_text_place_rotate(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current;
GList *iter;
int x_local = -1;
int y_local = -1;
- for (iter = w_current->page_current->attrib_place_list;
+ for (iter = toplevel->page_current->attrib_place_list;
iter != NULL;
iter = g_list_next(iter)) {
o_current = iter->data;
@@ -593,14 +605,14 @@ void o_text_place_rotate(TOPLEVEL *w_current)
return;
}
- for (iter = w_current->page_current->attrib_place_list;
+ for (iter = toplevel->page_current->attrib_place_list;
iter != NULL;
iter = g_list_next(iter)) {
o_current = iter->data;
switch(o_current->type) {
case(OBJ_TEXT):
- o_text_rotate_world(w_current, x_local, y_local, 90, o_current);
+ o_text_rotate_world(toplevel, x_local, y_local, 90, o_current);
break;
}
}
diff --git a/gschem/src/o_undo.c b/gschem/src/o_undo.c
index 5b60b17..1d9ab68 100644
--- a/gschem/src/o_undo.c
+++ b/gschem/src/o_undo.c
@@ -30,6 +30,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -79,8 +80,9 @@ void o_undo_init(void)
* <DT>*</DT><DD>UNDO_VIEWPORT_ONLY
* </DL>
*/
-void o_undo_savestate(TOPLEVEL *w_current, int flag)
+void o_undo_savestate(GSCHEM_TOPLEVEL *w_current, int flag)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
char *filename = NULL;
OBJECT *object_head = NULL;
int levels;
@@ -98,8 +100,8 @@ void o_undo_savestate(TOPLEVEL *w_current, int flag)
/* Increment the number of operations since last backup if
auto-save is enabled */
- if (w_current->auto_save_interval != 0) {
- w_current->page_current->ops_since_last_backup++;
+ if (toplevel->auto_save_interval != 0) {
+ toplevel->page_current->ops_since_last_backup++;
}
/* 32 is? for max length of pid and index */
@@ -116,61 +118,61 @@ void o_undo_savestate(TOPLEVEL *w_current, int flag)
/* f_save manages the creaton of backup copies.
This way, f_save is called only when saving a file, and not when
saving an undo backup copy */
- o_save(w_current, filename);
+ o_save(toplevel, filename);
} else if (w_current->undo_type == UNDO_MEMORY && flag == UNDO_ALL) {
/* Increment the number of operations since last backup if
auto-save is enabled */
- if (w_current->auto_save_interval != 0) {
- w_current->page_current->ops_since_last_backup++;
+ if (toplevel->auto_save_interval != 0) {
+ toplevel->page_current->ops_since_last_backup++;
}
object_head = s_basic_init_object("undo_head");
- o_list_copy_all(w_current,
- w_current->page_current->object_head->next,
+ o_list_copy_all(toplevel,
+ toplevel->page_current->object_head->next,
object_head, NORMAL_FLAG);
}
/* Clear Anything above current */
- if (w_current->page_current->undo_current) {
- s_undo_remove_rest(w_current,
- w_current->page_current->undo_current->next);
- w_current->page_current->undo_current->next = NULL;
+ if (toplevel->page_current->undo_current) {
+ s_undo_remove_rest(toplevel,
+ toplevel->page_current->undo_current->next);
+ toplevel->page_current->undo_current->next = NULL;
} else { /* undo current is NULL */
- s_undo_remove_rest(w_current,
- w_current->page_current->undo_bottom);
- w_current->page_current->undo_bottom = NULL;
+ s_undo_remove_rest(toplevel,
+ toplevel->page_current->undo_bottom);
+ toplevel->page_current->undo_bottom = NULL;
}
- w_current->page_current->undo_tos = w_current->page_current->undo_current;
+ toplevel->page_current->undo_tos = toplevel->page_current->undo_current;
- w_current->page_current->undo_tos =
- s_undo_add(w_current->page_current->undo_tos,
+ toplevel->page_current->undo_tos =
+ s_undo_add(toplevel->page_current->undo_tos,
flag, filename, object_head,
- w_current->page_current->left,
- w_current->page_current->top,
- w_current->page_current->right,
- w_current->page_current->bottom,
- w_current->page_current->page_control,
- w_current->page_current->up);
-
- w_current->page_current->undo_current =
- w_current->page_current->undo_tos;
-
- if (w_current->page_current->undo_bottom == NULL) {
- w_current->page_current->undo_bottom =
- w_current->page_current->undo_tos;
+ toplevel->page_current->left,
+ toplevel->page_current->top,
+ toplevel->page_current->right,
+ toplevel->page_current->bottom,
+ toplevel->page_current->page_control,
+ toplevel->page_current->up);
+
+ toplevel->page_current->undo_current =
+ toplevel->page_current->undo_tos;
+
+ if (toplevel->page_current->undo_bottom == NULL) {
+ toplevel->page_current->undo_bottom =
+ toplevel->page_current->undo_tos;
}
#if DEBUG
printf("\n\n---Undo----\n");
- s_undo_print_all(w_current->page_current->undo_bottom);
- printf("BOTTOM: %s\n", w_current->page_current->undo_bottom->filename);
- printf("TOS: %s\n", w_current->page_current->undo_tos->filename);
- printf("CURRENT: %s\n", w_current->page_current->undo_current->filename);
+ s_undo_print_all(toplevel->page_current->undo_bottom);
+ printf("BOTTOM: %s\n", toplevel->page_current->undo_bottom->filename);
+ printf("TOS: %s\n", toplevel->page_current->undo_tos->filename);
+ printf("CURRENT: %s\n", toplevel->page_current->undo_current->filename);
printf("----\n");
#endif
@@ -186,7 +188,7 @@ void o_undo_savestate(TOPLEVEL *w_current, int flag)
return;
}
- levels = s_undo_levels(w_current->page_current->undo_bottom);
+ levels = s_undo_levels(toplevel->page_current->undo_bottom);
#if DEBUG
printf("levels: %d\n", levels);
@@ -199,7 +201,7 @@ void o_undo_savestate(TOPLEVEL *w_current, int flag)
printf("Trimming: %d levels\n", levels);
#endif
- u_current = w_current->page_current->undo_bottom;
+ u_current = toplevel->page_current->undo_bottom;
while(u_current && levels > 0) {
u_current_next = u_current->next;
@@ -212,7 +214,7 @@ void o_undo_savestate(TOPLEVEL *w_current, int flag)
}
if (u_current->object_head) {
- s_delete_list_fromstart(w_current,
+ s_delete_list_fromstart(toplevel,
u_current->object_head);
u_current->object_head = NULL;
}
@@ -228,7 +230,7 @@ void o_undo_savestate(TOPLEVEL *w_current, int flag)
/* Because we use a pad you are always garanteed to never */
/* exhaust the list */
u_current->prev = NULL;
- w_current->page_current->undo_bottom = u_current;
+ toplevel->page_current->undo_bottom = u_current;
#if DEBUG
printf("New current is: %s\n", u_current->filename);
@@ -237,10 +239,10 @@ void o_undo_savestate(TOPLEVEL *w_current, int flag)
#if DEBUG
printf("\n\n---Undo----\n");
- s_undo_print_all(w_current->page_current->undo_bottom);
- printf("BOTTOM: %s\n", w_current->page_current->undo_bottom->filename);
- printf("TOS: %s\n", w_current->page_current->undo_tos->filename);
- printf("CURRENT: %s\n", w_current->page_current->undo_current->filename);
+ s_undo_print_all(toplevel->page_current->undo_bottom);
+ printf("BOTTOM: %s\n", toplevel->page_current->undo_bottom->filename);
+ printf("TOS: %s\n", toplevel->page_current->undo_tos->filename);
+ printf("CURRENT: %s\n", toplevel->page_current->undo_current->filename);
printf("----\n");
#endif
@@ -298,8 +300,9 @@ OBJECT *o_undo_find_prev_object_head(UNDO *start)
* <DT>*</DT><DD>REDO_ACTION
* </DL>
*/
-void o_undo_callback(TOPLEVEL *w_current, int type)
+void o_undo_callback(GSCHEM_TOPLEVEL *w_current, int type)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
UNDO *u_current;
UNDO *u_next;
UNDO *save_bottom;
@@ -316,17 +319,17 @@ void o_undo_callback(TOPLEVEL *w_current, int type)
return;
}
- if (w_current->page_current->undo_current == NULL) {
+ if (toplevel->page_current->undo_current == NULL) {
return;
}
if (type == UNDO_ACTION) {
- u_current = w_current->page_current->undo_current->prev;
+ u_current = toplevel->page_current->undo_current->prev;
} else {
- u_current = w_current->page_current->undo_current->next;
+ u_current = toplevel->page_current->undo_current->next;
}
- u_next = w_current->page_current->undo_current;
+ u_next = toplevel->page_current->undo_current;
if (u_current == NULL) {
return;
@@ -347,63 +350,63 @@ void o_undo_callback(TOPLEVEL *w_current, int type)
}
/* save filename */
- save_filename = g_strdup (w_current->page_current->page_filename);
+ save_filename = g_strdup (toplevel->page_current->page_filename);
/* save structure so it's not nuked */
- save_bottom = w_current->page_current->undo_bottom;
- save_tos = w_current->page_current->undo_tos;
- save_current = w_current->page_current->undo_current;
- w_current->page_current->undo_bottom = NULL;
- w_current->page_current->undo_tos = NULL;
- w_current->page_current->undo_current = NULL;
+ save_bottom = toplevel->page_current->undo_bottom;
+ save_tos = toplevel->page_current->undo_tos;
+ save_current = toplevel->page_current->undo_current;
+ toplevel->page_current->undo_bottom = NULL;
+ toplevel->page_current->undo_tos = NULL;
+ toplevel->page_current->undo_current = NULL;
if (w_current->undo_type == UNDO_DISK && u_current->filename) {
PAGE *p_new;
- s_page_delete (w_current, w_current->page_current);
- p_new = s_page_new(w_current, u_current->filename);
- s_page_goto (w_current, p_new);
+ s_page_delete (toplevel, toplevel->page_current);
+ p_new = s_page_new(toplevel, u_current->filename);
+ s_page_goto (toplevel, p_new);
} else if (w_current->undo_type == UNDO_MEMORY && u_current->object_head) {
PAGE *p_new;
- s_page_delete (w_current, w_current->page_current);
- p_new = s_page_new (w_current, save_filename);
- s_page_goto (w_current, p_new);
+ s_page_delete (toplevel, toplevel->page_current);
+ p_new = s_page_new (toplevel, save_filename);
+ s_page_goto (toplevel, p_new);
}
/* temporarily disable logging */
save_logging = do_logging;
- prev_status = w_current->DONT_REDRAW;
- w_current->DONT_REDRAW = 1;
+ prev_status = toplevel->DONT_REDRAW;
+ toplevel->DONT_REDRAW = 1;
do_logging = FALSE;
if (w_current->undo_type == UNDO_DISK && u_current->filename) {
- f_open(w_current, u_current->filename);
+ f_open(toplevel, u_current->filename);
x_manual_resize(w_current);
- w_current->page_current->page_control = u_current->page_control;
- w_current->page_current->up = u_current->up;
- w_current->page_current->CHANGED=1;
+ toplevel->page_current->page_control = u_current->page_control;
+ toplevel->page_current->up = u_current->up;
+ toplevel->page_current->CHANGED=1;
} else if (w_current->undo_type == UNDO_MEMORY && u_current->object_head) {
- s_delete_list_fromstart(w_current, w_current->page_current->object_head);
+ s_delete_list_fromstart(toplevel, toplevel->page_current->object_head);
- w_current->page_current->object_head = s_basic_init_object("object_head");
- w_current->page_current->object_head->type = OBJ_HEAD;
+ toplevel->page_current->object_head = s_basic_init_object("object_head");
+ toplevel->page_current->object_head->type = OBJ_HEAD;
- o_list_copy_all(w_current, u_current->object_head->next,
- w_current->page_current->object_head,
+ o_list_copy_all(toplevel, u_current->object_head->next,
+ toplevel->page_current->object_head,
NORMAL_FLAG);
- w_current->page_current->object_tail = return_tail(w_current->page_current->object_head);
+ toplevel->page_current->object_tail = return_tail(toplevel->page_current->object_head);
x_manual_resize(w_current);
- w_current->page_current->page_control = u_current->page_control;
- w_current->page_current->up = u_current->up;
- w_current->page_current->CHANGED=1;
+ toplevel->page_current->page_control = u_current->page_control;
+ toplevel->page_current->up = u_current->up;
+ toplevel->page_current->CHANGED=1;
}
/* do misc setups */
- set_window(w_current, w_current->page_current,
+ set_window(toplevel, toplevel->page_current,
u_current->left, u_current->right,
u_current->top, u_current->bottom);
x_hscrollbar_update(w_current);
@@ -413,43 +416,43 @@ void o_undo_callback(TOPLEVEL *w_current, int type)
do_logging = save_logging;
/* set filename right */
- g_free(w_current->page_current->page_filename);
- w_current->page_current->page_filename = save_filename;
+ g_free(toplevel->page_current->page_filename);
+ toplevel->page_current->page_filename = save_filename;
/* final redraw */
x_pagesel_update (w_current);
x_multiattrib_update (w_current);
/* Let the caller to decide if redraw or not */
- /* w_current->DONT_REDRAW = 0; */
- w_current->DONT_REDRAW = prev_status;
+ /* toplevel->DONT_REDRAW = 0; */
+ toplevel->DONT_REDRAW = prev_status;
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_redraw_all(w_current);
}
i_update_menus(w_current);
/* restore saved undo structures */
- w_current->page_current->undo_bottom = save_bottom;
- w_current->page_current->undo_tos = save_tos;
- w_current->page_current->undo_current = save_current;
+ toplevel->page_current->undo_bottom = save_bottom;
+ toplevel->page_current->undo_tos = save_tos;
+ toplevel->page_current->undo_current = save_current;
if (type == UNDO_ACTION) {
- if (w_current->page_current->undo_current) {
- w_current->page_current->undo_current =
- w_current->page_current->undo_current->prev;
- if (w_current->page_current->undo_current == NULL) {
- w_current->page_current->undo_current =
- w_current->page_current->undo_bottom;
+ if (toplevel->page_current->undo_current) {
+ toplevel->page_current->undo_current =
+ toplevel->page_current->undo_current->prev;
+ if (toplevel->page_current->undo_current == NULL) {
+ toplevel->page_current->undo_current =
+ toplevel->page_current->undo_bottom;
}
}
} else { /* type is REDO_ACTION */
- if (w_current->page_current->undo_current) {
- w_current->page_current->undo_current =
- w_current->page_current->undo_current->next;
- if (w_current->page_current->undo_current == NULL) {
- w_current->page_current->undo_current =
- w_current->page_current->undo_tos;
+ if (toplevel->page_current->undo_current) {
+ toplevel->page_current->undo_current =
+ toplevel->page_current->undo_current->next;
+ if (toplevel->page_current->undo_current == NULL) {
+ toplevel->page_current->undo_current =
+ toplevel->page_current->undo_tos;
}
}
}
@@ -463,9 +466,9 @@ void o_undo_callback(TOPLEVEL *w_current, int type)
#if DEBUG
printf("\n\n---Undo----\n");
- s_undo_print_all(w_current->page_current->undo_bottom);
- printf("TOS: %s\n", w_current->page_current->undo_tos->filename);
- printf("CURRENT: %s\n", w_current->page_current->undo_current->filename);
+ s_undo_print_all(toplevel->page_current->undo_bottom);
+ printf("TOS: %s\n", toplevel->page_current->undo_tos->filename);
+ printf("CURRENT: %s\n", toplevel->page_current->undo_current->filename);
printf("----\n");
#endif
}
@@ -498,18 +501,19 @@ void o_undo_cleanup(void)
* \par Function Description
*
*/
-void o_undo_remove_last_undo(TOPLEVEL *w_current)
+void o_undo_remove_last_undo(GSCHEM_TOPLEVEL *w_current)
{
- if (w_current->page_current->undo_current == NULL) {
+ TOPLEVEL *toplevel = w_current->toplevel;
+ if (toplevel->page_current->undo_current == NULL) {
return;
}
- if (w_current->page_current->undo_current) {
- w_current->page_current->undo_current =
- w_current->page_current->undo_current->prev;
- if (w_current->page_current->undo_current == NULL) {
- w_current->page_current->undo_current =
- w_current->page_current->undo_bottom;
+ if (toplevel->page_current->undo_current) {
+ toplevel->page_current->undo_current =
+ toplevel->page_current->undo_current->prev;
+ if (toplevel->page_current->undo_current == NULL) {
+ toplevel->page_current->undo_current =
+ toplevel->page_current->undo_bottom;
}
}
diff --git a/gschem/src/parsecmd.c b/gschem/src/parsecmd.c
index 3a13f4c..c0888b8 100644
--- a/gschem/src/parsecmd.c
+++ b/gschem/src/parsecmd.c
@@ -26,6 +26,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
diff --git a/gschem/src/x_attribedit.c b/gschem/src/x_attribedit.c
index 97a5c42..fd7d23f 100644
--- a/gschem/src/x_attribedit.c
+++ b/gschem/src/x_attribedit.c
@@ -31,6 +31,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/i_vars.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -69,8 +70,9 @@ gint option_menu_get_history (GtkOptionMenu *option_menu)
* \par Function Documentation
*
*/
-void attrib_edit_dialog_ok(GtkWidget * w, TOPLEVEL * w_current)
+void attrib_edit_dialog_ok(GtkWidget * w, GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
const char *value, *label;
char *newtext;
GtkEntry *value_entry, *name_entry;
@@ -138,7 +140,7 @@ void attrib_edit_dialog_ok(GtkWidget * w, TOPLEVEL * w_current)
int world_x, world_y;
OBJECT *new = NULL;
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
while (s_current != NULL) {
object = (OBJECT *)s_current->data;
if (object == NULL) {
@@ -150,7 +152,7 @@ void attrib_edit_dialog_ok(GtkWidget * w, TOPLEVEL * w_current)
}
s_current = g_list_next(s_current);
}
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( toplevel->page_current->selection_list );
if (nsel > 1) {
addtoallbutton =
@@ -212,7 +214,7 @@ void attrib_edit_dialog_ok(GtkWidget * w, TOPLEVEL * w_current)
o_text_change(w_current, a_sav->object,
newtext, vis, show);
replaced = TRUE;
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
}
}
}
@@ -237,21 +239,21 @@ void attrib_edit_dialog_ok(GtkWidget * w, TOPLEVEL * w_current)
printf("invocation flag: %d\n", invocation_flag);
#endif
if (invocation_flag == FROM_HOTKEY) {
- SCREENtoWORLD(w_current, mouse_x, mouse_y, &world_x, &world_y);
- world_x = snap_grid(w_current, world_x);
- world_y = snap_grid(w_current, world_y);
+ SCREENtoWORLD(toplevel, mouse_x, mouse_y, &world_x, &world_y);
+ world_x = snap_grid(toplevel, world_x);
+ world_y = snap_grid(toplevel, world_y);
new->text->x = world_x;
new->text->y = world_y;
o_text_erase(w_current, new);
- o_text_recreate(w_current, new);
+ o_text_recreate(toplevel, new);
o_text_draw(w_current, new);
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
}
}
} else {
o_text_change(w_current, attribptr, newtext, vis, show);
- w_current->page_current->CHANGED = 1;
+ toplevel->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
}
gtk_grab_remove(w_current->aewindow);
@@ -266,7 +268,7 @@ void attrib_edit_dialog_ok(GtkWidget * w, TOPLEVEL * w_current)
* attribute dialog.
*/
void attribute_edit_dialog_response(GtkWidget *w, gint response,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
switch(response) {
case GTK_RESPONSE_APPLY:
@@ -291,8 +293,9 @@ void attribute_edit_dialog_response(GtkWidget *w, gint response,
* \par Function Description
* This function creates the single attribute edit dialog.
*/
-void attrib_edit_dialog(TOPLEVEL * w_current, OBJECT * list, int flag)
+void attrib_edit_dialog(GSCHEM_TOPLEVEL *w_current, OBJECT * list, int flag)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GtkWidget *aewindow;
GtkWidget *vbox, *label, *table, *alignment;
GtkWidget *show_options;
@@ -322,7 +325,7 @@ void attrib_edit_dialog(TOPLEVEL * w_current, OBJECT * list, int flag)
return;
/* gschem specific: What do we count here? (Werner) */
- for (s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ for (s_current = geda_list_get_glist( toplevel->page_current->selection_list );
s_current != NULL;
s_current = g_list_next(s_current)) {
if (!((OBJECT *) s_current->data)->attached_to) {
diff --git a/gschem/src/x_autonumber.c b/gschem/src/x_autonumber.c
index 4e18b1c..9142a4f 100644
--- a/gschem/src/x_autonumber.c
+++ b/gschem/src/x_autonumber.c
@@ -32,6 +32,7 @@
#include <libgeda/libgeda.h>
#include <gdk/gdkkeysyms.h>
+#include "../include/gschem_struct.h"
#include "../include/i_vars.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -102,8 +103,8 @@ struct autonumber_text_t {
/** @brief Pointer to the dialog */
GtkWidget *dialog;
- /** @brief Pointer to the toplevel struct */
- TOPLEVEL *toplevel;
+ /** @brief Pointer to the GSCHEM_TOPLEVEL struct */
+ GSCHEM_TOPLEVEL *w_current;
/* variables used while autonumbering */
gchar * current_searchtext;
@@ -386,7 +387,7 @@ gint autonumber_match(AUTONUMBER_TEXT *autotext, OBJECT *o_current, gint *number
* multislotted symbols, that were used only partially.
* The criterias are derivated from the autonumber dialog entries.
*/
-void autonumber_get_used(TOPLEVEL *w_current, AUTONUMBER_TEXT *autotext)
+void autonumber_get_used(GSCHEM_TOPLEVEL *w_current, AUTONUMBER_TEXT *autotext)
{
gint number, numslots, slotnr, i;
OBJECT *o_current, *o_parent, *o_numslots;
@@ -395,7 +396,7 @@ void autonumber_get_used(TOPLEVEL *w_current, AUTONUMBER_TEXT *autotext)
GList *slot_item;
char *numslot_str, *slot_str;
- for (o_current = w_current->page_current->object_head; o_current != NULL;
+ for (o_current = w_current->toplevel->page_current->object_head; o_current != NULL;
o_current = o_current->next) {
if (autonumber_match(autotext, o_current, &number) == AUTONUMBER_RESPECT) {
/* check slot and maybe add it to the lists */
@@ -575,9 +576,9 @@ void autonumber_remove_number(AUTONUMBER_TEXT * autotext, OBJECT *o_current)
autotext->current_searchtext);
/* redraw the text */
- o_text_erase(autotext->toplevel, o_current);
- o_text_recreate(autotext->toplevel, o_current);
- o_text_draw(autotext->toplevel, o_current);
+ o_text_erase(autotext->w_current, o_current);
+ o_text_recreate(autotext->w_current->toplevel, o_current);
+ o_text_draw(autotext->w_current, o_current);
/* remove the slot attribute if slotting is active */
if (autotext->slotting) {
@@ -588,14 +589,14 @@ void autonumber_remove_number(AUTONUMBER_TEXT * autotext, OBJECT *o_current)
if (slot_str != NULL && o_slot != NULL) {
g_free(slot_str);
/* delete the slot attribute */
- o_selection_remove (autotext->toplevel->page_current->selection_list, o_slot);
- o_delete_text (autotext->toplevel, o_slot);
+ o_selection_remove (autotext->w_current->toplevel->page_current->selection_list, o_slot);
+ o_delete_text (autotext->w_current, o_slot);
/* redraw the slotted object. So that the pinnumbers appear as with slot=1 */
/* --> No: should be done by o_delete_text as several dialog use it. */
}
}
}
- autotext->toplevel->page_current->CHANGED = 1;
+ autotext->w_current->toplevel->page_current->CHANGED = 1;
}
/*! \brief Changes the number <B>OBJECT</B> element. Changes the slot attribute.
@@ -621,18 +622,18 @@ void autonumber_apply_new_text(AUTONUMBER_TEXT * autotext, OBJECT *o_current,
g_free(slot_str);
g_free(o_slot->text->string);
o_slot->text->string = g_strdup_printf("slot=%d",slot);
- o_text_erase(autotext->toplevel, o_slot);
- o_text_recreate(autotext->toplevel, o_slot);
- o_text_draw(autotext->toplevel, o_slot);
+ o_text_erase(autotext->w_current, o_slot);
+ o_text_recreate(autotext->w_current->toplevel, o_slot);
+ o_text_draw(autotext->w_current, o_slot);
}
else {
/* create a new attribute and attach it */
- o_attrib_add_attrib(autotext->toplevel,
+ o_attrib_add_attrib(autotext->w_current,
g_strdup_printf("slot=%d",slot),
INVISIBLE, SHOW_NAME_VALUE,
o_parent);
}
- o_attrib_slot_update(autotext->toplevel, o_parent);
+ o_attrib_slot_update(autotext->w_current->toplevel, o_parent);
}
/* replace old text */
@@ -640,10 +641,10 @@ void autonumber_apply_new_text(AUTONUMBER_TEXT * autotext, OBJECT *o_current,
o_current->text->string = g_strdup_printf("%s%d", autotext->current_searchtext,
number);
/* redraw the text */
- o_text_erase(autotext->toplevel, o_current);
- o_text_recreate(autotext->toplevel, o_current);
- o_text_draw(autotext->toplevel, o_current);
- autotext->toplevel->page_current->CHANGED = 1;
+ o_text_erase(autotext->w_current, o_current);
+ o_text_recreate(autotext->w_current->toplevel, o_current);
+ o_text_draw(autotext->w_current, o_current);
+ autotext->w_current->toplevel->page_current->CHANGED = 1;
}
@@ -662,14 +663,14 @@ void autonumber_text_autonumber(AUTONUMBER_TEXT *autotext)
GList *searchtext_list=NULL;
GList *text_item, *obj_item, *page_item;
OBJECT *o_current;
- TOPLEVEL *w_current;
+ GSCHEM_TOPLEVEL *w_current;
gchar *searchtext;
gchar *scope_text;
gchar *new_searchtext;
gint i, number, slot;
GList *o_list = NULL;
- w_current = autotext->toplevel;
+ w_current = autotext->w_current;
autotext->current_searchtext = NULL;
autotext->root_page = 1;
autotext->used_numbers = NULL;
@@ -679,7 +680,7 @@ void autonumber_text_autonumber(AUTONUMBER_TEXT *autotext)
scope_text = g_list_first(autotext->scope_text)->data;
/* Step1: get all pages of the hierarchy */
- pages = s_hierarchy_traversepages(w_current, HIERARCHY_NODUPS);
+ pages = s_hierarchy_traversepages(w_current->toplevel, HIERARCHY_NODUPS);
/* g_list_foreach(pages, (GFunc) s_hierarchy_print_page, NULL); */
@@ -707,9 +708,9 @@ void autonumber_text_autonumber(AUTONUMBER_TEXT *autotext)
searchtext = g_strndup(scope_text, strlen(scope_text)-1);
/* collect all the possible searchtexts in all pages of the hierarchy */
for (page_item = pages; page_item != NULL; page_item = g_list_next(page_item)) {
- s_page_goto(w_current, page_item->data);
+ s_page_goto(w_current->toplevel, page_item->data);
/* iterate over all objects an look for matching searchtext's */
- for (o_current = w_current->page_current->object_head; o_current != NULL;
+ for (o_current = w_current->toplevel->page_current->object_head; o_current != NULL;
o_current = o_current->next) {
if (o_current->type == OBJ_TEXT) {
if (autotext->scope_number == SCOPE_HIERARCHY
@@ -760,7 +761,7 @@ void autonumber_text_autonumber(AUTONUMBER_TEXT *autotext)
&& autotext->scope_overwrite)) {
for (page_item = pages; page_item != NULL; page_item = g_list_next(page_item)) {
autotext->root_page = (pages->data == page_item->data);
- s_page_goto(w_current, page_item->data);
+ s_page_goto(w_current->toplevel, page_item->data);
autonumber_get_used(w_current, autotext);
}
}
@@ -768,7 +769,7 @@ void autonumber_text_autonumber(AUTONUMBER_TEXT *autotext)
/* renumber the elements */
for (page_item = pages; page_item != NULL; page_item = g_list_next(page_item)) {
- s_page_goto(w_current, page_item->data);
+ s_page_goto(w_current->toplevel, page_item->data);
autotext->root_page = (pages->data == page_item->data);
/* build a page database if we're numbering pagebypage or selection only*/
if (autotext->scope_skip == SCOPE_PAGE || autotext->scope_skip == SCOPE_SELECTED) {
@@ -777,7 +778,7 @@ void autonumber_text_autonumber(AUTONUMBER_TEXT *autotext)
/* RENUMBER CODE FOR ONE PAGE AND ONE SEARCHTEXT*/
/* 1. get objects to renumber */
- for (o_current = w_current->page_current->object_head; o_current != NULL;
+ for (o_current = w_current->toplevel->page_current->object_head; o_current != NULL;
o_current = o_current->next) {
if (autonumber_match(autotext, o_current, &number) == AUTONUMBER_RENUMBER) {
/* put number into the used list */
@@ -836,7 +837,7 @@ void autonumber_text_autonumber(AUTONUMBER_TEXT *autotext)
/* cleanup and redraw all*/
g_list_foreach(searchtext_list, (GFunc) g_free, NULL);
g_list_free(searchtext_list);
- s_page_goto(w_current, pages->data); /* go back to the root page */
+ s_page_goto(w_current->toplevel, pages->data); /* go back to the root page */
o_redraw_all(w_current);
g_list_free(pages);
o_undo_savestate(w_current, UNDO_ALL);
@@ -864,7 +865,7 @@ GtkWidget* lookup_widget(GtkWidget *widget, const gchar *widget_name)
* Load all bitmaps for the combobox and store them together with the label
* in a GtkListStore.
*/
-void autonumber_sortorder_create(TOPLEVEL *w_current, GtkWidget *sort_order)
+void autonumber_sortorder_create(GSCHEM_TOPLEVEL *w_current, GtkWidget *sort_order)
{
GtkListStore *store;
GtkTreeIter iter;
@@ -888,7 +889,7 @@ void autonumber_sortorder_create(TOPLEVEL *w_current, GtkWidget *sort_order)
store = gtk_list_store_new(2, G_TYPE_STRING, GDK_TYPE_PIXBUF);
for (i=0; filenames[i] != NULL; i++) {
- path=g_strconcat(w_current->bitmap_directory,
+ path=g_strconcat(w_current->toplevel->bitmap_directory,
G_DIR_SEPARATOR_S, filenames[i], NULL);
pixbuf = gdk_pixbuf_new_from_file(path, &error);
g_free(path);
@@ -1189,7 +1190,7 @@ void autonumber_removenum_toggled(GtkWidget * opt_removenum,
* @param w_current Pointer to the top level struct.
* @return Pointer to the dialog window.
*/
-GtkWidget* autonumber_create_dialog(TOPLEVEL *w_current)
+GtkWidget* autonumber_create_dialog(GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *autonumber_text;
GtkWidget *vbox1;
@@ -1394,7 +1395,7 @@ GtkWidget* autonumber_create_dialog(TOPLEVEL *w_current)
*
* @param w_current Pointer to the top level struct
*/
-void autonumber_text_dialog(TOPLEVEL *w_current)
+void autonumber_text_dialog(GSCHEM_TOPLEVEL *w_current)
{
static AUTONUMBER_TEXT *autotext = NULL;
@@ -1406,8 +1407,8 @@ void autonumber_text_dialog(TOPLEVEL *w_current)
autotext=autonumber_init_state();
}
- /* set the toplevel always. Can it be changed between the calls??? */
- autotext->toplevel = w_current;
+ /* set the GSCHEM_TOPLEVEL always. Can it be changed between the calls??? */
+ autotext->w_current = w_current;
if(autotext->dialog == NULL) {
/* Dialog is not currently displayed - create it */
diff --git a/gschem/src/x_basic.c b/gschem/src/x_basic.c
index 3e6b156..adfd031 100644
--- a/gschem/src/x_basic.c
+++ b/gschem/src/x_basic.c
@@ -24,6 +24,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -40,12 +41,13 @@
* \par Function Description
*
*/
-void x_repaint_background(TOPLEVEL *w_current)
+void x_repaint_background(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
if (!w_current->inside_redraw) {
gdk_gc_set_foreground(
w_current->gc,
- x_get_color(w_current->background_color));
+ x_get_color(toplevel->background_color));
gdk_draw_rectangle(w_current->window,
w_current->gc, TRUE, 0, 0,
@@ -68,8 +70,9 @@ void x_repaint_background(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_hscrollbar_set_ranges(TOPLEVEL *w_current)
+void x_hscrollbar_set_ranges(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GtkAdjustment *hadjustment;
if (w_current->scrollbars_flag == FALSE) {
@@ -79,8 +82,8 @@ void x_hscrollbar_set_ranges(TOPLEVEL *w_current)
hadjustment =
gtk_range_get_adjustment(GTK_RANGE(w_current->h_scrollbar));
- hadjustment->lower = w_current->init_left;
- hadjustment->upper = w_current->init_right;
+ hadjustment->lower = toplevel->init_left;
+ hadjustment->upper = toplevel->init_right;
}
@@ -89,8 +92,9 @@ void x_hscrollbar_set_ranges(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_hscrollbar_update(TOPLEVEL *w_current)
+void x_hscrollbar_update(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GtkAdjustment *hadjustment;
if (w_current->scrollbars_flag == FALSE) {
@@ -104,10 +108,10 @@ void x_hscrollbar_update(TOPLEVEL *w_current)
hadjustment = gtk_range_get_adjustment (GTK_RANGE (
w_current->h_scrollbar));
- hadjustment->value = w_current->page_current->left;
+ hadjustment->value = toplevel->page_current->left;
- hadjustment->page_size = fabs(w_current->page_current->right -
- w_current->page_current->left);
+ hadjustment->page_size = fabs(toplevel->page_current->right -
+ toplevel->page_current->left);
hadjustment->page_increment = hadjustment->page_size - 100.0;
@@ -125,8 +129,9 @@ void x_hscrollbar_update(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_vscrollbar_set_ranges(TOPLEVEL *w_current)
+void x_vscrollbar_set_ranges(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GtkAdjustment *vadjustment;
if (w_current->scrollbars_flag == FALSE) {
@@ -136,8 +141,8 @@ void x_vscrollbar_set_ranges(TOPLEVEL *w_current)
vadjustment =
gtk_range_get_adjustment(GTK_RANGE(w_current->v_scrollbar));
- vadjustment->lower = w_current->init_top;
- vadjustment->upper = w_current->init_bottom;
+ vadjustment->lower = toplevel->init_top;
+ vadjustment->upper = toplevel->init_bottom;
}
/*! \todo Finish function documentation!!!
@@ -145,8 +150,9 @@ void x_vscrollbar_set_ranges(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_vscrollbar_update(TOPLEVEL *w_current)
+void x_vscrollbar_update(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GtkAdjustment *vadjustment;
if (w_current->scrollbars_flag == FALSE) {
@@ -160,13 +166,13 @@ void x_vscrollbar_update(TOPLEVEL *w_current)
vadjustment =
gtk_range_get_adjustment(GTK_RANGE(w_current->v_scrollbar));
- vadjustment->page_size = fabs(w_current->page_current->bottom -
- w_current->page_current->top);
+ vadjustment->page_size = fabs(toplevel->page_current->bottom -
+ toplevel->page_current->top);
vadjustment->page_increment = vadjustment->page_size - 100.0;
vadjustment->value =
- w_current->init_bottom - w_current->page_current->bottom;
+ toplevel->init_bottom - toplevel->page_current->bottom;
#if DEBUG
printf("V %f %f\n", vadjustment->lower, vadjustment->upper);
@@ -182,16 +188,17 @@ void x_vscrollbar_update(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_scrollbars_update(TOPLEVEL *w_current)
+void x_scrollbars_update(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
if (w_current->scrollbars_flag == FALSE) {
return;
}
- w_current->DONT_REDRAW = 1;
+ toplevel->DONT_REDRAW = 1;
x_hscrollbar_update(w_current);
x_vscrollbar_update(w_current);
- w_current->DONT_REDRAW = 0;
+ toplevel->DONT_REDRAW = 0;
}
diff --git a/gschem/src/x_color.c b/gschem/src/x_color.c
index d411de1..8205c65 100644
--- a/gschem/src/x_color.c
+++ b/gschem/src/x_color.c
@@ -27,6 +27,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
diff --git a/gschem/src/x_compselect.c b/gschem/src/x_compselect.c
index 9ed8c3d..3db1db0 100644
--- a/gschem/src/x_compselect.c
+++ b/gschem/src/x_compselect.c
@@ -40,6 +40,7 @@
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -74,7 +75,7 @@
*
* \param [in] dialog The component selection dialog.
* \param [in] arg1 The response ID.
- * \param [in] user_data A pointer on the toplevel environment.
+ * \param [in] user_data A pointer on the GSCHEM_TOPLEVEL environment.
*/
static void
x_compselect_callback_response (GtkDialog *dialog,
@@ -82,7 +83,8 @@ x_compselect_callback_response (GtkDialog *dialog,
gpointer user_data)
{
Compselect *compselect = (Compselect*)dialog;
- TOPLEVEL *toplevel = (TOPLEVEL*)user_data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL *)user_data;
+ TOPLEVEL *toplevel = w_current->toplevel;
switch (arg1) {
case COMPSELECT_RESPONSE_PLACE: {
@@ -95,24 +97,24 @@ x_compselect_callback_response (GtkDialog *dialog,
"behavior", &behavior,
NULL);
- toplevel->include_complex = toplevel->embed_complex = 0;
+ w_current->include_complex = w_current->embed_complex = 0;
switch (behavior) {
case COMPSELECT_BEHAVIOR_REFERENCE:
break;
case COMPSELECT_BEHAVIOR_EMBED:
- toplevel->embed_complex = 1;
+ w_current->embed_complex = 1;
break;
case COMPSELECT_BEHAVIOR_INCLUDE:
- toplevel->include_complex = 1;
+ w_current->include_complex = 1;
break;
default:
g_assert_not_reached();
}
- diff_x = toplevel->last_x - toplevel->start_x;
- diff_y = toplevel->last_y - toplevel->start_y;
+ diff_x = w_current->last_x - w_current->start_x;
+ diff_y = w_current->last_y - w_current->start_y;
- o_complex_translate_display_object_glist(toplevel,
+ o_complex_translate_display_object_glist(w_current,
diff_x, diff_y,
toplevel->page_current->
complex_place_list);
@@ -124,11 +126,11 @@ x_compselect_callback_response (GtkDialog *dialog,
if (symbol == NULL) {
/* If there is no symbol selected, switch to SELECT mode */
- toplevel->event_state = SELECT;
+ w_current->event_state = SELECT;
} else {
/* Otherwise set the new symbol to place */
o_complex_set_filename(toplevel, s_clib_symbol_get_name (symbol));
- toplevel->event_state = DRAWCOMP;
+ w_current->event_state = DRAWCOMP;
}
break;
}
@@ -148,9 +150,9 @@ x_compselect_callback_response (GtkDialog *dialog,
case GTK_RESPONSE_CLOSE:
case GTK_RESPONSE_DELETE_EVENT:
- g_assert (GTK_WIDGET (dialog) == toplevel->cswindow);
+ g_assert (GTK_WIDGET (dialog) == w_current->cswindow);
gtk_widget_destroy (GTK_WIDGET (dialog));
- toplevel->cswindow = NULL;
+ w_current->cswindow = NULL;
/* Free the complex place list and its contents */
s_delete_object_glist(toplevel,
@@ -158,8 +160,8 @@ x_compselect_callback_response (GtkDialog *dialog,
toplevel->page_current->complex_place_list = NULL;
/* return to the default state */
- i_set_state(toplevel, SELECT);
- i_update_toolbar(toplevel);
+ i_set_state(w_current, SELECT);
+ i_update_toolbar(w_current);
break;
default:
@@ -176,43 +178,43 @@ x_compselect_callback_response (GtkDialog *dialog,
* <B>toplevel</B> if it is not already. In this last case, it only
* raises the dialog.
*
- * \param [in] toplevel The toplevel environment.
+ * \param [in] w_current The GSCHEM_TOPLEVEL environment.
*/
void
-x_compselect_open (TOPLEVEL *toplevel)
+x_compselect_open (GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *current_tab, *entry_filter;
GtkNotebook *compselect_notebook;
- if (toplevel->cswindow == NULL) {
- toplevel->cswindow = GTK_WIDGET (
+ if (w_current->cswindow == NULL) {
+ w_current->cswindow = GTK_WIDGET (
g_object_new (TYPE_COMPSELECT,
/* GschemDialog */
"settings-name", "compselect",
- "toplevel", toplevel,
+ "gschem-toplevel", w_current,
NULL));
- g_signal_connect (toplevel->cswindow,
+ g_signal_connect (w_current->cswindow,
"response",
G_CALLBACK (x_compselect_callback_response),
- toplevel);
+ w_current);
- gtk_window_set_transient_for(GTK_WINDOW(toplevel->cswindow),
- GTK_WINDOW(toplevel->main_window));
+ gtk_window_set_transient_for(GTK_WINDOW(w_current->cswindow),
+ GTK_WINDOW(w_current->main_window));
- gtk_widget_show (toplevel->cswindow);
+ gtk_widget_show (w_current->cswindow);
} else {
- gtk_window_present (GTK_WINDOW(toplevel->cswindow));
+ gtk_window_present (GTK_WINDOW(w_current->cswindow));
}
- gtk_editable_select_region(GTK_EDITABLE(COMPSELECT(toplevel->cswindow)->entry_filter), 0, -1);
+ gtk_editable_select_region(GTK_EDITABLE(COMPSELECT(w_current->cswindow)->entry_filter), 0, -1);
/* Set the focus to the filter entry only if it is in the current
displayed tab */
- compselect_notebook = GTK_NOTEBOOK(COMPSELECT(toplevel->cswindow)->viewtabs);
+ compselect_notebook = GTK_NOTEBOOK(COMPSELECT(w_current->cswindow)->viewtabs);
current_tab = gtk_notebook_get_nth_page(compselect_notebook,
gtk_notebook_get_current_page(compselect_notebook));
- entry_filter = GTK_WIDGET(COMPSELECT(toplevel->cswindow)->entry_filter);
+ entry_filter = GTK_WIDGET(COMPSELECT(w_current->cswindow)->entry_filter);
if (gtk_widget_is_ancestor(entry_filter, current_tab)) {
gtk_widget_grab_focus (entry_filter);
}
@@ -223,15 +225,15 @@ x_compselect_open (TOPLEVEL *toplevel)
* This function closes the component chooser dialog associated with
* <B>toplevel</B>.
*
- * \param [in] toplevel The toplevel environment.
+ * \param [in] w_current The GSCHEM_TOPLEVEL environment.
*/
void
-x_compselect_close (TOPLEVEL *toplevel)
+x_compselect_close (GSCHEM_TOPLEVEL *w_current)
{
- if (toplevel->cswindow) {
- g_assert (IS_COMPSELECT (toplevel->cswindow));
- gtk_widget_destroy (toplevel->cswindow);
- toplevel->cswindow = NULL;
+ if (w_current->cswindow) {
+ g_assert (IS_COMPSELECT (w_current->cswindow));
+ gtk_widget_destroy (w_current->cswindow);
+ w_current->cswindow = NULL;
}
}
@@ -561,7 +563,7 @@ create_inuse_tree_model (Compselect *compselect)
store = (GtkListStore *) gtk_list_store_new (1, G_TYPE_POINTER);
- symhead = s_toplevel_get_symbols (GSCHEM_DIALOG (compselect)->toplevel);
+ symhead = s_toplevel_get_symbols (GSCHEM_DIALOG (compselect)->w_current->toplevel);
for (symlist = symhead;
symlist != NULL;
@@ -594,7 +596,7 @@ create_lib_tree_model (Compselect *compselect)
store = (GtkTreeStore*)gtk_tree_store_new (1, G_TYPE_POINTER);
/* populate component store */
- srchead = s_clib_get_sources (GSCHEM_DIALOG (compselect)->toplevel->sort_component_library != 0);
+ srchead = s_clib_get_sources (GSCHEM_DIALOG (compselect)->w_current->sort_component_library != 0);
for (srclist = srchead;
srclist != NULL;
srclist = g_list_next (srclist)) {
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index ac78d81..717a7b6 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -30,6 +30,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/i_vars.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -44,11 +45,11 @@
g_object_set_data_full (G_OBJECT (component), name, \
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
-static GtkWidget* create_menu_linetype (TOPLEVEL *w_current);
+static GtkWidget* create_menu_linetype (GSCHEM_TOPLEVEL *w_current);
static gint line_type_dialog_linetype_change (GtkWidget *w, gpointer data);
static void line_type_dialog_ok (GtkWidget *w, gpointer data);
-static GtkWidget* create_menu_filltype (TOPLEVEL *w_current);
+static GtkWidget* create_menu_filltype (GSCHEM_TOPLEVEL *w_current);
static gint fill_type_dialog_filltype_change(GtkWidget *w, gpointer data);
static void fill_type_dialog_ok(GtkWidget *w, gpointer data);
@@ -60,7 +61,7 @@ struct line_type_data {
GtkWidget *length_entry;
GtkWidget *space_entry;
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current;
GList *objects;
};
@@ -73,7 +74,7 @@ struct fill_type_data {
GtkWidget *angle2_entry;
GtkWidget *pitch2_entry;
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current;
GList *objects;
};
@@ -98,9 +99,10 @@ char generic_textstring[256] = "refdes=R";
* \par Function Description
* This function applies the text from the text entry dialog.
*/
-void text_input_dialog_apply(GtkWidget *w, TOPLEVEL *w_current)
+void text_input_dialog_apply(GtkWidget *w, GSCHEM_TOPLEVEL *w_current)
{
int len;
+ TOPLEVEL *toplevel = w_current->toplevel;
char *string = NULL;
GtkWidget *tientry;
GtkTextBuffer *textbuffer;
@@ -136,8 +138,8 @@ void text_input_dialog_apply(GtkWidget *w, TOPLEVEL *w_current)
select_all_text_in_textview(GTK_TEXT_VIEW(tientry));
gtk_widget_grab_focus(tientry);
- o_attrib_set_string(w_current, string);
- w_current->page_current->CHANGED=1;
+ o_attrib_set_string(toplevel, string);
+ toplevel->page_current->CHANGED=1;
w_current->event_state = DRAWTEXT;
w_current->inside_action = 1;
}
@@ -147,7 +149,7 @@ void text_input_dialog_apply(GtkWidget *w, TOPLEVEL *w_current)
* \par Function Description
* Callback function for the text entry dialog.
*/
-void text_input_dialog_response(GtkWidget * widget, gint response, TOPLEVEL *w_current)
+void text_input_dialog_response(GtkWidget * widget, gint response, GSCHEM_TOPLEVEL *w_current)
{
switch(response) {
case GTK_RESPONSE_ACCEPT:
@@ -170,7 +172,7 @@ void text_input_dialog_response(GtkWidget * widget, gint response, TOPLEVEL *w_c
* \par Function Description
* This function creates or raises the modal text entry dialog
*/
-void text_input_dialog (TOPLEVEL *w_current)
+void text_input_dialog (GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *label = NULL;
GtkWidget *tientry = NULL;
@@ -272,11 +274,11 @@ void text_input_dialog (TOPLEVEL *w_current)
/*! \brief CAllback for a text aligment change
* \par Function Description
* This function stores a change of the text alignment in the
- * <b>TOPLEVEL</b> struct.
+ * <b>GSCHEM_TOPLEVEL</b> struct.
* \todo Remove that function. Only the OK-Button should set any
- * properties in the TOPLEVEL struct.
+ * properties in the GSCHEM_TOPLEVEL struct.
*/
-gint change_alignment(GtkWidget *w, TOPLEVEL *w_current)
+gint change_alignment(GtkWidget *w, GSCHEM_TOPLEVEL *w_current)
{
char *alignment;
alignment = gtk_object_get_data(GTK_OBJECT(w),"alignment");
@@ -293,7 +295,7 @@ gint change_alignment(GtkWidget *w, TOPLEVEL *w_current)
* This function creates a GtkMenu with nine different alignment
* entries.
*/
-static GtkWidget *create_menu_alignment (TOPLEVEL *w_current)
+static GtkWidget *create_menu_alignment (GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *menu;
GtkWidget *menuitem;
@@ -406,14 +408,14 @@ static GtkWidget *create_menu_alignment (TOPLEVEL *w_current)
}
/* we reuse the color menu so we need to declare it */
-static GtkWidget *create_color_menu(TOPLEVEL * w_current, int * select_index);
+static GtkWidget *create_color_menu(GSCHEM_TOPLEVEL * w_current, int * select_index);
/*! \brief Apply the settings from the text property dialog
* \par Function Description
* This function applies the user settings to the selected text objects
* and closes the dialog
*/
-void text_edit_dialog_ok(GtkWidget *w, TOPLEVEL *w_current)
+void text_edit_dialog_ok(GtkWidget *w, GSCHEM_TOPLEVEL *w_current)
{
int len=0;
int text_size=8;
@@ -425,7 +427,7 @@ void text_edit_dialog_ok(GtkWidget *w, TOPLEVEL *w_current)
GtkTextIter start, end;
GtkWidget *widget;
- num_selected = g_list_length( geda_list_get_glist( w_current->page_current->selection_list ));
+ num_selected = g_list_length( geda_list_get_glist( w_current->toplevel->page_current->selection_list ));
/* text string entry will only show up if one object is selected */
if (num_selected == 1) {
@@ -461,7 +463,7 @@ void text_edit_dialog_ok(GtkWidget *w, TOPLEVEL *w_current)
* The response is either <b>OK</b>, <b>Cancel</b> or delete.
*
*/
-void text_edit_dialog_response(GtkWidget * widget, gint response, TOPLEVEL *w_current)
+void text_edit_dialog_response(GtkWidget * widget, gint response, GSCHEM_TOPLEVEL *w_current)
{
switch(response) {
case GTK_RESPONSE_ACCEPT:
@@ -487,7 +489,7 @@ void text_edit_dialog_response(GtkWidget * widget, gint response, TOPLEVEL *w_cu
* \todo Check why there's no color in the calling parameters
* \todo If more than one text element is selected, add an unchanged option
*/
-void text_edit_dialog (TOPLEVEL *w_current, char *string, int text_size,
+void text_edit_dialog (GSCHEM_TOPLEVEL *w_current, char *string, int text_size,
int text_alignment)
{
GtkWidget *label = NULL;
@@ -539,7 +541,7 @@ void text_edit_dialog (TOPLEVEL *w_current, char *string, int text_size,
gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
/* add a text box if only one object is selected */
- num_selected = g_list_length( geda_list_get_glist( w_current->page_current->selection_list ));
+ num_selected = g_list_length( geda_list_get_glist( w_current->toplevel->page_current->selection_list ));
if (num_selected == 1) {
label = gtk_label_new (_("<b>Text Content</b>"));
@@ -655,7 +657,7 @@ void text_edit_dialog (TOPLEVEL *w_current, char *string, int text_size,
* \par Function Description
* This function creates a GtkMenu with the different linetypes.
*/
-static GtkWidget *create_menu_linetype (TOPLEVEL *w_current)
+static GtkWidget *create_menu_linetype (GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *menu;
GSList *group;
@@ -741,15 +743,15 @@ static gint line_type_dialog_linetype_change(GtkWidget *w, gpointer data)
static void line_type_dialog_ok(GtkWidget *w, gpointer data)
{
struct line_type_data *line_type_data = (struct line_type_data*)data;
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current = line_type_data->w_current;
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *objects;
const gchar *width_str, *length_str, *space_str;
OBJECT_TYPE type;
- /* retrieve the list of objects and the toplevel */
+ /* retrieve the list of objects */
objects = line_type_data->objects;
- toplevel = line_type_data->toplevel;
-
+
/* get the new values from the text entries of the dialog */
width_str = gtk_entry_get_text (GTK_ENTRY (
line_type_data->width_entry));
@@ -776,14 +778,14 @@ static void line_type_dialog_ok(GtkWidget *w, gpointer data)
space = atoi (space_str);
/* apply the new line options to object */
- o_erase_single (toplevel, o_current);
+ o_erase_single (w_current, o_current);
o_set_line_options (toplevel, o_current,
o_current->line_end,
type,
width,
length,
space);
- o_redraw_single (toplevel, o_current);
+ o_redraw_single (w_current, o_current);
} else {
/* more than one object in the list */
@@ -803,14 +805,14 @@ static void line_type_dialog_ok(GtkWidget *w, gpointer data)
while (object != NULL) {
OBJECT *o_current = (OBJECT*)object->data;
- o_erase_single (toplevel, o_current);
+ o_erase_single (w_current, o_current);
o_set_line_options (toplevel, o_current,
o_current->line_end,
type == -1 ? o_current->line_type : type,
width == -1 ? o_current->line_width : width,
length == -1 ? o_current->line_length : length,
space == -1 ? o_current->line_space : space);
- o_redraw_single (toplevel, o_current);
+ o_redraw_single (w_current, o_current);
object = g_list_next(object);
}
@@ -840,8 +842,8 @@ void line_type_dialog_response(GtkWidget *widget, gint response,
printf("line_type_dialog_response(): strange signal %d\n",response);
}
- i_set_state (line_type_data->toplevel, SELECT);
- i_update_toolbar (line_type_data->toplevel);
+ i_set_state (line_type_data->w_current, SELECT);
+ i_update_toolbar (line_type_data->w_current);
gtk_widget_destroy (line_type_data->dialog);
/* get ride of the list of objects but not the objects */
@@ -854,7 +856,7 @@ void line_type_dialog_response(GtkWidget *widget, gint response,
* This function creates and sets up a dialog for manipulating the
* line width and the line type setting of objects.
*/
-void line_type_dialog (TOPLEVEL *w_current, GList *objects)
+void line_type_dialog (GSCHEM_TOPLEVEL *w_current, GList *objects)
{
GtkWidget *dialog;
GtkWidget *vbox;
@@ -963,7 +965,7 @@ void line_type_dialog (TOPLEVEL *w_current, GList *objects)
line_type_data->length_entry = length_entry;
line_type_data->space_entry = space_entry;
- line_type_data->toplevel = w_current;
+ line_type_data->w_current = w_current;
line_type_data->objects = objects;
/* fill in the fields of the dialog */
@@ -1022,7 +1024,7 @@ void line_type_dialog (TOPLEVEL *w_current, GList *objects)
* \par Function Description
* This function creates a GtkMenu with the different fill types.
*/
-static GtkWidget *create_menu_filltype (TOPLEVEL *w_current)
+static GtkWidget *create_menu_filltype (GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *menu;
GSList *group;
@@ -1117,14 +1119,14 @@ static gint fill_type_dialog_filltype_change(GtkWidget *w, gpointer data)
static void fill_type_dialog_ok(GtkWidget *w, gpointer data)
{
struct fill_type_data *fill_type_data = (struct fill_type_data*)data;
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current = fill_type_data->w_current;
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *objects;
const gchar *width_str, *angle1_str, *pitch1_str, *angle2_str, *pitch2_str;
OBJECT_FILLING type;
- /* retrieve the list of objects and the toplevel */
+ /* retrieve the list of objects */
objects = fill_type_data->objects;
- toplevel = fill_type_data->toplevel;
/* get the new values from the text entries of the dialog */
width_str = gtk_entry_get_text (GTK_ENTRY (
@@ -1158,12 +1160,12 @@ static void fill_type_dialog_ok(GtkWidget *w, gpointer data)
pitch2 = atoi (pitch2_str);
/* apply the new line options to object */
- o_erase_single (toplevel, o_current);
+ o_erase_single (w_current, o_current);
o_set_fill_options(toplevel, o_current,
type, width,
pitch1, angle1,
pitch2, angle2);
- o_redraw_single (toplevel, o_current);
+ o_redraw_single (w_current, o_current);
} else {
/* more than one object in the list */
@@ -1187,7 +1189,7 @@ static void fill_type_dialog_ok(GtkWidget *w, gpointer data)
while (object != NULL) {
OBJECT *o_current = (OBJECT*)object->data;
- o_erase_single (toplevel, o_current);
+ o_erase_single (w_current, o_current);
o_set_fill_options (toplevel, o_current,
type == -1 ? o_current->fill_type : type,
width == -1 ? o_current->fill_width : width,
@@ -1195,7 +1197,7 @@ static void fill_type_dialog_ok(GtkWidget *w, gpointer data)
angle1 == -1 ? o_current->fill_angle1 : angle1,
pitch2 == -1 ? o_current->fill_pitch2 : pitch2,
angle2 == -1 ? o_current->fill_angle2 : angle2);
- o_redraw_single (toplevel, o_current);
+ o_redraw_single (w_current, o_current);
object = g_list_next(object);
}
@@ -1223,8 +1225,8 @@ void fill_type_dialog_response(GtkWidget *widget, gint response,
printf("line_type_dialog_response(): strange signal %d\n",response);
}
- i_set_state (fill_type_data->toplevel, SELECT);
- i_update_toolbar (fill_type_data->toplevel);
+ i_set_state (fill_type_data->w_current, SELECT);
+ i_update_toolbar (fill_type_data->w_current);
gtk_grab_remove (fill_type_data->dialog);
gtk_widget_destroy (fill_type_data->dialog);
@@ -1239,7 +1241,7 @@ void fill_type_dialog_response(GtkWidget *widget, gint response,
* This function creates the fill type dialog. It operates on a list
* of objects.
*/
-void fill_type_dialog(TOPLEVEL *w_current, GList *objects)
+void fill_type_dialog(GSCHEM_TOPLEVEL *w_current, GList *objects)
{
GtkWidget *dialog;
GtkWidget *vbox;
@@ -1367,7 +1369,7 @@ void fill_type_dialog(TOPLEVEL *w_current, GList *objects)
fill_type_data->angle2_entry = angle2_entry;
fill_type_data->pitch2_entry = pitch2_entry;
- fill_type_data->toplevel = w_current;
+ fill_type_data->w_current = w_current;
fill_type_data->objects = objects;
/* fill in the fields of the dialog */
@@ -1441,7 +1443,7 @@ void fill_type_dialog(TOPLEVEL *w_current, GList *objects)
* If the dialog is closed or canceled the function destroys the dialog.
*/
void arc_angle_dialog_response(GtkWidget *w, gint response,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *spinentry;
gint start_angle, sweep_angle;
@@ -1472,7 +1474,7 @@ void arc_angle_dialog_response(GtkWidget *w, gint response,
* \par Function Description
* This function create the arc angle dialog.
*/
-void arc_angle_dialog (TOPLEVEL *w_current)
+void arc_angle_dialog (GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *label = NULL;
GtkWidget *vbox;
@@ -1562,7 +1564,7 @@ void arc_angle_dialog (TOPLEVEL *w_current)
* \todo improve error detection / use a spin button?
*/
void translate_dialog_response(GtkWidget *widget, gint response,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *textentry;
gchar *string;
@@ -1594,7 +1596,7 @@ void translate_dialog_response(GtkWidget *widget, gint response,
* \par Function Description
* Create the dialog to translate symbols.
*/
-void translate_dialog (TOPLEVEL *w_current)
+void translate_dialog (GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *label;
GtkWidget *textentry;
@@ -1661,7 +1663,7 @@ void translate_dialog (TOPLEVEL *w_current)
* This function takes the user input and applies it to gschem
*/
void text_size_dialog_response(GtkWidget *w, gint response,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *spin_size;
gint size;
@@ -1672,7 +1674,7 @@ void text_size_dialog_response(GtkWidget *w, gint response,
size = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(spin_size));
w_current->text_size = size;
- w_current->page_current->CHANGED=1;
+ w_current->toplevel->page_current->CHANGED=1;
o_undo_savestate(w_current, UNDO_ALL);
break;
case GTK_RESPONSE_REJECT:
@@ -1694,7 +1696,7 @@ void text_size_dialog_response(GtkWidget *w, gint response,
* \par Function Description
* This function creates the text size dialog.
*/
-void text_size_dialog (TOPLEVEL *w_current)
+void text_size_dialog (GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *label = NULL;
GtkWidget *vbox;
@@ -1767,7 +1769,7 @@ void text_size_dialog (TOPLEVEL *w_current)
* It sets the given snap size to gschem.
*/
void snap_size_dialog_response(GtkWidget *w, gint response,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *spin_size;
gint size;
@@ -1777,9 +1779,9 @@ void snap_size_dialog_response(GtkWidget *w, gint response,
spin_size = g_object_get_data(G_OBJECT(w_current->tswindow),"spin_size");
size = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(spin_size));
- w_current->snap_size = size;
+ w_current->toplevel->snap_size = size;
o_redraw_all(w_current);
- w_current->page_current->CHANGED=1; /* maybe remove those two lines */
+ w_current->toplevel->page_current->CHANGED=1; /* maybe remove those two lines */
o_undo_savestate(w_current, UNDO_ALL);
break;
case GTK_RESPONSE_REJECT:
@@ -1801,7 +1803,7 @@ void snap_size_dialog_response(GtkWidget *w, gint response,
* \par Function Description
* This function creates the snap size dialog.
*/
-void snap_size_dialog (TOPLEVEL *w_current)
+void snap_size_dialog (GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *label = NULL;
GtkWidget *vbox;
@@ -1860,7 +1862,7 @@ void snap_size_dialog (TOPLEVEL *w_current)
/* always set the current gschem value to the dialog entry */
spin_size = g_object_get_data(G_OBJECT(w_current->tswindow),"spin_size");
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_size), w_current->snap_size);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_size), w_current->toplevel->snap_size);
gtk_editable_select_region(GTK_EDITABLE(spin_size), 0, -1);
}
@@ -1873,7 +1875,7 @@ void snap_size_dialog (TOPLEVEL *w_current)
* The function takes the dialog entry and applies the new slot to the
* symbol.
*/
-void slot_edit_dialog_response(GtkWidget *widget, gint response, TOPLEVEL *w_current)
+void slot_edit_dialog_response(GtkWidget *widget, gint response, GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *textentry;
int len;
@@ -1906,7 +1908,7 @@ void slot_edit_dialog_response(GtkWidget *widget, gint response, TOPLEVEL *w_cur
* \par Function Description
* This function creates the slot edit dialog.
*/
-void slot_edit_dialog (TOPLEVEL *w_current, char *string)
+void slot_edit_dialog (GSCHEM_TOPLEVEL *w_current, char *string)
{
GtkWidget *label = NULL;
GtkWidget *textentry;
@@ -1982,7 +1984,7 @@ void slot_edit_dialog (TOPLEVEL *w_current, char *string)
* This function destoys the about dialg.
*/
void about_dialog_response(GtkWidget *w, gint response,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
switch (response) {
case GTK_RESPONSE_REJECT:
@@ -2001,7 +2003,7 @@ void about_dialog_response(GtkWidget *w, gint response,
* \par Function Description
* This function creates the about dialog.
*/
-void about_dialog (TOPLEVEL *w_current)
+void about_dialog (GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *label = NULL;
GtkWidget *vbox;
@@ -2062,7 +2064,7 @@ void about_dialog (TOPLEVEL *w_current)
* \par Function Description
* This function destroys the coord dialog box and does some cleanup.
*/
-void coord_dialog_response(GtkWidget *w, gint response, TOPLEVEL *w_current)
+void coord_dialog_response(GtkWidget *w, gint response, GSCHEM_TOPLEVEL *w_current)
{
gtk_widget_destroy(w_current->cowindow);
w_current->cowindow = NULL;
@@ -2075,8 +2077,9 @@ void coord_dialog_response(GtkWidget *w, gint response, TOPLEVEL *w_current)
* This function takes the screen coordinates and prints the
* screen and the world coordinates in the coord dialog.
*/
-void coord_display_update(TOPLEVEL *w_current, int x, int y)
+void coord_display_update(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
char *string;
int world_x, world_y;
@@ -2084,10 +2087,10 @@ void coord_display_update(TOPLEVEL *w_current, int x, int y)
gtk_label_set_text(GTK_LABEL(w_current->coord_screen), string );
g_free(string);
- SCREENtoWORLD(w_current, x, y, &world_x, &world_y);
+ SCREENtoWORLD(toplevel, x, y, &world_x, &world_y);
/* TODO: Do we want to snap the coordinate display? */
- world_x = snap_grid(w_current, world_x);
- world_y = snap_grid(w_current, world_y);
+ world_x = snap_grid(toplevel, world_x);
+ world_y = snap_grid(toplevel, world_y);
string = g_strdup_printf("(%d, %d)", world_x, world_y);
gtk_label_set_text(GTK_LABEL(w_current->coord_world), string );
@@ -2098,7 +2101,7 @@ void coord_display_update(TOPLEVEL *w_current, int x, int y)
* \par Function Description
* This function creates the coord dialog box.
*/
-void coord_dialog (TOPLEVEL *w_current, int x, int y)
+void coord_dialog (GSCHEM_TOPLEVEL *w_current, int x, int y)
{
GtkWidget *frame;
GtkWidget *vbox;
@@ -2256,7 +2259,7 @@ char *index2functionstring(int index)
* This Function creates a GtkOptionMenu with the color list.
* It selects the color of the first selected object.
*/
-static GtkWidget *create_color_menu (TOPLEVEL * w_current, int * select_index)
+static GtkWidget *create_color_menu (GSCHEM_TOPLEVEL * w_current, int * select_index)
{
GtkWidget *menu;
GtkWidget *menuitem;
@@ -2275,7 +2278,7 @@ static GtkWidget *create_color_menu (TOPLEVEL * w_current, int * select_index)
menu = gtk_menu_new ();
group = NULL;
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( w_current->toplevel->page_current->selection_list );
if (s_current != NULL) {
@@ -2346,12 +2349,12 @@ static GtkWidget *create_color_menu (TOPLEVEL * w_current, int * select_index)
* \par Function Description
* This function applies a color change to the currently selected objects.
*/
-void color_edit_dialog_apply(GtkWidget *w, TOPLEVEL *w_current)
+void color_edit_dialog_apply(GtkWidget *w, GSCHEM_TOPLEVEL *w_current)
{
GList *s_current = NULL;
OBJECT *object = NULL;
- s_current = geda_list_get_glist( w_current->page_current->selection_list );
+ s_current = geda_list_get_glist( w_current->toplevel->page_current->selection_list );
while(s_current != NULL) {
@@ -2370,7 +2373,7 @@ void color_edit_dialog_apply(GtkWidget *w, TOPLEVEL *w_current)
case(OBJ_PIN):
case(OBJ_ARC):
object->saved_color = w_current->edit_color;
- w_current->page_current->CHANGED = 1;
+ w_current->toplevel->page_current->CHANGED = 1;
break;
case(OBJ_TEXT):
@@ -2378,7 +2381,7 @@ void color_edit_dialog_apply(GtkWidget *w, TOPLEVEL *w_current)
o_complex_set_saved_color_only(
object->text->prim_objs,
w_current->edit_color);
- w_current->page_current->CHANGED = 1;
+ w_current->toplevel->page_current->CHANGED = 1;
break;
}
@@ -2391,7 +2394,7 @@ void color_edit_dialog_apply(GtkWidget *w, TOPLEVEL *w_current)
* \par Function Description
* This function takes the user response from the color edit dialog
*/
-void color_edit_dialog_response(GtkWidget *widget, gint response, TOPLEVEL *w_current)
+void color_edit_dialog_response(GtkWidget *widget, gint response, GSCHEM_TOPLEVEL *w_current)
{
switch (response) {
case GTK_RESPONSE_REJECT:
@@ -2412,7 +2415,7 @@ void color_edit_dialog_response(GtkWidget *widget, gint response, TOPLEVEL *w_cu
* \par Function Description
* This function creates the color edit dialog
*/
-void color_edit_dialog (TOPLEVEL *w_current)
+void color_edit_dialog (GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *optionmenu;
GtkWidget *label;
@@ -2480,7 +2483,7 @@ void color_edit_dialog (TOPLEVEL *w_current)
* This function destroys the hotkey dialog and does some cleanup.
*/
void x_dialog_hotkeys_response(GtkWidget *w, gint response,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
switch(response) {
case GTK_RESPONSE_REJECT:
@@ -2500,7 +2503,7 @@ void x_dialog_hotkeys_response(GtkWidget *w, gint response,
* This function creates the hotkey dialog and puts the list of hotkeys
* into it.
*/
-void x_dialog_hotkeys (TOPLEVEL *w_current)
+void x_dialog_hotkeys (GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *vbox, *scrolled_win;
GtkListStore *store;
@@ -2611,7 +2614,7 @@ extern GtkWidget *stwindow;
* \par Function Description
*
*/
-void x_dialog_raise_all(TOPLEVEL *w_current)
+void x_dialog_raise_all(GSCHEM_TOPLEVEL *w_current)
{
if(w_current->sowindow) {
gdk_window_raise(w_current->sowindow->window);
@@ -2619,11 +2622,9 @@ void x_dialog_raise_all(TOPLEVEL *w_current)
if(w_current->cswindow) {
gdk_window_raise(w_current->cswindow->window);
}
-
if(w_current->iwindow) {
gdk_window_raise(w_current->iwindow->window);
}
-
if(w_current->tiwindow) {
gdk_window_raise(w_current->tiwindow->window);
}
@@ -2836,8 +2837,9 @@ PAGE *remember_page;
* in the schematic.
*/
void find_text_dialog_response(GtkWidget *w, gint response,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GtkWidget *textentry;
GtkWidget *checkdescend;
gchar *string;
@@ -2851,8 +2853,8 @@ void find_text_dialog_response(GtkWidget *w, gint response,
strncpy(generic_textstring, string, 256);
- if (remember_page != w_current->page_current) {
- s_page_goto(w_current, remember_page);
+ if (remember_page != toplevel->page_current) {
+ s_page_goto(toplevel, remember_page);
}
done =
o_edit_find_text(w_current, remember_page->object_head, string,
@@ -2882,7 +2884,7 @@ void find_text_dialog_response(GtkWidget *w, gint response,
* \par Function Description
* This function creates the text find dialog.
*/
-void find_text_dialog(TOPLEVEL * w_current)
+void find_text_dialog(GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *label = NULL;
GtkWidget *vbox;
@@ -2891,7 +2893,7 @@ void find_text_dialog(TOPLEVEL * w_current)
OBJECT *object = NULL;
start_find = 1;
- remember_page = w_current->page_current;
+ remember_page = w_current->toplevel->page_current;
if ((object = o_select_return_first_object(w_current)) != NULL) {
if (object->type == OBJ_TEXT) {
strncpy(generic_textstring, object->text->string, 256);
@@ -2971,7 +2973,7 @@ void find_text_dialog(TOPLEVEL * w_current)
* and hides all text elements that starts with the searchtext.
*/
void hide_text_dialog_response(GtkWidget *w, gint response,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *textentry;
gchar *string;
@@ -2983,7 +2985,7 @@ void hide_text_dialog_response(GtkWidget *w, gint response,
strncpy(generic_textstring, string, 256);
o_edit_hide_specific_text(w_current,
- w_current->page_current->object_head, string);
+ w_current->toplevel->page_current->object_head, string);
break;
case GTK_RESPONSE_REJECT:
case GTK_RESPONSE_DELETE_EVENT:
@@ -2999,7 +3001,7 @@ void hide_text_dialog_response(GtkWidget *w, gint response,
* \par Function Description
* This function creates the hide text dialog.
*/
-void hide_text_dialog(TOPLEVEL * w_current)
+void hide_text_dialog(GSCHEM_TOPLEVEL * w_current)
{
GtkWidget *label = NULL;
GtkWidget *textentry;
@@ -3072,7 +3074,7 @@ void hide_text_dialog(TOPLEVEL * w_current)
* the given search text and hides those text objects.
*/
void show_text_dialog_response(GtkWidget *widget, gint response,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *textentry;
gchar *string;
@@ -3084,7 +3086,7 @@ void show_text_dialog_response(GtkWidget *widget, gint response,
strncpy(generic_textstring, string, 256);
o_edit_show_specific_text(w_current,
- w_current->page_current->object_head, string);
+ w_current->toplevel->page_current->object_head, string);
break;
case GTK_RESPONSE_REJECT:
case GTK_RESPONSE_DELETE_EVENT:
@@ -3100,7 +3102,7 @@ void show_text_dialog_response(GtkWidget *widget, gint response,
* \par Function Description
* This function creates the show text dialog.
*/
-void show_text_dialog(TOPLEVEL * w_current)
+void show_text_dialog(GSCHEM_TOPLEVEL * w_current)
{
GtkWidget *label = NULL;
GtkWidget *textentry;
@@ -3229,15 +3231,15 @@ int text_view_calculate_real_tab_width(GtkTextView *textview, int tab_size)
* \par Function Description
*
*/
-void major_changed_dialog(TOPLEVEL* w_current)
+void major_changed_dialog(GSCHEM_TOPLEVEL* w_current)
{
GtkWidget* dialog;
char* refdes_string = NULL;
char* tmp;
- if (w_current->major_changed_refdes) {
+ if (w_current->toplevel->major_changed_refdes) {
- GList* current = w_current->major_changed_refdes;
+ GList* current = w_current->toplevel->major_changed_refdes;
while (current)
{
char *value = (char*) current->data;
@@ -3920,7 +3922,7 @@ close_confirmation_dialog_get_selected_pages (CloseConfirmationDialog *dialog)
* \param in page The page to close.
*/
void
-x_dialog_close_changed_page (TOPLEVEL *toplevel, PAGE *page)
+x_dialog_close_changed_page (GSCHEM_TOPLEVEL *w_current, PAGE *page)
{
GtkWidget *dialog;
@@ -3938,18 +3940,18 @@ x_dialog_close_changed_page (TOPLEVEL *toplevel, PAGE *page)
case GTK_RESPONSE_NO:
/* action selected: close without saving */
/* close the page, discard changes */
- x_window_close_page (toplevel, page);
+ x_window_close_page (w_current, page);
break;
case GTK_RESPONSE_YES:
/* action selected: save */
/* prompts user for the filename and ultimate confirmation */
- s_page_goto (toplevel, page);
- x_fileselect_save (toplevel);
+ s_page_goto (w_current->toplevel, page);
+ x_fileselect_save (w_current);
/* has the page been really saved? */
if (!page->CHANGED) {
- x_window_close_page (toplevel, page);
+ x_window_close_page (w_current, page);
}
/* no, user has cancelled the save and page has changes */
/* do not close page */
@@ -3984,8 +3986,9 @@ x_dialog_close_changed_page (TOPLEVEL *toplevel, PAGE *page)
* \returns TRUE if the window can be closed, FALSE otherwise.
*/
gboolean
-x_dialog_close_window (TOPLEVEL *toplevel)
+x_dialog_close_window (GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *iter;
GtkWidget *dialog;
PAGE *p_current;
@@ -4033,7 +4036,7 @@ x_dialog_close_window (TOPLEVEL *toplevel)
p_current = (PAGE*)p_unsaved->data;
s_page_goto (toplevel, p_current);
- x_fileselect_save (toplevel);
+ x_fileselect_save (w_current);
/* if user cancelled previous, do not close window */
ret &= !p_current->CHANGED;
}
diff --git a/gschem/src/x_event.c b/gschem/src/x_event.c
index 0f95cba..2a9d071 100644
--- a/gschem/src/x_event.c
+++ b/gschem/src/x_event.c
@@ -27,6 +27,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -62,15 +63,16 @@ int stroke_trans (char *sequence);
*
*/
gint x_event_expose(GtkWidget *widget, GdkEventExpose *event,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
#if DEBUG
printf("EXPOSE\n");
#endif
exit_if_null(w_current);
/* nasty global variable */
- global_window_current = (TOPLEVEL *) w_current;
+ global_window_current = w_current;
gdk_draw_pixmap(widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
@@ -89,14 +91,14 @@ gint x_event_expose(GtkWidget *widget, GdkEventExpose *event,
case(ENDCOPY):
case(ENDMCOPY):
o_drawbounding(w_current,
- geda_list_get_glist( w_current->page_current->selection_list ),
+ geda_list_get_glist( toplevel->page_current->selection_list ),
x_get_darkcolor(w_current->bb_color), FALSE);
break;
case(DRAWCOMP):
case(ENDCOMP):
case(ENDPASTE):
o_drawbounding(w_current,
- w_current->page_current->complex_place_list,
+ toplevel->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), FALSE);
break;
@@ -146,8 +148,9 @@ gint x_event_expose(GtkWidget *widget, GdkEventExpose *event,
*
*/
gint x_event_button_pressed(GtkWidget *widget, GdkEventButton *event,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int prev_state;
int w_x, w_y;
@@ -159,7 +162,7 @@ gint x_event_button_pressed(GtkWidget *widget, GdkEventButton *event,
printf("event state: %d \n", event->state);
printf("w_current state: %d \n", w_current->event_state);
printf("Selection is:\n");
- o_selection_print_all(&(w_current->page_current->selection_list));
+ o_selection_print_all(&(toplevel->page_current->selection_list));
printf("\n");
#endif
@@ -167,8 +170,8 @@ gint x_event_button_pressed(GtkWidget *widget, GdkEventButton *event,
(w_current->event_state == STARTSELECT ||
w_current->event_state == SELECT)) {
o_find_object(w_current, (int) event->x, (int) event->y, TRUE);
- if ( geda_list_get_glist( w_current->page_current->selection_list )) {
- o_edit(w_current, geda_list_get_glist( w_current->page_current->selection_list ));
+ if ( geda_list_get_glist( toplevel->page_current->selection_list )) {
+ o_edit(w_current, geda_list_get_glist( toplevel->page_current->selection_list ));
return(0);
}
}
@@ -376,12 +379,12 @@ gint x_event_button_pressed(GtkWidget *widget, GdkEventButton *event,
case(ENDCOMP):
o_complex_end(w_current,
- fix_x(w_current, (int) event->x),
- fix_y(w_current, (int) event->y));
+ fix_x(toplevel, (int) event->x),
+ fix_y(toplevel, (int) event->y));
/* not sure on this one */
/* probably keep this one */
- o_redraw_single(w_current, w_current->page_current->
+ o_redraw_single(w_current, toplevel->page_current->
object_tail);
if (w_current->continue_component_place) {
o_complex_start(w_current,
@@ -396,8 +399,8 @@ gint x_event_button_pressed(GtkWidget *widget, GdkEventButton *event,
case(ENDPASTE):
o_buffer_paste_end(w_current,
- fix_x(w_current, (int) event->x),
- fix_y(w_current, (int) event->y),
+ fix_x(toplevel, (int) event->x),
+ fix_y(toplevel, (int) event->y),
w_current->buffer_number);
w_current->inside_action = 0;
i_set_state(w_current, SELECT);
@@ -405,21 +408,21 @@ gint x_event_button_pressed(GtkWidget *widget, GdkEventButton *event,
break;
case(ENDROTATEP):
- prev_state = w_current->DONT_REDRAW;
- w_current->DONT_REDRAW = 0;
+ prev_state = toplevel->DONT_REDRAW;
+ toplevel->DONT_REDRAW = 0;
- SCREENtoWORLD( w_current,
+ SCREENtoWORLD( toplevel,
(int) event->x,
(int) event->y,
&w_x, &w_y );
- w_x = snap_grid(w_current, w_x);
- w_y = snap_grid(w_current, w_y);
+ w_x = snap_grid(toplevel, w_x);
+ w_y = snap_grid(toplevel, w_y);
o_rotate_90_world(
w_current,
- geda_list_get_glist( w_current->page_current->selection_list ),
+ geda_list_get_glist( toplevel->page_current->selection_list ),
w_x, w_y);
- w_current->DONT_REDRAW = prev_state;
+ toplevel->DONT_REDRAW = prev_state;
w_current->inside_action = 0;
i_set_state(w_current, SELECT);
@@ -427,15 +430,15 @@ gint x_event_button_pressed(GtkWidget *widget, GdkEventButton *event,
break;
case(ENDMIRROR):
- SCREENtoWORLD( w_current,
+ SCREENtoWORLD( toplevel,
(int) event->x,
(int) event->y,
&w_x, &w_y );
- w_x = snap_grid(w_current, w_x);
- w_y = snap_grid(w_current, w_y);
+ w_x = snap_grid(toplevel, w_x);
+ w_y = snap_grid(toplevel, w_y);
o_mirror_world(w_current,
- geda_list_get_glist( w_current->page_current->selection_list ),
+ geda_list_get_glist( toplevel->page_current->selection_list ),
w_x, w_y);
w_current->inside_action = 0;
@@ -542,10 +545,9 @@ gint x_event_button_pressed(GtkWidget *widget, GdkEventButton *event,
}
break;
- case(REPEAT):
+ case(REPEAT):
if (w_current->last_callback != NULL) {
- (*w_current->last_callback)(w_current,
- 0, NULL);
+ (*w_current->last_callback)(w_current, 0, NULL);
}
break;
#ifdef HAS_LIBSTROKE
@@ -653,8 +655,9 @@ gint x_event_button_pressed(GtkWidget *widget, GdkEventButton *event,
*
*/
gint x_event_button_released(GtkWidget *widget, GdkEventButton *event,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int prev_state;
int redraw_state;
int w_x, w_y;
@@ -716,8 +719,8 @@ gint x_event_button_released(GtkWidget *widget, GdkEventButton *event,
/* having this stay in copy was driving me nuts*/
w_current->inside_action = 1;
/* Keep the state and the inside_action, as the copy has not finished. */
- w_current->last_x = w_current->start_x = fix_x(w_current, mouse_x);
- w_current->last_y = w_current->start_y = fix_y(w_current, mouse_y);
+ w_current->last_x = w_current->start_x = fix_x(toplevel, mouse_x);
+ w_current->last_y = w_current->start_y = fix_y(toplevel, mouse_y);
i_set_state(w_current, ENDMCOPY);
i_update_toolbar(w_current);
o_undo_savestate(w_current, UNDO_ALL);
@@ -772,7 +775,7 @@ gint x_event_button_released(GtkWidget *widget, GdkEventButton *event,
if (w_current->inside_action) {
if (w_current->event_state == ENDCOMP) {
- o_drawbounding(w_current, w_current->page_current->complex_place_list,
+ o_drawbounding(w_current, toplevel->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), TRUE);
w_current->complex_rotate =
@@ -782,16 +785,16 @@ gint x_event_button_released(GtkWidget *widget, GdkEventButton *event,
/* Run the complex place list changed hook without redrawing */
/* since all objects are being redrawn afterwards */
- prev_state = w_current->DONT_REDRAW;
- w_current->DONT_REDRAW = 1;
+ prev_state = toplevel->DONT_REDRAW;
+ toplevel->DONT_REDRAW = 1;
o_complex_place_changed_run_hook (w_current);
- w_current->DONT_REDRAW = prev_state;
+ toplevel->DONT_REDRAW = prev_state;
- o_drawbounding(w_current, w_current->page_current->complex_place_list,
+ o_drawbounding(w_current, toplevel->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), TRUE);
return(0);
} else if (w_current->event_state == ENDTEXT) {
- o_drawbounding(w_current, w_current->page_current->attrib_place_list,
+ o_drawbounding(w_current, toplevel->page_current->attrib_place_list,
x_get_darkcolor(w_current->bb_color), TRUE);
w_current->complex_rotate =
@@ -799,7 +802,7 @@ gint x_event_button_released(GtkWidget *widget, GdkEventButton *event,
o_text_place_rotate(w_current);
- o_drawbounding(w_current, w_current->page_current->attrib_place_list,
+ o_drawbounding(w_current, toplevel->page_current->attrib_place_list,
x_get_darkcolor(w_current->bb_color), TRUE);
return(0);
@@ -807,25 +810,25 @@ gint x_event_button_released(GtkWidget *widget, GdkEventButton *event,
else if (w_current->event_state == ENDMOVE) {
prev_state = w_current->event_state;
- o_drawbounding(w_current, w_current->page_current->complex_place_list,
+ o_drawbounding(w_current, toplevel->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), TRUE);
/* Don't allow o_rotate_90 to erase the selection, neither to
redraw the objects after rotating */
/* skip over head node */
- redraw_state = w_current->DONT_REDRAW;
- w_current->DONT_REDRAW = 1;
- SCREENtoWORLD( w_current,
+ redraw_state = toplevel->DONT_REDRAW;
+ toplevel->DONT_REDRAW = 1;
+ SCREENtoWORLD( toplevel,
w_current->start_x, w_current->start_y,
&w_x, &w_y );
- w_x = snap_grid(w_current, w_x);
- w_y = snap_grid(w_current, w_y);
- o_rotate_90_world(w_current, w_current->page_current->complex_place_list, w_x, w_y );
- w_current->DONT_REDRAW = redraw_state;
+ w_x = snap_grid(toplevel, w_x);
+ w_y = snap_grid(toplevel, w_y);
+ o_rotate_90_world(w_current, toplevel->page_current->complex_place_list, w_x, w_y );
+ toplevel->DONT_REDRAW = redraw_state;
w_current->rotated_inside ++;
w_current->event_state = prev_state;
- o_drawbounding(w_current, w_current->page_current->complex_place_list,
+ o_drawbounding(w_current, toplevel->page_current->complex_place_list,
x_get_darkcolor(w_current->bb_color), TRUE);
return(0);
@@ -930,8 +933,9 @@ gint x_event_button_released(GtkWidget *widget, GdkEventButton *event,
*
*/
gint x_event_motion(GtkWidget *widget, GdkEventMotion *event,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int temp_x, temp_y;
int pdiff_x, pdiff_y;
@@ -1015,17 +1019,17 @@ gint x_event_motion(GtkWidget *widget, GdkEventMotion *event,
(w_current->drag_can_move &&
(! o_find_selected_object(w_current,
w_current->start_x, w_current->start_y)))) {
- temp_x = fix_x(w_current, (int) event->x);
- temp_y = fix_y(w_current, (int) event->y);
+ temp_x = fix_x(toplevel, (int) event->x);
+ temp_y = fix_y(toplevel, (int) event->y);
/* is eight enough of a threshold? */
/* make this configurable anyways */
- diff_x = fabs(w_current->page_current->right -
- w_current->page_current->left);
+ diff_x = fabs(toplevel->page_current->right -
+ toplevel->page_current->left);
#ifdef HAS_RINT
- zoom_scale = (int) rint(w_current->init_right / diff_x);
+ zoom_scale = (int) rint(toplevel->init_right / diff_x);
#else
- zoom_scale = (int) w_current->init_right / diff_x;
+ zoom_scale = (int) toplevel->init_right / diff_x;
#endif
if (zoom_scale < 10) {
@@ -1065,8 +1069,8 @@ gint x_event_motion(GtkWidget *widget, GdkEventMotion *event,
}
o_complex_rubbercomplex(w_current);
- w_current->last_x = fix_x(w_current, (int) event->x);
- w_current->last_y = fix_y(w_current, (int) event->y);
+ w_current->last_x = fix_x(toplevel, (int) event->x);
+ w_current->last_y = fix_y(toplevel, (int) event->y);
o_complex_rubbercomplex(w_current);
if (w_current->netconn_rubberband) {
o_move_stretch_rubberband(w_current);
@@ -1081,12 +1085,12 @@ gint x_event_motion(GtkWidget *widget, GdkEventMotion *event,
case(MCOPY):
if (w_current->inside_action) {
o_drawbounding(w_current,
- geda_list_get_glist( w_current->page_current->selection_list ),
+ geda_list_get_glist( toplevel->page_current->selection_list ),
x_get_darkcolor(w_current->bb_color), FALSE);
- w_current->last_x = fix_x(w_current, (int) event->x);
- w_current->last_y = fix_y(w_current, (int) event->y);
+ w_current->last_x = fix_x(toplevel, (int) event->x);
+ w_current->last_y = fix_y(toplevel, (int) event->y);
o_drawbounding(w_current,
- geda_list_get_glist( w_current->page_current->selection_list ),
+ geda_list_get_glist( toplevel->page_current->selection_list ),
x_get_darkcolor(w_current->bb_color), FALSE);
}
break;
@@ -1161,15 +1165,15 @@ gint x_event_motion(GtkWidget *widget, GdkEventMotion *event,
case(ENDCOMP):
o_complex_rubbercomplex(w_current);
- w_current->last_x = fix_x(w_current, (int) event->x);
- w_current->last_y = fix_y(w_current, (int) event->y);
+ w_current->last_x = fix_x(toplevel, (int) event->x);
+ w_current->last_y = fix_y(toplevel, (int) event->y);
o_complex_rubbercomplex(w_current);
break;
case(ENDPASTE):
o_buffer_paste_rubberpaste(w_current, w_current->buffer_number);
- w_current->last_x = fix_x(w_current, (int) event->x);
- w_current->last_y = fix_y(w_current, (int) event->y);
+ w_current->last_x = fix_x(toplevel, (int) event->x);
+ w_current->last_y = fix_y(toplevel, (int) event->y);
o_buffer_paste_rubberpaste(w_current, w_current->buffer_number);
break;
@@ -1182,8 +1186,8 @@ gint x_event_motion(GtkWidget *widget, GdkEventMotion *event,
case(ENDTEXT):
o_text_rubberattrib(w_current);
- w_current->last_x = fix_x(w_current, (int) event->x);
- w_current->last_y = fix_y(w_current, (int) event->y);
+ w_current->last_x = fix_x(toplevel, (int) event->x);
+ w_current->last_y = fix_y(toplevel, (int) event->y);
o_text_rubberattrib(w_current);
break;
@@ -1206,7 +1210,7 @@ gint x_event_motion(GtkWidget *widget, GdkEventMotion *event,
return(0);
}
-/*! \brief Updates the toplevel and display when drawing area is configured.
+/*! \brief Updates the GSCHEM_TOPLEVEL and display when drawing area is configured.
* \par Function Description
* This is the callback function connected to the configure event of
* the drawing area of the main window.
@@ -1229,22 +1233,23 @@ x_event_configure (GtkWidget *widget,
GdkEventConfigure *event,
gpointer user_data)
{
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*)user_data;
+ TOPLEVEL *toplevel = w_current->toplevel;
GList *iter;
- TOPLEVEL *toplevel = (TOPLEVEL*)user_data;
PAGE *old_page_current, *p_current;
gint old_win_width, old_win_height, new_win_width, new_win_height;
gdouble relativ_zoom_factor = 1.0;
g_assert (toplevel != NULL);
- global_window_current = toplevel;
+ global_window_current = w_current;
if (toplevel->page_current == NULL) {
/* don't want to call this if the current page isn't setup yet */
return FALSE;
}
- old_win_width = toplevel->win_width;
- old_win_height = toplevel->win_height;
+ old_win_width = w_current->win_width;
+ old_win_height = w_current->win_height;
new_win_width = event->width;
new_win_height = event->height;
@@ -1256,16 +1261,16 @@ x_event_configure (GtkWidget *widget,
}
/* update the backingstore of toplevel */
- if (toplevel->backingstore != NULL) {
- gdk_pixmap_unref (toplevel->backingstore);
+ if (w_current->backingstore != NULL) {
+ gdk_pixmap_unref (w_current->backingstore);
}
- toplevel->backingstore = gdk_pixmap_new (widget->window,
+ w_current->backingstore = gdk_pixmap_new (widget->window,
new_win_width,
new_win_height,
-1);
- /* update the toplevel with new size of drawing area */
- toplevel->win_width = toplevel->width = new_win_width;
- toplevel->win_height = toplevel->height = new_win_height;
+ /* update the GSCHEM_TOPLEVEL with new size of drawing area */
+ w_current->win_width = toplevel->width = new_win_width;
+ w_current->win_height = toplevel->height = new_win_height;
/* in the case the user has maximised the window (hence the */
@@ -1287,7 +1292,7 @@ x_event_configure (GtkWidget *widget,
/* save current page */
old_page_current = toplevel->page_current;
- /* re-pan each page of the toplevel */
+ /* re-pan each page of the TOPLEVEL */
for ( iter = geda_list_get_glist( toplevel->pages );
iter != NULL;
iter = g_list_next( iter ) ) {
@@ -1299,7 +1304,7 @@ x_event_configure (GtkWidget *widget,
cx = ((gdouble)(p_current->left + p_current->right)) / 2;
cy = ((gdouble)(p_current->top + p_current->bottom)) / 2;
s_page_goto (toplevel, p_current);
- a_pan_general (toplevel, cx, cy, relativ_zoom_factor, A_PAN_DONT_REDRAW);
+ a_pan_general (w_current, cx, cy, relativ_zoom_factor, A_PAN_DONT_REDRAW);
}
/* restore current page to saved value */
@@ -1307,8 +1312,8 @@ x_event_configure (GtkWidget *widget,
if (!toplevel->DONT_REDRAW) {
/* redraw the current page and update UI */
- o_redraw_all_fast (toplevel);
- x_scrollbars_update (toplevel);
+ o_redraw_all_fast (w_current);
+ x_scrollbars_update (w_current);
}
return FALSE;
@@ -1322,9 +1327,10 @@ x_event_configure (GtkWidget *widget,
* this is used during an open command
* to setup the correct sizes
*/
-void x_manual_resize(TOPLEVEL *w_current)
+void x_manual_resize(GSCHEM_TOPLEVEL *w_current)
{
-
+ TOPLEVEL *toplevel = w_current->toplevel;
+
/* of the actual win window (drawing_area) */
w_current->win_width = w_current->drawing_area->allocation.width;
w_current->win_height = w_current->drawing_area->allocation.height;
@@ -1333,15 +1339,15 @@ void x_manual_resize(TOPLEVEL *w_current)
printf("manual: %d %d\n", w_current->win_width, w_current->win_height);
#endif
- w_current->width = w_current->win_width;
- w_current->height = w_current->win_height;
+ toplevel->width = w_current->win_width;
+ toplevel->height = w_current->win_height;
/* need to do this every time you change width / height */
- set_window(w_current, w_current->page_current,
- w_current->page_current->left,
- w_current->page_current->right,
- w_current->page_current->top,
- w_current->page_current->bottom);
+ set_window(toplevel, toplevel->page_current,
+ toplevel->page_current->left,
+ toplevel->page_current->right,
+ toplevel->page_current->top,
+ toplevel->page_current->bottom);
#if DEBUG
printf("Window aspect: %f\n",
@@ -1360,8 +1366,9 @@ void x_manual_resize(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_event_hschanged (GtkAdjustment *adj, TOPLEVEL *w_current)
+void x_event_hschanged (GtkAdjustment *adj, GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int current_left;
int new_left;
GtkAdjustment *hadjustment;
@@ -1376,15 +1383,15 @@ void x_event_hschanged (GtkAdjustment *adj, TOPLEVEL *w_current)
hadjustment =
gtk_range_get_adjustment(GTK_RANGE(w_current->h_scrollbar));
- current_left = w_current->page_current->left;
+ current_left = toplevel->page_current->left;
new_left = (int) hadjustment->value;
- w_current->page_current->left = new_left;
- w_current->page_current->right =
- w_current->page_current->right -
+ toplevel->page_current->left = new_left;
+ toplevel->page_current->right =
+ toplevel->page_current->right -
(current_left - new_left);
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_redraw_all_fast(w_current);
}
}
@@ -1394,8 +1401,9 @@ void x_event_hschanged (GtkAdjustment *adj, TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_event_vschanged (GtkAdjustment *adj, TOPLEVEL *w_current)
+void x_event_vschanged (GtkAdjustment *adj, GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int current_bottom;
int new_bottom;
GtkAdjustment *vadjustment;
@@ -1410,22 +1418,22 @@ void x_event_vschanged (GtkAdjustment *adj, TOPLEVEL *w_current)
vadjustment = gtk_range_get_adjustment(
GTK_RANGE(w_current->v_scrollbar));
- current_bottom = w_current->page_current->bottom;
- new_bottom = w_current->init_bottom - (int) vadjustment->value;
+ current_bottom = toplevel->page_current->bottom;
+ new_bottom = toplevel->init_bottom - (int) vadjustment->value;
- w_current->page_current->bottom = new_bottom;
- w_current->page_current->top =
- w_current->page_current->top -
+ toplevel->page_current->bottom = new_bottom;
+ toplevel->page_current->top =
+ toplevel->page_current->top -
(current_bottom - new_bottom);
#if DEBUG
printf("vrange %f %f\n", vadjustment->lower, vadjustment->upper);
printf("vvalue %f\n", vadjustment->value);
- printf("actual: %d %d\n", w_current->page_current->top,
- w_current->page_current->bottom);
+ printf("actual: %d %d\n", toplevel->page_current->top,
+ toplevel->page_current->bottom);
#endif
- if (!w_current->DONT_REDRAW) {
+ if (!toplevel->DONT_REDRAW) {
o_redraw_all_fast(w_current);
}
}
@@ -1436,7 +1444,7 @@ void x_event_vschanged (GtkAdjustment *adj, TOPLEVEL *w_current)
*
*/
gint x_event_enter(GtkWidget *widget, GdkEventCrossing *event,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
exit_if_null(w_current);
global_window_current = w_current;
@@ -1450,7 +1458,7 @@ gint x_event_enter(GtkWidget *widget, GdkEventCrossing *event,
*
*/
gboolean x_event_key_press (GtkWidget *widget, GdkEventKey *event,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
int retval;
@@ -1476,7 +1484,7 @@ gboolean x_event_key_press (GtkWidget *widget, GdkEventKey *event,
*
*/
gint x_event_scroll (GtkWidget *widget, GdkEventScroll *event,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
GtkAdjustment *adj;
diff --git a/gschem/src/x_fileselect.c b/gschem/src/x_fileselect.c
index adc491f..c23c39d 100644
--- a/gschem/src/x_fileselect.c
+++ b/gschem/src/x_fileselect.c
@@ -26,6 +26,7 @@
#include <libgeda/libgeda.h>
#include <gtk/gtk.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
#include "../include/x_preview.h"
@@ -158,23 +159,23 @@ x_fileselect_add_preview (GtkFileChooser *filechooser)
/*! \brief Opens a file chooser for opening one or more schematics.
* \par Function Description
* This function opens a file chooser dialog and wait for the user to
- * select at least one file to load as <B>toplevel</B>'s new pages.
+ * select at least one file to load as <B>w_current</B>'s new pages.
*
* The function updates the user interface.
*
- * At the end of the function, the toplevel's current page is set to
- * the page of the last loaded page.
+ * At the end of the function, the w_current->toplevel's current page
+ * is set to the page of the last loaded page.
*
- * \param [in] toplevel The toplevel environment.
+ * \param [in] w_current The GSCHEM_TOPLEVEL environment.
*/
void
-x_fileselect_open(TOPLEVEL *toplevel)
+x_fileselect_open(GSCHEM_TOPLEVEL *w_current)
{
PAGE *page = NULL;
GtkWidget *dialog;
dialog = gtk_file_chooser_dialog_new (_("Open..."),
- GTK_WINDOW(toplevel->main_window),
+ GTK_WINDOW(w_current->main_window),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
@@ -202,11 +203,11 @@ x_fileselect_open(TOPLEVEL *toplevel)
/* open each file */
for (tmp = filenames; tmp != NULL;tmp = g_slist_next (tmp)) {
- page = x_window_open_page (toplevel, (gchar*)tmp->data);
+ page = x_window_open_page (w_current, (gchar*)tmp->data);
}
/* Switch to the last page opened */
if ( page != NULL )
- x_window_set_current_page (toplevel, page);
+ x_window_set_current_page (w_current, page);
/* free the list of filenames */
g_slist_foreach (filenames, (GFunc)g_free, NULL);
@@ -227,15 +228,15 @@ x_fileselect_open(TOPLEVEL *toplevel)
*
* The function updates the user interface.
*
- * \param [in] toplevel The toplevel environment.
+ * \param [in] w_current The GSCHEM_TOPLEVEL environment.
*/
void
-x_fileselect_save (TOPLEVEL *toplevel)
+x_fileselect_save (GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *dialog;
dialog = gtk_file_chooser_dialog_new (_("Save as..."),
- GTK_WINDOW(toplevel->main_window),
+ GTK_WINDOW(w_current->main_window),
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
@@ -264,7 +265,7 @@ x_fileselect_save (TOPLEVEL *toplevel)
x_fileselect_setup_filechooser_filters (GTK_FILE_CHOOSER (dialog));
/* set the current filename or directory name if new document */
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog),
- toplevel->page_current->page_filename);
+ w_current->toplevel->page_current->page_filename);
gtk_dialog_set_default_response(GTK_DIALOG(dialog),
GTK_RESPONSE_ACCEPT);
@@ -275,8 +276,8 @@ x_fileselect_save (TOPLEVEL *toplevel)
/* try saving current page of toplevel to file filename */
if (filename != NULL) {
- x_window_save_page (toplevel,
- toplevel->page_current,
+ x_window_save_page (w_current,
+ w_current->toplevel->page_current,
filename);
}
}
@@ -289,6 +290,9 @@ x_fileselect_save (TOPLEVEL *toplevel)
* This function opens a message dialog and wait for the user to choose
* if load the backup or the original file.
*
+ * \todo Make this a registered callback function with user data,
+ * as we'd rather be passed a GSCHEM_TOPLEVEL than a TOPLEVEL.
+ *
* \param [in] toplevel The TOPLEVEL object.
* \param [in] message Message to display to user.
* \return TRUE if the user wants to load the backup file, FALSE otherwise.
@@ -296,10 +300,24 @@ x_fileselect_save (TOPLEVEL *toplevel)
int x_fileselect_load_backup(TOPLEVEL *toplevel, GString *message)
{
GtkWidget *dialog;
+ GSCHEM_TOPLEVEL *window, *w_current = NULL;
+ GList *iter;
+
+ /* Find the matching GSCHEM_TOPLEVEL for the TOPLEVEL we were passed */
+ iter = global_window_list;
+ while (iter != NULL) {
+ window = (GSCHEM_TOPLEVEL *)iter->data;
+ if (window->toplevel == toplevel) {
+ w_current = window;
+ break;
+ }
+ iter = g_list_next (iter);
+ }
+ g_assert( w_current != NULL );
g_string_append(message, "\nIf you load the original file, the backup file will be overwritten in the next autosave timeout and it will be lost.\n\nDo you want to load the backup file?\n");
- dialog = gtk_message_dialog_new(GTK_WINDOW(toplevel->main_window),
+ dialog = gtk_message_dialog_new(GTK_WINDOW(w_current->main_window),
GTK_DIALOG_MODAL,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO,
diff --git a/gschem/src/x_grid.c b/gschem/src/x_grid.c
index 58a0666..29aba56 100644
--- a/gschem/src/x_grid.c
+++ b/gschem/src/x_grid.c
@@ -26,6 +26,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/x_states.h"
#include "../include/prototype.h"
@@ -40,8 +41,9 @@ static GdkPoint points[5000];
* \par Function Description
*
*/
-void x_grid_draw(TOPLEVEL *w_current)
+void x_grid_draw(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int i, j;
int x, y;
int x_start, y_start;
@@ -59,11 +61,11 @@ void x_grid_draw(TOPLEVEL *w_current)
{
/* In the variable mode around every 30th screenpixel will be grid-point */
/* adding 0.1 for correct cast*/
- incr = round_5_2_1(w_current->page_current->to_world_x_constant *30)+0.1;
+ incr = round_5_2_1(toplevel->page_current->to_world_x_constant *30)+0.1;
/*limit grid to snap_size; only a idea of mine, hope you like it (hw) */
- if (incr < w_current->snap_size) {
- incr = w_current->snap_size;
+ if (incr < toplevel->snap_size) {
+ incr = toplevel->snap_size;
}
/* usually this should never happen */
if (incr < 1){
@@ -72,8 +74,8 @@ void x_grid_draw(TOPLEVEL *w_current)
}
else
{
- incr = w_current->snap_size;
- screen_incr = SCREENabs(w_current, incr);
+ incr = toplevel->snap_size;
+ screen_incr = SCREENabs(toplevel, incr);
if (screen_incr < w_current->grid_fixed_threshold)
{
/* don't draw the grid if the screen incr spacing is less than the */
@@ -100,18 +102,18 @@ void x_grid_draw(TOPLEVEL *w_current)
/* figure starting grid coordinates, work by taking the start
* and end coordinates and rounding down to the nearest
* increment */
- x_start = (w_current->page_current->left -
- (w_current->page_current->left % incr));
- y_start = (w_current->page_current->top -
- (w_current->page_current->top % incr));
-
- for (i = x_start; i < w_current->page_current->right; i = i + incr) {
- for(j = y_start; j < w_current->page_current->bottom; j = j + incr) {
- WORLDtoSCREEN(w_current, i,j, &x, &y);
- if (inside_region(w_current->page_current->left,
- w_current->page_current->top,
- w_current->page_current->right,
- w_current->page_current->bottom,
+ x_start = (toplevel->page_current->left -
+ (toplevel->page_current->left % incr));
+ y_start = (toplevel->page_current->top -
+ (toplevel->page_current->top % incr));
+
+ for (i = x_start; i < toplevel->page_current->right; i = i + incr) {
+ for(j = y_start; j < toplevel->page_current->bottom; j = j + incr) {
+ WORLDtoSCREEN(toplevel, i,j, &x, &y);
+ if (inside_region(toplevel->page_current->left,
+ toplevel->page_current->top,
+ toplevel->page_current->right,
+ toplevel->page_current->bottom,
i, j)) {
if (w_current->grid_dot_size == 1)
@@ -165,8 +167,9 @@ void x_grid_draw(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_draw_tiles(TOPLEVEL *w_current)
+void x_draw_tiles(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
TILE *t_current;
GdkFont *font;
int i,j;
@@ -180,10 +183,10 @@ void x_draw_tiles(TOPLEVEL *w_current)
font = gdk_fontset_load ("fixed");
for (j = 0; j < MAX_TILES_Y; j++) {
for (i = 0; i < MAX_TILES_X; i++) {
- t_current = &w_current->page_current->world_tiles[i][j];
- WORLDtoSCREEN(w_current, t_current->left,
+ t_current = &toplevel->page_current->world_tiles[i][j];
+ WORLDtoSCREEN(toplevel, t_current->left,
t_current->top, &x1, &y1);
- WORLDtoSCREEN(w_current, t_current->right,
+ WORLDtoSCREEN(toplevel, t_current->right,
t_current->bottom, &x2, &y2);
screen_x = min(x1, x2);
diff --git a/gschem/src/x_image.c b/gschem/src/x_image.c
index 2ed738f..af3db6a 100644
--- a/gschem/src/x_image.c
+++ b/gschem/src/x_image.c
@@ -32,6 +32,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
#include "../include/x_dialog.h"
@@ -48,7 +49,7 @@
#define X_IMAGE_DEFAULT_TYPE "PNG"
static char *x_image_sizes[] = {"320x240", "640x480", "800x600", "1200x768",
- "1280x960", "1600x1200", "3200x2400", NULL};
+ "1280x960", "1600x1200", "3200x2400", NULL};
#if ((GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION < 6))
/* gtk_combo_box_get_active_text was included in GTK 2.6, so we need to store
@@ -61,7 +62,7 @@ GSList *image_type_descriptions = NULL;
static void free_image_type_descriptions_list ()
{
GSList *ptr;
-
+
/* Free the data stored in each node */
ptr = image_type_descriptions;
while (ptr) {
@@ -140,23 +141,23 @@ static void create_type_menu(GtkComboBox *combo)
/* If GTK < 2.6, then add it also to the descriptions list. */
#if ((GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION < 6))
image_type_descriptions = g_slist_append(image_type_descriptions,
- buf);
+ buf);
#endif
/* Compare the name with "png" and store the index */
buf = g_strdup_printf(gdk_pixbuf_format_get_name(ptr->data));
if (strcasecmp(buf, X_IMAGE_DEFAULT_TYPE) == 0) {
- default_index = i;
+ default_index = i;
}
i++; /* this is the count of items added to the combo box */
- /* not the total number of pixbuf formats */
+ /* not the total number of pixbuf formats */
g_free(buf);
}
ptr = ptr->next;
}
g_slist_free (formats);
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Encapsulated Postscript");
-
+
/* Set the default menu */
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), default_index);
return;
@@ -175,7 +176,7 @@ static char *x_image_get_type_from_description(char *description) {
GSList *formats = gdk_pixbuf_get_formats ();
GSList *ptr;
gchar *ptr_descr;
-
+
/*WK - catch EPS export case*/
if (strcmp(descr, _("Encapsulated Postscript")) == 0) {
return(g_strdup("eps"));
@@ -199,14 +200,14 @@ static char *x_image_get_type_from_description(char *description) {
* \par Given a combobox inside a file chooser dialog, this function updates
* the filename displayed by the dialog, removing the current extension, and
* adding the extension of the image type selected.
- * \param combo [in] A combobox inside a file chooser dialog, with gdk-pixbuf image type descriptions.
- * \param w_current [in] the TOPLEVEL structure.
+ * \param combo [in] A combobox inside a file chooser dialog, with gdk-pixbuf image type descriptions.
+ * \param w_current [in] the GSCHEM_TOPLEVEL structure.
* \return nothing.
*
*/
static void x_image_update_dialog_filename(GtkComboBox *combo,
- TOPLEVEL *w_current) {
-
+ GSCHEM_TOPLEVEL *w_current) {
+ TOPLEVEL *toplevel = w_current->toplevel;
char* image_type_descr = NULL;
char *image_type = NULL;
char *old_image_filename = NULL;
@@ -214,13 +215,13 @@ static void x_image_update_dialog_filename(GtkComboBox *combo,
char *file_name = NULL ;
char *new_image_filename = NULL;
GtkWidget *file_chooser;
-
+
/* Get the current image type */
#if ((GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION < 6))
GSList *ptr;
/* If GTK < 2.6, get the description from the descriptions list */
ptr = g_slist_nth(image_type_descriptions,
- gtk_combo_box_get_active(GTK_COMBO_BOX(combo)));
+ gtk_combo_box_get_active(GTK_COMBO_BOX(combo)));
image_type_descr = (char *) (ptr->data);
#else
image_type_descr = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
@@ -229,12 +230,12 @@ static void x_image_update_dialog_filename(GtkComboBox *combo,
/* Get the parent dialog */
file_chooser = gtk_widget_get_ancestor(GTK_WIDGET(combo),
- GTK_TYPE_FILE_CHOOSER);
+ GTK_TYPE_FILE_CHOOSER);
/* Get the previous file name. If none, revert to the page filename */
old_image_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_chooser));
if (!old_image_filename) {
- old_image_filename = w_current->page_current->page_filename;
+ old_image_filename = toplevel->page_current->page_filename;
}
/* Get the file name, without extension */
@@ -243,23 +244,23 @@ static void x_image_update_dialog_filename(GtkComboBox *combo,
if (g_strrstr(file_basename, ".") != NULL) {
file_name = g_strndup(file_basename,
- g_strrstr(file_basename, ".") - file_basename);
+ g_strrstr(file_basename, ".") - file_basename);
}
}
/* Add the extension */
if (file_name) {
new_image_filename = g_strdup_printf("%s.%s", file_name,
- image_type);
+ image_type);
} else {
new_image_filename = g_strdup_printf("%s.%s", file_basename,
- image_type);
+ image_type);
}
/* Set the new filename */
if (file_chooser) {
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(file_chooser),
- new_image_filename);
+ new_image_filename);
} else {
s_log_message("x_image_update_dialog_filename: No parent file chooser found!.\n");
fprintf(stderr, "x_image_update_dialog_filename: No parent file chooser found!.\n");
@@ -273,52 +274,54 @@ static void x_image_update_dialog_filename(GtkComboBox *combo,
/*! \brief Write eps image file.
* \par This function writes the eps file, using the postscript print code
* from libgeda. Orientation is portrait and type is extents without margins.
- * \param w_current [in] the TOPLEVEL structure.
- * \param filename [in] the image filename.
+ * \param w_current [in] the GSCHEM_TOPLEVEL structure.
+ * \param filename [in] the image filename.
* \return nothing
*
*/
-void x_image_write_eps(TOPLEVEL *w_current, const char* filename)
+void x_image_write_eps(GSCHEM_TOPLEVEL *w_current, const char* filename)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int result;
int w, h, orientation, type;
- w = w_current->paper_width;
- h = w_current->paper_height;
- orientation = w_current->print_orientation;
- type = w_current->print_output_type;
-
- w_current->paper_width = 0;
- w_current->paper_height = 0;
- w_current->print_orientation = PORTRAIT;
- w_current->print_output_type = EXTENTS_NOMARGINS;
- result = f_print_file (w_current, filename);
+ w = toplevel->paper_width;
+ h = toplevel->paper_height;
+ orientation = toplevel->print_orientation;
+ type = toplevel->print_output_type;
+
+ toplevel->paper_width = 0;
+ toplevel->paper_height = 0;
+ toplevel->print_orientation = PORTRAIT;
+ toplevel->print_output_type = EXTENTS_NOMARGINS;
+ result = f_print_file (toplevel, filename);
if (result) {
- fprintf(stderr, "x_image_lowlevel: Unable to save eps file %s.\n",
- filename);
- s_log_message(_("x_image_lowlevel: Unable to write eps file %s.\n"),
- filename);
+ fprintf(stderr, "x_image_lowlevel: Unable to save eps file %s.\n",
+ filename);
+ s_log_message(_("x_image_lowlevel: Unable to write eps file %s.\n"),
+ filename);
}
- w_current->paper_width = w;
- w_current->paper_height = h;
- w_current->print_orientation = orientation;
- w_current->print_output_type = type;
+ toplevel->paper_width = w;
+ toplevel->paper_height = h;
+ toplevel->print_orientation = orientation;
+ toplevel->print_output_type = type;
}
/*! \brief Write the image file, with the desired options.
* \par This function writes the image file, with the options set in the
* dialog by the user.
- * \param w_current [in] the TOPLEVEL structure.
- * \param filename [in] the image filename.
- * \param desired_width [in] the image width chosen by the user.
+ * \param w_current [in] the GSCHEM_TOPLEVEL structure.
+ * \param filename [in] the image filename.
+ * \param desired_width [in] the image width chosen by the user.
* \param desired_height [in] the image height chosen by the user.
* \param filetype [in] image filetype.
* \return nothing
*
*/
-void x_image_lowlevel(TOPLEVEL *w_current, const char* filename,
- int desired_width, int desired_height, char *filetype)
+void x_image_lowlevel(GSCHEM_TOPLEVEL *w_current, const char* filename,
+ int desired_width, int desired_height, char *filetype)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
int width, height;
int save_height, save_width;
int save_page_left, save_page_right, save_page_top, save_page_bottom;
@@ -331,17 +334,17 @@ void x_image_lowlevel(TOPLEVEL *w_current, const char* filename,
w_current->image_width = width = desired_width;
w_current->image_height = height = desired_height;
- save_width = w_current->width;
- save_height = w_current->height;
+ save_width = toplevel->width;
+ save_height = toplevel->height;
- w_current->width = width;
- w_current->height = height;
+ toplevel->width = width;
+ toplevel->height = height;
+
+ save_page_left = toplevel->page_current->left;
+ save_page_right = toplevel->page_current->right;
+ save_page_top = toplevel->page_current->top;
+ save_page_bottom = toplevel->page_current->bottom;
- save_page_left = w_current->page_current->left;
- save_page_right = w_current->page_current->right;
- save_page_top = w_current->page_current->top;
- save_page_bottom = w_current->page_current->bottom;
-
page_width = save_page_right - save_page_left;
page_height = save_page_bottom - save_page_top;
@@ -357,78 +360,78 @@ void x_image_lowlevel(TOPLEVEL *w_current, const char* filename,
}
/* need to do this every time you change width / height */
- set_window(w_current, w_current->page_current,
- page_center_left - (page_width / 2),
- page_center_left + (page_width / 2),
- page_center_top - (page_height / 2),
- page_center_top + (page_height / 2));
+ set_window(toplevel, toplevel->page_current,
+ page_center_left - (page_width / 2),
+ page_center_left + (page_width / 2),
+ page_center_top - (page_height / 2),
+ page_center_top + (page_height / 2));
/* de select everything first */
o_select_unselect_all( w_current );
- if (strcmp(filetype, "eps") == 0) /*WK - catch EPS export case*/
+ if (strcmp(filetype, "eps") == 0) /*WK - catch EPS export case*/
x_image_write_eps(w_current, filename);
- else {
- pixbuf = x_image_get_pixbuf(w_current);
- if (pixbuf != NULL) {
- if (!gdk_pixbuf_save(pixbuf, filename, filetype, &gerror, NULL)) {
- fprintf(stderr, "x_image_lowlevel: Unable to save %s file %s.\n",
- filetype, filename);
- fprintf(stderr, "%s\n", gerror->message);
- s_log_message(_("x_image_lowlevel: Unable to write %s file %s.\n"),
- filetype, filename);
- s_log_message(gerror->message);
-
- /* Warn the user */
- dialog = gtk_message_dialog_new (GTK_WINDOW(w_current->main_window),
- GTK_DIALOG_MODAL
- | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("There was the following error when saving image with type %s to filename:\n%s\n\n%s.\n"),
- filetype, filename, gerror->message
- );
-
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
- /* Free the gerror */
- g_error_free(gerror);
- gerror = NULL;
-
- /* Unlink the output file */
- /* It's not safe to unlink the file if there was an error.
- For example: if the operation was not allowed due to permissions,
- the _previous existing_ file will be removed */
- /* unlink(filename); */
+ else {
+ pixbuf = x_image_get_pixbuf(w_current);
+ if (pixbuf != NULL) {
+ if (!gdk_pixbuf_save(pixbuf, filename, filetype, &gerror, NULL)) {
+ fprintf(stderr, "x_image_lowlevel: Unable to save %s file %s.\n",
+ filetype, filename);
+ fprintf(stderr, "%s\n", gerror->message);
+ s_log_message(_("x_image_lowlevel: Unable to write %s file %s.\n"),
+ filetype, filename);
+ s_log_message(gerror->message);
+
+ /* Warn the user */
+ dialog = gtk_message_dialog_new (GTK_WINDOW(w_current->main_window),
+ GTK_DIALOG_MODAL
+ | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("There was the following error when saving image with type %s to filename:\n%s\n\n%s.\n"),
+ filetype, filename, gerror->message
+ );
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ /* Free the gerror */
+ g_error_free(gerror);
+ gerror = NULL;
+
+ /* Unlink the output file */
+ /* It's not safe to unlink the file if there was an error.
+ For example: if the operation was not allowed due to permissions,
+ the _previous existing_ file will be removed */
+ /* unlink(filename); */
+ }
+ else {
+ if (toplevel->image_color == TRUE) {
+ s_log_message(_("Wrote color image to [%s] [%d x %d]\n"), filename, width, height);
+ } else {
+ s_log_message(_("Wrote black and white image to [%s] [%d x %d]\n"), filename, width, height);
+ }
+ }
+ if (filetype != NULL)
+ g_free(filetype);
+ if (pixbuf != NULL)
+ g_object_unref(pixbuf);
}
else {
- if (w_current->image_color == TRUE) {
- s_log_message(_("Wrote color image to [%s] [%d x %d]\n"), filename, width, height);
- } else {
- s_log_message(_("Wrote black and white image to [%s] [%d x %d]\n"), filename, width, height);
- }
+ fprintf(stderr, "x_image_lowlevel: Unable to get pixbuf from gschem's window.\n");
+ s_log_message(_("x_image_lowlevel: Unable to get pixbuf from gschem's window.\n"));
}
- if (filetype != NULL)
- g_free(filetype);
- if (pixbuf != NULL)
- g_object_unref(pixbuf);
}
- else {
- fprintf(stderr, "x_image_lowlevel: Unable to get pixbuf from gschem's window.\n");
- s_log_message(_("x_image_lowlevel: Unable to get pixbuf from gschem's window.\n"));
- }
- }
- w_current->width = save_width;
- w_current->height = save_height;
+ toplevel->width = save_width;
+ toplevel->height = save_height;
/* need to do this every time you change width / height */
- set_window(w_current, w_current->page_current,
- save_page_left,
- save_page_right,
- save_page_top,
- save_page_bottom);
+ set_window(toplevel, toplevel->page_current,
+ save_page_left,
+ save_page_right,
+ save_page_top,
+ save_page_bottom);
/* try to use recalc here... */
o_redraw_all(w_current);
@@ -439,10 +442,10 @@ void x_image_lowlevel(TOPLEVEL *w_current, const char* filename,
* \par Display the image file selection dialog, allowing the user to
* set several options, like image size and image type.
* When the user hits "ok", then it writes the image file.
- * \param w_current [in] the TOPLEVEL structure.
+ * \param w_current [in] the GSCHEM_TOPLEVEL structure.
* \return nothing
*/
-void x_image_setup (TOPLEVEL *w_current)
+void x_image_setup (GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *dialog;
GtkWidget *vbox1;
@@ -459,7 +462,7 @@ void x_image_setup (TOPLEVEL *w_current)
int width, height;
hbox = gtk_hbox_new(FALSE, 0);
-
+
/* Image size selection */
vbox1 = gtk_vbox_new(TRUE, 0);
label1 = gtk_label_new (_("Width x Height"));
@@ -467,15 +470,15 @@ void x_image_setup (TOPLEVEL *w_current)
gtk_misc_set_alignment( GTK_MISC (label1), 0, 0);
gtk_misc_set_padding (GTK_MISC (label1), 0, 0);
gtk_box_pack_start (GTK_BOX (vbox1),
- label1, FALSE, FALSE, 0);
-
+ label1, FALSE, FALSE, 0);
+
size_combo = gtk_combo_box_new_text ();
create_size_menu (GTK_COMBO_BOX(size_combo));
-
+
gtk_widget_show (size_combo);
gtk_box_pack_start (GTK_BOX (vbox1), size_combo, TRUE, TRUE, 0);
gtk_widget_show(vbox1);
-
+
/* Image type selection */
vbox2 = gtk_vbox_new(TRUE, 0);
label2 = gtk_label_new (_("Image type"));
@@ -483,68 +486,68 @@ void x_image_setup (TOPLEVEL *w_current)
gtk_misc_set_alignment( GTK_MISC (label2), 0, 0);
gtk_misc_set_padding (GTK_MISC (label2), 0, 0);
gtk_box_pack_start (GTK_BOX (vbox2),
- label2, FALSE, FALSE, 0);
-
+ label2, FALSE, FALSE, 0);
+
type_combo = gtk_combo_box_new_text ();
gtk_box_pack_start (GTK_BOX (vbox2), type_combo, TRUE, TRUE, 0);
create_type_menu (GTK_COMBO_BOX(type_combo));
-
+
/* Connect the changed signal to the callback, so the filename
gets updated every time the image type is changed */
g_signal_connect (type_combo, "changed",
- G_CALLBACK(x_image_update_dialog_filename),
- w_current);
+ G_CALLBACK(x_image_update_dialog_filename),
+ w_current);
gtk_widget_show (type_combo);
gtk_widget_show(vbox2);
-
+
/* Create the dialog */
dialog = gtk_file_chooser_dialog_new (_("Write image..."),
- GTK_WINDOW(w_current->main_window),
- GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
- NULL);
+ GTK_WINDOW(w_current->main_window),
+ GTK_FILE_CHOOSER_ACTION_SAVE,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+ NULL);
#if GTK_CHECK_VERSION (2,6,0)
/* Set the alternative button order (ok, cancel, help) for other systems */
gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog),
- GTK_RESPONSE_ACCEPT,
- GTK_RESPONSE_CANCEL,
- -1);
+ GTK_RESPONSE_ACCEPT,
+ GTK_RESPONSE_CANCEL,
+ -1);
#endif
-
+
/* Add the extra widgets to the dialog*/
gtk_box_pack_start(GTK_BOX(hbox), vbox1, FALSE, FALSE, 10);
gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 10);
gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(dialog), hbox);
-
+
g_object_set (dialog,
- /* GtkFileChooser */
- "select-multiple", FALSE,
+ /* GtkFileChooser */
+ "select-multiple", FALSE,
#if ((GTK_MAJOR_VERSION > 2) || ((GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION >=8)))
- /* only in GTK 2.8 */
- "do-overwrite-confirmation", TRUE,
+ /* only in GTK 2.8 */
+ "do-overwrite-confirmation", TRUE,
#endif
- NULL);
-
+ NULL);
+
/* Update the filename */
x_image_update_dialog_filename(GTK_COMBO_BOX(type_combo), w_current);
gtk_dialog_set_default_response(GTK_DIALOG(dialog),
- GTK_RESPONSE_ACCEPT);
+ GTK_RESPONSE_ACCEPT);
gtk_window_position (GTK_WINDOW (dialog),
- GTK_WIN_POS_MOUSE);
+ GTK_WIN_POS_MOUSE);
gtk_container_set_border_width(GTK_CONTAINER(dialog),
- DIALOG_BORDER_SPACING);
+ DIALOG_BORDER_SPACING);
gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox),
- DIALOG_V_SPACING);
+ DIALOG_V_SPACING);
gtk_widget_show (dialog);
-
+
if (gtk_dialog_run((GTK_DIALOG(dialog))) == GTK_RESPONSE_ACCEPT) {
#if ((GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION < 6))
image_size =
@@ -554,11 +557,11 @@ void x_image_setup (TOPLEVEL *w_current)
#endif
#if ((GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION < 6))
- GSList *ptr;
- /* If GTK < 2.6, get the description from the descriptions list */
- ptr = g_slist_nth(image_type_descriptions,
- gtk_combo_box_get_active(GTK_COMBO_BOX(type_combo)));
- image_type_descr = (char *) (ptr->data);
+ GSList *ptr;
+ /* If GTK < 2.6, get the description from the descriptions list */
+ ptr = g_slist_nth(image_type_descriptions,
+ gtk_combo_box_get_active(GTK_COMBO_BOX(type_combo)));
+ image_type_descr = (char *) (ptr->data);
#else
image_type_descr = gtk_combo_box_get_active_text(GTK_COMBO_BOX(type_combo));
#endif
@@ -569,7 +572,7 @@ void x_image_setup (TOPLEVEL *w_current)
x_image_lowlevel(w_current, filename, width, height, image_type);
}
-
+
#if ((GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION < 6))
/* If GTK < 2.6, free the descriptions list */
free_image_type_descriptions_list();
@@ -590,12 +593,12 @@ static void x_image_convert_to_greyscale(GdkPixbuf *pixbuf)
int i, j;
n_channels = gdk_pixbuf_get_n_channels (pixbuf);
-
+
if (n_channels != 3)
{
return;
}
-
+
if (gdk_pixbuf_get_colorspace (pixbuf) != GDK_COLORSPACE_RGB)
{
return;
@@ -631,40 +634,45 @@ static void x_image_convert_to_greyscale(GdkPixbuf *pixbuf)
* \par Function Description
*
*/
-GdkPixbuf *x_image_get_pixbuf (TOPLEVEL *w_current)
+GdkPixbuf *x_image_get_pixbuf (GSCHEM_TOPLEVEL *w_current)
{
GdkPixbuf *pixbuf;
int origin_x, origin_y, bottom, right;
int size_x, size_y, s_right, s_left, s_top,s_bottom;
+ GSCHEM_TOPLEVEL new_w_current;
TOPLEVEL toplevel;
+ /* Do a copy of the w_current struct and work with it */
+ memcpy(&new_w_current, w_current, sizeof(GSCHEM_TOPLEVEL));
/* Do a copy of the toplevel struct and work with it */
memcpy(&toplevel, w_current, sizeof(TOPLEVEL));
+ new_w_current.toplevel = &toplevel;
+
WORLDtoSCREEN(&toplevel,
- w_current->page_current->right,
- w_current->page_current->left,
- &s_right,
- &s_left);
+ toplevel.page_current->right,
+ toplevel.page_current->left,
+ &s_right,
+ &s_left);
WORLDtoSCREEN(&toplevel,
- w_current->page_current->bottom,
- w_current->page_current->top,
- &s_bottom,
- &s_top);
+ toplevel.page_current->bottom,
+ toplevel.page_current->top,
+ &s_bottom,
+ &s_top);
size_x = s_left - s_right;
size_y = s_bottom - s_top;
- size_x = toplevel.image_width;
- size_y = toplevel.image_height;
+ size_x = new_w_current.image_width;
+ size_y = new_w_current.image_height;
- toplevel.window = gdk_pixmap_new(w_current->window, size_x, size_y, -1);
- toplevel.backingstore = gdk_pixmap_new(w_current->window, size_x, size_y, -1);
- toplevel.grid = 0;
- toplevel.text_origin_marker = FALSE;
+ new_w_current.window = gdk_pixmap_new(w_current->window, size_x, size_y, -1);
+ new_w_current.backingstore = gdk_pixmap_new(w_current->window, size_x, size_y, -1);
+ new_w_current.grid = 0;
+ new_w_current.text_origin_marker = FALSE;
- toplevel.win_width = toplevel.image_width;
- toplevel.win_height = toplevel.image_height;
+ new_w_current.win_width = new_w_current.image_width;
+ new_w_current.win_height = new_w_current.image_height;
if (toplevel.image_color == FALSE)
{
@@ -696,7 +704,7 @@ GdkPixbuf *x_image_get_pixbuf (TOPLEVEL *w_current)
/* See if there are objects */
- aux = w_current->page_current->object_head;
+ aux = toplevel->page_current->object_head;
while (aux != NULL) {
if (aux->type != -1) {
object_found = 1;
@@ -717,10 +725,10 @@ GdkPixbuf *x_image_get_pixbuf (TOPLEVEL *w_current)
#endif
/* ------------------ End optional code ------------------------ */
- o_redraw_all (&toplevel);
+ o_redraw_all (&new_w_current);
/* Get the pixbuf */
- pixbuf=gdk_pixbuf_get_from_drawable(NULL,toplevel.backingstore, NULL,
+ pixbuf=gdk_pixbuf_get_from_drawable(NULL,new_w_current.backingstore, NULL,
origin_x, origin_y, 0, 0,
right-origin_x,
bottom-origin_y);
@@ -730,11 +738,11 @@ GdkPixbuf *x_image_get_pixbuf (TOPLEVEL *w_current)
x_image_convert_to_greyscale(pixbuf);
}
- if (toplevel.window != NULL) {
- g_object_unref(toplevel.window);
+ if (new_w_current.window != NULL) {
+ g_object_unref(new_w_current.window);
}
- if (toplevel.backingstore != NULL) {
- g_object_unref(toplevel.backingstore);
+ if (new_w_current.backingstore != NULL) {
+ g_object_unref(new_w_current.backingstore);
}
return(pixbuf);
diff --git a/gschem/src/x_log.c b/gschem/src/x_log.c
index d209f19..2c6ac85 100644
--- a/gschem/src/x_log.c
+++ b/gschem/src/x_log.c
@@ -37,6 +37,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
diff --git a/gschem/src/x_menus.c b/gschem/src/x_menus.c
index 7256bc6..2fd0ed3 100644
--- a/gschem/src/x_menus.c
+++ b/gschem/src/x_menus.c
@@ -26,6 +26,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -85,7 +86,7 @@ static void g_menu_execute(char *func)
* \par Function Description
*
*/
-void get_main_menu(TOPLEVEL * w_current, GtkWidget ** menubar)
+void get_main_menu(GtkWidget ** menubar)
{
char *buf;
GtkWidget *menu_item;
@@ -247,7 +248,7 @@ static gchar* gettext_fn(const gchar *path,
return gettext(path);
}
-GtkWidget *get_main_popup(TOPLEVEL *w_current)
+GtkWidget *get_main_popup(GSCHEM_TOPLEVEL *w_current)
{
static GtkItemFactory *item_factory;
GtkAccelGroup *accel_group;
@@ -288,7 +289,7 @@ GtkWidget *get_main_popup(TOPLEVEL *w_current)
* \note
* need to look at this... here and the setup
*/
-gint do_popup (TOPLEVEL *w_current, GdkEventButton *event)
+gint do_popup (GSCHEM_TOPLEVEL *w_current, GdkEventButton *event)
{
GtkWidget *menu; /* =NULL; */ /* was static */
@@ -311,7 +312,7 @@ gint do_popup (TOPLEVEL *w_current, GdkEventButton *event)
* \par Function Description
*
*/
-void x_menus_sensitivity (TOPLEVEL* w_current, const char *buf, int flag)
+void x_menus_sensitivity (GSCHEM_TOPLEVEL *w_current, const char *buf, int flag)
{
GtkWidget* item=NULL;
@@ -343,7 +344,7 @@ void x_menus_sensitivity (TOPLEVEL* w_current, const char *buf, int flag)
* \note
* 1.9.2005 -- SDB.
*/
-void x_menus_popup_sensitivity (TOPLEVEL* w_current, const char *buf, int flag)
+void x_menus_popup_sensitivity (GSCHEM_TOPLEVEL *w_current, const char *buf, int flag)
{
GtkWidget *menu_item;
GtkItemFactory *menu_item_factory;
@@ -401,7 +402,7 @@ out:
#if !GLIB_CHECK_VERSION(2,6,0)
/* disable recent files support */
-inline void x_menu_attach_recent_files_submenu(TOPLEVEL *w_current)
+inline void x_menu_attach_recent_files_submenu(GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *recent_menu_item;
@@ -426,14 +427,14 @@ static GList *recent_files = NULL;
*/
static void update_recent_files_menus()
{
- TOPLEVEL *w_current;
+ GSCHEM_TOPLEVEL *w_current;
GtkWidget *submenu, *recent_menu_item;
GList *iter;
for (iter = global_window_list;
iter != NULL;
iter = g_list_next (iter)) {
- w_current = (TOPLEVEL *)iter->data;
+ w_current = (GSCHEM_TOPLEVEL *)iter->data;
if (w_current->menubar == NULL)
continue;
@@ -472,7 +473,7 @@ static void recent_file_clicked(gpointer filename)
{
FILE *fp;
PAGE *page;
- TOPLEVEL *w;
+ GSCHEM_TOPLEVEL *w_current;
/* Check if the file exists */
fp = fopen((char *) filename, "r");
@@ -485,10 +486,11 @@ static void recent_file_clicked(gpointer filename)
}
fclose(fp);
- w = s_toplevel_new();
- x_window_setup(w);
- page = x_window_open_page(w, (char *)filename);
- x_window_set_current_page(w, page);
+ w_current = gschem_toplevel_new();
+ w_current->toplevel = s_toplevel_new();
+ x_window_setup(w_current);
+ page = x_window_open_page(w_current, (char *)filename);
+ x_window_set_current_page(w_current, page);
s_log_message (_("New Window created [%s]\n"), (char *)filename);
}
@@ -497,7 +499,7 @@ static void recent_file_clicked(gpointer filename)
*
* Called from x_window_setup().
*/
-void x_menu_attach_recent_files_submenu(TOPLEVEL *w_current)
+void x_menu_attach_recent_files_submenu(GSCHEM_TOPLEVEL *w_current)
{
gulong id;
GtkWidget *tmp;
diff --git a/gschem/src/x_multiattrib.c b/gschem/src/x_multiattrib.c
index 97c7119..1f48ccf 100644
--- a/gschem/src/x_multiattrib.c
+++ b/gschem/src/x_multiattrib.c
@@ -29,6 +29,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/i_vars.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -48,20 +49,20 @@
*
* \param [in] dialog The multi-attribute editor dialog.
* \param [in] arg1 The response ID.
- * \param [in] user_data A pointer on the toplevel environment.
+ * \param [in] user_data A pointer on the GSCHEM_TOPLEVEL environment.
*/
static void
multiattrib_callback_response (GtkDialog *dialog,
gint arg1,
gpointer user_data)
{
- TOPLEVEL *toplevel = (TOPLEVEL*)user_data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*)user_data;
switch (arg1) {
case GTK_RESPONSE_CLOSE:
case GTK_RESPONSE_DELETE_EVENT:
gtk_widget_destroy (GTK_WIDGET (dialog));
- toplevel->mawindow = NULL;
+ w_current->mawindow = NULL;
break;
}
}
@@ -70,29 +71,29 @@ multiattrib_callback_response (GtkDialog *dialog,
* \par Function Description
* Opens the multiple attribute editor dialog for objects in this <B>toplevel</B>.
*
- * \param [in] toplevel The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
*/
-void x_multiattrib_open (TOPLEVEL *toplevel)
+void x_multiattrib_open (GSCHEM_TOPLEVEL *w_current)
{
- if ( toplevel->mawindow == NULL ) {
- toplevel->mawindow = GTK_WIDGET (g_object_new (TYPE_MULTIATTRIB,
- "selection", toplevel->page_current->selection_list,
+ if ( w_current->mawindow == NULL ) {
+ w_current->mawindow = GTK_WIDGET (g_object_new (TYPE_MULTIATTRIB,
+ "selection", w_current->toplevel->page_current->selection_list,
/* GschemDialog */
"settings-name", "multiattrib",
- "toplevel", toplevel,
+ "gschem-toplevel", w_current,
NULL));
- g_signal_connect (toplevel->mawindow,
+ g_signal_connect (w_current->mawindow,
"response",
G_CALLBACK (multiattrib_callback_response),
- toplevel);
+ w_current);
- gtk_window_set_transient_for (GTK_WINDOW(toplevel->mawindow),
- GTK_WINDOW(toplevel->main_window));
+ gtk_window_set_transient_for (GTK_WINDOW(w_current->mawindow),
+ GTK_WINDOW(w_current->main_window));
- gtk_widget_show (toplevel->mawindow);
+ gtk_widget_show (w_current->mawindow);
} else {
- gtk_window_present (GTK_WINDOW(toplevel->mawindow));
+ gtk_window_present (GTK_WINDOW(w_current->mawindow));
}
}
@@ -101,33 +102,33 @@ void x_multiattrib_open (TOPLEVEL *toplevel)
*
* \par Function Description
*
- * Closes the multiattrib dialog associated with <B>toplevel</B>.
+ * Closes the multiattrib dialog associated with <B>w_current</B>.
*
- * \param [in] toplevel The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
*/
-void x_multiattrib_close (TOPLEVEL *toplevel)
+void x_multiattrib_close (GSCHEM_TOPLEVEL *w_current)
{
- if (toplevel->mawindow != NULL) {
- gtk_widget_destroy (toplevel->mawindow);
- toplevel->mawindow = NULL;
+ if (w_current->mawindow != NULL) {
+ gtk_widget_destroy (w_current->mawindow);
+ w_current->mawindow = NULL;
}
}
-/*! \brief Update the multiattrib editor dialog for a TOPLEVEL.
+/*! \brief Update the multiattrib editor dialog for a GSCHEM_TOPLEVEL.
*
* \par Function Description
*
- * If the TOPLEVEL has an open multiattrib dialog, switch to
+ * If the GSCHEM_TOPLEVEL has an open multiattrib dialog, switch to
* watching the current page's SELECTION object for changes.
*
- * \param [in] toplevel The TOPLEVEL object.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object.
*/
-void x_multiattrib_update( TOPLEVEL *toplevel )
+void x_multiattrib_update( GSCHEM_TOPLEVEL *w_current )
{
- if (toplevel->mawindow != NULL) {
- g_object_set (G_OBJECT (toplevel->mawindow), "selection",
- toplevel->page_current->selection_list, NULL);
+ if (w_current->mawindow != NULL) {
+ g_object_set (G_OBJECT (w_current->mawindow), "selection",
+ w_current->toplevel->page_current->selection_list, NULL);
}
}
@@ -457,7 +458,7 @@ static void multiattrib_popup_menu (Multiattrib *multiattrib,
* \par Function Description
*
*/
-static void multiattrib_action_add_attribute(TOPLEVEL *toplevel,
+static void multiattrib_action_add_attribute(GSCHEM_TOPLEVEL *w_current,
OBJECT *object,
Multiattrib *multiattrib,
const gchar *name,
@@ -476,11 +477,11 @@ static void multiattrib_action_add_attribute(TOPLEVEL *toplevel,
}
/* create a new attribute and link it */
- o_attrib = o_attrib_add_attrib (toplevel, newtext,
+ o_attrib = o_attrib_add_attrib (w_current, newtext,
visible, show_name_value, object);
- toplevel->page_current->CHANGED = 1;
- o_undo_savestate (toplevel, UNDO_ALL);
+ w_current->toplevel->page_current->CHANGED = 1;
+ o_undo_savestate (w_current, UNDO_ALL);
g_free (newtext);
@@ -491,19 +492,19 @@ static void multiattrib_action_add_attribute(TOPLEVEL *toplevel,
* \par Function Description
*
*/
-static void multiattrib_action_duplicate_attribute(TOPLEVEL *toplevel,
+static void multiattrib_action_duplicate_attribute(GSCHEM_TOPLEVEL *w_current,
OBJECT *object,
OBJECT *o_attrib)
{
OBJECT *o_new;
- o_new = o_attrib_add_attrib (toplevel,
+ o_new = o_attrib_add_attrib (w_current,
o_attrib->text->string,
o_attrib->visibility,
o_attrib->show_name_value,
object);
- toplevel->page_current->CHANGED = 1;
- o_undo_savestate (toplevel, UNDO_ALL);
+ w_current->toplevel->page_current->CHANGED = 1;
+ o_undo_savestate (w_current, UNDO_ALL);
}
@@ -512,14 +513,14 @@ static void multiattrib_action_duplicate_attribute(TOPLEVEL *toplevel,
* \par Function Description
*
*/
-static void multiattrib_action_delete_attribute(TOPLEVEL *toplevel,
+static void multiattrib_action_delete_attribute(GSCHEM_TOPLEVEL *w_current,
OBJECT *o_attrib)
{
/* actually deletes the attribute */
- o_selection_remove ( toplevel->page_current->selection_list, o_attrib);
- o_delete_text (toplevel, o_attrib);
- toplevel->page_current->CHANGED=1;
- o_undo_savestate (toplevel, UNDO_ALL);
+ o_selection_remove ( w_current->toplevel->page_current->selection_list, o_attrib);
+ o_delete_text (w_current, o_attrib);
+ w_current->toplevel->page_current->CHANGED=1;
+ o_undo_savestate (w_current, UNDO_ALL);
}
@@ -688,11 +689,11 @@ static void multiattrib_callback_edited_name(GtkCellRendererText *cellrendererte
GtkTreeModel *model;
GtkTreeIter iter;
OBJECT *o_attrib;
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current;
gchar *name, *value, *newtext;
model = gtk_tree_view_get_model (multiattrib->treeview);
- toplevel = GSCHEM_DIALOG (multiattrib)->toplevel;
+ w_current = GSCHEM_DIALOG (multiattrib)->w_current;
if (!gtk_tree_model_get_iter_from_string (model, &iter, arg1)) {
return;
@@ -728,7 +729,7 @@ static void multiattrib_callback_edited_name(GtkCellRendererText *cellrendererte
/* actually modifies the attribute */
- o_text_change (toplevel, o_attrib,
+ o_text_change (w_current, o_attrib,
newtext, o_attrib->visibility, o_attrib->show_name_value);
g_free (name);
@@ -751,11 +752,11 @@ static void multiattrib_callback_edited_value(GtkCellRendererText *cell_renderer
GtkTreeModel *model;
GtkTreeIter iter;
OBJECT *o_attrib;
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current;
gchar *name, *value, *newtext;
model = gtk_tree_view_get_model (multiattrib->treeview);
- toplevel = GSCHEM_DIALOG (multiattrib)->toplevel;
+ w_current = GSCHEM_DIALOG (multiattrib)->w_current;
if (!gtk_tree_model_get_iter_from_string (model, &iter, arg1)) {
return;
@@ -777,7 +778,7 @@ static void multiattrib_callback_edited_value(GtkCellRendererText *cell_renderer
}
/* actually modifies the attribute */
- o_text_change (toplevel, o_attrib,
+ o_text_change (w_current, o_attrib,
newtext, o_attrib->visibility, o_attrib->show_name_value);
/* request an update of display for this row */
@@ -802,11 +803,11 @@ static void multiattrib_callback_toggled_visible(GtkCellRendererToggle *cell_ren
GtkTreeModel *model;
GtkTreeIter iter;
OBJECT *o_attrib;
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current;
gint visibility;
model = gtk_tree_view_get_model (multiattrib->treeview);
- toplevel = GSCHEM_DIALOG (multiattrib)->toplevel;
+ w_current = GSCHEM_DIALOG (multiattrib)->w_current;
if (!gtk_tree_model_get_iter_from_string (model, &iter, path)) {
return;
@@ -816,15 +817,15 @@ static void multiattrib_callback_toggled_visible(GtkCellRendererToggle *cell_ren
COLUMN_ATTRIBUTE, &o_attrib,
-1);
g_assert (o_attrib->type == OBJ_TEXT);
- o_text_erase (toplevel, o_attrib);
+ o_text_erase (w_current, o_attrib);
visibility = o_attrib->visibility == VISIBLE ? INVISIBLE : VISIBLE;
/* actually modifies the attribute */
o_attrib->visibility = visibility;
- o_text_recreate (toplevel, o_attrib);
- o_text_draw (toplevel, o_attrib);
- o_undo_savestate (toplevel, UNDO_ALL);
+ o_text_recreate (w_current->toplevel, o_attrib);
+ o_text_draw (w_current, o_attrib);
+ o_undo_savestate (w_current, UNDO_ALL);
/* request an update of display for this row */
update_row_display (model, &iter);
@@ -844,11 +845,11 @@ static void multiattrib_callback_toggled_show_name(GtkCellRendererToggle *cell_r
GtkTreeModel *model;
GtkTreeIter iter;
OBJECT *o_attrib;
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current;
gint new_snv;
model = gtk_tree_view_get_model (multiattrib->treeview);
- toplevel = GSCHEM_DIALOG (multiattrib)->toplevel;
+ w_current = GSCHEM_DIALOG (multiattrib)->w_current;
if (!gtk_tree_model_get_iter_from_string (model, &iter, path)) {
return;
@@ -858,7 +859,7 @@ static void multiattrib_callback_toggled_show_name(GtkCellRendererToggle *cell_r
COLUMN_ATTRIBUTE, &o_attrib,
-1);
g_assert (o_attrib->type == OBJ_TEXT);
- o_text_erase (toplevel, o_attrib);
+ o_text_erase (w_current, o_attrib);
switch (o_attrib->show_name_value) {
case SHOW_NAME_VALUE: new_snv = SHOW_VALUE; break;
@@ -871,9 +872,9 @@ static void multiattrib_callback_toggled_show_name(GtkCellRendererToggle *cell_r
/* actually modifies the attribute */
o_attrib->show_name_value = new_snv;
- o_text_recreate (toplevel, o_attrib);
- o_text_draw (toplevel, o_attrib);
- o_undo_savestate (toplevel, UNDO_ALL);
+ o_text_recreate (w_current->toplevel, o_attrib);
+ o_text_draw (w_current, o_attrib);
+ o_undo_savestate (w_current, UNDO_ALL);
/* request an update of display for this row */
update_row_display (model, &iter);
@@ -893,11 +894,11 @@ static void multiattrib_callback_toggled_show_value(GtkCellRendererToggle *cell_
GtkTreeModel *model;
GtkTreeIter iter;
OBJECT *o_attrib;
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current;
gint new_snv;
model = gtk_tree_view_get_model (multiattrib->treeview);
- toplevel = GSCHEM_DIALOG (multiattrib)->toplevel;
+ w_current = GSCHEM_DIALOG (multiattrib)->w_current;
if (!gtk_tree_model_get_iter_from_string (model, &iter, path)) {
return;
@@ -907,7 +908,7 @@ static void multiattrib_callback_toggled_show_value(GtkCellRendererToggle *cell_
COLUMN_ATTRIBUTE, &o_attrib,
-1);
g_assert (o_attrib->type == OBJ_TEXT);
- o_text_erase (toplevel, o_attrib);
+ o_text_erase (w_current, o_attrib);
switch (o_attrib->show_name_value) {
case SHOW_NAME_VALUE: new_snv = SHOW_NAME; break;
@@ -920,9 +921,9 @@ static void multiattrib_callback_toggled_show_value(GtkCellRendererToggle *cell_
/* actually modifies the attribute */
o_attrib->show_name_value = new_snv;
- o_text_recreate (toplevel, o_attrib);
- o_text_draw (toplevel, o_attrib);
- o_undo_savestate (toplevel, UNDO_ALL);
+ o_text_recreate (w_current->toplevel, o_attrib);
+ o_text_draw (w_current, o_attrib);
+ o_undo_savestate (w_current, UNDO_ALL);
/* request an update of display for this row */
update_row_display (model, &iter);
@@ -959,7 +960,7 @@ static gboolean multiattrib_callback_key_pressed(GtkWidget *widget,
-1);
g_assert (o_attrib->type == OBJ_TEXT);
- multiattrib_action_delete_attribute (GSCHEM_DIALOG (multiattrib)->toplevel,
+ multiattrib_action_delete_attribute (GSCHEM_DIALOG (multiattrib)->w_current,
o_attrib);
/* update the treeview contents */
@@ -1015,7 +1016,7 @@ static void multiattrib_callback_popup_duplicate(GtkMenuItem *menuitem,
Multiattrib *multiattrib = (Multiattrib*)user_data;
GtkTreeModel *model;
GtkTreeIter iter;
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current;
OBJECT *object, *o_attrib;
if (!gtk_tree_selection_get_selected (
@@ -1025,7 +1026,7 @@ static void multiattrib_callback_popup_duplicate(GtkMenuItem *menuitem,
return;
}
- toplevel = GSCHEM_DIALOG (multiattrib)->toplevel;
+ w_current = GSCHEM_DIALOG (multiattrib)->w_current;
object = multiattrib->object;
gtk_tree_model_get (model, &iter,
@@ -1033,7 +1034,7 @@ static void multiattrib_callback_popup_duplicate(GtkMenuItem *menuitem,
-1);
g_assert (o_attrib->type == OBJ_TEXT);
- multiattrib_action_duplicate_attribute (toplevel, object, o_attrib);
+ multiattrib_action_duplicate_attribute (w_current, object, o_attrib);
/* update the treeview contents */
multiattrib_update (multiattrib);
@@ -1051,7 +1052,7 @@ static void multiattrib_callback_popup_delete(GtkMenuItem *menuitem,
Multiattrib *multiattrib = (Multiattrib*)user_data;
GtkTreeModel *model;
GtkTreeIter iter;
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current;
OBJECT *o_attrib;
if (!gtk_tree_selection_get_selected (
@@ -1061,14 +1062,14 @@ static void multiattrib_callback_popup_delete(GtkMenuItem *menuitem,
return;
}
- toplevel = GSCHEM_DIALOG (multiattrib)->toplevel;
+ w_current = GSCHEM_DIALOG (multiattrib)->w_current;
gtk_tree_model_get (model, &iter,
COLUMN_ATTRIBUTE, &o_attrib,
-1);
g_assert (o_attrib->type == OBJ_TEXT);
- multiattrib_action_delete_attribute (toplevel, o_attrib);
+ multiattrib_action_delete_attribute (w_current, o_attrib);
/* update the treeview contents */
multiattrib_update (multiattrib);
@@ -1143,12 +1144,12 @@ static void multiattrib_callback_button_add(GtkButton *button,
GtkTextIter start, end;
const gchar *name;
gchar *value;
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current;
OBJECT *object;
gboolean visible;
gint shownv;
- toplevel = GSCHEM_DIALOG (multiattrib)->toplevel;
+ w_current = GSCHEM_DIALOG (multiattrib)->w_current;
object = multiattrib->object;
buffer = gtk_text_view_get_buffer (multiattrib->textview_value);
@@ -1171,7 +1172,7 @@ static void multiattrib_callback_button_add(GtkButton *button,
return;
}
- multiattrib_action_add_attribute (toplevel, object, multiattrib,
+ multiattrib_action_add_attribute (w_current, object, multiattrib,
name, value,
visible, shownv);
g_free (value);
@@ -1893,7 +1894,7 @@ void multiattrib_update (Multiattrib *multiattrib)
gboolean sensitive;
GtkStyle *style;
- g_assert (GSCHEM_DIALOG (multiattrib)->toplevel != NULL);
+ g_assert (GSCHEM_DIALOG (multiattrib)->w_current != NULL);
/* clear the list of attributes */
liststore = (GtkListStore*)gtk_tree_view_get_model (multiattrib->treeview);
@@ -1918,7 +1919,7 @@ void multiattrib_update (Multiattrib *multiattrib)
/* get list of attributes */
object_attribs = o_attrib_return_attribs (
- GSCHEM_DIALOG (multiattrib)->toplevel->page_current->object_head,
+ GSCHEM_DIALOG (multiattrib)->w_current->toplevel->page_current->object_head,
multiattrib->object);
/* populate the store with attributes */
if (object_attribs) {
diff --git a/gschem/src/x_pagesel.c b/gschem/src/x_pagesel.c
index 2aad9c7..926622b 100644
--- a/gschem/src/x_pagesel.c
+++ b/gschem/src/x_pagesel.c
@@ -29,6 +29,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -51,25 +52,25 @@ static void x_pagesel_callback_response (GtkDialog *dialog,
* Opens the page manager dialog for <B>toplevel</B> if it is not already.
* In this last case, it raises the dialog.
*
- * \param [in] toplevel The TOPLEVEL object to open page manager for.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object to open page manager for.
*/
-void x_pagesel_open (TOPLEVEL *toplevel)
+void x_pagesel_open (GSCHEM_TOPLEVEL *w_current)
{
- if (toplevel->pswindow == NULL) {
- toplevel->pswindow = GTK_WIDGET (g_object_new (TYPE_PAGESEL,
- /* GschemDialog */
- "settings-name", "pagesel",
- "toplevel", toplevel,
- NULL));
-
- g_signal_connect (toplevel->pswindow,
+ if (w_current->pswindow == NULL) {
+ w_current->pswindow = GTK_WIDGET (g_object_new (TYPE_PAGESEL,
+ /* GschemDialog */
+ "settings-name", "pagesel",
+ "gschem-toplevel", w_current,
+ NULL));
+
+ g_signal_connect (w_current->pswindow,
"response",
G_CALLBACK (x_pagesel_callback_response),
- toplevel);
-
- gtk_widget_show (toplevel->pswindow);
+ w_current);
+
+ gtk_widget_show (w_current->pswindow);
} else {
- gdk_window_raise (toplevel->pswindow->window);
+ gdk_window_raise (w_current->pswindow->window);
}
}
@@ -78,14 +79,14 @@ void x_pagesel_open (TOPLEVEL *toplevel)
* \par Function Description
* Closes the page manager dialog associated with <B>toplevel</B>.
*
- * \param [in] toplevel The TOPLEVEL object to close page manager for.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object to close page manager for.
*/
-void x_pagesel_close (TOPLEVEL *toplevel)
+void x_pagesel_close (GSCHEM_TOPLEVEL *w_current)
{
- if (toplevel->pswindow) {
- g_assert (IS_PAGESEL (toplevel->pswindow));
- gtk_widget_destroy (toplevel->pswindow);
- toplevel->pswindow = NULL;
+ if (w_current->pswindow) {
+ g_assert (IS_PAGESEL (w_current->pswindow));
+ gtk_widget_destroy (w_current->pswindow);
+ w_current->pswindow = NULL;
}
}
@@ -95,13 +96,13 @@ void x_pagesel_close (TOPLEVEL *toplevel)
* Updates the list and status of <B>toplevel</B>\'s pages if the page
* manager dialog is opened.
*
- * \param [in] toplevel The TOPLEVEL object to update.
+ * \param [in] w_current The GSCHEM_TOPLEVEL object to update.
*/
-void x_pagesel_update (TOPLEVEL *toplevel)
+void x_pagesel_update (GSCHEM_TOPLEVEL *w_current)
{
- if (toplevel->pswindow) {
- g_assert (IS_PAGESEL (toplevel->pswindow));
- pagesel_update (PAGESEL (toplevel->pswindow));
+ if (w_current->pswindow) {
+ g_assert (IS_PAGESEL (w_current->pswindow));
+ pagesel_update (PAGESEL (w_current->pswindow));
}
}
@@ -111,13 +112,13 @@ void x_pagesel_update (TOPLEVEL *toplevel)
*
* \param [in] dialog GtkDialog that issues callback.
* \param [in] arg1 Response argument of page manager dialog.
- * \param [in] user_data Pointer to relevant TOPLEVEL structure.
+ * \param [in] user_data Pointer to relevant GSCHEM_TOPLEVEL structure.
*/
static void x_pagesel_callback_response (GtkDialog *dialog,
gint arg1,
gpointer user_data)
{
- TOPLEVEL *toplevel = (TOPLEVEL*)user_data;
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL*)user_data;
switch (arg1) {
case PAGESEL_RESPONSE_UPDATE:
@@ -125,9 +126,9 @@ static void x_pagesel_callback_response (GtkDialog *dialog,
break;
case GTK_RESPONSE_DELETE_EVENT:
case PAGESEL_RESPONSE_CLOSE:
- g_assert (GTK_WIDGET (dialog) == toplevel->pswindow);
+ g_assert (GTK_WIDGET (dialog) == w_current->pswindow);
gtk_widget_destroy (GTK_WIDGET (dialog));
- toplevel->pswindow = NULL;
+ w_current->pswindow = NULL;
break;
default:
g_assert_not_reached ();
@@ -160,23 +161,23 @@ static void pagesel_callback_selection_changed (GtkTreeSelection *selection,
GtkTreeModel *model;
GtkTreeIter iter;
Pagesel *pagesel = (Pagesel*)user_data;
- TOPLEVEL *toplevel;
+ GSCHEM_TOPLEVEL *w_current;
PAGE *page;
if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
return;
}
- toplevel = GSCHEM_DIALOG (pagesel)->toplevel;
+ w_current = GSCHEM_DIALOG (pagesel)->w_current;
gtk_tree_model_get (model, &iter,
COLUMN_PAGE, &page,
-1);
/* temp */
- s_page_goto (toplevel, page);
- i_set_filename (toplevel, toplevel->page_current->page_filename);
- x_scrollbars_update (toplevel);
- o_redraw_all (toplevel);
+ s_page_goto (w_current->toplevel, page);
+ i_set_filename (w_current, w_current->toplevel->page_current->page_filename);
+ x_scrollbars_update (w_current);
+ o_redraw_all (w_current);
/* We would like to use the following call, but since it calls
* x_pagesel_update() it would cause an infinite loop.
@@ -225,7 +226,7 @@ static void \
pagesel_callback_popup_ ## name (GtkMenuItem *menuitem, \
gpointer user_data) \
{ \
- i_callback_ ## action (GSCHEM_DIALOG (user_data)->toplevel, 0, NULL); \
+ i_callback_ ## action (GSCHEM_DIALOG (user_data)->w_current, 0, NULL); \
}
DEFINE_POPUP_CALLBACK (new_page, file_new)
@@ -300,20 +301,20 @@ static void pagesel_popup_menu (Pagesel *pagesel,
}
-/*! \brief Handler for the notify::toplevel signal of GschemDialog
+/*! \brief Handler for the notify::gschem-toplevel signal of GschemDialog
*
* \par Function Description
*
- * When the toplevel property is set on the parent GschemDialog,
+ * When the gschem-toplevel property is set on the parent GschemDialog,
* we should update the pagesel dialog.
*
* \param [in] pspec the GParamSpec of the property which changed
* \param [in] gobject the object which received the signal.
* \param [in] user_data user data set when the signal handler was connected.
*/
-static void notify_toplevel_cb (GObject *gobject,
- GParamSpec *arg1,
- gpointer user_data)
+static void notify_gschem_toplevel_cb (GObject *gobject,
+ GParamSpec *arg1,
+ gpointer user_data)
{
Pagesel *pagesel = PAGESEL( gobject );
@@ -493,8 +494,8 @@ static void pagesel_init (Pagesel *pagesel)
-1);
#endif
- g_signal_connect( pagesel, "notify::toplevel",
- G_CALLBACK( notify_toplevel_cb ), NULL );
+ g_signal_connect( pagesel, "notify::gschem-toplevel",
+ G_CALLBACK( notify_gschem_toplevel_cb ), NULL );
}
@@ -503,7 +504,7 @@ static void pagesel_init (Pagesel *pagesel)
* Updates the tree model of <B>pagesel</B>\'s treeview.
*
* Right now, each time it is called, it rebuilds all the model from the
- * list of page in the toplevel.
+ * list of pages passed in.
* It is a recursive function to populate the tree store
*
* \param [in] model GtkTreeModel to update.
@@ -590,9 +591,9 @@ void pagesel_update (Pagesel *pagesel)
g_assert (IS_PAGESEL (pagesel));
- g_return_if_fail (GSCHEM_DIALOG (pagesel)->toplevel);
+ g_return_if_fail (GSCHEM_DIALOG (pagesel)->w_current);
- toplevel = GSCHEM_DIALOG (pagesel)->toplevel;
+ toplevel = GSCHEM_DIALOG (pagesel)->w_current->toplevel;
model = gtk_tree_view_get_model (pagesel->treeview);
/* wipe out every thing in the store */
diff --git a/gschem/src/x_preview.c b/gschem/src/x_preview.c
index 3791d74..c6f7663 100644
--- a/gschem/src/x_preview.c
+++ b/gschem/src/x_preview.c
@@ -32,6 +32,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -70,10 +71,10 @@ static void preview_dispose (GObject *self);
/*! \brief Completes initialitation of the widget after realization.
* \par Function Description
- * This function terminates the initialization of preview's toplevel
- * environment after the widget has been realized.
+ * This function terminates the initialization of preview's GSCHEM_TOPLEVEL
+ * and TOPLEVEL environments after the widget has been realized.
*
- * It creates a preview page in the toplevel environment.
+ * It creates a preview page in the TOPLEVEL environment.
*
* \param [in] widget The preview widget.
* \param [in] user_data Unused user data.
@@ -83,36 +84,37 @@ preview_callback_realize (GtkWidget *widget,
gpointer user_data)
{
Preview *preview = PREVIEW (widget);
- TOPLEVEL *preview_toplevel = preview->preview_toplevel;
+ GSCHEM_TOPLEVEL *preview_w_current = preview->preview_w_current;
+ TOPLEVEL *preview_toplevel = preview_w_current->toplevel;
PAGE *preview_page;
- preview_toplevel->window = preview_toplevel->drawing_area->window;
- gtk_widget_grab_focus (preview_toplevel->drawing_area);
+ preview_w_current->window = preview_w_current->drawing_area->window;
+ gtk_widget_grab_focus (preview_w_current->drawing_area);
- preview_toplevel->width = preview_toplevel->drawing_area->allocation.width;
- preview_toplevel->height = preview_toplevel->drawing_area->allocation.height;
- preview_toplevel->win_width = preview_toplevel->width;
- preview_toplevel->win_height = preview_toplevel->height;
+ preview_toplevel->width = preview_w_current->drawing_area->allocation.width;
+ preview_toplevel->height = preview_w_current->drawing_area->allocation.height;
+ preview_w_current->win_width = preview_toplevel->width;
+ preview_w_current->win_height = preview_toplevel->height;
- preview_toplevel->backingstore = gdk_pixmap_new (
- preview_toplevel->window,
- preview_toplevel->drawing_area->allocation.width,
- preview_toplevel->drawing_area->allocation.height, -1);
+ preview_w_current->backingstore = gdk_pixmap_new (
+ preview_w_current->window,
+ preview_w_current->drawing_area->allocation.width,
+ preview_w_current->drawing_area->allocation.height, -1);
- x_window_setup_gc (preview_toplevel);
+ x_window_setup_gc (preview_w_current);
preview_page = s_page_new (preview_toplevel, "unknown");
s_page_goto (preview_toplevel, preview_page);
- x_repaint_background(preview_toplevel);
+ x_repaint_background(preview_w_current);
preview_toplevel->DONT_REDRAW = 0;
- a_zoom_extents(preview_toplevel,
+ a_zoom_extents(preview_w_current,
preview_page->object_head,
A_PAN_DONT_REDRAW);
- o_redraw_all(preview_toplevel);
+ o_redraw_all(preview_w_current);
}
@@ -131,11 +133,11 @@ preview_callback_expose (GtkWidget *widget,
gpointer user_data)
{
Preview *preview = PREVIEW (widget);
- TOPLEVEL *preview_toplevel = preview->preview_toplevel;
+ GSCHEM_TOPLEVEL *preview_w_current = preview->preview_w_current;
gdk_draw_pixmap(widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
- preview_toplevel->backingstore,
+ preview_w_current->backingstore,
event->area.x, event->area.y,
event->area.x, event->area.y,
event->area.width, event->area.height);
@@ -160,7 +162,7 @@ preview_callback_button_press (GtkWidget *widget,
gpointer user_data)
{
Preview *preview = PREVIEW (widget);
- TOPLEVEL *preview_toplevel = preview->preview_toplevel;
+ GSCHEM_TOPLEVEL *preview_w_current = preview->preview_w_current;
if (!preview->active) {
return TRUE;
@@ -168,17 +170,17 @@ preview_callback_button_press (GtkWidget *widget,
switch (event->button) {
case 1: /* left mouse button: zoom in */
- a_zoom (preview_toplevel, ZOOM_IN, HOTKEY,
+ a_zoom (preview_w_current, ZOOM_IN, HOTKEY,
A_PAN_DONT_REDRAW);
- o_redraw_all_fast (preview_toplevel);
+ o_redraw_all_fast (preview_w_current);
break;
case 2: /* middle mouse button: pan */
- a_pan (preview_toplevel, mouse_x, mouse_y);
+ a_pan (preview_w_current, mouse_x, mouse_y);
break;
case 3: /* right mouse button: zoom out */
- a_zoom (preview_toplevel, ZOOM_OUT, HOTKEY,
+ a_zoom (preview_w_current, ZOOM_OUT, HOTKEY,
A_PAN_DONT_REDRAW);
- o_redraw_all_fast (preview_toplevel);
+ o_redraw_all_fast (preview_w_current);
break;
}
@@ -226,7 +228,8 @@ preview_callback_motion_notify (GtkWidget *widget,
static void
preview_update (Preview *preview)
{
- TOPLEVEL *preview_toplevel = preview->preview_toplevel;
+ GSCHEM_TOPLEVEL *preview_w_current = preview->preview_w_current;
+ TOPLEVEL *preview_toplevel = preview_w_current->toplevel;
int left, top, right, bottom;
int width, height;
@@ -279,10 +282,10 @@ preview_update (Preview *preview)
}
/* display current page (possibly empty) */
- a_zoom_extents (preview_toplevel,
+ a_zoom_extents (preview_w_current,
preview_toplevel->page_current->object_head,
A_PAN_DONT_REDRAW);
- o_redraw_all (preview_toplevel);
+ o_redraw_all (preview_w_current);
}
@@ -355,18 +358,18 @@ preview_event_configure (GtkWidget *widget,
{
gboolean retval;
int save_redraw;
- TOPLEVEL *preview_toplevel = PREVIEW (widget)->preview_toplevel;
- PAGE *preview_page = preview_toplevel->page_current;
+ GSCHEM_TOPLEVEL *preview_w_current = PREVIEW (widget)->preview_w_current;
+ PAGE *preview_page = preview_w_current->toplevel->page_current;
- save_redraw = preview_toplevel->DONT_REDRAW;
- preview_toplevel->DONT_REDRAW = 1;
- retval = x_event_configure (widget, event, preview_toplevel);
- preview_toplevel->DONT_REDRAW = save_redraw;
+ save_redraw = preview_w_current->toplevel->DONT_REDRAW;
+ preview_w_current->toplevel->DONT_REDRAW = 1;
+ retval = x_event_configure (widget, event, preview_w_current);
+ preview_w_current->toplevel->DONT_REDRAW = save_redraw;
if (preview_page != NULL) {
- a_zoom_extents(preview_toplevel,
+ a_zoom_extents(preview_w_current,
preview_page->object_head,
A_PAN_DONT_REDRAW);
- o_redraw_all_fast(preview_toplevel);
+ o_redraw_all_fast(preview_w_current);
}
return retval;
}
@@ -375,12 +378,12 @@ preview_event_configure (GtkWidget *widget,
static gboolean
preview_event_scroll (GtkWidget *widget,
GdkEventScroll *event,
- TOPLEVEL *w_current)
+ GSCHEM_TOPLEVEL *w_current)
{
if (!PREVIEW (widget)->active) {
return TRUE;
}
- return x_event_scroll (widget, event, PREVIEW (widget)->preview_toplevel);
+ return x_event_scroll (widget, event, PREVIEW (widget)->preview_w_current);
}
static void
@@ -398,33 +401,33 @@ preview_init (Preview *preview)
{ "scroll_event", G_CALLBACK (preview_event_scroll) },
{ NULL, NULL }
}, *tmp;
- TOPLEVEL *preview_toplevel;
+ GSCHEM_TOPLEVEL *preview_w_current;
+ preview_w_current = gschem_toplevel_new ();
+ preview_w_current->toplevel = s_toplevel_new ();
- preview_toplevel = s_toplevel_new ();
-
- i_vars_set (preview_toplevel);
+ i_vars_set (preview_w_current);
/* be sure to turn off scrollbars */
- preview_toplevel->scrollbars_flag = FALSE;
+ preview_w_current->scrollbars_flag = FALSE;
/* be sure to turn off the grid */
- preview_toplevel->grid = FALSE;
+ preview_w_current->grid = FALSE;
- /* preview_toplevel windows don't have toolbars */
- preview_toplevel->handleboxes = FALSE;
- preview_toplevel->toolbars = FALSE;
+ /* preview_w_current windows don't have toolbars */
+ preview_w_current->handleboxes = FALSE;
+ preview_w_current->toolbars = FALSE;
- preview_toplevel->width = 160;
- preview_toplevel->height = 120;
- preview_toplevel->win_width = preview_toplevel->width;
- preview_toplevel->win_height = preview_toplevel->height;
+ preview_w_current->toplevel->width = 160;
+ preview_w_current->toplevel->height = 120;
+ preview_w_current->win_width = preview_w_current->toplevel->width;
+ preview_w_current->win_height = preview_w_current->toplevel->height;
- preview_toplevel->drawing_area = GTK_WIDGET (preview);
- preview->preview_toplevel = preview_toplevel;
+ preview_w_current->drawing_area = GTK_WIDGET (preview);
+ preview->preview_w_current = preview_w_current;
g_object_set (GTK_WIDGET (preview),
- "width-request", preview_toplevel->width,
- "height-request", preview_toplevel->height,
+ "width-request", preview_w_current->toplevel->width,
+ "height-request", preview_w_current->toplevel->height,
NULL);
preview->active = FALSE;
@@ -451,9 +454,9 @@ preview_set_property (GObject *object,
GParamSpec *pspec)
{
Preview *preview = PREVIEW (object);
- TOPLEVEL *preview_toplevel = preview->preview_toplevel;
+ GSCHEM_TOPLEVEL *preview_w_current = preview->preview_w_current;
- g_assert (preview_toplevel != NULL);
+ g_assert (preview_w_current != NULL);
switch(property_id) {
case PROP_FILENAME:
@@ -487,14 +490,14 @@ preview_get_property (GObject *object,
GParamSpec *pspec)
{
Preview *preview = PREVIEW (object);
- TOPLEVEL *preview_toplevel = preview->preview_toplevel;
+ GSCHEM_TOPLEVEL *preview_w_current = preview->preview_w_current;
switch(property_id) {
case PROP_FILENAME:
- g_assert (preview_toplevel != NULL);
+ g_assert (preview_w_current != NULL);
/* return the filename of the current page in toplevel */
g_value_set_string (value,
- preview_toplevel->page_current->page_filename);
+ preview_w_current->toplevel->page_current->page_filename);
break;
case PROP_ACTIVE:
g_value_set_boolean (value, preview->active);
@@ -509,23 +512,24 @@ static void
preview_dispose (GObject *self)
{
Preview *preview = PREVIEW (self);
- TOPLEVEL *preview_toplevel = preview->preview_toplevel;
+ GSCHEM_TOPLEVEL *preview_w_current = preview->preview_w_current;
- if (preview_toplevel != NULL) {
- preview_toplevel->drawing_area = NULL;
+ if (preview_w_current != NULL) {
+ preview_w_current->drawing_area = NULL;
- o_attrib_free_current (preview_toplevel);
- o_complex_free_filename (preview_toplevel);
+ o_attrib_free_current (preview_w_current->toplevel);
+ o_complex_free_filename (preview_w_current->toplevel);
- if (preview_toplevel->backingstore) {
- gdk_pixmap_unref (preview_toplevel->backingstore);
+ if (preview_w_current->backingstore) {
+ gdk_pixmap_unref (preview_w_current->backingstore);
}
- x_window_free_gc (preview_toplevel);
+ x_window_free_gc (preview_w_current);
- s_toplevel_delete (preview_toplevel);
+ s_toplevel_delete (preview_w_current->toplevel);
+ g_free (preview_w_current);
- preview->preview_toplevel = NULL;
+ preview->preview_w_current = NULL;
}
G_OBJECT_CLASS (preview_parent_class)->dispose (self);
diff --git a/gschem/src/x_print.c b/gschem/src/x_print.c
index 9679b9c..750d2f0 100644
--- a/gschem/src/x_print.c
+++ b/gschem/src/x_print.c
@@ -29,6 +29,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
#include "../include/gschem_dialog.h"
@@ -651,11 +652,12 @@ print_dialog_get_type ()
*
*/
void
-x_print_setup (TOPLEVEL * w_current, char *filename)
+x_print_setup (GSCHEM_TOPLEVEL *w_current, char *filename)
{
- gchar * command = w_current->print_command;
- gint orient = w_current->print_orientation;
- gint type = w_current->print_output_type;
+ TOPLEVEL *toplevel = w_current->toplevel;
+ gchar * command = toplevel->print_command;
+ gint orient = toplevel->print_orientation;
+ gint type = toplevel->print_output_type;
gint paperidx, x, y, result;
gchar *string, *destination;
gboolean usefile = FALSE;
@@ -675,8 +677,8 @@ x_print_setup (TOPLEVEL * w_current, char *filename)
string = (gchar *) s_papersizes_get (paperidx);
s_papersizes_get_size (string, &x, &y);
- if ((x == w_current->paper_width)
- && (y == w_current->paper_height))
+ if ((x == toplevel->paper_width)
+ && (y == toplevel->paper_height))
{
break;
}
@@ -699,7 +701,7 @@ x_print_setup (TOPLEVEL * w_current, char *filename)
"usefile", usefile,
/* GschemDialog */
"settings-name", "print",
- "toplevel", w_current,
+ "gschem-toplevel", w_current,
NULL));
gtk_widget_show_all (GTK_WIDGET (dialog));
@@ -717,14 +719,14 @@ x_print_setup (TOPLEVEL * w_current, char *filename)
"command", &command,
"filename", &filename,
"papersize", &paperidx,
- "orientation", &w_current->print_orientation,
- "type", &w_current->print_output_type,
+ "orientation", &toplevel->print_orientation,
+ "type", &toplevel->print_output_type,
"usefile", &usefile,
NULL);
s_papersizes_get_size (s_papersizes_get (paperidx),
- &w_current->paper_width,
- &w_current->paper_height);
+ &toplevel->paper_width,
+ &toplevel->paper_height);
/* de select everything first */
o_select_unselect_all( w_current );
@@ -733,16 +735,16 @@ x_print_setup (TOPLEVEL * w_current, char *filename)
/* Print to file */
{
destination = filename;
- result = f_print_file (w_current, filename);
+ result = f_print_file (toplevel, filename);
}
else if (command[0])
/* Print to command and save command for later use. */
{
destination = command;
- result = f_print_command (w_current, command);
+ result = f_print_command (toplevel, command);
- g_free (w_current->print_command);
- w_current->print_command = g_strdup (command);
+ g_free (toplevel->print_command);
+ toplevel->print_command = g_strdup (command);
}
else
{
diff --git a/gschem/src/x_script.c b/gschem/src/x_script.c
index e4a46de..c1508e1 100644
--- a/gschem/src/x_script.c
+++ b/gschem/src/x_script.c
@@ -30,6 +30,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -42,7 +43,7 @@
* This function opens a file selection dialog. The selected script
* is executed.
*/
-void setup_script_selector (TOPLEVEL *w_current)
+void setup_script_selector (GSCHEM_TOPLEVEL *w_current)
{
char *filename;
diff --git a/gschem/src/x_stroke.c b/gschem/src/x_stroke.c
index 1351ba2..3ee3b8e 100644
--- a/gschem/src/x_stroke.c
+++ b/gschem/src/x_stroke.c
@@ -23,6 +23,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/x_states.h"
#include "../include/prototype.h"
@@ -44,7 +45,7 @@ static STROKE_POINT *stroke_points = NULL;
* \par Function Description
*
*/
-void x_stroke_add_point(TOPLEVEL *w_current, int x, int y)
+void x_stroke_add_point(GSCHEM_TOPLEVEL *w_current, int x, int y)
{
STROKE_POINT *new_point;
@@ -74,7 +75,7 @@ void x_stroke_add_point(TOPLEVEL *w_current, int x, int y)
* \note
* traverse list as well as free each point as you go along
*/
-void x_stroke_erase_all(TOPLEVEL *w_current)
+void x_stroke_erase_all(GSCHEM_TOPLEVEL *w_current)
{
STROKE_POINT *temp;
@@ -87,7 +88,7 @@ void x_stroke_erase_all(TOPLEVEL *w_current)
/* was xor, wasn't working out... see above note */
gdk_gc_set_foreground(
w_current->gc,
- x_get_color(w_current->background_color));
+ x_get_color(w_current->toplevel->background_color));
gdk_draw_point(w_current->window, w_current->gc,
stroke_points->x, stroke_points->y);
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index 8db910b..de2645f 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -23,6 +23,7 @@
#include <libgeda/libgeda.h>
+#include "../include/gschem_struct.h"
#include "../include/i_vars.h"
#include "../include/globals.h"
#include "../include/prototype.h"
@@ -36,14 +37,12 @@
* \par Function Description
*
*/
-void x_window_setup (TOPLEVEL *toplevel)
+void x_window_setup (GSCHEM_TOPLEVEL *w_current)
{
- /* x_window_setup_rest() - BEGIN */
- toplevel->event_state = SELECT;
- /* x_window_setup_rest() - END */
+ TOPLEVEL *toplevel = w_current->toplevel;
/* immediately setup user params */
- i_vars_set(toplevel);
+ i_vars_set(w_current);
/* Initialize the autosave callback */
s_page_autosave_init(toplevel);
@@ -56,17 +55,17 @@ void x_window_setup (TOPLEVEL *toplevel)
toplevel->width = default_width;
toplevel->height = default_height;
- toplevel->win_width = toplevel->width;
- toplevel->win_height = toplevel->height;
+ w_current->win_width = toplevel->width;
+ w_current->win_height = toplevel->height;
/* x_window_setup_world() - END */
/* Add to the list of windows */
- global_window_list = g_list_append (global_window_list, toplevel);
+ global_window_list = g_list_append (global_window_list, w_current);
/* X related stuff */
- x_window_create_main (toplevel);
+ x_window_create_main (w_current);
- x_menu_attach_recent_files_submenu(toplevel);
+ x_menu_attach_recent_files_submenu(w_current);
}
/*! \todo Finish function documentation!!!
@@ -103,7 +102,7 @@ void x_window_setup_colors(void)
* \par Function Description
*
*/
-void x_window_free_colors(TOPLEVEL *w_current)
+void x_window_free_colors()
{
GdkColor *colors[] = { &black, &white };
@@ -116,7 +115,7 @@ void x_window_free_colors(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_window_setup_gc(TOPLEVEL *w_current)
+void x_window_setup_gc(GSCHEM_TOPLEVEL *w_current)
{
GdkGCValues values;
GdkGCValuesMask values_mask;
@@ -183,7 +182,7 @@ void x_window_setup_gc(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_window_free_gc(TOPLEVEL *w_current)
+void x_window_free_gc(GSCHEM_TOPLEVEL *w_current)
{
gdk_gc_unref(w_current->gc);
gdk_gc_unref(w_current->xor_gc);
@@ -196,7 +195,7 @@ void x_window_free_gc(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_window_create_drawing(GtkWidget *drawbox, TOPLEVEL *w_current)
+void x_window_create_drawing(GtkWidget *drawbox, GSCHEM_TOPLEVEL *w_current)
{
/* drawing next */
w_current->drawing_area = gtk_drawing_area_new ();
@@ -224,7 +223,7 @@ void x_window_create_drawing(GtkWidget *drawbox, TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_window_setup_draw_events(TOPLEVEL *w_current)
+void x_window_setup_draw_events(GSCHEM_TOPLEVEL *w_current)
{
struct event_reg_t {
gchar *detailed_signal;
@@ -278,7 +277,7 @@ void x_window_setup_draw_events(TOPLEVEL *w_current)
* \param stock Name of the stock icon ("new", "open", etc.)
* \return Pointer to the new GtkImage object.
*/
-static GtkWidget *x_window_stock_pixmap(const char *stock, TOPLEVEL *w_current)
+static GtkWidget *x_window_stock_pixmap(const char *stock, GSCHEM_TOPLEVEL *w_current)
{
GtkWidget *wpixmap = NULL;
GdkPixmap *pixmap;
@@ -288,7 +287,7 @@ static GtkWidget *x_window_stock_pixmap(const char *stock, TOPLEVEL *w_current)
GdkWindow *window=w_current->main_window->window;
GdkColor *background=&w_current->main_window->style->bg[GTK_STATE_NORMAL];
- gchar *filename=g_strconcat(w_current->bitmap_directory,
+ gchar *filename=g_strconcat(w_current->toplevel->bitmap_directory,
G_DIR_SEPARATOR_S,
"gschem-", stock, ".xpm", NULL);
@@ -322,8 +321,10 @@ static GtkWidget *x_window_stock_pixmap(const char *stock, TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_window_create_main(TOPLEVEL *w_current)
+void x_window_create_main(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
+
GtkWidget *label=NULL;
GtkWidget *main_box=NULL;
GtkWidget *menubar=NULL;
@@ -364,7 +365,7 @@ void x_window_create_main(TOPLEVEL *w_current)
gtk_container_border_width(GTK_CONTAINER(main_box), 0);
gtk_container_add(GTK_CONTAINER(w_current->main_window), main_box);
- get_main_menu(w_current, &menubar);
+ get_main_menu(&menubar);
if (w_current->handleboxes) {
handlebox = gtk_handle_box_new ();
gtk_box_pack_start(GTK_BOX(main_box), handlebox, FALSE, FALSE, 0);
@@ -498,8 +499,8 @@ void x_window_create_main(TOPLEVEL *w_current)
if (w_current->scrollbars_flag == TRUE) {
/* setup scroll bars */
w_current->v_adjustment =
- gtk_adjustment_new (w_current->init_bottom,
- 0.0, w_current->init_bottom,
+ gtk_adjustment_new (toplevel->init_bottom,
+ 0.0, toplevel->init_bottom,
100.0, 100.0, 10.0);
w_current->v_scrollbar = gtk_vscrollbar_new (GTK_ADJUSTMENT (
@@ -517,7 +518,7 @@ void x_window_create_main(TOPLEVEL *w_current)
w_current);
w_current->h_adjustment = gtk_adjustment_new (0.0, 0.0,
- w_current->init_right,
+ toplevel->init_right,
100.0, 100.0, 10.0);
w_current->h_scrollbar = gtk_hscrollbar_new (GTK_ADJUSTMENT (
@@ -614,8 +615,9 @@ void x_window_create_main(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_window_close(TOPLEVEL *w_current)
+void x_window_close(GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
gboolean last_window = FALSE;
/* last chance to save possible unsaved pages */
@@ -680,24 +682,24 @@ void x_window_close(TOPLEVEL *w_current)
last_window = TRUE;
}
- o_attrib_free_current(w_current);
- o_complex_free_filename(w_current);
+ o_attrib_free_current(toplevel);
+ o_complex_free_filename(toplevel);
- if (w_current->major_changed_refdes) {
- GList* current = w_current->major_changed_refdes;
+ if (toplevel->major_changed_refdes) {
+ GList* current = toplevel->major_changed_refdes;
while (current)
{
/* printf("yeah freeing: %s\n", (char*) current->data); */
g_free(current->data);
current = g_list_next(current);
}
- g_list_free(w_current->major_changed_refdes);
+ g_list_free(toplevel->major_changed_refdes);
}
/* stuff that has to be done before we free w_current */
if (last_window) {
/* free all fonts */
- o_text_freeallfonts (w_current);
+ o_text_freeallfonts (toplevel);
/* close the log file */
s_log_close ();
/* free the buffers */
@@ -713,8 +715,9 @@ void x_window_close(TOPLEVEL *w_current)
/* finally close the main window */
gtk_widget_destroy(w_current->main_window);
- s_toplevel_delete (w_current);
+ s_toplevel_delete (toplevel);
global_window_list = g_list_remove (global_window_list, w_current);
+ g_free (w_current);
/* just closed last window, so quit */
if (last_window) {
@@ -727,14 +730,14 @@ void x_window_close(TOPLEVEL *w_current)
* \par Function Description
*
*/
-void x_window_close_all(TOPLEVEL *w_current)
+void x_window_close_all(GSCHEM_TOPLEVEL *w_current)
{
- TOPLEVEL *current;
+ GSCHEM_TOPLEVEL *current;
GList *list_copy, *iter;
iter = list_copy = g_list_copy (global_window_list);
while (iter != NULL ) {
- current = (TOPLEVEL *)iter->data;
+ current = (GSCHEM_TOPLEVEL *)iter->data;
iter = g_list_next (iter);
x_window_close (current);
}
@@ -756,21 +759,22 @@ void x_window_close_all(TOPLEVEL *w_current)
* \returns A pointer on the new page.
*/
PAGE*
-x_window_open_untitled_page (TOPLEVEL *toplevel)
+x_window_open_untitled_page (GSCHEM_TOPLEVEL *w_current)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
PAGE *page;
gchar *cwd, *tmp, *filename;
cwd = g_get_current_dir ();
tmp = g_strdup_printf ("%s_%d.sch",
toplevel->untitled_name,
- ++toplevel->num_untitled);
+ ++w_current->num_untitled);
filename = g_build_filename (cwd, tmp, NULL);
g_free (cwd);
g_free (tmp);
- page = x_window_open_page (toplevel, filename);
+ page = x_window_open_page (w_current, filename);
g_free (filename);
return page;
@@ -793,8 +797,9 @@ x_window_open_untitled_page (TOPLEVEL *toplevel)
* \returns A pointer on the new page.
*/
PAGE*
-x_window_open_page (TOPLEVEL *toplevel, const gchar *filename)
+x_window_open_page (GSCHEM_TOPLEVEL *w_current, const gchar *filename)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
PAGE *old_current, *page;
g_return_val_if_fail (toplevel != NULL, NULL);
@@ -818,11 +823,11 @@ x_window_open_page (TOPLEVEL *toplevel, const gchar *filename)
scm_run_hook (new_page_hook,
scm_cons (g_make_page_smob (toplevel, page), SCM_EOL));
- a_zoom_extents (toplevel,
+ a_zoom_extents (w_current,
toplevel->page_current->object_head,
A_PAN_DONT_REDRAW);
- o_undo_savestate (toplevel, UNDO_ALL);
+ o_undo_savestate (w_current, UNDO_ALL);
if ( old_current != NULL )
s_page_goto (toplevel, old_current);
@@ -832,7 +837,7 @@ x_window_open_page (TOPLEVEL *toplevel, const gchar *filename)
* needed needed to add it into the page manager. Otherwise,
* it will get done in x_window_set_current_page(...)
*/
- x_pagesel_update (toplevel); /* ??? */
+ x_pagesel_update (w_current); /* ??? */
recent_files_add(filename);
return page;
@@ -852,27 +857,29 @@ x_window_open_page (TOPLEVEL *toplevel, const gchar *filename)
* \param [in] page The page to become current page.
*/
void
-x_window_set_current_page (TOPLEVEL *toplevel, PAGE *page)
+x_window_set_current_page (GSCHEM_TOPLEVEL *w_current, PAGE *page)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
+
g_return_if_fail (toplevel != NULL);
g_return_if_fail (page != NULL);
s_page_goto (toplevel, page);
- i_update_menus (toplevel);
- i_set_filename (toplevel, page->page_filename);
+ i_update_menus (w_current);
+ i_set_filename (w_current, page->page_filename);
- x_pagesel_update (toplevel);
- x_multiattrib_update (toplevel);
+ x_pagesel_update (w_current);
+ x_multiattrib_update (w_current);
toplevel->DONT_REDRAW = 1;
- x_repaint_background (toplevel);
- x_manual_resize (toplevel);
- x_hscrollbar_update (toplevel);
- x_vscrollbar_update (toplevel);
+ x_repaint_background (w_current);
+ x_manual_resize (w_current);
+ x_hscrollbar_update (w_current);
+ x_vscrollbar_update (w_current);
toplevel->DONT_REDRAW = 0;
- o_redraw_all (toplevel);
+ o_redraw_all (w_current);
}
/*! \brief Saves a page to a file.
@@ -893,8 +900,9 @@ x_window_set_current_page (TOPLEVEL *toplevel, PAGE *page)
* \returns 1 on success, 0 otherwise.
*/
gint
-x_window_save_page (TOPLEVEL *toplevel, PAGE *page, const gchar *filename)
+x_window_save_page (GSCHEM_TOPLEVEL *w_current, PAGE *page, const gchar *filename)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
PAGE *old_current;
const gchar *log_msg, *state_msg;
gint ret;
@@ -939,10 +947,10 @@ x_window_save_page (TOPLEVEL *toplevel, PAGE *page, const gchar *filename)
s_log_message (log_msg, filename);
/* update display and page manager */
- x_window_set_current_page (toplevel, old_current);
+ x_window_set_current_page (w_current, old_current);
- i_set_state_msg (toplevel, SELECT, state_msg);
- i_update_toolbar (toplevel);
+ i_set_state_msg (w_current, SELECT, state_msg);
+ i_update_toolbar (w_current);
return ret;
}
@@ -959,8 +967,9 @@ x_window_save_page (TOPLEVEL *toplevel, PAGE *page, const gchar *filename)
* \param [in] page The page to close.
*/
void
-x_window_close_page (TOPLEVEL *toplevel, PAGE *page)
+x_window_close_page (GSCHEM_TOPLEVEL *w_current, PAGE *page)
{
+ TOPLEVEL *toplevel = w_current->toplevel;
PAGE *new_current = NULL;
GList *iter;
@@ -1001,10 +1010,10 @@ x_window_close_page (TOPLEVEL *toplevel, PAGE *page)
/* Create a new page if there wasn't another to switch to */
if (new_current == NULL) {
- new_current = x_window_open_untitled_page (toplevel);
+ new_current = x_window_open_untitled_page (w_current);
}
/* change to new_current and update display */
- x_window_set_current_page (toplevel, new_current);
+ x_window_set_current_page (w_current, new_current);
}
}
diff --git a/libgeda/include/struct.h b/libgeda/include/struct.h
index 1a677f1..49a8b2a 100644
--- a/libgeda/include/struct.h
+++ b/libgeda/include/struct.h
@@ -397,34 +397,10 @@ struct st_page {
struct st_toplevel {
- int num_untitled; /* keep track of untitled wins */
-
- int start_x;
- int start_y;
- int save_x;
- int save_y;
- int last_x;
- int last_y;
- int second_x;
- int second_y;
- int loc_x, loc_y;
- int distance;
-
/* used by attribute dialog */
/* also used by text add dialog */
char *current_attribute;
-
- /* used by add picture dialog */
- GdkPixbuf *current_pixbuf;
-
- double pixbuf_wh_ratio; /* width/height ratio of the pixbuf */
- char *pixbuf_filename;
-
- /* have to decided on attribute list stuff */
- /* if it should go in here or not */
- /* leave outside for now */
-
gchar *internal_symbol_name;
/* have to decided on component list stuff */
/* if it should go in here or not */
@@ -438,154 +414,40 @@ struct st_toplevel {
char *scheme_directory; /* path of the scheme scripts */
char *bitmap_directory; /* path of the bitmaps */
- int event_state; /* Current event state */
-
- int inside_action; /* Are we doing an action? */
- int rotated_inside; /* Was the selection rotated
- inside an action? */
-
int init_left, init_right; /* Starting values for above */
int init_top, init_bottom;
- int win_width, win_height; /* Actual size of window (?) */
int width, height; /* height, width of window */
- int image_width, image_height; /* h, w of image write */
int snap; /* Snap on/off*/
- int grid; /* Grid on/off*/
-
- /* location to hold current alignment of text */
- int text_alignment;
int override_color; /* used in doing selections */
- int inside_redraw; /* complex vs list redrawing */
int DONT_REDRAW; /* misc flags */
int ADDING_SEL;
- int drawbounding_action_mode; /* outline vs bounding box */
- int last_drawb_mode; /* last above mode */
-
- int CONTROLKEY; /* control key pressed? */
- int SHIFTKEY; /* shift key pressed? */
- int ALTKEY; /* alt key pressed? */
-
- int doing_pan; /* mouse pan status flag */
-
/* page system */
PAGE *page_current;
GedaPageList *pages;
- /* buffer_number is used by the buffer copy/cut/paste mechanism */
- /* in gschem to keep track of the current buffer number */
- int buffer_number;
-
/* show_hidden_text is used to control which text is hidden in gschem */
int show_hidden_text;
- /* Variable to keep track of what value the complex is at */
- int complex_rotate;
-
- void (*last_callback)(); /* Last i_call* cmd executed */
-
GList* major_changed_refdes; /* A list of all refdes's that have */
/* major symbol version changes */
- /* main window widgets */
- GtkWidget *main_window;
- GtkWidget *drawing_area;
- GtkWidget *menubar;
- GtkWidget *popup_menu;
- GtkWidget *h_scrollbar;
- GtkWidget *v_scrollbar;
- GtkObject *h_adjustment;
- GtkObject *v_adjustment;
- GtkWidget *left_label;
- GtkWidget *middle_label;
- GtkWidget *right_label;
- GtkWidget *grid_label;
- GtkWidget *status_label;
-
- GtkWidget *toolbar_select;
- GtkWidget *toolbar_net;
- GtkWidget *toolbar_bus;
-
- /* Dialog boxes */
- GtkWidget *sowindow; /* Script open */
- GtkWidget *pfswindow; /* Picture File Selection window */
-
- GtkWidget *cswindow; /* component select */
-
- GtkWidget *iwindow; /* image write dialog box */
-
- GtkWidget *pswindow; /* page select */
-
- /* misc dialogs */
- GtkWidget *tiwindow; /* text input */
- GtkWidget *tewindow; /* text edit */
- GtkWidget *sewindow; /* slot edit */
- GtkWidget *aawindow; /* arc attribs */
- GtkWidget *mawindow; /* multi attribute */
- GtkWidget *aewindow; /* attribute edit */
- GtkWidget *trwindow; /* translate */
- GtkWidget *tswindow; /* text size */
- GtkWidget *tshowwindow; /* text show window */
- GtkWidget *thidewindow; /* text hide window */
- GtkWidget *tfindwindow; /* text find window */
- GtkWidget *abwindow; /* Help/About... dialog*/
- GtkWidget *hkwindow; /* Help/Hotkeys... dialog*/
- GtkWidget *cowindow;
- GtkWidget *coord_world;
- GtkWidget *coord_screen;
-
- GtkWidget *clwindow;
- int edit_color;
-
- /* this is the drawing_area's X drawable */
- GdkWindow *window;
-
- /* graphics context stuff */
- GdkGC *gc;
- GdkGC *xor_gc;
- GdkGC *outline_xor_gc;
- GdkGC *bounding_xor_gc;
- GdkGC *bus_gc;
-
- /* backingstore pixmap */
- GdkPixmap *backingstore;
-
- /* used for visual feedback when pressing keyboard accelerators */
- gchar *keyaccel_string;
-
- /* rc/user parameters */
- int graphic_color;
- int pin_color;
- int text_color;
-
/* backup variables */
int auto_save_interval;
gint auto_save_timeout;
-
- /* not used anywhere yet, but will be */
- int logic_bubble_color;
- int zoom_box_color;
- int text_caps;
- int attribute_color;
- int detachedattr_color;
- int text_size;
-
/* used by math funcs for the snapping */
int snap_size;
- int grid_color;
+ /* BLOCK SET IN GSCHEM, BUT USED IN LIBGEDA - NEEDS A RETHINK */
+ int attribute_color;
+ int detachedattr_color;
int background_color;
- int select_color;
- int bb_color;
- int lock_color;
int net_endpoint_color;
int junction_color;
- int net_color;
- int bus_color;
int override_net_color;
int override_bus_color;
int override_pin_color;
@@ -593,38 +455,14 @@ struct st_toplevel {
int net_style;
int bus_style;
int line_style;
- int zoom_with_pan;
-
- /* can be either OUTLINE or BOUNDINGBOX */
- int actionfeedback_mode;
-
- /* controls if text is drawn or not in copy/move/place ops */
- int text_feedback;
-
- /* zoom factor at which text is displayed completely */
- int text_display_zoomfactor;
-
- /* can be either NONE, FILLEDBOX, EMPTYBOX, X */
- int net_endpoint_mode;
-
- /* can be either NONE or FILLED or EMPTY */
- int net_midpoint_mode;
+ /* END BLOCK - ALTHOUGH THERE ARE MORE CASES! */
/* controls whether objects are clipped */
int object_clipping;
- /* controls if complex objects are embedded */
- int embed_complex;
-
- /* controls if complex objects are included */
- int include_complex;
-
/* controls how text is printed (vector / PS font) */
int text_output;
- /* controls if scrollbars are displayed */
- int scrollbars_flag;
-
/* either landscape or portrait */
int print_orientation;
@@ -649,39 +487,9 @@ struct st_toplevel {
/* Use this as a scaling factor for the output font */
float postscript_font_scale;
- /* color of the stroke points */
- int stroke_color;
-
- /* controls if the log windows mapped on startup */
- int log_window;
-
- /* controls if the log window is decorated or not */
- int log_window_type;
-
- /* controls what the third mouse button does */
- int third_button;
-
- /* controls what the third mouse button does */
- int middle_button;
-
/* controls if the net consolidation code is used */
int net_consolidate;
- /* controls if the preview area is enabled or not */
- int file_preview;
-
- /* controls how much freedom user has when traversing the hierarchy */
- int enforce_hierarchy;
-
- /* controls if text origin marker is displayed or not */
- int text_origin_marker;
-
- /* controls if text is completely drawn during mouse pan */
- int fast_mousepan;
-
- /*controls if expose events raise dialog boxes*/
- int raise_dialog_boxes;
-
/*controls if attribute promotion happens */
int attribute_promotion;
@@ -691,41 +499,6 @@ struct st_toplevel {
/* controls if invisible attribs are kept and not deleted */
int keep_invisible;
- /* controls if after doing a place the */
- /* same component can be placed again */
- int continue_component_place;
-
- /* Number of undo levels stored on disk */
- int undo_levels;
-
- /* Controls if undo is enabled or not */
- int undo_control;
-
- /* Type of undo (disk/memory) */
- int undo_type;
-
- /* Controls if pan / zoom info is saved in undo */
- int undo_panzoom;
-
- /* Controls if grips are enabled or not */
- int draw_grips;
-
- /* controls if nets are rubberbanded as you move */
- /* them (or connecting comps) */
- int netconn_rubberband;
-
- /* sort the component library */
- int sort_component_library;
-
- /* warp the cursor when zooming */
- int warp_cursor;
-
- /* controls if the toolbar(s) are enabled or disabled */
- int toolbars;
-
- /* controls if the handleboxes are enabled or disabled */
- int handleboxes;
-
/* either window or limits */
int print_output_type;
@@ -735,57 +508,22 @@ struct st_toplevel {
/* landscape printing only */
int paper_width, paper_height;
- /* controls the size of the bus rippers */
- int bus_ripper_size;
-
- /* controls the type of the bus ripper (either component or net) */
- int bus_ripper_type;
-
/* filename of the bus ripper component if set above */
char *bus_ripper_symname;
- /* controls whether or not the the bus ripper is symmetric or not */
- int bus_ripper_rotation;
-
/* controls if the whole bounding box is used in the auto whichend code */
int force_boundingbox;
- /* controls the grid dot size */
- int grid_dot_size;
-
- /* controls the mode of the grid (either variable or fixed) */
- int grid_mode;
-
- /* controls the mininum number of pixels necessary for the grid to be */
- /* displayed */
- int grid_fixed_threshold;
-
/* controls the threshold (in lines of text) when the multi-line text */
/* output font is forced to vector */
int print_vector_threshold;
- /* controls the offset (in world coordinates) that are added to netname */
- /* attributes when they are attached to vertical or horizontal nets */
- int add_attribute_offset;
-
- /* Controls if drag can move objects or not */
- int drag_can_move;
-
/* List of attributes to always promote */
char *always_promote_attributes;
- /* Controls the gain of the mouse pan */
- int mousepan_gain;
-
- /* Controls the gain of the keyboard pan */
- int keyboardpan_gain;
-
/* The command to send postscript to when printing */
char *print_command;
- /* Number of pixels around an object we can still select it with */
- int select_slack_pixels;
-
/* gnetlist specific */
int net_naming_priority;
int hierarchy_traversal;
diff --git a/libgeda/src/s_toplevel.c b/libgeda/src/s_toplevel.c
index b53040a..e97a298 100644
--- a/libgeda/src/s_toplevel.c
+++ b/libgeda/src/s_toplevel.c
@@ -58,22 +58,9 @@ TOPLEVEL *s_toplevel_new (void)
toplevel = (TOPLEVEL*)g_new (TOPLEVEL, 1);
- toplevel->num_untitled = 0;
-
- toplevel->start_x = -1;
- toplevel->start_y = -1;
- toplevel->save_x = -1;
- toplevel->save_y = -1;
- toplevel->last_x = -1;
- toplevel->last_y = -1;
- toplevel->loc_x = -1;
- toplevel->loc_y = -1;
- toplevel->distance = -1;
-
toplevel->current_attribute = NULL;
-
toplevel->internal_symbol_name = NULL;
-
+
toplevel->RC_list = NULL;
toplevel->series_name = NULL;
@@ -82,143 +69,34 @@ TOPLEVEL *s_toplevel_new (void)
toplevel->scheme_directory = NULL;
toplevel->bitmap_directory = NULL;
- toplevel->event_state = -1;
-
- toplevel->inside_action = 0;
- toplevel->rotated_inside = 0;
-
toplevel->init_left = 0;
toplevel->init_top = 0;
/* init_right and _bottom are set before this function is called */
- toplevel->win_width = 0;
- toplevel->win_height = 0;
toplevel->width = 1;
toplevel->height = 1;
- toplevel->image_width = 0;
- toplevel->image_height = 0;
toplevel->snap = 1;
- toplevel->grid = 1;
-
- toplevel->text_alignment = 0;
toplevel->override_color = -1;
- toplevel->inside_redraw = 0;
toplevel->DONT_REDRAW = 0;
toplevel->ADDING_SEL = 0;
- toplevel->drawbounding_action_mode = FREE;
- toplevel->last_drawb_mode = -1;
-
- toplevel->CONTROLKEY = 0;
- toplevel->SHIFTKEY = 0;
- toplevel->ALTKEY = 0;
-
- toplevel->doing_pan = 0;
-
toplevel->pages = geda_list_new();
toplevel->page_current = NULL;
- toplevel->buffer_number = 0;
-
toplevel->show_hidden_text = 0;
- toplevel->complex_rotate = 0;
-
- toplevel->last_callback = NULL;
-
toplevel->major_changed_refdes = NULL;
- toplevel->main_window = NULL;
- toplevel->drawing_area = NULL;
- toplevel->menubar = NULL;
- toplevel->popup_menu = NULL;
- toplevel->h_scrollbar = NULL;
- toplevel->v_scrollbar = NULL;
- toplevel->h_adjustment = NULL;
- toplevel->v_adjustment = NULL;
- toplevel->left_label = NULL;
- toplevel->middle_label = NULL;
- toplevel->right_label = NULL;
- toplevel->grid_label = NULL;
- toplevel->status_label = NULL;
-
- toplevel->toolbar_select = NULL;
- toplevel->toolbar_net = NULL;
- toplevel->toolbar_bus = NULL;
-
- toplevel->sowindow = NULL;
-
- toplevel->cswindow = NULL;
-
-/* toplevel->fileselect */
-
- toplevel->iwindow = NULL;
-
- toplevel->pswindow = NULL;
-
- toplevel->tiwindow = NULL;
- toplevel->tewindow = NULL;
- toplevel->sewindow = NULL;
- toplevel->aawindow = NULL;
- toplevel->mawindow = NULL;
- toplevel->aewindow = NULL;
- toplevel->trwindow = NULL;
- toplevel->tswindow = NULL;
- toplevel->tshowwindow = NULL;
- toplevel->thidewindow = NULL;
- toplevel->tfindwindow = NULL;
-
- toplevel->abwindow = NULL;
- toplevel->hkwindow = NULL;
- toplevel->cowindow = NULL;
- toplevel->coord_world = NULL;
- toplevel->coord_screen = NULL;
-
- toplevel->pfswindow = NULL;
-
- toplevel->current_pixbuf = NULL;
- toplevel->pixbuf_filename = NULL;
- toplevel->pixbuf_wh_ratio = 0;
-
- toplevel->clwindow = NULL;
- toplevel->edit_color = 0;
-
- toplevel->window = NULL;
-
- toplevel->gc = NULL;
- toplevel->xor_gc = NULL;
- toplevel->outline_xor_gc = NULL;
- toplevel->bounding_xor_gc = NULL;
- toplevel->bus_gc = NULL;
-
- toplevel->keyaccel_string = NULL;
-
- toplevel->backingstore = NULL;
-
- toplevel->graphic_color = 0;
- toplevel->pin_color = 0;
- toplevel->text_color = 0;
-
- toplevel->logic_bubble_color = 0;
- toplevel->zoom_box_color = 0;
- toplevel->text_caps = 0;
- toplevel->attribute_color = 0;
- toplevel->detachedattr_color = 0;
- toplevel->text_size = 0;
-
toplevel->snap_size = 100;
- toplevel->grid_color = 0;
+ /* BLOCK SET IN GSCHEM, BUT USED IN LIBGEDA - NEEDS A RETHINK */
+ toplevel->attribute_color = 0;
+ toplevel->detachedattr_color = 0;
toplevel->background_color = 0;
- toplevel->select_color = 0;
- toplevel->bb_color = 0;
- toplevel->lock_color = 0;
toplevel->net_endpoint_color = 0;
toplevel->junction_color = 0;
- toplevel->net_color = 0;
- toplevel->bus_color = 0;
toplevel->override_net_color = -1;
toplevel->override_bus_color = -1;
toplevel->override_pin_color = -1;
@@ -226,28 +104,12 @@ TOPLEVEL *s_toplevel_new (void)
toplevel->net_style = 0;
toplevel->bus_style = 0;
toplevel->line_style = 0;
- toplevel->zoom_with_pan = 0;
-
- toplevel->actionfeedback_mode = OUTLINE;
-
- toplevel->text_feedback = 0;
-
- toplevel->text_display_zoomfactor = 0;
-
- toplevel->net_endpoint_mode = NONE;
-
- toplevel->net_midpoint_mode = NONE;
+ /* END BLOCK - ALTHOUGH THERE ARE MORE CASES! */
toplevel->object_clipping = 0;
- toplevel->embed_complex = 0;
-
- toplevel->include_complex = 0;
-
toplevel->text_output = 0;
- toplevel->scrollbars_flag = 0;
-
toplevel->print_orientation = 0;
toplevel->image_color = FALSE;
@@ -263,56 +125,14 @@ TOPLEVEL *s_toplevel_new (void)
toplevel->postscript_prolog = NULL;
toplevel->postscript_font_scale = 1.0;
- toplevel->stroke_color = 0;
-
- toplevel->log_window = 0;
-
- toplevel->log_window_type = 0;
-
- toplevel->third_button = 0;
-
- toplevel->middle_button = 0;
-
toplevel->net_consolidate = FALSE;
- toplevel->file_preview = 0;
-
- toplevel->enforce_hierarchy = 0;
-
- toplevel->text_origin_marker = 0;
-
- toplevel->fast_mousepan = 0;
-
- toplevel->raise_dialog_boxes = 0;
-
/* The following is an attempt at getting (deterministic) defaults */
/* for the following variables */
toplevel->attribute_promotion = FALSE;
toplevel->promote_invisible = FALSE;
toplevel->keep_invisible = FALSE;
- toplevel->continue_component_place = 0;
-
- toplevel->undo_levels = 0;
-
- toplevel->undo_control = 0;
-
- toplevel->undo_type = 0;
-
- toplevel->undo_panzoom = 0;
-
- toplevel->draw_grips = 0;
-
- toplevel->netconn_rubberband = 0;
-
- toplevel->sort_component_library = 0;
-
- toplevel->warp_cursor = 0;
-
- toplevel->toolbars = 0;
-
- toplevel->handleboxes = 0;
-
toplevel->print_output_type = 0;
toplevel->print_output_capstyle = BUTT_CAP;
@@ -320,35 +140,16 @@ TOPLEVEL *s_toplevel_new (void)
toplevel->paper_width = 0;
toplevel->paper_height = 0;
- toplevel->bus_ripper_size = 0;
-
- toplevel->bus_ripper_type = 0;
-
toplevel->bus_ripper_symname = NULL;
- toplevel->bus_ripper_rotation = 0;
-
toplevel->force_boundingbox = FALSE;
- toplevel->grid_dot_size = 1;
- toplevel->grid_mode = GRID_VARIABLE_MODE;
- toplevel->grid_fixed_threshold = 10;
-
toplevel->print_vector_threshold = 3;
- toplevel->add_attribute_offset = 50;
-
- toplevel->drag_can_move = TRUE;
-
toplevel->always_promote_attributes = NULL;
- toplevel->mousepan_gain = 5;
- toplevel->keyboardpan_gain = 10;
-
toplevel->print_command = NULL;
- toplevel->select_slack_pixels = 4;
-
toplevel->net_naming_priority = 0;
toplevel->hierarchy_traversal = 0;
toplevel->hierarchy_uref_mangle = 0;
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs