* gerbv.c: Rework project filename saving to save all layers with relative
[geda-gerbv.git] / src / gerbv_screen.h
blobe4fe39c079bb2e7bf3fb4ab65e58b06e9c2ca77a
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, 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 char *name; /* this should be the full pathname to the file */
60 char inverted;
61 } gerbv_fileinfo_t;
63 typedef struct {
64 double x1, y1;
65 double x2, y2;
66 } gerbv_bbox_t;
69 typedef struct {
70 GtkWidget *drawing_area;
71 GdkPixmap *pixmap;
72 GdkColor background;
73 GdkColor zoom_outline_color;
74 GdkColor dist_measure_color;
75 gerbv_unit_t unit;
77 struct {
78 GtkWidget *log;
79 GtkWidget *topLevelWindow;
80 GtkWidget *messageTextView;
81 GtkWidget *statusMessageLeft;
82 GtkWidget *statusMessageRight;
83 GtkWidget *statusUnitComboBox;
84 GtkWidget *layerTree;
85 gboolean treeIsUpdating;
86 GtkWidget *colorSelectionDialog;
87 gint colorSelectionIndex;
88 GtkWidget *hAdjustment;
89 GtkWidget *vAdjustment;
90 GtkWidget *hRuler;
91 GtkWidget *vRuler;
92 GtkWidget *sidepane_notebook;
93 GtkWidget *project;
94 GtkWidget *gerber;
95 GtkWidget *about_dialog;
96 GtkWidget *toolButtonPointer;
97 GtkWidget *toolButtonZoom;
98 GtkWidget *toolButtonMeasure;
99 gboolean updatingTools;
100 } win;
101 gpointer windowSurface;
102 gpointer bufferSurface;
103 gerbv_fileinfo_t *file[MAX_FILES];
104 int curr_index;
105 int last_loaded;
107 gchar *path;
108 gchar *execpath; /* Path to executed version of gerbv */
109 gchar *project; /* Current project to simplify save next time */
111 GtkTooltips *tooltips;
112 GtkWidget *popup_menu;
113 struct {
114 GtkWidget *msg;
115 char msgstr[MAX_STATUSMSGLEN];
116 char coordstr[MAX_COORDLEN];
117 char diststr[MAX_DISTLEN];
118 } statusbar;
120 gerbv_state_t state;
121 gerbv_tool_t tool;
122 gboolean centered_outline_zoom;
124 int selected_layer; /* Selected layer by Alt+keypad */
126 gint last_x;
127 gint last_y;
128 gint start_x; /* Zoom box/measure start coordinates */
129 gint start_y;
131 gint off_x; /* Offset current pixmap when panning */
132 gint off_y;
134 int dump_parsed_image;
135 } gerbv_screen_t;
137 typedef enum {ZOOM_IN, ZOOM_OUT, ZOOM_FIT, ZOOM_IN_CMOUSE, ZOOM_OUT_CMOUSE, ZOOM_SET } gerbv_zoom_dir_t;
138 typedef struct {
139 gerbv_zoom_dir_t z_dir;
140 GdkEventButton *z_event;
141 int scale;
142 } gerbv_zoom_data_t;
144 extern gerbv_screen_t screen;
146 #endif /* GERBV_SCREEN_H */