fill-and-stroke.cpp revision a07ef8cb442640b12e4172d1c1da7f007e1e31d8
469N/A/** @file
469N/A * @brief Fill and Stroke dialog - implementation
469N/A *
469N/A * Based on the old sp_object_properties_dialog.
469N/A */
469N/A/* Authors:
469N/A * Bryce W. Harrington <bryce@bryceharrington.org>
469N/A * Gustav Broberg <broberg@kth.se>
469N/A * Jon A. Cruz <jon@joncruz.org>
469N/A *
469N/A * Copyright (C) 2004--2007 Authors
469N/A * Copyright (C) 2010 Jon A. Cruz
469N/A *
469N/A * Released under GNU GPL. Read the file 'COPYING' for more information.
469N/A */
469N/A
469N/A#include "desktop-handles.h"
469N/A#include "desktop-style.h"
469N/A#include "document.h"
469N/A#include "fill-and-stroke.h"
469N/A#include "filter-chemistry.h"
469N/A#include "inkscape.h"
469N/A#include "selection.h"
469N/A#include "style.h"
469N/A#include "svg/css-ostringstream.h"
1068N/A#include "ui/icon-names.h"
1068N/A#include "verbs.h"
1068N/A#include "widgets/fill-style.h"
1068N/A#include "widgets/icon.h"
1068N/A#include "widgets/paint-selector.h"
1068N/A#include "widgets/stroke-style.h"
1068N/A#include "xml/repr.h"
1068N/A
1068N/A#include "ui/view/view-widget.h"
1068N/A
1068N/Anamespace Inkscape {
1068N/Anamespace UI {
1068N/Anamespace Dialog {
1068N/A
1068N/AFillAndStroke::FillAndStroke()
1068N/A : UI::Widget::Panel ("", "/dialogs/fillstroke", SP_VERB_DIALOG_FILL_STROKE),
1068N/A _page_fill(1, 1, true, true),
1068N/A _page_stroke_paint(1, 1, true, true),
1068N/A _page_stroke_style(1, 1, true, true),
1068N/A _composite_settings(SP_VERB_DIALOG_FILL_STROKE, "fillstroke", UI::Widget::SimpleFilterModifier::BLUR),
1068N/A deskTrack(),
1068N/A targetDesktop(0),
1068N/A fillWdgt(0),
1068N/A strokeWdgt(0),
469N/A desktopChangeConn()
469N/A{
469N/A Gtk::Box *contents = _getContents();
469N/A contents->set_spacing(0);
469N/A
469N/A contents->pack_start(_notebook, true, true);
1068N/A
1068N/A _notebook.append_page(_page_fill, _createPageTabLabel(_("_Fill"), INKSCAPE_ICON_OBJECT_FILL));
1068N/A _notebook.append_page(_page_stroke_paint, _createPageTabLabel(_("Stroke _paint"), INKSCAPE_ICON_OBJECT_STROKE));
1068N/A _notebook.append_page(_page_stroke_style, _createPageTabLabel(_("Stroke st_yle"), INKSCAPE_ICON_OBJECT_STROKE_STYLE));
469N/A
469N/A _layoutPageFill();
1233N/A _layoutPageStrokePaint();
1233N/A _layoutPageStrokeStyle();
1233N/A
469N/A contents->pack_start(_composite_settings, false, false, 0);
469N/A
469N/A show_all_children();
469N/A
469N/A _composite_settings.setSubject(&_subject);
469N/A
469N/A // Connect this up last
469N/A desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &FillAndStroke::setTargetDesktop) );
469N/A deskTrack.connect(GTK_WIDGET(gobj()));
469N/A}
469N/A
469N/AFillAndStroke::~FillAndStroke()
469N/A{
469N/A _composite_settings.setSubject(NULL);
469N/A
469N/A desktopChangeConn.disconnect();
469N/A deskTrack.disconnect();
469N/A}
469N/A
469N/Avoid FillAndStroke::setDesktop(SPDesktop *desktop)
469N/A{
469N/A Panel::setDesktop(desktop);
469N/A deskTrack.setBase(desktop);
469N/A}
469N/A
469N/Avoid FillAndStroke::setTargetDesktop(SPDesktop *desktop)
469N/A{
469N/A if (targetDesktop != desktop) {
469N/A targetDesktop = desktop;
469N/A if (fillWdgt) {
469N/A sp_fill_style_widget_set_desktop(fillWdgt, desktop);
469N/A }
469N/A if (strokeWdgt) {
469N/A sp_stroke_style_widget_set_desktop(strokeWdgt, desktop);
469N/A }
469N/A }
469N/A}
469N/A
469N/Avoid
469N/AFillAndStroke::_layoutPageFill()
469N/A{
1233N/A fillWdgt = manage(sp_fill_style_widget_new());
469N/A _page_fill.table().attach(*fillWdgt, 0, 1, 0, 1);
469N/A}
469N/A
469N/Avoid
469N/AFillAndStroke::_layoutPageStrokePaint()
469N/A{
469N/A strokeWdgt = manage(sp_stroke_style_paint_widget_new());
1233N/A _page_stroke_paint.table().attach(*strokeWdgt, 0, 1, 0, 1);
1233N/A}
1233N/A
1233N/Avoid
1233N/AFillAndStroke::_layoutPageStrokeStyle()
1233N/A{
469N/A //Gtk::Widget *ssl = manage(Glib::wrap(sp_stroke_style_line_widget_new()));
1233N/A //Gtk::Widget *ssl = static_cast<Gtk::Widget *>(sp_stroke_style_line_widget_new());
1233N/A Gtk::Widget *ssl = sp_stroke_style_line_widget_new();
469N/A _page_stroke_style.table().attach(*ssl, 0, 1, 0, 1);
1233N/A}
1233N/A
1233N/Avoid
1233N/AFillAndStroke::showPageFill()
1233N/A{
1233N/A present();
1233N/A _notebook.set_current_page(0);
1233N/A}
469N/A
469N/Avoid
469N/AFillAndStroke::showPageStrokePaint()
469N/A{
469N/A present();
469N/A _notebook.set_current_page(1);
469N/A}
469N/A
1233N/Avoid
1233N/AFillAndStroke::showPageStrokeStyle()
469N/A{
1233N/A present();
469N/A _notebook.set_current_page(2);
469N/A}
469N/A
469N/AGtk::HBox&
469N/AFillAndStroke::_createPageTabLabel(const Glib::ustring& label, const char *label_image)
469N/A{
469N/A Gtk::HBox *_tab_label_box = manage(new Gtk::HBox(false, 0));
469N/A _tab_label_box->pack_start(*Glib::wrap(sp_icon_new(Inkscape::ICON_SIZE_DECORATION,
469N/A label_image)));
469N/A
469N/A Gtk::Label *_tab_label = manage(new Gtk::Label(label, true));
469N/A _tab_label_box->pack_start(*_tab_label);
469N/A _tab_label_box->show_all();
469N/A
469N/A return *_tab_label_box;
469N/A}
469N/A
469N/A} // namespace Dialog
469N/A} // namespace UI
469N/A} // namespace Inkscape
469N/A
469N/A/*
469N/A Local Variables:
469N/A mode:c++
1233N/A c-file-style:"stroustrup"
1233N/A c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
469N/A indent-tabs-mode:nil
469N/A fill-column:99
469N/A End:
469N/A*/
469N/A// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
469N/A