~vaifrax/inkscape/bugfix170049

« back to all changes in this revision

Viewing changes to src/application/editor.h

  • Committer: mental
  • Date: 2006-01-16 02:36:01 UTC
  • Revision ID: mental@users.sourceforge.net-20060116023601-wkr0h7edl5veyudq
moving trunk for module inkscape

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** \file
 
2
 * \brief  Class to manage an application used for editing SVG documents
 
3
 *         using GUI views
 
4
 *
 
5
 * \note  This class is a Singleton
 
6
 *
 
7
 * Authors:
 
8
 *   Bryce W. Harrington <bryce@bryceharrington.org>
 
9
 *   Ralf Stephan <ralf@ark.in-berlin.de>
 
10
 *
 
11
 * Copyright (C) 2004 Bryce Harrington
 
12
 *
 
13
 * Released under GNU GPL.  Read the file 'COPYING' for more information.
 
14
 */
 
15
 
 
16
#ifndef INKSCAPE_APPLICATION_EDITOR_H
 
17
#define INKSCAPE_APPLICATION_EDITOR_H
 
18
 
 
19
#include <sigc++/sigc++.h>
 
20
#include <glib/gslist.h>
 
21
#include <glibmm/ustring.h>
 
22
#include "app-prototype.h"
 
23
 
 
24
class SPDesktop;
 
25
class SPDocument;
 
26
class SPEventContext;
 
27
 
 
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 {
 
39
 
 
40
class Editor : public AppPrototype
 
41
{
 
42
public:
 
43
    static Editor *create (int argc, char **argv); 
 
44
    virtual ~Editor();
 
45
 
 
46
    void*           getWindow();
 
47
 
 
48
    void            toggleDialogs();
 
49
    void            nextDesktop();
 
50
    void            prevDesktop();
 
51
 
 
52
    void            refreshDisplay();
 
53
    void            exit();
 
54
 
 
55
    bool        lastViewOfDocument(SPDocument* doc, SPDesktop* view) const;
 
56
    
 
57
    bool        addView(SPDesktop* view);
 
58
    bool        deleteView(SPDesktop* view);
 
59
 
 
60
    static Inkscape::XML::Document *getPreferences();
 
61
    static SPDesktop* getActiveDesktop();
 
62
    static bool isDesktopActive (SPDesktop* dt) { return getActiveDesktop()==dt; }
 
63
    static SPDesktop* createDesktop (SPDocument* 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);
 
69
    
 
70
    static SPDocument* getActiveDocument();
 
71
    static void addDocument (SPDocument* doc);
 
72
    static void removeDocument (SPDocument* doc);
 
73
 
 
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();
 
81
 
 
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);
 
93
 
 
94
   
 
95
protected:
 
96
    Editor(Editor const &);
 
97
    Editor& operator=(Editor const &);
 
98
 
 
99
    GSList         *_documents;
 
100
    GSList         *_desktops;
 
101
    gchar          *_argv0;
 
102
 
 
103
    bool       _dialogs_toggle;
 
104
 
 
105
    sigc::signal <void, Inkscape::Selection*, guint> _selection_modified_signal;
 
106
    sigc::signal <void, Inkscape::Selection*>        _selection_changed_signal;
 
107
    sigc::signal <void, SPDesktop*>                  _subselection_changed_signal;
 
108
    sigc::signal <void, Inkscape::Selection*>        _selection_set_signal;
 
109
    sigc::signal <void, SPEventContext*>             _event_context_set_signal;
 
110
    sigc::signal <void, SPDesktop*>                  _desktop_activated_signal;
 
111
    sigc::signal <void, SPDesktop*>                  _desktop_deactivated_signal;
 
112
    sigc::signal <void> _shutdown_signal;
 
113
    sigc::signal <void> _dialogs_hidden_signal;
 
114
    sigc::signal <void> _dialogs_unhidden_signal;
 
115
    sigc::signal <void> _external_change_signal;
 
116
 
 
117
private:
 
118
    Editor(int argc, char **argv); 
 
119
    bool init();
 
120
};
 
121
 
 
122
#define ACTIVE_DESKTOP Inkscape::NSApplication::Editor::getActiveDesktop()
 
123
 
 
124
} // namespace NSApplication
 
125
} // namespace Inkscape
 
126
 
 
127
 
 
128
#endif /* !INKSCAPE_APPLICATION_EDITOR_H */
 
129
 
 
130
/*
 
131
  Local Variables:
 
132
  mode:c++
 
133
  c-file-style:"stroustrup"
 
134
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
135
  indent-tabs-mode:nil
 
136
  fill-column:99
 
137
  End:
 
138
*/
 
139
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :