More honesty about bug 144394, it's not quite fixed yet.
[dia.git] / app / display.h
blob5db785912828f9b30702b3b558938457fa94e6ab
1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1998 Alexander Larsson
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #ifndef DDISPLAY_H
19 #define DDISPLAY_H
21 #include <gtk/gtk.h>
22 #include <gtk/gtkimcontext.h>
24 typedef struct _DDisplay DDisplay;
26 #include "geometry.h"
27 #include "diagram.h"
28 #include "grid.h"
29 #include "menus.h"
30 #include "diarenderer.h"
32 /** Defines the pixels per cm, default is 20 pixels = 1 cm */
33 /** This is close to, but not quite the same as, the physical display size
34 * in most cases */
36 #define DDISPLAY_MAX_ZOOM 500.0
37 #define DDISPLAY_NORMAL_ZOOM 20.0
38 #define DDISPLAY_MIN_ZOOM 1.0
40 /* The zoom amount should be uniform. Pixels per cm should be defined by the
41 * renderer alone. But that'd take a lot of fiddling in renderers. */
43 #define DDISPLAY_MAX_ZOOM 100.0
44 #define DDISPLAY_NORMAL_ZOOM 1.0
45 #define DDISPLAY_MIN_ZOOM 0.01
47 struct _DDisplay {
48 Diagram *diagram; /* pointer to the associated diagram */
50 GtkWidget *shell; /* shell widget for this ddisplay */
51 GtkWidget *canvas; /* canvas widget for this ddisplay */
52 GtkWidget *hsb, *vsb; /* widgets for scroll bars */
53 GtkWidget *hrule, *vrule; /* widgets for rulers */
54 GtkWidget *origin; /* widgets for rulers */
55 GtkWidget *menu_bar; /* widget for the menu bar */
56 GtkUIManager *ui_manager; /* ui manager used to create the menu bar */
57 GtkActionGroup *actions;
59 /* menu bar widgets */
60 GtkMenuItem *rulers;
61 UpdatableMenuItems updatable_menu_items;
63 GtkWidget *zoom_status;
64 GtkWidget *grid_status;
65 GtkWidget *mainpoint_status;
66 GtkWidget *modified_status;
68 GtkAccelGroup *accel_group;
70 GtkAdjustment *hsbdata; /* horizontal data information */
71 GtkAdjustment *vsbdata; /* vertical data information */
73 Point origo; /* The origo (lower left) position */
74 real zoom_factor; /* zoom, 20.0 means 20 pixel == 1 cm */
75 Rectangle visible; /* The part visible in this display */
77 Grid grid; /* the grid in this display */
79 gboolean show_cx_pts; /* Connection points toggle boolean */
80 gboolean autoscroll;
81 gboolean mainpoint_magnetism; /* Mainpoints snapped from entire obj*/
83 int aa_renderer;
84 DiaRenderer *renderer;
86 GSList *update_areas; /* Update areas list */
87 GSList *display_areas; /* Display areas list */
88 guint update_id; /* idle handler ID for redraws */
90 GtkIMContext *im_context;
92 /* Preedit String */
93 gchar *preedit_string;
94 PangoAttrList *preedit_attrs;
97 extern GdkCursor *default_cursor;
99 DDisplay *new_display(Diagram *dia);
100 DDisplay *copy_display(DDisplay *orig_ddisp);
101 /* Normal destroy is done through shell widget destroy event. */
102 void ddisplay_really_destroy(DDisplay *ddisp);
103 void ddisplay_transform_coords_double(DDisplay *ddisp,
104 coord x, coord y,
105 double *xi, double *yi);
106 void ddisplay_transform_coords(DDisplay *ddisp,
107 coord x, coord y,
108 int *xi, int *yi);
109 void ddisplay_untransform_coords(DDisplay *ddisp,
110 int xi, int yi,
111 coord *x, coord *y);
112 real ddisplay_transform_length(DDisplay *ddisp, real len);
113 real ddisplay_untransform_length(DDisplay *ddisp, real len);
114 void ddisplay_add_update_pixels(DDisplay *ddisp, Point *point,
115 int pixel_width, int pixel_height);
116 void ddisplay_add_update_all(DDisplay *ddisp);
117 void ddisplay_add_update_with_border(DDisplay *ddisp, Rectangle *rect,
118 int pixel_border);
119 void ddisplay_add_update(DDisplay *ddisp, Rectangle *rect);
120 void ddisplay_add_display_area(DDisplay *ddisp,
121 int left, int top,
122 int right, int bottom);
123 void ddisplay_flush(DDisplay *ddisp);
124 void ddisplay_update_scrollbars(DDisplay *ddisp);
125 void ddisplay_set_origo(DDisplay *ddisp,
126 coord x, coord y);
127 void ddisplay_zoom(DDisplay *ddisp, Point *point,
128 real zoom_factor);
129 void ddisplay_set_snap_to_grid(DDisplay *ddisp, gboolean snap);
130 void ddisplay_set_snap_to_objects(DDisplay *ddisp, gboolean magnetic);
131 void ddisplay_set_renderer(DDisplay *ddisp, int aa_renderer);
132 void ddisplay_resize_canvas(DDisplay *ddisp,
133 int width,
134 int height);
136 void ddisplay_render_pixmap(DDisplay *ddisp, Rectangle *update);
138 DDisplay *ddisplay_active(void);
139 Diagram *ddisplay_active_diagram(void);
141 void ddisplay_close(DDisplay *ddisp);
143 void ddisplay_set_title(DDisplay *ddisp, char *title);
144 void ddisplay_set_cursor(DDisplay *ddisp, GdkCursor *cursor);
145 void ddisplay_set_all_cursor(GdkCursor *cursor);
147 gboolean ddisplay_scroll(DDisplay *ddisp, Point *delta);
148 gboolean ddisplay_autoscroll(DDisplay *ddisp, int x, int y);
149 void ddisplay_scroll_up(DDisplay *ddisp);
150 void ddisplay_scroll_down(DDisplay *ddisp);
151 void ddisplay_scroll_left(DDisplay *ddisp);
152 void ddisplay_scroll_right(DDisplay *ddisp);
153 gboolean ddisplay_scroll_center_point(DDisplay *ddisp, Point *p);
154 gboolean ddisplay_scroll_to_object(DDisplay *ddisp, DiaObject *obj);
156 void display_update_menu_state(DDisplay *ddisp);
157 void ddisplay_update_statusbar(DDisplay *ddisp);
158 void ddisplay_do_update_menu_sensitivity (DDisplay *ddisp);
160 void display_set_active(DDisplay *ddisp);
162 void ddisplay_im_context_preedit_reset(DDisplay *ddisp, Focus *focus);
164 #endif /* DDISPLAY_H */