~moduli16/inkscape/recolor

« back to all changes in this revision

Viewing changes to src/ui/dialog/symbols.h

  • Committer: tavmjong-free
  • Date: 2012-10-11 17:54:14 UTC
  • Revision ID: tavmjong@free.fr-20121011175414-j1i7huls4h70n91n
Add symbols dialog. See: http://wiki.inkscape.org/wiki/index.php/SymbolsDialog

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** @file
 
2
 * @brief Symbols dialog
 
3
 */
 
4
/* Authors:
 
5
 *   Tavmjong Bah
 
6
 *
 
7
 * Copyright (C) 2012 Tavmjong Bah
 
8
 *
 
9
 * Released under GNU GPL, read the file 'COPYING' for more information
 
10
 */
 
11
 
 
12
#ifndef INKSCAPE_UI_DIALOG_SYMBOLS_H
 
13
#define INKSCAPE_UI_DIALOG_SYMBOLS_H
 
14
 
 
15
#include "ui/widget/panel.h"
 
16
#include "ui/widget/button.h"
 
17
 
 
18
#include "ui/dialog/desktop-tracker.h"
 
19
 
 
20
#include "display/drawing.h"
 
21
 
 
22
#include <glib.h>
 
23
#include <gtkmm/treemodel.h>
 
24
 
 
25
#include <vector>
 
26
 
 
27
class SPObject;
 
28
 
 
29
namespace Inkscape {
 
30
namespace UI {
 
31
namespace Dialog {
 
32
 
 
33
class SymbolColumns; // For Gtk::ListStore
 
34
 
 
35
/**
 
36
 * A dialog that displays selectable symbols.
 
37
 */
 
38
class SymbolsDialog : public UI::Widget::Panel {
 
39
 
 
40
public:
 
41
    SymbolsDialog( gchar const* prefsPath = "/dialogs/symbols" );
 
42
    virtual ~SymbolsDialog();
 
43
 
 
44
    static SymbolsDialog& getInstance();
 
45
 
 
46
protected:
 
47
 
 
48
 
 
49
private:
 
50
    SymbolsDialog(SymbolsDialog const &); // no copy
 
51
    SymbolsDialog &operator=(SymbolsDialog const &); // no assign
 
52
 
 
53
    static SymbolColumns *getColumns();
 
54
 
 
55
    void rebuild();
 
56
    void iconChanged();
 
57
 
 
58
    void get_symbols();
 
59
    void draw_symbols( SPDocument* symbol_document );
 
60
    SPDocument* symbols_preview_doc();
 
61
 
 
62
    GSList* symbols_in_doc_recursive(SPObject *r, GSList *l);
 
63
    GSList* symbols_in_doc( SPDocument* document );
 
64
    GSList* use_in_doc_recursive(SPObject *r, GSList *l);
 
65
    GSList* use_in_doc( SPDocument* document );
 
66
    gchar const* style_from_use( gchar const* id, SPDocument* document);
 
67
 
 
68
    Glib::RefPtr<Gdk::Pixbuf>
 
69
    create_symbol_image(gchar const *symbol_name,
 
70
                        SPDocument *source,  Inkscape::Drawing* drawing,
 
71
                        unsigned /*visionkey*/);
 
72
 
 
73
    /* Keep track of all symbol template documents */
 
74
    std::map<Glib::ustring, SPDocument*> symbolSets;
 
75
 
 
76
 
 
77
    Glib::RefPtr<Gtk::ListStore> store;
 
78
    Gtk::ComboBoxText* symbolSet;
 
79
    Gtk::IconView* iconView;
 
80
    Gtk::ComboBoxText* previewScale;
 
81
    Gtk::ComboBoxText* previewSize;
 
82
 
 
83
    void setTargetDesktop(SPDesktop *desktop);
 
84
    SPDesktop*  currentDesktop;
 
85
    DesktopTracker deskTrack;
 
86
    SPDocument* currentDocument;
 
87
    SPDocument* previewDocument; /* Document to render single symbol */
 
88
 
 
89
    /* For rendering the template drawing */
 
90
    unsigned key;
 
91
    Inkscape::Drawing renderDrawing;
 
92
 
 
93
    std::vector<sigc::connection> instanceConns;
 
94
    sigc::connection desktopChangeConn;
 
95
 
 
96
};
 
97
 
 
98
} //namespace Dialogs
 
99
} //namespace UI
 
100
} //namespace Inkscape
 
101
 
 
102
 
 
103
#endif // INKSCAPE_UI_DIALOG_SYMBOLS_H
 
104
 
 
105
/*
 
106
  Local Variables:
 
107
  mode:c++
 
108
  c-file-style:"stroustrup"
 
109
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
110
  indent-tabs-mode:nil
 
111
  fill-column:99
 
112
  End:
 
113
*/
 
114
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :