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/helper-observer.h"
31 namespace Inkscape {
32 namespace UI {
33 namespace Dialog {
35 class DocumentProperties : public UI::Widget::Panel {
36 public:
37 void update();
38 static DocumentProperties &getInstance();
39 static void destroy();
41 void update_gridspage();
43 protected:
44 void build_page();
45 void build_grid();
46 void build_guides();
47 void build_snap();
48 void build_gridspage();
49 #if ENABLE_LCMS
50 void build_cms();
51 #endif // ENABLE_LCMS
52 void build_scripting();
53 void init();
55 virtual void on_response (int);
56 #if ENABLE_LCMS
57 void populate_available_profiles();
58 void populate_linked_profiles_box();
59 void linkSelectedProfile();
60 void removeSelectedProfile();
61 void linked_profiles_list_button_release(GdkEventButton* event);
62 void cms_create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem);
63 #endif // ENABLE_LCMS
65 void external_scripts_list_button_release(GdkEventButton* event);
66 void populate_external_scripts_box();
67 void addExternalScript();
68 void removeExternalScript();
69 void scripting_create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem);
71 void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document);
72 void _handleActivateDesktop(Inkscape::Application *application, SPDesktop *desktop);
73 void _handleDeactivateDesktop(Inkscape::Application *application, SPDesktop *desktop);
75 Inkscape::XML::SignalObserver _emb_profiles_observer, _ext_scripts_observer;
76 Gtk::Tooltips _tt;
77 Gtk::Notebook _notebook;
79 UI::Widget::NotebookPage _page_page;
80 UI::Widget::NotebookPage _page_guides;
81 UI::Widget::NotebookPage _page_snap;
82 UI::Widget::NotebookPage _page_cms;
83 UI::Widget::NotebookPage _page_scripting;
84 Gtk::VBox _grids_vbox;
86 UI::Widget::Registry _wr;
87 //---------------------------------------------------------------
88 UI::Widget::RegisteredCheckButton _rcb_canb;
89 UI::Widget::RegisteredCheckButton _rcb_bord;
90 UI::Widget::RegisteredCheckButton _rcb_shad;
91 UI::Widget::RegisteredColorPicker _rcp_bg;
92 UI::Widget::RegisteredColorPicker _rcp_bord;
93 UI::Widget::RegisteredUnitMenu _rum_deflt;
94 UI::Widget::PageSizer _page_sizer;
95 //---------------------------------------------------------------
96 UI::Widget::RegisteredCheckButton _rcb_sgui;
97 UI::Widget::RegisteredCheckButton _rcbsng;
98 UI::Widget::RegisteredColorPicker _rcp_gui;
99 UI::Widget::RegisteredColorPicker _rcp_hgui;
100 //---------------------------------------------------------------
101 UI::Widget::ToleranceSlider _rsu_sno;
102 UI::Widget::ToleranceSlider _rsu_sn;
103 UI::Widget::ToleranceSlider _rsu_gusn;
104 //---------------------------------------------------------------
105 Gtk::Menu _menu;
106 Gtk::OptionMenu _combo_avail;
107 Gtk::Button _link_btn;
108 class LinkedProfilesColumns : public Gtk::TreeModel::ColumnRecord
109 {
110 public:
111 LinkedProfilesColumns()
112 { add(nameColumn); add(previewColumn); }
113 Gtk::TreeModelColumn<Glib::ustring> nameColumn;
114 Gtk::TreeModelColumn<Glib::ustring> previewColumn;
115 };
116 LinkedProfilesColumns _LinkedProfilesListColumns;
117 Glib::RefPtr<Gtk::ListStore> _LinkedProfilesListStore;
118 Gtk::TreeView _LinkedProfilesList;
119 Gtk::ScrolledWindow _LinkedProfilesListScroller;
120 Gtk::Menu _EmbProfContextMenu;
122 //---------------------------------------------------------------
123 Gtk::Button _add_btn;
124 class ExternalScriptsColumns : public Gtk::TreeModel::ColumnRecord
125 {
126 public:
127 ExternalScriptsColumns()
128 { add(filenameColumn); }
129 Gtk::TreeModelColumn<Glib::ustring> filenameColumn;
130 };
131 ExternalScriptsColumns _ExternalScriptsListColumns;
132 Glib::RefPtr<Gtk::ListStore> _ExternalScriptsListStore;
133 Gtk::TreeView _ExternalScriptsList;
134 Gtk::ScrolledWindow _ExternalScriptsListScroller;
135 Gtk::Menu _ExternalScriptsContextMenu;
136 Gtk::Entry _script_entry;
137 //---------------------------------------------------------------
139 Gtk::Notebook _grids_notebook;
140 Gtk::HBox _grids_hbox_crea;
141 Gtk::Label _grids_label_crea;
142 Gtk::Button _grids_button_new;
143 Gtk::Button _grids_button_remove;
144 Gtk::ComboBoxText _grids_combo_gridtype;
145 Gtk::Label _grids_label_def;
146 Gtk::HBox _grids_space;
147 //---------------------------------------------------------------
149 Gtk::HBox& _createPageTabLabel(const Glib::ustring& label, const char *label_image);
151 private:
152 DocumentProperties();
153 virtual ~DocumentProperties();
155 // callback methods for buttons on grids page.
156 void onNewGrid();
157 void onRemoveGrid();
158 };
160 } // namespace Dialog
161 } // namespace UI
162 } // namespace Inkscape
164 #endif // INKSCAPE_UI_DIALOG_DOCUMENT_PREFERENCES_H
166 /*
167 Local Variables:
168 mode:c++
169 c-file-style:"stroustrup"
170 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
171 indent-tabs-mode:nil
172 fill-column:99
173 End:
174 */
175 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :