1 /* Dia -- an diagram creation/manipulation program -*- c -*-
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.
23 typedef struct _Diagram Diagram
;
27 #include "connectionpoint.h"
29 #include "diagramdata.h"
35 GType
diagram_get_type (void) G_GNUC_CONST
;
37 #define DIA_TYPE_DIAGRAM (diagram_get_type ())
38 #define DIA_DIAGRAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DIA_TYPE_DIAGRAM, Diagram))
39 #define DIA_DIAGRAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DIA_TYPE_DIAGRAM, DiagramClass))
40 #define DIA_IS_DIAGRAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DIA_TYPE_DIAGRAM))
41 #define DIA_DIAGRAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DIA_TYPE_DIAGRAM, DiagramClass))
44 DiagramData parent_instance
;
47 int unsaved
; /* True if diagram is created but not saved.*/
49 gboolean autosaved
; /* True if the diagram is autosaved since last mod */
50 char *autosavefilename
; /* Holds the name of the current autosave file
51 * for this diagram, or NULL. */
53 Color pagebreak_color
; /*!< just to show page breaks */
54 DiaGrid grid
; /*!< the display grid */
56 /*! almost completely unused guides (load and save code is there) */
58 /* sorted arrays of the guides for the diagram */
59 real
*hguides
, *vguides
;
60 guint nhguides
, nvguides
;
63 DiagramData
*data
; /*! just for compatibility, now that the Diagram _is_ and not _has_ DiagramData */
66 GSList
*displays
; /* List of all displays showing this diagram */
71 typedef struct _DiagramClass
{
72 GObjectClass parent_class
;
75 void (* removed
) (Diagram
*);
76 void (* selection_changed
) (Diagram
*, int);
80 GList
*dia_open_diagrams(void); /* Read only! */
82 Diagram
*diagram_load(const char *filename
, DiaImportFilter
*ifilter
);
83 int diagram_load_into (Diagram
*dest
, const char *filename
, DiaImportFilter
*ifilter
);
84 Diagram
*new_diagram(const char *filename
); /*Note: filename is copied*/
85 /** Perform updates related to getting a new current diagram */
86 void diagram_set_current(Diagram
*diagram
);
87 void diagram_destroy(Diagram
*dia
);
88 gboolean
diagram_is_modified(Diagram
*dia
);
89 void diagram_modified(Diagram
*dia
);
90 void diagram_set_modified(Diagram
*dia
, int modified
);
91 void diagram_add_ddisplay(Diagram
*dia
, DDisplay
*ddisp
);
92 void diagram_remove_ddisplay(Diagram
*dia
, DDisplay
*ddisp
);
93 void diagram_add_object(Diagram
*dia
, DiaObject
*obj
);
94 void diagram_add_object_list(Diagram
*dia
, GList
*list
);
95 void diagram_selected_break_external(Diagram
*dia
);
96 void diagram_remove_all_selected(Diagram
*diagram
, int delete_empty
);
97 void diagram_unselect_object(Diagram
*diagram
, DiaObject
*obj
);
98 void diagram_unselect_objects(Diagram
*dia
, GList
*obj_list
);
99 void diagram_select(Diagram
*diagram
, DiaObject
*obj
);
100 void diagram_select_list(Diagram
*diagram
, GList
*list
);
101 int diagram_is_selected(Diagram
*diagram
, DiaObject
*obj
);
102 GList
*diagram_get_sorted_selected(Diagram
*dia
);
103 /* Removes selected from objects list, NOT selected list: */
104 GList
*diagram_get_sorted_selected_remove(Diagram
*dia
);
105 void diagram_add_update(Diagram
*dia
, Rectangle
*update
);
106 void diagram_add_update_with_border(Diagram
*dia
, Rectangle
*update
,
108 void diagram_add_update_all(Diagram
*dia
);
109 void diagram_add_update_all_all_and_flush();
110 void diagram_add_update_pixels(Diagram
*dia
, Point
*point
,
111 int pixel_width
, int pixel_height
);
112 void diagram_flush(Diagram
*dia
);
113 DiaObject
*diagram_find_clicked_object(Diagram
*dia
,
116 DiaObject
*diagram_find_clicked_object_except(Diagram
*dia
,
120 real
diagram_find_closest_handle(Diagram
*dia
, Handle
**handle
,
121 DiaObject
**obj
, Point
*pos
);
122 real
diagram_find_closest_connectionpoint(Diagram
*dia
,
123 ConnectionPoint
**cp
,
126 void diagram_update_extents(Diagram
*dia
);
128 void diagram_update_menu_sensitivity (Diagram
*dia
, UpdatableMenuItems
*items
);
129 void diagram_update_menubar_sensitivity(Diagram
*dia
, UpdatableMenuItems
*items
);
130 void diagram_update_popupmenu_sensitivity(Diagram
*dia
);
132 void diagram_place_under_selected(Diagram
*dia
);
133 void diagram_place_over_selected(Diagram
*dia
);
134 void diagram_place_down_selected(Diagram
*dia
);
135 void diagram_place_up_selected(Diagram
*dia
);
136 void diagram_group_selected(Diagram
*dia
);
137 void diagram_ungroup_selected(Diagram
*dia
);
138 void diagram_parent_selected(Diagram
*dia
);
139 void diagram_unparent_selected(Diagram
*dia
);
140 void diagram_unparent_children_selected(Diagram
*dia
);
142 void diagram_set_filename(Diagram
*dia
, const char *filename
);
143 gchar
*diagram_get_name(Diagram
*dia
);
145 int diagram_modified_exists(void);
147 void diagram_redraw_all(void);
149 void diagram_object_modified(Diagram
*dia
, DiaObject
*object
);
151 #endif /* DIAGRAM_H */