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.
22 #include <gtk/gtkimcontext.h>
24 typedef struct _DDisplay DDisplay
;
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
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
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 GtkItemFactory
*mbar_item_factory
; /* item factory used to create the menu bar */
58 /* menu bar widgets */
60 UpdatableMenuItems updatable_menu_items
;
62 GtkWidget
*zoom_status
;
63 GtkWidget
*grid_status
;
64 GtkWidget
*mainpoint_status
;
65 GtkWidget
*modified_status
;
67 GtkAccelGroup
*accel_group
;
69 GtkAdjustment
*hsbdata
; /* horizontal data information */
70 GtkAdjustment
*vsbdata
; /* vertical data information */
72 Point origo
; /* The origo (lower left) position */
73 real zoom_factor
; /* zoom, 20.0 means 20 pixel == 1 cm */
74 Rectangle visible
; /* The part visible in this display */
76 Grid grid
; /* the grid in this display */
78 gboolean show_cx_pts
; /* Connection points toggle boolean */
80 gboolean mainpoint_magnetism
; /* Mainpoints snapped from entire obj*/
83 DiaRenderer
*renderer
;
85 GSList
*update_areas
; /* Update areas list */
86 GSList
*display_areas
; /* Display areas list */
87 guint update_id
; /* idle handler ID for redraws */
89 GtkIMContext
*im_context
;
92 gchar
*preedit_string
;
93 PangoAttrList
*preedit_attrs
;
96 extern GdkCursor
*default_cursor
;
98 DDisplay
*new_display(Diagram
*dia
);
99 /* Normal destroy is done through shell widget destroy event. */
100 void ddisplay_really_destroy(DDisplay
*ddisp
);
101 void ddisplay_transform_coords_double(DDisplay
*ddisp
,
103 double *xi
, double *yi
);
104 void ddisplay_transform_coords(DDisplay
*ddisp
,
107 void ddisplay_untransform_coords(DDisplay
*ddisp
,
110 real
ddisplay_transform_length(DDisplay
*ddisp
, real len
);
111 real
ddisplay_untransform_length(DDisplay
*ddisp
, real len
);
112 void ddisplay_add_update_pixels(DDisplay
*ddisp
, Point
*point
,
113 int pixel_width
, int pixel_height
);
114 void ddisplay_add_update_all(DDisplay
*ddisp
);
115 void ddisplay_add_update_with_border(DDisplay
*ddisp
, Rectangle
*rect
,
117 void ddisplay_add_update(DDisplay
*ddisp
, Rectangle
*rect
);
118 void ddisplay_add_display_area(DDisplay
*ddisp
,
120 int right
, int bottom
);
121 void ddisplay_flush(DDisplay
*ddisp
);
122 void ddisplay_update_scrollbars(DDisplay
*ddisp
);
123 void ddisplay_set_origo(DDisplay
*ddisp
,
125 void ddisplay_zoom(DDisplay
*ddisp
, Point
*point
,
127 void ddisplay_set_snap_to_grid(DDisplay
*ddisp
, gboolean snap
);
128 void ddisplay_set_snap_to_objects(DDisplay
*ddisp
, gboolean magnetic
);
129 void ddisplay_set_renderer(DDisplay
*ddisp
, int aa_renderer
);
130 void ddisplay_resize_canvas(DDisplay
*ddisp
,
134 void ddisplay_render_pixmap(DDisplay
*ddisp
, Rectangle
*update
);
136 DDisplay
*ddisplay_active(void);
137 Diagram
*ddisplay_active_diagram(void);
139 void ddisplay_close(DDisplay
*ddisp
);
141 void ddisplay_set_title(DDisplay
*ddisp
, char *title
);
142 void ddisplay_set_cursor(DDisplay
*ddisp
, GdkCursor
*cursor
);
143 void ddisplay_set_all_cursor(GdkCursor
*cursor
);
145 gboolean
ddisplay_scroll(DDisplay
*ddisp
, Point
*delta
);
146 gboolean
ddisplay_autoscroll(DDisplay
*ddisp
, int x
, int y
);
147 void ddisplay_scroll_up(DDisplay
*ddisp
);
148 void ddisplay_scroll_down(DDisplay
*ddisp
);
149 void ddisplay_scroll_left(DDisplay
*ddisp
);
150 void ddisplay_scroll_right(DDisplay
*ddisp
);
151 gboolean
ddisplay_scroll_center_point(DDisplay
*ddisp
, Point
*p
);
152 gboolean
ddisplay_scroll_to_object(DDisplay
*ddisp
, DiaObject
*obj
);
154 void display_update_menu_state(DDisplay
*ddisp
);
155 void ddisplay_update_statusbar(DDisplay
*ddisp
);
156 void ddisplay_do_update_menu_sensitivity (DDisplay
*ddisp
);
158 void display_set_active(DDisplay
*ddisp
);
160 void ddisplay_im_context_preedit_reset(DDisplay
*ddisp
, Focus
*focus
);
162 #endif /* DDISPLAY_H */