1 /*
2  * gEDA - GNU Electronic Design Automation
3  * This file is a part of gerbv.
4  *
5  *   Copyright (C) 2000-2003 Stefan Petersen (spe@stacken.kth.se)
6  *
7  * $Id$
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  */
23 
24 /** \file main.h
25     \brief Header info for common structs and functions used for the GUI application
26     \ingroup gerbv
27 */
28 
29 #ifndef MAIN_H
30 #define MAIN_H
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 typedef enum {GERBV_MILS, GERBV_MMS, GERBV_INS} gerbv_gui_unit_t;
37 typedef enum {ZOOM_IN, ZOOM_OUT, ZOOM_FIT, ZOOM_IN_CMOUSE, ZOOM_OUT_CMOUSE, ZOOM_SET } gerbv_zoom_dir_t;
38 typedef enum {NORMAL, IN_MOVE, IN_ZOOM_OUTLINE, IN_MEASURE, ALT_PRESSED,
39 		IN_SELECTION_DRAG, SCROLLBAR} gerbv_state_t;
40 typedef enum {POINTER, PAN, ZOOM, MEASURE} gerbv_tool_t;
41 
42 typedef struct {
43     GtkWidget *drawing_area;
44     GdkPixmap *pixmap;
45     GdkColor  zoom_outline_color;
46     GdkColor  dist_measure_color;
47     GdkColor  selection_color;
48 
49     struct {
50 	GtkWidget *log;
51 	GtkWidget *topLevelWindow;
52 	GtkWidget *messageTextView;
53 	GtkWidget *statusMessageLeft;
54 	GtkWidget *statusMessageRight;
55 	GtkWidget *statusUnitComboBox;
56 	GtkCheckMenuItem **menu_view_unit_group;
57 	GtkWidget *layerTree;
58 	gboolean treeIsUpdating;
59 	GtkWidget *colorSelectionDialog;
60 	gint colorSelectionIndex;
61 	GtkWidget *hAdjustment;
62 	GtkWidget *vAdjustment;
63 	GtkWidget *hRuler;
64 	GtkWidget *vRuler;
65 	GtkWidget *sidepane_notebook;
66 	GtkComboBox *sidepaneRenderComboBox;
67 	GtkCheckMenuItem **menu_view_render_group;
68 	GtkWidget *project;
69 	GtkWidget *gerber;
70 	GtkWidget *about_dialog;
71 	GtkWidget *toolButtonPointer;
72 	GtkWidget *toolButtonPan;
73 	GtkWidget *toolButtonZoom;
74 	GtkWidget *toolButtonMeasure;
75 	gboolean updatingTools;
76 	GtkWidget *layerTreePopupMenu;
77 	GtkWidget *drawWindowPopupMenu;
78 	GtkWidget *curLayerMenuItem;
79 	GtkWidget *curAnalyzeMenuItem;
80 	GtkWidget *curEditMenuItem;
81 	GtkWidget *curEditAlingMenuItem, *curEditAlingItem[2];
82 	GtkWidget *curFileMenuItem[7];
83     } win;
84 
85     gpointer windowSurface;
86     gpointer bufferSurface;
87     gpointer selectionRenderData;
88 
89     GtkTooltips *tooltips;
90     GtkWidget *popup_menu;
91     struct {
92 	GtkWidget *msg;
93 	char msgstr[MAX_STATUSMSGLEN];
94 	char coordstr[MAX_COORDLEN];
95 	char diststr[MAX_DISTLEN];
96     } statusbar;
97 
98     gboolean centered_outline_zoom;
99 
100     int selected_layer;		/* Selected layer by Alt+keypad */
101     gerbv_selection_info_t selectionInfo;
102     gerbv_state_t state;
103     gerbv_tool_t tool;
104     gerbv_gui_unit_t unit;
105     gboolean unit_is_from_cmdline;
106     gboolean background_is_from_cmdline;
107     gboolean background_is_from_project;
108     GSettings *settings;
109 
110     gint last_x;
111     gint last_y;
112     gint start_x;		/* Zoom box start screen coordinates */
113     gint start_y;
114 
115     gint off_x;			/* Offset current pixmap when panning */
116     gint off_y;
117 
118     gdouble measure_start_x;	/* Measure start board coordinates */
119     gdouble measure_start_y;
120     gdouble measure_stop_x;	/* Measure end board coordinates */
121     gdouble measure_stop_y;
122 
123     gdouble measure_last_x;
124     gdouble measure_last_y;
125 
126     gdouble length_sum;
127 
128     int dump_parsed_image;
129 } gerbv_screen_t;
130 
131 struct log_struct {
132     gchar *domain;
133     GLogLevelFlags level;
134     gchar *message;
135 };
136 
137 extern gerbv_screen_t screen;
138 extern gerbv_project_t *mainProject;
139 
140 void
141 main_save_as_project_from_filename(gerbv_project_t *gerbvProject, gchar *filename);
142 
143 void
144 main_save_project_from_filename(gerbv_project_t *gerbvProject, gchar *filename);
145 
146 void
147 main_open_project_from_filename(gerbv_project_t *gerbvProject, gchar *filename);
148 #endif /* GERBV_H */
149 
150