1 /**
2 * \brief Fill and Stroke dialog,
3 * based on sp_object_properties_dialog
4 *
5 * Authors:
6 * Bryce W. Harrington <bryce@bryceharrington.org>
7 * Gustav Broberg <broberg@kth.se>
8 *
9 * Copyright (C) 2004--2007 Authors
10 *
11 * Released under GNU GPL. Read the file 'COPYING' for more information.
12 */
14 #ifdef HAVE_CONFIG_H
15 # include <config.h>
16 #endif
18 #include "desktop-handles.h"
19 #include "desktop-style.h"
20 #include "document.h"
21 #include "fill-and-stroke.h"
22 #include "filter-chemistry.h"
23 #include "inkscape.h"
24 #include "inkscape-stock.h"
25 #include "selection.h"
26 #include "style.h"
27 #include "svg/css-ostringstream.h"
28 #include "verbs.h"
29 #include "xml/repr.h"
30 #include "widgets/icon.h"
32 #include "dialogs/fill-style.h"
33 #include "dialogs/stroke-style.h"
35 #include <widgets/paint-selector.h>
37 namespace Inkscape {
38 namespace UI {
39 namespace Dialog {
41 FillAndStroke::FillAndStroke()
42 : UI::Widget::Panel ("", "dialogs.fillstroke", SP_VERB_DIALOG_FILL_STROKE),
43 _page_fill(1, 1, true, true),
44 _page_stroke_paint(1, 1, true, true),
45 _page_stroke_style(1, 1, true, true),
46 _composite_settings(SP_VERB_DIALOG_FILL_STROKE, "fillstroke", SimpleFilterModifier::BLUR)
47 {
48 Gtk::Box *contents = _getContents();
49 contents->set_spacing(0);
51 contents->pack_start(_notebook, true, true);
53 _notebook.append_page(_page_fill, _createPageTabLabel(_("Fill"), INKSCAPE_STOCK_PROPERTIES_FILL_PAGE));
54 _notebook.append_page(_page_stroke_paint, _createPageTabLabel(_("Stroke _paint"), INKSCAPE_STOCK_PROPERTIES_STROKE_PAINT_PAGE));
55 _notebook.append_page(_page_stroke_style, _createPageTabLabel(_("Stroke st_yle"), INKSCAPE_STOCK_PROPERTIES_STROKE_PAGE));
57 _layoutPageFill();
58 _layoutPageStrokePaint();
59 _layoutPageStrokeStyle();
61 contents->pack_start(_composite_settings, false, false, 0);
63 show_all_children();
65 _composite_settings.setSubject(&_subject);
66 }
68 FillAndStroke::~FillAndStroke()
69 {
70 _composite_settings.setSubject(NULL);
71 }
73 void
74 FillAndStroke::_layoutPageFill()
75 {
76 Gtk::Widget *fs = manage(Glib::wrap(sp_fill_style_widget_new()));
77 _page_fill.table().attach(*fs, 0, 1, 0, 1);
78 }
80 void
81 FillAndStroke::_layoutPageStrokePaint()
82 {
83 Gtk::Widget *ssp = manage(Glib::wrap(sp_stroke_style_paint_widget_new()));
84 _page_stroke_paint.table().attach(*ssp, 0, 1, 0, 1);
85 }
87 void
88 FillAndStroke::_layoutPageStrokeStyle()
89 {
90 Gtk::Widget *ssl = manage(Glib::wrap(sp_stroke_style_line_widget_new()));
91 _page_stroke_style.table().attach(*ssl, 0, 1, 0, 1);
92 }
94 void
95 FillAndStroke::showPageFill()
96 {
97 present();
98 _notebook.set_current_page(0);
99 }
101 void
102 FillAndStroke::showPageStrokePaint()
103 {
104 present();
105 _notebook.set_current_page(1);
106 }
108 void
109 FillAndStroke::showPageStrokeStyle()
110 {
111 present();
112 _notebook.set_current_page(2);
113 }
115 Gtk::HBox&
116 FillAndStroke::_createPageTabLabel(const Glib::ustring& label, const char *label_image)
117 {
118 Gtk::HBox *_tab_label_box = manage(new Gtk::HBox(false, 0));
119 _tab_label_box->pack_start(*Glib::wrap(sp_icon_new(Inkscape::ICON_SIZE_DECORATION,
120 label_image)));
122 Gtk::Label *_tab_label = manage(new Gtk::Label(label, true));
123 _tab_label_box->pack_start(*_tab_label);
124 _tab_label_box->show_all();
126 return *_tab_label_box;
127 }
129 } // namespace Dialog
130 } // namespace UI
131 } // namespace Inkscape
133 /*
134 Local Variables:
135 mode:c++
136 c-file-style:"stroustrup"
137 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
138 indent-tabs-mode:nil
139 fill-column:99
140 End:
141 */
142 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :