1 /** \file
2 * \brief Document Properties dialog
3 */
4 /* Authors:
5 * Ralf Stephan <ralf@ark.in-berlin.de>
6 * Bryce W. Harrington <bryce@bryceharrington.org>
7 *
8 * Copyright (C) 2006-2008 Johan Engelen <johan@shouraizou.nl>
9 * Copyright (C) 2004, 2005 Authors
10 *
11 * Released under GNU GPL. Read the file 'COPYING' for more information.
12 */
14 #ifndef INKSCAPE_UI_DIALOG_DOCUMENT_PREFERENCES_H
15 #define INKSCAPE_UI_DIALOG_DOCUMENT_PREFERENCES_H
17 #include <list>
18 #include <sigc++/sigc++.h>
19 #include <gtkmm/notebook.h>
20 #include <glibmm/i18n.h>
22 #include "ui/widget/notebook-page.h"
23 #include "ui/widget/page-sizer.h"
24 #include "ui/widget/registered-widget.h"
25 #include "ui/widget/registry.h"
26 #include "ui/widget/tolerance-slider.h"
27 #include "ui/widget/panel.h"
29 #include "xml/node-observer.h"
31 using namespace Inkscape::UI::Widget;
33 namespace Inkscape {
34 namespace XML {
35 class Node;
36 }
37 namespace UI {
38 namespace Dialog {
40 class DocumentProperties : public UI::Widget::Panel {
41 public:
42 void update();
43 static DocumentProperties &getInstance();
44 static void destroy();
46 void update_gridspage();
48 protected:
49 void build_page();
50 void build_grid();
51 void build_guides();
52 void build_snap();
53 void build_snap_dtls();
54 void build_gridspage();
55 #if ENABLE_LCMS
56 void build_cms();
57 #endif // ENABLE_LCMS
58 void init();
60 void populate_available_profiles();
61 void populate_embedded_profiles_box();
62 virtual void on_response (int);
63 void onEmbedProfile();
64 void remove_profile();
65 void embedded_profiles_list_button_release(GdkEventButton* event);
66 void create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem);
68 void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document);
69 void _handleActivateDesktop(Inkscape::Application *application, SPDesktop *desktop);
70 void _handleDeactivateDesktop(Inkscape::Application *application, SPDesktop *desktop);
72 // Very simple observer that just emits a signal if anything happens to a node
73 class SignalObserver : public XML::NodeObserver
74 {
75 public:
76 SignalObserver();
78 // Add this observer to the SPObject and remove it from any previous object
79 void set(SPObject* o);
80 void notifyChildAdded(XML::Node&, XML::Node&, XML::Node*);
81 void notifyChildRemoved(XML::Node&, XML::Node&, XML::Node*);
82 void notifyChildOrderChanged(XML::Node&, XML::Node&, XML::Node*, XML::Node*);
83 void notifyContentChanged(XML::Node&, Util::ptr_shared<char>, Util::ptr_shared<char>);
84 void notifyAttributeChanged(XML::Node&, GQuark, Util::ptr_shared<char>, Util::ptr_shared<char>);
85 sigc::signal<void>& signal_changed();
86 private:
87 sigc::signal<void> _signal_changed;
88 SPObject* _oldsel;
89 };
91 SignalObserver _emb_profiles_observer;
92 Gtk::Tooltips _tt;
93 Gtk::Notebook _notebook;
95 NotebookPage _page_page, _page_guides;
96 NotebookPage _page_snap, _page_snap_dtls, _page_cms;
97 Gtk::VBox _grids_vbox;
99 Registry _wr;
100 //---------------------------------------------------------------
101 RegisteredCheckButton _rcb_canb, _rcb_bord, _rcb_shad;
102 RegisteredColorPicker _rcp_bg, _rcp_bord;
103 RegisteredUnitMenu _rum_deflt;
104 PageSizer _page_sizer;
105 //---------------------------------------------------------------
106 RegisteredCheckButton _rcb_sgui, _rcbsng;
107 RegisteredColorPicker _rcp_gui, _rcp_hgui;
108 //---------------------------------------------------------------
109 RegisteredCheckButton _rcbs, _rcbsnbb, _rcbsnn, _rcbsnop;
110 RegisteredCheckButton _rcbsnon, _rcbsnbbp, _rcbsnbbn, _rcbsnpb;
111 ToleranceSlider _rsu_sno, _rsu_sn, _rsu_gusn;
112 //---------------------------------------------------------------
113 RegisteredCheckButton _rcbic, _rcbsm;
114 RegisteredCheckButton _rcbsigg, _rcbsils;
115 //---------------------------------------------------------------
116 Gtk::Menu _menu;
117 Gtk::OptionMenu _combo_avail;
118 Gtk::Button _embed_btn;
119 class EmbeddedProfilesColumns : public Gtk::TreeModel::ColumnRecord
120 {
121 public:
122 EmbeddedProfilesColumns()
123 { add(nameColumn); add(previewColumn); }
124 Gtk::TreeModelColumn<Glib::ustring> nameColumn;
125 Gtk::TreeModelColumn<Glib::ustring> previewColumn;
126 };
127 EmbeddedProfilesColumns _EmbeddedProfilesListColumns;
128 Glib::RefPtr<Gtk::ListStore> _EmbeddedProfilesListStore;
129 Gtk::TreeView _EmbeddedProfilesList;
130 Gtk::ScrolledWindow _EmbeddedProfilesListScroller;
131 Gtk::Menu _EmbProfContextMenu;
132 //---------------------------------------------------------------
133 Gtk::Notebook _grids_notebook;
134 Gtk::HBox _grids_hbox_crea;
135 Gtk::Label _grids_label_crea;
136 Gtk::Button _grids_button_new;
137 Gtk::Button _grids_button_remove;
138 Gtk::ComboBoxText _grids_combo_gridtype;
139 Gtk::Label _grids_label_def;
140 Gtk::HBox _grids_space;
141 //---------------------------------------------------------------
143 Gtk::HBox& _createPageTabLabel(const Glib::ustring& label, const char *label_image);
145 private:
146 DocumentProperties();
147 virtual ~DocumentProperties();
149 // callback methods for buttons on grids page.
150 void onNewGrid();
151 void onRemoveGrid();
152 };
154 } // namespace Dialog
155 } // namespace UI
156 } // namespace Inkscape
158 #endif // INKSCAPE_UI_DIALOG_DOCUMENT_PREFERENCES_H
160 /*
161 Local Variables:
162 mode:c++
163 c-file-style:"stroustrup"
164 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
165 indent-tabs-mode:nil
166 fill-column:99
167 End:
168 */
169 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :