Code

5dd69385cae41c13d5141759250d229594824461
[inkscape.git] / src / ui / dialog / document-properties.h
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();
47     
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     virtual void  on_response (int);
61 #if ENABLE_LCMS
62     void  populate_available_profiles();
63     void  populate_embedded_profiles_box();
64     void  onEmbedProfile();
65     void  remove_profile();
66     void  embedded_profiles_list_button_release(GdkEventButton* event);
67     void  create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem);
68 #endif // ENABLE_LCMS
70     void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document);
71     void _handleActivateDesktop(Inkscape::Application *application, SPDesktop *desktop);
72     void _handleDeactivateDesktop(Inkscape::Application *application, SPDesktop *desktop);
74     // Very simple observer that just emits a signal if anything happens to a node
75     class SignalObserver : public XML::NodeObserver
76     {
77     public:
78         SignalObserver();
80         // Add this observer to the SPObject and remove it from any previous object
81         void set(SPObject* o);
82         void notifyChildAdded(XML::Node&, XML::Node&, XML::Node*);
83         void notifyChildRemoved(XML::Node&, XML::Node&, XML::Node*);
84         void notifyChildOrderChanged(XML::Node&, XML::Node&, XML::Node*, XML::Node*);
85         void notifyContentChanged(XML::Node&, Util::ptr_shared<char>, Util::ptr_shared<char>);
86         void notifyAttributeChanged(XML::Node&, GQuark, Util::ptr_shared<char>, Util::ptr_shared<char>);
87         sigc::signal<void>& signal_changed();
88     private:
89         sigc::signal<void> _signal_changed;
90         SPObject* _oldsel;
91     };
93     SignalObserver _emb_profiles_observer;
94     Gtk::Tooltips _tt;
95     Gtk::Notebook  _notebook;
97     NotebookPage   _page_page, _page_guides;
98     NotebookPage   _page_snap, _page_snap_dtls, _page_cms;
99     Gtk::VBox      _grids_vbox;
101     Registry _wr;
102     //---------------------------------------------------------------
103     RegisteredCheckButton _rcb_canb, _rcb_bord, _rcb_shad;
104     RegisteredColorPicker _rcp_bg, _rcp_bord;
105     RegisteredUnitMenu    _rum_deflt;
106     PageSizer             _page_sizer;
107     //---------------------------------------------------------------
108     RegisteredCheckButton _rcb_sgui, _rcbsng;
109     RegisteredColorPicker _rcp_gui, _rcp_hgui;
110     //---------------------------------------------------------------
111     RegisteredCheckButton _rcbs, _rcbsnbb, _rcbsnn, _rcbsnop;
112     RegisteredCheckButton _rcbsnon, _rcbsnbbp, _rcbsnbbn, _rcbsnpb;
113     ToleranceSlider       _rsu_sno, _rsu_sn, _rsu_gusn;
114     //---------------------------------------------------------------
115     RegisteredCheckButton _rcbic, _rcbsm;
116     RegisteredCheckButton _rcbsigg, _rcbsils;
117     //---------------------------------------------------------------
118     Gtk::Menu   _menu;
119     Gtk::OptionMenu   _combo_avail;
120     Gtk::Button         _embed_btn;
121     class EmbeddedProfilesColumns : public Gtk::TreeModel::ColumnRecord
122         {
123         public:
124             EmbeddedProfilesColumns()
125                { add(nameColumn); add(previewColumn);  }
126             Gtk::TreeModelColumn<Glib::ustring> nameColumn;
127             Gtk::TreeModelColumn<Glib::ustring> previewColumn;
128         };
129     EmbeddedProfilesColumns _EmbeddedProfilesListColumns;
130     Glib::RefPtr<Gtk::ListStore> _EmbeddedProfilesListStore;
131     Gtk::TreeView _EmbeddedProfilesList;
132     Gtk::ScrolledWindow _EmbeddedProfilesListScroller;
133     Gtk::Menu _EmbProfContextMenu;
134     //---------------------------------------------------------------
135     Gtk::Notebook   _grids_notebook;
136     Gtk::HBox       _grids_hbox_crea;
137     Gtk::Label      _grids_label_crea;
138     Gtk::Button     _grids_button_new;
139     Gtk::Button     _grids_button_remove;
140     Gtk::ComboBoxText _grids_combo_gridtype;
141     Gtk::Label      _grids_label_def;
142     Gtk::HBox       _grids_space;
143     //---------------------------------------------------------------
145     Gtk::HBox& _createPageTabLabel(const Glib::ustring& label, const char *label_image);
147 private:
148     DocumentProperties();
149     virtual ~DocumentProperties();
151     // callback methods for buttons on grids page.
152     void onNewGrid();
153     void onRemoveGrid();    
154 };
156 } // namespace Dialog
157 } // namespace UI
158 } // namespace Inkscape
160 #endif // INKSCAPE_UI_DIALOG_DOCUMENT_PREFERENCES_H
162 /*
163   Local Variables:
164   mode:c++
165   c-file-style:"stroustrup"
166   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
167   indent-tabs-mode:nil
168   fill-column:99
169   End:
170 */
171 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :