Convert all apertures and macros to inches during parsing, completing the storage...
[geda-gerbv.git] / src / gerbv_screen.h
blobf50cc183174b12453fa07aa15a01962128a538c8
1 /*
2 * gEDA - GNU Electronic Design Automation
3 * This file is a part of gerbv.
5 * Copyright (C) 2000-2003 Stefan Petersen (spe@stacken.kth.se)
7 * $Id$
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111 USA
24 #ifndef GERBV_SCREEN_H
25 #define GERBV_SCREEN_H
27 #ifdef HAVE_CONFIG_H
28 #include <config.h>
29 #endif
31 #include <gtk/gtk.h>
32 #include <gdk/gdk.h>
34 #include "gerb_image.h"
35 #include "gerber.h"
37 #define INITIAL_SCALE 200
38 #define MAX_ERRMSGLEN 25
39 #define MAX_COORDLEN 28
40 #define MAX_DISTLEN 90
41 #define MAX_STATUSMSGLEN (MAX_ERRMSGLEN+MAX_COORDLEN+MAX_DISTLEN)
43 /* Macros to convert between unscaled gerber coordinates and other units */
44 /* XXX NOTE: Currently unscaled units are assumed as inch, this is not
45 XXX necessarily true for all files */
46 #define COORD2MILS(c) ((c)*1000.0)
47 #define COORD2MMS(c) ((c)*25.4)
49 typedef enum {NORMAL, IN_MOVE, IN_ZOOM_OUTLINE, IN_MEASURE, ALT_PRESSED, SCROLLBAR} gerbv_state_t;
50 typedef enum {POINTER, PAN, ZOOM, MEASURE} gerbv_tool_t;
51 typedef enum {GERBV_MILS, GERBV_MMS, GERBV_INS} gerbv_unit_t;
53 typedef struct {
54 gerb_image_t *image;
55 GdkColor color;
56 guint16 alpha;
57 gboolean isVisible;
58 gpointer privateRenderData;
59 gchar *fullPathname; /* this should be the full pathname to the file */
60 gchar *name;
61 gboolean inverted;
62 } gerbv_fileinfo_t;
64 typedef struct {
65 double x1, y1;
66 double x2, y2;
67 } gerbv_bbox_t;
70 typedef struct {
71 GtkWidget *drawing_area;
72 GdkPixmap *pixmap;
73 GdkColor background;
74 GdkColor zoom_outline_color;
75 GdkColor dist_measure_color;
76 gerbv_unit_t unit;
78 struct {
79 GtkWidget *log;
80 GtkWidget *topLevelWindow;
81 GtkWidget *messageTextView;
82 GtkWidget *statusMessageLeft;
83 GtkWidget *statusMessageRight;
84 GtkWidget *statusUnitComboBox;
85 GtkWidget *layerTree;
86 gboolean treeIsUpdating;
87 GtkWidget *colorSelectionDialog;
88 gint colorSelectionIndex;
89 GtkWidget *hAdjustment;
90 GtkWidget *vAdjustment;
91 GtkWidget *hRuler;
92 GtkWidget *vRuler;
93 GtkWidget *sidepane_notebook;
94 GtkWidget *project;
95 GtkWidget *gerber;
96 GtkWidget *about_dialog;
97 GtkWidget *toolButtonPointer;
98 GtkWidget *toolButtonPan;
99 GtkWidget *toolButtonZoom;
100 GtkWidget *toolButtonMeasure;
101 gboolean updatingTools;
102 GtkWidget *layerTreePopupMenu;
103 gdouble lastMeasuredX;
104 gdouble lastMeasuredY;
105 } win;
106 gpointer windowSurface;
107 gpointer bufferSurface;
108 int max_files;
109 gerbv_fileinfo_t **file;
110 int curr_index;
111 int last_loaded;
113 gchar *path;
114 gchar *execpath; /* Path to executed version of gerbv */
115 gchar *project; /* Current project to simplify save next time */
117 GtkTooltips *tooltips;
118 GtkWidget *popup_menu;
119 struct {
120 GtkWidget *msg;
121 char msgstr[MAX_STATUSMSGLEN];
122 char coordstr[MAX_COORDLEN];
123 char diststr[MAX_DISTLEN];
124 } statusbar;
126 gerbv_state_t state;
127 gerbv_tool_t tool;
128 gboolean centered_outline_zoom;
130 int selected_layer; /* Selected layer by Alt+keypad */
132 gint last_x;
133 gint last_y;
134 gint start_x; /* Zoom box/measure start coordinates */
135 gint start_y;
137 gint off_x; /* Offset current pixmap when panning */
138 gint off_y;
140 int dump_parsed_image;
141 } gerbv_screen_t;
143 typedef enum {ZOOM_IN, ZOOM_OUT, ZOOM_FIT, ZOOM_IN_CMOUSE, ZOOM_OUT_CMOUSE, ZOOM_SET } gerbv_zoom_dir_t;
144 typedef struct {
145 gerbv_zoom_dir_t z_dir;
146 GdkEventButton *z_event;
147 int scale;
148 } gerbv_zoom_data_t;
150 extern gerbv_screen_t screen;
152 #endif /* GERBV_SCREEN_H */