added gas bottle shape
[dia.git] / app / diagram.h
blob6bca4dbffa7c0d3fd08e226cd5c49e4c64cbadd2
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 DIAGRAM_H
19 #define DIAGRAM_H
21 #include <gtk/gtk.h>
23 typedef struct _Diagram Diagram;
25 #include "geometry.h"
26 #include "object.h"
27 #include "handle.h"
28 #include "connectionpoint.h"
29 #include "display.h"
30 #include "diagramdata.h"
31 #include "undo.h"
32 #include "filter.h"
34 struct _Diagram {
35 char *filename;
36 int unsaved; /* True if diagram is created but not saved.*/
37 int modified;
39 DiagramData *data;
41 guint display_count;
42 GSList *displays; /* List of all displays showing this diagram */
44 UndoStack *undo;
47 extern GList *open_diagrams; /* Read only! */
49 Diagram *diagram_load(const char *filename, DiaImportFilter *ifilter);
50 int diagram_load_into (Diagram *dest, const char *filename, DiaImportFilter *ifilter);
51 Diagram *new_diagram(const char *filename); /*Note: filename is copied*/
52 void diagram_destroy(Diagram *dia);
53 void diagram_modified(Diagram *dia);
54 void diagram_set_modified(Diagram *dia, int modified);
55 void diagram_add_ddisplay(Diagram *dia, DDisplay *ddisp);
56 void diagram_remove_ddisplay(Diagram *dia, DDisplay *ddisp);
57 void diagram_add_object(Diagram *dia, Object *obj);
58 void diagram_add_object_list(Diagram *dia, GList *list);
59 void diagram_selected_break_external(Diagram *dia);
60 void diagram_remove_all_selected(Diagram *diagram, int delete_empty);
61 void diagram_unselect_object(Diagram *diagram, Object *obj);
62 void diagram_unselect_objects(Diagram *dia, GList *obj_list);
63 void diagram_select(Diagram *diagram, Object *obj);
64 void diagram_select_list(Diagram *diagram, GList *list);
65 int diagram_is_selected(Diagram *diagram, Object *obj);
66 GList *diagram_get_sorted_selected(Diagram *dia);
67 /* Removes selected from objects list, NOT selected list: */
68 GList *diagram_get_sorted_selected_remove(Diagram *dia);
69 void diagram_add_update(Diagram *dia, Rectangle *update);
70 void diagram_add_update_all(Diagram *dia);
71 void diagram_add_update_all_all_and_flush();
72 void diagram_add_update_pixels(Diagram *dia, Point *point,
73 int pixel_width, int pixel_height);
74 void diagram_flush(Diagram *dia);
75 Object *diagram_find_clicked_object(Diagram *dia,
76 Point *pos,
77 real maxdist);
78 real diagram_find_closest_handle(Diagram *dia, Handle **handle,
79 Object **obj, Point *pos);
80 real diagram_find_closest_connectionpoint(Diagram *dia,
81 ConnectionPoint **cp,
82 Point *pos);
83 void diagram_update_extents(Diagram *dia);
85 void diagram_update_menu_sensitivity(Diagram *dia);
87 void diagram_place_under_selected(Diagram *dia);
88 void diagram_place_over_selected(Diagram *dia);
89 void diagram_group_selected(Diagram *dia);
90 void diagram_ungroup_selected(Diagram *dia);
92 void diagram_set_filename(Diagram *dia, char *filename);
94 void diagram_import_from_xfig(Diagram *dia, char *filename);
96 int diagram_modified_exists(void);
98 void diagram_redraw_all(void);
100 #endif /* DIAGRAM_H */