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 //Gtk::Widget *ssl = static_cast<Gtk::Widget *>(sp_stroke_style_line_widget_new());
92 Gtk::Widget *ssl = sp_stroke_style_line_widget_new();
93 _page_stroke_style.table().attach(*ssl, 0, 1, 0, 1);
94 }
96 void
97 FillAndStroke::showPageFill()
98 {
99 present();
100 _notebook.set_current_page(0);
101 }
103 void
104 FillAndStroke::showPageStrokePaint()
105 {
106 present();
107 _notebook.set_current_page(1);
108 }
110 void
111 FillAndStroke::showPageStrokeStyle()
112 {
113 present();
114 _notebook.set_current_page(2);
115 }
117 Gtk::HBox&
118 FillAndStroke::_createPageTabLabel(const Glib::ustring& label, const char *label_image)
119 {
120 Gtk::HBox *_tab_label_box = manage(new Gtk::HBox(false, 0));
121 _tab_label_box->pack_start(*Glib::wrap(sp_icon_new(Inkscape::ICON_SIZE_DECORATION,
122 label_image)));
124 Gtk::Label *_tab_label = manage(new Gtk::Label(label, true));
125 _tab_label_box->pack_start(*_tab_label);
126 _tab_label_box->show_all();
128 return *_tab_label_box;
129 }
131 } // namespace Dialog
132 } // namespace UI
133 } // namespace Inkscape
135 /*
136 Local Variables:
137 mode:c++
138 c-file-style:"stroustrup"
139 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
140 indent-tabs-mode:nil
141 fill-column:99
142 End:
143 */
144 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :