re-adding .pngs as binary
[dia.git] / app / display.h
blob45a2b9db94852a77f8d6f143808b30b7f445b61e
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>
23 typedef struct _DDisplay DDisplay;
25 #include "geometry.h"
26 #include "diagram.h"
27 #include "grid.h"
28 #include "render_gdk.h"
29 #include "render_libart.h"
30 #include "menus.h"
32 #define DDISPLAY_MAX_ZOOM 500.0
33 #define DDISPLAY_NORMAL_ZOOM 20.0
34 #define DDISPLAY_MIN_ZOOM 1.0
36 struct _DDisplay {
37 Diagram *diagram; /* pointer to the associated diagram */
39 GtkWidget *shell; /* shell widget for this ddisplay */
40 GtkWidget *canvas; /* canvas widget for this ddisplay */
41 GtkWidget *hsb, *vsb; /* widgets for scroll bars */
42 GtkWidget *hrule, *vrule; /* widgets for rulers */
43 GtkWidget *origin; /* widgets for rulers */
44 GtkWidget *menu_bar; /* widget for the menu bar */
45 GtkItemFactory *mbar_item_factory; /* item factory used to create the menu bar */
47 /* menu bar widgets */
48 GtkWidget *rulers;
49 GtkWidget *visible_grid;
50 GtkWidget *snap_to_grid;
51 GtkWidget *show_cx_pts_mitem;
52 #ifdef HAVE_LIBART
53 GtkWidget *antialiased;
54 #endif
55 UpdatableMenuItems updatable_menu_items;
58 GtkWidget *snap_status;
59 GtkWidget *zoom_status;
60 GtkWidget *modified_status;
62 GtkAccelGroup *accel_group;
64 GtkAdjustment *hsbdata; /* horizontal data information */
65 GtkAdjustment *vsbdata; /* vertical data information */
67 Point origo; /* The origo (lower left) position */
68 real zoom_factor; /* zoom, 20.0 means 20 pixel == 1 cm */
69 Rectangle visible; /* The part visible in this display */
71 Grid grid; /* the grid in this display */
73 gboolean show_cx_pts; /* Connection points toggle boolean */
74 gboolean autoscroll;
76 int aa_renderer;
77 Renderer *renderer;
79 GSList *update_areas; /* Update areas list */
80 GSList *display_areas; /* Display areas list */
81 guint update_id; /* idle handler ID for redraws */
83 /* input contexts */
84 GdkIC *ic;
85 GdkICAttr *ic_attr;
88 extern GdkCursor *default_cursor;
90 DDisplay *new_display(Diagram *dia);
91 /* Normal destroy is done through shell widget destroy event. */
92 void ddisplay_really_destroy(DDisplay *ddisp);
93 void ddisplay_transform_coords_double(DDisplay *ddisp,
94 coord x, coord y,
95 double *xi, double *yi);
96 void ddisplay_transform_coords(DDisplay *ddisp,
97 coord x, coord y,
98 int *xi, int *yi);
99 void ddisplay_untransform_coords(DDisplay *ddisp,
100 int xi, int yi,
101 coord *x, coord *y);
102 real ddisplay_transform_length(DDisplay *ddisp, real len);
103 real ddisplay_untransform_length(DDisplay *ddisp, real len);
104 void ddisplay_add_update_pixels(DDisplay *ddisp, Point *point,
105 int pixel_width, int pixel_height);
106 void ddisplay_add_update_all(DDisplay *ddisp);
107 void ddisplay_add_update(DDisplay *ddisp, Rectangle *rect);
108 void ddisplay_add_display_area(DDisplay *ddisp,
109 int left, int top,
110 int right, int bottom);
111 void ddisplay_flush(DDisplay *ddisp);
112 void ddisplay_update_scrollbars(DDisplay *ddisp);
113 void ddisplay_set_origo(DDisplay *ddisp,
114 coord x, coord y);
115 void ddisplay_zoom(DDisplay *ddisp, Point *point,
116 real zoom_factor);
118 void ddisplay_set_renderer(DDisplay *ddisp, int aa_renderer);
119 void ddisplay_resize_canvas(DDisplay *ddisp,
120 int width,
121 int height);
123 void ddisplay_render_pixmap(DDisplay *ddisp, Rectangle *update);
125 DDisplay *ddisplay_active(void);
126 Diagram *ddisplay_active_diagram(void);
128 void ddisplay_close(DDisplay *ddisp);
130 void ddisplay_set_title(DDisplay *ddisp, char *title);
131 void ddisplay_set_cursor(DDisplay *ddisp, GdkCursor *cursor);
132 void ddisplay_set_all_cursor(GdkCursor *cursor);
134 gboolean ddisplay_scroll(DDisplay *ddisp, Point *delta);
135 gboolean ddisplay_autoscroll(DDisplay *ddisp, int x, int y);
136 void ddisplay_scroll_up(DDisplay *ddisp);
137 void ddisplay_scroll_down(DDisplay *ddisp);
138 void ddisplay_scroll_left(DDisplay *ddisp);
139 void ddisplay_scroll_right(DDisplay *ddisp);
141 void display_update_menu_state(DDisplay *ddisp);
142 void ddisplay_update_statusbar(DDisplay *ddisp);
143 void ddisplay_do_update_menu_sensitivity (DDisplay *ddisp);
144 /* Have to be called from interface.c */
145 GtkPixmap *snap_status_load_images(GdkWindow *window);
147 void display_set_active(DDisplay *ddisp);
149 #endif /* DDISPLAY_H */