Code

Implement keyboard shortcuts for single handle adjustments.
[inkscape.git] / src / ui / dialog / fill-and-stroke.cpp
1 /** @file
2  * @brief Fill and Stroke dialog - implementation
3  *
4  * Based on the old sp_object_properties_dialog.
5  */
6 /* Authors:
7  *   Bryce W. Harrington <bryce@bryceharrington.org>
8  *   Gustav Broberg <broberg@kth.se>
9  *
10  * Copyright (C) 2004--2007 Authors
11  *
12  * Released under GNU GPL.  Read the file 'COPYING' for more information.
13  */
15 #include "desktop-handles.h"
16 #include "desktop-style.h"
17 #include "document.h"
18 #include "fill-and-stroke.h"
19 #include "filter-chemistry.h"
20 #include "inkscape.h"
21 #include "selection.h"
22 #include "style.h"
23 #include "svg/css-ostringstream.h"
24 #include "ui/icon-names.h"
25 #include "verbs.h"
26 #include "widgets/fill-style.h"
27 #include "widgets/icon.h"
28 #include "widgets/paint-selector.h"
29 #include "widgets/stroke-style.h"
30 #include "xml/repr.h"
32 namespace Inkscape {
33 namespace UI {
34 namespace Dialog {
36 FillAndStroke::FillAndStroke()
37     : UI::Widget::Panel ("", "/dialogs/fillstroke", SP_VERB_DIALOG_FILL_STROKE),
38       _page_fill(1, 1, true, true),
39       _page_stroke_paint(1, 1, true, true),
40       _page_stroke_style(1, 1, true, true),
41       _composite_settings(SP_VERB_DIALOG_FILL_STROKE, "fillstroke", SimpleFilterModifier::BLUR)
42 {
43     Gtk::Box *contents = _getContents();
44     contents->set_spacing(0);
46     contents->pack_start(_notebook, true, true);
48     _notebook.append_page(_page_fill, _createPageTabLabel(_("Fill"), INKSCAPE_ICON_OBJECT_FILL));
49     _notebook.append_page(_page_stroke_paint, _createPageTabLabel(_("Stroke _paint"), INKSCAPE_ICON_OBJECT_STROKE));
50     _notebook.append_page(_page_stroke_style, _createPageTabLabel(_("Stroke st_yle"), INKSCAPE_ICON_OBJECT_STROKE_STYLE));
52     _layoutPageFill();
53     _layoutPageStrokePaint();
54     _layoutPageStrokeStyle();
56     contents->pack_start(_composite_settings, false, false, 0);
58     show_all_children();
60     _composite_settings.setSubject(&_subject);
61 }
63 FillAndStroke::~FillAndStroke()
64 {
65     _composite_settings.setSubject(NULL);
66 }
68 void
69 FillAndStroke::_layoutPageFill()
70 {
71     Gtk::Widget *fs = manage(Glib::wrap(sp_fill_style_widget_new()));
72     _page_fill.table().attach(*fs, 0, 1, 0, 1);
73 }
75 void
76 FillAndStroke::_layoutPageStrokePaint()
77 {
78     Gtk::Widget *ssp = manage(Glib::wrap(sp_stroke_style_paint_widget_new()));
79     _page_stroke_paint.table().attach(*ssp, 0, 1, 0, 1);
80 }
82 void
83 FillAndStroke::_layoutPageStrokeStyle()
84 {
85     //Gtk::Widget *ssl = manage(Glib::wrap(sp_stroke_style_line_widget_new()));
86     //Gtk::Widget *ssl = static_cast<Gtk::Widget *>(sp_stroke_style_line_widget_new());
87     Gtk::Widget *ssl = sp_stroke_style_line_widget_new();
88     _page_stroke_style.table().attach(*ssl, 0, 1, 0, 1);
89 }
91 void
92 FillAndStroke::showPageFill()
93 {
94     present();
95     _notebook.set_current_page(0);
96 }
98 void
99 FillAndStroke::showPageStrokePaint()
101     present();
102     _notebook.set_current_page(1);
105 void
106 FillAndStroke::showPageStrokeStyle()
108     present();
109     _notebook.set_current_page(2);
112 Gtk::HBox&
113 FillAndStroke::_createPageTabLabel(const Glib::ustring& label, const char *label_image)
115     Gtk::HBox *_tab_label_box = manage(new Gtk::HBox(false, 0));
116     _tab_label_box->pack_start(*Glib::wrap(sp_icon_new(Inkscape::ICON_SIZE_DECORATION,
117                                                        label_image)));
119     Gtk::Label *_tab_label = manage(new Gtk::Label(label, true));
120     _tab_label_box->pack_start(*_tab_label);
121     _tab_label_box->show_all();
123     return *_tab_label_box;
126 } // namespace Dialog
127 } // namespace UI
128 } // namespace Inkscape
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 :