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 "inkscape-stock.h"
22 #include "selection.h"
23 #include "style.h"
24 #include "svg/css-ostringstream.h"
25 #include "verbs.h"
26 #include "xml/repr.h"
27 #include "widgets/icon.h"
29 #include "dialogs/fill-style.h"
30 #include "dialogs/stroke-style.h"
32 #include <widgets/paint-selector.h>
34 namespace Inkscape {
35 namespace UI {
36 namespace Dialog {
38 FillAndStroke::FillAndStroke()
39 : UI::Widget::Panel ("", "/dialogs/fillstroke", SP_VERB_DIALOG_FILL_STROKE),
40 _page_fill(1, 1, true, true),
41 _page_stroke_paint(1, 1, true, true),
42 _page_stroke_style(1, 1, true, true),
43 _composite_settings(SP_VERB_DIALOG_FILL_STROKE, "fillstroke", SimpleFilterModifier::BLUR)
44 {
45 Gtk::Box *contents = _getContents();
46 contents->set_spacing(0);
48 contents->pack_start(_notebook, true, true);
50 _notebook.append_page(_page_fill, _createPageTabLabel(_("Fill"), INKSCAPE_STOCK_PROPERTIES_FILL_PAGE));
51 _notebook.append_page(_page_stroke_paint, _createPageTabLabel(_("Stroke _paint"), INKSCAPE_STOCK_PROPERTIES_STROKE_PAINT_PAGE));
52 _notebook.append_page(_page_stroke_style, _createPageTabLabel(_("Stroke st_yle"), INKSCAPE_STOCK_PROPERTIES_STROKE_PAGE));
54 _layoutPageFill();
55 _layoutPageStrokePaint();
56 _layoutPageStrokeStyle();
58 contents->pack_start(_composite_settings, false, false, 0);
60 show_all_children();
62 _composite_settings.setSubject(&_subject);
63 }
65 FillAndStroke::~FillAndStroke()
66 {
67 _composite_settings.setSubject(NULL);
68 }
70 void
71 FillAndStroke::_layoutPageFill()
72 {
73 Gtk::Widget *fs = manage(Glib::wrap(sp_fill_style_widget_new()));
74 _page_fill.table().attach(*fs, 0, 1, 0, 1);
75 }
77 void
78 FillAndStroke::_layoutPageStrokePaint()
79 {
80 Gtk::Widget *ssp = manage(Glib::wrap(sp_stroke_style_paint_widget_new()));
81 _page_stroke_paint.table().attach(*ssp, 0, 1, 0, 1);
82 }
84 void
85 FillAndStroke::_layoutPageStrokeStyle()
86 {
87 //Gtk::Widget *ssl = manage(Glib::wrap(sp_stroke_style_line_widget_new()));
88 //Gtk::Widget *ssl = static_cast<Gtk::Widget *>(sp_stroke_style_line_widget_new());
89 Gtk::Widget *ssl = sp_stroke_style_line_widget_new();
90 _page_stroke_style.table().attach(*ssl, 0, 1, 0, 1);
91 }
93 void
94 FillAndStroke::showPageFill()
95 {
96 present();
97 _notebook.set_current_page(0);
98 }
100 void
101 FillAndStroke::showPageStrokePaint()
102 {
103 present();
104 _notebook.set_current_page(1);
105 }
107 void
108 FillAndStroke::showPageStrokeStyle()
109 {
110 present();
111 _notebook.set_current_page(2);
112 }
114 Gtk::HBox&
115 FillAndStroke::_createPageTabLabel(const Glib::ustring& label, const char *label_image)
116 {
117 Gtk::HBox *_tab_label_box = manage(new Gtk::HBox(false, 0));
118 _tab_label_box->pack_start(*Glib::wrap(sp_icon_new(Inkscape::ICON_SIZE_DECORATION,
119 label_image)));
121 Gtk::Label *_tab_label = manage(new Gtk::Label(label, true));
122 _tab_label_box->pack_start(*_tab_label);
123 _tab_label_box->show_all();
125 return *_tab_label_box;
126 }
128 } // namespace Dialog
129 } // namespace UI
130 } // namespace Inkscape
132 /*
133 Local Variables:
134 mode:c++
135 c-file-style:"stroustrup"
136 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
137 indent-tabs-mode:nil
138 fill-column:99
139 End:
140 */
141 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :