Code

SPDocument->Document
[inkscape.git] / src / application / editor.h
1 /** @file
2  * @brief  Singleton class to manage an application used for editing SVG
3  *         documents using GUI views
4  */
5 /*
6  * Authors:
7  *   Bryce W. Harrington <bryce@bryceharrington.org>
8  *   Ralf Stephan <ralf@ark.in-berlin.de>
9  *
10  * Copyright (C) 2004 Bryce Harrington
11  *
12  * Released under GNU GPL.  Read the file 'COPYING' for more information.
13  */
15 #ifndef INKSCAPE_APPLICATION_EDITOR_H
16 #define INKSCAPE_APPLICATION_EDITOR_H
18 #include <sigc++/sigc++.h>
19 #include <glib/gslist.h>
20 #include <glibmm/ustring.h>
21 #include <set>
22 #include "app-prototype.h"
24 class SPDesktop;
25 class Document;
26 class SPEventContext;
28 namespace Inkscape {
29     class Selection;
30     namespace XML {
31         class Document;
32     }
33     namespace UI {
34         namespace View {
35             class Edit;
36         }
37     }
38     namespace NSApplication {
40 class Editor : public AppPrototype
41 {
42 public:
43     static Editor *create (int argc, char **argv);
44     virtual ~Editor();
46     void*           getWindow();
48     void            toggleDialogs();
49     void            nextDesktop();
50     void            prevDesktop();
52     void            refreshDisplay();
53     void            exit();
55     bool        lastViewOfDocument(Document* doc, SPDesktop* view) const;
57     bool        addView(SPDesktop* view);
58     bool        deleteView(SPDesktop* view);
60     static Inkscape::XML::Document *getPreferences();
61     static SPDesktop* getActiveDesktop();
62     static bool isDesktopActive (SPDesktop* dt) { return getActiveDesktop()==dt; }
63     static SPDesktop* createDesktop (Document* doc);
64     static void addDesktop (SPDesktop* dt);
65     static void removeDesktop (SPDesktop* dt);
66     static void activateDesktop (SPDesktop* dt);
67     static void reactivateDesktop (SPDesktop* dt);
68     static bool isDuplicatedView (SPDesktop* dt);
70     static Document* getActiveDocument();
71     static void addDocument (Document* doc);
72     static void removeDocument (Document* doc);
74     static void selectionModified (Inkscape::Selection*, guint);
75     static void selectionChanged (Inkscape::Selection*);
76     static void subSelectionChanged (SPDesktop*);
77     static void selectionSet (Inkscape::Selection*);
78     static void eventContextSet (SPEventContext*);
79     static void hideDialogs();
80     static void unhideDialogs();
82     static sigc::connection connectSelectionModified (const sigc::slot<void, Inkscape::Selection*, guint> &slot);
83     static sigc::connection connectSelectionChanged (const sigc::slot<void, Inkscape::Selection*> &slot);
84     static sigc::connection connectSubselectionChanged (const sigc::slot<void, SPDesktop*> &slot);
85     static sigc::connection connectSelectionSet (const sigc::slot<void, Inkscape::Selection*> &slot);
86     static sigc::connection connectEventContextSet (const sigc::slot<void, SPEventContext*> &slot);
87     static sigc::connection connectDesktopActivated (const sigc::slot<void, SPDesktop*> &slot);
88     static sigc::connection connectDesktopDeactivated (const sigc::slot<void, SPDesktop*> &slot);
89     static sigc::connection connectShutdown (const sigc::slot<void> &slot);
90     static sigc::connection connectDialogsHidden (const sigc::slot<void> &slot);
91     static sigc::connection connectDialogsUnhidden (const sigc::slot<void> &slot);
92     static sigc::connection connectExternalChange (const sigc::slot<void> &slot);
95 protected:
96     Editor(Editor const &);
97     Editor& operator=(Editor const &);
99     std::multiset<Document *> _document_set;
100     GSList         *_documents;
101     GSList         *_desktops;
102     gchar          *_argv0;
104     bool       _dialogs_toggle;
106     sigc::signal <void, Inkscape::Selection*, guint> _selection_modified_signal;
107     sigc::signal <void, Inkscape::Selection*>        _selection_changed_signal;
108     sigc::signal <void, SPDesktop*>                  _subselection_changed_signal;
109     sigc::signal <void, Inkscape::Selection*>        _selection_set_signal;
110     sigc::signal <void, SPEventContext*>             _event_context_set_signal;
111     sigc::signal <void, SPDesktop*>                  _desktop_activated_signal;
112     sigc::signal <void, SPDesktop*>                  _desktop_deactivated_signal;
113     sigc::signal <void> _shutdown_signal;
114     sigc::signal <void> _dialogs_hidden_signal;
115     sigc::signal <void> _dialogs_unhidden_signal;
116     sigc::signal <void> _external_change_signal;
118 private:
119     Editor(int argc, char **argv);
120     bool init();
121 };
123 #define ACTIVE_DESKTOP Inkscape::NSApplication::Editor::getActiveDesktop()
125 } // namespace NSApplication
126 } // namespace Inkscape
129 #endif /* !INKSCAPE_APPLICATION_EDITOR_H */
131 /*
132   Local Variables:
133   mode:c++
134   c-file-style:"stroustrup"
135   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
136   indent-tabs-mode:nil
137   fill-column:99
138   End:
139 */
140 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :