From a230b9d6684f01ded46fd530ba0cc74ce9696e2d Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 19 Feb 2015 21:53:20 +0100 Subject: Basic filleting using pointwise (bzr r13645.1.16) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 300 ------------------------ src/ui/dialog/lpe-fillet-chamfer-properties.h | 115 --------- 2 files changed, 415 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index b318933a7..e69de29bb 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -1,300 +0,0 @@ -/** - * From the code of Liam P.White from his Power Stroke Knot dialog - * - * Released under GNU GPL. Read the file 'COPYING' for more information - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#if GLIBMM_DISABLE_DEPRECATED &&HAVE_GLIBMM_THREADS_H -#include -#endif - -#include -#include "lpe-fillet-chamfer-properties.h" -#include -#include -#include -#include "inkscape.h" -#include "desktop.h" -#include "document.h" -#include "document-undo.h" -#include "layer-manager.h" -#include "message-stack.h" - -#include "sp-object.h" -#include "sp-item.h" -#include "verbs.h" -#include "selection.h" -#include "selection-chemistry.h" -#include "ui/icon-names.h" -#include "ui/widget/imagetoggler.h" -#include "util/units.h" -#include - -//#include "event-context.h" - -namespace Inkscape { -namespace UI { -namespace Dialogs { - -FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() - : _desktop(NULL), _knotpoint(NULL), _position_visible(false) -{ - Gtk::Box *mainVBox = get_vbox(); - mainVBox->set_homogeneous(false); - _layout_table.set_spacings(4); - _layout_table.resize(3, 3); - - // Layer name widgets - _fillet_chamfer_position_numeric.set_digits(4); - _fillet_chamfer_position_numeric.set_increments(1,1); - //todo: get tha max aloable infinity freeze the widget - _fillet_chamfer_position_numeric.set_range(0., 999999999999999999.); - - _fillet_chamfer_position_label.set_label(_("Radius (pixels):")); - _fillet_chamfer_position_label.set_alignment(1.0, 0.5); - - _layout_table.attach(_fillet_chamfer_position_label, 0, 1, 0, 1, Gtk::FILL, - Gtk::FILL); - _layout_table.attach(_fillet_chamfer_position_numeric, 1, 2, 0, 1, - Gtk::FILL | Gtk::EXPAND, Gtk::FILL); - _fillet_chamfer_chamfer_subdivisions.set_digits(0); - _fillet_chamfer_chamfer_subdivisions.set_increments(1,1); - //todo: get tha max aloable infinity freeze the widget - _fillet_chamfer_chamfer_subdivisions.set_range(0, 999999999999999999.0); - - _fillet_chamfer_chamfer_subdivisions_label.set_label(_("Chamfer subdivisions:")); - _fillet_chamfer_chamfer_subdivisions_label.set_alignment(1.0, 0.5); - - _layout_table.attach(_fillet_chamfer_chamfer_subdivisions_label, 0, 1, 1, 2, Gtk::FILL, - Gtk::FILL); - _layout_table.attach(_fillet_chamfer_chamfer_subdivisions, 1, 2, 1, 2, - Gtk::FILL | Gtk::EXPAND, Gtk::FILL); - _fillet_chamfer_type_fillet.set_label(_("Fillet")); - _fillet_chamfer_type_fillet.set_group(_fillet_chamfer_type_group); - _fillet_chamfer_type_inverse_fillet.set_label(_("Inverse fillet")); - _fillet_chamfer_type_inverse_fillet.set_group(_fillet_chamfer_type_group); - _fillet_chamfer_type_chamfer.set_label(_("Chamfer")); - _fillet_chamfer_type_chamfer.set_group(_fillet_chamfer_type_group); - _fillet_chamfer_type_inverse_chamfer.set_label(_("Inverse chamfer")); - _fillet_chamfer_type_inverse_chamfer.set_group(_fillet_chamfer_type_group); - - - mainVBox->pack_start(_layout_table, true, true, 4); - mainVBox->pack_start(_fillet_chamfer_type_fillet, true, true, 4); - mainVBox->pack_start(_fillet_chamfer_type_inverse_fillet, true, true, 4); - mainVBox->pack_start(_fillet_chamfer_type_chamfer, true, true, 4); - mainVBox->pack_start(_fillet_chamfer_type_inverse_chamfer, true, true, 4); - - // Buttons - _close_button.set_use_stock(true); - _close_button.set_label(Gtk::Stock::CANCEL.id); - _close_button.set_can_default(); - - _apply_button.set_use_underline(true); - _apply_button.set_can_default(); - - _close_button.signal_clicked() - .connect(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_close)); - _apply_button.signal_clicked() - .connect(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_apply)); - - signal_delete_event().connect(sigc::bind_return( - sigc::hide(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_close)), - true)); - - add_action_widget(_close_button, Gtk::RESPONSE_CLOSE); - add_action_widget(_apply_button, Gtk::RESPONSE_APPLY); - - _apply_button.grab_default(); - - show_all_children(); - - set_focus(_fillet_chamfer_position_numeric); -} - -FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog() -{ - - _set_desktop(NULL); -} - -void FilletChamferPropertiesDialog::showDialog( - SPDesktop *desktop, Geom::Point knotpoint, - const Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity *pt, - const gchar *unit, - bool use_distance, - bool aprox_radius, - Glib::ustring const * documentUnit) -{ - FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog(); - - dialog->_set_desktop(desktop); - dialog->_set_unit(unit); - dialog->_set_use_distance(use_distance); - dialog->_set_aprox(aprox_radius); - dialog->_set_document_unit(documentUnit); - dialog->_set_knot_point(knotpoint); - dialog->_set_pt(pt); - - dialog->set_title(_("Modify Fillet-Chamfer")); - dialog->_apply_button.set_label(_("_Modify")); - - dialog->set_modal(true); - desktop->setWindowTransient(dialog->gobj()); - dialog->property_destroy_with_parent() = true; - - dialog->show(); - dialog->present(); -} - -void FilletChamferPropertiesDialog::_apply() -{ - double d_width; - double d_pos = _fillet_chamfer_position_numeric.get_value(); - if (d_pos) { - if (_fillet_chamfer_type_fillet.get_active() == true) { - d_width = 1; - } else if (_fillet_chamfer_type_inverse_fillet.get_active() == true) { - d_width = 2; - } else if (_fillet_chamfer_type_inverse_chamfer.get_active() == true) { - d_width = _fillet_chamfer_chamfer_subdivisions.get_value() + 4000; - } else { - d_width = _fillet_chamfer_chamfer_subdivisions.get_value() + 3000; - } - if (_flexible) { - if (d_pos > 99.99999 || d_pos < 0) { - d_pos = 0; - } - d_pos = _index + (d_pos / 100); - } else { - d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, *document_unit); - d_pos = d_pos * -1; - } - _knotpoint->knot_set_offset(Geom::Point(d_pos, d_width)); - } - _close(); -} - -void FilletChamferPropertiesDialog::_close() -{ - _set_desktop(NULL); - destroy_(); - Glib::signal_idle().connect( - sigc::bind_return( - sigc::bind(sigc::ptr_fun(&::operator delete), this), - false - ) - ); -} - -bool FilletChamferPropertiesDialog::_handleKeyEvent(GdkEventKey * /*event*/) -{ - return false; -} - -void FilletChamferPropertiesDialog::_handleButtonEvent(GdkEventButton *event) -{ - if ((event->type == GDK_2BUTTON_PRESS) && (event->button == 1)) { - _apply(); - } -} - -void FilletChamferPropertiesDialog::_set_knot_point(Geom::Point knotpoint) -{ - double position; - std::string distance_or_radius = std::string(_("Radius")); - if(aprox){ - distance_or_radius = std::string(_("Radius approximated")); - } - if(use_distance){ - distance_or_radius = std::string(_("Knot distance")); - } - if (knotpoint.x() > 0) { - double intpart; - position = modf(knotpoint[Geom::X], &intpart) * 100; - _flexible = true; - _index = intpart; - _fillet_chamfer_position_label.set_label(_("Position (%):")); - } else { - _flexible = false; - std::string posConcat = Glib::ustring::compose (_("%1 (%2):"), distance_or_radius, unit); - _fillet_chamfer_position_label.set_label(_(posConcat.c_str())); - position = knotpoint[Geom::X] * -1; - - position = Inkscape::Util::Quantity::convert(position, *document_unit, unit); - } - _fillet_chamfer_position_numeric.set_value(position); - if (knotpoint.y() == 1) { - _fillet_chamfer_type_fillet.set_active(true); - } else if (knotpoint.y() == 2) { - _fillet_chamfer_type_inverse_fillet.set_active(true); - } else if (knotpoint.y() >= 3000 && knotpoint.y() < 4000) { - _fillet_chamfer_chamfer_subdivisions.set_value(knotpoint.y() - 3000); - _fillet_chamfer_type_chamfer.set_active(true); - } else if (knotpoint.y() >= 4000 && knotpoint.y() < 5000) { - _fillet_chamfer_chamfer_subdivisions.set_value(knotpoint.y() - 4000); - _fillet_chamfer_type_inverse_chamfer.set_active(true); - } -} - -void FilletChamferPropertiesDialog::_set_pt( - const Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity *pt) -{ - _knotpoint = const_cast< - Inkscape::LivePathEffect::FilletChamferPointArrayParamKnotHolderEntity *>( - pt); -} - -void FilletChamferPropertiesDialog::_set_unit(const gchar *abbr) -{ - unit = abbr; -} - -void FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring const *abbr) -{ - document_unit = abbr; -} - -void FilletChamferPropertiesDialog::_set_use_distance(bool use_knot_distance) -{ - use_distance = use_knot_distance; -} - -void FilletChamferPropertiesDialog::_set_aprox(bool aprox_radius) -{ - aprox = aprox_radius; -} - -void FilletChamferPropertiesDialog::_set_desktop(SPDesktop *desktop) -{ - if (desktop) { - Inkscape::GC::anchor(desktop); - } - if (_desktop) { - Inkscape::GC::release(_desktop); - } - _desktop = desktop; -} - -} // namespace -} // namespace -} // namespace - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: -// filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 -// : diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index 3807e98c8..e69de29bb 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -1,115 +0,0 @@ -/** - * - * From the code of Liam P.White from his Power Stroke Knot dialog - * - * Released under GNU GPL. Read the file 'COPYING' for more information - */ - -#ifndef INKSCAPE_DIALOG_FILLET_CHAMFER_PROPERTIES_H -#define INKSCAPE_DIALOG_FILLET_CHAMFER_PROPERTIES_H - -#include <2geom/point.h> -#include -#include "live_effects/parameter/filletchamferpointarray.h" - -class SPDesktop; - -namespace Inkscape { -namespace UI { -namespace Dialogs { - -class FilletChamferPropertiesDialog : public Gtk::Dialog { -public: - FilletChamferPropertiesDialog(); - virtual ~FilletChamferPropertiesDialog(); - - Glib::ustring getName() const { - return "LayerPropertiesDialog"; - } - - static void showDialog(SPDesktop *desktop, Geom::Point knotpoint, - const Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity *pt, - const gchar *unit, - bool use_distance, - bool aprox_radius, - Glib::ustring const * documentUnit); - -protected: - - SPDesktop *_desktop; - Inkscape::LivePathEffect::FilletChamferPointArrayParamKnotHolderEntity * - _knotpoint; - - Gtk::Label _fillet_chamfer_position_label; - Gtk::SpinButton _fillet_chamfer_position_numeric; - Gtk::RadioButton::Group _fillet_chamfer_type_group; - Gtk::RadioButton _fillet_chamfer_type_fillet; - Gtk::RadioButton _fillet_chamfer_type_inverse_fillet; - Gtk::RadioButton _fillet_chamfer_type_chamfer; - Gtk::RadioButton _fillet_chamfer_type_inverse_chamfer; - Gtk::Label _fillet_chamfer_chamfer_subdivisions_label; - Gtk::SpinButton _fillet_chamfer_chamfer_subdivisions; - - Gtk::Table _layout_table; - bool _position_visible; - double _index; - - Gtk::Button _close_button; - Gtk::Button _apply_button; - - sigc::connection _destroy_connection; - - static FilletChamferPropertiesDialog &_instance() { - static FilletChamferPropertiesDialog instance; - return instance; - } - - void _set_desktop(SPDesktop *desktop); - void _set_pt(const Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity *pt); - void _set_unit(const gchar *abbr); - void _set_document_unit(Glib::ustring const * abbr); - void _set_use_distance(bool use_knot_distance); - void _set_aprox(bool aprox_radius); - void _apply(); - void _close(); - bool _flexible; - const gchar *unit; - Glib::ustring const * document_unit; - bool use_distance; - bool aprox; - void _set_knot_point(Geom::Point knotpoint); - void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row); - - bool _handleKeyEvent(GdkEventKey *event); - void _handleButtonEvent(GdkEventButton *event); - - friend class Inkscape::LivePathEffect:: - FilletChamferPointArrayParamKnotHolderEntity; - -private: - FilletChamferPropertiesDialog( - FilletChamferPropertiesDialog const &); // no copy - FilletChamferPropertiesDialog &operator=( - FilletChamferPropertiesDialog const &); // no assign -}; - -} // namespace -} // namespace -} // namespace - -#endif //INKSCAPE_DIALOG_LAYER_PROPERTIES_H - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: -// filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 -// : -- cgit v1.2.3 From 1db09cce6114c1b2d95ac77b00672caad0447b29 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 4 Mar 2015 23:42:59 +0100 Subject: All features done, only need piecewise update function (bzr r13645.1.33) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 313 ++++++++++++++++++++++++ src/ui/dialog/lpe-fillet-chamfer-properties.h | 118 +++++++++ 2 files changed, 431 insertions(+) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index e69de29bb..fe0deba57 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -0,0 +1,313 @@ +/** + * From the code of Liam P.White from his Power Stroke Knot dialog + * + * Released under GNU GPL. Read the file 'COPYING' for more information + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#if GLIBMM_DISABLE_DEPRECATED &&HAVE_GLIBMM_THREADS_H +#include +#endif + +#include +#include "lpe-fillet-chamfer-properties.h" +#include +#include +#include +#include "inkscape.h" +#include "desktop.h" +#include "document.h" +#include "document-undo.h" +#include "layer-manager.h" +#include "message-stack.h" + +#include "sp-object.h" +#include "sp-item.h" +#include "verbs.h" +#include "selection.h" +#include "selection-chemistry.h" +#include "ui/icon-names.h" +#include "ui/widget/imagetoggler.h" +#include "util/units.h" +#include + +//#include "event-context.h" + +namespace Inkscape { +namespace UI { +namespace Dialogs { + +FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() + : _desktop(NULL), _knotpoint(NULL), _position_visible(false) +{ + Gtk::Box *mainVBox = get_vbox(); + mainVBox->set_homogeneous(false); + _layout_table.set_spacings(4); + _layout_table.resize(3, 3); + + // Layer name widgets + _fillet_chamfer_position_numeric.set_digits(4); + _fillet_chamfer_position_numeric.set_increments(1,1); + //todo: get tha max aloable infinity freeze the widget + _fillet_chamfer_position_numeric.set_range(0., 999999999999999999.); + + _fillet_chamfer_position_label.set_label(_("Radius (pixels):")); + _fillet_chamfer_position_label.set_alignment(1.0, 0.5); + + _layout_table.attach(_fillet_chamfer_position_label, 0, 1, 0, 1, Gtk::FILL, + Gtk::FILL); + _layout_table.attach(_fillet_chamfer_position_numeric, 1, 2, 0, 1, + Gtk::FILL | Gtk::EXPAND, Gtk::FILL); + _fillet_chamfer_chamfer_subdivisions.set_digits(0); + _fillet_chamfer_chamfer_subdivisions.set_increments(1,1); + //todo: get tha max aloable infinity freeze the widget + _fillet_chamfer_chamfer_subdivisions.set_range(1, 4294967295); + + _fillet_chamfer_chamfer_subdivisions_label.set_label(_("Chamfer subdivisions:")); + _fillet_chamfer_chamfer_subdivisions_label.set_alignment(1.0, 0.5); + + _layout_table.attach(_fillet_chamfer_chamfer_subdivisions_label, 0, 1, 1, 2, Gtk::FILL, + Gtk::FILL); + _layout_table.attach(_fillet_chamfer_chamfer_subdivisions, 1, 2, 1, 2, + Gtk::FILL | Gtk::EXPAND, Gtk::FILL); + _fillet_chamfer_type_fillet.set_label(_("Fillet")); + _fillet_chamfer_type_fillet.set_group(_fillet_chamfer_type_group); + _fillet_chamfer_type_inverse_fillet.set_label(_("Inverse fillet")); + _fillet_chamfer_type_inverse_fillet.set_group(_fillet_chamfer_type_group); + _fillet_chamfer_type_chamfer.set_label(_("Chamfer")); + _fillet_chamfer_type_chamfer.set_group(_fillet_chamfer_type_group); + _fillet_chamfer_type_inverse_chamfer.set_label(_("Inverse chamfer")); + _fillet_chamfer_type_inverse_chamfer.set_group(_fillet_chamfer_type_group); + + + mainVBox->pack_start(_layout_table, true, true, 4); + mainVBox->pack_start(_fillet_chamfer_type_fillet, true, true, 4); + mainVBox->pack_start(_fillet_chamfer_type_inverse_fillet, true, true, 4); + mainVBox->pack_start(_fillet_chamfer_type_chamfer, true, true, 4); + mainVBox->pack_start(_fillet_chamfer_type_inverse_chamfer, true, true, 4); + + // Buttons + _close_button.set_use_stock(true); + _close_button.set_label(Gtk::Stock::CANCEL.id); + _close_button.set_can_default(); + + _apply_button.set_use_underline(true); + _apply_button.set_can_default(); + + _close_button.signal_clicked() + .connect(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_close)); + _apply_button.signal_clicked() + .connect(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_apply)); + + signal_delete_event().connect(sigc::bind_return( + sigc::hide(sigc::mem_fun(*this, &FilletChamferPropertiesDialog::_close)), + true)); + + add_action_widget(_close_button, Gtk::RESPONSE_CLOSE); + add_action_widget(_apply_button, Gtk::RESPONSE_APPLY); + + _apply_button.grab_default(); + + show_all_children(); + + set_focus(_fillet_chamfer_position_numeric); +} + +FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog() +{ + + _set_desktop(NULL); +} + +void FilletChamferPropertiesDialog::showDialog( + SPDesktop *desktop, double ammount, + const Inkscape::LivePathEffect:: + SatellitePairArrayParamKnotHolderEntity *pt, + const gchar *unit, + bool use_distance, + bool aprox_radius, + Glib::ustring const * documentUnit, + Geom::Satellite satellite) +{ + FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog(); + + dialog->_set_desktop(desktop); + dialog->_set_unit(unit); + dialog->_set_use_distance(use_distance); + dialog->_set_aprox(aprox_radius); + dialog->_set_document_unit(documentUnit); + dialog->_set_ammount(ammount); + dialog->_set_satellite(satellite); + dialog->_set_pt(pt); + + dialog->set_title(_("Modify Fillet-Chamfer")); + dialog->_apply_button.set_label(_("_Modify")); + + dialog->set_modal(true); + desktop->setWindowTransient(dialog->gobj()); + dialog->property_destroy_with_parent() = true; + + dialog->show(); + dialog->present(); +} + +void FilletChamferPropertiesDialog::_apply() +{ + + double d_pos = _fillet_chamfer_position_numeric.get_value(); + if (d_pos >= 0) { + if (_fillet_chamfer_type_fillet.get_active() == true) { + _satellite.setSatelliteType(Geom::F); + } else if (_fillet_chamfer_type_inverse_fillet.get_active() == true) { + _satellite.setSatelliteType(Geom::IF); + } else if (_fillet_chamfer_type_inverse_chamfer.get_active() == true) { + _satellite.setSatelliteType(Geom::IC); + } else { + _satellite.setSatelliteType(Geom::C); + } + if (_flexible) { + if (d_pos > 99.99999 || d_pos < 0) { + d_pos = 0; + } + d_pos = d_pos / 100; + } else { + d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, *document_unit); + } + _satellite.setAmmount( d_pos); + unsigned int steps = (unsigned int)_fillet_chamfer_chamfer_subdivisions.get_value(); + if(steps < 1){ + steps = 1; + } + _satellite.setSteps(steps); + _knotpoint->knot_set_offset(_satellite); + } + _close(); +} + +void FilletChamferPropertiesDialog::_close() +{ + _set_desktop(NULL); + destroy_(); + Glib::signal_idle().connect( + sigc::bind_return( + sigc::bind(sigc::ptr_fun(&::operator delete), this), + false + ) + ); +} + +bool FilletChamferPropertiesDialog::_handleKeyEvent(GdkEventKey * /*event*/) +{ + return false; +} + +void FilletChamferPropertiesDialog::_handleButtonEvent(GdkEventButton *event) +{ + if ((event->type == GDK_2BUTTON_PRESS) && (event->button == 1)) { + _apply(); + } +} + +void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) +{ + double position; + std::string distance_or_radius = std::string(_("Radius")); + if(aprox){ + distance_or_radius = std::string(_("Radius approximated")); + } + if(use_distance){ + distance_or_radius = std::string(_("Knot distance")); + } + if (satellite.getIsTime()) { + position = ammount * 100; + _flexible = true; + _fillet_chamfer_position_label.set_label(_("Position (%):")); + } else { + _flexible = false; + std::string posConcat = Glib::ustring::compose (_("%1 (%2):"), distance_or_radius, unit); + _fillet_chamfer_position_label.set_label(_(posConcat.c_str())); + position = ammount; + position = Inkscape::Util::Quantity::convert(position, *document_unit, unit); + } + _fillet_chamfer_position_numeric.set_value(position); + if (satellite.getSatelliteType() == Geom::F) { + _fillet_chamfer_type_fillet.set_active(true); + } else if (satellite.getSatelliteType() == Geom::IF) { + _fillet_chamfer_type_inverse_fillet.set_active(true); + } else if (satellite.getSatelliteType() == Geom::C) { + _fillet_chamfer_type_chamfer.set_active(true); + _fillet_chamfer_chamfer_subdivisions.set_value(satellite.getSteps()); + } else if (satellite.getSatelliteType() == Geom::IC) { + _fillet_chamfer_type_inverse_chamfer.set_active(true); + _fillet_chamfer_chamfer_subdivisions.set_value(satellite.getSteps()); + } + _satellite = satellite; +} + +void FilletChamferPropertiesDialog::_set_pt( + const Inkscape::LivePathEffect:: + SatellitePairArrayParamKnotHolderEntity *pt) +{ + _knotpoint = const_cast< + Inkscape::LivePathEffect::SatellitePairArrayParamKnotHolderEntity *>( + pt); +} + +void FilletChamferPropertiesDialog::_set_unit(const gchar *abbr) +{ + unit = abbr; +} + +void FilletChamferPropertiesDialog::_set_ammount(double amm) +{ + ammount = amm; +} + + + + +void FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring const *abbr) +{ + document_unit = abbr; +} + +void FilletChamferPropertiesDialog::_set_use_distance(bool use_knot_distance) +{ + use_distance = use_knot_distance; +} + +void FilletChamferPropertiesDialog::_set_aprox(bool aprox_radius) +{ + aprox = aprox_radius; +} + +void FilletChamferPropertiesDialog::_set_desktop(SPDesktop *desktop) +{ + if (desktop) { + Inkscape::GC::anchor(desktop); + } + if (_desktop) { + Inkscape::GC::release(_desktop); + } + _desktop = desktop; +} + +} // namespace +} // namespace +} // namespace + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: +// filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 +// : diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index e69de29bb..63215d17c 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -0,0 +1,118 @@ +/** + * + * From the code of Liam P.White from his Power Stroke Knot dialog + * + * Released under GNU GPL. Read the file 'COPYING' for more information + */ + +#ifndef INKSCAPE_DIALOG_FILLET_CHAMFER_PROPERTIES_H +#define INKSCAPE_DIALOG_FILLET_CHAMFER_PROPERTIES_H + +#include <2geom/point.h> +#include +#include "live_effects/parameter/satellitepairarray.h" + +class SPDesktop; + +namespace Inkscape { +namespace UI { +namespace Dialogs { + +class FilletChamferPropertiesDialog : public Gtk::Dialog { +public: + FilletChamferPropertiesDialog(); + virtual ~FilletChamferPropertiesDialog(); + + Glib::ustring getName() const { + return "LayerPropertiesDialog"; + } + + static void showDialog(SPDesktop *desktop, double ammount, + const Inkscape::LivePathEffect:: + SatellitePairArrayParamKnotHolderEntity *pt, + const gchar *unit, + bool use_distance, + bool aprox_radius, + Glib::ustring const * documentUnit, + Geom::Satellite satellite); + +protected: + + SPDesktop *_desktop; + Inkscape::LivePathEffect::SatellitePairArrayParamKnotHolderEntity * + _knotpoint; + + Gtk::Label _fillet_chamfer_position_label; + Gtk::SpinButton _fillet_chamfer_position_numeric; + Gtk::RadioButton::Group _fillet_chamfer_type_group; + Gtk::RadioButton _fillet_chamfer_type_fillet; + Gtk::RadioButton _fillet_chamfer_type_inverse_fillet; + Gtk::RadioButton _fillet_chamfer_type_chamfer; + Gtk::RadioButton _fillet_chamfer_type_inverse_chamfer; + Gtk::Label _fillet_chamfer_chamfer_subdivisions_label; + Gtk::SpinButton _fillet_chamfer_chamfer_subdivisions; + + Gtk::Table _layout_table; + bool _position_visible; + + Gtk::Button _close_button; + Gtk::Button _apply_button; + + sigc::connection _destroy_connection; + + static FilletChamferPropertiesDialog &_instance() { + static FilletChamferPropertiesDialog instance; + return instance; + } + + void _set_desktop(SPDesktop *desktop); + void _set_pt(const Inkscape::LivePathEffect:: + SatellitePairArrayParamKnotHolderEntity *pt); + void _set_unit(const gchar *abbr); + void _set_document_unit(Glib::ustring const * abbr); + void _set_use_distance(bool use_knot_distance); + void _set_aprox(bool aprox_radius); + void _apply(); + void _close(); + bool _flexible; + Geom::Satellite _satellite; + const gchar *unit; + Glib::ustring const * document_unit; + bool use_distance; + double ammount; + bool aprox; + void _set_ammount(double ammount); + void _set_satellite(Geom::Satellite satellite); + void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row); + + bool _handleKeyEvent(GdkEventKey *event); + void _handleButtonEvent(GdkEventButton *event); + + friend class Inkscape::LivePathEffect:: + SatellitePairArrayParamKnotHolderEntity; + +private: + FilletChamferPropertiesDialog( + FilletChamferPropertiesDialog const &); // no copy + FilletChamferPropertiesDialog &operator=( + FilletChamferPropertiesDialog const &); // no assign +}; + +} // namespace +} // namespace +} // namespace + +#endif //INKSCAPE_DIALOG_LAYER_PROPERTIES_H + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: +// filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 +// : -- cgit v1.2.3 From 62ebac099d8fa013e34a773c0fe3aee56b5a5758 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 7 Mar 2015 13:55:16 +0100 Subject: finish helper paths and beter handle of fillet/chamfer overflow. Also make the satellitepairarray LPE parameter usable for other pointwise effects, not only to fillet chamfer (bzr r13645.1.35) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 20 ++++++++++---------- src/ui/dialog/lpe-fillet-chamfer-properties.h | 14 +++++++------- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index fe0deba57..8a6cbadad 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -123,9 +123,9 @@ FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog() } void FilletChamferPropertiesDialog::showDialog( - SPDesktop *desktop, double ammount, + SPDesktop *desktop, double amount, const Inkscape::LivePathEffect:: - SatellitePairArrayParamKnotHolderEntity *pt, + FilletChamferKnotHolderEntity *pt, const gchar *unit, bool use_distance, bool aprox_radius, @@ -139,7 +139,7 @@ void FilletChamferPropertiesDialog::showDialog( dialog->_set_use_distance(use_distance); dialog->_set_aprox(aprox_radius); dialog->_set_document_unit(documentUnit); - dialog->_set_ammount(ammount); + dialog->_set_amount(amount); dialog->_set_satellite(satellite); dialog->_set_pt(pt); @@ -176,7 +176,7 @@ void FilletChamferPropertiesDialog::_apply() } else { d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, *document_unit); } - _satellite.setAmmount( d_pos); + _satellite.setAmount( d_pos); unsigned int steps = (unsigned int)_fillet_chamfer_chamfer_subdivisions.get_value(); if(steps < 1){ steps = 1; @@ -222,14 +222,14 @@ void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) distance_or_radius = std::string(_("Knot distance")); } if (satellite.getIsTime()) { - position = ammount * 100; + position = amount * 100; _flexible = true; _fillet_chamfer_position_label.set_label(_("Position (%):")); } else { _flexible = false; std::string posConcat = Glib::ustring::compose (_("%1 (%2):"), distance_or_radius, unit); _fillet_chamfer_position_label.set_label(_(posConcat.c_str())); - position = ammount; + position = amount; position = Inkscape::Util::Quantity::convert(position, *document_unit, unit); } _fillet_chamfer_position_numeric.set_value(position); @@ -249,10 +249,10 @@ void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) void FilletChamferPropertiesDialog::_set_pt( const Inkscape::LivePathEffect:: - SatellitePairArrayParamKnotHolderEntity *pt) + FilletChamferKnotHolderEntity *pt) { _knotpoint = const_cast< - Inkscape::LivePathEffect::SatellitePairArrayParamKnotHolderEntity *>( + Inkscape::LivePathEffect::FilletChamferKnotHolderEntity *>( pt); } @@ -261,9 +261,9 @@ void FilletChamferPropertiesDialog::_set_unit(const gchar *abbr) unit = abbr; } -void FilletChamferPropertiesDialog::_set_ammount(double amm) +void FilletChamferPropertiesDialog::_set_amount(double amm) { - ammount = amm; + amount = amm; } diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index 63215d17c..6051b49d3 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -27,9 +27,9 @@ public: return "LayerPropertiesDialog"; } - static void showDialog(SPDesktop *desktop, double ammount, + static void showDialog(SPDesktop *desktop, double amount, const Inkscape::LivePathEffect:: - SatellitePairArrayParamKnotHolderEntity *pt, + FilletChamferKnotHolderEntity *pt, const gchar *unit, bool use_distance, bool aprox_radius, @@ -39,7 +39,7 @@ public: protected: SPDesktop *_desktop; - Inkscape::LivePathEffect::SatellitePairArrayParamKnotHolderEntity * + Inkscape::LivePathEffect::FilletChamferKnotHolderEntity * _knotpoint; Gtk::Label _fillet_chamfer_position_label; @@ -67,7 +67,7 @@ protected: void _set_desktop(SPDesktop *desktop); void _set_pt(const Inkscape::LivePathEffect:: - SatellitePairArrayParamKnotHolderEntity *pt); + FilletChamferKnotHolderEntity *pt); void _set_unit(const gchar *abbr); void _set_document_unit(Glib::ustring const * abbr); void _set_use_distance(bool use_knot_distance); @@ -79,9 +79,9 @@ protected: const gchar *unit; Glib::ustring const * document_unit; bool use_distance; - double ammount; + double amount; bool aprox; - void _set_ammount(double ammount); + void _set_amount(double amount); void _set_satellite(Geom::Satellite satellite); void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row); @@ -89,7 +89,7 @@ protected: void _handleButtonEvent(GdkEventButton *event); friend class Inkscape::LivePathEffect:: - SatellitePairArrayParamKnotHolderEntity; + FilletChamferKnotHolderEntity; private: FilletChamferPropertiesDialog( -- cgit v1.2.3 From 4c1951cc43deafcc0131ba6a0878b4f371651f68 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 8 Mar 2015 16:30:33 +0100 Subject: merged anf fixed from trunk (bzr r13645.1.39) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index d0f52775a..c6959b718 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -129,12 +129,8 @@ void FilletChamferPropertiesDialog::showDialog( const gchar *unit, bool use_distance, bool aprox_radius, -<<<<<<< TREE - Glib::ustring const * documentUnit, + Glib::ustring documentUnit, Geom::Satellite satellite) -======= - Glib::ustring documentUnit) ->>>>>>> MERGE-SOURCE { FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog(); @@ -265,7 +261,6 @@ void FilletChamferPropertiesDialog::_set_unit(const gchar *abbr) unit = abbr; } -<<<<<<< TREE void FilletChamferPropertiesDialog::_set_amount(double amm) { amount = amm; @@ -274,10 +269,7 @@ void FilletChamferPropertiesDialog::_set_amount(double amm) -void FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring const *abbr) -======= void FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring abbr) ->>>>>>> MERGE-SOURCE { document_unit = abbr; } -- cgit v1.2.3 From aeffc3f474c1ce460b2c9f8340de283d5853a164 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 19 Mar 2015 19:26:22 +0100 Subject: fixing a boring bug in path manipulator (bzr r13645.1.43) --- src/ui/tool/path-manipulator.cpp | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index c8b986824..dbcde240a 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1221,10 +1221,13 @@ int PathManipulator::BSplineGetSteps() const { LivePathEffect::LPEBSpline const *lpe_bsp = NULL; - if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ - Inkscape::LivePathEffect::Effect const *thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); - if(thisEffect){ - lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + SPLPEItem * path = dynamic_cast(_path); + if (path){ + if(path->hasPathEffect()){ + Inkscape::LivePathEffect::Effect const *thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); + if(thisEffect){ + lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + } } } int steps = 0; @@ -1338,19 +1341,22 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) _spcurve->set_pathvector(pathv); if (alert_LPE) { /// \todo note that _path can be an Inkscape::LivePathEffect::Effect* too, kind of confusing, rework member naming? - if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ - Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::POWERSTROKE); - if(thisEffect){ - LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); - if (lpe_pwr) { - lpe_pwr->adjustForNewPath(pathv); + SPLPEItem * path = dynamic_cast(_path); + if (path){ + if(path->hasPathEffect()){ + Inkscape::LivePathEffect::Effect* thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::POWERSTROKE); + if(thisEffect){ + LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + if (lpe_pwr) { + lpe_pwr->adjustForNewPath(pathv); + } } - } - thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER); - if(thisEffect){ - LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); - if (lpe_fll) { - lpe_fll->adjustForNewPath(pathv); + thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER); + if(thisEffect){ + LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + if (lpe_fll) { + lpe_fll->adjustForNewPath(pathv); + } } } } -- cgit v1.2.3 From f3e7b51b1d2497cda7a66e13f4f50da145ece19c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 20 Mar 2015 00:14:47 +0100 Subject: Added delete nodes/satellites (bzr r13645.1.45) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index c6959b718..aa27a1414 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -233,16 +233,15 @@ void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) position = Inkscape::Util::Quantity::convert(position, document_unit, unit); } _fillet_chamfer_position_numeric.set_value(position); + _fillet_chamfer_chamfer_subdivisions.set_value(satellite.getSteps()); if (satellite.getSatelliteType() == Geom::F) { _fillet_chamfer_type_fillet.set_active(true); } else if (satellite.getSatelliteType() == Geom::IF) { _fillet_chamfer_type_inverse_fillet.set_active(true); } else if (satellite.getSatelliteType() == Geom::C) { _fillet_chamfer_type_chamfer.set_active(true); - _fillet_chamfer_chamfer_subdivisions.set_value(satellite.getSteps()); } else if (satellite.getSatelliteType() == Geom::IC) { _fillet_chamfer_type_inverse_chamfer.set_active(true); - _fillet_chamfer_chamfer_subdivisions.set_value(satellite.getSteps()); } _satellite = satellite; } -- cgit v1.2.3 From cfe5bd077cc29fd43385792435f687d468aca13f Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 21 Mar 2015 10:55:27 +0100 Subject: fix bspline calls and atemp to fic a bug whith map (bzr r13645.1.46) --- src/ui/tool/node.cpp | 20 ++++++++++---------- src/ui/tool/path-manipulator.cpp | 6 +++--- src/ui/tool/path-manipulator.h | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index eeea47e4d..5cfc2a0ca 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -175,7 +175,7 @@ void Handle::move(Geom::Point const &new_pos) setPosition(new_pos); //move the handler and its oposite the same proportion - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this,this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),this)); } @@ -192,7 +192,7 @@ void Handle::move(Geom::Point const &new_pos) setRelativePos(new_delta); //move the handler and its oposite the same proportion - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this,this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),this)); } @@ -218,7 +218,7 @@ void Handle::move(Geom::Point const &new_pos) setPosition(new_pos); // moves the handler and its oposite the same proportion - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this,this)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),this)); } @@ -313,7 +313,7 @@ bool Handle::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, GdkEven //this function moves the handler and its oposite to the default proportion of defaultStartPower void Handle::handle_2button_press(){ - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ setPosition(_pm().BSplineHandleReposition(this,defaultStartPower)); this->other()->setPosition(_pm().BSplineHandleReposition(this->other(),defaultStartPower)); _pm().update(); @@ -373,7 +373,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) new_pos = result; // moves the handler and its oposite in X fixed positions depending on parameter "steps with control" // by default in live BSpline - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ setPosition(new_pos); int steps = _pm().BSplineGetSteps(); new_pos=_pm().BSplineHandleReposition(this,ceilf(_pm().BSplineHandlePosition(this,this)*steps)/steps); @@ -423,7 +423,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) } } //if it is bspline but SHIFT or CONTROL are not pressed it fixes it in the original position - if(_pm().isBSpline() && !held_shift(*event) && !held_control(*event)){ + if(_pm().isBSpline(false) && !held_shift(*event) && !held_control(*event)){ new_pos=_last_drag_origin(); } move(new_pos); // needed for correct update, even though it's redundant @@ -656,7 +656,7 @@ void Node::move(Geom::Point const &new_pos) _fixNeighbors(old_pos, new_pos); // move the affected handlers. First the node ones, later the adjoining ones. - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),nodeWeight)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),nodeWeight)); if(prevNode){ @@ -709,7 +709,7 @@ void Node::transform(Geom::Affine const &m) _fixNeighbors(old_pos, position()); // move the involved handlers, first the node ones, later the adjoining ones - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ _front.setPosition(_pm().BSplineHandleReposition(this->front(),nodeWeight)); _back.setPosition(_pm().BSplineHandleReposition(this->back(),nodeWeight)); if(prevNode){ @@ -916,7 +916,7 @@ void Node::setType(NodeType type, bool update_handles) } /* in node type changes, about bspline traces, we can mantain them with noPower power in border mode, or we give them the default power in curve mode */ - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ double weight = noPower; if(_pm().BSplineHandlePosition(this->front()) != noPower ){ weight = defaultStartPower; @@ -1172,7 +1172,7 @@ void Node::_setState(State state) mgr.setActive(_canvas_item, true); mgr.setPrelight(_canvas_item, false); //this shows the handlers when selecting the nodes - if(_pm().isBSpline()){ + if(_pm().isBSpline(false)){ this->front()->setPosition(_pm().BSplineHandleReposition(this->front())); this->back()->setPosition(_pm().BSplineHandleReposition(this->back())); } diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index dbcde240a..64eba3921 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -670,7 +670,7 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite start = next; } // if we are removing, we readjust the handlers - if(isBSpline()){ + if(isBSpline(false)){ if(start.prev()){ start.prev()->front()->setPosition(BSplineHandleReposition(start.prev()->front(),start.prev()->back())); } @@ -999,7 +999,7 @@ NodeList::iterator PathManipulator::subdivideSegment(NodeList::iterator first, d // set new handle positions Node *n = new Node(_multi_path_manipulator._path_data.node_data, seg2[0]); - if(!isBSpline()){ + if(!isBSpline(false)){ n->back()->setPosition(seg1[2]); n->front()->setPosition(seg2[1]); n->setType(NODE_SMOOTH, false); @@ -1245,7 +1245,7 @@ bool PathManipulator::isBSpline(bool recalculate){ return _is_bspline; } -bool PathManipulator::isBSpline() const { +bool PathManipulator::isBSpline(false) const { return BSplineGetSteps() > 0; } diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h index 4d2bf4300..4badec569 100644 --- a/src/ui/tool/path-manipulator.h +++ b/src/ui/tool/path-manipulator.h @@ -107,7 +107,7 @@ private: void _createControlPointsFromGeometry(); - bool isBSpline(bool recalculate = false); + bool isBSpline(bool recalculate); bool isBSpline() const; double BSplineHandlePosition(Handle *h, Handle *h2 = NULL); Geom::Point BSplineHandleReposition(Handle *h, Handle *h2 = NULL); -- cgit v1.2.3 From c1487f9dc277520b8734b7e80387b35c78d979ae Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 21 Mar 2015 22:24:37 +0100 Subject: Fixed bug whith maps (bzr r13645.1.49) --- src/ui/tool/multi-path-manipulator.h | 2 +- src/ui/tool/path-manipulator.cpp | 30 ++++++++++++++---------------- src/ui/tool/path-manipulator.h | 2 +- 3 files changed, 16 insertions(+), 18 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tool/multi-path-manipulator.h b/src/ui/tool/multi-path-manipulator.h index cdbf34e9d..1bbcdd7ec 100644 --- a/src/ui/tool/multi-path-manipulator.h +++ b/src/ui/tool/multi-path-manipulator.h @@ -39,7 +39,7 @@ public: virtual bool event(Inkscape::UI::Tools::ToolBase *, GdkEvent *event); bool empty() { return _mmap.empty(); } - unsigned size() { return _mmap.empty(); } + unsigned size() { return _mmap.size(); } void setItems(std::set const &); void clear() { _mmap.clear(); } void cleanup(); diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 8b735f3e6..00e18dd3f 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -11,6 +11,7 @@ */ #include "live_effects/lpe-powerstroke.h" +#include "live_effects/lpe-bspline.h" #include "live_effects/lpe-fillet-chamfer.h" #include #include @@ -20,7 +21,7 @@ #include <2geom/bezier-curve.h> #include <2geom/bezier-utils.h> #include <2geom/path-sink.h> -#include + #include "ui/tool/path-manipulator.h" #include "desktop.h" @@ -33,6 +34,7 @@ #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" + #include "sp-path.h" #include "helper/geom.h" #include "preferences.h" @@ -43,7 +45,7 @@ #include "ui/tool/multi-path-manipulator.h" #include "xml/node.h" #include "xml/node-observer.h" -#include "live_effects/lpe-bspline.h" +#include namespace Inkscape { namespace UI { @@ -151,7 +153,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, _createControlPointsFromGeometry(); //Define if the path is BSpline on construction - isBSpline(true); + recalculateIsBSpline(); } PathManipulator::~PathManipulator() @@ -1238,22 +1240,18 @@ int PathManipulator::BSplineGetSteps() const { } // determines if the trace has bspline effect -bool PathManipulator::isBSpline(bool recalculate){ - if(recalculate){ - SPLPEItem * path = dynamic_cast(_path); - if (path){ - if(path->hasPathEffect()){ - Inkscape::LivePathEffect::Effect const *thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); - if(thisEffect){ - _is_bspline = true; - return _is_bspline; - } +void PathManipulator::recalculateIsBSpline(){ + SPLPEItem * path = dynamic_cast(_path); + if (path){ + if(path->hasPathEffect()){ + Inkscape::LivePathEffect::Effect const *thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); + if(thisEffect){ + _is_bspline = true; + return; } } - } _is_bspline = false; - return _is_bspline; } bool PathManipulator::isBSpline() const { @@ -1325,7 +1323,7 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) { Geom::PathBuilder builder; //Refresh if is bspline some times -think on path change selection, this value get lost - isBSpline(true); + recalculateIsBSpline(); for (std::list::iterator spi = _subpaths.begin(); spi != _subpaths.end(); ) { SubpathPtr subpath = *spi; if (subpath->empty()) { diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h index 4badec569..6dc1c9d09 100644 --- a/src/ui/tool/path-manipulator.h +++ b/src/ui/tool/path-manipulator.h @@ -107,7 +107,7 @@ private: void _createControlPointsFromGeometry(); - bool isBSpline(bool recalculate); + void recalculateIsBSpline(); bool isBSpline() const; double BSplineHandlePosition(Handle *h, Handle *h2 = NULL); Geom::Point BSplineHandleReposition(Handle *h, Handle *h2 = NULL); -- cgit v1.2.3 From 8bd246d8b59749e15de4d5d0d78e9b82fa8a601a Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 22 Mar 2015 18:27:17 +0100 Subject: Fixed bug when deleting nodes (bzr r13645.1.51) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index aa27a1414..6875799f8 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -177,7 +177,7 @@ void FilletChamferPropertiesDialog::_apply() d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, document_unit); } _satellite.setAmount( d_pos); - unsigned int steps = (unsigned int)_fillet_chamfer_chamfer_subdivisions.get_value(); + size_t steps = (size_t)_fillet_chamfer_chamfer_subdivisions.get_value(); if(steps < 1){ steps = 1; } -- cgit v1.2.3 From edc48d93d2b528c20b9adb0f7d074c73c46f03eb Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 27 Mar 2015 00:01:44 +0100 Subject: adding append mode (bzr r13645.1.54) --- src/ui/tool/path-manipulator.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index d2bdd9384..ccf75dcde 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -34,7 +34,6 @@ #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" - #include "sp-path.h" #include "helper/geom.h" #include "preferences.h" -- cgit v1.2.3 From dff3aa428ff050c2cce501f646977ddad921feca Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 1 Apr 2015 04:13:16 +0200 Subject: Move 2Geom work to a intermediate positon -helper- Removed dependency to helper/geom.h Now use a simple vector, not a vector of pairs of size_t and Satellite Getters and setters on Satellite removed Update store parameter to a more friendly string, like powerstroke Todo: Documentation and Fix coding style. (bzr r13645.1.63) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 24 ++++++++++++------------ src/ui/dialog/lpe-fillet-chamfer-properties.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 6875799f8..443a48c13 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -160,13 +160,13 @@ void FilletChamferPropertiesDialog::_apply() double d_pos = _fillet_chamfer_position_numeric.get_value(); if (d_pos >= 0) { if (_fillet_chamfer_type_fillet.get_active() == true) { - _satellite.setSatelliteType(Geom::F); + _satellite.satelliteType = Geom::F; } else if (_fillet_chamfer_type_inverse_fillet.get_active() == true) { - _satellite.setSatelliteType(Geom::IF); + _satellite.satelliteType = Geom::IF; } else if (_fillet_chamfer_type_inverse_chamfer.get_active() == true) { - _satellite.setSatelliteType(Geom::IC); + _satellite.satelliteType = Geom::IC; } else { - _satellite.setSatelliteType(Geom::C); + _satellite.satelliteType = Geom::C; } if (_flexible) { if (d_pos > 99.99999 || d_pos < 0) { @@ -176,12 +176,12 @@ void FilletChamferPropertiesDialog::_apply() } else { d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, document_unit); } - _satellite.setAmount( d_pos); + _satellite.amount = d_pos; size_t steps = (size_t)_fillet_chamfer_chamfer_subdivisions.get_value(); if(steps < 1){ steps = 1; } - _satellite.setSteps(steps); + _satellite.steps = steps; _knotpoint->knot_set_offset(_satellite); } _close(); @@ -221,7 +221,7 @@ void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) if(use_distance){ distance_or_radius = std::string(_("Knot distance")); } - if (satellite.getIsTime()) { + if (satellite.isTime) { position = amount * 100; _flexible = true; _fillet_chamfer_position_label.set_label(_("Position (%):")); @@ -233,14 +233,14 @@ void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) position = Inkscape::Util::Quantity::convert(position, document_unit, unit); } _fillet_chamfer_position_numeric.set_value(position); - _fillet_chamfer_chamfer_subdivisions.set_value(satellite.getSteps()); - if (satellite.getSatelliteType() == Geom::F) { + _fillet_chamfer_chamfer_subdivisions.set_value(satellite.steps); + if (satellite.satelliteType == Geom::F) { _fillet_chamfer_type_fillet.set_active(true); - } else if (satellite.getSatelliteType() == Geom::IF) { + } else if (satellite.satelliteType == Geom::IF) { _fillet_chamfer_type_inverse_fillet.set_active(true); - } else if (satellite.getSatelliteType() == Geom::C) { + } else if (satellite.satelliteType == Geom::C) { _fillet_chamfer_type_chamfer.set_active(true); - } else if (satellite.getSatelliteType() == Geom::IC) { + } else if (satellite.satelliteType == Geom::IC) { _fillet_chamfer_type_inverse_chamfer.set_active(true); } _satellite = satellite; diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index 533f7af2a..1a40eea9b 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -10,7 +10,7 @@ #include <2geom/point.h> #include -#include "live_effects/parameter/satellitepairarray.h" +#include "live_effects/parameter/satellitearray.h" class SPDesktop; -- cgit v1.2.3 From f3965759e52107c1cdcd8b7e248e5538fdaa11b6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 1 Apr 2015 17:54:35 +0200 Subject: Added documentation and fix to coding style. (bzr r13645.1.66) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 80 ++++++++++++------------- src/ui/dialog/lpe-fillet-chamfer-properties.h | 54 +++++++++-------- 2 files changed, 69 insertions(+), 65 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 443a48c13..2960f0d34 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -53,7 +53,7 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() _fillet_chamfer_position_numeric.set_increments(1,1); //todo: get tha max aloable infinity freeze the widget _fillet_chamfer_position_numeric.set_range(0., 999999999999999999.); - + _fillet_chamfer_position_label.set_label(_("Radius (pixels):")); _fillet_chamfer_position_label.set_alignment(1.0, 0.5); @@ -65,7 +65,7 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() _fillet_chamfer_chamfer_subdivisions.set_increments(1,1); //todo: get tha max aloable infinity freeze the widget _fillet_chamfer_chamfer_subdivisions.set_range(1, 4294967295); - + _fillet_chamfer_chamfer_subdivisions_label.set_label(_("Chamfer subdivisions:")); _fillet_chamfer_chamfer_subdivisions_label.set_alignment(1.0, 0.5); @@ -119,29 +119,29 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog() { - _set_desktop(NULL); + _setDesktop(NULL); } void FilletChamferPropertiesDialog::showDialog( - SPDesktop *desktop, double amount, + SPDesktop *desktop, double _amount, const Inkscape::LivePathEffect:: FilletChamferKnotHolderEntity *pt, - const gchar *unit, - bool use_distance, - bool aprox_radius, - Glib::ustring documentUnit, - Geom::Satellite satellite) + const gchar *_unit, + bool _use_distance, + bool _aprox_radius, + Glib::ustring _documentUnit, + Geom::Satellite _satellite) { FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog(); - dialog->_set_desktop(desktop); - dialog->_set_unit(unit); - dialog->_set_use_distance(use_distance); - dialog->_set_aprox(aprox_radius); - dialog->_set_document_unit(documentUnit); - dialog->_set_amount(amount); - dialog->_set_satellite(satellite); - dialog->_set_pt(pt); + dialog->_setDesktop(desktop); + dialog->_setUnit(_unit); + dialog->_setUseDistance(_use_distance); + dialog->_setAprox(_aprox_radius); + dialog->_setDocumentUnit(_documentUnit); + dialog->_setAmount(_amount); + dialog->_setSatellite(_satellite); + dialog->_setPt(pt); dialog->set_title(_("Modify Fillet-Chamfer")); dialog->_apply_button.set_label(_("_Modify")); @@ -156,7 +156,7 @@ void FilletChamferPropertiesDialog::showDialog( void FilletChamferPropertiesDialog::_apply() { - + double d_pos = _fillet_chamfer_position_numeric.get_value(); if (d_pos >= 0) { if (_fillet_chamfer_type_fillet.get_active() == true) { @@ -174,11 +174,11 @@ void FilletChamferPropertiesDialog::_apply() } d_pos = d_pos / 100; } else { - d_pos = Inkscape::Util::Quantity::convert(d_pos, unit, document_unit); + d_pos = Inkscape::Util::Quantity::convert(d_pos, _unit, _document_unit); } _satellite.amount = d_pos; size_t steps = (size_t)_fillet_chamfer_chamfer_subdivisions.get_value(); - if(steps < 1){ + if(steps < 1) { steps = 1; } _satellite.steps = steps; @@ -189,7 +189,7 @@ void FilletChamferPropertiesDialog::_apply() void FilletChamferPropertiesDialog::_close() { - _set_desktop(NULL); + _setDesktop(NULL); destroy_(); Glib::signal_idle().connect( sigc::bind_return( @@ -211,26 +211,26 @@ void FilletChamferPropertiesDialog::_handleButtonEvent(GdkEventButton *event) } } -void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) +void FilletChamferPropertiesDialog::_setSatellite(Geom::Satellite satellite) { double position; std::string distance_or_radius = std::string(_("Radius")); - if(aprox){ + if(_aprox) { distance_or_radius = std::string(_("Radius approximated")); } - if(use_distance){ + if(_use_distance) { distance_or_radius = std::string(_("Knot distance")); } if (satellite.isTime) { - position = amount * 100; + position = _amount * 100; _flexible = true; _fillet_chamfer_position_label.set_label(_("Position (%):")); } else { _flexible = false; - std::string posConcat = Glib::ustring::compose (_("%1 (%2):"), distance_or_radius, unit); + std::string posConcat = Glib::ustring::compose (_("%1 (%2):"), distance_or_radius, _unit); _fillet_chamfer_position_label.set_label(_(posConcat.c_str())); - position = amount; - position = Inkscape::Util::Quantity::convert(position, document_unit, unit); + position = _amount; + position = Inkscape::Util::Quantity::convert(position, _document_unit, _unit); } _fillet_chamfer_position_numeric.set_value(position); _fillet_chamfer_chamfer_subdivisions.set_value(satellite.steps); @@ -246,7 +246,7 @@ void FilletChamferPropertiesDialog::_set_satellite(Geom::Satellite satellite) _satellite = satellite; } -void FilletChamferPropertiesDialog::_set_pt( +void FilletChamferPropertiesDialog::_setPt( const Inkscape::LivePathEffect:: FilletChamferKnotHolderEntity *pt) { @@ -255,35 +255,35 @@ void FilletChamferPropertiesDialog::_set_pt( pt); } -void FilletChamferPropertiesDialog::_set_unit(const gchar *abbr) +void FilletChamferPropertiesDialog::_setUnit(const gchar *abbr) { - unit = abbr; + _unit = abbr; } -void FilletChamferPropertiesDialog::_set_amount(double amm) +void FilletChamferPropertiesDialog::_setAmount(double amm) { - amount = amm; + _amount = amm; } -void FilletChamferPropertiesDialog::_set_document_unit(Glib::ustring abbr) +void FilletChamferPropertiesDialog::_setDocumentUnit(Glib::ustring abbr) { - document_unit = abbr; + _document_unit = abbr; } -void FilletChamferPropertiesDialog::_set_use_distance(bool use_knot_distance) +void FilletChamferPropertiesDialog::_setUseDistance(bool use_knot_distance) { - use_distance = use_knot_distance; + _use_distance = use_knot_distance; } -void FilletChamferPropertiesDialog::_set_aprox(bool aprox_radius) +void FilletChamferPropertiesDialog::_setAprox(bool _aprox_radius) { - aprox = aprox_radius; + _aprox = _aprox_radius; } -void FilletChamferPropertiesDialog::_set_desktop(SPDesktop *desktop) +void FilletChamferPropertiesDialog::_setDesktop(SPDesktop *desktop) { if (desktop) { Inkscape::GC::anchor(desktop); diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index 1a40eea9b..51fc847c3 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -23,18 +23,19 @@ public: FilletChamferPropertiesDialog(); virtual ~FilletChamferPropertiesDialog(); - Glib::ustring getName() const { + Glib::ustring getName() const + { return "LayerPropertiesDialog"; } - static void showDialog(SPDesktop *desktop, double amount, + static void showDialog(SPDesktop *desktop, double _amount, const Inkscape::LivePathEffect:: FilletChamferKnotHolderEntity *pt, - const gchar *unit, - bool use_distance, - bool aprox_radius, - Glib::ustring documentUnit, - Geom::Satellite satellite); + const gchar *_unit, + bool _use_distance, + bool _aprox_radius, + Glib::ustring _documentUnit, + Geom::Satellite _satellite); protected: @@ -60,36 +61,39 @@ protected: sigc::connection _destroy_connection; - static FilletChamferPropertiesDialog &_instance() { + static FilletChamferPropertiesDialog &_instance() + { static FilletChamferPropertiesDialog instance; return instance; } - void _set_desktop(SPDesktop *desktop); - void _set_pt(const Inkscape::LivePathEffect:: + void _setDesktop(SPDesktop *desktop); + void _setPt(const Inkscape::LivePathEffect:: FilletChamferKnotHolderEntity *pt); - void _set_unit(const gchar *abbr); - void _set_document_unit(Glib::ustring abbr); - void _set_use_distance(bool use_knot_distance); - void _set_aprox(bool aprox_radius); + void _setUnit(const gchar *abbr); + void _setDocumentUnit(Glib::ustring abbr); + void _setUseDistance(bool use_knot_distance); + void _setAprox(bool aprox_radius); + void _setAmount(double amount); + void _setSatellite(Geom::Satellite satellite); + void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row); + + bool _handleKeyEvent(GdkEventKey *event); + void _handleButtonEvent(GdkEventButton *event); + void _apply(); void _close(); bool _flexible; Geom::Satellite _satellite; - const gchar *unit; - Glib::ustring document_unit; - bool use_distance; - double amount; - bool aprox; - void _set_amount(double amount); - void _set_satellite(Geom::Satellite satellite); - void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row); + const gchar *_unit; + Glib::ustring _document_unit; + bool _use_distance; + double _amount; + bool _aprox; - bool _handleKeyEvent(GdkEventKey *event); - void _handleButtonEvent(GdkEventButton *event); friend class Inkscape::LivePathEffect:: - FilletChamferKnotHolderEntity; + FilletChamferKnotHolderEntity; private: FilletChamferPropertiesDialog( -- cgit v1.2.3 From 04218b26ae0a10bf9e64721fb0dd789f024afca5 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 3 Apr 2015 16:10:46 +0200 Subject: Update pathinfo class to allow piecewise and pathvector as input. Add a method on pointwise to allow update if degenerated curves in new path, not noticed by piecewises (bzr r13645.1.72) --- src/ui/tool/multi-path-manipulator.cpp | 10 +++++----- src/ui/tool/path-manipulator.cpp | 7 ------- 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index f53cef5f4..8a8e4cb8a 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -330,20 +330,20 @@ void MultiPathManipulator::insertNodes() { if (_selection.empty()) return; invokeForAll(&PathManipulator::insertNodes); - _done(_("Add nodes")); + _done(_("Add nodes"), true); } void MultiPathManipulator::insertNodesAtExtrema(ExtremumType extremum) { if (_selection.empty()) return; invokeForAll(&PathManipulator::insertNodeAtExtremum, extremum); - _done(_("Add extremum nodes")); + _done(_("Add extremum nodes"), true); } void MultiPathManipulator::duplicateNodes() { if (_selection.empty()) return; invokeForAll(&PathManipulator::duplicateNodes); - _done(_("Duplicate nodes")); + _done(_("Duplicate nodes"), true); } void MultiPathManipulator::joinNodes() @@ -483,10 +483,10 @@ void MultiPathManipulator::reverseSubpaths() { if (_selection.empty()) { invokeForAll(&PathManipulator::reverseSubpaths, false); - _done("Reverse subpaths"); + _done("Reverse subpaths", true); } else { invokeForAll(&PathManipulator::reverseSubpaths, true); - _done("Reverse selected subpaths"); + _done("Reverse selected subpaths", true); } } diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index dbae69f2c..d50c3057b 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1356,13 +1356,6 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) lpe_pwr->adjustForNewPath(pathv); } } - thisEffect = _path->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER); - if(thisEffect){ - LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); - if (lpe_fll) { - lpe_fll->adjustForNewPath(pathv); - } - } } } -- cgit v1.2.3 From 6195a5fd157ff2681534aa90a279627e0048d4e1 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 10 May 2015 00:37:31 +0200 Subject: fixing review (bzr r13645.1.87) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 4 ++-- src/ui/dialog/lpe-fillet-chamfer-properties.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index bc6557b19..2b49d1952 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -123,7 +123,7 @@ void FilletChamferPropertiesDialog::showDialog( FilletChamferKnotHolderEntity *pt, bool _use_distance, bool _aprox_radius, - Geom::Satellite _satellite) + Satellite _satellite) { FilletChamferPropertiesDialog *dialog = new FilletChamferPropertiesDialog(); @@ -200,7 +200,7 @@ void FilletChamferPropertiesDialog::_handleButtonEvent(GdkEventButton *event) } } -void FilletChamferPropertiesDialog::_setSatellite(Geom::Satellite satellite) +void FilletChamferPropertiesDialog::_setSatellite(Satellite satellite) { double position; std::string distance_or_radius = std::string(_("Radius")); diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index 53bb90b80..f982db286 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -33,7 +33,7 @@ public: FilletChamferKnotHolderEntity *pt, bool _use_distance, bool _aprox_radius, - Geom::Satellite _satellite); + Satellite _satellite); protected: @@ -71,7 +71,7 @@ protected: void _setUseDistance(bool use_knot_distance); void _setAprox(bool aprox_radius); void _setAmount(double amount); - void _setSatellite(Geom::Satellite satellite); + void _setSatellite(Satellite satellite); void _prepareLabelRenderer(Gtk::TreeModel::const_iterator const &row); bool _handleKeyEvent(GdkEventKey *event); @@ -80,7 +80,7 @@ protected: void _apply(); void _close(); bool _flexible; - Geom::Satellite _satellite; + Satellite _satellite; bool _use_distance; double _amount; bool _aprox; -- cgit v1.2.3 From 870dbb0348163f55263eb9dca601d525d53a8d79 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 10 May 2015 13:40:31 +0200 Subject: Working on Krzysztof review. Seems to be all fixed. TODO: double check review and comment (bzr r13645.1.89) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 2b49d1952..f89668a4c 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -151,13 +151,13 @@ void FilletChamferPropertiesDialog::_apply() double d_pos = _fillet_chamfer_position_numeric.get_value(); if (d_pos >= 0) { if (_fillet_chamfer_type_fillet.get_active() == true) { - _satellite.satelliteType = Geom::F; + _satellite.satellite_type = FILLET; } else if (_fillet_chamfer_type_inverse_fillet.get_active() == true) { - _satellite.satelliteType = Geom::IF; + _satellite.satellite_type = INVERSE_FILLET; } else if (_fillet_chamfer_type_inverse_chamfer.get_active() == true) { - _satellite.satelliteType = Geom::IC; + _satellite.satellite_type = INVERSE_CHAMFER; } else { - _satellite.satelliteType = Geom::C; + _satellite.satellite_type = CHAMFER; } if (_flexible) { if (d_pos > 99.99999 || d_pos < 0) { @@ -210,7 +210,7 @@ void FilletChamferPropertiesDialog::_setSatellite(Satellite satellite) if(_use_distance) { distance_or_radius = std::string(_("Knot distance")); } - if (satellite.isTime) { + if (satellite.is_time) { position = _amount * 100; _flexible = true; _fillet_chamfer_position_label.set_label(_("Position (%):")); @@ -222,13 +222,13 @@ void FilletChamferPropertiesDialog::_setSatellite(Satellite satellite) } _fillet_chamfer_position_numeric.set_value(position); _fillet_chamfer_chamfer_subdivisions.set_value(satellite.steps); - if (satellite.satelliteType == Geom::F) { + if (satellite.satellite_type == FILLET) { _fillet_chamfer_type_fillet.set_active(true); - } else if (satellite.satelliteType == Geom::IF) { + } else if (satellite.satellite_type == INVERSE_FILLET) { _fillet_chamfer_type_inverse_fillet.set_active(true); - } else if (satellite.satelliteType == Geom::C) { + } else if (satellite.satellite_type == CHAMFER) { _fillet_chamfer_type_chamfer.set_active(true); - } else if (satellite.satelliteType == Geom::IC) { + } else if (satellite.satellite_type == INVERSE_CHAMFER) { _fillet_chamfer_type_inverse_chamfer.set_active(true); } _satellite = satellite; -- cgit v1.2.3 From 2a3581c9a5e6d18b3cd0ea2fe523063a116af8f8 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 2 May 2016 09:47:14 +0200 Subject: Working on clip erase basic work done but broken (bzr r14865.1.1) --- src/ui/tools/eraser-tool.cpp | 109 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 94 insertions(+), 15 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 6b32b5901..38e599c05 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -58,6 +58,8 @@ #include "sp-item-group.h" #include "sp-shape.h" #include "sp-path.h" +#include "sp-clippath.h" +#include "sp-rect.h" #include "sp-text.h" #include "display/canvas-bpath.h" #include "display/canvas-arena.h" @@ -69,6 +71,7 @@ #include <2geom/math-utils.h> #include <2geom/pathvector.h> #include "path-chemistry.h" +#include "selection-chemistry.h" #include "display/curve.h" #include "ui/tools/eraser-tool.h" @@ -380,7 +383,7 @@ void EraserTool::cancel() { bool EraserTool::root_handler(GdkEvent* event) { gint ret = FALSE; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - gint eraserMode = prefs->getBool("/tools/eraser/mode") ? 1 : 0; + gint eraser_mode = prefs->getInt("/tools/eraser/mode", 2); switch (event->type) { case GDK_BUTTON_PRESS: if (event->button.button == 1 && !this->space_panning) { @@ -400,7 +403,7 @@ bool EraserTool::root_handler(GdkEvent* event) { if (this->repr) { this->repr = NULL; } - if ( ! eraserMode ) { + if ( eraser_mode == 0 ) { Inkscape::Rubberband::get(desktop)->start(desktop, button_dt); Inkscape::Rubberband::get(desktop)->setMode(RUBBERBAND_MODE_TOUCHPATH); } @@ -448,7 +451,7 @@ bool EraserTool::root_handler(GdkEvent* event) { ret = TRUE; } - if ( !eraserMode ) { + if ( eraser_mode == 0 ) { this->accumulated->reset(); Inkscape::Rubberband::get(desktop)->move(motion_dt); } @@ -491,7 +494,7 @@ bool EraserTool::root_handler(GdkEvent* event) { ret = TRUE; } - if (!eraserMode && Inkscape::Rubberband::get(desktop)->is_started()) { + if (eraser_mode == 0 && Inkscape::Rubberband::get(desktop)->is_started()) { Inkscape::Rubberband::get(desktop)->stop(); } @@ -578,7 +581,7 @@ bool EraserTool::root_handler(GdkEvent* event) { break; case GDK_KEY_Escape: - if ( !eraserMode ) { + if ( eraser_mode == 0 ) { Inkscape::Rubberband::get(desktop)->stop(); } if (this->is_drawing) { @@ -640,7 +643,9 @@ void EraserTool::clear_current() { void EraserTool::set_to_accumulated() { bool workDone = false; - + SPDocument *document = this->desktop->doc(); +// bool has_undo_sensitive = DocumentUndo::getUndoSensitive(document); +// DocumentUndo::setUndoSensitive(document, false); if (!this->accumulated->is_empty()) { if (!this->repr) { /* Create object */ @@ -666,7 +671,7 @@ void EraserTool::set_to_accumulated() { bool wasSelection = false; Inkscape::Selection *selection = desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - gint eraserMode = prefs->getBool("/tools/eraser/mode") ? 1 : 0; + gint eraser_mode = prefs->getInt("/tools/eraser/mode", 2); Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); SPItem* acid = SP_ITEM(desktop->doc()->getObjectByRepr(this->repr)); @@ -674,7 +679,7 @@ void EraserTool::set_to_accumulated() { std::vector remainingItems; std::vector toWorkOn; if (selection->isEmpty()) { - if ( eraserMode ) { + if ( eraser_mode == 1 || eraser_mode == 2) { toWorkOn = desktop->getDocument()->getItemsPartiallyInBox(desktop->dkey, *eraserBbox); } else { Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); @@ -682,7 +687,7 @@ void EraserTool::set_to_accumulated() { } toWorkOn.erase(std::remove(toWorkOn.begin(), toWorkOn.end(), acid), toWorkOn.end()); } else { - if ( !eraserMode ) { + if ( eraser_mode == 0 ) { Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); std::vector touched; touched = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints()); @@ -698,7 +703,7 @@ void EraserTool::set_to_accumulated() { } if ( !toWorkOn.empty() ) { - if ( eraserMode ) { + if ( eraser_mode == 1 ) { for (std::vector::const_iterator i = toWorkOn.begin(); i != toWorkOn.end(); ++i){ SPItem *item = *i; SPUse *use = dynamic_cast(item); @@ -708,7 +713,6 @@ void EraserTool::set_to_accumulated() { item->deleteObject(true); sp_object_unref(item); workDone = true; - workDone = true; } else if (SP_IS_GROUP(item) || use ) { /*Do nothing*/ } else { @@ -755,6 +759,81 @@ void EraserTool::set_to_accumulated() { } } } + } else if ( eraser_mode == 2 ) { + for (std::vector::const_iterator i = toWorkOn.begin(); i != toWorkOn.end(); ++i){ + selection->clear(); + SPItem *item = *i; + Geom::OptRect bbox = item->desktopVisualBounds(); + Inkscape::XML::Document *xml_doc = this->desktop->doc()->getReprDoc(); + Inkscape::XML::Node *rect_repr = xml_doc->createElement("svg:rect"); + SPRect * rect = SP_RECT(this->desktop->currentLayer()->appendChildRepr(rect_repr)); + rect->updateRepr(); + rect->setPosition (bbox.min()[Geom::X], bbox.min()[Geom::Y], bbox.dimensions()[Geom::X], bbox.dimensions()[Geom::Y]); + rect->doWriteTransform(rect_repr, SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse() * this->desktop->dt2doc()); + Inkscape::GC::release(rect_repr); + + + Inkscape::XML::Node *rect_repr2 = xml_doc->createElement("svg:rect"); + SPRect * rect2 = SP_RECT(this->desktop->currentLayer()->appendChildRepr(rect_repr2)); + rect2->updateRepr(); + sp_desktop_apply_style_tool (desktop, rect_repr2, "/tools/shapes/rect", false); + rect2->setPosition (bbox->left(), bbox->top(), bbox->width(), bbox->height()); + rect->doWriteTransform(rect_repr, SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse() * this->desktop->dt2doc()); + Inkscape::GC::release(rect_repr2); + + + Inkscape::XML::Node *rect_repr3 = xml_doc->createElement("svg:rect"); + SPRect * rect3 = SP_RECT(this->desktop->currentLayer()->appendChildRepr(rect_repr3)); + rect3->updateRepr(); + sp_desktop_apply_style_tool (desktop, rect_repr3, "/tools/shapes/rect", false); + rect3->setPosition (bbox->left(), bbox->top(), bbox->width(), bbox->height()); + rect->doWriteTransform(rect_repr3, SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse() * this->desktop->doc2dt()); + Inkscape::GC::release(rect_repr3); + + + + + + Inkscape::XML::Node* dup = this->repr->duplicate(xml_doc); + this->repr->parent()->appendChild(dup); + Inkscape::GC::release(dup); // parent takes over + selection->set(dup); + sp_selected_path_union_skip_undo(selection, this->desktop); + sp_selection_raise_to_top(selection, this->desktop); + if (bbox && bbox->intersects(*eraserBbox)) { + SPClipPath *clip_path = item->clip_ref->getObject(); + if (clip_path) { + SPObject *clip_data = clip_path->firstChild(); + Inkscape::XML::Node *dup_clip = clip_data->getRepr()->duplicate(xml_doc); + if (dup_clip) { + this->repr->parent()->appendChild(dup_clip); + sp_object_ref(clip_data, 0); + clip_data->deleteObject(true); + sp_object_unref(clip_data); + sp_selection_raise_to_top(selection, this->desktop); + selection->add(dup_clip); + } + } else { + selection->add(rect); + } + sp_selected_path_diff_skip_undo(selection, this->desktop); + sp_selection_raise_to_top(selection, this->desktop); + selection->add(item); + sp_selection_set_mask(this->desktop, true, false); + } else { + SPItem *erase_clip = selection->singleItem(); + if (erase_clip) { + sp_object_ref(erase_clip, 0); + erase_clip->deleteObject(true); + sp_object_unref(erase_clip); + } + } + workDone = true; + } + selection->clear(); + if (wasSelection) { + selection->setList(toWorkOn); + } } else { for (std::vector ::const_iterator i = toWorkOn.begin();i!=toWorkOn.end();++i) { sp_object_ref( *i, 0 ); @@ -768,7 +847,7 @@ void EraserTool::set_to_accumulated() { } } - if ( !eraserMode ) { + if ( eraser_mode == 0 ) { //sp_selection_delete(desktop); remainingItems.clear(); } @@ -792,7 +871,7 @@ void EraserTool::set_to_accumulated() { } } - +// DocumentUndo::setUndoSensitive(document, has_undo_sensitive); if ( workDone ) { DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke")); } else { @@ -987,7 +1066,7 @@ void EraserTool::fit_and_split(bool release) { g_print("[%d]Yup\n", this->npoints); #endif if (!release) { - gint eraserMode = prefs->getBool("/tools/eraser/mode") ? 1 : 0; + gint eraser_mode = prefs->getInt("/tools/eraser/mode",2); g_assert(!this->currentcurve->is_empty()); SPCanvasItem *cbp = sp_canvas_item_new(desktop->getSketch(), SP_TYPE_CANVAS_BPATH, NULL); @@ -1009,7 +1088,7 @@ void EraserTool::fit_and_split(bool release) { this->segments = g_slist_prepend(this->segments, cbp); - if ( !eraserMode ) { + if ( eraser_mode == 0 ) { sp_canvas_item_hide(cbp); sp_canvas_item_hide(this->currentshape); } -- cgit v1.2.3 From c425407979c2eca1a6fe6858923619de18c8d058 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 6 May 2016 22:56:57 +0200 Subject: Finishing eraser tool. TODO undo work (bzr r14865.1.2) --- src/ui/tools/eraser-tool.cpp | 90 ++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 45 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 38e599c05..f1c7306b4 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -644,8 +644,6 @@ void EraserTool::clear_current() { void EraserTool::set_to_accumulated() { bool workDone = false; SPDocument *document = this->desktop->doc(); -// bool has_undo_sensitive = DocumentUndo::getUndoSensitive(document); -// DocumentUndo::setUndoSensitive(document, false); if (!this->accumulated->is_empty()) { if (!this->repr) { /* Create object */ @@ -657,11 +655,11 @@ void EraserTool::set_to_accumulated() { this->repr = repr; } - SPItem *item = SP_ITEM(desktop->currentLayer()->appendChildRepr(this->repr)); + SPItem *item_repr = SP_ITEM(desktop->currentLayer()->appendChildRepr(this->repr)); Inkscape::GC::release(this->repr); - item->updateRepr(); + item_repr->updateRepr(); Geom::PathVector pathv = this->accumulated->get_pathvector() * desktop->dt2doc(); - pathv *= item->i2doc_affine().inverse(); + pathv *= item_repr->i2doc_affine().inverse(); gchar *str = sp_svg_write_path(pathv); g_assert( str != NULL ); this->repr->setAttribute("d", str); @@ -760,66 +758,68 @@ void EraserTool::set_to_accumulated() { } } } else if ( eraser_mode == 2 ) { + remainingItems.clear(); for (std::vector::const_iterator i = toWorkOn.begin(); i != toWorkOn.end(); ++i){ selection->clear(); + size_t n_undo = 0; SPItem *item = *i; Geom::OptRect bbox = item->desktopVisualBounds(); Inkscape::XML::Document *xml_doc = this->desktop->doc()->getReprDoc(); Inkscape::XML::Node *rect_repr = xml_doc->createElement("svg:rect"); + sp_desktop_apply_style_tool (desktop, rect_repr, "/tools/eraser", false); SPRect * rect = SP_RECT(this->desktop->currentLayer()->appendChildRepr(rect_repr)); - rect->updateRepr(); - rect->setPosition (bbox.min()[Geom::X], bbox.min()[Geom::Y], bbox.dimensions()[Geom::X], bbox.dimensions()[Geom::Y]); - rect->doWriteTransform(rect_repr, SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse() * this->desktop->dt2doc()); Inkscape::GC::release(rect_repr); - - Inkscape::XML::Node *rect_repr2 = xml_doc->createElement("svg:rect"); - SPRect * rect2 = SP_RECT(this->desktop->currentLayer()->appendChildRepr(rect_repr2)); - rect2->updateRepr(); - sp_desktop_apply_style_tool (desktop, rect_repr2, "/tools/shapes/rect", false); - rect2->setPosition (bbox->left(), bbox->top(), bbox->width(), bbox->height()); - rect->doWriteTransform(rect_repr, SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse() * this->desktop->dt2doc()); - Inkscape::GC::release(rect_repr2); - - - Inkscape::XML::Node *rect_repr3 = xml_doc->createElement("svg:rect"); - SPRect * rect3 = SP_RECT(this->desktop->currentLayer()->appendChildRepr(rect_repr3)); - rect3->updateRepr(); - sp_desktop_apply_style_tool (desktop, rect_repr3, "/tools/shapes/rect", false); - rect3->setPosition (bbox->left(), bbox->top(), bbox->width(), bbox->height()); - rect->doWriteTransform(rect_repr3, SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse() * this->desktop->doc2dt()); - Inkscape::GC::release(rect_repr3); - - - - - + rect->updateRepr(); + rect->setPosition (bbox->left(), bbox->top(), bbox->width(), bbox->height()); + rect->transform = SP_ITEM(desktop->currentLayer())->i2dt_affine().inverse(); + Inkscape::XML::Node* dup = this->repr->duplicate(xml_doc); this->repr->parent()->appendChild(dup); Inkscape::GC::release(dup); // parent takes over selection->set(dup); sp_selected_path_union_skip_undo(selection, this->desktop); sp_selection_raise_to_top(selection, this->desktop); + n_undo++; if (bbox && bbox->intersects(*eraserBbox)) { SPClipPath *clip_path = item->clip_ref->getObject(); if (clip_path) { - SPObject *clip_data = clip_path->firstChild(); - Inkscape::XML::Node *dup_clip = clip_data->getRepr()->duplicate(xml_doc); - if (dup_clip) { - this->repr->parent()->appendChild(dup_clip); - sp_object_ref(clip_data, 0); - clip_data->deleteObject(true); - sp_object_unref(clip_data); - sp_selection_raise_to_top(selection, this->desktop); - selection->add(dup_clip); + SPPath *clip_data = SP_PATH(clip_path->firstChild()); + if (clip_data) { + Inkscape::XML::Node *dup_clip = SP_OBJECT(clip_data)->getRepr()->duplicate(xml_doc); + if (dup_clip) { + SPItem * dup_clip_obj = SP_ITEM(item_repr->parent->appendChildRepr(dup_clip)); + if (dup_clip_obj) { + dup_clip_obj->doWriteTransform(dup_clip, item->transform); + sp_object_ref(clip_data, 0); + clip_data->deleteObject(true); + sp_object_unref(clip_data); + sp_object_ref(clip_path, 0); + clip_path->deleteObject(true); + sp_object_unref(clip_path); + sp_object_ref(rect, 0); + rect->deleteObject(true); + sp_object_unref(rect); + sp_selection_raise_to_top(selection, this->desktop); + n_undo++; + selection->add(dup_clip); + sp_selected_path_diff_skip_undo(selection, this->desktop); + n_undo++; + SPItem * clip = SP_ITEM(selection->itemList()[0]); + } + } } } else { selection->add(rect); + sp_selected_path_diff_skip_undo(selection, this->desktop); + n_undo++; } - sp_selected_path_diff_skip_undo(selection, this->desktop); sp_selection_raise_to_top(selection, this->desktop); + n_undo++; selection->add(item); sp_selection_set_mask(this->desktop, true, false); + n_undo++; + DocumentUndo::clearUndo(document, n_undo); } else { SPItem *erase_clip = selection->singleItem(); if (erase_clip) { @@ -829,11 +829,12 @@ void EraserTool::set_to_accumulated() { } } workDone = true; + selection->clear(); + if (wasSelection) { + remainingItems.push_back(item); + } } - selection->clear(); - if (wasSelection) { - selection->setList(toWorkOn); - } + } else { for (std::vector ::const_iterator i = toWorkOn.begin();i!=toWorkOn.end();++i) { sp_object_ref( *i, 0 ); @@ -871,7 +872,6 @@ void EraserTool::set_to_accumulated() { } } -// DocumentUndo::setUndoSensitive(document, has_undo_sensitive); if ( workDone ) { DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke")); } else { -- cgit v1.2.3 From 72610e6bbd79b3a3e9a980980ebc2f533ea8056d Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 7 May 2016 01:37:50 +0200 Subject: working on undo (bzr r14865.1.4) --- src/ui/tools/eraser-tool.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index f1c7306b4..b62f68a5f 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -721,7 +721,7 @@ void EraserTool::set_to_accumulated() { Inkscape::GC::release(dup); // parent takes over selection->set(dup); if (!this->nowidth) { - sp_selected_path_union_skip_undo(selection, desktop); + sp_selected_path_union(selection, desktop); } selection->add(item); if(item->style->fill_rule.value == SP_WIND_RULE_EVENODD){ @@ -732,9 +732,9 @@ void EraserTool::set_to_accumulated() { css = 0; } if (this->nowidth) { - sp_selected_path_cut_skip_undo(selection, desktop); + sp_selected_path_cut(selection, desktop); } else { - sp_selected_path_diff_skip_undo(selection, desktop); + sp_selected_path_diff(selection, desktop); } workDone = true; // TODO set this only if something was cut. bool break_apart = prefs->getBool("/tools/eraser/break_apart", false); @@ -761,7 +761,6 @@ void EraserTool::set_to_accumulated() { remainingItems.clear(); for (std::vector::const_iterator i = toWorkOn.begin(); i != toWorkOn.end(); ++i){ selection->clear(); - size_t n_undo = 0; SPItem *item = *i; Geom::OptRect bbox = item->desktopVisualBounds(); Inkscape::XML::Document *xml_doc = this->desktop->doc()->getReprDoc(); @@ -778,9 +777,8 @@ void EraserTool::set_to_accumulated() { this->repr->parent()->appendChild(dup); Inkscape::GC::release(dup); // parent takes over selection->set(dup); - sp_selected_path_union_skip_undo(selection, this->desktop); + sp_selected_path_union(selection, this->desktop); sp_selection_raise_to_top(selection, this->desktop); - n_undo++; if (bbox && bbox->intersects(*eraserBbox)) { SPClipPath *clip_path = item->clip_ref->getObject(); if (clip_path) { @@ -801,25 +799,19 @@ void EraserTool::set_to_accumulated() { rect->deleteObject(true); sp_object_unref(rect); sp_selection_raise_to_top(selection, this->desktop); - n_undo++; selection->add(dup_clip); - sp_selected_path_diff_skip_undo(selection, this->desktop); - n_undo++; + sp_selected_path_diff(selection, this->desktop); SPItem * clip = SP_ITEM(selection->itemList()[0]); } } } } else { selection->add(rect); - sp_selected_path_diff_skip_undo(selection, this->desktop); - n_undo++; + sp_selected_path_diff(selection, this->desktop); } sp_selection_raise_to_top(selection, this->desktop); - n_undo++; selection->add(item); sp_selection_set_mask(this->desktop, true, false); - n_undo++; - DocumentUndo::clearUndo(document, n_undo); } else { SPItem *erase_clip = selection->singleItem(); if (erase_clip) { @@ -871,7 +863,6 @@ void EraserTool::set_to_accumulated() { this->repr = 0; } } - if ( workDone ) { DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke")); } else { -- cgit v1.2.3 From 07717a370b8efe6ddbb0c69d115bb063a2e7686a Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 10 May 2016 23:16:49 +0200 Subject: Working with path updates (bzr r13645.1.130) --- src/ui/dialog/lpe-fillet-chamfer-properties.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.h b/src/ui/dialog/lpe-fillet-chamfer-properties.h index f982db286..105cafe68 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.h +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.h @@ -10,7 +10,7 @@ #include <2geom/point.h> #include -#include "live_effects/parameter/satellitearray.h" +#include "live_effects/parameter/satellitesarray.h" class SPDesktop; -- cgit v1.2.3 From 159439c26042b7c69aa9c33ce9484e4dfd00372a Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 15 May 2016 11:48:51 +0200 Subject: Fixing pointwise (bzr r13645.1.137) --- src/ui/tool/multi-path-manipulator.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 857f954ce..9ec6f733f 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -330,13 +330,13 @@ void MultiPathManipulator::insertNodes() { if (_selection.empty()) return; invokeForAll(&PathManipulator::insertNodes); - _done(_("Add nodes"), true); + _done(_("Add nodes")); } void MultiPathManipulator::insertNodesAtExtrema(ExtremumType extremum) { if (_selection.empty()) return; invokeForAll(&PathManipulator::insertNodeAtExtremum, extremum); - _done(_("Add extremum nodes"), true); + _done(_("Add extremum nodes")); } void MultiPathManipulator::insertNode(Geom::Point pt) @@ -351,7 +351,7 @@ void MultiPathManipulator::duplicateNodes() { if (_selection.empty()) return; invokeForAll(&PathManipulator::duplicateNodes); - _done(_("Duplicate nodes"), true); + _done(_("Duplicate nodes")); } void MultiPathManipulator::joinNodes() @@ -491,10 +491,10 @@ void MultiPathManipulator::reverseSubpaths() { if (_selection.empty()) { invokeForAll(&PathManipulator::reverseSubpaths, false); - _done("Reverse subpaths", true); + _done("Reverse subpaths"); } else { invokeForAll(&PathManipulator::reverseSubpaths, true); - _done("Reverse selected subpaths", true); + _done("Reverse selected subpaths"); } } -- cgit v1.2.3 From 2d2718e48ee56f975342f0329b98f892f118d85e Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 22 May 2016 00:03:52 +0200 Subject: Fixing undo thing (bzr r14865.1.5) --- src/ui/tools/eraser-tool.cpp | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index b62f68a5f..60b8c2792 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -644,6 +644,8 @@ void EraserTool::clear_current() { void EraserTool::set_to_accumulated() { bool workDone = false; SPDocument *document = this->desktop->doc(); + bool saved = DocumentUndo::getUndoSensitive(document); + DocumentUndo::setUndoSensitive(document, false); if (!this->accumulated->is_empty()) { if (!this->repr) { /* Create object */ @@ -721,7 +723,9 @@ void EraserTool::set_to_accumulated() { Inkscape::GC::release(dup); // parent takes over selection->set(dup); if (!this->nowidth) { - sp_selected_path_union(selection, desktop); + DocumentUndo::setUndoSensitive(document, saved); + sp_selected_path_union_skip_undo(selection, desktop); + DocumentUndo::setUndoSensitive(document, false); } selection->add(item); if(item->style->fill_rule.value == SP_WIND_RULE_EVENODD){ @@ -731,13 +735,16 @@ void EraserTool::set_to_accumulated() { sp_repr_css_attr_unref(css); css = 0; } + DocumentUndo::setUndoSensitive(document, saved); if (this->nowidth) { - sp_selected_path_cut(selection, desktop); + sp_selected_path_cut_skip_undo(selection, desktop); } else { - sp_selected_path_diff(selection, desktop); + sp_selected_path_diff_skip_undo(selection, desktop); } + DocumentUndo::setUndoSensitive(document, saved); workDone = true; // TODO set this only if something was cut. bool break_apart = prefs->getBool("/tools/eraser/break_apart", false); + DocumentUndo::setUndoSensitive(document, saved); if(!break_apart){ sp_selected_path_combine(desktop, true); } else { @@ -745,6 +752,7 @@ void EraserTool::set_to_accumulated() { sp_selected_path_break_apart(desktop, true); } } + DocumentUndo::setUndoSensitive(document, saved); if ( !selection->isEmpty() ) { // If the item was not completely erased, track the new remainder. std::vector nowSel(selection->itemList()); @@ -777,7 +785,9 @@ void EraserTool::set_to_accumulated() { this->repr->parent()->appendChild(dup); Inkscape::GC::release(dup); // parent takes over selection->set(dup); - sp_selected_path_union(selection, this->desktop); + DocumentUndo::setUndoSensitive(document, saved); + sp_selected_path_union_skip_undo(selection, this->desktop); + DocumentUndo::setUndoSensitive(document, false); sp_selection_raise_to_top(selection, this->desktop); if (bbox && bbox->intersects(*eraserBbox)) { SPClipPath *clip_path = item->clip_ref->getObject(); @@ -800,14 +810,19 @@ void EraserTool::set_to_accumulated() { sp_object_unref(rect); sp_selection_raise_to_top(selection, this->desktop); selection->add(dup_clip); - sp_selected_path_diff(selection, this->desktop); + DocumentUndo::setUndoSensitive(document, saved); + sp_selected_path_diff_skip_undo(selection, this->desktop); + DocumentUndo::setUndoSensitive(document, saved); SPItem * clip = SP_ITEM(selection->itemList()[0]); + DocumentUndo::setUndoSensitive(document, false); } } } } else { selection->add(rect); - sp_selected_path_diff(selection, this->desktop); + DocumentUndo::setUndoSensitive(document, saved); + sp_selected_path_diff_skip_undo(selection, this->desktop); + DocumentUndo::setUndoSensitive(document, false); } sp_selection_raise_to_top(selection, this->desktop); selection->add(item); @@ -863,6 +878,8 @@ void EraserTool::set_to_accumulated() { this->repr = 0; } } + document->setModifiedSinceSave(); + DocumentUndo::setUndoSensitive(document, saved); if ( workDone ) { DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke")); } else { -- cgit v1.2.3 From 3fcae9b041aae2e79732277cbcd20fc13a92d453 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 22 May 2016 00:13:36 +0200 Subject: Fixing undo thing (bzr r14865.1.7) --- src/ui/tools/eraser-tool.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 60b8c2792..2896e7b3e 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -723,10 +723,8 @@ void EraserTool::set_to_accumulated() { Inkscape::GC::release(dup); // parent takes over selection->set(dup); if (!this->nowidth) { - DocumentUndo::setUndoSensitive(document, saved); sp_selected_path_union_skip_undo(selection, desktop); - DocumentUndo::setUndoSensitive(document, false); - } + } selection->add(item); if(item->style->fill_rule.value == SP_WIND_RULE_EVENODD){ SPCSSAttr *css = sp_repr_css_attr_new(); @@ -735,16 +733,13 @@ void EraserTool::set_to_accumulated() { sp_repr_css_attr_unref(css); css = 0; } - DocumentUndo::setUndoSensitive(document, saved); if (this->nowidth) { sp_selected_path_cut_skip_undo(selection, desktop); } else { sp_selected_path_diff_skip_undo(selection, desktop); } - DocumentUndo::setUndoSensitive(document, saved); workDone = true; // TODO set this only if something was cut. bool break_apart = prefs->getBool("/tools/eraser/break_apart", false); - DocumentUndo::setUndoSensitive(document, saved); if(!break_apart){ sp_selected_path_combine(desktop, true); } else { @@ -752,7 +747,6 @@ void EraserTool::set_to_accumulated() { sp_selected_path_break_apart(desktop, true); } } - DocumentUndo::setUndoSensitive(document, saved); if ( !selection->isEmpty() ) { // If the item was not completely erased, track the new remainder. std::vector nowSel(selection->itemList()); @@ -785,10 +779,8 @@ void EraserTool::set_to_accumulated() { this->repr->parent()->appendChild(dup); Inkscape::GC::release(dup); // parent takes over selection->set(dup); - DocumentUndo::setUndoSensitive(document, saved); sp_selected_path_union_skip_undo(selection, this->desktop); - DocumentUndo::setUndoSensitive(document, false); - sp_selection_raise_to_top(selection, this->desktop); + sp_selection_raise_to_top(selection, this->desktop, true); if (bbox && bbox->intersects(*eraserBbox)) { SPClipPath *clip_path = item->clip_ref->getObject(); if (clip_path) { @@ -808,23 +800,18 @@ void EraserTool::set_to_accumulated() { sp_object_ref(rect, 0); rect->deleteObject(true); sp_object_unref(rect); - sp_selection_raise_to_top(selection, this->desktop); + sp_selection_raise_to_top(selection, this->desktop, true); selection->add(dup_clip); - DocumentUndo::setUndoSensitive(document, saved); sp_selected_path_diff_skip_undo(selection, this->desktop); - DocumentUndo::setUndoSensitive(document, saved); SPItem * clip = SP_ITEM(selection->itemList()[0]); - DocumentUndo::setUndoSensitive(document, false); } } } } else { selection->add(rect); - DocumentUndo::setUndoSensitive(document, saved); sp_selected_path_diff_skip_undo(selection, this->desktop); - DocumentUndo::setUndoSensitive(document, false); } - sp_selection_raise_to_top(selection, this->desktop); + sp_selection_raise_to_top(selection, this->desktop, true); selection->add(item); sp_selection_set_mask(this->desktop, true, false); } else { -- cgit v1.2.3 From e2f3d8631f30db820029835ecc6cdc68d339cdc0 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 22 May 2016 01:33:30 +0200 Subject: Working undo (bzr r14865.1.8) --- src/ui/tools/eraser-tool.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 2896e7b3e..40e13a9cd 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -644,8 +644,6 @@ void EraserTool::clear_current() { void EraserTool::set_to_accumulated() { bool workDone = false; SPDocument *document = this->desktop->doc(); - bool saved = DocumentUndo::getUndoSensitive(document); - DocumentUndo::setUndoSensitive(document, false); if (!this->accumulated->is_empty()) { if (!this->repr) { /* Create object */ @@ -680,17 +678,17 @@ void EraserTool::set_to_accumulated() { std::vector toWorkOn; if (selection->isEmpty()) { if ( eraser_mode == 1 || eraser_mode == 2) { - toWorkOn = desktop->getDocument()->getItemsPartiallyInBox(desktop->dkey, *eraserBbox); + toWorkOn = document->getItemsPartiallyInBox(desktop->dkey, *eraserBbox); } else { Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); - toWorkOn = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints()); + toWorkOn = document->getItemsAtPoints(desktop->dkey, r->getPoints()); } toWorkOn.erase(std::remove(toWorkOn.begin(), toWorkOn.end(), acid), toWorkOn.end()); } else { if ( eraser_mode == 0 ) { Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); std::vector touched; - touched = desktop->getDocument()->getItemsAtPoints(desktop->dkey, r->getPoints()); + touched = document->getItemsAtPoints(desktop->dkey, r->getPoints()); for (std::vector::const_iterator i = touched.begin();i!=touched.end();++i) { if(selection->includes(*i)){ toWorkOn.push_back((*i)); @@ -779,8 +777,8 @@ void EraserTool::set_to_accumulated() { this->repr->parent()->appendChild(dup); Inkscape::GC::release(dup); // parent takes over selection->set(dup); - sp_selected_path_union_skip_undo(selection, this->desktop); - sp_selection_raise_to_top(selection, this->desktop, true); + sp_selected_path_union_skip_undo(selection, desktop); + sp_selection_raise_to_top(selection, desktop, true); if (bbox && bbox->intersects(*eraserBbox)) { SPClipPath *clip_path = item->clip_ref->getObject(); if (clip_path) { @@ -800,20 +798,21 @@ void EraserTool::set_to_accumulated() { sp_object_ref(rect, 0); rect->deleteObject(true); sp_object_unref(rect); - sp_selection_raise_to_top(selection, this->desktop, true); + sp_selection_raise_to_top(selection, desktop, true); selection->add(dup_clip); - sp_selected_path_diff_skip_undo(selection, this->desktop); + sp_selected_path_diff_skip_undo(selection, desktop); SPItem * clip = SP_ITEM(selection->itemList()[0]); } } } } else { selection->add(rect); - sp_selected_path_diff_skip_undo(selection, this->desktop); + std::cout << "asasgfasfasfasfasfasf\n"; + sp_selected_path_diff_skip_undo(selection, desktop); } - sp_selection_raise_to_top(selection, this->desktop, true); + sp_selection_raise_to_top(selection, desktop, true); selection->add(item); - sp_selection_set_mask(this->desktop, true, false); + sp_selection_set_mask(desktop, true, false, true); } else { SPItem *erase_clip = selection->singleItem(); if (erase_clip) { @@ -843,7 +842,7 @@ void EraserTool::set_to_accumulated() { } if ( eraser_mode == 0 ) { - //sp_selection_delete(desktop); + sp_selection_delete(desktop); remainingItems.clear(); } @@ -865,12 +864,10 @@ void EraserTool::set_to_accumulated() { this->repr = 0; } } - document->setModifiedSinceSave(); - DocumentUndo::setUndoSensitive(document, saved); if ( workDone ) { - DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke")); + DocumentUndo::done(document, SP_VERB_CONTEXT_ERASER, _("Draw eraser stroke")); } else { - DocumentUndo::cancel(desktop->getDocument()); + DocumentUndo::cancel(document); } } -- cgit v1.2.3 From 331336b5f924ad3200a343f571178e19b55532a1 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 22 May 2016 04:13:59 +0200 Subject: Clip eraser done! Thanks Doctormon! (bzr r14865.1.9) --- src/ui/tools/eraser-tool.cpp | 165 +++++++++++++++++++++---------------------- 1 file changed, 82 insertions(+), 83 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 40e13a9cd..c5a068dfc 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -647,48 +647,48 @@ void EraserTool::set_to_accumulated() { if (!this->accumulated->is_empty()) { if (!this->repr) { /* Create object */ - Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); + Inkscape::XML::Document *xml_doc = this->desktop->doc()->getReprDoc(); Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); /* Set style */ - sp_desktop_apply_style_tool (desktop, repr, "/tools/eraser", false); + sp_desktop_apply_style_tool (this->desktop, repr, "/tools/eraser", false); this->repr = repr; } - SPItem *item_repr = SP_ITEM(desktop->currentLayer()->appendChildRepr(this->repr)); + SPItem *item_repr = SP_ITEM(this->desktop->currentLayer()->appendChildRepr(this->repr)); Inkscape::GC::release(this->repr); item_repr->updateRepr(); - Geom::PathVector pathv = this->accumulated->get_pathvector() * desktop->dt2doc(); + Geom::PathVector pathv = this->accumulated->get_pathvector() * this->desktop->dt2doc(); pathv *= item_repr->i2doc_affine().inverse(); gchar *str = sp_svg_write_path(pathv); g_assert( str != NULL ); this->repr->setAttribute("d", str); g_free(str); - + Geom::OptRect eraserBbox; if ( this->repr ) { bool wasSelection = false; - Inkscape::Selection *selection = desktop->getSelection(); + Inkscape::Selection *selection = this->desktop->getSelection(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gint eraser_mode = prefs->getInt("/tools/eraser/mode", 2); - Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); + Inkscape::XML::Document *xml_doc = this->desktop->doc()->getReprDoc(); - SPItem* acid = SP_ITEM(desktop->doc()->getObjectByRepr(this->repr)); - Geom::OptRect eraserBbox = acid->desktopVisualBounds(); + SPItem* acid = SP_ITEM(this->desktop->doc()->getObjectByRepr(this->repr)); + eraserBbox = acid->desktopVisualBounds(); std::vector remainingItems; std::vector toWorkOn; if (selection->isEmpty()) { if ( eraser_mode == 1 || eraser_mode == 2) { - toWorkOn = document->getItemsPartiallyInBox(desktop->dkey, *eraserBbox); + toWorkOn = document->getItemsPartiallyInBox(this->desktop->dkey, *eraserBbox); } else { - Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); - toWorkOn = document->getItemsAtPoints(desktop->dkey, r->getPoints()); + Inkscape::Rubberband *r = Inkscape::Rubberband::get(this->desktop); + toWorkOn = document->getItemsAtPoints(this->desktop->dkey, r->getPoints()); } toWorkOn.erase(std::remove(toWorkOn.begin(), toWorkOn.end(), acid), toWorkOn.end()); } else { if ( eraser_mode == 0 ) { - Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); + Inkscape::Rubberband *r = Inkscape::Rubberband::get(this->desktop); std::vector touched; - touched = document->getItemsAtPoints(desktop->dkey, r->getPoints()); + touched = document->getItemsAtPoints(this->desktop->dkey, r->getPoints()); for (std::vector::const_iterator i = touched.begin();i!=touched.end();++i) { if(selection->includes(*i)){ toWorkOn.push_back((*i)); @@ -721,28 +721,28 @@ void EraserTool::set_to_accumulated() { Inkscape::GC::release(dup); // parent takes over selection->set(dup); if (!this->nowidth) { - sp_selected_path_union_skip_undo(selection, desktop); + sp_selected_path_union_skip_undo(selection, this->desktop); } selection->add(item); if(item->style->fill_rule.value == SP_WIND_RULE_EVENODD){ SPCSSAttr *css = sp_repr_css_attr_new(); sp_repr_css_set_property(css, "fill-rule", "evenodd"); - sp_desktop_set_style(desktop, css); + sp_desktop_set_style(this->desktop, css); sp_repr_css_attr_unref(css); css = 0; } if (this->nowidth) { - sp_selected_path_cut_skip_undo(selection, desktop); + sp_selected_path_cut_skip_undo(selection, this->desktop); } else { - sp_selected_path_diff_skip_undo(selection, desktop); + sp_selected_path_diff_skip_undo(selection, this->desktop); } workDone = true; // TODO set this only if something was cut. bool break_apart = prefs->getBool("/tools/eraser/break_apart", false); if(!break_apart){ - sp_selected_path_combine(desktop, true); + sp_selected_path_combine(this->desktop, true); } else { if(!this->nowidth){ - sp_selected_path_break_apart(desktop, true); + sp_selected_path_break_apart(this->desktop, true); } } if ( !selection->isEmpty() ) { @@ -758,76 +758,75 @@ void EraserTool::set_to_accumulated() { } } } else if ( eraser_mode == 2 ) { - remainingItems.clear(); - for (std::vector::const_iterator i = toWorkOn.begin(); i != toWorkOn.end(); ++i){ - selection->clear(); - SPItem *item = *i; - Geom::OptRect bbox = item->desktopVisualBounds(); - Inkscape::XML::Document *xml_doc = this->desktop->doc()->getReprDoc(); - Inkscape::XML::Node *rect_repr = xml_doc->createElement("svg:rect"); - sp_desktop_apply_style_tool (desktop, rect_repr, "/tools/eraser", false); - SPRect * rect = SP_RECT(this->desktop->currentLayer()->appendChildRepr(rect_repr)); - Inkscape::GC::release(rect_repr); - - rect->updateRepr(); - rect->setPosition (bbox->left(), bbox->top(), bbox->width(), bbox->height()); - rect->transform = SP_ITEM(desktop->currentLayer())->i2dt_affine().inverse(); - - Inkscape::XML::Node* dup = this->repr->duplicate(xml_doc); - this->repr->parent()->appendChild(dup); - Inkscape::GC::release(dup); // parent takes over - selection->set(dup); - sp_selected_path_union_skip_undo(selection, desktop); - sp_selection_raise_to_top(selection, desktop, true); - if (bbox && bbox->intersects(*eraserBbox)) { - SPClipPath *clip_path = item->clip_ref->getObject(); - if (clip_path) { - SPPath *clip_data = SP_PATH(clip_path->firstChild()); - if (clip_data) { - Inkscape::XML::Node *dup_clip = SP_OBJECT(clip_data)->getRepr()->duplicate(xml_doc); - if (dup_clip) { - SPItem * dup_clip_obj = SP_ITEM(item_repr->parent->appendChildRepr(dup_clip)); - if (dup_clip_obj) { - dup_clip_obj->doWriteTransform(dup_clip, item->transform); - sp_object_ref(clip_data, 0); - clip_data->deleteObject(true); - sp_object_unref(clip_data); - sp_object_ref(clip_path, 0); - clip_path->deleteObject(true); - sp_object_unref(clip_path); - sp_object_ref(rect, 0); - rect->deleteObject(true); - sp_object_unref(rect); - sp_selection_raise_to_top(selection, desktop, true); - selection->add(dup_clip); - sp_selected_path_diff_skip_undo(selection, desktop); - SPItem * clip = SP_ITEM(selection->itemList()[0]); + if (!this->nowidth) { + remainingItems.clear(); + for (std::vector::const_iterator i = toWorkOn.begin(); i != toWorkOn.end(); ++i){ + selection->clear(); + SPItem *item = *i; + Geom::OptRect bbox = item->desktopVisualBounds(); + Inkscape::XML::Document *xml_doc = this->desktop->doc()->getReprDoc(); + Inkscape::XML::Node *rect_repr = xml_doc->createElement("svg:rect"); + sp_desktop_apply_style_tool (this->desktop, rect_repr, "/tools/eraser", false); + SPRect * rect = SP_RECT(this->desktop->currentLayer()->appendChildRepr(rect_repr)); + Inkscape::GC::release(rect_repr); + rect->setPosition (bbox->left(), bbox->top(), bbox->width(), bbox->height()); + rect->transform = SP_ITEM(this->desktop->currentLayer())->i2dt_affine().inverse(); + rect->updateRepr(); + this->desktop->canvas->endForcedFullRedraws(); + Inkscape::XML::Node* dup = this->repr->duplicate(xml_doc); + this->repr->parent()->appendChild(dup); + Inkscape::GC::release(dup); // parent takes over + selection->set(dup); + sp_selected_path_union_skip_undo(selection, this->desktop); + sp_selection_raise_to_top(selection, this->desktop, true); + if (bbox && bbox->intersects(*eraserBbox)) { + SPClipPath *clip_path = item->clip_ref->getObject(); + if (clip_path) { + SPPath *clip_data = SP_PATH(clip_path->firstChild()); + if (clip_data) { + Inkscape::XML::Node *dup_clip = SP_OBJECT(clip_data)->getRepr()->duplicate(xml_doc); + if (dup_clip) { + SPItem * dup_clip_obj = SP_ITEM(item_repr->parent->appendChildRepr(dup_clip)); + if (dup_clip_obj) { + dup_clip_obj->doWriteTransform(dup_clip, item->transform); + sp_object_ref(clip_data, 0); + clip_data->deleteObject(true); + sp_object_unref(clip_data); + sp_object_ref(clip_path, 0); + clip_path->deleteObject(true); + sp_object_unref(clip_path); + sp_object_ref(rect, 0); + rect->deleteObject(true); + sp_object_unref(rect); + sp_selection_raise_to_top(selection, this->desktop, true); + selection->add(dup_clip); + sp_selected_path_diff_skip_undo(selection, this->desktop); + SPItem * clip = SP_ITEM(selection->itemList()[0]); + } } } + } else { + selection->add(rect); + sp_selected_path_diff_skip_undo(selection, this->desktop); } + sp_selection_raise_to_top(selection, this->desktop, true); + selection->add(item); + sp_selection_set_mask(this->desktop, true, false, true); } else { - selection->add(rect); - std::cout << "asasgfasfasfasfasfasf\n"; - sp_selected_path_diff_skip_undo(selection, desktop); + SPItem *erase_clip = selection->singleItem(); + if (erase_clip) { + sp_object_ref(erase_clip, 0); + erase_clip->deleteObject(true); + sp_object_unref(erase_clip); + } } - sp_selection_raise_to_top(selection, desktop, true); - selection->add(item); - sp_selection_set_mask(desktop, true, false, true); - } else { - SPItem *erase_clip = selection->singleItem(); - if (erase_clip) { - sp_object_ref(erase_clip, 0); - erase_clip->deleteObject(true); - sp_object_unref(erase_clip); + workDone = true; + selection->clear(); + if (wasSelection) { + remainingItems.push_back(item); } } - workDone = true; - selection->clear(); - if (wasSelection) { - remainingItems.push_back(item); - } } - } else { for (std::vector ::const_iterator i = toWorkOn.begin();i!=toWorkOn.end();++i) { sp_object_ref( *i, 0 ); @@ -842,7 +841,7 @@ void EraserTool::set_to_accumulated() { } if ( eraser_mode == 0 ) { - sp_selection_delete(desktop); + sp_selection_delete(this->desktop); remainingItems.clear(); } -- cgit v1.2.3 From c230ee02c2732c7eb55c5bdc6ef846f88550eea3 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 22 May 2016 17:44:25 +0200 Subject: first attem to work throught layers (bzr r14865.1.11) --- src/ui/tools/eraser-tool.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index c5a068dfc..02908fdf9 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -61,6 +61,7 @@ #include "sp-clippath.h" #include "sp-rect.h" #include "sp-text.h" +#include "sp-root.h" #include "display/canvas-bpath.h" #include "display/canvas-arena.h" #include "livarot/Shape.h" @@ -655,7 +656,7 @@ void EraserTool::set_to_accumulated() { this->repr = repr; } - SPItem *item_repr = SP_ITEM(this->desktop->currentLayer()->appendChildRepr(this->repr)); + SPItem *item_repr = SP_ITEM(SP_OBJECT(document->getRoot())->appendChildRepr(this->repr)); Inkscape::GC::release(this->repr); item_repr->updateRepr(); Geom::PathVector pathv = this->accumulated->get_pathvector() * this->desktop->dt2doc(); @@ -722,7 +723,7 @@ void EraserTool::set_to_accumulated() { selection->set(dup); if (!this->nowidth) { sp_selected_path_union_skip_undo(selection, this->desktop); - } + } selection->add(item); if(item->style->fill_rule.value == SP_WIND_RULE_EVENODD){ SPCSSAttr *css = sp_repr_css_attr_new(); @@ -767,10 +768,10 @@ void EraserTool::set_to_accumulated() { Inkscape::XML::Document *xml_doc = this->desktop->doc()->getReprDoc(); Inkscape::XML::Node *rect_repr = xml_doc->createElement("svg:rect"); sp_desktop_apply_style_tool (this->desktop, rect_repr, "/tools/eraser", false); - SPRect * rect = SP_RECT(this->desktop->currentLayer()->appendChildRepr(rect_repr)); + SPRect * rect = SP_RECT(item_repr->parent->appendChildRepr(rect_repr)); Inkscape::GC::release(rect_repr); rect->setPosition (bbox->left(), bbox->top(), bbox->width(), bbox->height()); - rect->transform = SP_ITEM(this->desktop->currentLayer())->i2dt_affine().inverse(); + rect->transform = SP_ITEM(rect->parent)->i2dt_affine().inverse(); rect->updateRepr(); this->desktop->canvas->endForcedFullRedraws(); Inkscape::XML::Node* dup = this->repr->duplicate(xml_doc); -- cgit v1.2.3 From 2d1b3b926c94db73a3f5cb73071027b9ee348154 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 22 May 2016 18:17:49 +0200 Subject: Speed improvements (bzr r14865.1.12) --- src/ui/tools/eraser-tool.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 02908fdf9..5cd04fa6f 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -766,20 +766,11 @@ void EraserTool::set_to_accumulated() { SPItem *item = *i; Geom::OptRect bbox = item->desktopVisualBounds(); Inkscape::XML::Document *xml_doc = this->desktop->doc()->getReprDoc(); - Inkscape::XML::Node *rect_repr = xml_doc->createElement("svg:rect"); - sp_desktop_apply_style_tool (this->desktop, rect_repr, "/tools/eraser", false); - SPRect * rect = SP_RECT(item_repr->parent->appendChildRepr(rect_repr)); - Inkscape::GC::release(rect_repr); - rect->setPosition (bbox->left(), bbox->top(), bbox->width(), bbox->height()); - rect->transform = SP_ITEM(rect->parent)->i2dt_affine().inverse(); - rect->updateRepr(); - this->desktop->canvas->endForcedFullRedraws(); Inkscape::XML::Node* dup = this->repr->duplicate(xml_doc); this->repr->parent()->appendChild(dup); Inkscape::GC::release(dup); // parent takes over selection->set(dup); sp_selected_path_union_skip_undo(selection, this->desktop); - sp_selection_raise_to_top(selection, this->desktop, true); if (bbox && bbox->intersects(*eraserBbox)) { SPClipPath *clip_path = item->clip_ref->getObject(); if (clip_path) { @@ -790,15 +781,9 @@ void EraserTool::set_to_accumulated() { SPItem * dup_clip_obj = SP_ITEM(item_repr->parent->appendChildRepr(dup_clip)); if (dup_clip_obj) { dup_clip_obj->doWriteTransform(dup_clip, item->transform); - sp_object_ref(clip_data, 0); - clip_data->deleteObject(true); - sp_object_unref(clip_data); sp_object_ref(clip_path, 0); clip_path->deleteObject(true); sp_object_unref(clip_path); - sp_object_ref(rect, 0); - rect->deleteObject(true); - sp_object_unref(rect); sp_selection_raise_to_top(selection, this->desktop, true); selection->add(dup_clip); sp_selected_path_diff_skip_undo(selection, this->desktop); @@ -807,6 +792,15 @@ void EraserTool::set_to_accumulated() { } } } else { + Inkscape::XML::Node *rect_repr = xml_doc->createElement("svg:rect"); + sp_desktop_apply_style_tool (this->desktop, rect_repr, "/tools/eraser", false); + SPRect * rect = SP_RECT(item_repr->parent->appendChildRepr(rect_repr)); + Inkscape::GC::release(rect_repr); + rect->setPosition (bbox->left(), bbox->top(), bbox->width(), bbox->height()); + rect->transform = SP_ITEM(rect->parent)->i2dt_affine().inverse(); + rect->updateRepr(); + rect->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + sp_selection_raise_to_top(selection, this->desktop, true); selection->add(rect); sp_selected_path_diff_skip_undo(selection, this->desktop); } -- cgit v1.2.3 From 8d35486a82d04a28dc9f297147ad4666b34cde4a Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 26 May 2016 19:37:15 +0200 Subject: Fixing pointwise (bzr r13645.1.143) --- src/ui/tool/path-manipulator.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 9d479432b..0d603ad1f 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -12,7 +12,6 @@ #include "live_effects/lpe-powerstroke.h" #include "live_effects/lpe-bspline.h" -#include "live_effects/lpe-fillet-chamfer.h" #include #include #include -- cgit v1.2.3 From 46bff7b31a99784086c5f5589956e647c862e944 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Sat, 4 Jun 2016 20:02:59 +0530 Subject: Register style dialog with support to add selector (bzr r14949.1.1) --- src/ui/CMakeLists.txt | 2 + src/ui/dialog/dialog-manager.cpp | 3 ++ src/ui/dialog/styledialog.cpp | 113 +++++++++++++++++++++++++++++++++++++++ src/ui/dialog/styledialog.h | 69 ++++++++++++++++++++++++ 4 files changed, 187 insertions(+) create mode 100644 src/ui/dialog/styledialog.cpp create mode 100644 src/ui/dialog/styledialog.h (limited to 'src/ui') diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 587974b90..4be3fa3d2 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -99,6 +99,7 @@ set(ui_SRC dialog/print-colors-preview-dialog.cpp dialog/print.cpp dialog/spellcheck.cpp + dialog/styledialog.cpp dialog/svg-fonts-dialog.cpp dialog/swatches.cpp dialog/symbols.cpp @@ -240,6 +241,7 @@ set(ui_SRC dialog/print-colors-preview-dialog.h dialog/print.h dialog/spellcheck.h + dialog/styledialog.h dialog/svg-fonts-dialog.h dialog/swatches.h dialog/symbols.h diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 49853277c..4bb5215fd 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -60,6 +60,7 @@ #include "ui/dialog/svg-fonts-dialog.h" #include "ui/dialog/objects.h" #include "ui/dialog/tags.h" +#include "ui/dialog/styledialog.h" namespace Inkscape { namespace UI { @@ -128,6 +129,7 @@ DialogManager::DialogManager() { registerFactory("Swatches", &create); registerFactory("TileDialog", &create); registerFactory("Symbols", &create); + registerFactory("StyleDialog", &create); #if HAVE_POTRACE registerFactory("Trace", &create); @@ -167,6 +169,7 @@ DialogManager::DialogManager() { registerFactory("Swatches", &create); registerFactory("TileDialog", &create); registerFactory("Symbols", &create); + registerFactory("StyleDialog", &create); #if HAVE_POTRACE registerFactory("Trace", &create); diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp new file mode 100644 index 000000000..7e555ddb2 --- /dev/null +++ b/src/ui/dialog/styledialog.cpp @@ -0,0 +1,113 @@ +#include "styledialog.h" +#include "widgets/icon.h" +#include "verbs.h" +#include "sp-object.h" +#include "selection.h" + +namespace Inkscape { +namespace UI { +namespace Dialog { + +void StyleDialog::_styleButton(Gtk::Button& btn, char const* iconName, + char const* tooltip) +{ + GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); + gtk_widget_show(child); + btn.add(*manage(Glib::wrap(child))); + btn.set_relief(Gtk::RELIEF_NONE); + btn.set_tooltip_text (tooltip); +} + +/** + * Constructor + * A treeview and a set of two buttons are added to the dialog. _addSelector + * adds selectors to treeview. Currently, delete button is disabled. + */ +StyleDialog::StyleDialog() : + UI::Widget::Panel("", "/dialogs/style", SP_VERB_DIALOG_STYLE), + _desktop(0) +{ + set_size_request(200, 200); + add(_mainBox); + + _mainBox.pack_start(_scrolledWindow, Gtk::PACK_EXPAND_WIDGET); + _treeView.set_headers_visible(false); + _scrolledWindow.add(_treeView); + _scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + _store = Gtk::ListStore::create(_mColumns); + _treeView.set_model(_store); + _treeView.append_column("Selector Number", _mColumns._selectorNumber); + _treeView.append_column("Selector Name", _mColumns._selectorLabel); + + Gtk::Button* create = manage( new Gtk::Button() ); + _styleButton(*create, "list-add", "Add a new CSS Selector"); + create->signal_clicked().connect(sigc::mem_fun(*this, + &StyleDialog::_addSelector)); + + Gtk::Button* del = manage( new Gtk::Button() ); + _styleButton(*del, "list-remove", "Remove a CSS Selector"); + del->set_sensitive(false); + + _mainBox.pack_start(_buttonBox, Gtk::PACK_SHRINK); + _buttonBox.pack_start(*create, Gtk::PACK_SHRINK); + _buttonBox.pack_start(*del, Gtk::PACK_SHRINK); + + SPDesktop* targetDesktop = getDesktop(); + setDesktop(targetDesktop); +} + +StyleDialog::~StyleDialog() +{ + setDesktop(NULL); +} + +void StyleDialog::setDesktop( SPDesktop* desktop ) +{ + Panel::setDesktop(desktop); + _desktop = Panel::getDesktop(); +} + +void StyleDialog::_addSelector() +{ + Gtk::TreeModel::Row row = *(_store->append()); + + /** + * On clicking '+' button, an entrybox with default text opens up. If an + * object is already selected, 'class' attribute with value in the entry + * is added to the selected object. + */ + Gtk::Dialog *textDialogPtr = new Gtk::Dialog(); + Gtk::Entry *textEditPtr = manage ( new Gtk::Entry() ); + textDialogPtr->add_button("Add", Gtk::RESPONSE_OK); + textDialogPtr->get_vbox()->pack_start(*textEditPtr, Gtk::PACK_SHRINK); + textEditPtr->set_text("Class1"); + + textDialogPtr->set_size_request(200, 100); + textDialogPtr->show_all(); + int result = textDialogPtr->run(); + static int number = 1; + + switch (result) { + case Gtk::RESPONSE_OK: + textDialogPtr->hide(); + row[_mColumns._selectorNumber] = number; + row[_mColumns._selectorLabel] = textEditPtr->get_text(); + number++; + break; + default: + break; + } + + if (_desktop->selection) { + std::vector selected = _desktop->getSelection()->list(); + for (int i = 0; i < selected.size(); ++i ) { + SPObject *obj = selected.at(i); + obj->setAttribute("class", textEditPtr->get_text()); + } + } +} + +} // namespace Dialog +} // namespace UI +} // namespace Inkscape diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h new file mode 100644 index 000000000..044737add --- /dev/null +++ b/src/ui/dialog/styledialog.h @@ -0,0 +1,69 @@ +/** @file + * @brief A dialog for CSS selectors + */ +/* Authors: + * Kamalpreet Kaur Grewal + * + * Copyright (C) Kamalpreet Kaur Grewal 2016 + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef STYLEDIALOG_H +#define STYLEDIALOG_H + +#include +#include +#include +#include +#include + +#include "desktop.h" + +namespace Inkscape { +namespace UI { +namespace Dialog { + +/** + * @brief The StyleDialog class + * A list of CSS selectors will show up in this dialog. + */ + +class StyleDialog : public UI::Widget::Panel +{ +public: + StyleDialog(); + ~StyleDialog(); + + static StyleDialog &getInstance() { return *new StyleDialog(); } + void setDesktop( SPDesktop* desktop); + +private: + void _styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip); + + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + ModelColumns() + { add(_selectorNumber); add(_selectorLabel); } + Gtk::TreeModelColumn _selectorNumber; + Gtk::TreeModelColumn _selectorLabel; + }; + + SPDesktop* _desktop; + ModelColumns _mColumns; + Gtk::VBox _mainBox; + Gtk::HBox _buttonBox; + Gtk::TreeView _treeView; + Glib::RefPtr _store; + Gtk::ScrolledWindow _scrolledWindow; + + // Signal handlers + void _addSelector(); +}; + +} // namespace Dialog +} // namespace UI +} // namespace Inkscape + +#endif // STYLEDIALOG_H -- cgit v1.2.3 From 8970301df8e29722a113e20295239c64e070d0d7 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Mon, 6 Jun 2016 22:50:06 +0530 Subject: Set class attribute values of selected objects using style dialog (bzr r14949.1.3) --- src/ui/dialog/styledialog.cpp | 71 +++++++++++++++++++++++++++++++++++++++++-- src/ui/dialog/styledialog.h | 1 + 2 files changed, 70 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 7e555ddb2..6681a7c56 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -1,3 +1,14 @@ +/** @file + * @brief A dialog for CSS selectors + */ +/* Authors: + * Kamalpreet Kaur Grewal + * + * Copyright (C) Kamalpreet Kaur Grewal 2016 + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + #include "styledialog.h" #include "widgets/icon.h" #include "verbs.h" @@ -8,6 +19,13 @@ namespace Inkscape { namespace UI { namespace Dialog { +/** + * @brief StyleDialog::_styleButton + * @param btn + * @param iconName + * @param tooltip + * This function sets the style of '+' and '-' buttons at the bottom of dialog. + */ void StyleDialog::_styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip) { @@ -68,6 +86,11 @@ void StyleDialog::setDesktop( SPDesktop* desktop ) _desktop = Panel::getDesktop(); } +/** + * @brief StyleDialog::_addSelector + * This function is the slot to the signal emitted when '+' at the bottom of + * the dialog is clicked. + */ void StyleDialog::_addSelector() { Gtk::TreeModel::Row row = *(_store->append()); @@ -81,7 +104,18 @@ void StyleDialog::_addSelector() Gtk::Entry *textEditPtr = manage ( new Gtk::Entry() ); textDialogPtr->add_button("Add", Gtk::RESPONSE_OK); textDialogPtr->get_vbox()->pack_start(*textEditPtr, Gtk::PACK_SHRINK); - textEditPtr->set_text("Class1"); + + /** + * By default, the entrybox contains 'Class1' as text. However, if object(s) + * is(are) selected and user clicks '+' at the bottom of dialog, the + * entrybox will have the id(s) of the selected objects as text. + */ + if (_desktop->selection->isEmpty()) + textEditPtr->set_text("Class1"); + else { + std::vector selected = _desktop->getSelection()->list(); + textEditPtr->set_text(_setClassAttribute(selected)); + } textDialogPtr->set_size_request(200, 100); textDialogPtr->show_all(); @@ -99,15 +133,48 @@ void StyleDialog::_addSelector() break; } + /** + * The 'class' attribute of the selected objects is set to the text that + * the user sets in the entrybox. If the attribute does not exist, it is + * created. In case the attribute already has a value, the new value entered + * is appended to the values. + */ if (_desktop->selection) { std::vector selected = _desktop->getSelection()->list(); for (int i = 0; i < selected.size(); ++i ) { SPObject *obj = selected.at(i); - obj->setAttribute("class", textEditPtr->get_text()); + const char *classExists = obj->getAttribute("class"); + + if (classExists) { + if (strlen(classExists) == 0) + obj->setAttribute("class", textEditPtr->get_text()); + else + obj->setAttribute("class", std::string(classExists) + " " + + textEditPtr->get_text()); + } + else { + obj->setAttribute("class", textEditPtr->get_text()); + } } } } +/** + * @brief StyleDialog::_setClassAttribute + * @param sel + * @return This function returns the ids of objects selected which are passed + * to entrybox. + */ +std::string StyleDialog::_setClassAttribute(std::vector sel) +{ + std::string str = ""; + for (int i = 0; i < sel.size(); ++i ) { + SPObject *obj = sel.at(i); + str = str + " " + std::string(obj->getId()); + } + return str; +} + } // namespace Dialog } // namespace UI } // namespace Inkscape diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 044737add..281585d9d 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -40,6 +40,7 @@ public: private: void _styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip); + std::string _setClassAttribute(std::vector); class ModelColumns : public Gtk::TreeModel::ColumnRecord { -- cgit v1.2.3 From ac25f7827cc250eb47eedf1bd3aa5ec8438fc0e5 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 7 Jun 2016 01:35:26 +0200 Subject: Add measure Over Item by a vlada idea on IRC (bzr r14957.1.1) --- src/ui/tools/measure-tool.cpp | 112 ++++++++++++++++++++++++++++++++++++++++++ src/ui/tools/measure-tool.h | 9 ++++ 2 files changed, 121 insertions(+) (limited to 'src/ui') diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index 287828d32..8b2a734ff 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -394,6 +394,10 @@ MeasureTool::~MeasureTool() sp_canvas_item_destroy(measure_tmp_items[idx]); } measure_tmp_items.clear(); + for (size_t idx = 0; idx < measure_item.size(); ++idx) { + sp_canvas_item_destroy(measure_item[idx]); + } + measure_item.clear(); for (size_t idx = 0; idx < measure_phantom_items.size(); ++idx) { sp_canvas_item_destroy(measure_phantom_items[idx]); } @@ -608,6 +612,12 @@ bool MeasureTool::root_handler(GdkEvent* event) snap_manager.preSnap(scp); snap_manager.unSetup(); } + Geom::Point const motion_w(event->motion.x, event->motion.y); + if(event->motion.state & GDK_SHIFT_MASK) { + showInfoBox(motion_w, true); + } else { + showInfoBox(motion_w, false); + } } else { ret = TRUE; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -1128,6 +1138,108 @@ void MeasureTool::setMeasureCanvasControlLine(Geom::Point start, Geom::Point end } } +void MeasureTool::showItemInfoText(Geom::Point pos, gchar *measure_str, double fontsize) +{ + SPCanvasText *canvas_tooltip = sp_canvastext_new(desktop->getTempGroup(), + desktop, + pos, + measure_str); + sp_canvastext_set_fontsize(canvas_tooltip, fontsize); + canvas_tooltip->rgba = 0xffffffff; + canvas_tooltip->outline = false; + canvas_tooltip->background = true; + canvas_tooltip->anchor_position = TEXT_ANCHOR_LEFT; + canvas_tooltip->rgba_background = 0x00000099; + measure_item.push_back(SP_CANVAS_ITEM(canvas_tooltip)); + sp_canvas_item_show(SP_CANVAS_ITEM(canvas_tooltip)); +} + +void MeasureTool::showInfoBox(Geom::Point cursor, bool into_groups) +{ + SPDesktop *desktop = SP_ACTIVE_DESKTOP; + Inkscape::Util::Unit const * unit = desktop->getNamedView()->getDisplayUnit(); + for (size_t idx = 0; idx < measure_item.size(); ++idx) { + sp_canvas_item_destroy(measure_item[idx]); + } + measure_item.clear(); + + SPItem *newover = desktop->getItemAtPoint(cursor, into_groups); + if (newover) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + double fontsize = prefs->getDouble("/tools/measure/fontsize", 10.0); + double scale = prefs->getDouble("/tools/measure/scale", 100.0) / 100.0; + int precision = prefs->getInt("/tools/measure/precision", 2); + Glib::ustring unit_name = prefs->getString("/tools/measure/unit"); + if (!unit_name.compare("")) { + unit_name = "px"; + } + Geom::Scale zoom = Geom::Scale(Inkscape::Util::Quantity::convert(desktop->current_zoom(), "px", unit->abbr)).inverse(); + if(newover != over){ + over = newover; + Preferences *prefs = Preferences::get(); + int prefs_bbox = prefs->getBool("/tools/bounding_box", 0); + SPItem::BBoxType bbox_type = !prefs_bbox ? SPItem::VISUAL_BBOX : SPItem::GEOMETRIC_BBOX; + Geom::OptRect bbox = over->bounds(bbox_type); + if (bbox) { + + item_width = Inkscape::Util::Quantity::convert((*bbox).width() * scale, unit->abbr, unit_name); + item_height = Inkscape::Util::Quantity::convert((*bbox).height() * scale, unit->abbr, unit_name); + item_x = Inkscape::Util::Quantity::convert((*bbox).left(), unit->abbr, unit_name); + Geom::Point y_point(0,Inkscape::Util::Quantity::convert((*bbox).bottom() * scale, unit->abbr, "px")); + y_point *= desktop->doc2dt(); + item_y = Inkscape::Util::Quantity::convert(y_point[Geom::Y] * scale, "px", unit_name); + if (SP_IS_SHAPE(over)) { + Geom::PathVector shape = SP_SHAPE(over)->getCurve()->get_pathvector(); + item_length = Geom::length(paths_to_pw(shape)); + item_length = Inkscape::Util::Quantity::convert(item_length * scale, unit->abbr, unit_name); + } + } + } + gchar *measure_str = NULL; + std::stringstream precision_str; + precision_str.imbue(std::locale::classic()); + double origin = Inkscape::Util::Quantity::convert(14, "px", unit->abbr); + Geom::Point rel_position = Geom::Point(origin, origin); + Geom::Point pos = desktop->w2d(cursor); + double gap = Inkscape::Util::Quantity::convert(7 + fontsize, "px", unit->abbr); + if (SP_IS_SHAPE(over)) { + precision_str << _("Lenght") << ": %." << precision << "f %s"; + measure_str = g_strdup_printf(precision_str.str().c_str(), item_length, unit_name.c_str()); + precision_str.str(""); + showItemInfoText(pos + (rel_position * zoom),measure_str,fontsize); + rel_position = Geom::Point(rel_position[Geom::X], rel_position[Geom::Y] + gap); + } else if (SP_IS_GROUP(over)) { + measure_str = _("Shift to measure into group"); + showItemInfoText(pos + (rel_position * zoom),measure_str,fontsize); + rel_position = Geom::Point(rel_position[Geom::X], rel_position[Geom::Y] + gap); + } + + precision_str << "Y: %." << precision << "f %s"; + measure_str = g_strdup_printf(precision_str.str().c_str(), item_y, unit_name.c_str()); + precision_str.str(""); + showItemInfoText(pos + (rel_position * zoom),measure_str,fontsize); + rel_position = Geom::Point(rel_position[Geom::X], rel_position[Geom::Y] + gap); + + precision_str << "X: %." << precision << "f %s"; + measure_str = g_strdup_printf(precision_str.str().c_str(), item_x, unit_name.c_str()); + precision_str.str(""); + showItemInfoText(pos + (rel_position * zoom),measure_str,fontsize); + rel_position = Geom::Point(rel_position[Geom::X], rel_position[Geom::Y] + gap); + + precision_str << _("Height") << ": %." << precision << "f %s"; + measure_str = g_strdup_printf(precision_str.str().c_str(), item_height, unit_name.c_str()); + precision_str.str(""); + showItemInfoText(pos + (rel_position * zoom),measure_str,fontsize); + rel_position = Geom::Point(rel_position[Geom::X], rel_position[Geom::Y] + gap); + + precision_str << _("Width") << ": %." << precision << "f %s"; + measure_str = g_strdup_printf(precision_str.str().c_str(), item_width, unit_name.c_str()); + precision_str.str(""); + showItemInfoText(pos + (rel_position * zoom),measure_str,fontsize); + g_free(measure_str); + } +} + void MeasureTool::showCanvasItems(bool to_guides, bool to_item, bool to_phantom, Inkscape::XML::Node *measure_repr) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; diff --git a/src/ui/tools/measure-tool.h b/src/ui/tools/measure-tool.h index 14fc9f81a..42122dca1 100644 --- a/src/ui/tools/measure-tool.h +++ b/src/ui/tools/measure-tool.h @@ -54,6 +54,8 @@ public: virtual void setMarker(bool isStart); virtual const std::string& getPrefsPath(); Geom::Point readMeasurePoint(bool is_start); + void showInfoBox(Geom::Point cursor, bool into_groups); + void showItemInfoText(Geom::Point pos, gchar *measure_str, double fontsize); void writeMeasurePoint(Geom::Point point, bool is_start); void setGuide(Geom::Point origin, double angle, const char *label); void setPoint(Geom::Point origin, Inkscape::XML::Node *measure_repr); @@ -77,6 +79,13 @@ private: Geom::Point end_p; std::vector measure_tmp_items; std::vector measure_phantom_items; + std::vector measure_item; + double item_width; + double item_height; + double item_x; + double item_y; + double item_length; + SPItem *over; sigc::connection _knot_start_moved_connection; sigc::connection _knot_start_ungrabbed_connection; sigc::connection _knot_start_click_connection; -- cgit v1.2.3 From d05e7ac156a8dedc0e80390a80edaa90b6260a4c Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Fri, 10 Jun 2016 14:10:53 +0530 Subject: Add selector to style element (bzr r14949.1.5) --- src/ui/dialog/styledialog.cpp | 100 +++++++++++++++++++++++++++++++++--------- src/ui/dialog/styledialog.h | 2 + 2 files changed, 81 insertions(+), 21 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 6681a7c56..992e75285 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -14,6 +14,10 @@ #include "verbs.h" #include "sp-object.h" #include "selection.h" +#include "xml/attribute-record.h" + +using Inkscape::Util::List; +using Inkscape::XML::AttributeRecord; namespace Inkscape { namespace UI { @@ -97,8 +101,8 @@ void StyleDialog::_addSelector() /** * On clicking '+' button, an entrybox with default text opens up. If an - * object is already selected, 'class' attribute with value in the entry - * is added to the selected object. + * object is already selected, a selector with value in the entry + * is added to a new style element. */ Gtk::Dialog *textDialogPtr = new Gtk::Dialog(); Gtk::Entry *textEditPtr = manage ( new Gtk::Entry() ); @@ -110,7 +114,7 @@ void StyleDialog::_addSelector() * is(are) selected and user clicks '+' at the bottom of dialog, the * entrybox will have the id(s) of the selected objects as text. */ - if (_desktop->selection->isEmpty()) + if ( _desktop->selection->isEmpty() ) textEditPtr->set_text("Class1"); else { std::vector selected = _desktop->getSelection()->list(); @@ -120,13 +124,28 @@ void StyleDialog::_addSelector() textDialogPtr->set_size_request(200, 100); textDialogPtr->show_all(); int result = textDialogPtr->run(); + + /** + * @brief selectorName + * This string stores selector name. If '#' or a '.' is present in the + * beginning of string, text from entrybox is saved directly as name for + * selector. If text like 'red' is written in entrybox, it is prefixed + * with a dot. + */ + std::string selectorName = ""; + if ( textEditPtr->get_text().at(0) == '#' || + textEditPtr->get_text().at(0) == '.' ) + selectorName = textEditPtr->get_text(); + else + selectorName = "." + textEditPtr->get_text(); + static int number = 1; switch (result) { case Gtk::RESPONSE_OK: textDialogPtr->hide(); row[_mColumns._selectorNumber] = number; - row[_mColumns._selectorLabel] = textEditPtr->get_text(); + row[_mColumns._selectorLabel] = selectorName; number++; break; default: @@ -134,27 +153,49 @@ void StyleDialog::_addSelector() } /** - * The 'class' attribute of the selected objects is set to the text that - * the user sets in the entrybox. If the attribute does not exist, it is + * The selector name objects is set to the text that the user sets in the + * entrybox. If the attribute does not exist, it is * created. In case the attribute already has a value, the new value entered * is appended to the values. */ - if (_desktop->selection) { + if ( _desktop->selection ) { std::vector selected = _desktop->getSelection()->list(); - for (int i = 0; i < selected.size(); ++i ) { + std::string selectorValue; + for ( unsigned i = 0; i < selected.size(); ++i ) { SPObject *obj = selected.at(i); - const char *classExists = obj->getAttribute("class"); - - if (classExists) { - if (strlen(classExists) == 0) - obj->setAttribute("class", textEditPtr->get_text()); - else - obj->setAttribute("class", std::string(classExists) + " " + - textEditPtr->get_text()); - } - else { - obj->setAttribute("class", textEditPtr->get_text()); + + std::string style = std::string(obj->getRepr()->attribute("style")); + style = row[_mColumns._selectorLabel] + ";" + style; + + for ( List iter = obj->getRepr()->attributeList() ; + iter ; ++iter ) { + gchar const * property = g_quark_to_string(iter->key); + gchar const * value = iter->value; + + if ( std::string(property) == "style" ) + { + selectorValue = row[_mColumns._selectorLabel] + "{" + + "\n" + std::string(value) + "\n" + "}"; + } } + + /** + * @brief root + * A new style element is added to the document with value obtained + * from selectorValue above. + */ + Inkscape::XML::Node *root = obj->getRepr()->document()->root(); + Inkscape::XML::Node *newChild = obj->getRepr()->document() + ->createElement("svg:style"); + + Inkscape::XML::Node *smallChildren = obj->getRepr()->document() + ->createTextNode(selectorValue.c_str()); + + newChild->appendChild(smallChildren); + Inkscape::GC::release(smallChildren); + + root->addChild(newChild, NULL); + Inkscape::GC::release(newChild); } } } @@ -168,13 +209,30 @@ void StyleDialog::_addSelector() std::string StyleDialog::_setClassAttribute(std::vector sel) { std::string str = ""; - for (int i = 0; i < sel.size(); ++i ) { + for (unsigned i = 0; i < sel.size(); ++i) { SPObject *obj = sel.at(i); - str = str + " " + std::string(obj->getId()); + str = str + "#" + std::string(obj->getId()) + " "; } return str; } +/** + * @brief StyleDialog::_populateTree + * @param _selMap + * This function will populate the treeview with selectors available in the + * stylesheet. Not used yet. + */ +void StyleDialog::_populateTree(std::map _selMap) +{ + std::map _selectMap = _selMap; + + for(std::map::iterator it = _selectMap.begin(); + it != _selectMap.end(); ++it) { + Gtk::TreeModel::Row row = *(_store->append()); + row[_mColumns._selectorLabel] = it->first; + } +} + } // namespace Dialog } // namespace UI } // namespace Inkscape diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 281585d9d..21c33ab6e 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -41,6 +41,8 @@ public: private: void _styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip); std::string _setClassAttribute(std::vector); + std::map_selectorMap; + void _populateTree(std::map); class ModelColumns : public Gtk::TreeModel::ColumnRecord { -- cgit v1.2.3 From 0792b241079daea6c984d9fd6761b9bdfbe85455 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Fri, 10 Jun 2016 20:13:26 +0530 Subject: Populate style dialog with existing selectors in stylesheet (bzr r14949.1.7) --- src/ui/dialog/styledialog.cpp | 49 +++++++++++++++++++++++++++++++------------ src/ui/dialog/styledialog.h | 4 ++-- 2 files changed, 38 insertions(+), 15 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 992e75285..7a3dfeaff 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -59,7 +59,6 @@ StyleDialog::StyleDialog() : _store = Gtk::ListStore::create(_mColumns); _treeView.set_model(_store); - _treeView.append_column("Selector Number", _mColumns._selectorNumber); _treeView.append_column("Selector Name", _mColumns._selectorLabel); Gtk::Button* create = manage( new Gtk::Button() ); @@ -77,6 +76,32 @@ StyleDialog::StyleDialog() : SPDesktop* targetDesktop = getDesktop(); setDesktop(targetDesktop); + + /** + * @brief document + * If an existing document is opened, its XML representation is obtained + * and if it contains any style element with a style selector, the selector + * name and its value is extracted and saved to a map. This map is then used + * to populate the treeview with the already existing selectors. + */ + SPDocument * document = targetDesktop->doc(); + unsigned num = document->getReprRoot()->childCount(); + + std::string key, value; + std::map selMap; + + for ( unsigned i = 0; i < num; ++i ) + { + if ( std::string(document->getReprRoot()->nthChild(i)->name()) == "svg:style" ) + { + char *str = strdup(document->getReprRoot()->nthChild(i)->firstChild() + ->content()); + key = strtok(str, " "); + value = strtok(NULL, ""); + selMap[key] = value; + } + } + _populateTree(selMap); } StyleDialog::~StyleDialog() @@ -134,19 +159,15 @@ void StyleDialog::_addSelector() */ std::string selectorName = ""; if ( textEditPtr->get_text().at(0) == '#' || - textEditPtr->get_text().at(0) == '.' ) + textEditPtr->get_text().at(0) == '.' ) selectorName = textEditPtr->get_text(); else selectorName = "." + textEditPtr->get_text(); - static int number = 1; - switch (result) { case Gtk::RESPONSE_OK: textDialogPtr->hide(); - row[_mColumns._selectorNumber] = number; row[_mColumns._selectorLabel] = selectorName; - number++; break; default: break; @@ -167,8 +188,8 @@ void StyleDialog::_addSelector() std::string style = std::string(obj->getRepr()->attribute("style")); style = row[_mColumns._selectorLabel] + ";" + style; - for ( List iter = obj->getRepr()->attributeList() ; - iter ; ++iter ) { + for ( List iter = obj->getRepr()->attributeList(); + iter; ++iter ) { gchar const * property = g_quark_to_string(iter->key); gchar const * value = iter->value; @@ -196,6 +217,8 @@ void StyleDialog::_addSelector() root->addChild(newChild, NULL); Inkscape::GC::release(newChild); + + _selectorMap[selectorName] = selectorValue; } } } @@ -209,7 +232,7 @@ void StyleDialog::_addSelector() std::string StyleDialog::_setClassAttribute(std::vector sel) { std::string str = ""; - for (unsigned i = 0; i < sel.size(); ++i) { + for ( unsigned i = 0; i < sel.size(); ++i ) { SPObject *obj = sel.at(i); str = str + "#" + std::string(obj->getId()) + " "; } @@ -219,15 +242,15 @@ std::string StyleDialog::_setClassAttribute(std::vector sel) /** * @brief StyleDialog::_populateTree * @param _selMap - * This function will populate the treeview with selectors available in the - * stylesheet. Not used yet. + * This function populates the treeview with selectors available in the + * stylesheet. */ void StyleDialog::_populateTree(std::map _selMap) { std::map _selectMap = _selMap; - for(std::map::iterator it = _selectMap.begin(); - it != _selectMap.end(); ++it) { + for( std::map::iterator it = _selectMap.begin(); + it != _selectMap.end(); ++it ) { Gtk::TreeModel::Row row = *(_store->append()); row[_mColumns._selectorLabel] = it->first; } diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 21c33ab6e..79ff41559 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -19,6 +19,7 @@ #include #include "desktop.h" +#include "document.h" namespace Inkscape { namespace UI { @@ -48,8 +49,7 @@ private: { public: ModelColumns() - { add(_selectorNumber); add(_selectorLabel); } - Gtk::TreeModelColumn _selectorNumber; + { add(_selectorLabel); } Gtk::TreeModelColumn _selectorLabel; }; -- cgit v1.2.3 From 3bbe3debb72ae45a17eaa0133f73d8bc37c55b7b Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Sat, 11 Jun 2016 10:57:36 +0530 Subject: Apply patch for broken automake (bzr r14949.1.9) --- src/ui/dialog/Makefile_insert | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui') diff --git a/src/ui/dialog/Makefile_insert b/src/ui/dialog/Makefile_insert index 71628973e..982908731 100644 --- a/src/ui/dialog/Makefile_insert +++ b/src/ui/dialog/Makefile_insert @@ -92,6 +92,8 @@ ink_common_sources += \ ui/dialog/print-colors-preview-dialog.h \ ui/dialog/spellcheck.cpp \ ui/dialog/spellcheck.h \ + ui/dialog/styledialog.cpp \ + ui/dialog/styledialog.h \ ui/dialog/svg-fonts-dialog.cpp \ ui/dialog/svg-fonts-dialog.h \ ui/dialog/swatches.cpp \ -- cgit v1.2.3 From 6d5d7e5421a5ac585814bde11866d796d81653cd Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 11 Jun 2016 14:04:09 +0200 Subject: Fix a typo pointed by CR (bzr r14957.1.2) --- src/ui/tools/measure-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index 8b2a734ff..900274afc 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -1203,7 +1203,7 @@ void MeasureTool::showInfoBox(Geom::Point cursor, bool into_groups) Geom::Point pos = desktop->w2d(cursor); double gap = Inkscape::Util::Quantity::convert(7 + fontsize, "px", unit->abbr); if (SP_IS_SHAPE(over)) { - precision_str << _("Lenght") << ": %." << precision << "f %s"; + precision_str << _("Length") << ": %." << precision << "f %s"; measure_str = g_strdup_printf(precision_str.str().c_str(), item_length, unit_name.c_str()); precision_str.str(""); showItemInfoText(pos + (rel_position * zoom),measure_str,fontsize); -- cgit v1.2.3 From 2e2712f1a6f1b31b18b40f9cffc58c8ef7b9198e Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Sat, 11 Jun 2016 23:46:45 +0530 Subject: Delete selector from style dialog (not from repr yet) (bzr r14949.1.12) --- src/ui/dialog/styledialog.cpp | 115 +++++++++++++++++++++++++++++++++--------- src/ui/dialog/styledialog.h | 7 +++ 2 files changed, 97 insertions(+), 25 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 7a3dfeaff..14213f97d 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -61,47 +61,31 @@ StyleDialog::StyleDialog() : _treeView.set_model(_store); _treeView.append_column("Selector Name", _mColumns._selectorLabel); - Gtk::Button* create = manage( new Gtk::Button() ); + create = manage( new Gtk::Button() ); _styleButton(*create, "list-add", "Add a new CSS Selector"); create->signal_clicked().connect(sigc::mem_fun(*this, &StyleDialog::_addSelector)); - Gtk::Button* del = manage( new Gtk::Button() ); + del = manage( new Gtk::Button() ); _styleButton(*del, "list-remove", "Remove a CSS Selector"); + del->signal_clicked().connect(sigc::mem_fun(*this, + &StyleDialog::_delSelector)); del->set_sensitive(false); _mainBox.pack_start(_buttonBox, Gtk::PACK_SHRINK); _buttonBox.pack_start(*create, Gtk::PACK_SHRINK); _buttonBox.pack_start(*del, Gtk::PACK_SHRINK); - SPDesktop* targetDesktop = getDesktop(); - setDesktop(targetDesktop); + _targetDesktop = getDesktop(); + setDesktop(_targetDesktop); /** * @brief document * If an existing document is opened, its XML representation is obtained - * and if it contains any style element with a style selector, the selector - * name and its value is extracted and saved to a map. This map is then used - * to populate the treeview with the already existing selectors. + * and is then used to populate the treeview with the already existing + * selectors in the style element. */ - SPDocument * document = targetDesktop->doc(); - unsigned num = document->getReprRoot()->childCount(); - - std::string key, value; - std::map selMap; - - for ( unsigned i = 0; i < num; ++i ) - { - if ( std::string(document->getReprRoot()->nthChild(i)->name()) == "svg:style" ) - { - char *str = strdup(document->getReprRoot()->nthChild(i)->firstChild() - ->content()); - key = strtok(str, " "); - value = strtok(NULL, ""); - selMap[key] = value; - } - } - _populateTree(selMap); + _populateTree(_getSelectorMap()); } StyleDialog::~StyleDialog() @@ -173,6 +157,8 @@ void StyleDialog::_addSelector() break; } + del->set_sensitive(true); + /** * The selector name objects is set to the text that the user sets in the * entrybox. If the attribute does not exist, it is @@ -223,6 +209,52 @@ void StyleDialog::_addSelector() } } +/** + * @brief StyleDialog::_delSelector + * This function deletes selector when '-' at the bottom is clicked. Currently + * selectors are deleted from StyleDialog and not from repr of the document. + */ +void StyleDialog::_delSelector() +{ + Glib::RefPtr refTreeSelection = _treeView.get_selection(); + Gtk::TreeModel::iterator iter = refTreeSelection->get_selected(); + std::mapselMap = _getSelectorMap(); + + if (iter) + { + Gtk::TreeModel::Row row = *iter; + for( unsigned it = 0; it < selMap.size(); ++it ) { + std::string key = strtok(strdup(_document->getReprRoot() + ->nthChild(it) + ->firstChild()->content()), " "); + + /** + * @brief toDeleteNode + * The node to be deleted is obtained using nthChild and the selector + * name and corresponding style node from the repr of document are + * saved to a map. Keys of this map and labels of selected rows of + * dialog are compared and deleted. + */ + Inkscape::XML::Node *toDeleteNode = _document->getReprRoot()->nthChild(it); + std::maptoDeleteMap; + toDeleteMap[key] = toDeleteNode; + + for( std::map::iterator i = + toDeleteMap.begin(); i != toDeleteMap.end(); ++i ) { + if( row[_mColumns._selectorLabel] == i->first) + { + std::cout << i->second->name() << std::endl; + /** + This should work but uncommenting it causes a crash currently. + */ + //_document->getReprRoot()->removeChild(toDeleteNode); + } + } + } + _store->erase(row); + } +} + /** * @brief StyleDialog::_setClassAttribute * @param sel @@ -239,6 +271,36 @@ std::string StyleDialog::_setClassAttribute(std::vector sel) return str; } +/** + * @brief StyleDialog::_getSelectorMap + * @return selMap + * This function returns a map whose key is the style selector name and value is + * the style properties. All style selectors are extracted from svg:style + * element. + */ +std::mapStyleDialog::_getSelectorMap() +{ + _document = _targetDesktop->doc(); + unsigned num = _document->getReprRoot()->childCount(); + + std::string key, value; + std::map selMap; + + for ( unsigned i = 0; i < num; ++i ) + { + if ( std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style" ) + { + char *str = strdup(_document->getReprRoot()->nthChild(i)->firstChild() + ->content()); + key = strtok(str, " "); + value = strtok(NULL, ""); + selMap[key] = value; + } + } + + return selMap; +} + /** * @brief StyleDialog::_populateTree * @param _selMap @@ -254,6 +316,9 @@ void StyleDialog::_populateTree(std::map _selMap) Gtk::TreeModel::Row row = *(_store->append()); row[_mColumns._selectorLabel] = it->first; } + + if (_selectMap.size() > 0) + del->set_sensitive(true); } } // namespace Dialog diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 79ff41559..f206b1e23 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -17,6 +17,7 @@ #include #include #include +#include #include "desktop.h" #include "document.h" @@ -43,6 +44,7 @@ private: void _styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip); std::string _setClassAttribute(std::vector); std::map_selectorMap; + std::map _getSelectorMap(); void _populateTree(std::map); class ModelColumns : public Gtk::TreeModel::ColumnRecord @@ -54,15 +56,20 @@ private: }; SPDesktop* _desktop; + SPDesktop* _targetDesktop; ModelColumns _mColumns; Gtk::VBox _mainBox; Gtk::HBox _buttonBox; Gtk::TreeView _treeView; Glib::RefPtr _store; Gtk::ScrolledWindow _scrolledWindow; + Gtk::Button* del; + Gtk::Button* create; + SPDocument* _document; // Signal handlers void _addSelector(); + void _delSelector(); }; } // namespace Dialog -- cgit v1.2.3 From edc19028160caa0d92b943232483ba76fa8ea75b Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 12 Jun 2016 18:27:42 +0200 Subject: Fix bug 'Persistent measure repositions on middle click' Fixed bugs: - https://launchpad.net/bugs/1591662 (bzr r14982) --- src/ui/tools/measure-tool.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index 5900a2359..0977729ae 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -565,7 +565,6 @@ bool MeasureTool::root_handler(GdkEvent* event) explicit_base = boost::none; explicit_base_tmp = boost::none; last_end = boost::none; - start_p = desktop->w2d(button_w); if (event->button.button == 1 && !this->space_panning) { // save drag origin -- cgit v1.2.3 From 73f078b27b669c941651ecf14a3119ae491ccabf Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 13 Jun 2016 00:58:55 +0200 Subject: Fix 90% of tweenk review (bzr r13645.1.155) --- src/ui/tools/node-tool.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 23aaf6bb1..60d4c807f 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -292,15 +292,15 @@ void NodeTool::update_helperpath () { if (SP_IS_LPE_ITEM(selection->singleItem())) { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) { - Inkscape::UI::ControlPointSelection::Set &selectionNodes = _selected_nodes->allPoints(); - std::vector selectedNodesPositions; - for (Inkscape::UI::ControlPointSelection::Set::iterator i = selectionNodes.begin(); i != selectionNodes.end(); ++i) { + Inkscape::UI::ControlPointSelection::Set &selection_nodes = _selected_nodes->allPoints(); + std::vector selected_nodes_positions; + for (Inkscape::UI::ControlPointSelection::Set::iterator i = selection_nodes.begin(); i != selection_nodes.end(); ++i) { if ((*i)->selected()) { Inkscape::UI::Node *n = dynamic_cast(*i); - selectedNodesPositions.push_back(n->position()); + selected_nodes_positions.push_back(n->position()); } } - lpe->setSelectedNodePoints(selectedNodesPositions); + lpe->setSelectedNodePoints(selected_nodes_positions); lpe->setCurrentZoom(this->desktop->current_zoom()); SPCurve *c = new SPCurve(); SPCurve *cc = new SPCurve(); -- cgit v1.2.3 From b9f56542de1f33e8ac45325653dcac11691e3e47 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Mon, 13 Jun 2016 12:27:11 +0530 Subject: Correct parsing of style element (bzr r14949.1.14) --- src/ui/dialog/styledialog.cpp | 67 ++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 27 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 14213f97d..9abcc1562 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -19,6 +19,8 @@ using Inkscape::Util::List; using Inkscape::XML::AttributeRecord; +#define REMOVE_SPACES(x) x.erase(std::remove(x.begin(), x.end(), ' '), x.end()); + namespace Inkscape { namespace UI { namespace Dialog { @@ -181,8 +183,8 @@ void StyleDialog::_addSelector() if ( std::string(property) == "style" ) { - selectorValue = row[_mColumns._selectorLabel] + "{" + - "\n" + std::string(value) + "\n" + "}"; + selectorValue = "\n" + row[_mColumns._selectorLabel] + "{" + + std::string(value) + "}"; } } @@ -223,10 +225,10 @@ void StyleDialog::_delSelector() if (iter) { Gtk::TreeModel::Row row = *iter; - for( unsigned it = 0; it < selMap.size(); ++it ) { - std::string key = strtok(strdup(_document->getReprRoot() - ->nthChild(it) - ->firstChild()->content()), " "); +// for( unsigned it = 0; it < selMap.size(); ++it ) { +// std::string key = strtok(strdup(_document->getReprRoot() +// ->nthChild(it) +// ->firstChild()->content()), "{"); /** * @brief toDeleteNode @@ -235,22 +237,22 @@ void StyleDialog::_delSelector() * saved to a map. Keys of this map and labels of selected rows of * dialog are compared and deleted. */ - Inkscape::XML::Node *toDeleteNode = _document->getReprRoot()->nthChild(it); - std::maptoDeleteMap; - toDeleteMap[key] = toDeleteNode; - - for( std::map::iterator i = - toDeleteMap.begin(); i != toDeleteMap.end(); ++i ) { - if( row[_mColumns._selectorLabel] == i->first) - { - std::cout << i->second->name() << std::endl; - /** - This should work but uncommenting it causes a crash currently. - */ - //_document->getReprRoot()->removeChild(toDeleteNode); - } - } - } +// Inkscape::XML::Node *toDeleteNode = _document->getReprRoot()->nthChild(it); +// std::maptoDeleteMap; +// toDeleteMap[key] = toDeleteNode; + +// for( std::map::iterator i = +// toDeleteMap.begin(); i != toDeleteMap.end(); ++i ) { +// if( row[_mColumns._selectorLabel] == i->first) +// { +// std::cout << i->second->name() << std::endl; +// /** +// This should work but uncommenting it causes a crash currently. +// */ +// //_document->getReprRoot()->removeChild(toDeleteNode); +// } +// } +// } _store->erase(row); } } @@ -290,11 +292,22 @@ std::mapStyleDialog::_getSelectorMap() { if ( std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style" ) { - char *str = strdup(_document->getReprRoot()->nthChild(i)->firstChild() - ->content()); - key = strtok(str, " "); - value = strtok(NULL, ""); - selMap[key] = value; + std::stringstream str; + str << _document->getReprRoot()->nthChild(i)->firstChild()->content(); + std::string sel; + + while (str != NULL) + { + while(std::getline(str, sel, '\n')){ + REMOVE_SPACES(sel); + if (!sel.empty()) + { + key = strtok(strdup(sel.c_str()), "{"); + value = strtok(NULL, "}"); + selMap[key] = value; + } + } + } } } -- cgit v1.2.3 From d35fb3b6e570691908282543b97076591510c5f3 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Mon, 13 Jun 2016 13:31:06 +0530 Subject: Fix crash when object without style attribute is added to selector (bzr r14949.1.15) --- src/ui/dialog/styledialog.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 9abcc1562..997d8b230 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -173,21 +173,28 @@ void StyleDialog::_addSelector() for ( unsigned i = 0; i < selected.size(); ++i ) { SPObject *obj = selected.at(i); - std::string style = std::string(obj->getRepr()->attribute("style")); - style = row[_mColumns._selectorLabel] + ";" + style; - - for ( List iter = obj->getRepr()->attributeList(); - iter; ++iter ) { - gchar const * property = g_quark_to_string(iter->key); - gchar const * value = iter->value; - - if ( std::string(property) == "style" ) - { - selectorValue = "\n" + row[_mColumns._selectorLabel] + "{" - + std::string(value) + "}"; + if (obj->getRepr()->attribute("style")) + { + std::string style = std::string(obj->getRepr()->attribute("style")); + style = row[_mColumns._selectorLabel] + ";" + style; + + for ( List iter = obj->getRepr()->attributeList(); + iter; ++iter ) { + gchar const * property = g_quark_to_string(iter->key); + gchar const * value = iter->value; + + if ( std::string(property) == "style" ) + { + selectorValue = "\n" + row[_mColumns._selectorLabel] + "{" + + std::string(value) + "}"; + } } } + else + std::cout << "This object does not have a style attribute. Add " + "one first."; + /** * @brief root * A new style element is added to the document with value obtained -- cgit v1.2.3 From a2c9a2962f6b9d4419b689ed4924f2cae2485332 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Mon, 13 Jun 2016 18:43:40 +0530 Subject: Set style and class attribute of object approprialtely when adding new style selector (bzr r14949.1.16) --- src/ui/dialog/styledialog.cpp | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 997d8b230..15c870e5d 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -165,17 +165,20 @@ void StyleDialog::_addSelector() * The selector name objects is set to the text that the user sets in the * entrybox. If the attribute does not exist, it is * created. In case the attribute already has a value, the new value entered - * is appended to the values. + * is appended to the values. If a style attribute does not exist, it is + * created with an empty value. Also if a class selector is added, then + * class attribute for the selected object is set too. */ if ( _desktop->selection ) { std::vector selected = _desktop->getSelection()->list(); std::string selectorValue; for ( unsigned i = 0; i < selected.size(); ++i ) { SPObject *obj = selected.at(i); + std::string style; if (obj->getRepr()->attribute("style")) { - std::string style = std::string(obj->getRepr()->attribute("style")); + style = std::string(obj->getRepr()->attribute("style")); style = row[_mColumns._selectorLabel] + ";" + style; for ( List iter = obj->getRepr()->attributeList(); @@ -192,8 +195,23 @@ void StyleDialog::_addSelector() } else - std::cout << "This object does not have a style attribute. Add " - "one first."; + { + style = " "; + std::cout << "style" << style; + obj->getRepr()->setAttribute("style", style); + } + + if ( strcmp(selectorName.substr(0,1).c_str(), ".") == 0 ){ + if (!obj->getRepr()->attribute("class")) + obj->getRepr()->setAttribute("class", textEditPtr->get_text() + .erase(0,1)); + else + obj->getRepr()->setAttribute("class", std::string(obj-> + getRepr()-> + attribute("class")) + + " " + textEditPtr->get_text() + .erase(0,0)); + } /** * @brief root @@ -303,16 +321,13 @@ std::mapStyleDialog::_getSelectorMap() str << _document->getReprRoot()->nthChild(i)->firstChild()->content(); std::string sel; - while (str != NULL) - { - while(std::getline(str, sel, '\n')){ - REMOVE_SPACES(sel); - if (!sel.empty()) - { - key = strtok(strdup(sel.c_str()), "{"); - value = strtok(NULL, "}"); - selMap[key] = value; - } + while(std::getline(str, sel, '\n')){ + REMOVE_SPACES(sel); + if (!sel.empty()) + { + key = strtok(strdup(sel.c_str()), "{"); + value = strtok(NULL, "}"); + selMap[key] = value; } } } -- cgit v1.2.3 From 41c854edad820e281097f6ba8f17ea89521155ea Mon Sep 17 00:00:00 2001 From: Mark Harmer Date: Tue, 14 Jun 2016 14:33:17 +0200 Subject: [Bug #1300865] lcms2: crash in Fill and Stroke if linked color profile is missing on local system. Fixed bugs: - https://launchpad.net/bugs/1300865 (bzr r14987) --- src/ui/widget/color-icc-selector.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp index b422892fe..e4f58fe8a 100644 --- a/src/ui/widget/color-icc-selector.cpp +++ b/src/ui/widget/color-icc-selector.cpp @@ -633,9 +633,10 @@ void ColorICCSelectorImpl::_switchToProfile(gchar const *name) #endif // DEBUG_LCMS tmp.set(SP_RGBA32_U_COMPOSE(pre[0], pre[1], pre[2], 0xff)); } + + dirty = true; } } - dirty = true; } } else { -- cgit v1.2.3 From cf648cc9b825188b3a790eeeb202b52b07ff6cef Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Wed, 15 Jun 2016 19:54:38 +0530 Subject: Add selector to single style element & replace storage map by a vector (bzr r14949.1.18) --- src/ui/dialog/styledialog.cpp | 106 +++++++++++++++++++++++++++--------------- src/ui/dialog/styledialog.h | 8 ++-- 2 files changed, 74 insertions(+), 40 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 15c870e5d..bab08390c 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -10,6 +10,7 @@ */ #include "styledialog.h" +#include "ui/widget/addtoicon.h" #include "widgets/icon.h" #include "verbs.h" #include "sp-object.h" @@ -61,6 +62,11 @@ StyleDialog::StyleDialog() : _store = Gtk::ListStore::create(_mColumns); _treeView.set_model(_store); + + Inkscape::UI::Widget::AddToIcon * addRenderer = manage( + new Inkscape::UI::Widget::AddToIcon() ); + addRenderer->property_active() = true; + _treeView.append_column("type", *addRenderer); _treeView.append_column("Selector Name", _mColumns._selectorLabel); create = manage( new Gtk::Button() ); @@ -87,7 +93,8 @@ StyleDialog::StyleDialog() : * and is then used to populate the treeview with the already existing * selectors in the style element. */ - _populateTree(_getSelectorMap()); + _styleExists = false; + _sValue = _populateTree(_getSelectorVec()); } StyleDialog::~StyleDialog() @@ -178,9 +185,6 @@ void StyleDialog::_addSelector() if (obj->getRepr()->attribute("style")) { - style = std::string(obj->getRepr()->attribute("style")); - style = row[_mColumns._selectorLabel] + ";" + style; - for ( List iter = obj->getRepr()->attributeList(); iter; ++iter ) { gchar const * property = g_quark_to_string(iter->key); @@ -188,8 +192,8 @@ void StyleDialog::_addSelector() if ( std::string(property) == "style" ) { - selectorValue = "\n" + row[_mColumns._selectorLabel] + "{" - + std::string(value) + "}"; + selectorValue = row[_mColumns._selectorLabel] + "{" + + std::string(value) + "}" + "\n"; } } } @@ -197,7 +201,6 @@ void StyleDialog::_addSelector() else { style = " "; - std::cout << "style" << style; obj->getRepr()->setAttribute("style", style); } @@ -216,22 +219,45 @@ void StyleDialog::_addSelector() /** * @brief root * A new style element is added to the document with value obtained - * from selectorValue above. + * from selectorValue above. If style element already exists, then + * the new selector's content is appended to its previous content. */ - Inkscape::XML::Node *root = obj->getRepr()->document()->root(); - Inkscape::XML::Node *newChild = obj->getRepr()->document() - ->createElement("svg:style"); - - Inkscape::XML::Node *smallChildren = obj->getRepr()->document() - ->createTextNode(selectorValue.c_str()); - - newChild->appendChild(smallChildren); - Inkscape::GC::release(smallChildren); - - root->addChild(newChild, NULL); - Inkscape::GC::release(newChild); + unsigned num = _document->getReprRoot()->childCount(); + Inkscape::XML::Node *styleChild; + for ( unsigned i = 0; i < num; ++i ) + { + if ( std::string(_document->getReprRoot()->nthChild(i)->name()) + == "svg:style" ) + { + _styleExists = true; + styleChild = _document->getReprRoot()->nthChild(i); + break; + } + else + _styleExists = false; + } - _selectorMap[selectorName] = selectorValue; + if ( _styleExists ) + { + _sValue = _sValue + selectorValue; + styleChild->firstChild()->setContent(_sValue.c_str()); + } + else + { + _sValue = selectorValue; + Inkscape::XML::Node *root = obj->getRepr()->document()->root(); + Inkscape::XML::Node *newChild = obj->getRepr()->document() + ->createElement("svg:style"); + Inkscape::XML::Node *smallChildren = obj->getRepr()->document() + ->createTextNode(selectorValue.c_str()); + + newChild->appendChild(smallChildren); + Inkscape::GC::release(smallChildren); + + root->addChild(newChild, NULL); + Inkscape::GC::release(newChild); + } + _selectorVec.push_back(std::make_pair(selectorName, selectorValue)); } } } @@ -245,7 +271,7 @@ void StyleDialog::_delSelector() { Glib::RefPtr refTreeSelection = _treeView.get_selection(); Gtk::TreeModel::iterator iter = refTreeSelection->get_selected(); - std::mapselMap = _getSelectorMap(); + std::vector >selVec = _getSelectorVec(); if (iter) { @@ -299,19 +325,19 @@ std::string StyleDialog::_setClassAttribute(std::vector sel) } /** - * @brief StyleDialog::_getSelectorMap - * @return selMap - * This function returns a map whose key is the style selector name and value is - * the style properties. All style selectors are extracted from svg:style + * @brief StyleDialog::_getSelectorVec + * @return selVec + * This function returns a vector whose key is the style selector name and value + * is the style properties. All style selectors are extracted from svg:style * element. */ -std::mapStyleDialog::_getSelectorMap() +std::vector >StyleDialog::_getSelectorVec() { _document = _targetDesktop->doc(); unsigned num = _document->getReprRoot()->childCount(); std::string key, value; - std::map selMap; + std::vector > selVec; for ( unsigned i = 0; i < num; ++i ) { @@ -327,33 +353,39 @@ std::mapStyleDialog::_getSelectorMap() { key = strtok(strdup(sel.c_str()), "{"); value = strtok(NULL, "}"); - selMap[key] = value; + selVec.push_back(std::make_pair(key, value)); } } } } - return selMap; + return selVec; } /** * @brief StyleDialog::_populateTree - * @param _selMap + * @param _selVec * This function populates the treeview with selectors available in the * stylesheet. */ -void StyleDialog::_populateTree(std::map _selMap) +std::string StyleDialog::_populateTree(std::vector > _selVec) { - std::map _selectMap = _selMap; + std::vector > _selectVec = _selVec; + std::string selectorValue; - for( std::map::iterator it = _selectMap.begin(); - it != _selectMap.end(); ++it ) { + for( unsigned it = 0; it < _selectVec.size(); ++it ) { Gtk::TreeModel::Row row = *(_store->append()); - row[_mColumns._selectorLabel] = it->first; + row[_mColumns._selectorLabel] = _selectVec[it].first; + std::string selValue = _selectVec[it].first + " { " + + _selectVec[it].second + " }" + "\n"; + selectorValue.append(selValue.c_str()); } - if (_selectMap.size() > 0) + if (_selectVec.size() > 0) del->set_sensitive(true); + + return selectorValue; } } // namespace Dialog diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index f206b1e23..0cba3bf5b 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -43,9 +43,9 @@ public: private: void _styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip); std::string _setClassAttribute(std::vector); - std::map_selectorMap; - std::map _getSelectorMap(); - void _populateTree(std::map); + std::vector >_selectorVec; + std::vector > _getSelectorVec(); + std::string _populateTree(std::vector >); class ModelColumns : public Gtk::TreeModel::ColumnRecord { @@ -66,6 +66,8 @@ private: Gtk::Button* del; Gtk::Button* create; SPDocument* _document; + bool _styleExists; + std::string _sValue ; // Signal handlers void _addSelector(); -- cgit v1.2.3 From c21fa260cf5dde3e3558414ad69b05e04f173a73 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Thu, 16 Jun 2016 00:14:01 +0530 Subject: Implement deletion of style selector both from repr and treeview (bzr r14949.1.19) --- src/ui/dialog/styledialog.cpp | 70 ++++++++++++++++++++----------------------- src/ui/dialog/styledialog.h | 2 ++ 2 files changed, 34 insertions(+), 38 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index bab08390c..a56277054 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -94,6 +94,8 @@ StyleDialog::StyleDialog() : * selectors in the style element. */ _styleExists = false; + _document = _targetDesktop->doc(); + _num = _document->getReprRoot()->childCount(); _sValue = _populateTree(_getSelectorVec()); } @@ -222,15 +224,13 @@ void StyleDialog::_addSelector() * from selectorValue above. If style element already exists, then * the new selector's content is appended to its previous content. */ - unsigned num = _document->getReprRoot()->childCount(); - Inkscape::XML::Node *styleChild; - for ( unsigned i = 0; i < num; ++i ) + for ( unsigned i = 0; i < _num; ++i ) { if ( std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style" ) { _styleExists = true; - styleChild = _document->getReprRoot()->nthChild(i); + _styleChild = _document->getReprRoot()->nthChild(i); break; } else @@ -240,7 +240,7 @@ void StyleDialog::_addSelector() if ( _styleExists ) { _sValue = _sValue + selectorValue; - styleChild->firstChild()->setContent(_sValue.c_str()); + _styleChild->firstChild()->setContent(_sValue.c_str()); } else { @@ -264,46 +264,34 @@ void StyleDialog::_addSelector() /** * @brief StyleDialog::_delSelector - * This function deletes selector when '-' at the bottom is clicked. Currently - * selectors are deleted from StyleDialog and not from repr of the document. + * This function deletes selector when '-' at the bottom is clicked. The index + * of selected row is obtained and the corresponding selector and its values are + * deleted from the selector vector. Then _sValue's content is reset and contains + * only selectors remaining in the selVec (or treeview). */ void StyleDialog::_delSelector() { Glib::RefPtr refTreeSelection = _treeView.get_selection(); Gtk::TreeModel::iterator iter = refTreeSelection->get_selected(); std::vector >selVec = _getSelectorVec(); + Gtk::TreeModel::Path path; if (iter) { Gtk::TreeModel::Row row = *iter; -// for( unsigned it = 0; it < selMap.size(); ++it ) { -// std::string key = strtok(strdup(_document->getReprRoot() -// ->nthChild(it) -// ->firstChild()->content()), "{"); + path = _treeView.get_model()->get_path(iter); + int i = atoi(path.to_string().c_str()); + selVec.erase(selVec.begin()+i); + _sValue.clear(); - /** - * @brief toDeleteNode - * The node to be deleted is obtained using nthChild and the selector - * name and corresponding style node from the repr of document are - * saved to a map. Keys of this map and labels of selected rows of - * dialog are compared and deleted. - */ -// Inkscape::XML::Node *toDeleteNode = _document->getReprRoot()->nthChild(it); -// std::maptoDeleteMap; -// toDeleteMap[key] = toDeleteNode; - -// for( std::map::iterator i = -// toDeleteMap.begin(); i != toDeleteMap.end(); ++i ) { -// if( row[_mColumns._selectorLabel] == i->first) -// { -// std::cout << i->second->name() << std::endl; -// /** -// This should work but uncommenting it causes a crash currently. -// */ -// //_document->getReprRoot()->removeChild(toDeleteNode); -// } -// } -// } + for (unsigned i = 0; i < selVec.size(); ++i) + { + std::string selValue = (selVec[i].first + "{" + + selVec[i].second + " }\n"); + _sValue.append(selValue.c_str()); + } + + _styleChild->firstChild()->setContent(_sValue.c_str()); _store->erase(row); } } @@ -333,13 +321,10 @@ std::string StyleDialog::_setClassAttribute(std::vector sel) */ std::vector >StyleDialog::_getSelectorVec() { - _document = _targetDesktop->doc(); - unsigned num = _document->getReprRoot()->childCount(); - std::string key, value; std::vector > selVec; - for ( unsigned i = 0; i < num; ++i ) + for ( unsigned i = 0; i < _num; ++i ) { if ( std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style" ) { @@ -385,6 +370,15 @@ std::string StyleDialog::_populateTree(std::vector 0) del->set_sensitive(true); + for ( unsigned i = 0; i < _num; ++i ) + { + if ( std::string(_document->getReprRoot()->nthChild(i)->name()) + == "svg:style" ) + { + _styleChild = _document->getReprRoot()->nthChild(i); + } + } + return selectorValue; } diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 0cba3bf5b..502a7a3d4 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -68,6 +68,8 @@ private: SPDocument* _document; bool _styleExists; std::string _sValue ; + Inkscape::XML::Node *_styleChild; + unsigned _num; // Signal handlers void _addSelector(); -- cgit v1.2.3 From 425108aeb0731b11a5751b04f8e029b7a48ad0ab Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 16 Jun 2016 14:01:16 +0200 Subject: Fix z-cycling (alt+mousewheel) behavior Fixed bugs: - https://launchpad.net/bugs/1589420 (bzr r14988) --- src/ui/tools/select-tool.cpp | 199 ++++++++++++++++++------------------------- src/ui/tools/select-tool.h | 3 +- 2 files changed, 84 insertions(+), 118 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 905e38f2b..5b48d65be 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -111,7 +111,6 @@ SelectTool::SelectTool() //static gint tolerance = 0; //static bool within_tolerance = false; static bool is_cycling = false; -static bool moved_while_cycling = false; SelectTool::~SelectTool() { @@ -386,54 +385,68 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { } void SelectTool::sp_select_context_cycle_through_items(Inkscape::Selection *selection, GdkEventScroll *scroll_event, bool shift_pressed) { - if (this->cycling_cur_item == this->cycling_items.end()) { + if ( this->cycling_items.empty() ) return; - } Inkscape::DrawingItem *arenaitem; - SPItem *item = *cycling_cur_item; - g_assert(item != NULL); - // Deactivate current item - if (std::find(cycling_items_selected_before.begin(), cycling_items_selected_before.end(), item) == cycling_items_selected_before.end() && selection->includes(item)) { - selection->remove(item); + if(cycling_cur_item) { + arenaitem = cycling_cur_item->get_arenaitem(desktop->dkey); + arenaitem->setOpacity(0.3); } - arenaitem = item->get_arenaitem(desktop->dkey); - arenaitem->setOpacity(0.3); - // Find next item and activate it - std::vector::iterator next = this->cycling_cur_item; + + + std::vector::iterator next = cycling_items.end(); + if (scroll_event->direction == GDK_SCROLL_UP) { - ++next; - if (next == this->cycling_items.end() && this->cycling_wrap) { - next = this->cycling_items.begin(); + if (! cycling_cur_item) { + next = cycling_items.begin(); + } else { + next = std::find( cycling_items.begin(), cycling_items.end(), cycling_cur_item ); + g_assert (next != cycling_items.end()); + next++; + if (next == cycling_items.end()) + if ( cycling_wrap ) + next = cycling_items.begin(); + else + next--; } - } else { - if(next == this->cycling_items.begin()) { - next = this->cycling_items.end(); + } else { + if (! cycling_cur_item) { + next = cycling_items.end(); + next--; + } else { + next = std::find( cycling_items.begin(), cycling_items.end(), cycling_cur_item ); + g_assert (next != cycling_items.end()); + if (next == cycling_items.begin()){ + if ( cycling_wrap ) { + next = cycling_items.end(); + next--; + } + } else { + next--; + } } - --next; } - if (next!=this->cycling_items.end()) { - this->cycling_cur_item = next; - item = *next; - g_assert(item != NULL); - } + this->cycling_cur_item = *next; + g_assert(next != cycling_items.end()); + g_assert(cycling_cur_item != NULL); - arenaitem = item->get_arenaitem(desktop->dkey); + arenaitem = cycling_cur_item->get_arenaitem(desktop->dkey); arenaitem->setOpacity(1.0); if (shift_pressed) { - selection->add(item); + selection->add(cycling_cur_item); } else { - selection->set(item); + selection->set(cycling_cur_item); } } void SelectTool::sp_select_context_reset_opacities() { - for (std::vector::const_iterator l = this->cycling_items.begin(); l != this->cycling_items.end(); ++l ) { + for (std::vector::const_iterator l = this->cycling_items_cmp.begin(); l != this->cycling_items_cmp.end(); ++l ) { SPItem *item = *l; if (item) { Inkscape::DrawingItem *arenaitem = item->get_arenaitem(desktop->dkey); @@ -443,10 +456,8 @@ void SelectTool::sp_select_context_reset_opacities() { } } - this->cycling_items.clear(); - this->cycling_items_selected_before.clear(); - this->cycling_cur_item = this->cycling_items.end(); this->cycling_items_cmp.clear(); + this->cycling_cur_item = NULL; } bool SelectTool::root_handler(GdkEvent* event) { @@ -533,11 +544,7 @@ bool SelectTool::root_handler(GdkEvent* event) { case GDK_MOTION_NOTIFY: { - if (is_cycling) { - moved_while_cycling = true; - } - - tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); + tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); if ((event->motion.state & GDK_BUTTON1_MASK) && !this->space_panning) { Geom::Point const motion_pt(event->motion.x, event->motion.y); @@ -796,98 +803,58 @@ bool SelectTool::root_handler(GdkEvent* event) { break; case GDK_SCROLL: { - GdkEventScroll *scroll_event = (GdkEventScroll*) event; - - if (scroll_event->state & GDK_MOD1_MASK) { // alt modified pressed - if (moved_while_cycling) { - moved_while_cycling = false; - this->sp_select_context_reset_opacities(); - } - is_cycling = true; - - bool shift_pressed = scroll_event->state & GDK_SHIFT_MASK; - - /* Rebuild list of items underneath the mouse pointer */ - Geom::Point p = desktop->d2w(desktop->point()); - SPItem *item = desktop->getItemAtPoint(p, true, NULL); - - // Save pointer to current cycle-item so that we can find it again later, in the freshly built list - SPItem *tmp_cur_item = this->cycling_cur_item!=this->cycling_items.end() ? (*(this->cycling_cur_item)) : NULL; - this->cycling_items.clear(); - this->cycling_cur_item = this->cycling_items.end(); - while(item != NULL) { - this->cycling_items.push_back(item); - item = desktop->getItemAtPoint(p, true, item); - } - - /* Compare current item list with item list during previous scroll ... */ - bool item_lists_differ = this->cycling_items != this->cycling_items_cmp; - - /* If list of items under mouse pointer hasn't changed ... */ - if (!item_lists_differ) { - // ... find current item in the freshly built list and continue cycling ... - // TODO: This wouldn't be necessary if cycling_cur_item pointed to an element of cycling_items_cmp instead - this->cycling_cur_item = std::find(this->cycling_items.begin(), this->cycling_items.end(), tmp_cur_item); - g_assert(this->cycling_cur_item != this->cycling_items.end() || this->cycling_items.empty()); - } else { - // ... otherwise reset opacities for outdated items ... - Inkscape::DrawingItem *arenaitem; - - for (std::vector::const_iterator l = this->cycling_items_cmp.begin(); l != this->cycling_items_cmp.end(); ++l) { - SPItem *item = *l; - if (item) { - arenaitem = item->get_arenaitem(desktop->dkey); - arenaitem->setOpacity(1.0); - //if (!shift_pressed && !g_list_find(this->cycling_items_selected_before, item) && selection->includes(item)) - if (std::find(this->cycling_items_selected_before.begin(),this->cycling_items_selected_before.end(), item)==this->cycling_items_selected_before.end() && selection->includes(item)) { - selection->remove(item); - } - } - } + GdkEventScroll *scroll_event = (GdkEventScroll*) event; - // ... clear the lists ... + if ( ! (scroll_event->state & GDK_MOD1_MASK)) // do nothing specific if alt was not pressed + break; - this->cycling_items_cmp.clear(); - this->cycling_items_selected_before.clear(); - this->cycling_cur_item = this->cycling_items.end(); + bool shift_pressed = scroll_event->state & GDK_SHIFT_MASK; + is_cycling = true; - // ... and rebuild them with the new items. - this->cycling_items_cmp = (this->cycling_items); + /* Rebuild list of items underneath the mouse pointer */ + Geom::Point p = desktop->d2w(desktop->point()); + SPItem *item = desktop->getItemAtPoint(p, true, NULL); + this->cycling_items.clear(); - for(std::vector::const_iterator l = this->cycling_items.begin(); l != this->cycling_items.end(); ++l) { - SPItem *item =*l; - if (item) { - arenaitem = item->get_arenaitem(desktop->dkey); - arenaitem->setOpacity(0.3); + SPItem *tmp = NULL; + while(item != NULL) { + this->cycling_items.push_back(item); + item = desktop->getItemAtPoint(p, true, item); + if (selection->includes(item)) tmp = item; + } - if (selection->includes(item)) { - // already selected items are stored separately, too - this->cycling_items_selected_before.push_back(item); - } - } else { - g_assert_not_reached(); - } + /* Compare current item list with item list during previous scroll ... */ + bool item_lists_differ = this->cycling_items != this->cycling_items_cmp; + + if(item_lists_differ) { + this->sp_select_context_reset_opacities(); + for (std::vector::const_iterator l = this->cycling_items_cmp.begin(); l != this->cycling_items_cmp.end(); ++l) + selection->remove(*l); // deselects the previous content of the cycling loop + this->cycling_items_cmp = (this->cycling_items); + + // set opacities in new stack + for(std::vector::const_iterator l = this->cycling_items.begin(); l != this->cycling_items.end(); ++l) { + SPItem *item =*l; + if (item) { + Inkscape::DrawingItem *arenaitem = item->get_arenaitem(desktop->dkey); + arenaitem->setOpacity(0.3); } - - // set the current item to the bottommost one so that the cycling step below re-starts at the top - this->cycling_cur_item = this->cycling_items.end(); - this->cycling_cur_item--; } + } + if(!cycling_cur_item) cycling_cur_item = tmp; - this->cycling_wrap = prefs->getBool("/options/selection/cycleWrap", true); + this->cycling_wrap = prefs->getBool("/options/selection/cycleWrap", true); - // Cycle through the items underneath the mouse pointer, one-by-one - this->sp_select_context_cycle_through_items(selection, scroll_event, shift_pressed); + // Cycle through the items underneath the mouse pointer, one-by-one + this->sp_select_context_cycle_through_items(selection, scroll_event, shift_pressed); - ret = TRUE; + ret = TRUE; - GtkWindow *w =GTK_WINDOW(gtk_widget_get_toplevel( GTK_WIDGET(desktop->canvas) )); - if (w) - { - gtk_window_present(w); - gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas)); - } + GtkWindow *w =GTK_WINDOW(gtk_widget_get_toplevel( GTK_WIDGET(desktop->canvas) )); + if (w) { + gtk_window_present(w); + gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas)); } break; } diff --git a/src/ui/tools/select-tool.h b/src/ui/tools/select-tool.h index af183b1ca..420374661 100644 --- a/src/ui/tools/select-tool.h +++ b/src/ui/tools/select-tool.h @@ -42,8 +42,7 @@ public: std::vector cycling_items; std::vector cycling_items_cmp; - std::vector cycling_items_selected_before; - std::vector::iterator cycling_cur_item; + SPItem *cycling_cur_item; bool cycling_wrap; SPItem *item; -- cgit v1.2.3 From f5eb74652e628b4424647e798da1d0c05d6f4b2f Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 16 Jun 2016 14:07:58 +0200 Subject: remove tabs (bzr r14989) --- src/ui/tools/select-tool.cpp | 58 ++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 5b48d65be..b5ec3d88e 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -65,7 +65,7 @@ static gint rb_escaped = 0; // if non-zero, rubberband was canceled by esc, so t static gint drag_escaped = 0; // if non-zero, drag was canceled by esc const std::string& SelectTool::getPrefsPath() { - return SelectTool::prefsPath; + return SelectTool::prefsPath; } const std::string SelectTool::prefsPath = "/tools/select"; @@ -296,7 +296,7 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { } else { GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); - this->dragging = TRUE; + this->dragging = TRUE; this->moved = FALSE; gdk_window_set_cursor(window, CursorSelectDragging); @@ -346,11 +346,11 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { break; } case GDK_LEAVE_NOTIFY: - if (!desktop->isWaitingCursor() && !this->dragging) { + if (!desktop->isWaitingCursor() && !this->dragging) { GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); gdk_window_set_cursor(window, this->cursor); - } + } break; case GDK_KEY_PRESS: @@ -378,7 +378,7 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { } if (!ret) { - ret = ToolBase::item_handler(item, event); + ret = ToolBase::item_handler(item, event); } return ret; @@ -710,7 +710,7 @@ bool SelectTool::root_handler(GdkEvent* event) { if (r->is_started() && !within_tolerance) { // this was a rubberband drag - std::vector items; + std::vector items; if (r->getMode() == RUBBERBAND_MODE_RECT) { Geom::OptRect const b = r->getRectangle(); @@ -860,10 +860,10 @@ bool SelectTool::root_handler(GdkEvent* event) { } case GDK_KEY_PRESS: // keybindings for select context - { - { - guint keyval = get_group0_keyval(&event->key); - + { + { + guint keyval = get_group0_keyval(&event->key); + bool alt = ( MOD__ALT(event) || (keyval == GDK_KEY_Alt_L) || (keyval == GDK_KEY_Alt_R) @@ -891,7 +891,7 @@ bool SelectTool::root_handler(GdkEvent* event) { // if Alt and nonempty selection, show moving cursor ("move selected"): if (alt && !selection->isEmpty() && !desktop->isWaitingCursor()) { - GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); + GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); gdk_window_set_cursor(window, CursorSelectDragging); } @@ -912,15 +912,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), mul*-10, 0); // shift + sp_selection_move_screen(desktop->getSelection(), mul*-10, 0); // shift } else { - sp_selection_move_screen(desktop->getSelection(), mul*-1, 0); // no shift + sp_selection_move_screen(desktop->getSelection(), mul*-1, 0); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), mul*-10*nudge, 0); // shift + sp_selection_move(desktop->getSelection(), mul*-10*nudge, 0); // shift } else { - sp_selection_move(desktop->getSelection(), mul*-nudge, 0); // no shift + sp_selection_move(desktop->getSelection(), mul*-nudge, 0); // no shift } } @@ -935,15 +935,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), 0, mul*10); // shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*10); // shift } else { - sp_selection_move_screen(desktop->getSelection(), 0, mul*1); // no shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*1); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), 0, mul*10*nudge); // shift + sp_selection_move(desktop->getSelection(), 0, mul*10*nudge); // shift } else { - sp_selection_move(desktop->getSelection(), 0, mul*nudge); // no shift + sp_selection_move(desktop->getSelection(), 0, mul*nudge); // no shift } } @@ -958,15 +958,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), mul*10, 0); // shift + sp_selection_move_screen(desktop->getSelection(), mul*10, 0); // shift } else { - sp_selection_move_screen(desktop->getSelection(), mul*1, 0); // no shift + sp_selection_move_screen(desktop->getSelection(), mul*1, 0); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), mul*10*nudge, 0); // shift + sp_selection_move(desktop->getSelection(), mul*10*nudge, 0); // shift } else { - sp_selection_move(desktop->getSelection(), mul*nudge, 0); // no shift + sp_selection_move(desktop->getSelection(), mul*nudge, 0); // no shift } } @@ -981,15 +981,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), 0, mul*-10); // shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*-10); // shift } else { - sp_selection_move_screen(desktop->getSelection(), 0, mul*-1); // no shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*-1); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), 0, mul*-10*nudge); // shift + sp_selection_move(desktop->getSelection(), 0, mul*-10*nudge); // shift } else { - sp_selection_move(desktop->getSelection(), 0, mul*-nudge); // no shift + sp_selection_move(desktop->getSelection(), 0, mul*-nudge); // no shift } } @@ -1133,7 +1133,7 @@ bool SelectTool::root_handler(GdkEvent* event) { break; } break; - } + } case GDK_KEY_RELEASE: { guint keyval = get_group0_keyval(&event->key); if (key_is_a_modifier (keyval)) { @@ -1174,7 +1174,7 @@ bool SelectTool::root_handler(GdkEvent* event) { } if (!ret) { - ret = ToolBase::root_handler(event); + ret = ToolBase::root_handler(event); } return ret; -- cgit v1.2.3 From 5d388f13644b59e355e0980c74695247b2191562 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 16 Jun 2016 22:29:40 +0200 Subject: Fixes some bugs related to powerstroke 'Powerstroke infinite loop' Fixed bugs: - https://launchpad.net/bugs/1535444 - https://launchpad.net/bugs/1236320 - https://launchpad.net/bugs/1586973 (bzr r14991) --- src/ui/tools/freehand-base.cpp | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index c98ecb686..7697cd59c 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -236,38 +236,14 @@ static void spdc_apply_powerstroke_shape(const std::vector & points Effect* lpe = SP_LPE_ITEM(item)->getCurrentLPE(); static_cast(lpe)->offset_points.param_set_and_write_new_value(points); - // find out stroke width (TODO: is there an easier way??) - SPDesktop *desktop = dc->desktop; - Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); - Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); - Inkscape::GC::release(repr); - - char const* tool = SP_IS_PEN_CONTEXT(dc) ? "/tools/freehand/pen" : "/tools/freehand/pencil"; - - // apply the tool's current style - sp_desktop_apply_style_tool(desktop, repr, tool, false); - - double stroke_width = 1.0; - char const *style_str = NULL; - style_str = repr->attribute("style"); - if (style_str) { - SPStyle style(SP_ACTIVE_DOCUMENT); - style.mergeString(style_str); - stroke_width = style.stroke_width.computed; - } - - std::ostringstream s; - s.imbue(std::locale::classic()); - s << points[0][Geom::X] << "," << stroke_width / 2.; - // write powerstroke parameters: lpe->getRepr()->setAttribute("start_linecap_type", "zerowidth"); lpe->getRepr()->setAttribute("end_linecap_type", "zerowidth"); - lpe->getRepr()->setAttribute("cusp_linecap_type", "round"); lpe->getRepr()->setAttribute("sort_points", "true"); lpe->getRepr()->setAttribute("interpolator_type", "CubicBezierJohan"); lpe->getRepr()->setAttribute("interpolator_beta", "0.2"); - lpe->getRepr()->setAttribute("offset_points", s.str().c_str()); + lpe->getRepr()->setAttribute("miter_limit", "4"); + lpe->getRepr()->setAttribute("linejoin_type", "extrp_arc"); } static void spdc_apply_bend_shape(gchar const *svgd, FreehandBase *dc, SPItem *item) @@ -341,12 +317,14 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, bool shape_applied = false; SPCSSAttr *css_item = sp_css_attr_from_object(item, SP_STYLE_FLAG_ALWAYS); const char *cstroke = sp_repr_css_property(css_item, "stroke", "none"); + const char *stroke_width = sp_repr_css_property(css_item, "stroke-width", "0"); + double swidth; + sp_svg_number_read_d(stroke_width, &swidth); static SPItem *bend_item; #define SHAPE_LENGTH 10 #define SHAPE_HEIGHT 10 - if(shape == LAST_APPLIED){ shape = previous_shape_type; @@ -363,7 +341,8 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, { // "triangle in" std::vector points(1); - points[0] = Geom::Point(0., SHAPE_HEIGHT/2); + points[0] = Geom::Point(0., swidth/2); + points[0] *= i2anc_affine(static_cast(item->parent), NULL).inverse(); spdc_apply_powerstroke_shape(points, dc, item); shape_applied = true; @@ -374,7 +353,9 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, // "triangle out" guint curve_length = curve->get_segment_count(); std::vector points(1); - points[0] = Geom::Point((double)curve_length, SHAPE_HEIGHT/2); + points[0] = Geom::Point(0, swidth/2); + points[0] *= i2anc_affine(static_cast(item->parent), NULL).inverse(); + points[0][Geom::X] = (double)curve_length; spdc_apply_powerstroke_shape(points, dc, item); shape_applied = true; @@ -455,7 +436,6 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, if(previous_shape_type == CLIPBOARD){ if(previous_shape_pathv.size() != 0){ spdc_paste_curve_as_freehand_shape(previous_shape_pathv, dc, item); - shape_applied = true; shape = CLIPBOARD; } else{ -- cgit v1.2.3 From 736149f0b6b617c2cf6f6bef55b4606cd70e416b Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Fri, 17 Jun 2016 11:22:07 +0530 Subject: Remove unwanted empty space at top in style dialog (bzr r14949.1.21) --- src/ui/dialog/styledialog.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index a56277054..622bbcdb9 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -53,7 +53,6 @@ StyleDialog::StyleDialog() : _desktop(0) { set_size_request(200, 200); - add(_mainBox); _mainBox.pack_start(_scrolledWindow, Gtk::PACK_EXPAND_WIDGET); _treeView.set_headers_visible(false); @@ -80,10 +79,13 @@ StyleDialog::StyleDialog() : &StyleDialog::_delSelector)); del->set_sensitive(false); - _mainBox.pack_start(_buttonBox, Gtk::PACK_SHRINK); + _mainBox.pack_end(_buttonBox, Gtk::PACK_SHRINK); + _buttonBox.pack_start(*create, Gtk::PACK_SHRINK); _buttonBox.pack_start(*del, Gtk::PACK_SHRINK); + _getContents()->pack_start(_mainBox, Gtk::PACK_EXPAND_WIDGET); + _targetDesktop = getDesktop(); setDesktop(_targetDesktop); -- cgit v1.2.3 From 027da41d7212e9ecaf19439f91266d4888ae96e3 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Fri, 17 Jun 2016 08:14:16 +0200 Subject: Fixing wrong gettext keyword preventing translations from being used. (bzr r14992) --- src/ui/tools/measure-tool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index 0977729ae..63e2460ec 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -346,13 +346,13 @@ MeasureTool::MeasureTool() end_p = readMeasurePoint(false); dimension_offset = 35; // create the knots - this->knot_start = new SPKnot(desktop, N_("Measure start, Shift+Click for position dialog")); + this->knot_start = new SPKnot(desktop, _("Measure start, Shift+Click for position dialog")); this->knot_start->setMode(SP_KNOT_MODE_XOR); this->knot_start->setFill(MT_KNOT_COLOR_NORMAL, MT_KNOT_COLOR_MOUSEOVER, MT_KNOT_COLOR_MOUSEOVER); this->knot_start->setStroke(0x0000007f, 0x0000007f, 0x0000007f); this->knot_start->setShape(SP_KNOT_SHAPE_CIRCLE); this->knot_start->updateCtrl(); - this->knot_end = new SPKnot(desktop, N_("Measure end, Shift+Click for position dialog")); + this->knot_end = new SPKnot(desktop, _("Measure end, Shift+Click for position dialog")); this->knot_end->setMode(SP_KNOT_MODE_XOR); this->knot_end->setFill(MT_KNOT_COLOR_NORMAL, MT_KNOT_COLOR_MOUSEOVER, MT_KNOT_COLOR_MOUSEOVER); this->knot_end->setStroke(0x0000007f, 0x0000007f, 0x0000007f); -- cgit v1.2.3 From 0ce1eb6fcfa054641be8225cf65ef7d01bf0a813 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Fri, 17 Jun 2016 14:49:21 +0530 Subject: Fix a crash while deleting when there was single selector in the style dialog (bzr r14949.1.23) --- src/ui/dialog/styledialog.cpp | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 622bbcdb9..f81faec97 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -283,17 +283,44 @@ void StyleDialog::_delSelector() Gtk::TreeModel::Row row = *iter; path = _treeView.get_model()->get_path(iter); int i = atoi(path.to_string().c_str()); - selVec.erase(selVec.begin()+i); - _sValue.clear(); - for (unsigned i = 0; i < selVec.size(); ++i) + if (selVec.size() != 0) { - std::string selValue = (selVec[i].first + "{" - + selVec[i].second + " }\n"); - _sValue.append(selValue.c_str()); - } + selVec.erase(selVec.begin()+i); + _sValue.clear(); + + if (selVec.size() != 0) + { + for (unsigned i = 0; i < selVec.size(); ++i) + { + std::string selValue = (selVec[i].first + "{" + + selVec[i].second + " }\n"); + _sValue.append(selValue.c_str()); + } - _styleChild->firstChild()->setContent(_sValue.c_str()); + } + + /** + * Only if a value exists in _sValue and there is a _styleChild + * which contains the style element, then the content in style + * element is updated else the _styleChild is set and its content + * is set to an empty string. + */ + if (!_sValue.empty() && _styleChild) + _styleChild->firstChild()->setContent(_sValue.c_str()); + else + { + for ( unsigned i = 0; i < _num; ++i ) + { + if ( std::string(_document->getReprRoot()->nthChild(i)->name()) + == "svg:style" ) + { + _styleChild = _document->getReprRoot()->nthChild(i); + } + } + _styleChild->firstChild()->setContent(""); + } + } _store->erase(row); } } -- cgit v1.2.3 From c5f642fbd66ccb150d361d2861d0b1baa744dcba Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 18 Jun 2016 15:07:51 +0200 Subject: Pre fixing selected points (bzr r13645.1.161) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 7 ++++--- src/ui/tools/node-tool.cpp | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index c86fc4a20..098a84edf 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -117,7 +117,8 @@ FilletChamferPropertiesDialog::~FilletChamferPropertiesDialog() } void FilletChamferPropertiesDialog::showDialog( - SPDesktop *desktop, double _amount, + SPDesktop *desktop, + double _amount, const Inkscape::LivePathEffect:: FilletChamferKnotHolderEntity *pt, bool _use_distance, @@ -243,9 +244,9 @@ void FilletChamferPropertiesDialog::_setPt( } -void FilletChamferPropertiesDialog::_setAmount(double amm) +void FilletChamferPropertiesDialog::_setAmount(double amount) { - _amount = amm; + _amount = amount; } diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 60d4c807f..d02b8e6d3 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -293,14 +293,14 @@ void NodeTool::update_helperpath () { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) { Inkscape::UI::ControlPointSelection::Set &selection_nodes = _selected_nodes->allPoints(); - std::vector selected_nodes_positions; + std::vector selected_nodes_pos; for (Inkscape::UI::ControlPointSelection::Set::iterator i = selection_nodes.begin(); i != selection_nodes.end(); ++i) { if ((*i)->selected()) { Inkscape::UI::Node *n = dynamic_cast(*i); - selected_nodes_positions.push_back(n->position()); + selected_nodes_pos.push_back(n->position()); } } - lpe->setSelectedNodePoints(selected_nodes_positions); + lpe->setSelectedNodePoints(selected_nodes_pos); lpe->setCurrentZoom(this->desktop->current_zoom()); SPCurve *c = new SPCurve(); SPCurve *cc = new SPCurve(); -- cgit v1.2.3 From 38a1a4d45114a681408e763c3afec79f0bc21940 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 18 Jun 2016 18:53:51 +0200 Subject: fixing bug moving nodes (bzr r13645.1.162) --- src/ui/tools/node-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index d02b8e6d3..6a1feb760 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -300,7 +300,7 @@ void NodeTool::update_helperpath () { selected_nodes_pos.push_back(n->position()); } } - lpe->setSelectedNodePoints(selected_nodes_pos); + lpe->setSelectedNodes(selected_nodes_pos); lpe->setCurrentZoom(this->desktop->current_zoom()); SPCurve *c = new SPCurve(); SPCurve *cc = new SPCurve(); -- cgit v1.2.3 From 6820ee49d69cd419c5e8d3c9de74b0552758c842 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 19 Jun 2016 00:58:42 +0200 Subject: Fixes when moves a path (bzr r13645.1.163) --- src/ui/tools/node-tool.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 6a1feb760..9bdc578c1 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -292,15 +292,16 @@ void NodeTool::update_helperpath () { if (SP_IS_LPE_ITEM(selection->singleItem())) { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) { - Inkscape::UI::ControlPointSelection::Set &selection_nodes = _selected_nodes->allPoints(); - std::vector selected_nodes_pos; + Inkscape::UI::ControlPointSelection::Set &selection_nodes = this->_selected_nodes->allPoints(); + std::vector positions; + Geom::Affine affine = SP_ITEM(selection->singleItem())->i2dt_affine(); for (Inkscape::UI::ControlPointSelection::Set::iterator i = selection_nodes.begin(); i != selection_nodes.end(); ++i) { if ((*i)->selected()) { Inkscape::UI::Node *n = dynamic_cast(*i); - selected_nodes_pos.push_back(n->position()); + positions.push_back(n->position() * affine); } } - lpe->setSelectedNodes(selected_nodes_pos); + lpe->setSelectedNodes(positions); lpe->setCurrentZoom(this->desktop->current_zoom()); SPCurve *c = new SPCurve(); SPCurve *cc = new SPCurve(); -- cgit v1.2.3 From 417ba16c9f42a5476045ca4f1825fff2fed518ba Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 19 Jun 2016 03:30:10 +0200 Subject: Organize doeffect function (bzr r13645.1.164) --- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 098a84edf..98b654640 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -167,7 +167,7 @@ void FilletChamferPropertiesDialog::_apply() } _satellite.amount = d_pos; size_t steps = (size_t)_fillet_chamfer_chamfer_subdivisions.get_value(); - if(steps < 1) { + if (steps < 1) { steps = 1; } _satellite.steps = steps; @@ -204,10 +204,10 @@ void FilletChamferPropertiesDialog::_setSatellite(Satellite satellite) { double position; std::string distance_or_radius = std::string(_("Radius")); - if(_aprox) { + if (_aprox) { distance_or_radius = std::string(_("Radius approximated")); } - if(_use_distance) { + if (_use_distance) { distance_or_radius = std::string(_("Knot distance")); } if (satellite.is_time) { -- cgit v1.2.3 From 71959483ca7952c2b90c9b04651c187b6e17a19b Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Sun, 19 Jun 2016 16:29:01 +0530 Subject: Resolve crash when empty string was added via entrybox in style dialog (bzr r14949.1.24) --- src/ui/dialog/styledialog.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index f81faec97..a7a803edd 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -155,11 +155,16 @@ void StyleDialog::_addSelector() * with a dot. */ std::string selectorName = ""; - if ( textEditPtr->get_text().at(0) == '#' || - textEditPtr->get_text().at(0) == '.' ) - selectorName = textEditPtr->get_text(); - else - selectorName = "." + textEditPtr->get_text(); + if ( !textEditPtr->get_text().empty() ) { + if ( textEditPtr->get_text().at(0) == '#' || + textEditPtr->get_text().at(0) == '.' ) + selectorName = textEditPtr->get_text(); + else + selectorName = "." + textEditPtr->get_text(); + } + else { + selectorName = ".Class1"; + } switch (result) { case Gtk::RESPONSE_OK: -- cgit v1.2.3 From 1636c1dd1651780d01759676b194312529f211f7 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Sat, 25 Jun 2016 22:24:26 +0200 Subject: Moved next functions, added namespace, renamed range functions (bzr r14954.1.10) --- src/ui/clipboard.cpp | 6 +++--- src/ui/dialog/align-and-distribute.cpp | 16 ++++++++-------- src/ui/dialog/clonetiler.cpp | 8 ++++---- src/ui/dialog/export.cpp | 14 +++++++------- src/ui/dialog/filter-effects-dialog.cpp | 6 +++--- src/ui/dialog/find.cpp | 2 +- src/ui/dialog/glyphs.cpp | 4 ++-- src/ui/dialog/grid-arrange-tab.cpp | 12 ++++++------ src/ui/dialog/icon-preview.cpp | 2 +- src/ui/dialog/objects.cpp | 2 +- src/ui/dialog/pixelartdialog.cpp | 2 +- src/ui/dialog/polar-arrange-tab.cpp | 2 +- src/ui/dialog/svg-fonts-dialog.cpp | 4 ++-- src/ui/dialog/swatches.cpp | 2 +- src/ui/dialog/tags.cpp | 4 ++-- src/ui/dialog/text-edit.cpp | 6 +++--- src/ui/dialog/transformation.cpp | 14 +++++++------- src/ui/interface.cpp | 2 +- src/ui/tools/connector-tool.cpp | 2 +- src/ui/tools/eraser-tool.cpp | 4 ++-- src/ui/tools/gradient-tool.cpp | 14 +++++++------- src/ui/tools/lpe-tool.cpp | 2 +- src/ui/tools/mesh-tool.cpp | 12 ++++++------ src/ui/tools/node-tool.cpp | 4 ++-- src/ui/tools/select-tool.cpp | 2 +- src/ui/tools/spray-tool.cpp | 10 +++++----- src/ui/tools/tool-base.cpp | 2 +- src/ui/tools/tweak-tool.cpp | 6 +++--- src/ui/widget/style-subject.cpp | 2 +- 29 files changed, 84 insertions(+), 84 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index d581dbf7e..b1a946db2 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -522,7 +522,7 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a // resize each object in the selection if (separately) { - std::vector itemlist=selection->itemList(); + std::vector itemlist= selection->items(); for(std::vector::const_iterator i=itemlist.begin();i!=itemlist.end();++i){ SPItem *item = *i; if (item) { @@ -578,7 +578,7 @@ bool ClipboardManagerImpl::pastePathEffect(SPDesktop *desktop) desktop->doc()->importDefs(tempdoc); // make sure all selected items are converted to paths first (i.e. rectangles) sp_selected_to_lpeitems(desktop); - std::vector itemlist=selection->itemList(); + std::vector itemlist= selection->items(); for(std::vector::const_iterator i=itemlist.begin();i!=itemlist.end();++i){ SPItem *item = *i; _applyPathEffect(item, effectstack); @@ -661,7 +661,7 @@ Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId(SPDesktop *desktop) void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) { // copy the defs used by all items - std::vector itemlist=selection->itemList(); + std::vector itemlist= selection->items(); cloned_elements.clear(); for(std::vector::const_iterator i=itemlist.begin();i!=itemlist.end();++i){ SPItem *item = *i; diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 8f87932b8..b7b5b96cd 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -133,7 +133,7 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool sel_as_group = prefs->getBool("/dialogs/align/sel-as-groups"); - std::vector selected(selection->itemList()); + std::vector selected(selection->items()); if (selected.empty()) return; const Coeffs &a = _allCoeffs[index]; @@ -293,7 +293,7 @@ private : Inkscape::Selection *selection = desktop->getSelection(); if (!selection) return; - std::vector selected(selection->itemList()); + std::vector selected(selection->items()); if (selected.empty()) return; //Check 2 or more selected objects @@ -499,7 +499,7 @@ private : // xGap and yGap are the minimum space required between bounding rectangles. double const xGap = removeOverlapXGap.get_value(); double const yGap = removeOverlapYGap.get_value(); - removeoverlap(_dialog.getDesktop()->getSelection()->itemList(), xGap, yGap); + removeoverlap(_dialog.getDesktop()->getSelection()->items(), xGap, yGap); // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); @@ -530,7 +530,7 @@ private : int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); - graphlayout(_dialog.getDesktop()->getSelection()->itemList()); + graphlayout(_dialog.getDesktop()->getSelection()->items()); // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); @@ -590,7 +590,7 @@ private : Inkscape::Selection *selection = desktop->getSelection(); if (!selection) return; - std::vector selected(selection->itemList()); + std::vector selected(selection->items()); if (selected.empty()) return; //Check 2 or more selected objects @@ -656,7 +656,7 @@ private : Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); - std::vector x(_dialog.getDesktop()->getSelection()->itemList()); + std::vector x(_dialog.getDesktop()->getSelection()->items()); unclump (x); // restore compensation setting @@ -687,7 +687,7 @@ private : Inkscape::Selection *selection = desktop->getSelection(); if (!selection) return; - std::vector selected(selection->itemList()); + std::vector selected(selection->items()); if (selected.empty()) return; //Check 2 or more selected objects @@ -785,7 +785,7 @@ private : Inkscape::Selection *selection = desktop->getSelection(); if (!selection) return; - std::vector selected(selection->itemList()); + std::vector selected(selection->items()); //Check 2 or more selected objects if (selected.size() < 2) return; diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index b727c87ee..7ce937de7 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -1376,7 +1376,7 @@ void CloneTiler::clonetiler_change_selection(Inkscape::Selection *selection, Gtk return; } - if (selection->itemList().size() > 1) { + if (selection->items().size() > 1) { gtk_widget_set_sensitive (buttons, FALSE); gtk_label_set_markup (GTK_LABEL(status), _("More than one object selected.")); return; @@ -2113,7 +2113,7 @@ void CloneTiler::clonetiler_unclump(GtkWidget */*widget*/, void *) Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected - if (selection->isEmpty() || selection->itemList().size() > 1) { + if (selection->isEmpty() || selection->items().size() > 1) { desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select one object whose tiled clones to unclump.")); return; } @@ -2162,7 +2162,7 @@ void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool d Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected - if (selection->isEmpty() || selection->itemList().size() > 1) { + if (selection->isEmpty() || selection->items().size() > 1) { desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select one object whose tiled clones to remove.")); return; } @@ -2240,7 +2240,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) } // Check if more than one object is selected. - if (selection->itemList().size() > 1) { + if (selection->items().size() > 1) { desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("If you want to clone several objects, group them and clone the group.")); return; } diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 2fb5f9e3b..6d2842511 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -608,7 +608,7 @@ void Export::onBatchClicked () void Export::updateCheckbuttons () { - gint num = SP_ACTIVE_DESKTOP->getSelection()->itemList().size(); + gint num = SP_ACTIVE_DESKTOP->getSelection()->items().size(); if (num >= 2) { batch_export.set_sensitive(true); batch_export.set_label(g_strdup_printf (ngettext("B_atch export %d selected object","B_atch export %d selected objects",num), num)); @@ -820,7 +820,7 @@ void Export::onAreaToggled () one that's nice */ if (filename.empty()) { const gchar * id = "object"; - const std::vector reprlst = SP_ACTIVE_DESKTOP->getSelection()->reprList(); + const std::vector reprlst = SP_ACTIVE_DESKTOP->getSelection()->xmlNodes(); for(std::vector::const_iterator i=reprlst.begin(); reprlst.end() != i; ++i) { Inkscape::XML::Node * repr = *i; if (repr->attribute("id")) { @@ -1015,7 +1015,7 @@ void Export::onExport () if (batch_export.get_active ()) { // Batch export of selected objects - gint num = (desktop->getSelection()->itemList()).size(); + gint num = (desktop->getSelection()->items()).size(); gint n = 0; if (num < 1) { @@ -1029,7 +1029,7 @@ void Export::onExport () gint export_count = 0; - std::vector itemlist=desktop->getSelection()->itemList(); + std::vector itemlist= desktop->getSelection()->items(); for(std::vector::const_iterator i = itemlist.begin();i!=itemlist.end() && !interrupted ;++i){ SPItem *item = *i; @@ -1075,7 +1075,7 @@ void Export::onExport () nv->pagecolor, onProgressCallback, (void*)prog_dlg, TRUE, // overwrite without asking - hide ? (desktop->getSelection()->itemList()) : x + hide ? (desktop->getSelection()->items()) : x )) { gchar * error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile); @@ -1165,7 +1165,7 @@ void Export::onExport () nv->pagecolor, onProgressCallback, (void*)prog_dlg, FALSE, - hide ? (desktop->getSelection()->itemList()) : x + hide ? (desktop->getSelection()->items()) : x ); if (status == EXPORT_ERROR) { gchar * safeFile = Inkscape::IO::sanitizeString(path.c_str()); @@ -1237,7 +1237,7 @@ void Export::onExport () bool saved = DocumentUndo::getUndoSensitive(doc); DocumentUndo::setUndoSensitive(doc, false); - reprlst = desktop->getSelection()->reprList(); + reprlst = desktop->getSelection()->xmlNodes(); for(std::vector::const_iterator i=reprlst.begin(); reprlst.end() != i; ++i) { Inkscape::XML::Node * repr = *i; diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index d3ad5d1da..dfc19f3cc 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -691,7 +691,7 @@ private: void select_svg_element(){ Inkscape::Selection* sel = _desktop->getSelection(); if (sel->isEmpty()) return; - Inkscape::XML::Node* node = sel->reprList()[0]; + Inkscape::XML::Node* node = sel->xmlNodes()[0]; if (!node || !node->matchAttributeName("id")) return; std::ostringstream xlikhref; @@ -1474,7 +1474,7 @@ void FilterEffectsDialog::FilterModifier::update_selection(Selection *sel) } std::set used; - std::vector itemlist=sel->itemList(); + std::vector itemlist= sel->items(); for(std::vector::const_iterator i=itemlist.begin(); itemlist.end() != i; ++i) { SPObject *obj = *i; SPStyle *style = obj->style; @@ -1555,7 +1555,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri if((*iter)[_columns.sel] == 1) filter = 0; - std::vector itemlist=sel->itemList(); + std::vector itemlist= sel->items(); for(std::vector::const_iterator i=itemlist.begin(); itemlist.end() != i; ++i) { SPItem * item = *i; SPStyle *style = item->style; diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index 0f368c5ac..8424dd7f5 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -761,7 +761,7 @@ std::vector &Find::all_items (SPObject *r, std::vector &l, boo std::vector &Find::all_selection_items (Inkscape::Selection *s, std::vector &l, SPObject *ancestor, bool hidden, bool locked) { - std::vector itemlist=s->itemList(); + std::vector itemlist= s->items(); for(std::vector::const_reverse_iterator i=itemlist.rbegin(); itemlist.rend() != i; ++i) { SPObject *obj = *i; SPItem *item = dynamic_cast(obj); diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 56b001291..30b0f8df7 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -578,7 +578,7 @@ void GlyphsPanel::setTargetDesktop(SPDesktop *desktop) void GlyphsPanel::insertText() { SPItem *textItem = 0; - std::vector itemlist=targetDesktop->selection->itemList(); + std::vector itemlist= targetDesktop->selection->items(); for(std::vector::const_iterator i=itemlist.begin(); itemlist.end() != i; ++i) { if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) { textItem = *i; @@ -688,7 +688,7 @@ void GlyphsPanel::selectionModifiedCB(guint flags) void GlyphsPanel::calcCanInsert() { int items = 0; - std::vector itemlist=targetDesktop->selection->itemList(); + std::vector itemlist= targetDesktop->selection->items(); for(std::vector::const_iterator i=itemlist.begin(); itemlist.end() != i; ++i) { if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) { ++items; diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 639e463ea..ddcc20cb7 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -163,7 +163,7 @@ void GridArrangeTab::arrange() desktop->getDocument()->ensureUpToDate(); Inkscape::Selection *selection = desktop->getSelection(); - const std::vector items = selection ? selection->itemList() : std::vector(); + const std::vector items = selection ? selection->items() : std::vector(); for(std::vector::const_iterator i = items.begin();i!=items.end(); ++i){ SPItem *item = *i; Geom::OptRect b = item->documentVisualBounds(); @@ -192,7 +192,7 @@ void GridArrangeTab::arrange() // require the sorting done before we can calculate row heights etc. g_return_if_fail(selection); - std::vector sorted(selection->itemList()); + std::vector sorted(selection->items()); sort(sorted.begin(),sorted.end(),sp_compare_y_position); sort(sorted.begin(),sorted.end(),sp_compare_x_position); @@ -368,7 +368,7 @@ void GridArrangeTab::on_row_spinbutton_changed() Inkscape::Selection *selection = desktop ? desktop->selection : 0; g_return_if_fail( selection ); - std::vector const items = selection->itemList(); + std::vector const items = selection->items(); int selcount = items.size(); double PerCol = ceil(selcount / NoOfColsSpinner.get_value()); @@ -394,7 +394,7 @@ void GridArrangeTab::on_col_spinbutton_changed() Inkscape::Selection *selection = desktop ? desktop->selection : 0; g_return_if_fail(selection); - int selcount = selection->itemList().size(); + int selcount = selection->items().size(); double PerRow = ceil(selcount / NoOfRowsSpinner.get_value()); NoOfColsSpinner.set_value(PerRow); @@ -531,7 +531,7 @@ void GridArrangeTab::updateSelection() updating = true; SPDesktop *desktop = Parent->getDesktop(); Inkscape::Selection *selection = desktop ? desktop->selection : 0; - std::vector const items = selection ? selection->itemList() : std::vector(); + std::vector const items = selection ? selection->items() : std::vector(); if (!items.empty()) { int selcount = items.size(); @@ -602,7 +602,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) g_return_if_fail( selection ); int selcount = 1; if (!selection->isEmpty()) { - selcount = selection->itemList().size(); + selcount = selection->items().size(); } diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 83656a1f2..173a964e9 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -362,7 +362,7 @@ void IconPreviewPanel::refreshPreview() if ( sel ) { //g_message("found a selection to play with"); - std::vector const items = sel->itemList(); + std::vector const items = sel->items(); for(std::vector::const_iterator i=items.begin();!target && i!=items.end();++i){ SPItem* item = *i; gchar const *id = item->getId(); diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 27694a9ac..df32f73cf 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -478,7 +478,7 @@ void ObjectsPanel::_objectsSelected( Selection *sel ) { _selectedConnection.block(); _tree.get_selection()->unselect_all(); SPItem *item = NULL; - std::vector const items = sel->itemList(); + std::vector const items = sel->items(); for(std::vector::const_iterator i=items.begin(); i!=items.end(); ++i){ item = *i; if (setOpacity) diff --git a/src/ui/dialog/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp index f557ff0fc..ed62e26b0 100644 --- a/src/ui/dialog/pixelartdialog.cpp +++ b/src/ui/dialog/pixelartdialog.cpp @@ -372,7 +372,7 @@ void PixelArtDialogImpl::vectorize() return; } - std::vector const items = desktop->selection->itemList(); + std::vector const items = desktop->selection->items(); for(std::vector::const_iterator i=items.begin(); i!=items.end();++i){ if ( !SP_IS_IMAGE(*i) ) continue; diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index 5ec1285c1..c160c269f 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -297,7 +297,7 @@ static void moveToPoint(int anchor, SPItem *item, Geom::Point p) void PolarArrangeTab::arrange() { Inkscape::Selection *selection = parent->getDesktop()->getSelection(); - const std::vector tmp(selection->itemList()); + const std::vector tmp(selection->items()); SPGenericEllipse *referenceEllipse = NULL; // Last ellipse in selection bool arrangeOnEllipse = !arrangeOnParametersRadio.get_active(); diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 790c0e5fb..100a620fa 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -524,7 +524,7 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){ return; } - Inkscape::XML::Node* node = sel->reprList().front(); + Inkscape::XML::Node* node = sel->xmlNodes().front(); if (!node) return;//TODO: should this be an assert? if (!node->matchAttributeName("d") || !node->attribute("d")){ char *msg = _("The selected object does not have a path description."); @@ -566,7 +566,7 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ return; } - Inkscape::XML::Node* node = sel->reprList().front(); + Inkscape::XML::Node* node = sel->xmlNodes().front(); if (!node) return;//TODO: should this be an assert? if (!node->matchAttributeName("d") || !node->attribute("d")){ char *msg = _("The selected object does not have a path description."); diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 6577c8d4e..2573719ac 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -123,7 +123,7 @@ static void editGradientImpl( SPDesktop* desktop, SPGradient* gr ) bool shown = false; if ( desktop && desktop->doc() ) { Inkscape::Selection *selection = desktop->getSelection(); - std::vector const items = selection->itemList(); + std::vector const items = selection->items(); if (!items.empty()) { SPStyle query( desktop->doc() ); int result = objects_query_fillstroke((items), &query, true); diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index affbe0a3b..98b0f9502 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -348,7 +348,7 @@ void TagsPanel::_objectsSelected( Selection *sel ) { _selectedConnection.block(); _tree.get_selection()->unselect_all(); - auto tmp = sel->range(); + auto tmp = sel->objects(); for(auto i = tmp.begin(); i != tmp.end(); ++i) { SPObject *obj = *i; @@ -646,7 +646,7 @@ bool TagsPanel::_handleButtonEvent(GdkEventButton* event) if (col == _tree.get_column(COL_ADD - 1) && down_at_add) { if (SP_IS_TAG(obj)) { bool wasadded = false; - std::vector items=_desktop->selection->itemList(); + std::vector items= _desktop->selection->items(); for(std::vector::const_iterator i=items.begin();i!=items.end();++i){ SPObject *newobj = *i; bool addchild = true; diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index c01da8864..355bd16d1 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -443,7 +443,7 @@ SPItem *TextEdit::getSelectedTextItem (void) if (!SP_ACTIVE_DESKTOP) return NULL; - std::vector tmp=SP_ACTIVE_DESKTOP->getSelection()->itemList(); + std::vector tmp= SP_ACTIVE_DESKTOP->getSelection()->items(); for(std::vector::const_iterator i=tmp.begin();i!=tmp.end();++i) { if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) @@ -461,7 +461,7 @@ unsigned TextEdit::getSelectedTextCount (void) unsigned int items = 0; - std::vector tmp=SP_ACTIVE_DESKTOP->getSelection()->itemList(); + std::vector tmp= SP_ACTIVE_DESKTOP->getSelection()->items(); for(std::vector::const_iterator i=tmp.begin();i!=tmp.end();++i) { if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) @@ -568,7 +568,7 @@ void TextEdit::onApply() SPDesktop *desktop = SP_ACTIVE_DESKTOP; unsigned items = 0; - const std::vector item_list = desktop->getSelection()->itemList(); + const std::vector item_list = desktop->getSelection()->items(); SPCSSAttr *css = fillTextStyle (); sp_desktop_set_style(desktop, css, true); diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index b7638e8c1..f11ac1ebe 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -650,7 +650,7 @@ void Transformation::updatePageTransform(Inkscape::Selection *selection) { if (selection && !selection->isEmpty()) { if (_check_replace_matrix.get_active()) { - Geom::Affine current (selection->itemList()[0]->transform); // take from the first item in selection + Geom::Affine current (selection->items()[0]->transform); // take from the first item in selection Geom::Affine new_displayed = current; @@ -735,7 +735,7 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) if (_check_move_relative.get_active()) { // shift each object relatively to the previous one - std::vector selected(selection->itemList()); + std::vector selected(selection->items()); if (selected.empty()) return; if (fabs(x) > 1e-6) { @@ -810,7 +810,7 @@ void Transformation::applyPageScale(Inkscape::Selection *selection) bool transform_stroke = prefs->getBool("/options/transform/stroke", true); bool preserve = prefs->getBool("/options/preservetransform/value", false); if (prefs->getBool("/dialogs/transformation/applyseparately")) { - std::vector tmp=selection->itemList(); + std::vector tmp= selection->items(); for(std::vector::const_iterator i=tmp.begin();i!=tmp.end();++i){ SPItem *item = *i; Geom::OptRect bbox_pref = item->desktopPreferredBounds(); @@ -874,7 +874,7 @@ void Transformation::applyPageRotate(Inkscape::Selection *selection) } if (prefs->getBool("/dialogs/transformation/applyseparately")) { - std::vector tmp=selection->itemList(); + std::vector tmp= selection->items(); for(std::vector::const_iterator i=tmp.begin();i!=tmp.end();++i){ SPItem *item = *i; sp_item_rotate_rel(item, Geom::Rotate (angle*M_PI/180.0)); @@ -894,7 +894,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (prefs->getBool("/dialogs/transformation/applyseparately")) { - std::vector items=selection->itemList(); + std::vector items= selection->items(); for(std::vector::const_iterator i = items.begin();i!=items.end();++i){ SPItem *item = *i; @@ -996,7 +996,7 @@ void Transformation::applyPageTransform(Inkscape::Selection *selection) } if (_check_replace_matrix.get_active()) { - std::vector tmp=selection->itemList(); + std::vector tmp= selection->items(); for(std::vector::const_iterator i=tmp.begin();i!=tmp.end();++i){ SPItem *item = *i; item->set_item_transform(displayed); @@ -1149,7 +1149,7 @@ void Transformation::onReplaceMatrixToggled() double f = _scalar_transform_f.getValue(); Geom::Affine displayed (a, b, c, d, e, f); - Geom::Affine current = selection->itemList()[0]->transform; // take from the first item in selection + Geom::Affine current = selection->items()[0]->transform; // take from the first item in selection Geom::Affine new_displayed; if (_check_replace_matrix.get_active()) { diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index ab29471ed..7bbf588a7 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -2096,7 +2096,7 @@ void ContextMenu::ImageEdit(void) } #endif - std::vector itemlist=_desktop->selection->itemList(); + std::vector itemlist= _desktop->selection->items(); for(std::vector::const_iterator i=itemlist.begin();i!=itemlist.end();++i){ Inkscape::XML::Node *ir = (*i)->getRepr(); const gchar *href = ir->attribute("xlink:href"); diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp index 74f2664fe..52ddd589c 100644 --- a/src/ui/tools/connector-tool.cpp +++ b/src/ui/tools/connector-tool.cpp @@ -1306,7 +1306,7 @@ void cc_selection_set_avoid(bool const set_avoid) int changes = 0; - std::vector l = selection->itemList(); + std::vector l = selection->items(); for(std::vector::const_iterator i=l.begin();i!=l.end(); ++i) { SPItem *item = *i; diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index cb7747b2b..a81161ea9 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -692,7 +692,7 @@ void EraserTool::set_to_accumulated() { } } } else { - toWorkOn = selection->itemList(); + toWorkOn = selection->items(); } wasSelection = true; } @@ -744,7 +744,7 @@ void EraserTool::set_to_accumulated() { } if ( !selection->isEmpty() ) { // If the item was not completely erased, track the new remainder. - std::vector nowSel(selection->itemList()); + std::vector nowSel(selection->items()); for (std::vector::const_iterator i2 = nowSel.begin();i2!=nowSel.end();++i2) { remainingItems.push_back(*i2); } diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp index 9d8101cc4..e2bb0dc07 100644 --- a/src/ui/tools/gradient-tool.cpp +++ b/src/ui/tools/gradient-tool.cpp @@ -106,7 +106,7 @@ void GradientTool::selection_changed(Inkscape::Selection*) { if (selection == NULL) { return; } - guint n_obj = selection->itemList().size(); + guint n_obj = selection->items().size(); if (!drag->isNonEmpty() || selection->isEmpty()) return; @@ -492,9 +492,9 @@ bool GradientTool::root_handler(GdkEvent* event) { if (over_line) { // we take the first item in selection, because with doubleclick, the first click // always resets selection to the single object under cursor - sp_gradient_context_add_stop_near_point(this, SP_ITEM(selection->itemList().front()), this->mousepoint_doc, event->button.time); + sp_gradient_context_add_stop_near_point(this, SP_ITEM(selection->items().front()), this->mousepoint_doc, event->button.time); } else { - std::vector items=selection->itemList(); + std::vector items= selection->items(); for (std::vector::const_iterator i = items.begin();i!=items.end();++i) { SPItem *item = *i; SPGradientType new_type = (SPGradientType) prefs->getInt("/tools/gradient/newgradient", SP_GRADIENT_TYPE_LINEAR); @@ -897,7 +897,7 @@ static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint /*sta } else { // Starting from empty space: // Sort items so that the topmost comes last - std::vector items(selection->itemList()); + std::vector items(selection->items()); sort(items.begin(),items.end(),sp_item_repr_compare_position); // take topmost vector = sp_gradient_vector_for_object(document, desktop, SP_ITEM(items.back()), fill_or_stroke); @@ -907,7 +907,7 @@ static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint /*sta SPCSSAttr *css = sp_repr_css_attr_new(); sp_repr_css_set_property(css, "fill-opacity", "1.0"); - std::vector itemlist = selection->itemList(); + std::vector itemlist = selection->items(); for (std::vector::const_iterator i = itemlist.begin();i!=itemlist.end();++i) { //FIXME: see above @@ -931,7 +931,7 @@ static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint /*sta ec->_grdrag->local_change = true; // give the grab out-of-bounds values of xp/yp because we're already dragging // and therefore are already out of tolerance - ec->_grdrag->grabKnot (selection->itemList()[0], + ec->_grdrag->grabKnot (selection->items()[0], type == SP_GRADIENT_TYPE_LINEAR? POINT_LG_END : POINT_RG_R1, -1, // ignore number (though it is always 1) fill_or_stroke, 99999, 99999, etime); @@ -940,7 +940,7 @@ static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint /*sta // status text; we do not track coords because this branch is run once, not all the time // during drag - int n_objects = selection->itemList().size(); + int n_objects = selection->items().size(); rc.message_context->setF(Inkscape::NORMAL_MESSAGE, ngettext("Gradient for %d object; with Ctrl to snap angle", "Gradient for %d objects; with Ctrl to snap angle", n_objects), diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp index 9bbc1ac20..ebcac2279 100644 --- a/src/ui/tools/lpe-tool.cpp +++ b/src/ui/tools/lpe-tool.cpp @@ -396,7 +396,7 @@ lpetool_create_measuring_items(LpeTool *lc, Inkscape::Selection *selection) SPCanvasGroup *tmpgrp = lc->desktop->getTempGroup(); gchar *arc_length; double lengthval; - std::vector items=selection->itemList(); + std::vector items= selection->items(); for(std::vector::const_iterator i=items.begin();i!=items.end();++i){ if (SP_IS_PATH(*i)) { path = SP_PATH(*i); diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 47927667c..9aaa0c14e 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -103,7 +103,7 @@ void MeshTool::selection_changed(Inkscape::Selection* /*sel*/) { return; } - guint n_obj = selection->itemList().size(); + guint n_obj = selection->items().size(); if (!drag->isNonEmpty() || selection->isEmpty()) { return; @@ -467,10 +467,10 @@ bool MeshTool::root_handler(GdkEvent* event) { if (over_line) { // We take the first item in selection, because with doubleclick, the first click // always resets selection to the single object under cursor - sp_mesh_context_split_near_point(this, selection->itemList()[0], this->mousepoint_doc, event->button.time); + sp_mesh_context_split_near_point(this, selection->items()[0], this->mousepoint_doc, event->button.time); } else { // Create a new gradient with default coordinates. - std::vector items=selection->itemList(); + std::vector items= selection->items(); for(std::vector::const_iterator i=items.begin();i!=items.end();++i){ SPItem *item = *i; SPGradientType new_type = SP_GRADIENT_TYPE_MESH; @@ -945,7 +945,7 @@ static void sp_mesh_end_drag(MeshTool &rc) { } else { // Starting from empty space: // Sort items so that the topmost comes last - std::vector items(selection->itemList()); + std::vector items(selection->items()); sort(items.begin(),items.end(),sp_item_repr_compare_position); // take topmost vector = sp_gradient_vector_for_object(document, desktop, SP_ITEM(items.back()), fill_or_stroke); @@ -955,7 +955,7 @@ static void sp_mesh_end_drag(MeshTool &rc) { SPCSSAttr *css = sp_repr_css_attr_new(); sp_repr_css_set_property(css, "fill-opacity", "1.0"); - std::vector items=selection->itemList(); + std::vector items= selection->items(); for(std::vector::const_iterator i=items.begin();i!=items.end();++i){ //FIXME: see above @@ -972,7 +972,7 @@ static void sp_mesh_end_drag(MeshTool &rc) { // status text; we do not track coords because this branch is run once, not all the time // during drag - int n_objects = selection->itemList().size(); + int n_objects = selection->items().size(); rc.message_context->setF(Inkscape::NORMAL_MESSAGE, ngettext("Gradient for %d object; with Ctrl to snap angle", "Gradient for %d objects; with Ctrl to snap angle", n_objects), diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 23aaf6bb1..f7a725794 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -407,7 +407,7 @@ void NodeTool::selection_changed(Inkscape::Selection *sel) { std::set shapes; - std::vector items=sel->itemList(); + std::vector items= sel->items(); for(std::vector::const_iterator i=items.begin();i!=items.end();++i){ SPObject *obj = *i; @@ -444,7 +444,7 @@ void NodeTool::selection_changed(Inkscape::Selection *sel) { } _previous_selection = _current_selection; - _current_selection = sel->itemList(); + _current_selection = sel->items(); this->_multipath->setItems(shapes); this->update_tip(NULL); diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index b5ec3d88e..676a41eaa 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -477,7 +477,7 @@ bool SelectTool::root_handler(GdkEvent* event) { case GDK_2BUTTON_PRESS: if (event->button.button == 1) { if (!selection->isEmpty()) { - SPItem *clicked_item = selection->itemList()[0]; + SPItem *clicked_item = selection->items()[0]; if (dynamic_cast(clicked_item) && !dynamic_cast(clicked_item)) { // enter group if it's not a 3D box desktop->setCurrentLayer(clicked_item); diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 9adaf3879..4f36a827f 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -210,7 +210,7 @@ void SprayTool::update_cursor(bool /*with_shift*/) { gchar *sel_message = NULL; if (!desktop->selection->isEmpty()) { - num = desktop->selection->itemList().size(); + num = desktop->selection->items().size(); sel_message = g_strdup_printf(ngettext("%i object selected","%i objects selected",num), num); } else { sel_message = g_strdup_printf("%s", _("Nothing selected")); @@ -591,7 +591,7 @@ static bool fit_item(SPDesktop *desktop, if (selection->isEmpty()) { return false; } - std::vector const items_selected(selection->itemList()); + std::vector const items_selected(selection->items()); std::vector items_down_erased; for (std::vector::const_iterator i=items_down.begin(); i!=items_down.end(); ++i) { SPItem *item_down = *i; @@ -1002,7 +1002,7 @@ static bool sp_spray_recursive(SPDesktop *desktop, SPItem *unionResult = NULL; // Previous union int i=1; - std::vector items=selection->itemList(); + std::vector items= selection->items(); for(std::vector::const_iterator it=items.begin();it!=items.end(); ++it){ SPItem *item1 = *it; if (i == 1) { @@ -1170,7 +1170,7 @@ static bool sp_spray_dilate(SprayTool *tc, Geom::Point /*event_p*/, Geom::Point double move_standard_deviation = get_move_standard_deviation(tc); { - std::vector const items(selection->itemList()); + std::vector const items(selection->items()); for(std::vector::const_iterator i=items.begin();i!=items.end(); ++i){ SPItem *item = *i; @@ -1299,7 +1299,7 @@ bool SprayTool::root_handler(GdkEvent* event) { guint num = 0; if (!desktop->selection->isEmpty()) { - num = desktop->selection->itemList().size(); + num = desktop->selection->items().size(); } if (num == 0) { this->message_context->flash(Inkscape::ERROR_MESSAGE, _("Nothing selected! Select objects to spray.")); diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 36fe26e76..6da6526bc 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -1158,7 +1158,7 @@ SPItem *sp_event_context_find_item(SPDesktop *desktop, Geom::Point const &p, if (select_under) { SPItem *selected_at_point = desktop->getItemFromListAtPointBottom( - desktop->selection->itemList(), p); + desktop->selection->items(), p); item = desktop->getItemAtPoint(p, into_groups, selected_at_point); if (item == NULL) { // we may have reached bottom, flip over to the top item = desktop->getItemAtPoint(p, into_groups, NULL); diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index 39a7a3f0b..4da8060e2 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -153,7 +153,7 @@ void TweakTool::update_cursor (bool with_shift) { gchar *sel_message = NULL; if (!desktop->selection->isEmpty()) { - num = desktop->selection->itemList().size(); + num = desktop->selection->items().size(); sel_message = g_strdup_printf(ngettext("%i object selected","%i objects selected",num), num); } else { sel_message = g_strdup_printf("%s", _("Nothing selected")); @@ -1076,7 +1076,7 @@ sp_tweak_dilate (TweakTool *tc, Geom::Point event_p, Geom::Point p, Geom::Point double move_force = get_move_force(tc); double color_force = MIN(sqrt(path_force)/20.0, 1); - std::vector items=selection->itemList(); + std::vector items= selection->items(); for(std::vector::const_iterator i=items.begin();i!=items.end(); ++i){ SPItem *item = *i; @@ -1185,7 +1185,7 @@ bool TweakTool::root_handler(GdkEvent* event) { guint num = 0; if (!desktop->selection->isEmpty()) { - num = desktop->selection->itemList().size(); + num = desktop->selection->items().size(); } if (num == 0) { this->message_context->flash(Inkscape::ERROR_MESSAGE, _("Nothing selected! Select objects to tweak.")); diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index 5f697e420..059d1a4e3 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -58,7 +58,7 @@ Inkscape::Selection *StyleSubject::Selection::_getSelection() const { std::vector StyleSubject::Selection::list() { Inkscape::Selection *selection = _getSelection(); if(selection) { - return std::vector(selection->range().begin(), selection->range().end()); + return std::vector(selection->objects().begin(), selection->objects().end()); } return std::vector(); -- cgit v1.2.3 From 47a71e1eb00db2a3b6030ff545f624283a95e174 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Sun, 26 Jun 2016 09:24:02 +0530 Subject: Add/Remove objects to/from selector (bzr r14949.1.27) --- src/ui/dialog/styledialog.cpp | 252 ++++++++++++++++++++++++++++-------------- src/ui/dialog/styledialog.h | 11 +- 2 files changed, 178 insertions(+), 85 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index a7a803edd..6cb970eae 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -59,13 +59,20 @@ StyleDialog::StyleDialog() : _scrolledWindow.add(_treeView); _scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - _store = Gtk::ListStore::create(_mColumns); + _store = Gtk::TreeStore::create(_mColumns); _treeView.set_model(_store); Inkscape::UI::Widget::AddToIcon * addRenderer = manage( new Inkscape::UI::Widget::AddToIcon() ); addRenderer->property_active() = true; - _treeView.append_column("type", *addRenderer); + + int addCol = _treeView.append_column("type", *addRenderer) - 1; + + Gtk::TreeViewColumn *col = _treeView.get_column(addCol); + if ( col ) { + col->add_attribute( addRenderer->property_active(), _mColumns._colAddRemove ); + } + _treeView.append_column("Selector Name", _mColumns._selectorLabel); create = manage( new Gtk::Button() ); @@ -99,6 +106,11 @@ StyleDialog::StyleDialog() : _document = _targetDesktop->doc(); _num = _document->getReprRoot()->childCount(); _sValue = _populateTree(_getSelectorVec()); + + _treeView.signal_button_press_event().connect(sigc::mem_fun(*this, + &StyleDialog:: + _handleButtonEvent), + false); } StyleDialog::~StyleDialog() @@ -119,7 +131,7 @@ void StyleDialog::setDesktop( SPDesktop* desktop ) */ void StyleDialog::_addSelector() { - Gtk::TreeModel::Row row = *(_store->append()); + _row = *(_store->append()); /** * On clicking '+' button, an entrybox with default text opens up. If an @@ -154,22 +166,22 @@ void StyleDialog::_addSelector() * selector. If text like 'red' is written in entrybox, it is prefixed * with a dot. */ - std::string selectorName = ""; if ( !textEditPtr->get_text().empty() ) { if ( textEditPtr->get_text().at(0) == '#' || textEditPtr->get_text().at(0) == '.' ) - selectorName = textEditPtr->get_text(); + _selectorName = textEditPtr->get_text(); else - selectorName = "." + textEditPtr->get_text(); + _selectorName = "." + textEditPtr->get_text(); } else { - selectorName = ".Class1"; + _selectorName = ".Class1"; } switch (result) { case Gtk::RESPONSE_OK: textDialogPtr->hide(); - row[_mColumns._selectorLabel] = selectorName; + _row[_mColumns._selectorLabel] = _selectorName; + _row[_mColumns._colAddRemove] = true; break; default: break; @@ -185,11 +197,11 @@ void StyleDialog::_addSelector() * created with an empty value. Also if a class selector is added, then * class attribute for the selected object is set too. */ - if ( _desktop->selection ) { + SPObject *obj; + if ( !_desktop->getSelection()->list().empty() ) { std::vector selected = _desktop->getSelection()->list(); - std::string selectorValue; for ( unsigned i = 0; i < selected.size(); ++i ) { - SPObject *obj = selected.at(i); + obj = selected.at(i); std::string style; if (obj->getRepr()->attribute("style")) @@ -201,7 +213,7 @@ void StyleDialog::_addSelector() if ( std::string(property) == "style" ) { - selectorValue = row[_mColumns._selectorLabel] + "{" + _selectorValue = _row[_mColumns._selectorLabel] + "{" + std::string(value) + "}" + "\n"; } } @@ -213,7 +225,7 @@ void StyleDialog::_addSelector() obj->getRepr()->setAttribute("style", style); } - if ( strcmp(selectorName.substr(0,1).c_str(), ".") == 0 ){ + if ( strcmp(_selectorName.substr(0,1).c_str(), ".") == 0 ){ if (!obj->getRepr()->attribute("class")) obj->getRepr()->setAttribute("class", textEditPtr->get_text() .erase(0,1)); @@ -224,49 +236,49 @@ void StyleDialog::_addSelector() + " " + textEditPtr->get_text() .erase(0,0)); } + } + } + else { + _selectorValue = _selectorName + "{" + "}" + "\n"; + } - /** - * @brief root - * A new style element is added to the document with value obtained - * from selectorValue above. If style element already exists, then - * the new selector's content is appended to its previous content. - */ - for ( unsigned i = 0; i < _num; ++i ) - { - if ( std::string(_document->getReprRoot()->nthChild(i)->name()) - == "svg:style" ) - { - _styleExists = true; - _styleChild = _document->getReprRoot()->nthChild(i); - break; - } - else - _styleExists = false; - } - - if ( _styleExists ) - { - _sValue = _sValue + selectorValue; - _styleChild->firstChild()->setContent(_sValue.c_str()); - } - else - { - _sValue = selectorValue; - Inkscape::XML::Node *root = obj->getRepr()->document()->root(); - Inkscape::XML::Node *newChild = obj->getRepr()->document() - ->createElement("svg:style"); - Inkscape::XML::Node *smallChildren = obj->getRepr()->document() - ->createTextNode(selectorValue.c_str()); - - newChild->appendChild(smallChildren); - Inkscape::GC::release(smallChildren); - - root->addChild(newChild, NULL); - Inkscape::GC::release(newChild); - } - _selectorVec.push_back(std::make_pair(selectorName, selectorValue)); + /** + * @brief root + * A new style element is added to the document with value obtained + * from selectorValue above. If style element already exists, then + * the new selector's content is appended to its previous content. + */ + for ( unsigned i = 0; i < _num; ++i ) { + if ( std::string(_document->getReprRoot()->nthChild(i)->name()) + == "svg:style" ) { + _styleExists = true; + _styleChild = _document->getReprRoot()->nthChild(i); + break; } + else { + _styleExists = false; + } + } + + if ( _styleExists ) { + _sValue = _sValue + _selectorValue; + _styleChild->firstChild()->setContent(_sValue.c_str()); + } + else { + _sValue = _selectorValue; + Inkscape::XML::Node *root = _document->getReprDoc()->root(); + Inkscape::XML::Node *newChild = _document->getReprDoc() + ->createElement("svg:style"); + Inkscape::XML::Node *smallChildren = _document->getReprDoc() + ->createTextNode(_selectorValue.c_str()); + + newChild->appendChild(smallChildren); + Inkscape::GC::release(smallChildren); + + root->addChild(newChild, NULL); + Inkscape::GC::release(newChild); } + _selectorVec.push_back(std::make_pair(_selectorName, _selectorValue)); } /** @@ -283,26 +295,19 @@ void StyleDialog::_delSelector() std::vector >selVec = _getSelectorVec(); Gtk::TreeModel::Path path; - if (iter) - { + if (iter) { Gtk::TreeModel::Row row = *iter; path = _treeView.get_model()->get_path(iter); int i = atoi(path.to_string().c_str()); - if (selVec.size() != 0) - { + if ( selVec.size() != 0 ) { selVec.erase(selVec.begin()+i); _sValue.clear(); - if (selVec.size() != 0) - { - for (unsigned i = 0; i < selVec.size(); ++i) - { - std::string selValue = (selVec[i].first + "{" - + selVec[i].second + " }\n"); - _sValue.append(selValue.c_str()); - } - + for ( unsigned i = 0; i < selVec.size(); ++i ) { + std::string selValue = (selVec[i].first + "{" + + selVec[i].second + " }\n"); + _sValue.append(selValue.c_str()); } /** @@ -311,17 +316,13 @@ void StyleDialog::_delSelector() * element is updated else the _styleChild is set and its content * is set to an empty string. */ - if (!_sValue.empty() && _styleChild) + if ( !_sValue.empty() && _styleChild ) _styleChild->firstChild()->setContent(_sValue.c_str()); - else - { - for ( unsigned i = 0; i < _num; ++i ) - { + else { + for ( unsigned i = 0; i < _num; ++i ) { if ( std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style" ) - { _styleChild = _document->getReprRoot()->nthChild(i); - } } _styleChild->firstChild()->setContent(""); } @@ -358,20 +359,26 @@ std::vector >StyleDialog::_getSelectorVec() std::string key, value; std::vector > selVec; - for ( unsigned i = 0; i < _num; ++i ) - { + for ( unsigned i = 0; i < _num; ++i ) { if ( std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style" ) { std::stringstream str; str << _document->getReprRoot()->nthChild(i)->firstChild()->content(); std::string sel; - while(std::getline(str, sel, '\n')){ + /** + * If a selector without any style attribute content is added, the + * value is set to empty so that its corresponding XML repr is added. + */ + while( std::getline(str, sel, '\n') ){ REMOVE_SPACES(sel); - if (!sel.empty()) + if ( !sel.empty() ) { key = strtok(strdup(sel.c_str()), "{"); - value = strtok(NULL, "}"); + if ( strtok(NULL, "}") != NULL ) + value = strtok(NULL, "}"); + else + value = ""; selVec.push_back(std::make_pair(key, value)); } } @@ -404,18 +411,99 @@ std::string StyleDialog::_populateTree(std::vector 0) del->set_sensitive(true); - for ( unsigned i = 0; i < _num; ++i ) - { + for ( unsigned i = 0; i < _num; ++i ) { if ( std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style" ) - { _styleChild = _document->getReprRoot()->nthChild(i); - } } return selectorValue; } +/** + * @brief StyleDialog::_handleButtonEvent + * @param event + * @return + * This function handles the event when '+' button in front of a selector name + * is clicked. The selected objects (if any) is added to the selector as a child + * in the treeview. + * TODO: Appending children in XML repr. + */ + +bool StyleDialog::_handleButtonEvent(GdkEventButton *event) +{ + if ( event->type == GDK_BUTTON_PRESS && event->button == 1 ) + { + Gtk::TreeViewColumn *col = 0; + + Gtk::TreeModel::Path path; + int x = static_cast(event->x); + int y = static_cast(event->y); + int x2 = 0; + int y2 = 0; + if ( _treeView.get_path_at_pos( x, y, path, col, x2, y2 ) ) { + if ( col == _treeView.get_column(0) ) + { + if ( _desktop->selection ) + { + std::vectorsel = _desktop->selection->list(); + for (unsigned i = 0; i < sel.size(); ++i) + { + SPObject *obj = sel[i]; + Glib::RefPtr refTreeSelection = + _treeView.get_selection(); + Gtk::TreeModel::iterator iter = refTreeSelection-> + get_selected(); + + if ( iter ) + { + Gtk::TreeModel::Row row = *iter; +// SPObject *object = row[_mColumns._colObj]; + + typedef Gtk::TreeModel::Children type_children; + type_children children = row->children(); + Gtk::TreeModel::Row childrow; + + if ( children.size() == 0 && row->parent() == 0 ) + { + childrow = *(_store->append(row->children())); + childrow[_mColumns._selectorLabel] = obj->getId(); + childrow[_mColumns._colAddRemove] = false; +// childrow[_mColumns._colObj] = obj; +// object->getRepr()->appendChild(obj->getRepr()); + } + else + { + for( type_children::iterator it = children.begin(); + it != children.end(); ++it ) + { + Gtk::TreeModel::iterator i = it; + path = _treeView.get_model()->get_path(i); + + if( (*it)->get_value(_mColumns._selectorLabel) + != obj->getId() ) + { + childrow = *(_store->append(row.children())); + childrow[_mColumns._selectorLabel] = obj->getId(); + childrow[_mColumns._colAddRemove] = false; +// childrow[_mColumns._colObj] = obj; +// object->getRepr()->appendChild(obj->getRepr()); + + } + else { + std::cout << "Do nothing" << std::endl; + } + } + } +// std::cout << "repr" << object->getRepr()->content(); + } + } + } + } + } + } +} + } // namespace Dialog } // namespace UI } // namespace Inkscape diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 502a7a3d4..ff4de9a97 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include #include @@ -46,13 +46,15 @@ private: std::vector >_selectorVec; std::vector > _getSelectorVec(); std::string _populateTree(std::vector >); + bool _handleButtonEvent(GdkEventButton *event); class ModelColumns : public Gtk::TreeModel::ColumnRecord { public: ModelColumns() - { add(_selectorLabel); } + { add(_selectorLabel); add(_colAddRemove); } Gtk::TreeModelColumn _selectorLabel; + Gtk::TreeModelColumn _colAddRemove; }; SPDesktop* _desktop; @@ -61,7 +63,7 @@ private: Gtk::VBox _mainBox; Gtk::HBox _buttonBox; Gtk::TreeView _treeView; - Glib::RefPtr _store; + Glib::RefPtr _store; Gtk::ScrolledWindow _scrolledWindow; Gtk::Button* del; Gtk::Button* create; @@ -70,6 +72,9 @@ private: std::string _sValue ; Inkscape::XML::Node *_styleChild; unsigned _num; + std::string _selectorName = ""; + std::string _selectorValue; + Gtk::TreeModel::Row _row; // Signal handlers void _addSelector(); -- cgit v1.2.3 From a401c22ec8acb2a94701ea0fbb7ecf08683ebca1 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Sun, 26 Jun 2016 11:33:48 +0530 Subject: Fix a crash when deleting selectors and some coding style corrections (bzr r14949.1.29) --- src/ui/dialog/styledialog.cpp | 134 +++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 75 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 6cb970eae..3c1ed0a5d 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -148,8 +148,9 @@ void StyleDialog::_addSelector() * is(are) selected and user clicks '+' at the bottom of dialog, the * entrybox will have the id(s) of the selected objects as text. */ - if ( _desktop->selection->isEmpty() ) + if (_desktop->selection->isEmpty()) { textEditPtr->set_text("Class1"); + } else { std::vector selected = _desktop->getSelection()->list(); textEditPtr->set_text(_setClassAttribute(selected)); @@ -166,12 +167,14 @@ void StyleDialog::_addSelector() * selector. If text like 'red' is written in entrybox, it is prefixed * with a dot. */ - if ( !textEditPtr->get_text().empty() ) { - if ( textEditPtr->get_text().at(0) == '#' || - textEditPtr->get_text().at(0) == '.' ) + if (!textEditPtr->get_text().empty()) { + if (textEditPtr->get_text().at(0) == '#' || + textEditPtr->get_text().at(0) == '.') { _selectorName = textEditPtr->get_text(); - else + } + else { _selectorName = "." + textEditPtr->get_text(); + } } else { _selectorName = ".Class1"; @@ -198,43 +201,41 @@ void StyleDialog::_addSelector() * class attribute for the selected object is set too. */ SPObject *obj; - if ( !_desktop->getSelection()->list().empty() ) { + if (!_desktop->getSelection()->list().empty()) { std::vector selected = _desktop->getSelection()->list(); - for ( unsigned i = 0; i < selected.size(); ++i ) { + for (unsigned i = 0; i < selected.size(); ++i) { obj = selected.at(i); std::string style; - if (obj->getRepr()->attribute("style")) - { - for ( List iter = obj->getRepr()->attributeList(); - iter; ++iter ) { + if (obj->getRepr()->attribute("style")) { + for (List iter = obj->getRepr()->attributeList(); + iter; ++iter) { gchar const * property = g_quark_to_string(iter->key); gchar const * value = iter->value; - if ( std::string(property) == "style" ) - { + if (std::string(property) == "style") { _selectorValue = _row[_mColumns._selectorLabel] + "{" + std::string(value) + "}" + "\n"; } } } - - else - { + else { style = " "; obj->getRepr()->setAttribute("style", style); } - if ( strcmp(_selectorName.substr(0,1).c_str(), ".") == 0 ){ - if (!obj->getRepr()->attribute("class")) + if (strcmp(_selectorName.substr(0,1).c_str(), ".") == 0) { + if (!obj->getRepr()->attribute("class")) { obj->getRepr()->setAttribute("class", textEditPtr->get_text() .erase(0,1)); - else + } + else { obj->getRepr()->setAttribute("class", std::string(obj-> getRepr()-> attribute("class")) + " " + textEditPtr->get_text() .erase(0,0)); + } } } } @@ -248,9 +249,9 @@ void StyleDialog::_addSelector() * from selectorValue above. If style element already exists, then * the new selector's content is appended to its previous content. */ - for ( unsigned i = 0; i < _num; ++i ) { - if ( std::string(_document->getReprRoot()->nthChild(i)->name()) - == "svg:style" ) { + for (unsigned i = 0; i < _num; ++i) { + if (std::string(_document->getReprRoot()->nthChild(i)->name()) + == "svg:style") { _styleExists = true; _styleChild = _document->getReprRoot()->nthChild(i); break; @@ -260,7 +261,7 @@ void StyleDialog::_addSelector() } } - if ( _styleExists ) { + if (_styleExists) { _sValue = _sValue + _selectorValue; _styleChild->firstChild()->setContent(_sValue.c_str()); } @@ -300,11 +301,11 @@ void StyleDialog::_delSelector() path = _treeView.get_model()->get_path(iter); int i = atoi(path.to_string().c_str()); - if ( selVec.size() != 0 ) { + if (selVec.size() != 0) { selVec.erase(selVec.begin()+i); _sValue.clear(); - for ( unsigned i = 0; i < selVec.size(); ++i ) { + for (unsigned i = 0; i < selVec.size(); ++i) { std::string selValue = (selVec[i].first + "{" + selVec[i].second + " }\n"); _sValue.append(selValue.c_str()); @@ -316,13 +317,15 @@ void StyleDialog::_delSelector() * element is updated else the _styleChild is set and its content * is set to an empty string. */ - if ( !_sValue.empty() && _styleChild ) + if (!_sValue.empty() && _styleChild) { _styleChild->firstChild()->setContent(_sValue.c_str()); + } else { - for ( unsigned i = 0; i < _num; ++i ) { - if ( std::string(_document->getReprRoot()->nthChild(i)->name()) - == "svg:style" ) + for (unsigned i = 0; i < _num; ++i) { + if (std::string(_document->getReprRoot()->nthChild(i)->name()) + == "svg:style") { _styleChild = _document->getReprRoot()->nthChild(i); + } } _styleChild->firstChild()->setContent(""); } @@ -359,9 +362,8 @@ std::vector >StyleDialog::_getSelectorVec() std::string key, value; std::vector > selVec; - for ( unsigned i = 0; i < _num; ++i ) { - if ( std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style" ) - { + for (unsigned i = 0; i < _num; ++i) { + if (std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style") { std::stringstream str; str << _document->getReprRoot()->nthChild(i)->firstChild()->content(); std::string sel; @@ -370,21 +372,19 @@ std::vector >StyleDialog::_getSelectorVec() * If a selector without any style attribute content is added, the * value is set to empty so that its corresponding XML repr is added. */ - while( std::getline(str, sel, '\n') ){ + while(std::getline(str, sel, '\n')) { REMOVE_SPACES(sel); - if ( !sel.empty() ) - { + if (!sel.empty()) { key = strtok(strdup(sel.c_str()), "{"); - if ( strtok(NULL, "}") != NULL ) - value = strtok(NULL, "}"); - else - value = ""; + char *temp = strtok(NULL, "}"); + if (strtok(temp, "}") != NULL) { + value = strtok(temp, "}"); + } selVec.push_back(std::make_pair(key, value)); } } } } - return selVec; } @@ -400,7 +400,7 @@ std::string StyleDialog::_populateTree(std::vector > _selectVec = _selVec; std::string selectorValue; - for( unsigned it = 0; it < _selectVec.size(); ++it ) { + for(unsigned it = 0; it < _selectVec.size(); ++it) { Gtk::TreeModel::Row row = *(_store->append()); row[_mColumns._selectorLabel] = _selectVec[it].first; std::string selValue = _selectVec[it].first + " { " @@ -408,13 +408,15 @@ std::string StyleDialog::_populateTree(std::vector 0) + if (_selectVec.size() > 0) { del->set_sensitive(true); + } - for ( unsigned i = 0; i < _num; ++i ) { - if ( std::string(_document->getReprRoot()->nthChild(i)->name()) - == "svg:style" ) + for (unsigned i = 0; i < _num; ++i) { + if (std::string(_document->getReprRoot()->nthChild(i)->name()) + == "svg:style") { _styleChild = _document->getReprRoot()->nthChild(i); + } } return selectorValue; @@ -432,70 +434,52 @@ std::string StyleDialog::_populateTree(std::vectortype == GDK_BUTTON_PRESS && event->button == 1 ) - { + if (event->type == GDK_BUTTON_PRESS && event->button == 1) { Gtk::TreeViewColumn *col = 0; - Gtk::TreeModel::Path path; int x = static_cast(event->x); int y = static_cast(event->y); int x2 = 0; int y2 = 0; - if ( _treeView.get_path_at_pos( x, y, path, col, x2, y2 ) ) { - if ( col == _treeView.get_column(0) ) - { - if ( _desktop->selection ) - { + if (_treeView.get_path_at_pos(x, y, path, col, x2, y2)) { + if (col == _treeView.get_column(0)) { + if (_desktop->selection) { std::vectorsel = _desktop->selection->list(); - for (unsigned i = 0; i < sel.size(); ++i) - { + for (unsigned i = 0; i < sel.size(); ++i) { SPObject *obj = sel[i]; Glib::RefPtr refTreeSelection = _treeView.get_selection(); Gtk::TreeModel::iterator iter = refTreeSelection-> get_selected(); - if ( iter ) - { + if (iter) { Gtk::TreeModel::Row row = *iter; -// SPObject *object = row[_mColumns._colObj]; - typedef Gtk::TreeModel::Children type_children; type_children children = row->children(); Gtk::TreeModel::Row childrow; - if ( children.size() == 0 && row->parent() == 0 ) - { + if (children.size() == 0 && row->parent() == 0) { childrow = *(_store->append(row->children())); childrow[_mColumns._selectorLabel] = obj->getId(); childrow[_mColumns._colAddRemove] = false; -// childrow[_mColumns._colObj] = obj; -// object->getRepr()->appendChild(obj->getRepr()); } - else - { - for( type_children::iterator it = children.begin(); - it != children.end(); ++it ) - { + else { + for(type_children::iterator it = children.begin(); + it != children.end(); ++it) { Gtk::TreeModel::iterator i = it; path = _treeView.get_model()->get_path(i); - if( (*it)->get_value(_mColumns._selectorLabel) - != obj->getId() ) - { + if((*it)->get_value(_mColumns._selectorLabel) + != obj->getId()) { childrow = *(_store->append(row.children())); childrow[_mColumns._selectorLabel] = obj->getId(); childrow[_mColumns._colAddRemove] = false; -// childrow[_mColumns._colObj] = obj; -// object->getRepr()->appendChild(obj->getRepr()); - } else { std::cout << "Do nothing" << std::endl; } } } -// std::cout << "repr" << object->getRepr()->content(); } } } -- cgit v1.2.3 From 4a85a11d89d34739eb43496047ee7af67d635c1c Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Sun, 26 Jun 2016 18:52:52 +0530 Subject: Select objects corresponding to selector selected in treeview (bzr r14949.1.30) --- src/ui/dialog/styledialog.cpp | 79 ++++++++++++++++++++++++++++++++++++------- src/ui/dialog/styledialog.h | 6 +++- 2 files changed, 72 insertions(+), 13 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 3c1ed0a5d..1dba1d2df 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -111,6 +111,10 @@ StyleDialog::StyleDialog() : &StyleDialog:: _handleButtonEvent), false); + + _treeView.signal_row_activated().connect(sigc::mem_fun(*this, + &StyleDialog:: + _selectedRowCallback)); } StyleDialog::~StyleDialog() @@ -180,16 +184,6 @@ void StyleDialog::_addSelector() _selectorName = ".Class1"; } - switch (result) { - case Gtk::RESPONSE_OK: - textDialogPtr->hide(); - _row[_mColumns._selectorLabel] = _selectorName; - _row[_mColumns._colAddRemove] = true; - break; - default: - break; - } - del->set_sensitive(true); /** @@ -201,10 +195,12 @@ void StyleDialog::_addSelector() * class attribute for the selected object is set too. */ SPObject *obj; + bool objExists = false; if (!_desktop->getSelection()->list().empty()) { std::vector selected = _desktop->getSelection()->list(); for (unsigned i = 0; i < selected.size(); ++i) { obj = selected.at(i); + objExists = true; std::string style; if (obj->getRepr()->attribute("style")) { @@ -214,7 +210,7 @@ void StyleDialog::_addSelector() gchar const * value = iter->value; if (std::string(property) == "style") { - _selectorValue = _row[_mColumns._selectorLabel] + "{" + _selectorValue = _selectorName + "{" + std::string(value) + "}" + "\n"; } } @@ -241,9 +237,22 @@ void StyleDialog::_addSelector() } else { _selectorValue = _selectorName + "{" + "}" + "\n"; + objExists = false; } - /** + switch (result) { + case Gtk::RESPONSE_OK: + textDialogPtr->hide(); + _row[_mColumns._selectorLabel] = _selectorName; + _row[_mColumns._colAddRemove] = true; + if (objExists) { + _row[_mColumns._colObj] = obj; + } + break; + default: + break; + } + /** * @brief root * A new style element is added to the document with value obtained * from selectorValue above. If style element already exists, then @@ -462,6 +471,7 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) childrow = *(_store->append(row->children())); childrow[_mColumns._selectorLabel] = obj->getId(); childrow[_mColumns._colAddRemove] = false; + childrow[_mColumns._colObj] = obj; } else { for(type_children::iterator it = children.begin(); @@ -474,6 +484,7 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) childrow = *(_store->append(row.children())); childrow[_mColumns._selectorLabel] = obj->getId(); childrow[_mColumns._colAddRemove] = false; + childrow[_mColumns._colObj] = obj; } else { std::cout << "Do nothing" << std::endl; @@ -488,6 +499,50 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) } } +/** + * @brief StyleDialog::_selected_row_callback + * @param path + * This function selects objects in the drawing corresponding to the selector + * selected in the treeview. + */ +void StyleDialog::_selectedRowCallback(const Gtk::TreeModel::Path& path, + Gtk::TreeViewColumn* /* column */) +{ + _desktop->selection->clear(); + Gtk::TreeModel::iterator iter = _store->get_iter(path); + if (iter) { + Gtk::TreeModel::Row row = *iter; + Gtk::TreeModel::Children children = row.children(); + + if (row[_mColumns._colObj]) { + SPObject *obj = row[_mColumns._colObj]; + _desktop->selection->add(obj); + } + + if (children) { + _checkAllChildren(children); + } + } +} + +/** + * @brief StyleDialog::_checkAllChildren + * @param children + * This function iterates children of the row selected in treeview and selects + * the objects corresponding to any selector in child rows. + */ +void StyleDialog::_checkAllChildren(Gtk::TreeModel::Children& children) +{ + for (Gtk::TreeModel::Children::iterator iter = children.begin(); + iter!= children.end(); ++iter) { + Gtk::TreeModel::Row childrow = *iter; + if (childrow[_mColumns._colObj]) { + SPObject *obj = childrow[_mColumns._colObj]; + _desktop->selection->add(obj); + } + } +} + } // namespace Dialog } // namespace UI } // namespace Inkscape diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index ff4de9a97..79897a5b6 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -47,14 +47,18 @@ private: std::vector > _getSelectorVec(); std::string _populateTree(std::vector >); bool _handleButtonEvent(GdkEventButton *event); + void _selectedRowCallback(const Gtk::TreeModel::Path& path, + Gtk::TreeViewColumn* /* column */); + void _checkAllChildren(Gtk::TreeModel::Children& children); class ModelColumns : public Gtk::TreeModel::ColumnRecord { public: ModelColumns() - { add(_selectorLabel); add(_colAddRemove); } + { add(_selectorLabel); add(_colAddRemove); add(_colObj); } Gtk::TreeModelColumn _selectorLabel; Gtk::TreeModelColumn _colAddRemove; + Gtk::TreeModelColumn _colObj; }; SPDesktop* _desktop; -- cgit v1.2.3 From 94e53ff6ca6d0a595415b6f930a4a05adaeb68be Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Tue, 28 Jun 2016 22:18:31 +0530 Subject: Update XML repr when objects are added to selector & some code cleanup (bzr r14949.1.31) --- src/ui/dialog/styledialog.cpp | 180 +++++++++++++++++++++--------------------- src/ui/dialog/styledialog.h | 2 + 2 files changed, 91 insertions(+), 91 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 1dba1d2df..1b93fb550 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -172,13 +172,7 @@ void StyleDialog::_addSelector() * with a dot. */ if (!textEditPtr->get_text().empty()) { - if (textEditPtr->get_text().at(0) == '#' || - textEditPtr->get_text().at(0) == '.') { _selectorName = textEditPtr->get_text(); - } - else { - _selectorName = "." + textEditPtr->get_text(); - } } else { _selectorName = ".Class1"; @@ -252,27 +246,24 @@ void StyleDialog::_addSelector() default: break; } - /** - * @brief root + + /** * A new style element is added to the document with value obtained * from selectorValue above. If style element already exists, then * the new selector's content is appended to its previous content. */ - for (unsigned i = 0; i < _num; ++i) { - if (std::string(_document->getReprRoot()->nthChild(i)->name()) - == "svg:style") { - _styleExists = true; - _styleChild = _document->getReprRoot()->nthChild(i); - break; - } - else { - _styleExists = false; - } + _selectorVec.push_back(std::make_pair(_selectorName, _selectorValue)); + + if (_styleElementNode()) { + _styleChild = _styleElementNode(); + _styleExists = true; + } + else { + _styleExists = false; } if (_styleExists) { - _sValue = _sValue + _selectorValue; - _styleChild->firstChild()->setContent(_sValue.c_str()); + _updateStyleContent(); } else { _sValue = _selectorValue; @@ -288,7 +279,20 @@ void StyleDialog::_addSelector() root->addChild(newChild, NULL); Inkscape::GC::release(newChild); } - _selectorVec.push_back(std::make_pair(_selectorName, _selectorValue)); +} + +/** + * @brief StyleDialog::_updateStyleContent + * This function updates the content in style element as new selectors (or + * objects) are added/removed. + */ +void StyleDialog::_updateStyleContent() +{ + std::string styleContent = ""; + for (unsigned i = 0; i < _selectorVec.size(); ++i) { + styleContent = styleContent + _selectorVec[i].second; + } + _styleElementNode()->firstChild()->setContent(styleContent.c_str()); } /** @@ -297,12 +301,13 @@ void StyleDialog::_addSelector() * of selected row is obtained and the corresponding selector and its values are * deleted from the selector vector. Then _sValue's content is reset and contains * only selectors remaining in the selVec (or treeview). + * TODO: get index of children of rows for correct deletion of rows having + * children. */ void StyleDialog::_delSelector() { Glib::RefPtr refTreeSelection = _treeView.get_selection(); Gtk::TreeModel::iterator iter = refTreeSelection->get_selected(); - std::vector >selVec = _getSelectorVec(); Gtk::TreeModel::Path path; if (iter) { @@ -310,39 +315,46 @@ void StyleDialog::_delSelector() path = _treeView.get_model()->get_path(iter); int i = atoi(path.to_string().c_str()); - if (selVec.size() != 0) { - selVec.erase(selVec.begin()+i); - _sValue.clear(); - - for (unsigned i = 0; i < selVec.size(); ++i) { - std::string selValue = (selVec[i].first + "{" - + selVec[i].second + " }\n"); - _sValue.append(selValue.c_str()); - } + if (_selectorVec.size() != 0) { + _selectorVec.erase(_selectorVec.begin()+i); /** - * Only if a value exists in _sValue and there is a _styleChild - * which contains the style element, then the content in style - * element is updated else the _styleChild is set and its content - * is set to an empty string. + * If there is a _styleChild which contains the style element, then + * the content in style element is updated else the _styleChild is + * obtained and its content is set. */ - if (!_sValue.empty() && _styleChild) { - _styleChild->firstChild()->setContent(_sValue.c_str()); + if (_styleChild) { + _updateStyleContent(); } else { - for (unsigned i = 0; i < _num; ++i) { - if (std::string(_document->getReprRoot()->nthChild(i)->name()) - == "svg:style") { - _styleChild = _document->getReprRoot()->nthChild(i); - } - } - _styleChild->firstChild()->setContent(""); + _styleChild = _styleElementNode(); + _updateStyleContent(); } } _store->erase(row); } } +/** + * @brief StyleDialog::_styleElementNode + * @return + * This function returns the node containing style element. The document's + * children are iterated and the repr of the style element that occurs is + * obtained. + */ +Inkscape::XML::Node* StyleDialog::_styleElementNode() +{ + for (unsigned i = 0; i < _num; ++i) { + if (std::string(_document->getReprRoot()->nthChild(i)->name()) + == "svg:style") { + return _document->getReprRoot()->nthChild(i); + } + else { + return NULL; + } + } +} + /** * @brief StyleDialog::_setClassAttribute * @param sel @@ -412,8 +424,8 @@ std::string StyleDialog::_populateTree(std::vectorappend()); row[_mColumns._selectorLabel] = _selectVec[it].first; - std::string selValue = _selectVec[it].first + " { " - + _selectVec[it].second + " }" + "\n"; + std::string selValue = _selectVec[it].first + "{" + + _selectVec[it].second + "}" + "\n"; selectorValue.append(selValue.c_str()); } @@ -421,12 +433,7 @@ std::string StyleDialog::_populateTree(std::vectorset_sensitive(true); } - for (unsigned i = 0; i < _num; ++i) { - if (std::string(_document->getReprRoot()->nthChild(i)->name()) - == "svg:style") { - _styleChild = _document->getReprRoot()->nthChild(i); - } - } + _styleChild = _styleElementNode(); return selectorValue; } @@ -438,9 +445,7 @@ std::string StyleDialog::_populateTree(std::vectortype == GDK_BUTTON_PRESS && event->button == 1) { @@ -461,37 +466,30 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) Gtk::TreeModel::iterator iter = refTreeSelection-> get_selected(); - if (iter) { + if (iter) + { Gtk::TreeModel::Row row = *iter; typedef Gtk::TreeModel::Children type_children; - type_children children = row->children(); Gtk::TreeModel::Row childrow; - - if (children.size() == 0 && row->parent() == 0) { - childrow = *(_store->append(row->children())); - childrow[_mColumns._selectorLabel] = obj->getId(); - childrow[_mColumns._colAddRemove] = false; - childrow[_mColumns._colObj] = obj; - } - else { - for(type_children::iterator it = children.begin(); + path = _treeView.get_model()->get_path(iter); + childrow = *(_store->append(row->children())); + childrow[_mColumns._selectorLabel] = obj->getId(); + childrow[_mColumns._colAddRemove] = false; + childrow[_mColumns._colObj] = obj; + Gtk::TreeModel::Children children = row.children(); + std::string childStyle; + if (children) { + for(Gtk::TreeModel::Children::iterator it = children.begin(); it != children.end(); ++it) { - Gtk::TreeModel::iterator i = it; - path = _treeView.get_model()->get_path(i); - - if((*it)->get_value(_mColumns._selectorLabel) - != obj->getId()) { - childrow = *(_store->append(row.children())); - childrow[_mColumns._selectorLabel] = obj->getId(); - childrow[_mColumns._colAddRemove] = false; - childrow[_mColumns._colObj] = obj; - } - else { - std::cout << "Do nothing" << std::endl; - } + Gtk::TreeModel::Row row = *it; + SPObject *obj = row[_mColumns._colObj]; + childStyle = "#" + std::string(obj->getId()) + "{" + + std::string(obj->getAttribute("style")) + "}\n"; } } + _selectorVec.push_back(std::make_pair(obj->getId(), childStyle)); } + _updateStyleContent(); } } } @@ -506,21 +504,21 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) * selected in the treeview. */ void StyleDialog::_selectedRowCallback(const Gtk::TreeModel::Path& path, - Gtk::TreeViewColumn* /* column */) + Gtk::TreeViewColumn* column ) { _desktop->selection->clear(); - Gtk::TreeModel::iterator iter = _store->get_iter(path); - if (iter) { - Gtk::TreeModel::Row row = *iter; - Gtk::TreeModel::Children children = row.children(); - - if (row[_mColumns._colObj]) { - SPObject *obj = row[_mColumns._colObj]; - _desktop->selection->add(obj); - } - - if (children) { - _checkAllChildren(children); + if (column == _treeView.get_column(1)) { + Gtk::TreeModel::iterator iter = _store->get_iter(path); + if (iter) { + Gtk::TreeModel::Row row = *iter; + Gtk::TreeModel::Children children = row.children(); + if (row[_mColumns._colObj]) { + SPObject *obj = row[_mColumns._colObj]; + _desktop->selection->add(obj); + } + if (children) { + _checkAllChildren(children); + } } } } diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 79897a5b6..4193752e3 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -50,6 +50,8 @@ private: void _selectedRowCallback(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* /* column */); void _checkAllChildren(Gtk::TreeModel::Children& children); + Inkscape::XML::Node *_styleElementNode(); + void _updateStyleContent(); class ModelColumns : public Gtk::TreeModel::ColumnRecord { -- cgit v1.2.3 From cc89ba02cda5257f76df813d86318b57469ee81e Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Thu, 30 Jun 2016 15:02:15 +0530 Subject: If selectors(children) of a row in treeview are deleted, XML repr is updated and also remove duplicate style element(if one already exists) (bzr r14949.1.33) --- src/ui/dialog/styledialog.cpp | 96 ++++++++++++++++++++++++++++--------------- src/ui/dialog/styledialog.h | 2 +- 2 files changed, 65 insertions(+), 33 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 1b93fb550..3b01faa10 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -83,7 +83,7 @@ StyleDialog::StyleDialog() : del = manage( new Gtk::Button() ); _styleButton(*del, "list-remove", "Remove a CSS Selector"); del->signal_clicked().connect(sigc::mem_fun(*this, - &StyleDialog::_delSelector)); + &StyleDialog::_delSelector)); del->set_sensitive(false); _mainBox.pack_end(_buttonBox, Gtk::PACK_SHRINK); @@ -105,7 +105,7 @@ StyleDialog::StyleDialog() : _styleExists = false; _document = _targetDesktop->doc(); _num = _document->getReprRoot()->childCount(); - _sValue = _populateTree(_getSelectorVec()); + _selectorValue = _populateTree(_getSelectorVec()); _treeView.signal_button_press_event().connect(sigc::mem_fun(*this, &StyleDialog:: @@ -172,7 +172,7 @@ void StyleDialog::_addSelector() * with a dot. */ if (!textEditPtr->get_text().empty()) { - _selectorName = textEditPtr->get_text(); + _selectorName = textEditPtr->get_text(); } else { _selectorName = ".Class1"; @@ -199,7 +199,7 @@ void StyleDialog::_addSelector() if (obj->getRepr()->attribute("style")) { for (List iter = obj->getRepr()->attributeList(); - iter; ++iter) { + iter; ++iter) { gchar const * property = g_quark_to_string(iter->key); gchar const * value = iter->value; @@ -256,17 +256,12 @@ void StyleDialog::_addSelector() if (_styleElementNode()) { _styleChild = _styleElementNode(); - _styleExists = true; - } - else { - _styleExists = false; + _updateStyleContent(); } - - if (_styleExists) { + else if (_styleExists && !_newDrawing) { _updateStyleContent(); } - else { - _sValue = _selectorValue; + else if (!_styleExists) { Inkscape::XML::Node *root = _document->getReprDoc()->root(); Inkscape::XML::Node *newChild = _document->getReprDoc() ->createElement("svg:style"); @@ -292,17 +287,16 @@ void StyleDialog::_updateStyleContent() for (unsigned i = 0; i < _selectorVec.size(); ++i) { styleContent = styleContent + _selectorVec[i].second; } - _styleElementNode()->firstChild()->setContent(styleContent.c_str()); + _styleChild->firstChild()->setContent(styleContent.c_str()); } /** * @brief StyleDialog::_delSelector * This function deletes selector when '-' at the bottom is clicked. The index * of selected row is obtained and the corresponding selector and its values are - * deleted from the selector vector. Then _sValue's content is reset and contains - * only selectors remaining in the selVec (or treeview). - * TODO: get index of children of rows for correct deletion of rows having - * children. + * deleted from the selector vector. If a row has no parent, it is directly + * erased from the vector else the string containing selector row's selector value + * is updated after parsing. */ void StyleDialog::_delSelector() { @@ -316,7 +310,37 @@ void StyleDialog::_delSelector() int i = atoi(path.to_string().c_str()); if (_selectorVec.size() != 0) { - _selectorVec.erase(_selectorVec.begin()+i); + if (!row.parent()) { + _selectorVec.erase(_selectorVec.begin()+i); + } + else { + std::stringstream str; + std::string sel, key, value; + int i; + + for (unsigned it = 0; it < _selectorVec.size(); ++it) { + str << _selectorVec[it].second; + i = it; + } + + while (std::getline(str, sel, '\n')) { + REMOVE_SPACES(sel); + if (!sel.empty()) { + key = strtok(strdup(sel.c_str()), "{"); + char *temp = strtok(NULL, "}"); + if (strtok(temp, "}") != NULL) { + value = strtok(temp, "}"); + } + if (key == "#" + row[_mColumns._selectorLabel]) { + sel = ""; + } + else { + sel = sel; + } + _selectorVec[i].second = sel; + } + } + } /** * If there is a _styleChild which contains the style element, then @@ -347,6 +371,8 @@ Inkscape::XML::Node* StyleDialog::_styleElementNode() for (unsigned i = 0; i < _num; ++i) { if (std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style") { + _styleExists = true; + _newDrawing = true; return _document->getReprRoot()->nthChild(i); } else { @@ -376,15 +402,17 @@ std::string StyleDialog::_setClassAttribute(std::vector sel) * @return selVec * This function returns a vector whose key is the style selector name and value * is the style properties. All style selectors are extracted from svg:style - * element. + * element. _newDrawing is flag is set to false check if an existing drawing is + * opened. */ std::vector >StyleDialog::_getSelectorVec() { std::string key, value; - std::vector > selVec; - for (unsigned i = 0; i < _num; ++i) { if (std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style") { + _styleExists = true; + _newDrawing = false; + _styleChild = _document->getReprRoot()->nthChild(i); std::stringstream str; str << _document->getReprRoot()->nthChild(i)->firstChild()->content(); std::string sel; @@ -401,12 +429,12 @@ std::vector >StyleDialog::_getSelectorVec() if (strtok(temp, "}") != NULL) { value = strtok(temp, "}"); } - selVec.push_back(std::make_pair(key, value)); + _selectorVec.push_back(std::make_pair(key, sel)); } } } } - return selVec; + return _selectorVec; } /** @@ -418,23 +446,21 @@ std::vector >StyleDialog::_getSelectorVec() std::string StyleDialog::_populateTree(std::vector > _selVec) { - std::vector > _selectVec = _selVec; + _selectorVec = _selVec; std::string selectorValue; - for(unsigned it = 0; it < _selectVec.size(); ++it) { + for(unsigned it = 0; it < _selectorVec.size(); ++it) { Gtk::TreeModel::Row row = *(_store->append()); - row[_mColumns._selectorLabel] = _selectVec[it].first; - std::string selValue = _selectVec[it].first + "{" - + _selectVec[it].second + "}" + "\n"; + row[_mColumns._selectorLabel] = _selectorVec[it].first; + _selectorVec[it].second = _selectorVec[it].second + "\n"; + std::string selValue = _selectorVec[it].second; selectorValue.append(selValue.c_str()); } - if (_selectVec.size() > 0) { + if (_selectorVec.size() > 0) { del->set_sensitive(true); } - _styleChild = _styleElementNode(); - return selectorValue; } @@ -489,7 +515,13 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) } _selectorVec.push_back(std::make_pair(obj->getId(), childStyle)); } - _updateStyleContent(); + if (_styleElementNode()) { + _styleChild = _styleElementNode(); + _updateStyleContent(); + } + else if (_styleExists && !_newDrawing) { + _updateStyleContent(); + } } } } diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 4193752e3..fef1a954b 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -75,12 +75,12 @@ private: Gtk::Button* create; SPDocument* _document; bool _styleExists; - std::string _sValue ; Inkscape::XML::Node *_styleChild; unsigned _num; std::string _selectorName = ""; std::string _selectorValue; Gtk::TreeModel::Row _row; + bool _newDrawing; // Signal handlers void _addSelector(); -- cgit v1.2.3 From 0af04b99d1160cf2cfc38adb3a0f74c185da4370 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Thu, 30 Jun 2016 18:43:15 +0530 Subject: Solve some compiler errors (bzr r14949.1.34) --- src/ui/dialog/styledialog.cpp | 12 +++++------- src/ui/dialog/styledialog.h | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 3b01faa10..3d2091aef 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -316,11 +316,11 @@ void StyleDialog::_delSelector() else { std::stringstream str; std::string sel, key, value; - int i; + int index; for (unsigned it = 0; it < _selectorVec.size(); ++it) { str << _selectorVec[it].second; - i = it; + index = it; } while (std::getline(str, sel, '\n')) { @@ -337,7 +337,7 @@ void StyleDialog::_delSelector() else { sel = sel; } - _selectorVec[i].second = sel; + _selectorVec[index].second = sel; } } } @@ -375,10 +375,8 @@ Inkscape::XML::Node* StyleDialog::_styleElementNode() _newDrawing = true; return _document->getReprRoot()->nthChild(i); } - else { - return NULL; - } } + return NULL; } /** @@ -495,7 +493,6 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) if (iter) { Gtk::TreeModel::Row row = *iter; - typedef Gtk::TreeModel::Children type_children; Gtk::TreeModel::Row childrow; path = _treeView.get_model()->get_path(iter); childrow = *(_store->append(row->children())); @@ -527,6 +524,7 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) } } } + return false; } /** diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index fef1a954b..0192b3987 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -77,7 +77,7 @@ private: bool _styleExists; Inkscape::XML::Node *_styleChild; unsigned _num; - std::string _selectorName = ""; + std::string _selectorName; std::string _selectorValue; Gtk::TreeModel::Row _row; bool _newDrawing; -- cgit v1.2.3 From 2c22c31cb8650ad49f5e83c9221524f4cdcd3ddd Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Fri, 1 Jul 2016 12:37:35 +0530 Subject: Solve a spacing issue & fix buttons to add selectors when existing drawing is opened (bzr r14949.1.35) --- src/ui/dialog/styledialog.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 3d2091aef..3ee0e44f7 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -20,7 +20,7 @@ using Inkscape::Util::List; using Inkscape::XML::AttributeRecord; -#define REMOVE_SPACES(x) x.erase(std::remove(x.begin(), x.end(), ' '), x.end()); +#define REMOVE_SPACES(x) x.erase(0, x.find_first_not_of(' ')); namespace Inkscape { namespace UI { @@ -450,6 +450,7 @@ std::string StyleDialog::_populateTree(std::vectorappend()); row[_mColumns._selectorLabel] = _selectorVec[it].first; + row[_mColumns._colAddRemove] = true; _selectorVec[it].second = _selectorVec[it].second + "\n"; std::string selValue = _selectorVec[it].second; selectorValue.append(selValue.c_str()); -- cgit v1.2.3 From 7c35f8e864197a1b2620a5337947bcdfd0b52d5a Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Fri, 1 Jul 2016 17:19:45 +0530 Subject: Add support to select corresponding treeview rows when objects are selected (bzr r14949.1.36) --- src/ui/dialog/styledialog.cpp | 55 ++++++++++++++++++++++++++++++++++++------- src/ui/dialog/styledialog.h | 8 ++++--- 2 files changed, 52 insertions(+), 11 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 3ee0e44f7..406b984d7 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -20,7 +20,8 @@ using Inkscape::Util::List; using Inkscape::XML::AttributeRecord; -#define REMOVE_SPACES(x) x.erase(0, x.find_first_not_of(' ')); +#define REMOVE_SPACES(x) x.erase(0, x.find_first_not_of(' ')); \ + x.erase(x.find_last_not_of(' ') + 1); namespace Inkscape { namespace UI { @@ -126,6 +127,8 @@ void StyleDialog::setDesktop( SPDesktop* desktop ) { Panel::setDesktop(desktop); _desktop = Panel::getDesktop(); + _desktop->selection->connectChanged(sigc::mem_fun(*this, &StyleDialog:: + _selectRow)); } /** @@ -189,6 +192,7 @@ void StyleDialog::_addSelector() * class attribute for the selected object is set too. */ SPObject *obj; + SPObject *selectorObj; bool objExists = false; if (!_desktop->getSelection()->list().empty()) { std::vector selected = _desktop->getSelection()->list(); @@ -241,6 +245,7 @@ void StyleDialog::_addSelector() _row[_mColumns._colAddRemove] = true; if (objExists) { _row[_mColumns._colObj] = obj; + selectorObj = obj; } break; default: @@ -252,7 +257,8 @@ void StyleDialog::_addSelector() * from selectorValue above. If style element already exists, then * the new selector's content is appended to its previous content. */ - _selectorVec.push_back(std::make_pair(_selectorName, _selectorValue)); + _selectorVec.push_back(std::make_pair(std::make_pair(_selectorName, selectorObj), + _selectorValue)); if (_styleElementNode()) { _styleChild = _styleElementNode(); @@ -403,7 +409,7 @@ std::string StyleDialog::_setClassAttribute(std::vector sel) * element. _newDrawing is flag is set to false check if an existing drawing is * opened. */ -std::vector >StyleDialog::_getSelectorVec() +std::vector, std::string> > StyleDialog::_getSelectorVec() { std::string key, value; for (unsigned i = 0; i < _num; ++i) { @@ -427,7 +433,12 @@ std::vector >StyleDialog::_getSelectorVec() if (strtok(temp, "}") != NULL) { value = strtok(temp, "}"); } - _selectorVec.push_back(std::make_pair(key, sel)); + std::string selId = key.erase(0, key.find_first_not_of('#')); + REMOVE_SPACES(selId); + REMOVE_SPACES(key); + SPObject *obj = _document->getObjectById(selId); + _selectorVec.push_back(std::make_pair(std::make_pair(key, obj), + sel)); } } } @@ -441,16 +452,17 @@ std::vector >StyleDialog::_getSelectorVec() * This function populates the treeview with selectors available in the * stylesheet. */ -std::string StyleDialog::_populateTree(std::vector > _selVec) +std::string StyleDialog::_populateTree(std::vector, std::string> > _selVec) { _selectorVec = _selVec; std::string selectorValue; for(unsigned it = 0; it < _selectorVec.size(); ++it) { Gtk::TreeModel::Row row = *(_store->append()); - row[_mColumns._selectorLabel] = _selectorVec[it].first; + row[_mColumns._selectorLabel] = _selectorVec[it].first.first; row[_mColumns._colAddRemove] = true; + row[_mColumns._colObj] = _selectorVec[it].first.second; _selectorVec[it].second = _selectorVec[it].second + "\n"; std::string selValue = _selectorVec[it].second; selectorValue.append(selValue.c_str()); @@ -511,7 +523,9 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) std::string(obj->getAttribute("style")) + "}\n"; } } - _selectorVec.push_back(std::make_pair(obj->getId(), childStyle)); + _selectorVec.push_back(std::make_pair(std::make_pair + (obj->getId(), obj), + childStyle)); } if (_styleElementNode()) { _styleChild = _styleElementNode(); @@ -572,6 +586,31 @@ void StyleDialog::_checkAllChildren(Gtk::TreeModel::Children& children) } } +/** + * @brief StyleDialog::_selectRow + * This function selects the rows in treeview corresponding to an object selected + * in the drawing. + */ +void StyleDialog::_selectRow(Selection */*sel*/) +{ + if (!_desktop->selection->list().empty()) { + SPObject *obj; + std::vector selected = _desktop->getSelection()->list(); + for (unsigned i = 0; i < selected.size(); ++i) { + obj = selected.at(i); + } + + Gtk::TreeModel::Children children = _store->children(); + for(Gtk::TreeModel::Children::iterator iter = children.begin(); + iter != children.end(); ++iter) { + Gtk::TreeModel::Row row = *iter; + if (obj == row[_mColumns._colObj]) { + _treeView.get_selection()->select(row); + } + } + } +} + } // namespace Dialog } // namespace UI } // namespace Inkscape diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 0192b3987..6e1ffbb2c 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -43,15 +43,17 @@ public: private: void _styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip); std::string _setClassAttribute(std::vector); - std::vector >_selectorVec; - std::vector > _getSelectorVec(); - std::string _populateTree(std::vector >); + std::vector, std::string> >_selectorVec; + std::vector, std::string> > _getSelectorVec(); + std::string _populateTree(std::vector, + std::string> >); bool _handleButtonEvent(GdkEventButton *event); void _selectedRowCallback(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* /* column */); void _checkAllChildren(Gtk::TreeModel::Children& children); Inkscape::XML::Node *_styleElementNode(); void _updateStyleContent(); + void _selectRow(Selection *); class ModelColumns : public Gtk::TreeModel::ColumnRecord { -- cgit v1.2.3 From 22262f2db6747eb516283b92abcfd348c700911a Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Fri, 1 Jul 2016 20:57:32 +0200 Subject: Added xmlNodes as range function (bzr r14954.1.12) --- src/ui/dialog/export.cpp | 9 ++++----- src/ui/dialog/filter-effects-dialog.cpp | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 6d2842511..dbee80af9 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -820,8 +820,8 @@ void Export::onAreaToggled () one that's nice */ if (filename.empty()) { const gchar * id = "object"; - const std::vector reprlst = SP_ACTIVE_DESKTOP->getSelection()->xmlNodes(); - for(std::vector::const_iterator i=reprlst.begin(); reprlst.end() != i; ++i) { + auto reprlst = SP_ACTIVE_DESKTOP->getSelection()->xmlNodes(); + for(auto i=reprlst.begin(); reprlst.end() != i; ++i) { Inkscape::XML::Node * repr = *i; if (repr->attribute("id")) { id = repr->attribute("id"); @@ -1231,15 +1231,14 @@ void Export::onExport () break; } case SELECTION_SELECTION: { - std::vector reprlst; SPDocument * doc = SP_ACTIVE_DOCUMENT; bool modified = false; bool saved = DocumentUndo::getUndoSensitive(doc); DocumentUndo::setUndoSensitive(doc, false); - reprlst = desktop->getSelection()->xmlNodes(); + auto reprlst = desktop->getSelection()->xmlNodes(); - for(std::vector::const_iterator i=reprlst.begin(); reprlst.end() != i; ++i) { + for(auto i=reprlst.begin(); reprlst.end() != i; ++i) { Inkscape::XML::Node * repr = *i; const gchar * temp_string; Glib::ustring dir = Glib::path_get_dirname(filename.c_str()); diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index dfc19f3cc..ccba5a278 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -691,7 +691,7 @@ private: void select_svg_element(){ Inkscape::Selection* sel = _desktop->getSelection(); if (sel->isEmpty()) return; - Inkscape::XML::Node* node = sel->xmlNodes()[0]; + Inkscape::XML::Node* node = sel->xmlNodes().front(); if (!node || !node->matchAttributeName("id")) return; std::ostringstream xlikhref; -- cgit v1.2.3 From fefc3d571319771e1ee9e6c6f161d29882e7d7ab Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 2 Jul 2016 14:48:19 +0200 Subject: Fix typo from GList purge that broke SVG Font Editor dialog. (bzr r15005) --- src/ui/dialog/svg-fonts-dialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 790c0e5fb..e96eec5bb 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -266,7 +266,7 @@ void SvgFontsDialog::update_fonts() { SPDesktop* desktop = this->getDesktop(); SPDocument* document = desktop->getDocument(); - std::vector fonts = document->getResourceList( "fonts" ); + std::vector fonts = document->getResourceList( "font" ); _model->clear(); for (std::vector::const_iterator it = fonts.begin(); it != fonts.end(); ++it) { -- cgit v1.2.3 From aeb705274cc983200011d453643d5e3a6d2fd5f9 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 2 Jul 2016 15:53:33 +0200 Subject: Rename function, fix some indenting issues. (bzr r15006) --- src/ui/dialog/svg-fonts-dialog.cpp | 4 +- src/ui/dialog/svg-fonts-dialog.h | 206 +++++++++++++++++++------------------ 2 files changed, 110 insertions(+), 100 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index e96eec5bb..a39955123 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -340,7 +340,7 @@ void SvgFontsDialog::on_font_selection_changed(){ update_sensitiveness(); } -void SvgFontsDialog::on_setwidth_changed(){ +void SvgFontsDialog::on_setfontdata_changed(){ SPFont* spfont = this->get_selected_spfont(); if (spfont){ spfont->horiz_adv_x = setwidth_spin.get_value(); @@ -397,7 +397,7 @@ Gtk::VBox* SvgFontsDialog::global_settings_tab(){ setwidth_hbox->add(*Gtk::manage(new Gtk::Label(_("Set width:")))); setwidth_hbox->add(setwidth_spin); - setwidth_spin.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_setwidth_changed)); + setwidth_spin.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_setfontdata_changed)); setwidth_spin.set_range(0, 4096); setwidth_spin.set_increments(10, 0); global_vbox.pack_start(*setwidth_hbox, false, false); diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h index e5c4631e4..e80bbfd39 100644 --- a/src/ui/dialog/svg-fonts-dialog.h +++ b/src/ui/dialog/svg-fonts-dialog.h @@ -69,64 +69,63 @@ public: SvgFontsDialog(); ~SvgFontsDialog(); - static SvgFontsDialog &getInstance() - { return *new SvgFontsDialog(); } + static SvgFontsDialog &getInstance() { return *new SvgFontsDialog(); } void update_fonts(); SvgFont* get_selected_svgfont(); SPFont* get_selected_spfont(); - SPGlyph* get_selected_glyph(); - SPGlyphKerning* get_selected_kerning_pair(); + SPGlyph* get_selected_glyph(); + SPGlyphKerning* get_selected_kerning_pair(); - //TODO: these methods should be private, right?! + //TODO: these methods should be private, right?! void on_font_selection_changed(); - void on_kerning_pair_selection_changed(); + void on_kerning_pair_selection_changed(); void on_preview_text_changed(); void on_kerning_pair_changed(); void on_kerning_value_changed(); - void on_setwidth_changed(); - void add_font(); - Geom::PathVector flip_coordinate_system(Geom::PathVector pathv); + void on_setfontdata_changed(); + void add_font(); + Geom::PathVector flip_coordinate_system(Geom::PathVector pathv); - //TODO: AttrEntry is currently unused. Should we remove it? + //TODO: AttrEntry is currently unused. Should we remove it? class AttrEntry : public Gtk::HBox - { - public: - AttrEntry(SvgFontsDialog* d, gchar* lbl, const SPAttributeEnum attr); - void set_text(char*); - private: - SvgFontsDialog* dialog; - void on_attr_changed(); - Gtk::Entry entry; - SPAttributeEnum attr; + { + public: + AttrEntry(SvgFontsDialog* d, gchar* lbl, const SPAttributeEnum attr); + void set_text(char*); + private: + SvgFontsDialog* dialog; + void on_attr_changed(); + Gtk::Entry entry; + SPAttributeEnum attr; }; private: - void update_glyphs(); - void update_sensitiveness(); - void update_global_settings_tab(); - void populate_glyphs_box(); + void update_glyphs(); + void update_sensitiveness(); + void update_global_settings_tab(); + void populate_glyphs_box(); void populate_kerning_pairs_box(); - void set_glyph_description_from_selected_path(); - void missing_glyph_description_from_selected_path(); - void reset_missing_glyph_description(); - void add_glyph(); - void glyph_unicode_edit(const Glib::ustring&, const Glib::ustring&); - void glyph_name_edit(const Glib::ustring&, const Glib::ustring&); - void remove_selected_glyph(); - void remove_selected_font(); - void remove_selected_kerning_pair(); + void set_glyph_description_from_selected_path(); + void missing_glyph_description_from_selected_path(); + void reset_missing_glyph_description(); + void add_glyph(); + void glyph_unicode_edit(const Glib::ustring&, const Glib::ustring&); + void glyph_name_edit(const Glib::ustring&, const Glib::ustring&); + void remove_selected_glyph(); + void remove_selected_font(); + void remove_selected_kerning_pair(); - void add_kerning_pair(); + void add_kerning_pair(); - void create_glyphs_popup_menu(Gtk::Widget& parent, sigc::slot rem); - void glyphs_list_button_release(GdkEventButton* event); + void create_glyphs_popup_menu(Gtk::Widget& parent, sigc::slot rem); + void glyphs_list_button_release(GdkEventButton* event); - void create_fonts_popup_menu(Gtk::Widget& parent, sigc::slot rem); - void fonts_list_button_release(GdkEventButton* event); + void create_fonts_popup_menu(Gtk::Widget& parent, sigc::slot rem); + void fonts_list_button_release(GdkEventButton* event); - void create_kerning_pairs_popup_menu(Gtk::Widget& parent, sigc::slot rem); - void kerning_pairs_list_button_release(GdkEventButton* event); + void create_kerning_pairs_popup_menu(Gtk::Widget& parent, sigc::slot rem); + void kerning_pairs_list_button_release(GdkEventButton* event); Inkscape::XML::SignalObserver _defs_observer; //in order to update fonts Inkscape::XML::SignalObserver _glyphs_observer; @@ -134,47 +133,47 @@ private: Gtk::HBox* AttrCombo(gchar* lbl, const SPAttributeEnum attr); // Gtk::HBox* AttrSpin(gchar* lbl, const SPAttributeEnum attr); Gtk::VBox* global_settings_tab(); - AttrEntry* _familyname_entry; + AttrEntry* _familyname_entry; Gtk::VBox* kerning_tab(); Gtk::VBox* glyphs_tab(); Gtk::Button _add; Gtk::Button add_glyph_button; - Gtk::Button glyph_from_path_button; - Gtk::Button missing_glyph_button; - Gtk::Button missing_glyph_reset_button; + Gtk::Button glyph_from_path_button; + Gtk::Button missing_glyph_button; + Gtk::Button missing_glyph_reset_button; class Columns : public Gtk::TreeModel::ColumnRecord - { - public: - Columns() - { - add(spfont); - add(svgfont); - add(label); - } - - Gtk::TreeModelColumn spfont; - Gtk::TreeModelColumn svgfont; - Gtk::TreeModelColumn label; + { + public: + Columns() + { + add(spfont); + add(svgfont); + add(label); + } + + Gtk::TreeModelColumn spfont; + Gtk::TreeModelColumn svgfont; + Gtk::TreeModelColumn label; }; Glib::RefPtr _model; Columns _columns; Gtk::TreeView _FontsList; class GlyphsColumns : public Gtk::TreeModel::ColumnRecord - { - public: - GlyphsColumns() - { - add(glyph_node); - add(glyph_name); - add(unicode); - } - - Gtk::TreeModelColumn glyph_node; - Gtk::TreeModelColumn glyph_name; - Gtk::TreeModelColumn unicode; + { + public: + GlyphsColumns() + { + add(glyph_node); + add(glyph_name); + add(unicode); + } + + Gtk::TreeModelColumn glyph_node; + Gtk::TreeModelColumn glyph_name; + Gtk::TreeModelColumn unicode; }; GlyphsColumns _GlyphsListColumns; Glib::RefPtr _GlyphsListStore; @@ -182,30 +181,30 @@ private: Gtk::ScrolledWindow _GlyphsListScroller; class KerningPairColumns : public Gtk::TreeModel::ColumnRecord - { - public: - KerningPairColumns() - { - add(first_glyph); - add(second_glyph); - add(kerning_value); - add(spnode); - } - - Gtk::TreeModelColumn first_glyph; - Gtk::TreeModelColumn second_glyph; - Gtk::TreeModelColumn kerning_value; - Gtk::TreeModelColumn spnode; + { + public: + KerningPairColumns() + { + add(first_glyph); + add(second_glyph); + add(kerning_value); + add(spnode); + } + + Gtk::TreeModelColumn first_glyph; + Gtk::TreeModelColumn second_glyph; + Gtk::TreeModelColumn kerning_value; + Gtk::TreeModelColumn spnode; }; KerningPairColumns _KerningPairsListColumns; Glib::RefPtr _KerningPairsListStore; Gtk::TreeView _KerningPairsList; Gtk::ScrolledWindow _KerningPairsListScroller; - Gtk::Button add_kernpair_button; + Gtk::Button add_kernpair_button; Gtk::VBox _font_settings; - Gtk::VBox global_vbox; - Gtk::VBox glyphs_vbox; + Gtk::VBox global_vbox; + Gtk::VBox glyphs_vbox; Gtk::VBox kerning_vbox; Gtk::Entry _preview_entry; @@ -225,20 +224,20 @@ private: #endif class EntryWidget : public Gtk::HBox - { - public: - EntryWidget() - { - this->add(this->_label); - this->add(this->_entry); - } - void set_label(const gchar* l){ - this->_label.set_text(l); - } - private: - Gtk::Label _label; - Gtk::Entry _entry; - }; + { + public: + EntryWidget() + { + this->add(this->_label); + this->add(this->_entry); + } + void set_label(const gchar* l){ + this->_label.set_text(l); + } + private: + Gtk::Label _label; + Gtk::Entry _entry; + }; EntryWidget _font_family, _font_variant; }; @@ -247,3 +246,14 @@ private: } // namespace Inkscape #endif //#ifndef INKSCAPE_UI_DIALOG_SVG_FONTS_H + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : -- cgit v1.2.3 From be79b33c0c55628f347f2a8418cbd54997050920 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 4 Jul 2016 16:47:05 +0200 Subject: Fix typo that prevents reading of 'units-per-em'. (bzr r15008) --- src/ui/dialog/svg-fonts-dialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index a39955123..08ebbcf14 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -497,7 +497,7 @@ SvgFontsDialog::flip_coordinate_system(Geom::PathVector pathv){ for (obj = get_selected_spfont()->children; obj; obj=obj->next){ if (SP_IS_FONTFACE(obj)){ //XML Tree being directly used here while it shouldn't be. - sp_repr_get_double(obj->getRepr(), "units_per_em", &units_per_em); + sp_repr_get_double(obj->getRepr(), "units-per-em", &units_per_em); } } -- cgit v1.2.3 From f7724473cc5e15c9b9d0e7c2fe362ebedaa69f55 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Tue, 5 Jul 2016 13:39:43 +0530 Subject: Fix deletion and selection of objects clicking on styledialog rows and vice-versa (bzr r14949.1.39) --- src/ui/dialog/styledialog.cpp | 159 ++++++++++++++++++++++++++++++------------ src/ui/dialog/styledialog.h | 12 ++-- 2 files changed, 122 insertions(+), 49 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 406b984d7..b6e3d10ec 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -192,7 +192,8 @@ void StyleDialog::_addSelector() * class attribute for the selected object is set too. */ SPObject *obj; - SPObject *selectorObj; + std::vector objVec; + bool objExists = false; if (!_desktop->getSelection()->list().empty()) { std::vector selected = _desktop->getSelection()->list(); @@ -244,8 +245,8 @@ void StyleDialog::_addSelector() _row[_mColumns._selectorLabel] = _selectorName; _row[_mColumns._colAddRemove] = true; if (objExists) { - _row[_mColumns._colObj] = obj; - selectorObj = obj; + _row[_mColumns._colObj] = _desktop->selection->list(); + objVec = _row[_mColumns._colObj]; } break; default: @@ -257,7 +258,7 @@ void StyleDialog::_addSelector() * from selectorValue above. If style element already exists, then * the new selector's content is appended to its previous content. */ - _selectorVec.push_back(std::make_pair(std::make_pair(_selectorName, selectorObj), + _selectorVec.push_back(std::make_pair(std::make_pair(_selectorName, objVec), _selectorValue)); if (_styleElementNode()) { @@ -320,19 +321,14 @@ void StyleDialog::_delSelector() _selectorVec.erase(_selectorVec.begin()+i); } else { - std::stringstream str; std::string sel, key, value; - int index; - for (unsigned it = 0; it < _selectorVec.size(); ++it) { - str << _selectorVec[it].second; - index = it; - } - - while (std::getline(str, sel, '\n')) { + sel = _selectorVec[it].second; REMOVE_SPACES(sel); + std::cout << "sel" << sel << std::endl; if (!sel.empty()) { key = strtok(strdup(sel.c_str()), "{"); + REMOVE_SPACES(key); char *temp = strtok(NULL, "}"); if (strtok(temp, "}") != NULL) { value = strtok(temp, "}"); @@ -343,7 +339,7 @@ void StyleDialog::_delSelector() else { sel = sel; } - _selectorVec[index].second = sel; + _selectorVec[it].second = sel; } } } @@ -376,7 +372,7 @@ Inkscape::XML::Node* StyleDialog::_styleElementNode() { for (unsigned i = 0; i < _num; ++i) { if (std::string(_document->getReprRoot()->nthChild(i)->name()) - == "svg:style") { + == "svg:style") { _styleExists = true; _newDrawing = true; return _document->getReprRoot()->nthChild(i); @@ -409,9 +405,9 @@ std::string StyleDialog::_setClassAttribute(std::vector sel) * element. _newDrawing is flag is set to false check if an existing drawing is * opened. */ -std::vector, std::string> > StyleDialog::_getSelectorVec() +std::vector<_selectorVecType> StyleDialog::_getSelectorVec() { - std::string key, value; + std::string key, value, selId; for (unsigned i = 0; i < _num; ++i) { if (std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style") { _styleExists = true; @@ -426,19 +422,74 @@ std::vector, std::string> > StyleDi * value is set to empty so that its corresponding XML repr is added. */ while(std::getline(str, sel, '\n')) { + std::vectorobjVec; REMOVE_SPACES(sel); if (!sel.empty()) { key = strtok(strdup(sel.c_str()), "{"); + _selectorName = key; char *temp = strtok(NULL, "}"); if (strtok(temp, "}") != NULL) { value = strtok(temp, "}"); } - std::string selId = key.erase(0, key.find_first_not_of('#')); - REMOVE_SPACES(selId); - REMOVE_SPACES(key); - SPObject *obj = _document->getObjectById(selId); - _selectorVec.push_back(std::make_pair(std::make_pair(key, obj), - sel)); + + std::stringstream ss(key); + std::string token; + std::size_t found = key.find(","); + if (found!=std::string::npos) { + while(std::getline(ss, token, ',')) { + REMOVE_SPACES(token); + + if (strcmp(token.substr(0,1).c_str(), ".") == 0) { + token.erase(0, token.find_first_not_of('.')); + for (unsigned i = 0; i < _num; ++i) { + if (_document->getReprRoot()-> + nthChild(i)->attribute("class") && + _document->getReprRoot()->nthChild(i) + ->attribute("class") == token) { + selId = _document->getReprRoot()->nthChild(i) + ->attribute("id"); + objVec.push_back( _document->getObjectById(selId)); + } + } + } + else if (strcmp(token.substr(0,1).c_str(), "#") == 0) { + token.erase(0, token.find_first_not_of('#')); + selId = token; + objVec.push_back(_document->getObjectById(selId)); + } + else { + std::cout << "simple text" << std::endl; + } + } + } + else { + REMOVE_SPACES(key); + std::string tkn = key; + if (strcmp(tkn.substr(0,1).c_str(), ".") == 0) { + tkn.erase(0, tkn.find_first_not_of('.')); + for (unsigned i = 0; i < _num; ++i) { + if (_document->getReprRoot()-> + nthChild(i)->attribute("class") && + _document->getReprRoot()->nthChild(i) + ->attribute("class") == tkn) { + selId = _document->getReprRoot()->nthChild(i) + ->attribute("id"); + objVec.push_back(_document->getObjectById(selId)); + } + } + } + else if (strcmp(tkn.substr(0,1).c_str(), "#") == 0) { + tkn.erase(0, key.find_first_not_of('#')); + selId = tkn; + objVec.push_back(_document->getObjectById(selId)); + } + else { + std::cout << "simple text" << std::endl; + } + } + _selectorValue = _selectorName + "{" + value + "}\n"; + _selectorVec.push_back(std::make_pair(std::make_pair(key, objVec), + _selectorValue)); } } } @@ -452,8 +503,7 @@ std::vector, std::string> > StyleDi * This function populates the treeview with selectors available in the * stylesheet. */ -std::string StyleDialog::_populateTree(std::vector, std::string> > _selVec) +std::string StyleDialog::_populateTree(std::vector<_selectorVecType> _selVec) { _selectorVec = _selVec; std::string selectorValue; @@ -463,7 +513,6 @@ std::string StyleDialog::_populateTree(std::vectorget_path(iter); - childrow = *(_store->append(row->children())); - childrow[_mColumns._selectorLabel] = obj->getId(); - childrow[_mColumns._colAddRemove] = false; - childrow[_mColumns._colObj] = obj; - Gtk::TreeModel::Children children = row.children(); + int i = atoi(path.to_string().c_str()); + Gtk::TreeModel::Row row = *iter; std::string childStyle; - if (children) { - for(Gtk::TreeModel::Children::iterator it = children.begin(); - it != children.end(); ++it) { - Gtk::TreeModel::Row row = *it; - SPObject *obj = row[_mColumns._colObj]; + + if (_selectorVec.size() != 0) { + if (!row.parent()) { + Gtk::TreeModel::Row childrow; + childrow = *(_store->append(row->children())); + std::cout << "_store->children() " << _store->children() + ->children().size() << std::endl; + + childrow[_mColumns._selectorLabel] = obj->getId(); + childrow[_mColumns._colAddRemove] = false; + childrow[_mColumns._colObj] = _desktop->selection->list(); childStyle = "#" + std::string(obj->getId()) + "{" + std::string(obj->getAttribute("style")) + "}\n"; } } + _selectorVec.push_back(std::make_pair(std::make_pair - (obj->getId(), obj), + (obj->getId(), + sel), childStyle)); } if (_styleElementNode()) { @@ -557,8 +609,9 @@ void StyleDialog::_selectedRowCallback(const Gtk::TreeModel::Path& path, if (iter) { Gtk::TreeModel::Row row = *iter; Gtk::TreeModel::Children children = row.children(); - if (row[_mColumns._colObj]) { - SPObject *obj = row[_mColumns._colObj]; + std::vector objVec = row[_mColumns._colObj]; + for (unsigned i = 0; i < objVec.size(); ++i) { + SPObject *obj = objVec[i]; _desktop->selection->add(obj); } if (children) { @@ -579,8 +632,9 @@ void StyleDialog::_checkAllChildren(Gtk::TreeModel::Children& children) for (Gtk::TreeModel::Children::iterator iter = children.begin(); iter!= children.end(); ++iter) { Gtk::TreeModel::Row childrow = *iter; - if (childrow[_mColumns._colObj]) { - SPObject *obj = childrow[_mColumns._colObj]; + std::vector objVec = childrow[_mColumns._colObj]; + for (unsigned i = 0; i < objVec.size(); ++i) { + SPObject *obj = objVec[i]; _desktop->selection->add(obj); } } @@ -604,8 +658,25 @@ void StyleDialog::_selectRow(Selection */*sel*/) for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) { Gtk::TreeModel::Row row = *iter; - if (obj == row[_mColumns._colObj]) { - _treeView.get_selection()->select(row); + std::vector objVec = row[_mColumns._colObj]; + std::vector childObjVec; + Gtk::TreeModel::Row childRow; + if (row.children()) { + for(Gtk::TreeModel::Children::iterator it = row.children().begin(); + it != row.children().end(); ++it) { + childRow = *it; + childObjVec = childRow[_mColumns._colObj]; + } + } + for (unsigned i = 0; i < objVec.size(); ++i) { + if (obj->getId() == objVec[i]->getId()) { + _treeView.get_selection()->select(row); + } + } + for (unsigned j = 0; j < childObjVec.size(); ++j) { + if (obj->getId() == childObjVec[j]->getId()) { + _treeView.get_selection()->select(childRow); + } } } } diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 6e1ffbb2c..e47fbc96d 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -30,6 +30,8 @@ namespace Dialog { * @brief The StyleDialog class * A list of CSS selectors will show up in this dialog. */ +typedef std::pair >, std::string> +_selectorVecType; class StyleDialog : public UI::Widget::Panel { @@ -43,10 +45,10 @@ public: private: void _styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip); std::string _setClassAttribute(std::vector); - std::vector, std::string> >_selectorVec; - std::vector, std::string> > _getSelectorVec(); - std::string _populateTree(std::vector, - std::string> >); + + std::vector<_selectorVecType>_selectorVec; + std::vector<_selectorVecType> _getSelectorVec(); + std::string _populateTree(std::vector<_selectorVecType>); bool _handleButtonEvent(GdkEventButton *event); void _selectedRowCallback(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* /* column */); @@ -62,7 +64,7 @@ private: { add(_selectorLabel); add(_colAddRemove); add(_colObj); } Gtk::TreeModelColumn _selectorLabel; Gtk::TreeModelColumn _colAddRemove; - Gtk::TreeModelColumn _colObj; + Gtk::TreeModelColumn > _colObj; }; SPDesktop* _desktop; -- cgit v1.2.3 From 7c612210cbeecef13c9148a3e35a5f73dd5a6347 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Wed, 6 Jul 2016 14:38:04 +0530 Subject: Fix issues related to updating style content and selection of rows in treeview (bzr r14949.1.40) --- src/ui/dialog/styledialog.cpp | 62 ++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 27 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index b6e3d10ec..72fea5dc6 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -200,23 +200,16 @@ void StyleDialog::_addSelector() for (unsigned i = 0; i < selected.size(); ++i) { obj = selected.at(i); objExists = true; - std::string style; - - if (obj->getRepr()->attribute("style")) { - for (List iter = obj->getRepr()->attributeList(); - iter; ++iter) { - gchar const * property = g_quark_to_string(iter->key); - gchar const * value = iter->value; + if (!obj->getRepr()->attribute("style")) { + obj->getRepr()->setAttribute("style", NULL); + } - if (std::string(property) == "style") { - _selectorValue = _selectorName + "{" - + std::string(value) + "}" + "\n"; - } - } + if (obj->getAttribute("style") == NULL) { + _selectorValue = _selectorName + "{" + "}" + "\n"; } else { - style = " "; - obj->getRepr()->setAttribute("style", style); + _selectorValue = _selectorName + "{" + + obj->getAttribute("style") + "}" + "\n"; } if (strcmp(_selectorName.substr(0,1).c_str(), ".") == 0) { @@ -647,13 +640,20 @@ void StyleDialog::_checkAllChildren(Gtk::TreeModel::Children& children) */ void StyleDialog::_selectRow(Selection */*sel*/) { + SPObject *obj = NULL; + bool objExists = false; if (!_desktop->selection->list().empty()) { - SPObject *obj; std::vector selected = _desktop->getSelection()->list(); - for (unsigned i = 0; i < selected.size(); ++i) { - obj = selected.at(i); - } + obj = selected.back(); + } + /** + * If obj has some SPObject, then it is added to desktop's selection. If a + * row in treeview has children, those rows are checked too against selected + * object's id. If an object which is not present in any selector is selected, + * the treeview's selections are unselected. + */ + if (obj != NULL) { Gtk::TreeModel::Children children = _store->children(); for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) { @@ -661,24 +661,32 @@ void StyleDialog::_selectRow(Selection */*sel*/) std::vector objVec = row[_mColumns._colObj]; std::vector childObjVec; Gtk::TreeModel::Row childRow; + + for (unsigned i = 0; i < objVec.size(); ++i) { + if (obj->getId() == objVec[i]->getId()) { + _treeView.get_selection()->select(row); + objExists = true; + } + } + if (row.children()) { for(Gtk::TreeModel::Children::iterator it = row.children().begin(); it != row.children().end(); ++it) { childRow = *it; childObjVec = childRow[_mColumns._colObj]; } - } - for (unsigned i = 0; i < objVec.size(); ++i) { - if (obj->getId() == objVec[i]->getId()) { - _treeView.get_selection()->select(row); - } - } - for (unsigned j = 0; j < childObjVec.size(); ++j) { - if (obj->getId() == childObjVec[j]->getId()) { - _treeView.get_selection()->select(childRow); + for (unsigned j = 0; j < childObjVec.size(); ++j) { + if (obj->getId() == childObjVec[j]->getId()) { + _treeView.get_selection()->select(childRow); + objExists = true; + } } } } + + if (!objExists) { + _treeView.get_selection()->unselect_all(); + } } } -- cgit v1.2.3 From 71cb7d8ddbabf102501c9b245c2eea99a4ba1011 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Fri, 8 Jul 2016 09:17:55 +0200 Subject: Documentation. French documentation translation updated. (bzr r15013) --- src/ui/dialog/aboutbox.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index 1a87a9718..6276d3391 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -467,7 +467,8 @@ void AboutBox::initStrings() { "Adib Taraben , 2004-2014.\n" "Alan Monfort , 2009-2010.\n" "Alastair McKinstry , 2000.\n" -"Aleksandar Urošević , 2004-2006.\n" +"Aleksandar Marković , 2015.\n" +"Aleksandar Urošević , 2004-2009.\n" "Alessio Frusciante , 2002, 2003.\n" "Alexander Shopov , 2006.\n" "Alexandre Prokoudine , 2005, 2010-2014.\n" @@ -499,18 +500,19 @@ void AboutBox::initStrings() { "Cédric Gemy , 2006.\n" "Daniel Díaz , 2004.\n" "Didier Conchaudron , 2003.\n" -"Dimitris Spingos , 2011-2013.\n" +"Dimitris Spingos (Δημήτρης Σπίγγος) , 2011-2015.\n" "Dorji Tashi , 2006.\n" "Duarte Loreto 2002, 2003 (Maintainer).\n" "Elias Norberg , 2009.\n" "Equipe de Tradução Inkscape Brasil , 2007.\n" "Fatih Demir , 2000.\n" -"Firas Hanife , 2014-2015.\n" +"Firas Hanife , 2014-2016.\n" "Foppe Benedictus , 2007-2009.\n" "Francesc Dorca , 2003. Traducció sodipodi.\n" "Francisco Javier F. Serrador , 2003.\n" "Francisco Xosé Vázquez Grandal , 2001.\n" "Frederic Rodrigo , 2004-2005.\n" +"Ganesh Murmu , 2014.\n" "Ge'ez Frontier Foundation , 2002.\n" "George Boukeas , 2011.\n" "Heiko Wöhrle , 2014.\n" @@ -528,6 +530,7 @@ void AboutBox::initStrings() { "Jeroen van der Vegt , 2003, 2005, 2008.\n" "Jin-Hwan Jeong , 2009.\n" "Jonathan Ernst , 2006.\n" +"Jordi Mas i Hernàndez , 2015.\n" "Jose Antonio Salgueiro Aquino , 2003.\n" "Josef Vybiral , 2005-2006.\n" "Juarez Rudsatz , 2004.\n" @@ -542,10 +545,11 @@ void AboutBox::initStrings() { "Kingsley Turner , 2006.\n" "Kitae , 2006.\n" "Kjartan Maraas , 2000-2002.\n" -"Kris De Gussem , 2008-2014.\n" +"Kris De Gussem , 2008-2015.\n" "Lauris Kaplinski , 2000.\n" "Leandro Regueiro , 2006-2008, 2010.\n" "Liu Xiaoqin , 2008.\n" +"Louni Kandulna , 2014.\n" "Luca Bruno , 2005.\n" "Lucas Vieites Fariña, 2003-2013.\n" "Mahesh subedi , 2006.\n" @@ -561,8 +565,10 @@ void AboutBox::initStrings() { "Mufit Eribol , 2000.\n" "Muhammad Bashir Al-Noimi , 2008.\n" "Myckel Habets , 2008.\n" +"Nasreen , 2013.\n" "Nguyen Dinh Trung , 2007, 2008.\n" -"Nicolas Dufour , 2008-2014.\n" +"Nicolas Dufour , 2008-2016.\n" +"Paresh prabhu , 2013.\n" "Pawan Chitrakar , 2006.\n" "Przemysław Loesch , 2005.\n" "Quico Llach , 2000. Traducció sodipodi.\n" @@ -570,6 +576,8 @@ void AboutBox::initStrings() { "Riku Leino , 2006-2011.\n" "Rune Rønde Laursen , 2006.\n" "Ruud Steltenpool , 2006.\n" +"Sangeeta , 2011.\n" +"Savitha , 2013.\n" "Serdar Soytetir , 2005.\n" "shivaken , 2004.\n" "Shyam Krishna Bal , 2006.\n" @@ -577,8 +585,11 @@ void AboutBox::initStrings() { "Spyros Blanas , 2006, 2011.\n" "Stefan Graubner , 2005.\n" "Supranee Thirawatthanasuk , 2006.\n" +"Sushma Joshi , 2011.\n" +"Sveinn í Felli , 2014-2015.\n" +"Sylvain Chiron , 2016.\n" "Takeshi Aihana , 2000, 2001.\n" -"Tim Sheridan , 2007-2014.\n" +"Tim Sheridan , 2007-2016.\n" "Theppitak Karoonboonyanan , 2006.\n" "Thiago Pimentel , 2006.\n" "Toshifumi Sato , 2005.\n" @@ -592,6 +603,7 @@ void AboutBox::initStrings() { "Vital Khilko , 2003.\n" "Vitaly Lipatov , 2002, 2004.\n" "vonHalenbach , 2005.\n" +"vrundeshw , 2012.\n" "Waluyo Adi Siswanto , 2011.\n" "Wang Li , 2002.\n" "Wei-Lun Chao , 2006.\n" -- cgit v1.2.3 From 67f04a5e0e1bff0523a97d4aa16357849e51e1d8 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Fri, 8 Jul 2016 17:19:12 +0530 Subject: Selects matching objects for single as well as double click on selector (bzr r14949.1.42) --- src/ui/dialog/styledialog.cpp | 89 +++++++++++++++++++++++++++---------------- src/ui/dialog/styledialog.h | 4 +- 2 files changed, 59 insertions(+), 34 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 72fea5dc6..7e0cb135f 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -113,9 +113,10 @@ StyleDialog::StyleDialog() : _handleButtonEvent), false); - _treeView.signal_row_activated().connect(sigc::mem_fun(*this, - &StyleDialog:: - _selectedRowCallback)); + _treeView.signal_button_press_event().connect_notify(sigc::mem_fun + (*this, &StyleDialog:: + _buttonEventsSelectObjs), + false); } StyleDialog::~StyleDialog() @@ -548,18 +549,14 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) if (iter) { path = _treeView.get_model()->get_path(iter); - int i = atoi(path.to_string().c_str()); Gtk::TreeModel::Row row = *iter; std::string childStyle; - if (_selectorVec.size() != 0) { if (!row.parent()) { Gtk::TreeModel::Row childrow; childrow = *(_store->append(row->children())); - std::cout << "_store->children() " << _store->children() - ->children().size() << std::endl; - - childrow[_mColumns._selectorLabel] = obj->getId(); + childrow[_mColumns._selectorLabel] = "#" + + std::string(obj->getId()); childrow[_mColumns._colAddRemove] = false; childrow[_mColumns._colObj] = _desktop->selection->list(); childStyle = "#" + std::string(obj->getId()) + "{" + @@ -588,27 +585,59 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) } /** - * @brief StyleDialog::_selected_row_callback - * @param path + * @brief StyleDialog::_selectObjects + * @param event + * This function detects single or double click on a selector in any row. Single + * click on a selector selects the matching objects. A double click on any + * selector selects the matching objects as well as will open CSS dialog. It + * calls _selectObjects to add objects to selection. + * TODO: Open CSS dialog on double click. + */ +void StyleDialog::_buttonEventsSelectObjs(GdkEventButton* event ) +{ + if (event->type == GDK_BUTTON_PRESS && event->button == 1) { + int x = static_cast(event->x); + int y = static_cast(event->y); + _selectObjects(x, y); + } + else if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { + int x = static_cast(event->x); + int y = static_cast(event->y); + _selectObjects(x, y); + //Open CSS dialog here. + } +} + +/** + * @brief StyleDialog::_selectObjects + * @param eventX + * @param eventY * This function selects objects in the drawing corresponding to the selector * selected in the treeview. */ -void StyleDialog::_selectedRowCallback(const Gtk::TreeModel::Path& path, - Gtk::TreeViewColumn* column ) +void StyleDialog::_selectObjects(int eventX, int eventY) { _desktop->selection->clear(); - if (column == _treeView.get_column(1)) { - Gtk::TreeModel::iterator iter = _store->get_iter(path); - if (iter) { - Gtk::TreeModel::Row row = *iter; - Gtk::TreeModel::Children children = row.children(); - std::vector objVec = row[_mColumns._colObj]; - for (unsigned i = 0; i < objVec.size(); ++i) { - SPObject *obj = objVec[i]; - _desktop->selection->add(obj); - } - if (children) { - _checkAllChildren(children); + Gtk::TreeViewColumn *col = _treeView.get_column(1); + Gtk::TreeModel::Path path; + int x = eventX; + int y = eventY; + int x2 = 0; + int y2 = 0; + if (_treeView.get_path_at_pos(x, y, path, col, x2, y2)) { + if (col == _treeView.get_column(1)) { + Gtk::TreeModel::iterator iter = _store->get_iter(path); + if (iter) { + Gtk::TreeModel::Row row = *iter; + Gtk::TreeModel::Children children = row.children(); + std::vector objVec = row[_mColumns._colObj]; + for (unsigned i = 0; i < objVec.size(); ++i) { + SPObject *obj = objVec[i]; + _desktop->selection->add(obj); + } + if (children) { + _checkAllChildren(children); + } } } } @@ -641,7 +670,6 @@ void StyleDialog::_checkAllChildren(Gtk::TreeModel::Children& children) void StyleDialog::_selectRow(Selection */*sel*/) { SPObject *obj = NULL; - bool objExists = false; if (!_desktop->selection->list().empty()) { std::vector selected = _desktop->getSelection()->list(); obj = selected.back(); @@ -665,7 +693,6 @@ void StyleDialog::_selectRow(Selection */*sel*/) for (unsigned i = 0; i < objVec.size(); ++i) { if (obj->getId() == objVec[i]->getId()) { _treeView.get_selection()->select(row); - objExists = true; } } @@ -678,15 +705,13 @@ void StyleDialog::_selectRow(Selection */*sel*/) for (unsigned j = 0; j < childObjVec.size(); ++j) { if (obj->getId() == childObjVec[j]->getId()) { _treeView.get_selection()->select(childRow); - objExists = true; } } } } - - if (!objExists) { - _treeView.get_selection()->unselect_all(); - } + } + else { + _treeView.get_selection()->unselect_all(); } } diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index e47fbc96d..08061d923 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -50,8 +50,8 @@ private: std::vector<_selectorVecType> _getSelectorVec(); std::string _populateTree(std::vector<_selectorVecType>); bool _handleButtonEvent(GdkEventButton *event); - void _selectedRowCallback(const Gtk::TreeModel::Path& path, - Gtk::TreeViewColumn* /* column */); + void _buttonEventsSelectObjs(GdkEventButton *event); + void _selectObjects(int, int); void _checkAllChildren(Gtk::TreeModel::Children& children); Inkscape::XML::Node *_styleElementNode(); void _updateStyleContent(); -- cgit v1.2.3 From f57322fc77c604c6102132b6a254280e1f597064 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Sat, 9 Jul 2016 16:04:31 +0530 Subject: Delete objects from selector by clicking '-' in front of objects (bzr r14949.1.44) --- src/ui/dialog/styledialog.cpp | 148 +++++++++++++++++++++++++++++------------- 1 file changed, 104 insertions(+), 44 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 7e0cb135f..ac51e36c1 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -223,7 +223,7 @@ void StyleDialog::_addSelector() getRepr()-> attribute("class")) + " " + textEditPtr->get_text() - .erase(0,0)); + .erase(0,1)); } } } @@ -296,46 +296,43 @@ void StyleDialog::_updateStyleContent() * This function deletes selector when '-' at the bottom is clicked. The index * of selected row is obtained and the corresponding selector and its values are * deleted from the selector vector. If a row has no parent, it is directly - * erased from the vector else the string containing selector row's selector value - * is updated after parsing. + * erased from the vector along with its child rows. The style element is updated + * accordingly. */ void StyleDialog::_delSelector() { Glib::RefPtr refTreeSelection = _treeView.get_selection(); Gtk::TreeModel::iterator iter = refTreeSelection->get_selected(); - Gtk::TreeModel::Path path; - if (iter) { Gtk::TreeModel::Row row = *iter; - path = _treeView.get_model()->get_path(iter); - int i = atoi(path.to_string().c_str()); + std::string sel, key, value; + std::vector<_selectorVecType>::iterator it; + for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it ) { + sel = (*it).second; + REMOVE_SPACES(sel); + if (!sel.empty()) { + key = strtok(strdup(sel.c_str()), "{"); + REMOVE_SPACES(key); + char *temp = strtok(NULL, "}"); + if (strtok(temp, "}") != NULL) { + value = strtok(temp, "}"); + } + } + } if (_selectorVec.size() != 0) { if (!row.parent()) { - _selectorVec.erase(_selectorVec.begin()+i); - } - else { - std::string sel, key, value; - for (unsigned it = 0; it < _selectorVec.size(); ++it) { - sel = _selectorVec[it].second; - REMOVE_SPACES(sel); - std::cout << "sel" << sel << std::endl; - if (!sel.empty()) { - key = strtok(strdup(sel.c_str()), "{"); - REMOVE_SPACES(key); - char *temp = strtok(NULL, "}"); - if (strtok(temp, "}") != NULL) { - value = strtok(temp, "}"); - } - if (key == "#" + row[_mColumns._selectorLabel]) { - sel = ""; - } - else { - sel = sel; + if (!row.children().empty()) { + for (Gtk::TreeModel::Children::iterator child = row.children().begin(); + child != row.children().end(); ++child) { + Gtk::TreeModel::Row childrow = *child; + if (key == childrow[_mColumns._selectorLabel]) { + _selectorVec.erase(it); } - _selectorVec[it].second = sel; } } + _selectorVec.erase(it); + _store->erase(row); } /** @@ -351,7 +348,6 @@ void StyleDialog::_delSelector() _updateStyleContent(); } } - _store->erase(row); } } @@ -537,22 +533,29 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) int y2 = 0; if (_treeView.get_path_at_pos(x, y, path, col, x2, y2)) { if (col == _treeView.get_column(0)) { - if (_desktop->selection) { - std::vectorsel = _desktop->selection->list(); - for (unsigned i = 0; i < sel.size(); ++i) { - SPObject *obj = sel[i]; - Glib::RefPtr refTreeSelection = - _treeView.get_selection(); - Gtk::TreeModel::iterator iter = refTreeSelection-> - get_selected(); - - if (iter) - { - path = _treeView.get_model()->get_path(iter); - Gtk::TreeModel::Row row = *iter; + Glib::RefPtr refTreeSelection = + _treeView.get_selection(); + Gtk::TreeModel::iterator iter = refTreeSelection-> + get_selected(); + Gtk::TreeModel::Row row = *iter; + + /** + * This adds child rows to selected rows. If the parent row is + * a class selector, then the class attribute of object added + * to child row is appended with class in the parent row. The + * else below deletes objects from selectors when 'delete' button + * in front of child row is clicked. The class attribute is updated + * by removing the parent row's class selector name. + */ + if (!row.parent()) { + if (_desktop->selection) { + std::vectorsel = _desktop->selection->list(); + for (unsigned i = 0; i < sel.size(); ++i) { + SPObject *obj = sel[i]; std::string childStyle; - if (_selectorVec.size() != 0) { - if (!row.parent()) { + if (iter) { + path = _treeView.get_model()->get_path(iter); + if (_selectorVec.size() != 0) { Gtk::TreeModel::Row childrow; childrow = *(_store->append(row->children())); childrow[_mColumns._selectorLabel] = "#" + @@ -561,6 +564,19 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) childrow[_mColumns._colObj] = _desktop->selection->list(); childStyle = "#" + std::string(obj->getId()) + "{" + std::string(obj->getAttribute("style")) + "}\n"; + Glib::ustring key = row[_mColumns._selectorLabel]; + if (strcmp(key.substr(0,1).c_str(), ".") == 0) { + if (!obj->getRepr()->attribute("class")) { + obj->setAttribute("class", key.erase(0,1)); + } + else { + obj->setAttribute("class", std::string + (obj->getRepr()-> + attribute("class")) + + " " + key + .erase(0,1)); + } + } } } @@ -578,6 +594,50 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) } } } + + else { + std::string sel, key, value; + std::vector<_selectorVecType>::iterator it; + for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it ) { + sel = (*it).second; + REMOVE_SPACES(sel); + if (!sel.empty()) { + key = strtok(strdup(sel.c_str()), "{"); + REMOVE_SPACES(key); + char *temp = strtok(NULL, "}"); + if (strtok(temp, "}") != NULL) { + value = strtok(temp, "}"); + } + } + } + if (key == row[_mColumns._selectorLabel]) { + Gtk::TreeModel::Row parentRow = *(row.parent()); + Glib::ustring parentKey = parentRow[_mColumns._selectorLabel]; + if (strcmp(parentKey.substr(0,1).c_str(), ".") == 0) { + std::vector objVec = row[_mColumns._colObj]; + for (unsigned i = 0; i < objVec.size(); ++i) { + SPObject *obj = objVec[i]; + std::string classAttr = std::string(obj->getRepr() + ->attribute("class")); + std::size_t found = classAttr.find(parentKey.erase(0,1)); + if (found != std::string::npos) { + classAttr.erase(found, parentKey.length()+1); + obj->getRepr()->setAttribute("class", classAttr); + } + } + } + _selectorVec.erase(it); + } + + if (_styleChild) { + _updateStyleContent(); + } + else { + _styleChild = _styleElementNode(); + _updateStyleContent(); + } + _store->erase(row); + } } } } -- cgit v1.2.3 From dca182031f3a9c95ae6a1f06c139a89c298846a1 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 10 Jul 2016 16:51:02 +0200 Subject: Improve font editing dialog: 1. Allow for fonts with other than 1000 units per em. 2. Allow setting 'ascent', 'descent', etc. 3. Allow setting individual glyph horizontal advances. 4. Fix bug where 'units-per-em' was not read correctly. (bzr r15014.1.1) --- src/ui/dialog/svg-fonts-dialog.cpp | 182 +++++++++++++++++++++++++++++-------- src/ui/dialog/svg-fonts-dialog.h | 37 +++++++- 2 files changed, 179 insertions(+), 40 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 08ebbcf14..3672fbe9e 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -31,6 +31,7 @@ #include "sp-font-face.h" #include "desktop.h" +#include #include "display/nr-svgfonts.h" #include "verbs.h" #include "sp-glyph.h" @@ -76,6 +77,15 @@ bool SvgFontDrawingArea::on_expose_event (GdkEventExpose */*event*/){ cr->set_font_size (_y-20); cr->move_to (10, 10); cr->show_text (_text.c_str()); + + // Draw some lines to show line area. + cr->set_source_rgb( 0.5, 0.5, 0.5 ); + cr->move_to ( 0, 10); + cr->line_to (_x, 10); + cr->stroke(); + cr->move_to ( 0, _y-10); + cr->line_to (_x, _y-10); + cr->stroke(); } return TRUE; } @@ -112,6 +122,7 @@ void SvgFontsDialog::AttrEntry::set_text(char* t){ entry.set_text(t); } +// 'font-family' has a problem as it is also a presentation attribute for void SvgFontsDialog::AttrEntry::on_attr_changed(){ SPObject* o = NULL; @@ -141,6 +152,74 @@ void SvgFontsDialog::AttrEntry::on_attr_changed(){ } +SvgFontsDialog::AttrSpin::AttrSpin(SvgFontsDialog* d, gchar* lbl, const SPAttributeEnum attr) { + + this->dialog = d; + this->attr = attr; + this->add(* Gtk::manage(new Gtk::Label(lbl)) ); + this->add(spin); + this->show_all(); + spin.set_range(0, 4096); + spin.set_increments(16, 0); + spin.signal_value_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::AttrSpin::on_attr_changed)); +} + +void SvgFontsDialog::AttrSpin::set_range(double low, double high){ + spin.set_range(low, high); +} + +void SvgFontsDialog::AttrSpin::set_value(double v){ + spin.set_value(v); +} + +void SvgFontsDialog::AttrSpin::on_attr_changed(){ + + SPObject* o = NULL; + switch (this->attr) { + + // attributes + case SP_ATTR_HORIZ_ORIGIN_X: + case SP_ATTR_HORIZ_ORIGIN_Y: + case SP_ATTR_HORIZ_ADV_X: + case SP_ATTR_VERT_ORIGIN_X: + case SP_ATTR_VERT_ORIGIN_Y: + case SP_ATTR_VERT_ADV_Y: + o = this->dialog->get_selected_spfont(); + break; + + // attributes + case SP_ATTR_UNITS_PER_EM: + case SP_ATTR_ASCENT: + case SP_ATTR_DESCENT: + case SP_ATTR_CAP_HEIGHT: + case SP_ATTR_X_HEIGHT: + for(SPObject* node = this->dialog->get_selected_spfont()->children; node; node=node->next){ + if (SP_IS_FONTFACE(node)){ + o = node; + continue; + } + } + break; + + default: + o = NULL; + } + + const gchar* name = (const gchar*)sp_attribute_name(this->attr); + if(name && o) { + std::ostringstream temp; + temp << this->spin.get_value(); + o->getRepr()->setAttribute((const gchar*) name, temp.str().c_str() ); + o->parent->requestModified(SP_OBJECT_MODIFIED_FLAG); + + Glib::ustring undokey = "svgfonts:"; + undokey += name; + DocumentUndo::maybeDone(o->document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, + _("Set SVG Font attribute")); + } + +} + Gtk::HBox* SvgFontsDialog::AttrCombo(gchar* lbl, const SPAttributeEnum /*attr*/){ Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox()); hbox->add(* Gtk::manage(new Gtk::Label(lbl)) ); @@ -283,7 +362,6 @@ void SvgFontsDialog::update_fonts() } void SvgFontsDialog::on_preview_text_changed(){ - _font_da.set_text((gchar*) _preview_entry.get_text().c_str()); _font_da.set_text(_preview_entry.get_text()); } @@ -308,10 +386,19 @@ void SvgFontsDialog::update_global_settings_tab(){ SPFont* font = get_selected_spfont(); if (!font) return; + _horiz_adv_x_spin->set_value(font->horiz_adv_x); + _horiz_origin_x_spin->set_value(font->horiz_origin_x); + _horiz_origin_y_spin->set_value(font->horiz_origin_y); + SPObject* obj; for (obj=font->children; obj; obj=obj->next){ if (SP_IS_FONTFACE(obj)){ _familyname_entry->set_text((SP_FONTFACE(obj))->font_family); + _units_per_em_spin->set_value((SP_FONTFACE(obj))->units_per_em); + _ascent_spin->set_value((SP_FONTFACE(obj))->ascent); + _descent_spin->set_value((SP_FONTFACE(obj))->descent); + _x_height_spin->set_value((SP_FONTFACE(obj))->x_height); + _cap_height_spin->set_value((SP_FONTFACE(obj))->cap_height); } } } @@ -326,11 +413,8 @@ void SvgFontsDialog::on_font_selection_changed(){ kerning_preview.set_svgfont(svgfont); _font_da.set_svgfont(svgfont); _font_da.redraw(); - - double set_width = spfont->horiz_adv_x; - setwidth_spin.set_value(set_width); - - kerning_slider->set_range(0, set_width); + + kerning_slider->set_range(0, spfont->horiz_adv_x); kerning_slider->set_draw_value(false); kerning_slider->set_value(0); @@ -340,17 +424,6 @@ void SvgFontsDialog::on_font_selection_changed(){ update_sensitiveness(); } -void SvgFontsDialog::on_setfontdata_changed(){ - SPFont* spfont = this->get_selected_spfont(); - if (spfont){ - spfont->horiz_adv_x = setwidth_spin.get_value(); - //TODO: tell cairo that the glyphs cache has to be invalidated - // The current solution is to recreate the whole cairo svgfont. - // This is not a good solution to the issue because big fonts will result in poor performance. - update_glyphs(); - } -} - SPGlyphKerning* SvgFontsDialog::get_selected_kerning_pair() { Gtk::TreeModel::iterator i = _KerningPairsList.get_selection()->get_selected(); @@ -384,24 +457,37 @@ SPGlyph* SvgFontsDialog::get_selected_glyph() } Gtk::VBox* SvgFontsDialog::global_settings_tab(){ - _familyname_entry = new AttrEntry(this, (gchar*) _("Family Name:"), SP_PROP_FONT_FAMILY); + _font_label = new Gtk::Label( _("Font Attributes") ); + _horiz_adv_x_spin = new AttrSpin( this, (gchar*) _("Horiz. Advance X"), SP_ATTR_HORIZ_ADV_X); + _horiz_origin_x_spin = new AttrSpin( this, (gchar*) _("Horiz. Origin X "), SP_ATTR_HORIZ_ORIGIN_X); + _horiz_origin_y_spin = new AttrSpin( this, (gchar*) _("Horiz. Origin Y "), SP_ATTR_HORIZ_ORIGIN_Y); + _font_face_label = new Gtk::Label( _("Font Face Attributes") ); + _familyname_entry = new AttrEntry(this, (gchar*) _("Family Name:"), SP_PROP_FONT_FAMILY); + _units_per_em_spin = new AttrSpin( this, (gchar*) _("Units per em"), SP_ATTR_UNITS_PER_EM); + _ascent_spin = new AttrSpin( this, (gchar*) _("Ascent:"), SP_ATTR_ASCENT); + _descent_spin = new AttrSpin( this, (gchar*) _("Descent:"), SP_ATTR_DESCENT); + _cap_height_spin = new AttrSpin( this, (gchar*) _("Cap Height:"), SP_ATTR_CAP_HEIGHT); + _x_height_spin = new AttrSpin( this, (gchar*) _("x Height:"), SP_ATTR_X_HEIGHT); + + _descent_spin->set_range(-4096,0); + + global_vbox.pack_start(*_font_label, false, false); + global_vbox.pack_start(*_horiz_adv_x_spin, false, false); + global_vbox.pack_start(*_horiz_origin_x_spin, false, false); + global_vbox.pack_start(*_horiz_origin_y_spin, false, false); + global_vbox.pack_start(*_font_face_label, false, false); + global_vbox.pack_start(*_familyname_entry, false, false); + global_vbox.pack_start(*_units_per_em_spin, false, false); + global_vbox.pack_start(*_ascent_spin, false, false); + global_vbox.pack_start(*_descent_spin, false, false); + global_vbox.pack_start(*_cap_height_spin, false, false); + global_vbox.pack_start(*_x_height_spin, false, false); - global_vbox.pack_start(*_familyname_entry, false, false); /* global_vbox->add(*AttrCombo((gchar*) _("Style:"), SP_PROP_FONT_STYLE)); global_vbox->add(*AttrCombo((gchar*) _("Variant:"), SP_PROP_FONT_VARIANT)); global_vbox->add(*AttrCombo((gchar*) _("Weight:"), SP_PROP_FONT_WEIGHT)); */ -//Set Width (horiz_adv_x): - Gtk::HBox* setwidth_hbox = Gtk::manage(new Gtk::HBox()); - setwidth_hbox->add(*Gtk::manage(new Gtk::Label(_("Set width:")))); - setwidth_hbox->add(setwidth_spin); - - setwidth_spin.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_setfontdata_changed)); - setwidth_spin.set_range(0, 4096); - setwidth_spin.set_increments(10, 0); - global_vbox.pack_start(*setwidth_hbox, false, false); - return &global_vbox; } @@ -417,9 +503,10 @@ SvgFontsDialog::populate_glyphs_box() for(SPObject* node = spfont->children; node; node=node->next){ if (SP_IS_GLYPH(node)){ Gtk::TreeModel::Row row = *(_GlyphsListStore->append()); - row[_GlyphsListColumns.glyph_node] = static_cast(node); + row[_GlyphsListColumns.glyph_node] = static_cast(node); row[_GlyphsListColumns.glyph_name] = (static_cast(node))->glyph_name; - row[_GlyphsListColumns.unicode] = (static_cast(node))->unicode; + row[_GlyphsListColumns.unicode] = (static_cast(node))->unicode; + row[_GlyphsListColumns.advance] = (static_cast(node))->horiz_adv_x; } } } @@ -492,7 +579,7 @@ void SvgFontsDialog::add_glyph(){ Geom::PathVector SvgFontsDialog::flip_coordinate_system(Geom::PathVector pathv){ - double units_per_em = 1000; + double units_per_em = 1024; SPObject* obj; for (obj = get_selected_spfont()->children; obj; obj=obj->next){ if (SP_IS_FONTFACE(obj)){ @@ -500,9 +587,7 @@ SvgFontsDialog::flip_coordinate_system(Geom::PathVector pathv){ sp_repr_get_double(obj->getRepr(), "units-per-em", &units_per_em); } } - double baseline_offset = units_per_em - get_selected_spfont()->horiz_origin_y; - //This matrix flips y-axis and places the origin at baseline Geom::Affine m(Geom::Coord(1),Geom::Coord(0),Geom::Coord(0),Geom::Coord(-1),Geom::Coord(0),Geom::Coord(baseline_offset)); return pathv*m; @@ -639,6 +724,26 @@ void SvgFontsDialog::glyph_unicode_edit(const Glib::ustring&, const Glib::ustrin update_glyphs(); } +void SvgFontsDialog::glyph_advance_edit(const Glib::ustring&, const Glib::ustring& str){ + Gtk::TreeModel::iterator i = _GlyphsList.get_selection()->get_selected(); + if (!i) return; + + SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node]; + //XML Tree being directly used here while it shouldn't be. + std::istringstream is(str); + double value; + // Check if input valid + if ((is >> value)) { + glyph->getRepr()->setAttribute("horiz-adv-x", str.c_str()); + SPDocument* doc = this->getDesktop()->getDocument(); + DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph advance")); + + update_glyphs(); + } else { + std::cerr << "SvgFontDialog::glyph_advance_edit: Error in input: " << str << std::endl; + } +} + void SvgFontsDialog::remove_selected_font(){ SPFont* font = get_selected_spfont(); if (!font) return; @@ -707,9 +812,9 @@ Gtk::VBox* SvgFontsDialog::glyphs_tab(){ _GlyphsListScroller.add(_GlyphsList); _GlyphsListStore = Gtk::ListStore::create(_GlyphsListColumns); _GlyphsList.set_model(_GlyphsListStore); - _GlyphsList.append_column_editable(_("Glyph name"), _GlyphsListColumns.glyph_name); + _GlyphsList.append_column_editable(_("Glyph name"), _GlyphsListColumns.glyph_name); _GlyphsList.append_column_editable(_("Matching string"), _GlyphsListColumns.unicode); - + _GlyphsList.append_column_numeric_editable(_("Advance"), _GlyphsListColumns.advance, "%.2f"); Gtk::HBox* hb = Gtk::manage(new Gtk::HBox()); add_glyph_button.set_label(_("Add Glyph")); add_glyph_button.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::add_glyph)); @@ -727,6 +832,9 @@ Gtk::VBox* SvgFontsDialog::glyphs_tab(){ dynamic_cast( _GlyphsList.get_column_cell_renderer(1))->signal_edited().connect( sigc::mem_fun(*this, &SvgFontsDialog::glyph_unicode_edit)); + dynamic_cast( _GlyphsList.get_column_cell_renderer(2))->signal_edited().connect( + sigc::mem_fun(*this, &SvgFontsDialog::glyph_advance_edit)); + _glyphs_observer.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::update_glyphs)); return &glyphs_vbox; @@ -806,7 +914,7 @@ Gtk::VBox* SvgFontsDialog::kerning_tab(){ kerning_amount_hbox->add(*kerning_slider); kerning_preview.set_size(300 + 20, 150 + 20); - _font_da.set_size(150 + 20, 50 + 20); + _font_da.set_size(300 + 50 + 20, 60 + 20); return &kerning_vbox; } diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h index e80bbfd39..11bf52187 100644 --- a/src/ui/dialog/svg-fonts-dialog.h +++ b/src/ui/dialog/svg-fonts-dialog.h @@ -86,8 +86,9 @@ public: void on_setfontdata_changed(); void add_font(); Geom::PathVector flip_coordinate_system(Geom::PathVector pathv); + bool updating; - //TODO: AttrEntry is currently unused. Should we remove it? + // Used for font-family class AttrEntry : public Gtk::HBox { public: @@ -100,6 +101,20 @@ public: SPAttributeEnum attr; }; + class AttrSpin : public Gtk::HBox + { + public: + AttrSpin(SvgFontsDialog* d, gchar* lbl, const SPAttributeEnum attr); + void set_value(double v); + void set_range(double low, double high); + Inkscape::UI::Widget::SpinButton* getSpin() { return &spin; } + private: + SvgFontsDialog* dialog; + void on_attr_changed(); + Inkscape::UI::Widget::SpinButton spin; + SPAttributeEnum attr; + }; + private: void update_glyphs(); void update_sensitiveness(); @@ -111,7 +126,8 @@ private: void reset_missing_glyph_description(); void add_glyph(); void glyph_unicode_edit(const Glib::ustring&, const Glib::ustring&); - void glyph_name_edit(const Glib::ustring&, const Glib::ustring&); + void glyph_name_edit( const Glib::ustring&, const Glib::ustring&); + void glyph_advance_edit(const Glib::ustring&, const Glib::ustring&); void remove_selected_glyph(); void remove_selected_font(); void remove_selected_kerning_pair(); @@ -133,7 +149,21 @@ private: Gtk::HBox* AttrCombo(gchar* lbl, const SPAttributeEnum attr); // Gtk::HBox* AttrSpin(gchar* lbl, const SPAttributeEnum attr); Gtk::VBox* global_settings_tab(); + + // + Gtk::Label* _font_label; + AttrSpin* _horiz_adv_x_spin; + AttrSpin* _horiz_origin_x_spin; + AttrSpin* _horiz_origin_y_spin; + + // + Gtk::Label* _font_face_label; AttrEntry* _familyname_entry; + AttrSpin* _units_per_em_spin; + AttrSpin* _ascent_spin; + AttrSpin* _descent_spin; + AttrSpin* _cap_height_spin; + AttrSpin* _x_height_spin; Gtk::VBox* kerning_tab(); Gtk::VBox* glyphs_tab(); @@ -169,11 +199,13 @@ private: add(glyph_node); add(glyph_name); add(unicode); + add(advance); } Gtk::TreeModelColumn glyph_node; Gtk::TreeModelColumn glyph_name; Gtk::TreeModelColumn unicode; + Gtk::TreeModelColumn advance; }; GlyphsColumns _GlyphsListColumns; Glib::RefPtr _GlyphsListStore; @@ -215,7 +247,6 @@ private: SvgFontDrawingArea _font_da, kerning_preview; GlyphComboBox first_glyph, second_glyph; SPGlyphKerning* kerning_pair; - Inkscape::UI::Widget::SpinButton setwidth_spin; #if WITH_GTKMM_3_0 Gtk::Scale* kerning_slider; -- cgit v1.2.3 From 058e95a59ccb2ab1748392acdfdbbffd516c9c81 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Mon, 11 Jul 2016 14:24:52 +0200 Subject: First part of new SPObject children list (bzr r14954.1.17) --- src/ui/widget/layer-selector.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/ui') diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index 1a9ce617f..46a0b3547 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -19,6 +19,8 @@ #include "ui/dialog/layer-properties.h" #include +#include +#include #include "desktop.h" @@ -348,27 +350,17 @@ void LayerSelector::_buildSiblingEntries( unsigned depth, SPObject &parent, Inkscape::Util::List hierarchy ) { - using Inkscape::Util::List; using Inkscape::Util::rest; - using Inkscape::Util::reverse_list_in_place; - using Inkscape::Util::filter_list; - Inkscape::Util::List siblings( - reverse_list_in_place( - filter_list( - is_layer(_desktop), parent.firstChild(), NULL - ) - ) - ); + auto siblings = parent._children | boost::adaptors::filtered(is_layer(_desktop)) | boost::adaptors::reversed; SPObject *layer( hierarchy ? &*hierarchy : NULL ); - while (siblings) { - _buildEntry(depth, *siblings); - if ( &*siblings == layer ) { + for (auto& sib: siblings) { + _buildEntry(depth, sib); + if ( &sib == layer ) { _buildSiblingEntries(depth+1, *layer, rest(hierarchy)); } - ++siblings; } } -- cgit v1.2.3 From d1947e768272c703674129d5c583204ff2b59251 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 13 Jul 2016 13:36:19 +0200 Subject: Second part of new SPObject children list (bzr r14954.1.19) --- src/ui/clipboard.cpp | 4 ++-- src/ui/dialog/clonetiler.cpp | 24 ++++++++++++------------ src/ui/dialog/filter-effects-dialog.cpp | 23 ++++++++++++----------- src/ui/dialog/find.cpp | 10 +++++----- src/ui/dialog/font-substitution.cpp | 2 +- src/ui/dialog/objects.cpp | 6 +++--- src/ui/dialog/spellcheck.cpp | 12 ++++++------ src/ui/dialog/symbols.cpp | 8 ++++---- src/ui/tools/box3d-tool.cpp | 4 ++-- src/ui/tools/connector-tool.cpp | 6 +++--- src/ui/tools/tweak-tool.cpp | 16 ++++++++-------- 11 files changed, 58 insertions(+), 57 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 9871804f5..75c6c5bcc 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -894,8 +894,8 @@ void ClipboardManagerImpl::_copyPattern(SPPattern *pattern) _copyNode(pattern->getRepr(), _doc, _defs); // items in the pattern may also use gradients and other patterns, so recurse - for ( SPObject *child = pattern->firstChild() ; child ; child = child->getNext() ) { - SPItem *childItem = dynamic_cast(child); + for (auto& child: pattern->_children) { + SPItem *childItem = dynamic_cast(&child); if (childItem) { _copyUsedDefs(childItem); } diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index 87c90c460..11af02e3c 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -2042,12 +2042,12 @@ void CloneTiler::clonetiler_trace_hide_tiled_clones_recursively(SPObject *from) if (!trace_drawing) return; - for (SPObject *o = from->firstChild(); o != NULL; o = o->next) { - SPItem *item = dynamic_cast(o); - if (item && clonetiler_is_a_clone_of(o, NULL)) { + for (auto& o: from->_children) { + SPItem *item = dynamic_cast(&o); + if (item && clonetiler_is_a_clone_of(&o, NULL)) { item->invoke_hide(trace_visionkey); // FIXME: hide each tiled clone's original too! } - clonetiler_trace_hide_tiled_clones_recursively (o); + clonetiler_trace_hide_tiled_clones_recursively (&o); } } @@ -2123,9 +2123,9 @@ void CloneTiler::clonetiler_unclump(GtkWidget */*widget*/, void *) std::vector to_unclump; // not including the original - for (SPObject *child = parent->firstChild(); child != NULL; child = child->next) { - if (clonetiler_is_a_clone_of (child, obj)) { - to_unclump.push_back((SPItem*)child); + for (auto& child: parent->_children) { + if (clonetiler_is_a_clone_of (&child, obj)) { + to_unclump.push_back((SPItem*)&child); } } @@ -2143,8 +2143,8 @@ guint CloneTiler::clonetiler_number_of_clones(SPObject *obj) guint n = 0; - for (SPObject *child = parent->firstChild(); child != NULL; child = child->next) { - if (clonetiler_is_a_clone_of (child, obj)) { + for (auto& child: parent->_children) { + if (clonetiler_is_a_clone_of (&child, obj)) { n ++; } } @@ -2172,9 +2172,9 @@ void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool d // remove old tiling GSList *to_delete = NULL; - for (SPObject *child = parent->firstChild(); child != NULL; child = child->next) { - if (clonetiler_is_a_clone_of (child, obj)) { - to_delete = g_slist_prepend (to_delete, child); + for (auto& child: parent->_children) { + if (clonetiler_is_a_clone_of (&child, obj)) { + to_delete = g_slist_prepend (to_delete, &child); } } for (GSList *i = to_delete; i; i = i->next) { diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 78e03e2a0..a60d1ddff 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -103,9 +103,7 @@ static int input_count(const SPFilterPrimitive* prim) return 2; else if(SP_IS_FEMERGE(prim)) { // Return the number of feMergeNode connections plus an extra - int count = 1; - for(const SPObject* o = prim->firstChild(); o; o = o->next, ++count){}; - return count; + return (int) (prim->_children.size() + 1); } else return 1; @@ -2343,11 +2341,12 @@ const Gtk::TreeIter FilterEffectsDialog::PrimitiveList::find_result(const Gtk::T if(SP_IS_FEMERGE(prim)) { int c = 0; bool found = false; - for(const SPObject* o = prim->firstChild(); o; o = o->next, ++c) { - if(c == attr && SP_IS_FEMERGENODE(o)) { - image = SP_FEMERGENODE(o)->input; + for (auto& o: prim->_children) { + if(c == attr && SP_IS_FEMERGENODE(&o)) { + image = SP_FEMERGENODE(&o)->input; found = true; } + ++c; } if(!found) return target; @@ -2534,21 +2533,23 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton* if(SP_IS_FEMERGE(prim)) { int c = 1; bool handled = false; - for(SPObject* o = prim->firstChild(); o && !handled; o = o->next, ++c) { - if(c == _in_drag && SP_IS_FEMERGENODE(o)) { + for (auto& o: prim->_children) { + if(c == _in_drag && SP_IS_FEMERGENODE(&o)) { // If input is null, delete it if(!in_val) { //XML Tree being used directly here while it shouldn't be. - sp_repr_unparent(o->getRepr()); + sp_repr_unparent(o.getRepr()); DocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove merge node")); (*get_selection()->get_selected())[_columns.primitive] = prim; + } else { + _dialog.set_attr(&o, SP_ATTR_IN, in_val); } - else - _dialog.set_attr(o, SP_ATTR_IN, in_val); handled = true; + break; } + ++c; } // Add new input? if(!handled && c == _in_drag && in_val) { diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index 013a0ae6a..e156dfa13 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -747,14 +747,14 @@ std::vector &Find::all_items (SPObject *r, std::vector &l, boo return l; // we're not interested in metadata } - for (SPObject *child = r->firstChild(); child; child = child->getNext()) { - SPItem *item = dynamic_cast(child); - if (item && !child->cloned && !desktop->isLayer(item)) { + for (auto& child: r->_children) { + SPItem *item = dynamic_cast(&child); + if (item && !child.cloned && !desktop->isLayer(item)) { if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) { - l.insert(l.begin(),(SPItem*)child); + l.insert(l.begin(),(SPItem*)&child); } } - l = all_items (child, l, hidden, locked); + l = all_items (&child, l, hidden, locked); } return l; } diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index f219f3db6..eafe5566a 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -182,7 +182,7 @@ std::vector FontSubstitution::getFontReplacedItems(SPDocument* doc, Gli family = SP_TEXT(parent_text)->layout.getFontFamily(0); // Add all the spans fonts to the set gint ii = 0; - for (SPObject *child = parent_text->firstChild() ; child ; child = child->getNext() ) { + for (auto& child: parent_text->_children) { family = SP_TEXT(parent_text)->layout.getFontFamily(ii); setFontSpans.insert(family); ii++; diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 9d05c73bc..00482c573 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -1292,9 +1292,9 @@ bool ObjectsPanel::_executeAction() break; case BUTTON_COLLAPSE_ALL: { - for (SPObject* obj = _document->getRoot()->firstChild(); obj != NULL; obj = obj->next) { - if (SP_IS_GROUP(obj)) { - _setCollapsed(SP_GROUP(obj)); + for (auto& obj: _document->getRoot()->_children) { + if (SP_IS_GROUP(&obj)) { + _setCollapsed(SP_GROUP(&obj)); } } _objectsChanged(_document->getRoot()); diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp index 6da8acb20..9338a4e8c 100644 --- a/src/ui/dialog/spellcheck.cpp +++ b/src/ui/dialog/spellcheck.cpp @@ -234,14 +234,14 @@ GSList *SpellCheck::allTextItems (SPObject *r, GSList *l, bool hidden, bool lock return l; // we're not interested in metadata } - for (SPObject *child = r->firstChild(); child; child = child->next) { - if (SP_IS_ITEM (child) && !child->cloned && !desktop->isLayer(SP_ITEM(child))) { - if ((hidden || !desktop->itemIsHidden(SP_ITEM(child))) && (locked || !SP_ITEM(child)->isLocked())) { - if (SP_IS_TEXT(child) || SP_IS_FLOWTEXT(child)) - l = g_slist_prepend (l, child); + for (auto& child: r->_children) { + if (SP_IS_ITEM (&child) && !child.cloned && !desktop->isLayer(SP_ITEM(&child))) { + if ((hidden || !desktop->itemIsHidden(SP_ITEM(&child))) && (locked || !SP_ITEM(&child)->isLocked())) { + if (SP_IS_TEXT(&child) || SP_IS_FLOWTEXT(&child)) + l = g_slist_prepend (l, &child); } } - l = allTextItems (child, l, hidden, locked); + l = allTextItems (&child, l, hidden, locked); } return l; } diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 51d81022f..1fdce34a5 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -658,8 +658,8 @@ GSList* SymbolsDialog::symbols_in_doc_recursive (SPObject *r, GSList *l) l = g_slist_prepend (l, r); } - for (SPObject *child = r->firstChild(); child; child = child->getNext()) { - l = symbols_in_doc_recursive( child, l ); + for (auto& child: r->_children) { + l = symbols_in_doc_recursive( &child, l ); } return l; @@ -680,8 +680,8 @@ GSList* SymbolsDialog::use_in_doc_recursive (SPObject *r, GSList *l) l = g_slist_prepend (l, r); } - for (SPObject *child = r->firstChild(); child; child = child->getNext()) { - l = use_in_doc_recursive( child, l ); + for (auto& child: r->_children) { + l = use_in_doc_recursive( &child, l ); } return l; diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp index 27e755add..2adba38c5 100644 --- a/src/ui/tools/box3d-tool.cpp +++ b/src/ui/tools/box3d-tool.cpp @@ -118,8 +118,8 @@ static void sp_box3d_context_ensure_persp_in_defs(SPDocument *document) { SPDefs *defs = document->getDefs(); bool has_persp = false; - for ( SPObject *child = defs->firstChild(); child; child = child->getNext() ) { - if (SP_IS_PERSP3D(child)) { + for (auto& child: defs->_children) { + if (SP_IS_PERSP3D(&child)) { has_persp = true; break; } diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp index b81a630e2..be8ce6d0c 100644 --- a/src/ui/tools/connector-tool.cpp +++ b/src/ui/tools/connector-tool.cpp @@ -1114,9 +1114,9 @@ void ConnectorTool::_setActiveShape(SPItem *item) { // The idea here is to try and add a group's children to solidify // connection handling. We react to path objects with only one node. - for (SPObject *child = item->firstChild() ; child ; child = child->getNext() ) { - if (SP_IS_PATH(child) && SP_PATH(child)->nodesInPath() == 1) { - this->_activeShapeAddKnot((SPItem *) child); + for (auto& child: item->_children) { + if (SP_IS_PATH(&child) && SP_PATH(&child)->nodesInPath() == 1) { + this->_activeShapeAddKnot((SPItem *) &child); } } this->_activeShapeAddKnot(item); diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index 658cf4617..d048c318b 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -385,9 +385,9 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P if (dynamic_cast(item) && !dynamic_cast(item)) { GSList *children = NULL; - for (SPObject *child = item->firstChild() ; child; child = child->getNext() ) { - if (dynamic_cast(static_cast(child))) { - children = g_slist_prepend(children, child); + for (auto& child: item->_children) { + if (dynamic_cast(static_cast(&child))) { + children = g_slist_prepend(children, &child); } } @@ -832,8 +832,8 @@ static void tweak_colors_in_gradient(SPItem *item, Inkscape::PaintTarget fill_or double offset_l = 0; double offset_h = 0; SPObject *child_prev = NULL; - for (SPObject *child = vector->firstChild(); child; child = child->getNext()) { - SPStop *stop = dynamic_cast(child); + for (auto& child: vector->_children) { + SPStop *stop = dynamic_cast(&child); if (!stop) { continue; } @@ -878,7 +878,7 @@ static void tweak_colors_in_gradient(SPItem *item, Inkscape::PaintTarget fill_or } offset_l = offset_h; - child_prev = child; + child_prev = &child; } } @@ -894,8 +894,8 @@ sp_tweak_color_recursive (guint mode, SPItem *item, SPItem *item_at_point, bool did = false; if (dynamic_cast(item)) { - for (SPObject *child = item->firstChild() ; child; child = child->getNext() ) { - SPItem *childItem = dynamic_cast(child); + for (auto& child: item->_children) { + SPItem *childItem = dynamic_cast(&child); if (childItem) { if (sp_tweak_color_recursive (mode, childItem, item_at_point, fill_goal, do_fill, -- cgit v1.2.3 From c1b1cf45b4b1feb43d326c2660e70408185ca64d Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Wed, 13 Jul 2016 20:32:24 +0530 Subject: Fix crash when deleting selector (bzr r14949.1.47) --- src/ui/dialog/styledialog.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index ac51e36c1..ca4f35bb6 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -307,7 +307,7 @@ void StyleDialog::_delSelector() Gtk::TreeModel::Row row = *iter; std::string sel, key, value; std::vector<_selectorVecType>::iterator it; - for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it ) { + for (it = _selectorVec.begin(); it != _selectorVec.end();) { sel = (*it).second; REMOVE_SPACES(sel); if (!sel.empty()) { @@ -318,10 +318,11 @@ void StyleDialog::_delSelector() value = strtok(temp, "}"); } } - } - if (_selectorVec.size() != 0) { - if (!row.parent()) { + Glib::ustring selectedRowLabel = row[_mColumns._selectorLabel]; + std::string matchSelector = selectedRowLabel; + REMOVE_SPACES(s1); + if (key == matchSelector) { if (!row.children().empty()) { for (Gtk::TreeModel::Children::iterator child = row.children().begin(); child != row.children().end(); ++child) { @@ -331,20 +332,24 @@ void StyleDialog::_delSelector() } } } - _selectorVec.erase(it); + it = _selectorVec.erase(it); _store->erase(row); } + else { + ++it; + } /** - * If there is a _styleChild which contains the style element, then - * the content in style element is updated else the _styleChild is - * obtained and its content is set. + * The _stylechild is obtained which contains the style element and + * the content in style element is updated. */ - if (_styleChild) { - _updateStyleContent(); + _styleChild = _styleElementNode(); + + if (_selectorVec.size() == 0) { + _document->getReprRoot()->removeChild(_styleChild); + _styleExists = false; } else { - _styleChild = _styleElementNode(); _updateStyleContent(); } } -- cgit v1.2.3 From 0799f58bb7144addd85ba4601899eaf29d92d26c Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Wed, 13 Jul 2016 20:38:56 +0530 Subject: Replace s1 with matchSelector (bzr r14949.1.48) --- src/ui/dialog/styledialog.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index ca4f35bb6..4c4cb03aa 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -321,7 +321,7 @@ void StyleDialog::_delSelector() Glib::ustring selectedRowLabel = row[_mColumns._selectorLabel]; std::string matchSelector = selectedRowLabel; - REMOVE_SPACES(s1); + REMOVE_SPACES(matchSelector); if (key == matchSelector) { if (!row.children().empty()) { for (Gtk::TreeModel::Children::iterator child = row.children().begin(); @@ -341,10 +341,11 @@ void StyleDialog::_delSelector() /** * The _stylechild is obtained which contains the style element and - * the content in style element is updated. + * the content in style element is updated. If _selectorVec is + * empty, the style element is removed from the XML repr else + * the content is updated simply using _updateStyleContent(). */ _styleChild = _styleElementNode(); - if (_selectorVec.size() == 0) { _document->getReprRoot()->removeChild(_styleChild); _styleExists = false; -- cgit v1.2.3 From 593e73c62fd16032ddd1ec85f21fb32ae543d753 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Wed, 13 Jul 2016 22:22:20 +0530 Subject: Correct deletion of child rows when parent selector is deleted (bzr r14949.1.49) --- src/ui/dialog/styledialog.cpp | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 4c4cb03aa..bf731466f 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -327,8 +327,25 @@ void StyleDialog::_delSelector() for (Gtk::TreeModel::Children::iterator child = row.children().begin(); child != row.children().end(); ++child) { Gtk::TreeModel::Row childrow = *child; - if (key == childrow[_mColumns._selectorLabel]) { - _selectorVec.erase(it); + std::string childSel, childKey; + std::vector<_selectorVecType>::iterator i; + for (i = _selectorVec.begin(); i != _selectorVec.end();) { + childSel = (*i).second; + REMOVE_SPACES(childSel); + if (!childSel.empty()) { + childKey = strtok(strdup(childSel.c_str()), "{"); + REMOVE_SPACES(childKey); + } + Glib::ustring selectedChildRowLabel = + childrow[_mColumns._selectorLabel]; + std::string matchChildSelector = selectedChildRowLabel; + REMOVE_SPACES(matchChildSelector); + if (childKey == matchChildSelector) { + i = _selectorVec.erase(i); + } + else { + ++i; + } } } } @@ -568,8 +585,14 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) std::string(obj->getId()); childrow[_mColumns._colAddRemove] = false; childrow[_mColumns._colObj] = _desktop->selection->list(); - childStyle = "#" + std::string(obj->getId()) + "{" + - std::string(obj->getAttribute("style")) + "}\n"; + if (obj->getAttribute("style") != NULL) { + childStyle = "#" + std::string(obj->getId()) + "{" + + std::string(obj->getAttribute("style")) + "}\n"; + } + else { + childStyle = "#" + std::string(obj->getId()) + + "{" + "}\n"; + } Glib::ustring key = row[_mColumns._selectorLabel]; if (strcmp(key.substr(0,1).c_str(), ".") == 0) { if (!obj->getRepr()->attribute("class")) { -- cgit v1.2.3 From c72fde648673730e259453b05df66287b1b6d779 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Wed, 13 Jul 2016 23:46:40 +0530 Subject: Change expander column of treeview and set indentation of child rows (bzr r14949.1.50) --- src/ui/dialog/styledialog.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index bf731466f..174dd5ece 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -75,6 +75,8 @@ StyleDialog::StyleDialog() : } _treeView.append_column("Selector Name", _mColumns._selectorLabel); + _treeView.set_expander_column(*(_treeView.get_column(1))); + _treeView.set_level_indentation(-12); create = manage( new Gtk::Button() ); _styleButton(*create, "list-add", "Add a new CSS Selector"); -- cgit v1.2.3 From 9e210a6d1333c3366681547e3e81593ef69ff73e Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 12:56:49 +0200 Subject: Last part of new SPObject children list (bzr r14954.1.20) --- src/ui/clipboard.cpp | 8 ++-- src/ui/dialog/document-properties.cpp | 14 +++--- src/ui/dialog/filter-effects-dialog.cpp | 54 ++++++++++----------- src/ui/dialog/objects.cpp | 83 ++++++++++++++++++-------------- src/ui/dialog/svg-fonts-dialog.cpp | 84 +++++++++++++++------------------ src/ui/dialog/tags.cpp | 45 +++++++++--------- src/ui/tools/node-tool.cpp | 4 +- src/ui/tools/tweak-tool.cpp | 6 +-- 8 files changed, 148 insertions(+), 150 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 75c6c5bcc..48d53857b 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -839,8 +839,8 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) SPObject *mask = item->mask_ref->getObject(); _copyNode(mask->getRepr(), _doc, _defs); // recurse into the mask for its gradients etc. - for (SPObject *o = mask->children ; o != NULL ; o = o->next) { - SPItem *childItem = dynamic_cast(o); + for(auto& o: mask->_children) { + SPItem *childItem = dynamic_cast(&o); if (childItem) { _copyUsedDefs(childItem); } @@ -857,8 +857,8 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) } // recurse - for (SPObject *o = item->children ; o != NULL ; o = o->next) { - SPItem *childItem = dynamic_cast(o); + for(auto& o: item->_children) { + SPItem *childItem = dynamic_cast(&o); if (childItem) { _copyUsedDefs(childItem); } diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 589973162..df37eb005 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1315,12 +1315,7 @@ void DocumentProperties::changeEmbeddedScript(){ for (std::vector::const_iterator it = current.begin(); it != current.end(); ++it) { SPObject* obj = *it; if (id == obj->getId()){ - - int count=0; - for ( SPObject *child = obj->children ; child; child = child->next ) - { - count++; - } + int count = (int) obj->_children.size(); if (count>1) g_warning("TODO: Found a script element with multiple (%d) child nodes! We must implement support for that!", count); @@ -1364,8 +1359,11 @@ void DocumentProperties::editEmbeddedScript(){ //XML Tree being used directly here while it shouldn't be. Inkscape::XML::Node *repr = obj->getRepr(); if (repr){ - SPObject *child; - while (NULL != (child = obj->firstChild())) child->deleteObject(); + auto tmp = obj->_children | boost::adaptors::transformed([](SPObject& o) { return &o; }); + std::vector vec(tmp.begin(), tmp.end()); + for (auto &child: vec) { + child->deleteObject(); + } obj->appendChildRepr(xml_doc->createTextNode(_EmbeddedContent.get_buffer()->get_text().c_str())); //TODO repr->set_content(_EmbeddedContent.get_buffer()->get_text()); diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index a60d1ddff..1be5d540a 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1058,11 +1058,10 @@ public: // FuncNode can be in any order so we must search to find correct one. SPFeFuncNode* find_node(SPFeComponentTransfer* ct) { - SPObject* node = ct->children; SPFeFuncNode* funcNode = NULL; bool found = false; - for(;node;node=node->next){ - funcNode = SP_FEFUNCNODE(node); + for(auto& node: ct->_children) { + funcNode = SP_FEFUNCNODE(&node); if( funcNode->channel == _channel ) { found = true; break; @@ -1226,7 +1225,7 @@ protected: _locked = true; - SPObject* child = o->children; + SPObject* child = o->firstChild(); if(SP_IS_FEDISTANTLIGHT(child)) _light_source.set_active(0); @@ -1251,7 +1250,7 @@ private: if(prim) { _locked = true; - SPObject* child = prim->children; + SPObject* child = prim->firstChild(); const int ls = _light_source.get_active_row_number(); // Check if the light source type has changed if(!(ls == -1 && !child) && @@ -1285,8 +1284,8 @@ private: _light_box.show_all(); SPFilterPrimitive* prim = _dialog._primitive_list.get_selected(); - if(prim && prim->children) - _settings.show_and_update(_light_source.get_active_data()->id, prim->children); + if(prim && prim->firstChild()) + _settings.show_and_update(_light_source.get_active_data()->id, prim->firstChild()); } FilterEffectsDialog& _dialog; @@ -1869,26 +1868,25 @@ void FilterEffectsDialog::PrimitiveList::update() bool active_found = false; _dialog._primitive_box->set_sensitive(true); _dialog.update_filter_general_settings_view(); - for(SPObject *prim_obj = f->children; - prim_obj && SP_IS_FILTER_PRIMITIVE(prim_obj); - prim_obj = prim_obj->next) { - SPFilterPrimitive *prim = SP_FILTER_PRIMITIVE(prim_obj); - if(prim) { - Gtk::TreeModel::Row row = *_model->append(); - row[_columns.primitive] = prim; - - //XML Tree being used directly here while it shouldn't be. - row[_columns.type_id] = FPConverter.get_id_from_key(prim->getRepr()->name()); - row[_columns.type] = _(FPConverter.get_label(row[_columns.type_id]).c_str()); - - if (prim->getId()) { - row[_columns.id] = Glib::ustring(prim->getId()); - } - - if(prim == active_prim) { - get_selection()->select(row); - active_found = true; - } + for(auto& prim_obj: f->_children) { + SPFilterPrimitive *prim = SP_FILTER_PRIMITIVE(&prim_obj); + if(!prim) { + break; + } + Gtk::TreeModel::Row row = *_model->append(); + row[_columns.primitive] = prim; + + //XML Tree being used directly here while it shouldn't be. + row[_columns.type_id] = FPConverter.get_id_from_key(prim->getRepr()->name()); + row[_columns.type] = _(FPConverter.get_label(row[_columns.type_id]).c_str()); + + if (prim->getId()) { + row[_columns.id] = Glib::ustring(prim->getId()); + } + + if(prim == active_prim) { + get_selection()->select(row); + active_found = true; } } @@ -3098,7 +3096,7 @@ void FilterEffectsDialog::set_filternode_attr(const AttrWidget* input) void FilterEffectsDialog::set_child_attr_direct(const AttrWidget* input) { - set_attr(_primitive_list.get_selected()->children, input->get_attribute(), input->get_as_attribute().c_str()); + set_attr(_primitive_list.get_selected()->firstChild(), input->get_attribute(), input->get_as_attribute().c_str()); } void FilterEffectsDialog::set_attr(SPObject* o, const SPAttributeEnum attr, const gchar* val) diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 00482c573..e4639745f 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -340,12 +340,11 @@ void ObjectsPanel::_objectsChanged(SPObject */*obj*/) void ObjectsPanel::_addObject(SPObject* obj, Gtk::TreeModel::Row* parentRow) { if ( _desktop && obj ) { - for ( SPObject *child = obj->children; child != NULL; child = child->next) { - - if (SP_IS_ITEM(child)) + for(auto& child: obj->_children) { + if (SP_IS_ITEM(&child)) { - SPItem * item = SP_ITEM(child); - SPGroup * group = SP_IS_GROUP(child) ? SP_GROUP(child) : 0; + SPItem * item = SP_ITEM(&child); + SPGroup * group = SP_IS_GROUP(&child) ? SP_GROUP(&child) : 0; //Add the item to the tree and set the column information Gtk::TreeModel::iterator iter = parentRow ? _store->prepend(parentRow->children()) : _store->prepend(); @@ -372,14 +371,14 @@ void ObjectsPanel::_addObject(SPObject* obj, Gtk::TreeModel::Row* parentRow) } //Add an object watcher to the item - ObjectsPanel::ObjectWatcher *w = new ObjectsPanel::ObjectWatcher(this, child); - child->getRepr()->addObserver(*w); + ObjectsPanel::ObjectWatcher *w = new ObjectsPanel::ObjectWatcher(this, &child); + child.getRepr()->addObserver(*w); _objectWatchers.push_back(w); //If the item is a group, recursively add its children if (group) { - _addObject( child, &row ); + _addObject( &child, &row ); } } } @@ -399,9 +398,8 @@ void ObjectsPanel::_updateObject( SPObject *obj, bool recurse ) { //end mark if (recurse) { - for (SPObject * iter = obj->children; iter != NULL; iter = iter->next) - { - _updateObject(iter, recurse); + for (auto& iter: obj->_children) { + _updateObject(&iter, recurse); } } } @@ -520,19 +518,22 @@ void ObjectsPanel::_setCompositingValues(SPItem *item) SPGaussianBlur *spblur = NULL; if (item->style->getFilter()) { - for(SPObject *primitive_obj = item->style->getFilter()->children; primitive_obj && SP_IS_FILTER_PRIMITIVE(primitive_obj); primitive_obj = primitive_obj->next) { - if(SP_IS_FEBLEND(primitive_obj) && !spblend) { - //Get the blend mode - spblend = SP_FEBLEND(primitive_obj); - } - - if(SP_IS_GAUSSIANBLUR(primitive_obj) && !spblur) { - //Get the blur value - spblur = SP_GAUSSIANBLUR(primitive_obj); - } + for (auto& primitive_obj: item->style->getFilter()->_children) { + if (!SP_IS_FILTER_PRIMITIVE(&primitive_obj)) { + break; } + if(SP_IS_FEBLEND(&primitive_obj) && !spblend) { + //Get the blend mode + spblend = SP_FEBLEND(&primitive_obj); + } + + if(SP_IS_GAUSSIANBLUR(&primitive_obj) && !spblur) { + //Get the blur value + spblur = SP_GAUSSIANBLUR(&primitive_obj); + } + } } - + //Set the blend mode _fe_cb.set_blend_mode(spblend ? spblend->blend_mode : Inkscape::Filters::BLEND_NORMAL); @@ -1404,9 +1405,10 @@ void ObjectsPanel::_setCollapsed(SPGroup * group) { group->setExpanded(false); group->updateRepr(SP_OBJECT_WRITE_NO_CHILDREN | SP_OBJECT_WRITE_EXT); - for (SPObject *iter = group->children; iter != NULL; iter = iter->next) - { - if (SP_IS_GROUP(iter)) _setCollapsed(SP_GROUP(iter)); + for (auto& iter: group->_children) { + if (SP_IS_GROUP(&iter)) { + _setCollapsed(SP_GROUP(&iter)); + } } } @@ -1521,11 +1523,14 @@ void ObjectsPanel::_blendChangedIter(const Gtk::TreeIter& iter, Glib::ustring bl if (blendmode != "normal") { gdouble radius = 0; if (item->style->getFilter()) { - for (SPObject *primitive = item->style->getFilter()->children; primitive && SP_IS_FILTER_PRIMITIVE(primitive); primitive = primitive->next) { - if (SP_IS_GAUSSIANBLUR(primitive)) { + for (auto& primitive: item->style->getFilter()->_children) { + if (!SP_IS_FILTER_PRIMITIVE(&primitive)) { + break; + } + if (SP_IS_GAUSSIANBLUR(&primitive)) { Geom::OptRect bbox = item->bounds(SPItem::GEOMETRIC_BBOX); if (bbox) { - radius = SP_GAUSSIANBLUR(primitive)->stdDeviation.getNumber(); + radius = SP_GAUSSIANBLUR(&primitive)->stdDeviation.getNumber(); } } } @@ -1533,13 +1538,16 @@ void ObjectsPanel::_blendChangedIter(const Gtk::TreeIter& iter, Glib::ustring bl SPFilter *filter = new_filter_simple_from_item(_document, item, blendmode.c_str(), radius); sp_style_set_property_url(item, "filter", filter, false); } else { - for (SPObject *primitive = item->style->getFilter()->children; primitive && SP_IS_FILTER_PRIMITIVE(primitive); primitive = primitive->next) { - if (SP_IS_FEBLEND(primitive)) { - primitive->deleteObject(); + for (auto& primitive: item->style->getFilter()->_children) { + if (!SP_IS_FILTER_PRIMITIVE(&primitive)) { + break; + } + if (SP_IS_FEBLEND(&primitive)) { + primitive.deleteObject(); break; } } - if (!item->style->getFilter()->children) { + if (!item->style->getFilter()->firstChild()) { remove_filter(item, false); } } @@ -1590,13 +1598,16 @@ void ObjectsPanel::_blurChangedIter(const Gtk::TreeIter& iter, double blur) SPFilter *filter = modify_filter_gaussian_blur_from_item(_document, item, radius); sp_style_set_property_url(item, "filter", filter, false); } else if (item->style->filter.set && item->style->getFilter()) { - for (SPObject *primitive = item->style->getFilter()->children; primitive && SP_IS_FILTER_PRIMITIVE(primitive); primitive = primitive->next) { - if (SP_IS_GAUSSIANBLUR(primitive)) { - primitive->deleteObject(); + for (auto& primitive: item->style->getFilter()->_children) { + if (!SP_IS_FILTER_PRIMITIVE(&primitive)) { + break; + } + if (SP_IS_GAUSSIANBLUR(&primitive)) { + primitive.deleteObject(); break; } } - if (!item->style->getFilter()->children) { + if (!item->style->getFilter()->firstChild()) { remove_filter(item, false); } } diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 7b256fc8f..93bd67a3d 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -115,11 +115,11 @@ void SvgFontsDialog::AttrEntry::set_text(char* t){ void SvgFontsDialog::AttrEntry::on_attr_changed(){ SPObject* o = NULL; - for(SPObject* node = this->dialog->get_selected_spfont()->children; node; node=node->next){ + for (auto& node: dialog->get_selected_spfont()->_children) { switch(this->attr){ case SP_PROP_FONT_FAMILY: - if (SP_IS_FONTFACE(node)){ - o = node; + if (SP_IS_FONTFACE(&node)){ + o = &node; continue; } break; @@ -170,9 +170,9 @@ void GlyphComboBox::update(SPFont* spfont){ this->append(""); //Gtk is refusing to clear the combobox when I comment out this line this->remove_all(); - for(SPObject* node = spfont->children; node; node=node->next){ - if (SP_IS_GLYPH(node)){ - this->append((static_cast(node))->unicode); + for (auto& node: spfont->_children) { + if (SP_IS_GLYPH(&node)){ + this->append((static_cast(&node))->unicode); } } } @@ -308,10 +308,9 @@ void SvgFontsDialog::update_global_settings_tab(){ SPFont* font = get_selected_spfont(); if (!font) return; - SPObject* obj; - for (obj=font->children; obj; obj=obj->next){ - if (SP_IS_FONTFACE(obj)){ - _familyname_entry->set_text((SP_FONTFACE(obj))->font_family); + for (auto& obj: font->_children) { + if (SP_IS_FONTFACE(&obj)){ + _familyname_entry->set_text((SP_FONTFACE(&obj))->font_family); } } } @@ -414,12 +413,12 @@ SvgFontsDialog::populate_glyphs_box() SPFont* spfont = this->get_selected_spfont(); _glyphs_observer.set(spfont); - for(SPObject* node = spfont->children; node; node=node->next){ - if (SP_IS_GLYPH(node)){ + for (auto& node: spfont->_children) { + if (SP_IS_GLYPH(&node)){ Gtk::TreeModel::Row row = *(_GlyphsListStore->append()); - row[_GlyphsListColumns.glyph_node] = static_cast(node); - row[_GlyphsListColumns.glyph_name] = (static_cast(node))->glyph_name; - row[_GlyphsListColumns.unicode] = (static_cast(node))->unicode; + row[_GlyphsListColumns.glyph_node] = static_cast(&node); + row[_GlyphsListColumns.glyph_name] = (static_cast(&node))->glyph_name; + row[_GlyphsListColumns.unicode] = (static_cast(&node))->unicode; } } } @@ -432,13 +431,13 @@ SvgFontsDialog::populate_kerning_pairs_box() SPFont* spfont = this->get_selected_spfont(); - for(SPObject* node = spfont->children; node; node=node->next){ - if (SP_IS_HKERN(node)){ + for (auto& node: spfont->_children) { + if (SP_IS_HKERN(&node)){ Gtk::TreeModel::Row row = *(_KerningPairsListStore->append()); - row[_KerningPairsListColumns.first_glyph] = (static_cast(node))->u1->attribute_string().c_str(); - row[_KerningPairsListColumns.second_glyph] = (static_cast(node))->u2->attribute_string().c_str(); - row[_KerningPairsListColumns.kerning_value] = (static_cast(node))->k; - row[_KerningPairsListColumns.spnode] = static_cast(node); + row[_KerningPairsListColumns.first_glyph] = (static_cast(&node))->u1->attribute_string().c_str(); + row[_KerningPairsListColumns.second_glyph] = (static_cast(&node))->u2->attribute_string().c_str(); + row[_KerningPairsListColumns.kerning_value] = (static_cast(&node))->k; + row[_KerningPairsListColumns.spnode] = static_cast(&node); } } } @@ -493,11 +492,10 @@ void SvgFontsDialog::add_glyph(){ Geom::PathVector SvgFontsDialog::flip_coordinate_system(Geom::PathVector pathv){ double units_per_em = 1000; - SPObject* obj; - for (obj = get_selected_spfont()->children; obj; obj=obj->next){ - if (SP_IS_FONTFACE(obj)){ + for (auto& obj: get_selected_spfont()->_children) { + if (SP_IS_FONTFACE(&obj)){ //XML Tree being directly used here while it shouldn't be. - sp_repr_get_double(obj->getRepr(), "units-per-em", &units_per_em); + sp_repr_get_double(obj.getRepr(), "units-per-em", &units_per_em); } } @@ -576,13 +574,12 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ Geom::PathVector pathv = sp_svg_read_pathv(node->attribute("d")); - SPObject* obj; - for (obj = get_selected_spfont()->children; obj; obj=obj->next){ - if (SP_IS_MISSING_GLYPH(obj)){ + for (auto& obj: get_selected_spfont()->_children) { + if (SP_IS_MISSING_GLYPH(&obj)){ //XML Tree being directly used here while it shouldn't be. gchar *str = sp_svg_write_path (flip_coordinate_system(pathv)); - obj->getRepr()->setAttribute("d", str); + obj.getRepr()->setAttribute("d", str); g_free(str); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); } @@ -599,11 +596,10 @@ void SvgFontsDialog::reset_missing_glyph_description(){ } SPDocument* doc = desktop->getDocument(); - SPObject* obj; - for (obj = get_selected_spfont()->children; obj; obj=obj->next){ - if (SP_IS_MISSING_GLYPH(obj)){ + for (auto& obj: get_selected_spfont()->_children) { + if (SP_IS_MISSING_GLYPH(&obj)){ //XML Tree being directly used here while it shouldn't be. - obj->getRepr()->setAttribute("d", (char*) "M0,0h1000v1024h-1000z"); + obj.getRepr()->setAttribute("d", (char*) "M0,0h1000v1024h-1000z"); DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Reset missing-glyph")); } } @@ -738,12 +734,12 @@ void SvgFontsDialog::add_kerning_pair(){ //look for this kerning pair on the currently selected font this->kerning_pair = NULL; - for(SPObject* node = this->get_selected_spfont()->children; node; node=node->next){ + for (auto& node: get_selected_spfont()->_children) { //TODO: It is not really correct to get only the first byte of each string. //TODO: We should also support vertical kerning - if (SP_IS_HKERN(node) && (static_cast(node))->u1->contains((gchar) first_glyph.get_active_text().c_str()[0]) - && (static_cast(node))->u2->contains((gchar) second_glyph.get_active_text().c_str()[0]) ){ - this->kerning_pair = static_cast(node); + if (SP_IS_HKERN(&node) && (static_cast(&node))->u1->contains((gchar) first_glyph.get_active_text().c_str()[0]) + && (static_cast(&node))->u2->contains((gchar) second_glyph.get_active_text().c_str()[0]) ){ + this->kerning_pair = static_cast(&node); continue; } } @@ -852,11 +848,10 @@ SPFont *new_font(SPDocument *document) void set_font_family(SPFont* font, char* str){ if (!font) return; - SPObject* obj; - for (obj=font->children; obj; obj=obj->next){ - if (SP_IS_FONTFACE(obj)){ + for (auto& obj: font->_children) { + if (SP_IS_FONTFACE(&obj)){ //XML Tree being directly used here while it shouldn't be. - obj->getRepr()->setAttribute("font-family", str); + obj.getRepr()->setAttribute("font-family", str); } } @@ -873,11 +868,10 @@ void SvgFontsDialog::add_font(){ font->setLabel(os.str().c_str()); os2 << "SVGFont " << count; - SPObject* obj; - for (obj=font->children; obj; obj=obj->next){ - if (SP_IS_FONTFACE(obj)){ + for (auto& obj: font->_children) { + if (SP_IS_FONTFACE(&obj)){ //XML Tree being directly used here while it shouldn't be. - obj->getRepr()->setAttribute("font-family", os2.str().c_str()); + obj.getRepr()->setAttribute("font-family", os2.str().c_str()); } } diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index 53641c0de..61c8b5d37 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -399,26 +399,26 @@ void TagsPanel::_objectsChanged(SPObject* root) void TagsPanel::_addObject( SPDocument* doc, SPObject* obj, Gtk::TreeModel::Row* parentRow ) { if ( _desktop && obj ) { - for ( SPObject *child = obj->children; child != NULL; child = child->next) { - if (SP_IS_TAG(child)) + for (auto& child: obj->_children) { + if (SP_IS_TAG(&child)) { Gtk::TreeModel::iterator iter = parentRow ? _store->prepend(parentRow->children()) : _store->prepend(); Gtk::TreeModel::Row row = *iter; - row[_model->_colObject] = child; + row[_model->_colObject] = &child; row[_model->_colParentObject] = NULL; - row[_model->_colLabel] = child->label() ? child->label() : child->getId(); + row[_model->_colLabel] = child.label() ? child.label() : child.getId(); row[_model->_colAddRemove] = true; row[_model->_colAllowAddRemove] = true; _tree.expand_to_path( _store->get_path(iter) ); - TagsPanel::ObjectWatcher *w = new TagsPanel::ObjectWatcher(this, child); - child->getRepr()->addObserver(*w); + TagsPanel::ObjectWatcher *w = new TagsPanel::ObjectWatcher(this, &child); + child.getRepr()->addObserver(*w); _objectWatchers.push_back(w); - _addObject( doc, child, &row ); + _addObject( doc, &child, &row ); } } - if (SP_IS_TAG(obj) && obj->children) + if (SP_IS_TAG(obj) && obj->firstChild()) { Gtk::TreeModel::iterator iteritems = parentRow ? _store->append(parentRow->children()) : _store->prepend(); Gtk::TreeModel::Row rowitems = *iteritems; @@ -429,16 +429,16 @@ void TagsPanel::_addObject( SPDocument* doc, SPObject* obj, Gtk::TreeModel::Row* rowitems[_model->_colAllowAddRemove] = false; _tree.expand_to_path( _store->get_path(iteritems) ); - - for ( SPObject *child = obj->children; child != NULL; child = child->next) { - if (SP_IS_TAG_USE(child)) + + for (auto& child: obj->_children) { + if (SP_IS_TAG_USE(&child)) { - SPItem *item = SP_TAG_USE(child)->ref->getObject(); + SPItem *item = SP_TAG_USE(&child)->ref->getObject(); Gtk::TreeModel::iterator iter = _store->prepend(rowitems->children()); Gtk::TreeModel::Row row = *iter; - row[_model->_colObject] = child; + row[_model->_colObject] = &child; row[_model->_colParentObject] = NULL; - row[_model->_colLabel] = item ? (item->label() ? item->label() : item->getId()) : SP_TAG_USE(child)->href; + row[_model->_colLabel] = item ? (item->label() ? item->label() : item->getId()) : SP_TAG_USE(&child)->href; row[_model->_colAddRemove] = false; row[_model->_colAllowAddRemove] = true; @@ -447,7 +447,7 @@ void TagsPanel::_addObject( SPDocument* doc, SPObject* obj, Gtk::TreeModel::Row* } if (item) { - TagsPanel::ObjectWatcher *w = new TagsPanel::ObjectWatcher(this, child, item->getRepr()); + TagsPanel::ObjectWatcher *w = new TagsPanel::ObjectWatcher(this, &child, item->getRepr()); item->getRepr()->addObserver(*w); _objectWatchers.push_back(w); } @@ -459,12 +459,11 @@ void TagsPanel::_addObject( SPDocument* doc, SPObject* obj, Gtk::TreeModel::Row* void TagsPanel::_select_tag( SPTag * tag ) { - for (SPObject * child = tag->children; child != NULL; child = child->next) - { - if (SP_IS_TAG(child)) { - _select_tag(SP_TAG(child)); - } else if (SP_IS_TAG_USE(child)) { - SPObject * obj = SP_TAG_USE(child)->ref->getObject(); + for (auto& child: tag->_children) { + if (SP_IS_TAG(&child)) { + _select_tag(SP_TAG(&child)); + } else if (SP_IS_TAG_USE(&child)) { + SPObject * obj = SP_TAG_USE(&child)->ref->getObject(); if (obj) { if (_desktop->selection->isEmpty()) _desktop->setCurrentLayer(obj->parent); _desktop->selection->add(obj); @@ -650,8 +649,8 @@ bool TagsPanel::_handleButtonEvent(GdkEventButton* event) for(auto i=items.begin();i!=items.end();++i){ SPObject *newobj = *i; bool addchild = true; - for ( SPObject *child = obj->children; child != NULL; child = child->next) { - if (SP_IS_TAG_USE(child) && SP_TAG_USE(child)->ref->getObject() == newobj) { + for (auto& child: obj->_children) { + if (SP_IS_TAG_USE(&child) && SP_TAG_USE(&child)->ref->getObject() == newobj) { addchild = false; } } diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 736dafa50..3dfac5e3d 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -378,8 +378,8 @@ void gather_items(NodeTool *nt, SPItem *base, SPObject *obj, Inkscape::UI::Shape r.role = role; s.insert(r); } else if (role != SHAPE_ROLE_NORMAL && (SP_IS_GROUP(obj) || SP_IS_OBJECTGROUP(obj))) { - for (SPObject *c = obj->children; c; c = c->next) { - gather_items(nt, base, c, role, s); + for (auto& c: obj->_children) { + gather_items(nt, base, &c, role, s); } } else if (SP_IS_ITEM(obj)) { SPItem *item = static_cast(obj); diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index d048c318b..7da0973d5 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -951,9 +951,8 @@ sp_tweak_color_recursive (guint mode, SPItem *item, SPItem *item_at_point, Geom::Affine i2dt = item->i2dt_affine (); if (style->filter.set && style->getFilter()) { //cycle through filter primitives - SPObject *primitive_obj = style->getFilter()->children; - while (primitive_obj) { - SPFilterPrimitive *primitive = dynamic_cast(primitive_obj); + for (auto& primitive_obj: style->getFilter()->_children) { + SPFilterPrimitive *primitive = dynamic_cast(&primitive_obj); if (primitive) { //if primitive is gaussianblur SPGaussianBlur * spblur = dynamic_cast(primitive); @@ -962,7 +961,6 @@ sp_tweak_color_recursive (guint mode, SPItem *item, SPItem *item_at_point, blur_now += num * i2dt.descrim(); // sum all blurs in the filter } } - primitive_obj = primitive_obj->next; } } double perimeter = bbox->dimensions()[Geom::X] + bbox->dimensions()[Geom::Y]; -- cgit v1.2.3 From 24d3f50003ca3cec6a03a7f5267cc4fe5588c69f Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 13:17:21 +0200 Subject: Renamed children list in SPObject (bzr r14954.1.21) --- src/ui/clipboard.cpp | 6 +++--- src/ui/dialog/clonetiler.cpp | 8 ++++---- src/ui/dialog/document-properties.cpp | 4 ++-- src/ui/dialog/filter-effects-dialog.cpp | 10 +++++----- src/ui/dialog/find.cpp | 2 +- src/ui/dialog/font-substitution.cpp | 2 +- src/ui/dialog/objects.cpp | 16 ++++++++-------- src/ui/dialog/spellcheck.cpp | 2 +- src/ui/dialog/svg-fonts-dialog.cpp | 22 +++++++++++----------- src/ui/dialog/symbols.cpp | 4 ++-- src/ui/dialog/tags.cpp | 8 ++++---- src/ui/tools/box3d-tool.cpp | 2 +- src/ui/tools/connector-tool.cpp | 2 +- src/ui/tools/node-tool.cpp | 2 +- src/ui/tools/tweak-tool.cpp | 8 ++++---- src/ui/widget/layer-selector.cpp | 2 +- 16 files changed, 50 insertions(+), 50 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 48d53857b..b25a70b15 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -839,7 +839,7 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) SPObject *mask = item->mask_ref->getObject(); _copyNode(mask->getRepr(), _doc, _defs); // recurse into the mask for its gradients etc. - for(auto& o: mask->_children) { + for(auto& o: mask->children) { SPItem *childItem = dynamic_cast(&o); if (childItem) { _copyUsedDefs(childItem); @@ -857,7 +857,7 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) } // recurse - for(auto& o: item->_children) { + for(auto& o: item->children) { SPItem *childItem = dynamic_cast(&o); if (childItem) { _copyUsedDefs(childItem); @@ -894,7 +894,7 @@ void ClipboardManagerImpl::_copyPattern(SPPattern *pattern) _copyNode(pattern->getRepr(), _doc, _defs); // items in the pattern may also use gradients and other patterns, so recurse - for (auto& child: pattern->_children) { + for (auto& child: pattern->children) { SPItem *childItem = dynamic_cast(&child); if (childItem) { _copyUsedDefs(childItem); diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index 11af02e3c..1e8ca4405 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -2042,7 +2042,7 @@ void CloneTiler::clonetiler_trace_hide_tiled_clones_recursively(SPObject *from) if (!trace_drawing) return; - for (auto& o: from->_children) { + for (auto& o: from->children) { SPItem *item = dynamic_cast(&o); if (item && clonetiler_is_a_clone_of(&o, NULL)) { item->invoke_hide(trace_visionkey); // FIXME: hide each tiled clone's original too! @@ -2123,7 +2123,7 @@ void CloneTiler::clonetiler_unclump(GtkWidget */*widget*/, void *) std::vector to_unclump; // not including the original - for (auto& child: parent->_children) { + for (auto& child: parent->children) { if (clonetiler_is_a_clone_of (&child, obj)) { to_unclump.push_back((SPItem*)&child); } @@ -2143,7 +2143,7 @@ guint CloneTiler::clonetiler_number_of_clones(SPObject *obj) guint n = 0; - for (auto& child: parent->_children) { + for (auto& child: parent->children) { if (clonetiler_is_a_clone_of (&child, obj)) { n ++; } @@ -2172,7 +2172,7 @@ void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool d // remove old tiling GSList *to_delete = NULL; - for (auto& child: parent->_children) { + for (auto& child: parent->children) { if (clonetiler_is_a_clone_of (&child, obj)) { to_delete = g_slist_prepend (to_delete, &child); } diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index df37eb005..6f5f14d80 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1315,7 +1315,7 @@ void DocumentProperties::changeEmbeddedScript(){ for (std::vector::const_iterator it = current.begin(); it != current.end(); ++it) { SPObject* obj = *it; if (id == obj->getId()){ - int count = (int) obj->_children.size(); + int count = (int) obj->children.size(); if (count>1) g_warning("TODO: Found a script element with multiple (%d) child nodes! We must implement support for that!", count); @@ -1359,7 +1359,7 @@ void DocumentProperties::editEmbeddedScript(){ //XML Tree being used directly here while it shouldn't be. Inkscape::XML::Node *repr = obj->getRepr(); if (repr){ - auto tmp = obj->_children | boost::adaptors::transformed([](SPObject& o) { return &o; }); + auto tmp = obj->children | boost::adaptors::transformed([](SPObject& o) { return &o; }); std::vector vec(tmp.begin(), tmp.end()); for (auto &child: vec) { child->deleteObject(); diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 1be5d540a..3e3ede019 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -103,7 +103,7 @@ static int input_count(const SPFilterPrimitive* prim) return 2; else if(SP_IS_FEMERGE(prim)) { // Return the number of feMergeNode connections plus an extra - return (int) (prim->_children.size() + 1); + return (int) (prim->children.size() + 1); } else return 1; @@ -1060,7 +1060,7 @@ public: { SPFeFuncNode* funcNode = NULL; bool found = false; - for(auto& node: ct->_children) { + for(auto& node: ct->children) { funcNode = SP_FEFUNCNODE(&node); if( funcNode->channel == _channel ) { found = true; @@ -1868,7 +1868,7 @@ void FilterEffectsDialog::PrimitiveList::update() bool active_found = false; _dialog._primitive_box->set_sensitive(true); _dialog.update_filter_general_settings_view(); - for(auto& prim_obj: f->_children) { + for(auto& prim_obj: f->children) { SPFilterPrimitive *prim = SP_FILTER_PRIMITIVE(&prim_obj); if(!prim) { break; @@ -2339,7 +2339,7 @@ const Gtk::TreeIter FilterEffectsDialog::PrimitiveList::find_result(const Gtk::T if(SP_IS_FEMERGE(prim)) { int c = 0; bool found = false; - for (auto& o: prim->_children) { + for (auto& o: prim->children) { if(c == attr && SP_IS_FEMERGENODE(&o)) { image = SP_FEMERGENODE(&o)->input; found = true; @@ -2531,7 +2531,7 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton* if(SP_IS_FEMERGE(prim)) { int c = 1; bool handled = false; - for (auto& o: prim->_children) { + for (auto& o: prim->children) { if(c == _in_drag && SP_IS_FEMERGENODE(&o)) { // If input is null, delete it if(!in_val) { diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index e156dfa13..b09ce6078 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -747,7 +747,7 @@ std::vector &Find::all_items (SPObject *r, std::vector &l, boo return l; // we're not interested in metadata } - for (auto& child: r->_children) { + for (auto& child: r->children) { SPItem *item = dynamic_cast(&child); if (item && !child.cloned && !desktop->isLayer(item)) { if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) { diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index eafe5566a..b927096ab 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -182,7 +182,7 @@ std::vector FontSubstitution::getFontReplacedItems(SPDocument* doc, Gli family = SP_TEXT(parent_text)->layout.getFontFamily(0); // Add all the spans fonts to the set gint ii = 0; - for (auto& child: parent_text->_children) { + for (auto& child: parent_text->children) { family = SP_TEXT(parent_text)->layout.getFontFamily(ii); setFontSpans.insert(family); ii++; diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index e4639745f..f4d3a3f70 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -340,7 +340,7 @@ void ObjectsPanel::_objectsChanged(SPObject */*obj*/) void ObjectsPanel::_addObject(SPObject* obj, Gtk::TreeModel::Row* parentRow) { if ( _desktop && obj ) { - for(auto& child: obj->_children) { + for(auto& child: obj->children) { if (SP_IS_ITEM(&child)) { SPItem * item = SP_ITEM(&child); @@ -398,7 +398,7 @@ void ObjectsPanel::_updateObject( SPObject *obj, bool recurse ) { //end mark if (recurse) { - for (auto& iter: obj->_children) { + for (auto& iter: obj->children) { _updateObject(&iter, recurse); } } @@ -518,7 +518,7 @@ void ObjectsPanel::_setCompositingValues(SPItem *item) SPGaussianBlur *spblur = NULL; if (item->style->getFilter()) { - for (auto& primitive_obj: item->style->getFilter()->_children) { + for (auto& primitive_obj: item->style->getFilter()->children) { if (!SP_IS_FILTER_PRIMITIVE(&primitive_obj)) { break; } @@ -1293,7 +1293,7 @@ bool ObjectsPanel::_executeAction() break; case BUTTON_COLLAPSE_ALL: { - for (auto& obj: _document->getRoot()->_children) { + for (auto& obj: _document->getRoot()->children) { if (SP_IS_GROUP(&obj)) { _setCollapsed(SP_GROUP(&obj)); } @@ -1405,7 +1405,7 @@ void ObjectsPanel::_setCollapsed(SPGroup * group) { group->setExpanded(false); group->updateRepr(SP_OBJECT_WRITE_NO_CHILDREN | SP_OBJECT_WRITE_EXT); - for (auto& iter: group->_children) { + for (auto& iter: group->children) { if (SP_IS_GROUP(&iter)) { _setCollapsed(SP_GROUP(&iter)); } @@ -1523,7 +1523,7 @@ void ObjectsPanel::_blendChangedIter(const Gtk::TreeIter& iter, Glib::ustring bl if (blendmode != "normal") { gdouble radius = 0; if (item->style->getFilter()) { - for (auto& primitive: item->style->getFilter()->_children) { + for (auto& primitive: item->style->getFilter()->children) { if (!SP_IS_FILTER_PRIMITIVE(&primitive)) { break; } @@ -1538,7 +1538,7 @@ void ObjectsPanel::_blendChangedIter(const Gtk::TreeIter& iter, Glib::ustring bl SPFilter *filter = new_filter_simple_from_item(_document, item, blendmode.c_str(), radius); sp_style_set_property_url(item, "filter", filter, false); } else { - for (auto& primitive: item->style->getFilter()->_children) { + for (auto& primitive: item->style->getFilter()->children) { if (!SP_IS_FILTER_PRIMITIVE(&primitive)) { break; } @@ -1598,7 +1598,7 @@ void ObjectsPanel::_blurChangedIter(const Gtk::TreeIter& iter, double blur) SPFilter *filter = modify_filter_gaussian_blur_from_item(_document, item, radius); sp_style_set_property_url(item, "filter", filter, false); } else if (item->style->filter.set && item->style->getFilter()) { - for (auto& primitive: item->style->getFilter()->_children) { + for (auto& primitive: item->style->getFilter()->children) { if (!SP_IS_FILTER_PRIMITIVE(&primitive)) { break; } diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp index 9338a4e8c..ac8ef5c15 100644 --- a/src/ui/dialog/spellcheck.cpp +++ b/src/ui/dialog/spellcheck.cpp @@ -234,7 +234,7 @@ GSList *SpellCheck::allTextItems (SPObject *r, GSList *l, bool hidden, bool lock return l; // we're not interested in metadata } - for (auto& child: r->_children) { + for (auto& child: r->children) { if (SP_IS_ITEM (&child) && !child.cloned && !desktop->isLayer(SP_ITEM(&child))) { if ((hidden || !desktop->itemIsHidden(SP_ITEM(&child))) && (locked || !SP_ITEM(&child)->isLocked())) { if (SP_IS_TEXT(&child) || SP_IS_FLOWTEXT(&child)) diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 93bd67a3d..a723c86d8 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -115,7 +115,7 @@ void SvgFontsDialog::AttrEntry::set_text(char* t){ void SvgFontsDialog::AttrEntry::on_attr_changed(){ SPObject* o = NULL; - for (auto& node: dialog->get_selected_spfont()->_children) { + for (auto& node: dialog->get_selected_spfont()->children) { switch(this->attr){ case SP_PROP_FONT_FAMILY: if (SP_IS_FONTFACE(&node)){ @@ -170,7 +170,7 @@ void GlyphComboBox::update(SPFont* spfont){ this->append(""); //Gtk is refusing to clear the combobox when I comment out this line this->remove_all(); - for (auto& node: spfont->_children) { + for (auto& node: spfont->children) { if (SP_IS_GLYPH(&node)){ this->append((static_cast(&node))->unicode); } @@ -308,7 +308,7 @@ void SvgFontsDialog::update_global_settings_tab(){ SPFont* font = get_selected_spfont(); if (!font) return; - for (auto& obj: font->_children) { + for (auto& obj: font->children) { if (SP_IS_FONTFACE(&obj)){ _familyname_entry->set_text((SP_FONTFACE(&obj))->font_family); } @@ -413,7 +413,7 @@ SvgFontsDialog::populate_glyphs_box() SPFont* spfont = this->get_selected_spfont(); _glyphs_observer.set(spfont); - for (auto& node: spfont->_children) { + for (auto& node: spfont->children) { if (SP_IS_GLYPH(&node)){ Gtk::TreeModel::Row row = *(_GlyphsListStore->append()); row[_GlyphsListColumns.glyph_node] = static_cast(&node); @@ -431,7 +431,7 @@ SvgFontsDialog::populate_kerning_pairs_box() SPFont* spfont = this->get_selected_spfont(); - for (auto& node: spfont->_children) { + for (auto& node: spfont->children) { if (SP_IS_HKERN(&node)){ Gtk::TreeModel::Row row = *(_KerningPairsListStore->append()); row[_KerningPairsListColumns.first_glyph] = (static_cast(&node))->u1->attribute_string().c_str(); @@ -492,7 +492,7 @@ void SvgFontsDialog::add_glyph(){ Geom::PathVector SvgFontsDialog::flip_coordinate_system(Geom::PathVector pathv){ double units_per_em = 1000; - for (auto& obj: get_selected_spfont()->_children) { + for (auto& obj: get_selected_spfont()->children) { if (SP_IS_FONTFACE(&obj)){ //XML Tree being directly used here while it shouldn't be. sp_repr_get_double(obj.getRepr(), "units-per-em", &units_per_em); @@ -574,7 +574,7 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ Geom::PathVector pathv = sp_svg_read_pathv(node->attribute("d")); - for (auto& obj: get_selected_spfont()->_children) { + for (auto& obj: get_selected_spfont()->children) { if (SP_IS_MISSING_GLYPH(&obj)){ //XML Tree being directly used here while it shouldn't be. @@ -596,7 +596,7 @@ void SvgFontsDialog::reset_missing_glyph_description(){ } SPDocument* doc = desktop->getDocument(); - for (auto& obj: get_selected_spfont()->_children) { + for (auto& obj: get_selected_spfont()->children) { if (SP_IS_MISSING_GLYPH(&obj)){ //XML Tree being directly used here while it shouldn't be. obj.getRepr()->setAttribute("d", (char*) "M0,0h1000v1024h-1000z"); @@ -734,7 +734,7 @@ void SvgFontsDialog::add_kerning_pair(){ //look for this kerning pair on the currently selected font this->kerning_pair = NULL; - for (auto& node: get_selected_spfont()->_children) { + for (auto& node: get_selected_spfont()->children) { //TODO: It is not really correct to get only the first byte of each string. //TODO: We should also support vertical kerning if (SP_IS_HKERN(&node) && (static_cast(&node))->u1->contains((gchar) first_glyph.get_active_text().c_str()[0]) @@ -848,7 +848,7 @@ SPFont *new_font(SPDocument *document) void set_font_family(SPFont* font, char* str){ if (!font) return; - for (auto& obj: font->_children) { + for (auto& obj: font->children) { if (SP_IS_FONTFACE(&obj)){ //XML Tree being directly used here while it shouldn't be. obj.getRepr()->setAttribute("font-family", str); @@ -868,7 +868,7 @@ void SvgFontsDialog::add_font(){ font->setLabel(os.str().c_str()); os2 << "SVGFont " << count; - for (auto& obj: font->_children) { + for (auto& obj: font->children) { if (SP_IS_FONTFACE(&obj)){ //XML Tree being directly used here while it shouldn't be. obj.getRepr()->setAttribute("font-family", os2.str().c_str()); diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 1fdce34a5..84088052e 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -658,7 +658,7 @@ GSList* SymbolsDialog::symbols_in_doc_recursive (SPObject *r, GSList *l) l = g_slist_prepend (l, r); } - for (auto& child: r->_children) { + for (auto& child: r->children) { l = symbols_in_doc_recursive( &child, l ); } @@ -680,7 +680,7 @@ GSList* SymbolsDialog::use_in_doc_recursive (SPObject *r, GSList *l) l = g_slist_prepend (l, r); } - for (auto& child: r->_children) { + for (auto& child: r->children) { l = use_in_doc_recursive( &child, l ); } diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index 61c8b5d37..fcc9b804c 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -399,7 +399,7 @@ void TagsPanel::_objectsChanged(SPObject* root) void TagsPanel::_addObject( SPDocument* doc, SPObject* obj, Gtk::TreeModel::Row* parentRow ) { if ( _desktop && obj ) { - for (auto& child: obj->_children) { + for (auto& child: obj->children) { if (SP_IS_TAG(&child)) { Gtk::TreeModel::iterator iter = parentRow ? _store->prepend(parentRow->children()) : _store->prepend(); @@ -430,7 +430,7 @@ void TagsPanel::_addObject( SPDocument* doc, SPObject* obj, Gtk::TreeModel::Row* _tree.expand_to_path( _store->get_path(iteritems) ); - for (auto& child: obj->_children) { + for (auto& child: obj->children) { if (SP_IS_TAG_USE(&child)) { SPItem *item = SP_TAG_USE(&child)->ref->getObject(); @@ -459,7 +459,7 @@ void TagsPanel::_addObject( SPDocument* doc, SPObject* obj, Gtk::TreeModel::Row* void TagsPanel::_select_tag( SPTag * tag ) { - for (auto& child: tag->_children) { + for (auto& child: tag->children) { if (SP_IS_TAG(&child)) { _select_tag(SP_TAG(&child)); } else if (SP_IS_TAG_USE(&child)) { @@ -649,7 +649,7 @@ bool TagsPanel::_handleButtonEvent(GdkEventButton* event) for(auto i=items.begin();i!=items.end();++i){ SPObject *newobj = *i; bool addchild = true; - for (auto& child: obj->_children) { + for (auto& child: obj->children) { if (SP_IS_TAG_USE(&child) && SP_TAG_USE(&child)->ref->getObject() == newobj) { addchild = false; } diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp index 2adba38c5..9a0b37913 100644 --- a/src/ui/tools/box3d-tool.cpp +++ b/src/ui/tools/box3d-tool.cpp @@ -118,7 +118,7 @@ static void sp_box3d_context_ensure_persp_in_defs(SPDocument *document) { SPDefs *defs = document->getDefs(); bool has_persp = false; - for (auto& child: defs->_children) { + for (auto& child: defs->children) { if (SP_IS_PERSP3D(&child)) { has_persp = true; break; diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp index be8ce6d0c..11752726b 100644 --- a/src/ui/tools/connector-tool.cpp +++ b/src/ui/tools/connector-tool.cpp @@ -1114,7 +1114,7 @@ void ConnectorTool::_setActiveShape(SPItem *item) { // The idea here is to try and add a group's children to solidify // connection handling. We react to path objects with only one node. - for (auto& child: item->_children) { + for (auto& child: item->children) { if (SP_IS_PATH(&child) && SP_PATH(&child)->nodesInPath() == 1) { this->_activeShapeAddKnot((SPItem *) &child); } diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 3dfac5e3d..87b7bf7e3 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -378,7 +378,7 @@ void gather_items(NodeTool *nt, SPItem *base, SPObject *obj, Inkscape::UI::Shape r.role = role; s.insert(r); } else if (role != SHAPE_ROLE_NORMAL && (SP_IS_GROUP(obj) || SP_IS_OBJECTGROUP(obj))) { - for (auto& c: obj->_children) { + for (auto& c: obj->children) { gather_items(nt, base, &c, role, s); } } else if (SP_IS_ITEM(obj)) { diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index 7da0973d5..361986d0c 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -385,7 +385,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P if (dynamic_cast(item) && !dynamic_cast(item)) { GSList *children = NULL; - for (auto& child: item->_children) { + for (auto& child: item->children) { if (dynamic_cast(static_cast(&child))) { children = g_slist_prepend(children, &child); } @@ -832,7 +832,7 @@ static void tweak_colors_in_gradient(SPItem *item, Inkscape::PaintTarget fill_or double offset_l = 0; double offset_h = 0; SPObject *child_prev = NULL; - for (auto& child: vector->_children) { + for (auto& child: vector->children) { SPStop *stop = dynamic_cast(&child); if (!stop) { continue; @@ -894,7 +894,7 @@ sp_tweak_color_recursive (guint mode, SPItem *item, SPItem *item_at_point, bool did = false; if (dynamic_cast(item)) { - for (auto& child: item->_children) { + for (auto& child: item->children) { SPItem *childItem = dynamic_cast(&child); if (childItem) { if (sp_tweak_color_recursive (mode, childItem, item_at_point, @@ -951,7 +951,7 @@ sp_tweak_color_recursive (guint mode, SPItem *item, SPItem *item_at_point, Geom::Affine i2dt = item->i2dt_affine (); if (style->filter.set && style->getFilter()) { //cycle through filter primitives - for (auto& primitive_obj: style->getFilter()->_children) { + for (auto& primitive_obj: style->getFilter()->children) { SPFilterPrimitive *primitive = dynamic_cast(&primitive_obj); if (primitive) { //if primitive is gaussianblur diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index 46a0b3547..c080579f1 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -352,7 +352,7 @@ void LayerSelector::_buildSiblingEntries( ) { using Inkscape::Util::rest; - auto siblings = parent._children | boost::adaptors::filtered(is_layer(_desktop)) | boost::adaptors::reversed; + auto siblings = parent.children | boost::adaptors::filtered(is_layer(_desktop)) | boost::adaptors::reversed; SPObject *layer( hierarchy ? &*hierarchy : NULL ); -- cgit v1.2.3 From e0396836d3738f9b6d2182f310795fc6fe9d8857 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Mon, 18 Jul 2016 00:14:29 +0530 Subject: Add CSS panel with editing support (no changes reflected yet) (bzr r14949.1.52) --- src/ui/CMakeLists.txt | 2 + src/ui/dialog/Makefile_insert | 2 + src/ui/dialog/cssdialog.cpp | 83 ++++++++++++++++++++++++++++++++++++++++ src/ui/dialog/cssdialog.h | 66 ++++++++++++++++++++++++++++++++ src/ui/dialog/dialog-manager.cpp | 3 ++ src/ui/dialog/styledialog.cpp | 55 ++++++++++++++++++++++++++ src/ui/dialog/styledialog.h | 2 + 7 files changed, 213 insertions(+) create mode 100644 src/ui/dialog/cssdialog.cpp create mode 100644 src/ui/dialog/cssdialog.h (limited to 'src/ui') diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 4be3fa3d2..4d838eb7f 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -57,6 +57,7 @@ set(ui_SRC dialog/calligraphic-profile-rename.cpp dialog/clonetiler.cpp dialog/color-item.cpp + dialog/cssdialog.cpp dialog/debug.cpp dialog/desktop-tracker.cpp dialog/dialog-manager.cpp @@ -197,6 +198,7 @@ set(ui_SRC dialog/calligraphic-profile-rename.h dialog/clonetiler.h dialog/color-item.h + dialog/cssdialog.h dialog/debug.h dialog/desktop-tracker.h dialog/dialog-manager.h diff --git a/src/ui/dialog/Makefile_insert b/src/ui/dialog/Makefile_insert index 982908731..3add3f214 100644 --- a/src/ui/dialog/Makefile_insert +++ b/src/ui/dialog/Makefile_insert @@ -13,6 +13,8 @@ ink_common_sources += \ ui/dialog/clonetiler.h \ ui/dialog/color-item.cpp \ ui/dialog/color-item.h \ + ui/dialog/cssdialog.cpp \ + ui/dialog/cssdialog.h \ ui/dialog/debug.cpp \ ui/dialog/debug.h \ ui/dialog/desktop-tracker.cpp \ diff --git a/src/ui/dialog/cssdialog.cpp b/src/ui/dialog/cssdialog.cpp new file mode 100644 index 000000000..b0123482b --- /dev/null +++ b/src/ui/dialog/cssdialog.cpp @@ -0,0 +1,83 @@ +/** @file + * @brief A dialog for CSS selectors + */ +/* Authors: + * Kamalpreet Kaur Grewal + * + * Copyright (C) Kamalpreet Kaur Grewal 2016 + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "cssdialog.h" +#include "ui/widget/addtoicon.h" +#include "widgets/icon.h" +#include "verbs.h" +#include "sp-object.h" +#include "selection.h" +#include "xml/attribute-record.h" + +namespace Inkscape { +namespace UI { +namespace Dialog { + +CssDialog::CssDialog(): + UI::Widget::Panel("", "/dialogs/css", SP_VERB_DIALOG_CSS), + _desktop(0) +{ + set_size_request(50, 50); + _mainBox.pack_start(_scrolledWindow, Gtk::PACK_EXPAND_WIDGET); + _treeView.set_headers_visible(false); + _scrolledWindow.add(_treeView); + _scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + _store = Gtk::ListStore::create(_cssColumns); + _treeView.set_model(_store); + + Inkscape::UI::Widget::AddToIcon * addRenderer = manage( + new Inkscape::UI::Widget::AddToIcon() ); + addRenderer->property_active() = false; + + int addCol = _treeView.append_column("Unset Property", *addRenderer) - 1; + Gtk::TreeViewColumn *col = _treeView.get_column(addCol); + if ( col ) { + col->add_attribute( addRenderer->property_active(), _cssColumns._colUnsetProp); + } + _textRenderer = Gtk::manage(new Gtk::CellRendererText()); + _textRenderer->property_editable() = true; + + int nameColNum = _treeView.append_column("Property", *_textRenderer) - 1; + _propCol = _treeView.get_column(nameColNum); + + _getContents()->pack_start(_mainBox, Gtk::PACK_EXPAND_WIDGET); + + _targetDesktop = getDesktop(); + setDesktop(_targetDesktop); + + _textRenderer->signal_edited().connect(sigc::mem_fun(*this, &CssDialog:: + _handleEdited)); +} + +CssDialog::~CssDialog() +{ + setDesktop(NULL); +} + +void CssDialog::setDesktop( SPDesktop* desktop ) +{ + _desktop = desktop; +} + +void CssDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& new_text) +{ + Gtk::TreeModel::iterator iter = _treeView.get_model()->get_iter(path); + if (iter) { + Gtk::TreeModel::Row row = *iter; + row[_cssColumns._propertyLabel] = new_text; + editedProp = new_text; + } +} + +} // namespace Dialog +} // namespace UI +} // namespace Inkscape diff --git a/src/ui/dialog/cssdialog.h b/src/ui/dialog/cssdialog.h new file mode 100644 index 000000000..03ffdf972 --- /dev/null +++ b/src/ui/dialog/cssdialog.h @@ -0,0 +1,66 @@ +/** @file + * @brief A dialog for CSS selectors + */ +/* Authors: + * Kamalpreet Kaur Grewal + * + * Copyright (C) Kamalpreet Kaur Grewal 2016 + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef CSSDIALOG_H +#define CSSDIALOG_H + +#include +#include +#include +#include +#include + +#include "desktop.h" + +namespace Inkscape { +namespace UI { +namespace Dialog { + +class CssDialog : public UI::Widget::Panel +{ +public: + CssDialog(); + ~CssDialog(); + + static CssDialog &getInstance() { return *new CssDialog(); } + void setDesktop( SPDesktop* desktop); + + class CssColumns : public Gtk::TreeModel::ColumnRecord + { + public: + CssColumns() + { add(_colUnsetProp); add(_propertyLabel); } + Gtk::TreeModelColumn _colUnsetProp; + Gtk::TreeModelColumn _propertyLabel; + }; + + SPDesktop* _desktop; + SPDesktop* _targetDesktop; + CssColumns _cssColumns; + Gtk::VBox _mainBox; + Gtk::TreeView _treeView; + Glib::RefPtr _store; + Gtk::ScrolledWindow _scrolledWindow; + Gtk::TreeModel::Row propRow; + Gtk::CellRendererText *_textRenderer; + Gtk::TreeViewColumn *_propCol; + Glib::ustring editedProp; + + void _handleButtonEvent(const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn*col); + void _handleEdited(const Glib::ustring& path, const Glib::ustring& new_text); +}; + + +} // namespace Dialog +} // namespace UI +} // namespace Inkscape + +#endif // CSSDIALOG_H diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 4bb5215fd..a225d193c 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -61,6 +61,7 @@ #include "ui/dialog/objects.h" #include "ui/dialog/tags.h" #include "ui/dialog/styledialog.h" +#include "ui/dialog/cssdialog.h" namespace Inkscape { namespace UI { @@ -130,6 +131,7 @@ DialogManager::DialogManager() { registerFactory("TileDialog", &create); registerFactory("Symbols", &create); registerFactory("StyleDialog", &create); + registerFactory("CssDialog", &create); #if HAVE_POTRACE registerFactory("Trace", &create); @@ -170,6 +172,7 @@ DialogManager::DialogManager() { registerFactory("TileDialog", &create); registerFactory("Symbols", &create); registerFactory("StyleDialog", &create); + registerFactory("CssDialog", &create); #if HAVE_POTRACE registerFactory("Trace", &create); diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 174dd5ece..8eeeda3e6 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -119,6 +119,8 @@ StyleDialog::StyleDialog() : (*this, &StyleDialog:: _buttonEventsSelectObjs), false); + + _cssPane = new CssDialog; } StyleDialog::~StyleDialog() @@ -695,7 +697,60 @@ void StyleDialog::_buttonEventsSelectObjs(GdkEventButton* event ) int x = static_cast(event->x); int y = static_cast(event->y); _selectObjects(x, y); + //Open CSS dialog here. + if (!_cssPane->get_visible()) { + _mainBox.pack_end(*_cssPane, Gtk::PACK_SHRINK); + _cssPane->show_all(); + } + Glib::RefPtr refTreeSelection = _treeView.get_selection(); + Gtk::TreeModel::iterator iter = refTreeSelection->get_selected(); + if (iter) { + Gtk::TreeModel::Row row = *iter; + std::string sel, key, value; + std::vector<_selectorVecType>::iterator it; + for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it) { + sel = (*it).second; + REMOVE_SPACES(sel); + if (!sel.empty()) { + key = strtok(strdup(sel.c_str()), "{"); + REMOVE_SPACES(key); + char *temp = strtok(NULL, "}"); + if (strtok(temp, "}") != NULL) { + value = strtok(temp, "}"); + } + } + + Glib::ustring selectedRowLabel = row[_mColumns._selectorLabel]; + std::string matchSelector = selectedRowLabel; + REMOVE_SPACES(matchSelector); + + if (key == matchSelector) { + _cssPane->_store->clear(); + std::stringstream ss(value); + std::string token; + std::size_t found = value.find(";"); + if (found!=std::string::npos) { + while(std::getline(ss, token, ';')) { + REMOVE_SPACES(token); + if (!token.empty()) { + _cssPane->propRow = *(_cssPane->_store->append()); + _cssPane->propRow[_cssPane->_cssColumns._colUnsetProp] = false; + _cssPane->propRow[_cssPane->_cssColumns._propertyLabel] = token; + _cssPane->_propCol->add_attribute(_cssPane->_textRenderer + ->property_text(), + _cssPane->_cssColumns + ._propertyLabel); + } + } + } + } + } + } + else { + _cssPane->_store->clear(); + _cssPane->hide(); + } } } diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 08061d923..4f5f212b2 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -21,6 +21,7 @@ #include "desktop.h" #include "document.h" +#include "ui/dialog/cssdialog.h" namespace Inkscape { namespace UI { @@ -85,6 +86,7 @@ private: std::string _selectorValue; Gtk::TreeModel::Row _row; bool _newDrawing; + CssDialog *_cssPane; // Signal handlers void _addSelector(); -- cgit v1.2.3 From a42c66cd5a915c7ddba323af7ec714d629e6059b Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Mon, 18 Jul 2016 11:19:25 -0600 Subject: [Bug #1524838] Disambiguate sigc::ptr_fun to fix C++14 compilation. (bzr r15016.1.1) --- src/ui/dialog/knot-properties.cpp | 2 +- src/ui/dialog/layer-properties.cpp | 2 +- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 2 +- src/ui/dialog/lpe-powerstroke-properties.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/knot-properties.cpp b/src/ui/dialog/knot-properties.cpp index 9c23c33e1..a91a09a4f 100644 --- a/src/ui/dialog/knot-properties.cpp +++ b/src/ui/dialog/knot-properties.cpp @@ -145,7 +145,7 @@ KnotPropertiesDialog::_close() destroy_(); Glib::signal_idle().connect( sigc::bind_return( - sigc::bind(sigc::ptr_fun(&::operator delete), this), + sigc::bind(sigc::ptr_fun(&::operator delete), this), false ) ); diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index 1b8fbb3f7..5d550ed48 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -146,7 +146,7 @@ LayerPropertiesDialog::_close() destroy_(); Glib::signal_idle().connect( sigc::bind_return( - sigc::bind(sigc::ptr_fun(&::operator delete), this), + sigc::bind(sigc::ptr_fun(&::operator delete), this), false ) ); diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 5ccee103c..b0cc91868 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -177,7 +177,7 @@ void FilletChamferPropertiesDialog::_close() destroy_(); Glib::signal_idle().connect( sigc::bind_return( - sigc::bind(sigc::ptr_fun(&::operator delete), this), + sigc::bind(sigc::ptr_fun(&::operator delete), this), false ) ); diff --git a/src/ui/dialog/lpe-powerstroke-properties.cpp b/src/ui/dialog/lpe-powerstroke-properties.cpp index cfc972547..a6dcce907 100644 --- a/src/ui/dialog/lpe-powerstroke-properties.cpp +++ b/src/ui/dialog/lpe-powerstroke-properties.cpp @@ -146,7 +146,7 @@ PowerstrokePropertiesDialog::_close() destroy_(); Glib::signal_idle().connect( sigc::bind_return( - sigc::bind(sigc::ptr_fun(&::operator delete), this), + sigc::bind(sigc::ptr_fun(&::operator delete), this), false ) ); -- cgit v1.2.3 From 96b7038386f56aa59a9d0935989469105234d2fe Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Tue, 19 Jul 2016 14:39:24 +0530 Subject: Update XML & hence drawing when properties are edited in CSS panel (bzr r14949.1.54) --- src/ui/dialog/cssdialog.cpp | 18 +++------- src/ui/dialog/cssdialog.h | 11 ++++--- src/ui/dialog/styledialog.cpp | 77 ++++++++++++++++++++++++++++++++++++++++--- src/ui/dialog/styledialog.h | 3 ++ 4 files changed, 88 insertions(+), 21 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/cssdialog.cpp b/src/ui/dialog/cssdialog.cpp index b0123482b..e12716d6e 100644 --- a/src/ui/dialog/cssdialog.cpp +++ b/src/ui/dialog/cssdialog.cpp @@ -21,6 +21,11 @@ namespace Inkscape { namespace UI { namespace Dialog { +/** + * Constructor + * A treeview whose each row corresponds to a CSS property of selector selected. + * TODO: Further, buttons to add and delete properties will be added. + */ CssDialog::CssDialog(): UI::Widget::Panel("", "/dialogs/css", SP_VERB_DIALOG_CSS), _desktop(0) @@ -53,9 +58,6 @@ CssDialog::CssDialog(): _targetDesktop = getDesktop(); setDesktop(_targetDesktop); - - _textRenderer->signal_edited().connect(sigc::mem_fun(*this, &CssDialog:: - _handleEdited)); } CssDialog::~CssDialog() @@ -68,16 +70,6 @@ void CssDialog::setDesktop( SPDesktop* desktop ) _desktop = desktop; } -void CssDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& new_text) -{ - Gtk::TreeModel::iterator iter = _treeView.get_model()->get_iter(path); - if (iter) { - Gtk::TreeModel::Row row = *iter; - row[_cssColumns._propertyLabel] = new_text; - editedProp = new_text; - } -} - } // namespace Dialog } // namespace UI } // namespace Inkscape diff --git a/src/ui/dialog/cssdialog.h b/src/ui/dialog/cssdialog.h index 03ffdf972..4ff79c219 100644 --- a/src/ui/dialog/cssdialog.h +++ b/src/ui/dialog/cssdialog.h @@ -24,6 +24,10 @@ namespace Inkscape { namespace UI { namespace Dialog { +/** + * @brief The CssDialog class + * A list of CSS properties will show up in this dialog. + */ class CssDialog : public UI::Widget::Panel { public: @@ -49,13 +53,12 @@ public: Gtk::TreeView _treeView; Glib::RefPtr _store; Gtk::ScrolledWindow _scrolledWindow; - Gtk::TreeModel::Row propRow; + Gtk::TreeModel::Row _propRow; Gtk::CellRendererText *_textRenderer; Gtk::TreeViewColumn *_propCol; - Glib::ustring editedProp; + Glib::ustring _editedProp; - void _handleButtonEvent(const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn*col); - void _handleEdited(const Glib::ustring& path, const Glib::ustring& new_text); + void _handleButtonEvent(const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *col); }; diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 8eeeda3e6..efbde1767 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -684,7 +684,6 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) * click on a selector selects the matching objects. A double click on any * selector selects the matching objects as well as will open CSS dialog. It * calls _selectObjects to add objects to selection. - * TODO: Open CSS dialog on double click. */ void StyleDialog::_buttonEventsSelectObjs(GdkEventButton* event ) { @@ -703,6 +702,7 @@ void StyleDialog::_buttonEventsSelectObjs(GdkEventButton* event ) _mainBox.pack_end(*_cssPane, Gtk::PACK_SHRINK); _cssPane->show_all(); } + Glib::RefPtr refTreeSelection = _treeView.get_selection(); Gtk::TreeModel::iterator iter = refTreeSelection->get_selected(); if (iter) { @@ -734,9 +734,9 @@ void StyleDialog::_buttonEventsSelectObjs(GdkEventButton* event ) while(std::getline(ss, token, ';')) { REMOVE_SPACES(token); if (!token.empty()) { - _cssPane->propRow = *(_cssPane->_store->append()); - _cssPane->propRow[_cssPane->_cssColumns._colUnsetProp] = false; - _cssPane->propRow[_cssPane->_cssColumns._propertyLabel] = token; + _cssPane->_propRow = *(_cssPane->_store->append()); + _cssPane->_propRow[_cssPane->_cssColumns._colUnsetProp] = false; + _cssPane->_propRow[_cssPane->_cssColumns._propertyLabel] = token; _cssPane->_propCol->add_attribute(_cssPane->_textRenderer ->property_text(), _cssPane->_cssColumns @@ -746,6 +746,9 @@ void StyleDialog::_buttonEventsSelectObjs(GdkEventButton* event ) } } } + _cssPane->_textRenderer->signal_edited().connect(sigc::mem_fun(*this, + &StyleDialog:: + _handleEdited)); } else { _cssPane->_store->clear(); @@ -754,6 +757,72 @@ void StyleDialog::_buttonEventsSelectObjs(GdkEventButton* event ) } } +/** + * @brief StyleDialog::_handleEdited + * @param path + * @param new_text + * This function edits CSS properties of the selector chosen. new_text is used + * to update the property in XML repr. The value from selected selector is + * obtained and modified as per value of new_text. Later _updateStyleContent() is + * called to update XML repr and hence changes are reflected in the drawing too. + */ +void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& new_text) +{ + Gtk::TreeModel::iterator iterCss = _cssPane->_treeView.get_model()->get_iter(path); + if (iterCss) { + Gtk::TreeModel::Row row = *iterCss; + row[_cssPane->_cssColumns._propertyLabel] = new_text; + _cssPane->_editedProp = new_text; + } + + Glib::RefPtr refTreeSelection = _treeView.get_selection(); + Gtk::TreeModel::iterator iter = refTreeSelection->get_selected(); + if (iter) { + Gtk::TreeModel::Row row = *iter; + std::string sel, key, value; + std::vector<_selectorVecType>::iterator it; + for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it) { + sel = (*it).second; + REMOVE_SPACES(sel); + if (!sel.empty()) { + key = strtok(strdup(sel.c_str()), "{"); + REMOVE_SPACES(key); + char *temp = strtok(NULL, "}"); + if (strtok(temp, "}") != NULL) { + value = strtok(temp, "}"); + } + } + + Glib::ustring selectedRowLabel = row[_mColumns._selectorLabel]; + std::string matchSelector = selectedRowLabel; + REMOVE_SPACES(matchSelector); + + if (key == matchSelector) { + std::stringstream ss(value); + std::string token; + std::size_t found = value.find(";"); + if (found!=std::string::npos) { + while(std::getline(ss, token, ';')) { + REMOVE_SPACES(token); + if (!token.empty()) { + if (token.substr(0, token.find(":")) == _cssPane + ->_editedProp.substr(0, _cssPane->_editedProp + .find(":"))) + { + token = _cssPane->_editedProp; + value.clear(); + value += token + ";"; + (*it).second = key + " { " + value + " }\n"; + _updateStyleContent(); + } + } + } + } + } + } + } +} + /** * @brief StyleDialog::_selectObjects * @param eventX diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 4f5f212b2..31a28dc1f 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -91,6 +91,9 @@ private: // Signal handlers void _addSelector(); void _delSelector(); + + // Signal handler for CssDialog + void _handleEdited(const Glib::ustring& path, const Glib::ustring& new_text); }; } // namespace Dialog -- cgit v1.2.3 From fe2e3fdfc7a546795e4a7221300aefd96d05f215 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Tue, 19 Jul 2016 16:57:19 +0530 Subject: Update XML correctly when editing properties (bzr r14949.1.55) --- src/ui/dialog/styledialog.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index efbde1767..99d5cd7e1 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -799,7 +799,7 @@ void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& if (key == matchSelector) { std::stringstream ss(value); - std::string token; + std::string token, editedToken; std::size_t found = value.find(";"); if (found!=std::string::npos) { while(std::getline(ss, token, ';')) { @@ -807,12 +807,11 @@ void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& if (!token.empty()) { if (token.substr(0, token.find(":")) == _cssPane ->_editedProp.substr(0, _cssPane->_editedProp - .find(":"))) - { - token = _cssPane->_editedProp; - value.clear(); - value += token + ";"; - (*it).second = key + " { " + value + " }\n"; + .find(":"))) { + editedToken = _cssPane->_editedProp; + size_t startPos = value.find(token); + value.replace(startPos, token.length(), editedToken); + (*it).second = key + "{" + value + "}\n"; _updateStyleContent(); } } -- cgit v1.2.3 From be3b537680814fd07a0a5776724028f09f78a023 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Wed, 20 Jul 2016 12:51:39 +0530 Subject: Separate CSS dialog from Style Dialog visually (bzr r14949.1.56) --- src/ui/dialog/cssdialog.cpp | 2 +- src/ui/dialog/styledialog.cpp | 6 +++--- src/ui/dialog/styledialog.h | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/cssdialog.cpp b/src/ui/dialog/cssdialog.cpp index e12716d6e..9007faafc 100644 --- a/src/ui/dialog/cssdialog.cpp +++ b/src/ui/dialog/cssdialog.cpp @@ -30,7 +30,7 @@ CssDialog::CssDialog(): UI::Widget::Panel("", "/dialogs/css", SP_VERB_DIALOG_CSS), _desktop(0) { - set_size_request(50, 50); + set_size_request(20, 15); _mainBox.pack_start(_scrolledWindow, Gtk::PACK_EXPAND_WIDGET); _treeView.set_headers_visible(false); _scrolledWindow.add(_treeView); diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 99d5cd7e1..f3e682062 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -55,6 +55,7 @@ StyleDialog::StyleDialog() : { set_size_request(200, 200); + _paned.pack1(_mainBox, Gtk::SHRINK); _mainBox.pack_start(_scrolledWindow, Gtk::PACK_EXPAND_WIDGET); _treeView.set_headers_visible(false); _scrolledWindow.add(_treeView); @@ -76,7 +77,6 @@ StyleDialog::StyleDialog() : _treeView.append_column("Selector Name", _mColumns._selectorLabel); _treeView.set_expander_column(*(_treeView.get_column(1))); - _treeView.set_level_indentation(-12); create = manage( new Gtk::Button() ); _styleButton(*create, "list-add", "Add a new CSS Selector"); @@ -94,7 +94,7 @@ StyleDialog::StyleDialog() : _buttonBox.pack_start(*create, Gtk::PACK_SHRINK); _buttonBox.pack_start(*del, Gtk::PACK_SHRINK); - _getContents()->pack_start(_mainBox, Gtk::PACK_EXPAND_WIDGET); + _getContents()->pack_start(_paned, Gtk::PACK_EXPAND_WIDGET); _targetDesktop = getDesktop(); setDesktop(_targetDesktop); @@ -699,7 +699,7 @@ void StyleDialog::_buttonEventsSelectObjs(GdkEventButton* event ) //Open CSS dialog here. if (!_cssPane->get_visible()) { - _mainBox.pack_end(*_cssPane, Gtk::PACK_SHRINK); + _paned.pack2(*_cssPane, Gtk::SHRINK); _cssPane->show_all(); } diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 31a28dc1f..b3a8580f1 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -18,6 +18,7 @@ #include #include #include +#include #include "desktop.h" #include "document.h" @@ -71,6 +72,7 @@ private: SPDesktop* _desktop; SPDesktop* _targetDesktop; ModelColumns _mColumns; + Gtk::VPaned _paned; Gtk::VBox _mainBox; Gtk::HBox _buttonBox; Gtk::TreeView _treeView; -- cgit v1.2.3 From 3c593bb8da3357514ff5b4f3154d08c4508ad47e Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 20 Jul 2016 11:01:17 +0200 Subject: Changed arguments and names of selection chemistry functions (bzr r14954.1.22) --- src/ui/interface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index bcf055654..d19526105 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -1916,7 +1916,7 @@ void ContextMenu::MakeGroupMenu(void) void ContextMenu::ActivateGroup(void) { - sp_selection_group(_desktop->selection, _desktop); + sp_selection_group_ui(_desktop->selection, _desktop); } void ContextMenu::ActivateUngroup(void) -- cgit v1.2.3 From a227e8d45e7eaa6bf25d8ab65fbd404bc4597306 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 20 Jul 2016 13:45:05 +0200 Subject: Changed signatures of boolean functions (bzr r14954.1.24) --- src/ui/tools/calligraphic-tool.cpp | 4 ++-- src/ui/tools/eraser-tool.cpp | 6 +++--- src/ui/tools/flood-tool.cpp | 2 +- src/ui/tools/spray-tool.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp index 28195eb75..12dcedd21 100644 --- a/src/ui/tools/calligraphic-tool.cpp +++ b/src/ui/tools/calligraphic-tool.cpp @@ -930,10 +930,10 @@ void CalligraphicTool::set_to_accumulated(bool unionize, bool subtract) { if (unionize) { desktop->getSelection()->add(this->repr); - sp_selected_path_union_skip_undo(desktop->getSelection(), desktop); + sp_selected_path_union_skip_undo(desktop->getSelection()); } else if (subtract) { desktop->getSelection()->add(this->repr); - sp_selected_path_diff_skip_undo(desktop->getSelection(), desktop); + sp_selected_path_diff_skip_undo(desktop->getSelection()); } else { if (this->keep_selected) { desktop->getSelection()->set(this->repr); diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 534123e90..8ed75fbdb 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -718,7 +718,7 @@ void EraserTool::set_to_accumulated() { Inkscape::GC::release(dup); // parent takes over selection->set(dup); if (!this->nowidth) { - sp_selected_path_union_skip_undo(selection, desktop); + sp_selected_path_union_skip_undo(selection); } selection->add(item); if(item->style->fill_rule.value == SP_WIND_RULE_EVENODD){ @@ -729,9 +729,9 @@ void EraserTool::set_to_accumulated() { css = 0; } if (this->nowidth) { - sp_selected_path_cut_skip_undo(selection, desktop); + sp_selected_path_cut_skip_undo(selection); } else { - sp_selected_path_diff_skip_undo(selection, desktop); + sp_selected_path_diff_skip_undo(selection); } workDone = true; // TODO set this only if something was cut. bool break_apart = prefs->getBool("/tools/eraser/break_apart", false); diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index 748c82717..b5a2fd871 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -456,7 +456,7 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto ngettext("Area filled, path with %d node created and unioned with selection.","Area filled, path with %d nodes created and unioned with selection.", SP_PATH(reprobj)->nodesInPath()), SP_PATH(reprobj)->nodesInPath() ); selection->add(reprobj); - sp_selected_path_union_skip_undo(desktop->getSelection(), desktop); + sp_selected_path_union_skip_undo(desktop->getSelection()); } else { desktop->messageStack()->flashF( Inkscape::WARNING_MESSAGE, ngettext("Area filled, path with %d node created.","Area filled, path with %d nodes created.", diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 5d804a9bd..a95e5aa96 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -1050,7 +1050,7 @@ static bool sp_spray_recursive(SPDesktop *desktop, if (unionResult) { // No need to add the very first item (initialized with NULL). selection->add(unionResult); } - sp_selected_path_union_skip_undo(selection, selection->desktop()); + sp_selected_path_union_skip_undo(selection); selection->add(parent_item); Inkscape::GC::release(copy); did = true; -- cgit v1.2.3 From d31923a399f3c7cde85aae8406191e37ad877eb7 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Fri, 22 Jul 2016 11:32:35 +0200 Subject: Improved spray tool, changed selection to object set (bzr r14954.1.25) --- src/ui/tools/spray-tool.cpp | 54 +++++++++++++++++++++------------------------ src/ui/tools/spray-tool.h | 9 +++++++- 2 files changed, 33 insertions(+), 30 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index a95e5aa96..49ff50428 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -13,6 +13,7 @@ * Jon A. Cruz * Abhishek Sharma * Jabiertxo Arraiza + * Adrian Boguszewski * * Copyright (C) 2009 authors * @@ -196,6 +197,7 @@ SprayTool::SprayTool() } SprayTool::~SprayTool() { + object_set.clear(); this->enableGrDrag(false); this->style_set_connection.disconnect(); @@ -862,7 +864,7 @@ static bool fit_item(SPDesktop *desktop, } static bool sp_spray_recursive(SPDesktop *desktop, - Inkscape::Selection *selection, + Inkscape::ObjectSet *set, SPItem *item, Geom::Point p, Geom::Point /*vector*/, @@ -907,7 +909,7 @@ static bool sp_spray_recursive(SPDesktop *desktop, if (box) { // convert 3D boxes to ordinary groups before spraying their shapes item = box3d_convert_to_group(box); - selection->add(item); + set->add(item); } } @@ -996,23 +998,11 @@ static bool sp_spray_recursive(SPDesktop *desktop, } #ifdef ENABLE_SPRAY_MODE_SINGLE_PATH } else if (mode == SPRAY_MODE_SINGLE_PATH) { + long setSize = boost::distance(set->items()); + SPItem *parent_item = setSize > 0 ? set->items().front() : nullptr; // Initial object + SPItem *unionResult = setSize > 1 ? *(++set->items().begin()) : nullptr; // Previous union + SPItem *item_copied = nullptr; // Projected object - SPItem *parent_item = NULL; // Initial object - SPItem *item_copied = NULL; // Projected object - SPItem *unionResult = NULL; // Previous union - - int i=1; - auto items= selection->items(); - for(auto it=items.begin();it!=items.end(); ++it){ - SPItem *item1 = *it; - if (i == 1) { - parent_item = item1; - } - if (i == 2) { - unionResult = item1; - } - i++; - } if (parent_item) { SPDocument *doc = parent_item->document; Inkscape::XML::Document* xml_doc = doc->getReprDoc(); @@ -1045,13 +1035,13 @@ static bool sp_spray_recursive(SPDesktop *desktop, sp_item_move_rel(item_copied, Geom::Translate(move[Geom::X], -move[Geom::Y])); // Union and duplication - selection->clear(); - selection->add(item_copied); + set->clear(); + set->add(item_copied); if (unionResult) { // No need to add the very first item (initialized with NULL). - selection->add(unionResult); + set->add(unionResult); } - sp_selected_path_union_skip_undo(selection); - selection->add(parent_item); + sp_selected_path_union_skip_undo(set); + set->add(parent_item); Inkscape::GC::release(copy); did = true; } @@ -1146,9 +1136,8 @@ static bool sp_spray_recursive(SPDesktop *desktop, static bool sp_spray_dilate(SprayTool *tc, Geom::Point /*event_p*/, Geom::Point p, Geom::Point vector, bool reverse) { SPDesktop *desktop = tc->desktop; - Inkscape::Selection *selection = desktop->getSelection(); - - if (selection->isEmpty()) { + Inkscape::ObjectSet *set = tc->objectSet(); + if (set->isEmpty()) { return false; } @@ -1170,7 +1159,7 @@ static bool sp_spray_dilate(SprayTool *tc, Geom::Point /*event_p*/, Geom::Point double move_standard_deviation = get_move_standard_deviation(tc); { - std::vector const items(selection->items().begin(), selection->items().end()); + std::vector const items(set->items().begin(), set->items().end()); for(std::vector::const_iterator i=items.begin();i!=items.end(); ++i){ SPItem *item = *i; @@ -1182,7 +1171,7 @@ static bool sp_spray_dilate(SprayTool *tc, Geom::Point /*event_p*/, Geom::Point SPItem *item = *i; g_assert(item != NULL); if (sp_spray_recursive(desktop - , selection + , set , item , p, vector , tc->mode @@ -1276,6 +1265,11 @@ bool SprayTool::root_handler(GdkEvent* event) { this->is_dilating = true; this->has_dilated = false; + object_set = *desktop->getSelection(); + if (mode == SPRAY_MODE_SINGLE_PATH) { + desktop->getSelection()->clear(); + } + if(this->is_dilating && event->button.button == 1 && !this->space_panning) { sp_spray_dilate(this, motion_w, desktop->dt2doc(motion_dt), Geom::Point(0,0), MOD__SHIFT(event)); } @@ -1299,7 +1293,7 @@ bool SprayTool::root_handler(GdkEvent* event) { guint num = 0; if (!desktop->selection->isEmpty()) { - num = boost::distance(desktop->selection->items() ); + num = (guint) boost::distance(desktop->selection->items()); } if (num == 0) { this->message_context->flash(Inkscape::ERROR_MESSAGE, _("Nothing selected! Select objects to spray.")); @@ -1384,6 +1378,8 @@ bool SprayTool::root_handler(GdkEvent* event) { SP_VERB_CONTEXT_SPRAY, _("Spray with clones")); break; case SPRAY_MODE_SINGLE_PATH: + sp_selected_path_union_skip_undo(objectSet()); + desktop->getSelection()->add(object_set.objects().begin(), object_set.objects().end()); DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_SPRAY, _("Spray in single path")); break; diff --git a/src/ui/tools/spray-tool.h b/src/ui/tools/spray-tool.h index c81110b37..d5504d565 100644 --- a/src/ui/tools/spray-tool.h +++ b/src/ui/tools/spray-tool.h @@ -13,6 +13,7 @@ * Vincent MONTAGNE * Pierre BARBRY-BLOT * Jabiertxo ARRAIZA + * Adrian Boguszewski * * Copyright (C) 2009 authors * @@ -120,8 +121,14 @@ public: virtual const std::string& getPrefsPath(); - void update_cursor(bool /*with_shift*/); + + ObjectSet* objectSet() { + return &object_set; + } + +private: + ObjectSet object_set; }; } -- cgit v1.2.3 From a83543fbf553fb141ec68386ecc77e2bffe36b10 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Fri, 22 Jul 2016 17:22:19 +0200 Subject: Fixed null when selection contains more than one item Fixed bugs: - https://launchpad.net/bugs/1591390 (bzr r15018) --- src/ui/tools/tool-base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 36fe26e76..72ba499de 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -1083,7 +1083,7 @@ void sp_event_root_menu_popup(SPDesktop *desktop, SPItem *item, GdkEvent *event) /* fixme: This is not what I want but works for now (Lauris) */ if (event->type == GDK_KEY_PRESS) { - item = desktop->getSelection()->singleItem(); + item = desktop->getSelection()->itemList().front(); } ContextMenu* CM = new ContextMenu(desktop, item); -- cgit v1.2.3 From 55a8a393851d289cf5699cc2d4f1bc5241d7b256 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Sun, 24 Jul 2016 18:49:23 +0530 Subject: Add InkSelector class with some code improvements (bzr r14949.1.58) --- src/ui/dialog/styledialog.cpp | 92 +++++++++++++++++++++++-------------------- src/ui/dialog/styledialog.h | 15 +++++-- 2 files changed, 60 insertions(+), 47 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index f3e682062..1004fa151 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -107,7 +107,6 @@ StyleDialog::StyleDialog() : */ _styleExists = false; _document = _targetDesktop->doc(); - _num = _document->getReprRoot()->childCount(); _selectorValue = _populateTree(_getSelectorVec()); _treeView.signal_button_press_event().connect(sigc::mem_fun(*this, @@ -217,7 +216,7 @@ void StyleDialog::_addSelector() + obj->getAttribute("style") + "}" + "\n"; } - if (strcmp(_selectorName.substr(0,1).c_str(), ".") == 0) { + if (_selectorName[0] == '.') { if (!obj->getRepr()->attribute("class")) { obj->getRepr()->setAttribute("class", textEditPtr->get_text() .erase(0,1)); @@ -256,8 +255,10 @@ void StyleDialog::_addSelector() * from selectorValue above. If style element already exists, then * the new selector's content is appended to its previous content. */ - _selectorVec.push_back(std::make_pair(std::make_pair(_selectorName, objVec), - _selectorValue)); + inkSelector._selector = _selectorName; + inkSelector._matchingObjs = objVec; + inkSelector._xmlContent = _selectorValue; + _selectorVec.push_back(inkSelector); if (_styleElementNode()) { _styleChild = _styleElementNode(); @@ -290,7 +291,7 @@ void StyleDialog::_updateStyleContent() { std::string styleContent = ""; for (unsigned i = 0; i < _selectorVec.size(); ++i) { - styleContent = styleContent + _selectorVec[i].second; + styleContent = styleContent + _selectorVec[i]._xmlContent; } _styleChild->firstChild()->setContent(styleContent.c_str()); } @@ -310,12 +311,12 @@ void StyleDialog::_delSelector() if (iter) { Gtk::TreeModel::Row row = *iter; std::string sel, key, value; - std::vector<_selectorVecType>::iterator it; + std::vector::iterator it; for (it = _selectorVec.begin(); it != _selectorVec.end();) { - sel = (*it).second; + sel = (*it)._xmlContent; REMOVE_SPACES(sel); if (!sel.empty()) { - key = strtok(strdup(sel.c_str()), "{"); + key = strtok((char*)sel.c_str(), "{"); REMOVE_SPACES(key); char *temp = strtok(NULL, "}"); if (strtok(temp, "}") != NULL) { @@ -332,12 +333,12 @@ void StyleDialog::_delSelector() child != row.children().end(); ++child) { Gtk::TreeModel::Row childrow = *child; std::string childSel, childKey; - std::vector<_selectorVecType>::iterator i; + std::vector::iterator i; for (i = _selectorVec.begin(); i != _selectorVec.end();) { - childSel = (*i).second; + childSel = (*i)._xmlContent; REMOVE_SPACES(childSel); if (!childSel.empty()) { - childKey = strtok(strdup(childSel.c_str()), "{"); + childKey = strtok((char*)childSel.c_str(), "{"); REMOVE_SPACES(childKey); } Glib::ustring selectedChildRowLabel = @@ -387,7 +388,7 @@ void StyleDialog::_delSelector() */ Inkscape::XML::Node* StyleDialog::_styleElementNode() { - for (unsigned i = 0; i < _num; ++i) { + for (unsigned i = 0; i < _document->getReprRoot()->childCount(); ++i) { if (std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style") { _styleExists = true; @@ -422,10 +423,10 @@ std::string StyleDialog::_setClassAttribute(std::vector sel) * element. _newDrawing is flag is set to false check if an existing drawing is * opened. */ -std::vector<_selectorVecType> StyleDialog::_getSelectorVec() +std::vector StyleDialog::_getSelectorVec() { std::string key, value, selId; - for (unsigned i = 0; i < _num; ++i) { + for (unsigned i = 0; i < _document->getReprRoot()->childCount(); ++i) { if (std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style") { _styleExists = true; _newDrawing = false; @@ -442,7 +443,7 @@ std::vector<_selectorVecType> StyleDialog::_getSelectorVec() std::vectorobjVec; REMOVE_SPACES(sel); if (!sel.empty()) { - key = strtok(strdup(sel.c_str()), "{"); + key = strtok((char*)sel.c_str(), "{"); _selectorName = key; char *temp = strtok(NULL, "}"); if (strtok(temp, "}") != NULL) { @@ -456,9 +457,10 @@ std::vector<_selectorVecType> StyleDialog::_getSelectorVec() while(std::getline(ss, token, ',')) { REMOVE_SPACES(token); - if (strcmp(token.substr(0,1).c_str(), ".") == 0) { + if (token[0] == '.') { token.erase(0, token.find_first_not_of('.')); - for (unsigned i = 0; i < _num; ++i) { + for (unsigned i = 0; i < _document->getReprRoot() + ->childCount(); ++i) { if (_document->getReprRoot()-> nthChild(i)->attribute("class") && _document->getReprRoot()->nthChild(i) @@ -469,7 +471,7 @@ std::vector<_selectorVecType> StyleDialog::_getSelectorVec() } } } - else if (strcmp(token.substr(0,1).c_str(), "#") == 0) { + else if (token[0] == '#') { token.erase(0, token.find_first_not_of('#')); selId = token; objVec.push_back(_document->getObjectById(selId)); @@ -482,9 +484,10 @@ std::vector<_selectorVecType> StyleDialog::_getSelectorVec() else { REMOVE_SPACES(key); std::string tkn = key; - if (strcmp(tkn.substr(0,1).c_str(), ".") == 0) { + if (tkn[0] == '.') { tkn.erase(0, tkn.find_first_not_of('.')); - for (unsigned i = 0; i < _num; ++i) { + for (unsigned i = 0; i < _document->getReprRoot() + ->childCount(); ++i) { if (_document->getReprRoot()-> nthChild(i)->attribute("class") && _document->getReprRoot()->nthChild(i) @@ -495,7 +498,7 @@ std::vector<_selectorVecType> StyleDialog::_getSelectorVec() } } } - else if (strcmp(tkn.substr(0,1).c_str(), "#") == 0) { + else if (tkn[0] == '#') { tkn.erase(0, key.find_first_not_of('#')); selId = tkn; objVec.push_back(_document->getObjectById(selId)); @@ -505,8 +508,11 @@ std::vector<_selectorVecType> StyleDialog::_getSelectorVec() } } _selectorValue = _selectorName + "{" + value + "}\n"; - _selectorVec.push_back(std::make_pair(std::make_pair(key, objVec), - _selectorValue)); + + inkSelector._selector = key; + inkSelector._matchingObjs = objVec; + inkSelector._xmlContent = _selectorValue; + _selectorVec.push_back(inkSelector); } } } @@ -520,17 +526,17 @@ std::vector<_selectorVecType> StyleDialog::_getSelectorVec() * This function populates the treeview with selectors available in the * stylesheet. */ -std::string StyleDialog::_populateTree(std::vector<_selectorVecType> _selVec) +std::string StyleDialog::_populateTree(std::vector _selVec) { _selectorVec = _selVec; std::string selectorValue; for(unsigned it = 0; it < _selectorVec.size(); ++it) { Gtk::TreeModel::Row row = *(_store->append()); - row[_mColumns._selectorLabel] = _selectorVec[it].first.first; + row[_mColumns._selectorLabel] = _selectorVec[it]._selector; row[_mColumns._colAddRemove] = true; - row[_mColumns._colObj] = _selectorVec[it].first.second; - std::string selValue = _selectorVec[it].second; + row[_mColumns._colObj] = _selectorVec[it]._matchingObjs; + std::string selValue = _selectorVec[it]._xmlContent; selectorValue.append(selValue.c_str()); } @@ -598,7 +604,7 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) + "{" + "}\n"; } Glib::ustring key = row[_mColumns._selectorLabel]; - if (strcmp(key.substr(0,1).c_str(), ".") == 0) { + if (key[0] == '.') { if (!obj->getRepr()->attribute("class")) { obj->setAttribute("class", key.erase(0,1)); } @@ -613,10 +619,10 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) } } - _selectorVec.push_back(std::make_pair(std::make_pair - (obj->getId(), - sel), - childStyle)); + inkSelector._selector = obj->getId(); + inkSelector._matchingObjs = sel; + inkSelector._xmlContent = childStyle; + _selectorVec.push_back(inkSelector); } if (_styleElementNode()) { _styleChild = _styleElementNode(); @@ -630,12 +636,12 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) else { std::string sel, key, value; - std::vector<_selectorVecType>::iterator it; + std::vector::iterator it; for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it ) { - sel = (*it).second; + sel = (*it)._xmlContent; REMOVE_SPACES(sel); if (!sel.empty()) { - key = strtok(strdup(sel.c_str()), "{"); + key = strtok((char*)sel.c_str(), "{"); REMOVE_SPACES(key); char *temp = strtok(NULL, "}"); if (strtok(temp, "}") != NULL) { @@ -646,7 +652,7 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) if (key == row[_mColumns._selectorLabel]) { Gtk::TreeModel::Row parentRow = *(row.parent()); Glib::ustring parentKey = parentRow[_mColumns._selectorLabel]; - if (strcmp(parentKey.substr(0,1).c_str(), ".") == 0) { + if (parentKey[0] == '.') { std::vector objVec = row[_mColumns._colObj]; for (unsigned i = 0; i < objVec.size(); ++i) { SPObject *obj = objVec[i]; @@ -708,12 +714,12 @@ void StyleDialog::_buttonEventsSelectObjs(GdkEventButton* event ) if (iter) { Gtk::TreeModel::Row row = *iter; std::string sel, key, value; - std::vector<_selectorVecType>::iterator it; + std::vector::iterator it; for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it) { - sel = (*it).second; + sel = (*it)._xmlContent; REMOVE_SPACES(sel); if (!sel.empty()) { - key = strtok(strdup(sel.c_str()), "{"); + key = strtok((char*)sel.c_str(), "{"); REMOVE_SPACES(key); char *temp = strtok(NULL, "}"); if (strtok(temp, "}") != NULL) { @@ -780,12 +786,12 @@ void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& if (iter) { Gtk::TreeModel::Row row = *iter; std::string sel, key, value; - std::vector<_selectorVecType>::iterator it; + std::vector::iterator it; for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it) { - sel = (*it).second; + sel = (*it)._xmlContent; REMOVE_SPACES(sel); if (!sel.empty()) { - key = strtok(strdup(sel.c_str()), "{"); + key = strtok((char*)sel.c_str(), "{"); REMOVE_SPACES(key); char *temp = strtok(NULL, "}"); if (strtok(temp, "}") != NULL) { @@ -811,7 +817,7 @@ void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& editedToken = _cssPane->_editedProp; size_t startPos = value.find(token); value.replace(startPos, token.length(), editedToken); - (*it).second = key + "{" + value + "}\n"; + (*it)._xmlContent = key + "{" + value + "}\n"; _updateStyleContent(); } } diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index b3a8580f1..54d6f5528 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -48,9 +48,17 @@ private: void _styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip); std::string _setClassAttribute(std::vector); - std::vector<_selectorVecType>_selectorVec; - std::vector<_selectorVecType> _getSelectorVec(); - std::string _populateTree(std::vector<_selectorVecType>); + class InkSelector { + public: + std::string _selector; + std::vector _matchingObjs; + std::string _xmlContent; + }; + + InkSelector inkSelector; + std::vector _selectorVec; + std::vector _getSelectorVec(); + std::string _populateTree(std::vector); bool _handleButtonEvent(GdkEventButton *event); void _buttonEventsSelectObjs(GdkEventButton *event); void _selectObjects(int, int); @@ -83,7 +91,6 @@ private: SPDocument* _document; bool _styleExists; Inkscape::XML::Node *_styleChild; - unsigned _num; std::string _selectorName; std::string _selectorValue; Gtk::TreeModel::Row _row; -- cgit v1.2.3 From 06caba8f2caeb07011e492d7218f0b8f6b28e801 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 24 Jul 2016 17:05:29 +0200 Subject: Fises to toggle button and coding style (bzr r15021) --- src/ui/widget/registered-widget.cpp | 6 ++---- src/ui/widget/registered-widget.h | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'src/ui') diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 298377af3..572845668 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -113,10 +113,8 @@ RegisteredToggleButton::~RegisteredToggleButton() _toggled_connection.disconnect(); } -RegisteredToggleButton::RegisteredToggleButton (const Glib::ustring& /*label*/, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in, char const *active_str, char const *inactive_str) +RegisteredToggleButton::RegisteredToggleButton (const Glib::ustring& /*label*/, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in, char const *icon_active, char const *icon_inactive) : RegisteredWidget() - , _active_str(active_str) - , _inactive_str(inactive_str) { init_parent(key, wr, repr_in, doc_in); setProgrammatically = false; @@ -149,7 +147,7 @@ RegisteredToggleButton::on_toggled() return; _wr->setUpdating (true); - write_to_xml(get_active() ? _active_str : _inactive_str); + write_to_xml(get_active() ? "true" : "false"); //The slave button is greyed out if the master button is untoggled for (std::list::const_iterator i = _slavewidgets.begin(); i != _slavewidgets.end(); ++i) { (*i)->set_sensitive(get_active()); diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index 9d2489712..ab2e4c8e4 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -166,7 +166,7 @@ protected: class RegisteredToggleButton : public RegisteredWidget { public: virtual ~RegisteredToggleButton(); - RegisteredToggleButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL, char const *active_str = "true", char const *inactive_str = "false"); + RegisteredToggleButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL, char const *icon_active = "true", char const *icon_inactive = "false"); void setActive (bool); @@ -183,7 +183,6 @@ public: // if a callback checks it, it must reset it back to false protected: - char const *_active_str, *_inactive_str; sigc::connection _toggled_connection; void on_toggled(); }; -- cgit v1.2.3 From a5d6c9a27683820be3d84eea73c2d6f161ce0e8e Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 24 Jul 2016 18:49:11 +0200 Subject: Add Text tag and update widgets code (bzr r15017.1.2) --- src/ui/CMakeLists.txt | 2 + src/ui/dialog/livepatheffect-editor.cpp | 31 +++++++-- src/ui/dialog/livepatheffect-editor.h | 5 +- src/ui/widget/Makefile_insert | 2 + src/ui/widget/font-selector.cpp | 115 ++++++++++++++++++++++++++++++++ src/ui/widget/font-selector.h | 81 ++++++++++++++++++++++ src/ui/widget/registered-widget.cpp | 44 ++++++++++++ src/ui/widget/registered-widget.h | 18 +++++ 8 files changed, 291 insertions(+), 7 deletions(-) create mode 100644 src/ui/widget/font-selector.cpp create mode 100644 src/ui/widget/font-selector.h (limited to 'src/ui') diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 587974b90..62f341962 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -128,6 +128,7 @@ set(ui_SRC widget/entity-entry.cpp widget/entry.cpp widget/filter-effect-chooser.cpp + widget/font-selector.cpp widget/font-variants.cpp widget/frame.cpp widget/gimpcolorwheel.c @@ -312,6 +313,7 @@ set(ui_SRC widget/entity-entry.h widget/entry.h widget/filter-effect-chooser.h + widget/font-selector.h widget/font-variants.h widget/frame.h widget/gimpspinscale.h diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 422ec10ae..7205beaa8 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -61,7 +61,7 @@ void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data { LivePathEffectEditor *lpeeditor = static_cast(data); lpeeditor->lpe_list_locked = false; - lpeeditor->onSelectionChanged(selection); + lpeeditor->onSelectionChanged(selection, true); } static void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data) @@ -98,7 +98,8 @@ LivePathEffectEditor::LivePathEffectEditor() button_up(), button_down(), current_desktop(NULL), - current_lpeitem(NULL) + current_lpeitem(NULL), + current_lperef(NULL) { Gtk::Box *contents = _getContents(); contents->set_spacing(4); @@ -206,6 +207,10 @@ LivePathEffectEditor::~LivePathEffectEditor() void LivePathEffectEditor::showParams(LivePathEffect::Effect& effect) { + if ( ! effect.upd_params ) { + return; + } + if (effectwidget) { effectcontrol_vbox.remove(*effectwidget); delete effectwidget; @@ -265,9 +270,8 @@ LivePathEffectEditor::set_sensitize_all(bool sensitive) button_down.set_sensitive(sensitive); } - void -LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel) +LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel, bool upd_params) { if (lpe_list_locked) { // this was triggered by selecting a row in the list, so skip reloading @@ -291,6 +295,9 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel) if ( lpeitem->hasPathEffect() ) { Inkscape::LivePathEffect::Effect *lpe = lpeitem->getCurrentLPE(); if (lpe) { + if (upd_params) { + lpe->upd_params = true; + } showParams(*lpe); lpe_list_locked = true; selectInList(lpe); @@ -494,6 +501,12 @@ LivePathEffectEditor::onRemove() SPItem *item = sel->singleItem(); SPLPEItem *lpeitem = dynamic_cast(item); if ( lpeitem ) { + if (current_lperef && current_lperef->lpeobject) { + LivePathEffect::Effect * effect = current_lperef->lpeobject->get_lpe(); + if (effect) { + effect->upd_params = true; + } + } lpeitem->removeCurrentPathEffect(false); DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, @@ -548,11 +561,17 @@ void LivePathEffectEditor::on_effect_selection_changed() Gtk::TreeModel::iterator it = sel->get_selected(); LivePathEffect::LPEObjectReference * lperef = (*it)[columns.lperef]; - if (lperef && current_lpeitem) { + if (lperef && current_lpeitem && current_lperef != lperef) { + //The last condition ignore Gtk::TreeModel may occasionally be changed emitted when nothing has happened if (lperef->lpeobject->get_lpe()) { lpe_list_locked = true; // prevent reload of the list which would lose selection current_lpeitem->setCurrentPathEffect(lperef); - showParams(*lperef->lpeobject->get_lpe()); + current_lperef = lperef; + LivePathEffect::Effect * effect = lperef->lpeobject->get_lpe(); + if (effect) { + effect->upd_params = true; + showParams(*effect); + } } } } diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index 4aac25eaa..b7ec1eeec 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -45,7 +45,8 @@ public: static LivePathEffectEditor &getInstance() { return *new LivePathEffectEditor(); } - void onSelectionChanged(Inkscape::Selection *sel); + void onSelectionChanged(Inkscape::Selection *sel, bool upd_params = false); + void onSelectionModified(Inkscape::Selection *sel); virtual void on_effect_selection_changed(); void setDesktop(SPDesktop *desktop); @@ -126,6 +127,8 @@ private: SPLPEItem * current_lpeitem; + LivePathEffect::LPEObjectReference * current_lperef; + friend void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data); LivePathEffectEditor(LivePathEffectEditor const &d); diff --git a/src/ui/widget/Makefile_insert b/src/ui/widget/Makefile_insert index eb98e6872..bb833e5ec 100644 --- a/src/ui/widget/Makefile_insert +++ b/src/ui/widget/Makefile_insert @@ -33,6 +33,8 @@ ink_common_sources += \ ui/widget/entry.h \ ui/widget/filter-effect-chooser.h \ ui/widget/filter-effect-chooser.cpp \ + ui/widget/font-selector.h \ + ui/widget/font-selector.cpp \ ui/widget/font-variants.h \ ui/widget/font-variants.cpp \ ui/widget/gimpspinscale.c \ diff --git a/src/ui/widget/font-selector.cpp b/src/ui/widget/font-selector.cpp new file mode 100644 index 000000000..77bf83fe1 --- /dev/null +++ b/src/ui/widget/font-selector.cpp @@ -0,0 +1,115 @@ +/* + * + * Released under GNU GPL. Read the file 'COPYING' for more information. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "font-selector.h" +#include "widgets/icon.h" +#include + +namespace Inkscape { +namespace UI { +namespace Widget { + +FontSelector::FontSelector(Glib::ustring const &label, Glib::ustring const &tooltip, + Glib::ustring const &suffix, + Glib::ustring const &icon, + bool mnemonic) + :_widget(new Gtk::HBox()), expanded(true) +{ + Gtk::VBox * vbox_expander = Gtk::manage( new Gtk::VBox() ); + GtkWidget *fontsel = sp_font_selector_new(); + gtk_widget_set_size_request (fontsel, 290, 150); + fsel = SP_FONT_SELECTOR(fontsel); + Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( "on", Inkscape::ICON_SIZE_BUTTON) ); + Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); + pButton->set_relief(Gtk::RELIEF_NONE); + pIcon->show(); + pButton->add(*pIcon); + pButton->show(); + pButton->signal_clicked().connect(sigc::mem_fun(*this, &FontSelector::onFontSelectorSave)); + pButton->set_tooltip_text(_("Save the changes to font selector")); + vbox_expander->pack_start(*Gtk::manage(Glib::wrap(fontsel)), true, true); + vbox_expander->pack_start(*pButton, true, true); + expander = Gtk::manage(new Gtk::Expander(Glib::ustring(_("Font Selector:")))); + expander->add(*vbox_expander); + expander->set_expanded(expanded); + expander->set_spacing(5); + expander->set_use_markup(true); + onExpanderChanged(); + _widget->set_tooltip_text(tooltip); + expander->property_expanded().signal_changed().connect(sigc::mem_fun(*this, &FontSelector::onExpanderChanged) ); + pack_start(*expander, true, true); + pack_start(*Gtk::manage(_widget), true, true); +} + +void +FontSelector::onExpanderChanged() +{ + expanded = expander->get_expanded(); + if(expanded) { + expander->set_label (Glib::ustring(_("Font Selector:"))); + } else { + expander->set_label (Glib::ustring(_("Font Selector: hided"))); + } +} + +Glib::ustring FontSelector::getFontSpec() const +{ + return _fontspec; +} + +void FontSelector::setFontSpec(Glib::ustring fontspec) +{ + _fontspec = fontspec; +} + +double FontSelector::getFontSize() const +{ + return _fontsize; +} + +void FontSelector::setFontSize(double fontsize) +{ + _fontsize = fontsize; +} + +void FontSelector::setValue (Glib::ustring fontspec, double fontsize) +{ + if (_fontsize != fontsize || _fontspec != fontspec) { + setFontSize(fontsize); + setFontSpec(fontspec); + sp_font_selector_set_fontspec(fsel, fontspec, fontsize); + } +} + +void +FontSelector::onFontSelectorSave() +{ + if (_fontspec != sp_font_selector_get_fontspec(fsel) || _fontsize != sp_font_selector_get_size(fsel)) { + setFontSpec(sp_font_selector_get_fontspec(fsel)); + setFontSize(sp_font_selector_get_size(fsel)); + signal_fontselupd.emit(); + onExpanderChanged(); + } +} + + +} // namespace Widget +} // namespace UI +} // namespace Inkscape + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/font-selector.h b/src/ui/widget/font-selector.h new file mode 100644 index 000000000..cfea54bde --- /dev/null +++ b/src/ui/widget/font-selector.h @@ -0,0 +1,81 @@ +/* + * + * Copyright (C) 2007 Author + * + * Released under GNU GPL. Read the file 'COPYING' for more information. + */ + +#ifndef INKSCAPE_UI_WIDGET_FONT_SELECTOR_H +#define INKSCAPE_UI_WIDGET_FONT_SELECTOR_H + +#include +#include "widgets/font-selector.h" + +struct SPFontSelector; +namespace Inkscape { +namespace UI { +namespace Widget { + +/** + * A labelled text box, with spin buttons and optional + * icon or suffix, for entering arbitrary number values. It adds an extra + * number called "startseed", that is not UI edittable, but should be put in SVG. + * This does NOT generate a random number, but provides merely the saving of + * the startseed value. + */ +class FontSelector : public Gtk::HBox +{ +public: + + /** + * Construct a FontSelector Widget. + * + * @param label Label. + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to false). + */ + FontSelector( Glib::ustring const &label, + Glib::ustring const &tooltip, + Glib::ustring const &suffix = "", + Glib::ustring const &icon = "", + bool mnemonic = true); + + Glib::ustring getFontSpec() const; + void onExpanderChanged(); + void setFontSpec(Glib::ustring fontspec); + double getFontSize() const; + void setFontSize(double fontsize); + void setValue (Glib::ustring fontspec, double fontsize); + sigc::signal signal_fontselupd; + +protected: + Gtk::Widget *_widget; + bool expanded; + Gtk::Expander * expander; + SPFontSelector *fsel; + Glib::ustring _fontspec; + double _fontsize; + +private: + void onFontSelectorSave(); +}; + +} // namespace Widget +} // namespace UI +} // namespace Inkscape + +#endif // INKSCAPE_UI_WIDGET_RANDOM_H + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 298377af3..7abab25c9 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -25,6 +25,7 @@ #include "ui/widget/scalar-unit.h" #include "ui/widget/point.h" #include "ui/widget/random.h" +#include "ui/widget/font-selector.h" #include "widgets/spinbutton-events.h" #include "xml/repr.h" @@ -805,6 +806,49 @@ RegisteredRandom::on_value_changed() _wr->setUpdating (false); } +/*######################################### + * Registered FONT-SELECTOR + */ + +RegisteredFontSelector::~RegisteredFontSelector() +{ + _value_changed_connection.disconnect(); +} + +RegisteredFontSelector::RegisteredFontSelector ( const Glib::ustring& label, const Glib::ustring& tip, + const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, + SPDocument* doc_in ) + : RegisteredWidget (label, tip) +{ + init_parent(key, wr, repr_in, doc_in); + _value_changed_connection = signal_fontselupd.connect (sigc::mem_fun (*this, &RegisteredFontSelector::on_value_changed)); +} + +void +RegisteredFontSelector::setValue (Glib::ustring fontspec, double fontsize) +{ + if (fontsize != 0) { //have value in the effect + FontSelector::setValue (fontspec, fontsize); + } +} + +void +RegisteredFontSelector::on_value_changed() +{ + + if (_wr->isUpdating()) + return; + + _wr->setUpdating (true); + + Inkscape::SVGOStringStream os; + os << getFontSpec() << " @ " << getFontSize(); + + write_to_xml(os.str().c_str()); + + _wr->setUpdating (false); +} + } // namespace Dialog } // namespace UI } // namespace Inkscape diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index 9d2489712..17c04de9f 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -22,6 +22,7 @@ #include "ui/widget/text.h" #include "ui/widget/random.h" #include "ui/widget/unit-menu.h" +#include "ui/widget/font-selector.h" #include "ui/widget/color-picker.h" #include "inkscape.h" @@ -419,6 +420,23 @@ protected: void on_value_changed(); }; +class RegisteredFontSelector : public RegisteredWidget { +public: + virtual ~RegisteredFontSelector(); + RegisteredFontSelector ( const Glib::ustring& label, + const Glib::ustring& tip, + const Glib::ustring& key, + Registry& wr, + Inkscape::XML::Node* repr_in = NULL, + SPDocument *doc_in = NULL); + + void setValue (Glib::ustring fontspec, double fontsize); + +protected: + sigc::connection _value_changed_connection; + void on_value_changed(); +}; + } // namespace Widget } // namespace UI } // namespace Inkscape -- cgit v1.2.3 From 6641c2e8c586612aad47e1296584ca6447e11b15 Mon Sep 17 00:00:00 2001 From: "Tavmjong Bah, Kamalpreet Grewal" <> Date: Mon, 25 Jul 2016 19:10:59 +0530 Subject: Add robust implementation of _getSelectorVec() (bzr r14949.1.60) --- src/ui/dialog/styledialog.cpp | 141 ++++++++++++++++++++---------------------- 1 file changed, 67 insertions(+), 74 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 1004fa151..259f326e4 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -425,95 +425,88 @@ std::string StyleDialog::_setClassAttribute(std::vector sel) */ std::vector StyleDialog::_getSelectorVec() { - std::string key, value, selId; for (unsigned i = 0; i < _document->getReprRoot()->childCount(); ++i) { if (std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style") { _styleExists = true; _newDrawing = false; _styleChild = _document->getReprRoot()->nthChild(i); - std::stringstream str; - str << _document->getReprRoot()->nthChild(i)->firstChild()->content(); - std::string sel; - /** - * If a selector without any style attribute content is added, the - * value is set to empty so that its corresponding XML repr is added. - */ - while(std::getline(str, sel, '\n')) { + // Get content from first style element. + std::string content = _styleChild->firstChild()->content(); + + // Remove end-of-lines (check it works on Windoze). + content.erase(std::remove(content.begin(), content.end(), '\n'), content.end()); + + // First split into selector/value chunks. + // An attempt to use Glib::Regex failed. A C++11 version worked but + // reportedly has problems on Windows. Using split_simple() is simpler + // and probably faster. + // + // Glib::RefPtr regex1 = + // Glib::Regex::create("([^\\{]+)\\{([^\\{]+)\\}"); + // + // Glib::MatchInfo minfo; + // regex1->match(content, minfo); + + // Split on curly brackets. Even tokens are selectors, odd are values. + std::vector tokens = Glib::Regex::split_simple("[}{]", content); + + for (unsigned i = 0; i < tokens.size()-1; i += 2) { + std::string selectors = tokens[i]; + REMOVE_SPACES(selectors); // Remove leading/trailing spaces + + /** Make a list of all objects that selector matches. This is + * currently limited to simple id, class, and element selectors. + * Expanding this would take integrating a true CSS parser. + */ std::vectorobjVec; - REMOVE_SPACES(sel); - if (!sel.empty()) { - key = strtok((char*)sel.c_str(), "{"); - _selectorName = key; - char *temp = strtok(NULL, "}"); - if (strtok(temp, "}") != NULL) { - value = strtok(temp, "}"); - } - std::stringstream ss(key); - std::string token; - std::size_t found = key.find(","); - if (found!=std::string::npos) { - while(std::getline(ss, token, ',')) { - REMOVE_SPACES(token); + // Split selector string into individual selectors (which are comma separated). + std::vector tokens2 = Glib::Regex::split_simple + ("\\s*,\\s*", selectors ); - if (token[0] == '.') { - token.erase(0, token.find_first_not_of('.')); - for (unsigned i = 0; i < _document->getReprRoot() - ->childCount(); ++i) { - if (_document->getReprRoot()-> - nthChild(i)->attribute("class") && - _document->getReprRoot()->nthChild(i) - ->attribute("class") == token) { - selId = _document->getReprRoot()->nthChild(i) - ->attribute("id"); - objVec.push_back( _document->getObjectById(selId)); - } - } - } - else if (token[0] == '#') { - token.erase(0, token.find_first_not_of('#')); - selId = token; - objVec.push_back(_document->getObjectById(selId)); - } - else { - std::cout << "simple text" << std::endl; - } + for(unsigned i = 0; i < tokens2.size(); ++i) { + std::string token2 = tokens2[i]; + + // Find objects that match class selector + if (token2[0] == '.') { + token2.erase(0,1); + std::vector objects = _document + ->getObjectsByClass(token2); + objVec.insert(objVec.end(), objects.begin(), objects.end()); + } + + // Find objects that match id selector + else if (token2[0] == '#') { + token2.erase(0,1); + SPObject * object = _document->getObjectById(token2); + if (object) { + objVec.push_back(object); } } + + // Find objects that match element selector else { - REMOVE_SPACES(key); - std::string tkn = key; - if (tkn[0] == '.') { - tkn.erase(0, tkn.find_first_not_of('.')); - for (unsigned i = 0; i < _document->getReprRoot() - ->childCount(); ++i) { - if (_document->getReprRoot()-> - nthChild(i)->attribute("class") && - _document->getReprRoot()->nthChild(i) - ->attribute("class") == tkn) { - selId = _document->getReprRoot()->nthChild(i) - ->attribute("id"); - objVec.push_back(_document->getObjectById(selId)); - } - } - } - else if (tkn[0] == '#') { - tkn.erase(0, key.find_first_not_of('#')); - selId = tkn; - objVec.push_back(_document->getObjectById(selId)); - } - else { - std::cout << "simple text" << std::endl; - } + std::vector objects = _document-> + getObjectsByElement(token2); + objVec.insert(objVec.end(), objects.begin(), objects.end()); } - _selectorValue = _selectorName + "{" + value + "}\n"; + } - inkSelector._selector = key; - inkSelector._matchingObjs = objVec; - inkSelector._xmlContent = _selectorValue; - _selectorVec.push_back(inkSelector); + std::string values; + // Check to make sure we do have a value to match selector. + if ((i+1) < tokens.size()) { + values = tokens[i+1]; + } else { + std::cerr << "StyleDialog::_getSelectorVec: Missing values " + "for last selector!" << std::endl; } + + _selectorValue = selectors + "{" + values + "}\n"; + inkSelector._selector = selectors; + inkSelector._matchingObjs = objVec; + inkSelector._xmlContent = _selectorValue; + _selectorVec.push_back(inkSelector); } } } -- cgit v1.2.3 From d7bdf3ed2d198c0027babed217dfec32f5f4f389 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 26 Jul 2016 00:10:01 +0200 Subject: Add gap,offset,insensitive transforms, and delete on lpe remove (bzr r15017.1.6) --- src/ui/widget/font-selector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/widget/font-selector.cpp b/src/ui/widget/font-selector.cpp index 77bf83fe1..6b0bdca36 100644 --- a/src/ui/widget/font-selector.cpp +++ b/src/ui/widget/font-selector.cpp @@ -19,7 +19,7 @@ FontSelector::FontSelector(Glib::ustring const &label, Glib::ustring const &tool Glib::ustring const &suffix, Glib::ustring const &icon, bool mnemonic) - :_widget(new Gtk::HBox()), expanded(true) + :_widget(new Gtk::HBox()), expanded(false) { Gtk::VBox * vbox_expander = Gtk::manage( new Gtk::VBox() ); GtkWidget *fontsel = sp_font_selector_new(); -- cgit v1.2.3 From 39c55178f470bf12c6a7fc51d5d17b65b319faf2 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Tue, 26 Jul 2016 21:45:08 +0530 Subject: Add functionality to add and delete CSS property in CSS panel (bzr r14949.1.61) --- src/ui/dialog/cssdialog.cpp | 37 +++++++++++ src/ui/dialog/cssdialog.h | 6 +- src/ui/dialog/styledialog.cpp | 146 ++++++++++++++++++++++++++++++++++++------ src/ui/dialog/styledialog.h | 2 + 4 files changed, 170 insertions(+), 21 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/cssdialog.cpp b/src/ui/dialog/cssdialog.cpp index 9007faafc..cd2f74d15 100644 --- a/src/ui/dialog/cssdialog.cpp +++ b/src/ui/dialog/cssdialog.cpp @@ -21,6 +21,23 @@ namespace Inkscape { namespace UI { namespace Dialog { +/** + * @brief CssDialog::_styleButton + * @param btn + * @param iconName + * @param tooltip + * This function sets the style of '+'button at the bottom of dialog. + */ +void CssDialog::_styleButton(Gtk::Button& btn, char const* iconName, + char const* tooltip) +{ + GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); + gtk_widget_show(child); + btn.add(*manage(Glib::wrap(child))); + btn.set_relief(Gtk::RELIEF_NONE); + btn.set_tooltip_text (tooltip); +} + /** * Constructor * A treeview whose each row corresponds to a CSS property of selector selected. @@ -54,10 +71,18 @@ CssDialog::CssDialog(): int nameColNum = _treeView.append_column("Property", *_textRenderer) - 1; _propCol = _treeView.get_column(nameColNum); + create = manage(new Gtk::Button()); + _styleButton(*create, "list-add", "Add a new property"); + + _mainBox.pack_end(_buttonBox, Gtk::PACK_SHRINK); + _buttonBox.pack_start(*create, Gtk::PACK_SHRINK); + _getContents()->pack_start(_mainBox, Gtk::PACK_EXPAND_WIDGET); _targetDesktop = getDesktop(); setDesktop(_targetDesktop); + + create->signal_clicked().connect(sigc::mem_fun(*this, &CssDialog::_addProperty)); } CssDialog::~CssDialog() @@ -70,6 +95,18 @@ void CssDialog::setDesktop( SPDesktop* desktop ) _desktop = desktop; } +/** + * @brief CssDialog::_addProperty + * This function is a slot to signal_clicked for '+' button at the bottom of CSS + * panel. A new row is added, double clicking which text for new property can be + * added. _newProperty is set to true in which case the value is appended. + */ +void CssDialog::_addProperty() +{ + _propRow = *(_store->append()); + _newProperty = true; +} + } // namespace Dialog } // namespace UI } // namespace Inkscape diff --git a/src/ui/dialog/cssdialog.h b/src/ui/dialog/cssdialog.h index 4ff79c219..ef48686cc 100644 --- a/src/ui/dialog/cssdialog.h +++ b/src/ui/dialog/cssdialog.h @@ -50,6 +50,7 @@ public: SPDesktop* _targetDesktop; CssColumns _cssColumns; Gtk::VBox _mainBox; + Gtk::HBox _buttonBox; Gtk::TreeView _treeView; Glib::RefPtr _store; Gtk::ScrolledWindow _scrolledWindow; @@ -57,8 +58,11 @@ public: Gtk::CellRendererText *_textRenderer; Gtk::TreeViewColumn *_propCol; Glib::ustring _editedProp; + Gtk::Button* create; + bool _newProperty; - void _handleButtonEvent(const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *col); + void _styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip); + void _addProperty(); }; diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 259f326e4..7deac22d8 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -120,6 +120,10 @@ StyleDialog::StyleDialog() : false); _cssPane = new CssDialog; + + _treeView.get_selection()->signal_changed().connect(sigc::mem_fun(*this, + &StyleDialog:: + _selChanged)); } StyleDialog::~StyleDialog() @@ -279,6 +283,7 @@ void StyleDialog::_addSelector() root->addChild(newChild, NULL); Inkscape::GC::release(newChild); + _styleChild = newChild; } } @@ -745,14 +750,29 @@ void StyleDialog::_buttonEventsSelectObjs(GdkEventButton* event ) } } } - _cssPane->_textRenderer->signal_edited().connect(sigc::mem_fun(*this, - &StyleDialog:: - _handleEdited)); } else { _cssPane->_store->clear(); _cssPane->hide(); } + + _cssPane->_textRenderer->signal_edited().connect(sigc::mem_fun(*this, + &StyleDialog:: + _handleEdited)); + _cssPane->_treeView.signal_button_press_event().connect(sigc::mem_fun + (*this, &StyleDialog:: + _delProperty), + false); + } +} + +/** + * @brief StyleDialog::_selChanged + * When no row in _treeView of Style Dialog is selected, the _cssPane is hidden. + */ +void StyleDialog::_selChanged() { + if (_treeView.get_selection()->count_selected_rows() == 0) { + _cssPane->hide(); } } @@ -762,8 +782,9 @@ void StyleDialog::_buttonEventsSelectObjs(GdkEventButton* event ) * @param new_text * This function edits CSS properties of the selector chosen. new_text is used * to update the property in XML repr. The value from selected selector is - * obtained and modified as per value of new_text. Later _updateStyleContent() is - * called to update XML repr and hence changes are reflected in the drawing too. + * obtained and modified as per value of new_text. If a new property is added, + * value is appended with new_text. Later _updateStyleContent() is called to + * update XML repr and hence changes are reflected in the drawing too. */ void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& new_text) { @@ -774,6 +795,7 @@ void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& _cssPane->_editedProp = new_text; } + // Selected selector row is obtained here to get corresponding key and value. Glib::RefPtr refTreeSelection = _treeView.get_selection(); Gtk::TreeModel::iterator iter = refTreeSelection->get_selected(); if (iter) { @@ -797,30 +819,114 @@ void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& REMOVE_SPACES(matchSelector); if (key == matchSelector) { - std::stringstream ss(value); - std::string token, editedToken; - std::size_t found = value.find(";"); - if (found!=std::string::npos) { - while(std::getline(ss, token, ';')) { - REMOVE_SPACES(token); - if (!token.empty()) { - if (token.substr(0, token.find(":")) == _cssPane - ->_editedProp.substr(0, _cssPane->_editedProp - .find(":"))) { - editedToken = _cssPane->_editedProp; - size_t startPos = value.find(token); - value.replace(startPos, token.length(), editedToken); - (*it)._xmlContent = key + "{" + value + "}\n"; - _updateStyleContent(); + /** If a new property is added, existing value is appended with new + * property, else replacements in value are done in the 'else' block. + */ + if (_cssPane->_newProperty) { + value.append((new_text + ";").c_str()); + _cssPane->_propCol->add_attribute(_cssPane->_textRenderer + ->property_text(), + _cssPane->_cssColumns + ._propertyLabel); + _cssPane->_newProperty = false; + } + else { + std::stringstream ss(value); + std::string token, editedToken; + std::size_t found = value.find(";"); + if (found!=std::string::npos) { + while(std::getline(ss, token, ';')) { + REMOVE_SPACES(token); + if (!token.empty()) { + if (token.substr(0, token.find(":")) == _cssPane + ->_editedProp.substr(0, _cssPane->_editedProp + .find(":"))) { + editedToken = _cssPane->_editedProp; + size_t startPos = value.find(token); + value.replace(startPos, token.length(), editedToken); + } } } } } + value.erase(std::remove(value.begin(), value.end(), '\n'), value.end()); + (*it)._xmlContent = key + "{" + value + "}\n"; + _updateStyleContent(); } } } } + +/** + * @brief StyleDialog::_delProperty + * @param event + * @return + * This function deletes property when '-' in front of property in CSS panel is + * clicked. The property row is deleted from CSS panel and XML repr is updated. + * toDelProperty is the property to be deleted which is looked in 'value' and is + * erased from 'value'. + */ +bool StyleDialog::_delProperty(GdkEventButton *event) +{ + if (event->type == GDK_BUTTON_PRESS && event->button == 1) { + Gtk::TreeViewColumn *col = 0; + Gtk::TreeModel::Path path; + int x = static_cast(event->x); + int y = static_cast(event->y); + int x2 = 0; + int y2 = 0; + Gtk::TreeModel::Row cssRow; + Glib::ustring toDelProperty; + if (_cssPane->_treeView.get_path_at_pos(x, y, path, col, x2, y2)) { + if (col == _cssPane->_treeView.get_column(0)) { + Gtk::TreeModel::iterator cssIter = _cssPane->_treeView.get_selection() + ->get_selected(); + if (cssIter) { + cssRow = *cssIter; + toDelProperty = cssRow[_cssPane->_cssColumns._propertyLabel]; + } + + Gtk::TreeModel::iterator iter = _treeView.get_selection()->get_selected(); + if (iter) { + Gtk::TreeModel::Row row = *iter; + std::string sel, key, value; + std::vector::iterator it; + for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it) { + sel = (*it)._xmlContent; + REMOVE_SPACES(sel); + if (!sel.empty()) { + key = strtok((char*)sel.c_str(), "{"); + REMOVE_SPACES(key); + char *temp = strtok(NULL, "}"); + if (strtok(temp, "}") != NULL) { + value = strtok(temp, "}"); + } + } + + Glib::ustring selectedRowLabel = row[_mColumns._selectorLabel]; + std::string matchSelector = selectedRowLabel; + REMOVE_SPACES(matchSelector); + + if (key == matchSelector) { + std::size_t found = value.find(toDelProperty); + if (found!=std::string::npos) { + if (!toDelProperty.empty()) { + value.erase(found, toDelProperty.length()+1); + (*it)._xmlContent = key + "{" + value + "}\n"; + _updateStyleContent(); + } + } + } + } + } + _cssPane->_store->erase(cssRow); + } + } + } + return false; +} + /** * @brief StyleDialog::_selectObjects * @param eventX diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 54d6f5528..a1048a97d 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -100,9 +100,11 @@ private: // Signal handlers void _addSelector(); void _delSelector(); + void _selChanged(); // Signal handler for CssDialog void _handleEdited(const Glib::ustring& path, const Glib::ustring& new_text); + bool _delProperty(GdkEventButton *event); }; } // namespace Dialog -- cgit v1.2.3 From ff4fbbc93f67afd6cbf851691833a50d6c76b350 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 27 Jul 2016 12:19:03 +0200 Subject: Renamed some functions, fixed tests (bzr r14954.1.28) --- src/ui/clipboard.cpp | 4 ++-- src/ui/dialog/export.cpp | 2 +- src/ui/dialog/transformation.cpp | 22 +++++++++++----------- src/ui/interface.cpp | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index b25a70b15..504a5e2ce 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -539,8 +539,8 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a else { Geom::OptRect sel_size = selection->visualBounds(); if ( sel_size ) { - sp_selection_scale_relative(selection, sel_size->midpoint(), - _getScale(desktop, min, max, *sel_size, apply_x, apply_y)); + sp_object_set_scale_relative(selection, sel_size->midpoint(), + _getScale(desktop, min, max, *sel_size, apply_x, apply_y)); } } pasted = true; diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 4ab007408..08fc25464 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -814,7 +814,7 @@ void Export::onAreaToggled () case SELECTION_SELECTION: if ((SP_ACTIVE_DESKTOP->getSelection())->isEmpty() == false) { - sp_selection_get_export_hints (SP_ACTIVE_DESKTOP->getSelection(), filename, &xdpi, &ydpi); + sp_object_set_get_export_hints(SP_ACTIVE_DESKTOP->getSelection(), filename, &xdpi, &ydpi); /* If we still don't have a filename -- let's build one that's nice */ diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index d4a0ffd68..d82b5ded3 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -723,12 +723,12 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) if (!prefs->getBool("/dialogs/transformation/applyseparately")) { // move selection as a whole if (_check_move_relative.get_active()) { - sp_selection_move_relative(selection, x, y); + sp_object_set_move_relative(selection, x, y); } else { Geom::OptRect bbox = selection->preferredBounds(); if (bbox) { - sp_selection_move_relative(selection, - x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); + sp_object_set_move_relative(selection, + x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); } } } else { @@ -791,8 +791,8 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) } else { Geom::OptRect bbox = selection->preferredBounds(); if (bbox) { - sp_selection_move_relative(selection, - x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); + sp_object_set_move_relative(selection, + x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); } } } @@ -856,7 +856,7 @@ void Transformation::applyPageScale(Inkscape::Selection *selection) double y1 = bbox_pref->midpoint()[Geom::Y] + new_height/2; Geom::Affine scaler = get_scale_transform_for_variable_stroke (*bbox_pref, *bbox_geom, transform_stroke, preserve, x0, y0, x1, y1); - sp_selection_apply_affine(selection, scaler); + sp_object_set_apply_affine(selection, scaler); } } @@ -882,7 +882,7 @@ void Transformation::applyPageRotate(Inkscape::Selection *selection) } else { boost::optional center = selection->center(); if (center) { - sp_selection_rotate_relative(selection, *center, angle); + sp_object_set_rotate_relative(selection, *center, angle); } } @@ -949,7 +949,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); return; } - sp_selection_skew_relative(selection, *center, 0.01*skewX, 0.01*skewY); + sp_object_set_skew_relative(selection, *center, 0.01 * skewX, 0.01 * skewY); } else if (_units_skew.isRadial()) { //deg or rad double angleX = _scalar_skew_horizontal.getValue("rad"); double angleY = _scalar_skew_vertical.getValue("rad"); @@ -962,7 +962,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) } double skewX = tan(-angleX); double skewY = tan(angleY); - sp_selection_skew_relative(selection, *center, skewX, skewY); + sp_object_set_skew_relative(selection, *center, skewX, skewY); } else { // absolute displacement double skewX = _scalar_skew_horizontal.getValue("px"); double skewY = _scalar_skew_vertical.getValue("px"); @@ -970,7 +970,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); return; } - sp_selection_skew_relative(selection, *center, skewX/height, skewY/width); + sp_object_set_skew_relative(selection, *center, skewX / height, skewY / width); } } } @@ -1003,7 +1003,7 @@ void Transformation::applyPageTransform(Inkscape::Selection *selection) item->updateRepr(); } } else { - sp_selection_apply_affine(selection, displayed); // post-multiply each object's transform + sp_object_set_apply_affine(selection, displayed); // post-multiply each object's transform } DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_DIALOG_TRANSFORM, diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index d19526105..eb3034ca3 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -1250,7 +1250,7 @@ sp_ui_drag_data_received(GtkWidget *widget, Geom::OptRect sel_bbox = selection->visualBounds(); if (sel_bbox) { Geom::Point m( desktop->point() - sel_bbox->midpoint() ); - sp_selection_move_relative(selection, m, false); + sp_object_set_move_relative(selection, m, false); } } @@ -1916,7 +1916,7 @@ void ContextMenu::MakeGroupMenu(void) void ContextMenu::ActivateGroup(void) { - sp_selection_group_ui(_desktop->selection, _desktop); + sp_selection_group(_desktop->selection, _desktop); } void ContextMenu::ActivateUngroup(void) -- cgit v1.2.3 From f35bb1f74a0ffeb5c6477a25e3c4cde87a97bcf1 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 12:06:06 +0200 Subject: Removed unused includes, decrease compilation time (bzr r15025) --- src/ui/clipboard.cpp | 12 ------------ src/ui/control-manager.cpp | 1 - src/ui/dialog-events.cpp | 5 +---- src/ui/dialog/align-and-distribute.cpp | 5 +---- src/ui/dialog/clonetiler.cpp | 14 +------------- src/ui/dialog/color-item.cpp | 10 +--------- src/ui/dialog/debug.cpp | 3 +-- src/ui/dialog/desktop-tracker.cpp | 1 - src/ui/dialog/dialog-manager.cpp | 5 +---- src/ui/dialog/dialog.cpp | 5 +---- src/ui/dialog/dock-behavior.cpp | 6 +----- src/ui/dialog/document-metadata.cpp | 3 +-- src/ui/dialog/document-properties.cpp | 13 ------------- src/ui/dialog/export.cpp | 16 +--------------- src/ui/dialog/extension-editor.cpp | 4 +--- src/ui/dialog/filedialog.cpp | 5 ----- src/ui/dialog/fill-and-stroke.cpp | 4 ---- src/ui/dialog/filter-effects-dialog.cpp | 23 +---------------------- src/ui/dialog/find.cpp | 10 +--------- src/ui/dialog/floating-behavior.cpp | 5 +---- src/ui/dialog/font-substitution.cpp | 8 +------- src/ui/dialog/glyphs.cpp | 5 ----- src/ui/dialog/grid-arrange-tab.cpp | 4 ---- src/ui/dialog/guides.cpp | 6 +----- src/ui/dialog/icon-preview.cpp | 7 +------ src/ui/dialog/inkscape-preferences.cpp | 10 ---------- src/ui/dialog/inkscape-preferences.h | 1 - src/ui/dialog/input.cpp | 9 --------- src/ui/dialog/knot-properties.cpp | 11 +---------- src/ui/dialog/layer-properties.cpp | 4 ---- src/ui/dialog/layers.cpp | 13 +------------ src/ui/dialog/livepatheffect-add.cpp | 3 +-- src/ui/dialog/livepatheffect-editor.cpp | 11 +---------- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 12 +----------- src/ui/dialog/lpe-powerstroke-properties.cpp | 13 +------------ src/ui/dialog/memory.cpp | 3 +-- src/ui/dialog/messages.cpp | 2 +- src/ui/dialog/new-from-template.cpp | 3 +-- src/ui/dialog/object-attributes.cpp | 3 --- src/ui/dialog/object-properties.cpp | 3 --- src/ui/dialog/objects.cpp | 15 +-------------- src/ui/dialog/ocaldialogs.cpp | 11 ----------- src/ui/dialog/pixelartdialog.cpp | 6 ------ src/ui/dialog/polar-arrange-tab.cpp | 2 -- src/ui/dialog/print.cpp | 3 +-- src/ui/dialog/spellcheck.cpp | 9 +-------- src/ui/dialog/svg-fonts-dialog.cpp | 6 +----- src/ui/dialog/swatches.cpp | 11 ----------- src/ui/dialog/symbols.cpp | 7 ------- src/ui/dialog/tags.cpp | 17 +---------------- src/ui/dialog/template-load-tab.cpp | 11 ----------- src/ui/dialog/template-widget.cpp | 6 ------ src/ui/dialog/text-edit.cpp | 8 -------- src/ui/dialog/tracedialog.cpp | 4 +--- src/ui/dialog/transformation.cpp | 6 +----- src/ui/dialog/undo-history.cpp | 6 +----- src/ui/dialog/xml-tree.cpp | 5 ----- src/ui/interface.cpp | 13 +------------ src/ui/object-edit.cpp | 8 ++------ src/ui/previewholder.cpp | 1 - src/ui/selected-color.cpp | 2 +- src/ui/shape-editor.cpp | 5 +---- src/ui/tool-factory.cpp | 2 -- src/ui/tool/control-point-selection.cpp | 1 - src/ui/tool/control-point.cpp | 2 -- src/ui/tool/curve-drag-point.cpp | 3 --- src/ui/tool/manipulator.cpp | 4 ++-- src/ui/tool/modifier-tracker.cpp | 1 - src/ui/tool/multi-path-manipulator.cpp | 2 -- src/ui/tool/node.cpp | 5 ----- src/ui/tool/path-manipulator.cpp | 13 ------------- src/ui/tool/selector.cpp | 1 - src/ui/tool/transform-handle-set.cpp | 4 ---- src/ui/tools-switch.cpp | 6 ------ src/ui/tools/arc-tool.cpp | 3 +-- src/ui/tools/box3d-tool.cpp | 9 --------- src/ui/tools/calligraphic-tool.cpp | 9 --------- src/ui/tools/connector-tool.cpp | 7 ------- src/ui/tools/dropper-tool.cpp | 5 +---- src/ui/tools/dynamic-base.cpp | 6 ------ src/ui/tools/eraser-tool.cpp | 11 ----------- src/ui/tools/flood-tool.cpp | 12 +----------- src/ui/tools/freehand-base.cpp | 16 +--------------- src/ui/tools/gradient-tool.cpp | 9 +-------- src/ui/tools/lpe-tool.cpp | 5 +---- src/ui/tools/measure-tool.cpp | 18 +----------------- src/ui/tools/mesh-tool.cpp | 3 +-- src/ui/tools/node-tool.cpp | 6 ------ src/ui/tools/pen-tool.cpp | 12 ------------ src/ui/tools/pencil-tool.cpp | 5 ----- src/ui/tools/rect-tool.cpp | 5 ----- src/ui/tools/select-tool.cpp | 4 +--- src/ui/tools/spiral-tool.cpp | 5 ----- src/ui/tools/spray-tool.cpp | 14 -------------- src/ui/tools/star-tool.cpp | 5 +---- src/ui/tools/text-tool.cpp | 6 +----- src/ui/tools/tool-base.cpp | 10 +--------- src/ui/tools/tweak-tool.cpp | 12 ------------ src/ui/tools/zoom-tool.cpp | 1 - src/ui/uxmanager.cpp | 5 +---- src/ui/view/view.h | 3 +-- src/ui/widget/addtoicon.cpp | 4 +--- src/ui/widget/anchor-selector.cpp | 1 - src/ui/widget/clipmaskicon.cpp | 2 +- src/ui/widget/color-icc-selector.cpp | 3 --- src/ui/widget/color-notebook.cpp | 4 ---- src/ui/widget/color-scales.cpp | 4 +--- src/ui/widget/color-slider.cpp | 3 +-- src/ui/widget/color-wheel-selector.cpp | 6 +----- src/ui/widget/dock-item.cpp | 3 --- src/ui/widget/entity-entry.cpp | 3 +-- src/ui/widget/entry.cpp | 2 +- src/ui/widget/filter-effect-chooser.cpp | 4 ---- src/ui/widget/font-variants.cpp | 10 +--------- src/ui/widget/frame.cpp | 2 +- src/ui/widget/highlight-picker.cpp | 3 --- src/ui/widget/imageicon.cpp | 3 --- src/ui/widget/layer-selector.cpp | 4 +--- src/ui/widget/layertypeicon.cpp | 3 +-- src/ui/widget/licensor.cpp | 2 -- src/ui/widget/object-composite-settings.cpp | 7 ------- src/ui/widget/page-sizer.cpp | 19 +------------------ src/ui/widget/panel.cpp | 7 +------ src/ui/widget/point.cpp | 5 +---- src/ui/widget/preferences-widget.cpp | 7 +------ src/ui/widget/preferences-widget.h | 1 - src/ui/widget/random.cpp | 2 +- src/ui/widget/registered-widget.cpp | 12 +----------- src/ui/widget/rendering-options.cpp | 2 +- src/ui/widget/rotateable.cpp | 3 +-- src/ui/widget/selected-style.cpp | 9 +-------- src/ui/widget/spin-scale.cpp | 2 -- src/ui/widget/spin-slider.cpp | 1 - src/ui/widget/spinbutton.cpp | 2 +- src/ui/widget/style-subject.cpp | 1 - src/ui/widget/style-swatch.cpp | 6 ------ src/ui/widget/tolerance-slider.cpp | 2 +- 137 files changed, 77 insertions(+), 770 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index d581dbf7e..09ba9a1a9 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -27,9 +27,6 @@ // TODO: reduce header bloat if possible #include "file.h" // for file_import, used in _pasteImage -#include -#include -#include #include #include // for g_file_set_contents etc., used in _onGet and paste #include "inkgc/gc-core.h" @@ -41,7 +38,6 @@ #include "desktop-style.h" // for sp_desktop_set_style, used in _pasteStyle #include "document.h" #include "document-private.h" -#include "selection.h" #include "message-stack.h" #include "context-fns.h" #include "ui/tools/dropper-tool.h" // used in copy() @@ -50,17 +46,13 @@ #include "extension/input.h" #include "extension/output.h" #include "selection-chemistry.h" -#include <2geom/rect.h> #include <2geom/transforms.h> #include "box3d.h" #include "gradient-drag.h" #include "sp-marker.h" -#include "sp-item.h" #include "sp-item-transform.h" // for sp_item_scale_rel, used in _pasteSize #include "sp-path.h" #include "sp-pattern.h" -#include "sp-shape.h" -#include "sp-gradient.h" #include "sp-gradient-reference.h" #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" @@ -68,8 +60,6 @@ #include "sp-mask.h" #include "sp-textpath.h" #include "sp-rect.h" -#include "sp-use.h" -#include "sp-symbol.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" @@ -83,9 +73,7 @@ #include "helper/png-write.h" #include "svg/svg-color.h" #include "sp-namedview.h" -#include "snap.h" #include "persp3d.h" -#include "preferences.h" /// Made up mimetype to represent Gdk::Pixbuf clipboard contents. #define CLIPBOARD_GDK_PIXBUF_TARGET "image/x-gdk-pixbuf" diff --git a/src/ui/control-manager.cpp b/src/ui/control-manager.cpp index a2c977533..973625574 100644 --- a/src/ui/control-manager.cpp +++ b/src/ui/control-manager.cpp @@ -17,7 +17,6 @@ #include #include "display/sodipodi-ctrl.h" // for SP_TYPE_CTRL -#include "display/sp-canvas-item.h" #include "display/sp-ctrlline.h" #include "display/sp-ctrlcurve.h" #include "preferences.h" diff --git a/src/ui/dialog-events.cpp b/src/ui/dialog-events.cpp index 8856631c0..d7d56fa50 100644 --- a/src/ui/dialog-events.cpp +++ b/src/ui/dialog-events.cpp @@ -12,17 +12,14 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include #include -#include #include "macros.h" -#include #include "desktop.h" #include "inkscape.h" -#include "preferences.h" #include "ui/tools/tool-base.h" #include "ui/dialog-events.h" diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 8f87932b8..f269d1cb9 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -18,7 +18,7 @@ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "align-and-distribute.h" @@ -27,13 +27,10 @@ #include "unclump.h" #include "document.h" -#include "enums.h" #include "graphlayout.h" #include "inkscape.h" -#include "macros.h" #include "preferences.h" #include "removeoverlap.h" -#include "selection.h" #include "sp-flowtext.h" #include "sp-item-transform.h" #include "sp-text.h" diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index b727c87ee..bdb826384 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -15,13 +15,11 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include "clonetiler.h" -#include - #include #include <2geom/transforms.h> #include @@ -31,23 +29,15 @@ #include "display/cairo-utils.h" #include "display/drawing.h" #include "display/drawing-context.h" -#include "display/drawing-item.h" #include "document.h" #include "document-undo.h" #include "filter-chemistry.h" #include "ui/widget/unit-menu.h" -#include "util/units.h" #include "helper/window.h" #include "inkscape.h" #include "ui/interface.h" -#include "macros.h" #include "message-stack.h" -#include "preferences.h" -#include "selection.h" -#include "sp-filter.h" #include "sp-namedview.h" -#include "sp-use.h" -#include "style.h" #include "svg/svg-color.h" #include "svg/svg.h" #include "ui/icon-names.h" @@ -55,8 +45,6 @@ #include "unclump.h" #include "verbs.h" #include "widgets/icon.h" -#include "xml/repr.h" -#include "sp-root.h" using Inkscape::DocumentUndo; using Inkscape::Util::unit_table; diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp index 34cdb92e3..df4ab6485 100644 --- a/src/ui/dialog/color-item.cpp +++ b/src/ui/dialog/color-item.cpp @@ -12,15 +12,13 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include #include #include -#include -#include #include "color-item.h" @@ -34,16 +32,10 @@ #include "io/resource.h" #include "io/sys.h" #include "message-context.h" -#include "sp-gradient.h" -#include "sp-item.h" #include "svg/svg-color.h" -#include "xml/node.h" -#include "xml/repr.h" #include "verbs.h" #include "widgets/gradient-vector.h" -#include "color.h" // for SP_RGBA32_U_COMPOSE - namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/debug.cpp b/src/ui/dialog/debug.cpp index d127261c0..d5ce6a160 100644 --- a/src/ui/dialog/debug.cpp +++ b/src/ui/dialog/debug.cpp @@ -10,13 +10,12 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include #include #include -#include #include #include #include diff --git a/src/ui/dialog/desktop-tracker.cpp b/src/ui/dialog/desktop-tracker.cpp index 0659de67b..c18711a55 100644 --- a/src/ui/dialog/desktop-tracker.cpp +++ b/src/ui/dialog/desktop-tracker.cpp @@ -6,7 +6,6 @@ */ #include "widgets/desktop-widget.h" -#include #include "desktop-tracker.h" diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 49853277c..c53112656 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -14,7 +14,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "ui/dialog/dialog-manager.h" @@ -45,11 +45,8 @@ #include "ui/dialog/panel-dialog.h" #include "ui/dialog/layers.h" #include "ui/dialog/icon-preview.h" -#include "ui/dialog/floating-behavior.h" -#include "ui/dialog/dock-behavior.h" //#include "ui/dialog/print-colors-preview-dialog.h" #include "util/ege-appear-time-tracker.h" -#include "preferences.h" #include "ui/dialog/object-attributes.h" #include "ui/dialog/object-properties.h" #include "ui/dialog/text-edit.h" diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 27d88bae7..d0b618c65 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -14,7 +14,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "dialog-manager.h" @@ -27,13 +27,10 @@ #include "desktop.h" #include "shortcuts.h" -#include "preferences.h" #include "ui/interface.h" #include "verbs.h" #include "ui/tool/event-utils.h" -#include - #define MIN_ONSCREEN_DISTANCE 50 diff --git a/src/ui/dialog/dock-behavior.cpp b/src/ui/dialog/dock-behavior.cpp index 50a6db208..ec630c08f 100644 --- a/src/ui/dialog/dock-behavior.cpp +++ b/src/ui/dialog/dock-behavior.cpp @@ -12,7 +12,7 @@ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "dock-behavior.h" @@ -23,15 +23,11 @@ #include "ui/widget/dock.h" #include "verbs.h" #include "dialog.h" -#include "preferences.h" #include "ui/dialog-events.h" #include -#include #include -#include - namespace Inkscape { namespace UI { namespace Dialog { diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index da1facc08..40495456b 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -15,13 +15,12 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "document-metadata.h" #include "desktop.h" -#include "inkscape.h" #include "rdf.h" #include "sp-namedview.h" #include "ui/widget/entity-entry.h" diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 589973162..b2c6c6d9f 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -25,27 +25,17 @@ #include "ui/widget/notebook-page.h" #include "document-properties.h" #include "display/canvas-grid.h" -#include "document.h" -#include "desktop.h" -#include "inkscape.h" #include "io/sys.h" -#include "preferences.h" #include "ui/shape-editor.h" -#include "sp-namedview.h" #include "sp-root.h" #include "sp-script.h" #include "style.h" -#include "svg/stringstream.h" #include "ui/tools-switch.h" -#include "ui/widget/color-picker.h" -#include "ui/widget/scalar-unit.h" #include "ui/dialog/filedialog.h" #include "verbs.h" #include "widgets/icon.h" #include "xml/node-event-vector.h" -#include "xml/repr.h" -#include // std::min #include "rdf.h" #include "ui/widget/entity-entry.h" @@ -54,11 +44,8 @@ #include "color-profile.h" #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -#include #include -#include -#include <2geom/transforms.h> #include "ui/icon-names.h" using std::pair; diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 2fb5f9e3b..2e78be8ac 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -24,37 +24,28 @@ #include #include #include -#include -#include #include #include -#include + #if WITH_GTKMM_3_0 # include #else # include #endif -#include -#include #ifdef WITH_GNOME_VFS # include // gnome_vfs_initialized #endif #include -#include #include "ui/widget/unit-menu.h" -#include "util/units.h" #include "helper/window.h" #include "inkscape.h" #include "document.h" #include "document-undo.h" -#include "sp-item.h" -#include "selection.h" #include "file.h" -#include "macros.h" #include "sp-namedview.h" #include "selection-chemistry.h" @@ -89,17 +80,12 @@ #include #endif -#include - #define SP_EXPORT_MIN_SIZE 1.0 #define DPI_BASE Inkscape::Util::Quantity::convert(1, "in", "px") #define EXPORT_COORD_PRECISION 3 -#include "../../document.h" -#include "../../document-undo.h" -#include "verbs.h" #include "export.h" using Inkscape::Util::unit_table; diff --git a/src/ui/dialog/extension-editor.cpp b/src/ui/dialog/extension-editor.cpp index 9bdddc0e0..84840f22d 100644 --- a/src/ui/dialog/extension-editor.cpp +++ b/src/ui/dialog/extension-editor.cpp @@ -12,14 +12,13 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "extension-editor.h" #include #include -#include #include #include @@ -27,7 +26,6 @@ #include "preferences.h" #include "ui/interface.h" -#include "extension/extension.h" #include "extension/db.h" namespace Inkscape { diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp index 4e4b0278a..ee673aecf 100644 --- a/src/ui/dialog/filedialog.cpp +++ b/src/ui/dialog/filedialog.cpp @@ -17,14 +17,9 @@ #include "filedialogimpl-win32.h" #include "filedialogimpl-gtkmm.h" -#include "filedialog.h" -#include "inkgc/gc-core.h" #include "ui/dialog-events.h" #include "extension/output.h" -#include "preferences.h" - -#include namespace Inkscape { diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index 8141f7696..fa69851e4 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -22,7 +22,6 @@ #include "fill-and-stroke.h" #include "filter-chemistry.h" #include "inkscape.h" -#include "selection.h" #include "preferences.h" #include "style.h" #include "svg/css-ostringstream.h" @@ -32,12 +31,9 @@ #include "widgets/icon.h" #include "widgets/paint-selector.h" #include "widgets/stroke-style.h" -#include "xml/repr.h" #include "ui/view/view-widget.h" -#include - namespace Inkscape { namespace UI { namespace Dialog { diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index d3ad5d1da..e733d1b72 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -16,7 +16,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "dialog-manager.h" @@ -28,57 +28,36 @@ #include "ui/widget/spinbutton.h" -#include #include -#include -#include #include "desktop.h" -#include "dir-util.h" #include "document.h" #include "document-undo.h" #include "filter-chemistry.h" #include "filter-effects-dialog.h" #include "filter-enums.h" #include "inkscape.h" -#include "path-prefix.h" -#include "preferences.h" -#include "selection.h" #include "filters/blend.h" #include "filters/colormatrix.h" #include "filters/componenttransfer.h" #include "filters/componenttransfer-funcnode.h" -#include "filters/composite.h" #include "filters/convolvematrix.h" -#include "filters/displacementmap.h" #include "filters/distantlight.h" -#include "filters/gaussian-blur.h" #include "filters/merge.h" #include "filters/mergenode.h" -#include "filters/offset.h" #include "filters/pointlight.h" #include "filters/spotlight.h" -#include "sp-filter-primitive.h" #include "style.h" #include "svg/svg-color.h" -#include "svg/stringstream.h" #include "ui/dialog/filedialog.h" #include "verbs.h" -#include "xml/node.h" -#include "xml/node-observer.h" -#include "xml/repr.h" -#include #include "io/sys.h" -#include #include "selection-chemistry.h" -#include #include -#include -#include #include #include diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index 0f368c5ac..aa26342df 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -11,30 +11,25 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "find.h" #include -#include #include "verbs.h" #include "message-stack.h" #include "helper/window.h" -#include "macros.h" #include "inkscape.h" #include "desktop.h" #include "document.h" #include "document-undo.h" -#include "selection.h" #include "ui/dialog-events.h" -#include "verbs.h" #include "ui/interface.h" -#include "preferences.h" #include "sp-text.h" #include "sp-flowtext.h" #include "sp-flowdiv.h" @@ -51,16 +46,13 @@ #include "sp-line.h" #include "sp-polyline.h" #include "sp-item-group.h" -#include "sp-use.h" #include "sp-image.h" #include "sp-offset.h" #include "sp-root.h" -#include "xml/repr.h" #include "xml/node-iterators.h" #include "xml/attribute-record.h" #include -#include namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp index 55ef0c5bb..2a4a6c028 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -11,13 +11,11 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include #include -#include -#include #include "floating-behavior.h" #include "dialog.h" @@ -26,7 +24,6 @@ #include "desktop.h" #include "ui/dialog-events.h" #include "ui/interface.h" -#include "preferences.h" #include "verbs.h" namespace Inkscape { diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index f219f3db6..0a96188ca 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -7,7 +7,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include @@ -21,16 +21,11 @@ #include "inkscape.h" #include "desktop.h" #include "document.h" -#include "selection.h" #include "ui/dialog-events.h" #include "selection-chemistry.h" -#include "preferences.h" -#include "xml/repr.h" - -#include "sp-defs.h" #include "sp-root.h" #include "sp-text.h" #include "sp-textpath.h" @@ -45,7 +40,6 @@ #include "libnrtype/font-instance.h" #include -#include namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 56b001291..7ce3eabfc 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -14,9 +14,7 @@ #include #include #include -#include #include -#include #include #include @@ -26,9 +24,6 @@ # include #endif -#include -#include - #include "desktop.h" #include "document.h" // for SPDocumentUndo::done() #include "document-undo.h" diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 639e463ea..8d83814b4 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -16,14 +16,12 @@ //#define DEBUG_GRID_ARRANGE 1 #include "ui/dialog/grid-arrange-tab.h" -#include //for GTK_RESPONSE* types #include #include #if WITH_GTKMM_3_0 # include #else -# include #endif #include <2geom/transforms.h> @@ -32,10 +30,8 @@ #include "preferences.h" #include "inkscape.h" -#include "selection.h" #include "document.h" #include "document-undo.h" -#include "sp-item.h" #include "widgets/icon.h" #include "desktop.h" //#include "sp-item-transform.h" FIXME diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 556d77a28..469bd5155 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -14,7 +14,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "guides.h" @@ -30,12 +30,8 @@ #include #include "ui/dialog-events.h" #include "message-context.h" -#include "xml/repr.h" #include "verbs.h" -#include <2geom/point.h> -#include <2geom/angle.h> - #include namespace Inkscape { diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 83656a1f2..8709a5855 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -14,15 +14,13 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include #include #include -#include -#include #include #include @@ -35,10 +33,7 @@ #include "display/drawing.h" #include "document.h" #include "inkscape.h" -#include "preferences.h" -#include "selection.h" #include "sp-root.h" -#include "xml/repr.h" #include "verbs.h" #include "icon-preview.h" diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 6dd62d3bb..d53e3dd73 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -19,30 +19,20 @@ #include "inkscape-preferences.h" #include -#include -#include #include -#include -#include #include #include "preferences.h" #include "verbs.h" #include "selcue.h" -#include "util/units.h" -#include -#include "enums.h" #include "extension/internal/gdkpixbuf-input.h" #include "message-stack.h" #include "style.h" #include "selection.h" #include "selection-chemistry.h" -#include "xml/repr.h" #include "ui/widget/style-swatch.h" -#include "ui/widget/spinbutton.h" #include "display/nr-filter-gaussian.h" -#include "display/nr-filter-types.h" #include "cms-system.h" #include "color-profile.h" #include "display/canvas-grid.h" diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index d1abcfc58..ea8ccf8fb 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -19,7 +19,6 @@ # include "config.h" #endif -#include #include #include "ui/widget/preferences-widget.h" #include "ui/widget/button.h" diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 8343cd6fe..1bfb59ae5 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -15,18 +15,12 @@ #include "ui/widget/panel.h" #include "ui/widget/frame.h" -#include #include -#include #include #include #include #include -#include -#include -#include -#include #include #include #include @@ -40,10 +34,7 @@ # include #endif -#include -#include #include -#include #include "device-manager.h" #include "preferences.h" diff --git a/src/ui/dialog/knot-properties.cpp b/src/ui/dialog/knot-properties.cpp index a91a09a4f..133ed6f4c 100644 --- a/src/ui/dialog/knot-properties.cpp +++ b/src/ui/dialog/knot-properties.cpp @@ -14,12 +14,10 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "ui/dialog/knot-properties.h" #include -#include -#include #include #include "inkscape.h" #include "util/units.h" @@ -27,15 +25,8 @@ #include "document.h" #include "document-undo.h" #include "layer-manager.h" -#include "message-stack.h" -#include "sp-object.h" -#include "sp-item.h" -#include "verbs.h" -#include "selection.h" #include "selection-chemistry.h" -#include "ui/icon-names.h" -#include "ui/widget/imagetoggler.h" //#include "event-context.h" diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index 5d550ed48..9af91eb92 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -15,7 +15,6 @@ #include "layer-properties.h" #include -#include #include #include "inkscape.h" #include "desktop.h" @@ -24,10 +23,7 @@ #include "layer-manager.h" #include "message-stack.h" -#include "sp-object.h" -#include "sp-item.h" #include "verbs.h" -#include "selection.h" #include "selection-chemistry.h" #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 1c022ecad..ce4fbeedc 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -10,36 +10,25 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "layers.h" -#include #include -#include -#include - -#include -#include #include "desktop.h" #include "desktop-style.h" #include "document.h" #include "document-undo.h" #include "helper/action.h" -#include "helper/action-context.h" #include "inkscape.h" #include "layer-fns.h" #include "layer-manager.h" -#include "preferences.h" -#include "sp-item.h" -#include "sp-object.h" #include "svg/css-ostringstream.h" #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" #include "verbs.h" #include "widgets/icon.h" -#include "xml/repr.h" #include "sp-root.h" #include "ui/tools/tool-base.h" #include "selection-chemistry.h" diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp index c558eddaf..3602b04df 100644 --- a/src/ui/dialog/livepatheffect-add.cpp +++ b/src/ui/dialog/livepatheffect-add.cpp @@ -9,7 +9,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "livepatheffect-add.h" @@ -17,7 +17,6 @@ #include #include "desktop.h" -#include "live_effects/effect-enum.h" namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 422ec10ae..ac64143f1 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -13,20 +13,16 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "livepatheffect-editor.h" -#include #include -#include -#include #include "desktop.h" #include "document.h" #include "document-undo.h" -#include "gtkmm/widget.h" #include "helper/action.h" #include "inkscape.h" #include "live_effects/effect.h" @@ -34,19 +30,14 @@ #include "live_effects/lpeobject-reference.h" #include "path-chemistry.h" #include "selection-chemistry.h" -#include "selection.h" #include "sp-item-group.h" -#include "sp-lpe-item.h" #include "sp-path.h" #include "sp-rect.h" -#include "sp-use.h" #include "sp-text.h" -#include "sp-shape.h" #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" #include "verbs.h" #include "widgets/icon.h" -#include "xml/node.h" #include "livepatheffect-add.h" namespace Inkscape { diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index b0cc91868..d33ee758d 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -5,30 +5,20 @@ */ #ifdef HAVE_CONFIG_H -#include +#include "config.h" #endif #include #include "lpe-fillet-chamfer-properties.h" #include -#include #include #include "inkscape.h" #include "desktop.h" -#include "document.h" #include "document-undo.h" #include "layer-manager.h" #include "message-stack.h" -#include "sp-object.h" -#include "sp-item.h" -#include "verbs.h" -#include "selection.h" #include "selection-chemistry.h" -#include "ui/icon-names.h" -#include "ui/widget/imagetoggler.h" -#include "live_effects/parameter/parameter.h" -#include //#include "event-context.h" diff --git a/src/ui/dialog/lpe-powerstroke-properties.cpp b/src/ui/dialog/lpe-powerstroke-properties.cpp index a6dcce907..d5b3bb30d 100644 --- a/src/ui/dialog/lpe-powerstroke-properties.cpp +++ b/src/ui/dialog/lpe-powerstroke-properties.cpp @@ -14,29 +14,18 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "lpe-powerstroke-properties.h" #include -#include -#include #include #include "inkscape.h" #include "desktop.h" -#include "document.h" #include "document-undo.h" #include "layer-manager.h" -#include "message-stack.h" -#include "sp-object.h" -#include "sp-item.h" -#include "verbs.h" -#include "selection.h" #include "selection-chemistry.h" -#include "ui/icon-names.h" -#include "ui/widget/imagetoggler.h" -#include "live_effects/parameter/parameter.h" //#include "event-context.h" namespace Inkscape { diff --git a/src/ui/dialog/memory.cpp b/src/ui/dialog/memory.cpp index c0bc884fa..f2813d4ce 100644 --- a/src/ui/dialog/memory.cpp +++ b/src/ui/dialog/memory.cpp @@ -11,11 +11,10 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "ui/dialog/memory.h" -#include #include #include #include diff --git a/src/ui/dialog/messages.cpp b/src/ui/dialog/messages.cpp index df02215fe..3a8e7338d 100644 --- a/src/ui/dialog/messages.cpp +++ b/src/ui/dialog/messages.cpp @@ -11,7 +11,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "messages.h" diff --git a/src/ui/dialog/new-from-template.cpp b/src/ui/dialog/new-from-template.cpp index 74ec7111e..96fa72791 100644 --- a/src/ui/dialog/new-from-template.cpp +++ b/src/ui/dialog/new-from-template.cpp @@ -9,14 +9,13 @@ */ #if HAVE_CONFIG_H - #include "config.h" +#include "config.h" #endif #include "new-from-template.h" #include "file.h" #include -#include namespace Inkscape { diff --git a/src/ui/dialog/object-attributes.cpp b/src/ui/dialog/object-attributes.cpp index 1bc570f43..72520d3d0 100644 --- a/src/ui/dialog/object-attributes.cpp +++ b/src/ui/dialog/object-attributes.cpp @@ -23,15 +23,12 @@ #include "ui/dialog/dialog-manager.h" #include "desktop.h" -#include "macros.h" #include "sp-anchor.h" #include "sp-image.h" #include "verbs.h" -#include "xml/repr.h" #include "ui/dialog/object-attributes.h" #include "widgets/sp-attribute-widget.h" #include "inkscape.h" -#include "selection.h" #include namespace Inkscape { diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index be46129c4..545c240fc 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -33,11 +33,8 @@ #include "document-undo.h" #include "verbs.h" #include "inkscape.h" -#include "selection.h" #include "desktop.h" -#include "sp-item.h" #include "sp-image.h" -#include "xml/repr.h" #include #if WITH_GTKMM_3_0 diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 27694a9ac..007c48b71 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -10,19 +10,13 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "objects.h" -#include #include -#include -#include #include -#include -#include - #include "desktop.h" #include "desktop-style.h" #include "ui/dialog-events.h" @@ -34,12 +28,8 @@ #include "helper/action.h" #include "inkscape.h" #include "layer-manager.h" -#include "preferences.h" -#include "selection.h" #include "sp-clippath.h" #include "sp-mask.h" -#include "sp-item.h" -#include "sp-object.h" #include "sp-root.h" #include "sp-shape.h" #include "style.h" @@ -52,13 +42,10 @@ #include "ui/widget/clipmaskicon.h" #include "ui/widget/highlight-picker.h" #include "ui/tools/node-tool.h" -#include "ui/tools/tool-base.h" #include "verbs.h" #include "ui/widget/color-notebook.h" #include "widgets/icon.h" -#include "xml/node.h" #include "xml/node-observer.h" -#include "xml/repr.h" //#define DUMP_LAYERS 1 diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index f2ee79d06..e271f190e 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -18,16 +18,10 @@ #include "ocaldialogs.h" -#include // rename() -#include // close() -#include // errno -#include // strerror() - #include "path-prefix.h" #include "filedialogimpl-gtkmm.h" #include "ui/interface.h" #include "inkgc/gc-core.h" -#include "ui/dialog-events.h" #include "io/sys.h" #include "preferences.h" @@ -37,12 +31,7 @@ #include #include -#include -#include #include -#include -#include -#include #include "ui/icon-names.h" namespace Inkscape diff --git a/src/ui/dialog/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp index f557ff0fc..62e6bf591 100644 --- a/src/ui/dialog/pixelartdialog.cpp +++ b/src/ui/dialog/pixelartdialog.cpp @@ -31,7 +31,6 @@ #include #include -#include //for GTK_RESPONSE* types #include #include "ui/widget/spinbutton.h" @@ -41,18 +40,13 @@ #include "desktop-tracker.h" #include "message-stack.h" #include "selection.h" -#include "preferences.h" #include "sp-image.h" #include "display/cairo-utils.h" #include "libdepixelize/kopftracer2011.h" -#include #include "document.h" -#include "xml/repr.h" -#include "xml/document.h" #include "svg/svg.h" #include "svg/svg-color.h" -#include "color.h" #include "svg/css-ostringstream.h" #include "document-undo.h" diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index 5ec1285c1..da914dcd4 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -17,10 +17,8 @@ #include "preferences.h" #include "inkscape.h" -#include "selection.h" #include "document.h" #include "document-undo.h" -#include "sp-item.h" #include "widgets/icon.h" #include "desktop.h" #include "sp-ellipse.h" diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index c44d645a5..9ebbf040c 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include @@ -26,7 +26,6 @@ #include "extension/internal/cairo-render-context.h" #include "extension/internal/cairo-renderer.h" -#include "ui/widget/rendering-options.h" #include "document.h" #include "util/units.h" diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp index 6da8acb20..61fa4c22b 100644 --- a/src/ui/dialog/spellcheck.cpp +++ b/src/ui/dialog/spellcheck.cpp @@ -17,25 +17,18 @@ #include "message-stack.h" #include "helper/window.h" -#include "macros.h" #include "inkscape.h" #include "document.h" -#include "selection.h" #include "desktop.h" #include "ui/tools-switch.h" #include "ui/tools/text-tool.h" #include "ui/interface.h" -#include "preferences.h" -#include "sp-text.h" #include "sp-flowtext.h" #include "text-editing.h" -#include "sp-tspan.h" #include "sp-tref.h" #include "sp-defs.h" #include "selection-chemistry.h" -#include -#include "display/canvas-bpath.h" #include "display/curve.h" #include "document-undo.h" #include "sp-root.h" @@ -47,7 +40,7 @@ #endif #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 08ebbcf14..c940931ed 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -12,21 +12,18 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "svg-fonts-dialog.h" #include "document-private.h" #include "document-undo.h" #include -#include #include #include #include #include "selection.h" -#include #include "svg/svg.h" -#include "xml/node.h" #include "xml/repr.h" #include "sp-font-face.h" #include "desktop.h" @@ -39,7 +36,6 @@ #include "sp-glyph-kerning.h" #include -#include SvgFontDrawingArea::SvgFontDrawingArea(): _x(0), diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 6577c8d4e..fdc8efe1b 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -22,9 +22,6 @@ #include #include -#include -#include -#include #include "color-item.h" #include "desktop.h" @@ -35,28 +32,20 @@ #include "document-undo.h" #include "extension/db.h" #include "inkscape.h" -#include "inkscape.h" #include "io/sys.h" #include "io/resource.h" #include "message-context.h" #include "path-prefix.h" -#include "preferences.h" -#include "sp-item.h" -#include "sp-gradient.h" -#include "sp-gradient-vector.h" #include "style.h" #include "ui/previewholder.h" #include "widgets/desktop-widget.h" #include "widgets/gradient-vector.h" -#include "widgets/eek-preview.h" #include "display/cairo-utils.h" #include "sp-gradient-reference.h" #include "dialog-manager.h" -#include "selection.h" #include "verbs.h" #include "gradient-chemistry.h" #include "helper/action.h" -#include "helper/action-context.h" namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 06c17611f..8433073a6 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -32,10 +31,6 @@ #include #include #include -#include -#include -#include -#include #include #include "path-prefix.h" #include "io/sys.h" @@ -76,8 +71,6 @@ #include "verbs.h" #include "helper/action.h" -#include "helper/action-context.h" -#include "xml/repr.h" namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index c99c1bff3..d03c781f3 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -10,17 +10,11 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "tags.h" -#include #include -#include -#include - -#include -#include #include "desktop.h" #include "desktop-style.h" @@ -30,28 +24,19 @@ #include "inkscape.h" #include "layer-fns.h" #include "layer-manager.h" -#include "preferences.h" -#include "sp-item.h" -#include "sp-object.h" #include "sp-shape.h" #include "svg/css-ostringstream.h" -#include "ui/icon-names.h" #include "ui/widget/layertypeicon.h" #include "ui/widget/addtoicon.h" #include "verbs.h" #include "widgets/icon.h" -#include "xml/node.h" #include "xml/node-observer.h" -#include "xml/repr.h" #include "sp-root.h" #include "ui/tools/tool-base.h" //"event-context.h" -#include "selection.h" //#include "dialogs/dialog-events.h" #include "ui/widget/color-notebook.h" #include "style.h" #include "filter-chemistry.h" -#include "filters/blend.h" -#include "filters/gaussian-blur.h" #include "sp-clippath.h" #include "sp-mask.h" #include "sp-tag.h" diff --git a/src/ui/dialog/template-load-tab.cpp b/src/ui/dialog/template-load-tab.cpp index 7eb04ff79..780da4ce3 100644 --- a/src/ui/dialog/template-load-tab.cpp +++ b/src/ui/dialog/template-load-tab.cpp @@ -9,28 +9,17 @@ */ #include "template-widget.h" -#include "template-load-tab.h" #include "new-from-template.h" #include #include -#include -#include -#include -#include #include -#include #include "extension/db.h" -#include "extension/effect.h" #include "inkscape.h" #include "ui/interface.h" #include "file.h" #include "path-prefix.h" -#include "preferences.h" -#include "xml/repr.h" -#include "xml/document.h" -#include "xml/node.h" namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/template-widget.cpp b/src/ui/dialog/template-widget.cpp index 0d110d853..93b44fefe 100644 --- a/src/ui/dialog/template-widget.cpp +++ b/src/ui/dialog/template-widget.cpp @@ -11,14 +11,8 @@ #include "template-widget.h" #include -#include -#include #include -#include -#include - -#include "template-load-tab.h" #include "desktop.h" #include "document.h" diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index c01da8864..73d2cd042 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -22,7 +22,6 @@ #include "text-edit.h" #include -#include #ifdef WITH_GTKSPELL extern "C" { @@ -31,11 +30,8 @@ extern "C" { #endif #include -#include #include -#include -#include "macros.h" #include "helper/window.h" #include "inkscape.h" #include "document.h" @@ -43,20 +39,16 @@ extern "C" { #include "desktop-style.h" #include "document-undo.h" -#include "selection.h" -#include "style.h" #include "sp-text.h" #include "sp-flowtext.h" #include "text-editing.h" #include "ui/icon-names.h" -#include "preferences.h" #include "verbs.h" #include "ui/interface.h" #include "svg/css-ostringstream.h" #include "widgets/icon.h" #include "widgets/font-selector.h" #include -#include #include "util/units.h" #include "sp-textpath.h" diff --git a/src/ui/dialog/tracedialog.cpp b/src/ui/dialog/tracedialog.cpp index 11e75391b..a264d83c8 100644 --- a/src/ui/dialog/tracedialog.cpp +++ b/src/ui/dialog/tracedialog.cpp @@ -12,7 +12,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "tracedialog.h" @@ -20,10 +20,8 @@ #include #include "ui/widget/spinbutton.h" #include "ui/widget/frame.h" -#include #include -#include //for GTK_RESPONSE* types #include #include "desktop.h" diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index b7638e8c1..031bc5ae1 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -12,7 +12,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include @@ -26,15 +26,11 @@ #include "transformation.h" #include "align-and-distribute.h" #include "inkscape.h" -#include "selection.h" #include "selection-chemistry.h" #include "message-stack.h" #include "verbs.h" -#include "preferences.h" #include "sp-namedview.h" #include "sp-item-transform.h" -#include "macros.h" -#include "sp-item.h" #include "ui/icon-names.h" #include "widgets/icon.h" diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index a50a169eb..38fab8f07 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -12,18 +12,14 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "undo-history.h" -#include -#include -#include #include "document.h" #include "document-undo.h" #include "inkscape.h" -#include "verbs.h" #include "util/signal-blocker.h" diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index 99a4acc69..c2711bb02 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -18,7 +18,6 @@ #include "xml-tree.h" #include "widgets/icon.h" -#include #include #include @@ -31,18 +30,14 @@ #include "helper/window.h" #include "inkscape.h" #include "ui/interface.h" -#include "macros.h" #include "message-context.h" #include "message-stack.h" -#include "preferences.h" -#include "selection.h" #include "shortcuts.h" #include "sp-root.h" #include "sp-string.h" #include "sp-tspan.h" #include "ui/icon-names.h" #include "verbs.h" -#include "widgets/icon.h" #include "widgets/sp-xmlview-attr-list.h" #include "widgets/sp-xmlview-content.h" diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index ab29471ed..16fc5c474 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include "ui/dialog/dialog-manager.h" @@ -35,25 +35,20 @@ #include "extension/input.h" #include "widgets/icon.h" #include "preferences.h" -#include "path-prefix.h" #include "shortcuts.h" #include "document.h" #include "ui/interface.h" #include "desktop.h" -#include "selection.h" #include "selection-chemistry.h" #include "svg-view-widget.h" #include "widgets/desktop-widget.h" #include "sp-item-group.h" #include "sp-text.h" -#include "sp-gradient.h" #include "sp-flowtext.h" #include "sp-namedview.h" #include "sp-root.h" -#include "ui/view/view.h" #include "helper/action.h" -#include "helper/action-context.h" #include "helper/gnome-utils.h" #include "helper/window.h" #include "io/sys.h" @@ -63,7 +58,6 @@ #include "ui/clipboard.h" #include "display/sp-canvas.h" -#include "color.h" #include "svg/svg-color.h" #include "desktop-style.h" #include "style.h" @@ -74,7 +68,6 @@ #include "sp-anchor.h" #include "sp-clippath.h" #include "sp-image.h" -#include "sp-item.h" #include "sp-mask.h" #include "message-stack.h" #include "ui/dialog/layer-properties.h" @@ -83,10 +76,6 @@ #include "widgets/image-menu-item.h" #endif -#include - -#include - using Inkscape::DocumentUndo; /* Drag and Drop */ diff --git a/src/ui/object-edit.cpp b/src/ui/object-edit.cpp index 459acf002..90676dc5f 100644 --- a/src/ui/object-edit.cpp +++ b/src/ui/object-edit.cpp @@ -12,11 +12,9 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif - - #include "sp-item.h" #include "sp-rect.h" #include "box3d.h" @@ -32,12 +30,10 @@ #include "sp-namedview.h" #include "live_effects/effect.h" #include "sp-pattern.h" -#include "sp-path.h" #include #include "ui/object-edit.h" -#include "xml/repr.h" -#include <2geom/math-utils.h> #include "knot-holder-entity.h" +#include #define sp_round(v,m) (((v) < 0.0) ? ((ceil((v) / (m) - 0.5)) * (m)) : ((floor((v) / (m) + 0.5)) * (m))) diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index 5e75179a3..ac1369ced 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -12,7 +12,6 @@ #include "previewholder.h" -#include "preferences.h" #include #include diff --git a/src/ui/selected-color.cpp b/src/ui/selected-color.cpp index 846d50a5b..08f4bd979 100644 --- a/src/ui/selected-color.cpp +++ b/src/ui/selected-color.cpp @@ -11,7 +11,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include diff --git a/src/ui/shape-editor.cpp b/src/ui/shape-editor.cpp index aec5cde27..98320ed8c 100644 --- a/src/ui/shape-editor.cpp +++ b/src/ui/shape-editor.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include @@ -16,11 +16,8 @@ #include "desktop.h" #include "document.h" -#include "gc-anchored.h" #include "knotholder.h" #include "ui/object-edit.h" -#include "sp-item.h" -#include "sp-object.h" #include "ui/shape-editor.h" #include "xml/node-event-vector.h" diff --git a/src/ui/tool-factory.cpp b/src/ui/tool-factory.cpp index c6c579c9e..f101e5a24 100644 --- a/src/ui/tool-factory.cpp +++ b/src/ui/tool-factory.cpp @@ -27,14 +27,12 @@ #include "ui/tools/mesh-tool.h" #include "ui/tools/node-tool.h" #include "ui/tools/pencil-tool.h" -#include "ui/tools/pen-tool.h" #include "ui/tools/rect-tool.h" #include "ui/tools/select-tool.h" #include "ui/tools/spiral-tool.h" #include "ui/tools/spray-tool.h" #include "ui/tools/star-tool.h" #include "ui/tools/text-tool.h" -#include "ui/tools/tool-base.h" #include "ui/tools/tweak-tool.h" #include "ui/tools/zoom-tool.h" diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp index f36ad7374..a5611addc 100644 --- a/src/ui/tool/control-point-selection.cpp +++ b/src/ui/tool/control-point-selection.cpp @@ -13,7 +13,6 @@ #include "ui/tool/selectable-control-point.h" #include <2geom/transforms.h> #include "desktop.h" -#include "preferences.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" #include "ui/tool/transform-handle-set.h" diff --git a/src/ui/tool/control-point.cpp b/src/ui/tool/control-point.cpp index 636595016..d9374c790 100644 --- a/src/ui/tool/control-point.cpp +++ b/src/ui/tool/control-point.cpp @@ -16,8 +16,6 @@ #include "display/snap-indicator.h" #include "ui/tools/tool-base.h" #include "message-context.h" -#include "preferences.h" -#include "snap-preferences.h" #include "sp-namedview.h" #include "ui/control-manager.h" #include "ui/tool/control-point.h" diff --git a/src/ui/tool/curve-drag-point.cpp b/src/ui/tool/curve-drag-point.cpp index e460b0fb7..908e18474 100644 --- a/src/ui/tool/curve-drag-point.cpp +++ b/src/ui/tool/curve-drag-point.cpp @@ -8,15 +8,12 @@ #include "ui/tool/curve-drag-point.h" #include -#include <2geom/bezier-curve.h> #include "desktop.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/path-manipulator.h" -#include "ui/tool/node.h" #include "sp-namedview.h" -#include "snap.h" namespace Inkscape { namespace UI { diff --git a/src/ui/tool/manipulator.cpp b/src/ui/tool/manipulator.cpp index 11dd220f4..82ff014e4 100644 --- a/src/ui/tool/manipulator.cpp +++ b/src/ui/tool/manipulator.cpp @@ -8,8 +8,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "ui/tool/node.h" -#include "ui/tool/manipulator.h" +//#include "ui/tool/node.h" +//#include "ui/tool/manipulator.h" namespace Inkscape { namespace UI { diff --git a/src/ui/tool/modifier-tracker.cpp b/src/ui/tool/modifier-tracker.cpp index cc4e4d0b2..f502acab2 100644 --- a/src/ui/tool/modifier-tracker.cpp +++ b/src/ui/tool/modifier-tracker.cpp @@ -12,7 +12,6 @@ #include #include "ui/tool/event-utils.h" #include "ui/tool/modifier-tracker.h" -#include namespace Inkscape { namespace UI { diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 9ec6f733f..f30c7e349 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -19,13 +19,11 @@ #include "document-undo.h" #include "live_effects/lpeobject.h" #include "message-stack.h" -#include "preferences.h" #include "sp-path.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/path-manipulator.h" -#include "util/unordered-containers.h" #include "verbs.h" #include diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 9268d9730..0e5a9279d 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -12,25 +12,20 @@ #include "multi-path-manipulator.h" #include #include <2geom/bezier-utils.h> -#include <2geom/transforms.h> #include "display/sp-ctrlline.h" #include "display/sp-canvas.h" #include "display/sp-canvas-util.h" #include "desktop.h" -#include "preferences.h" #include "snap.h" -#include "snap-preferences.h" #include "sp-namedview.h" #include "ui/control-manager.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" -#include "ui/tool/node.h" #include "ui/tool/path-manipulator.h" #include "ui/tools/node-tool.h" #include "ui/tools-switch.h" #include -#include namespace { diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index de071dad3..f316bea38 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -13,36 +13,23 @@ #include "live_effects/lpe-powerstroke.h" #include "live_effects/lpe-bspline.h" #include "live_effects/lpe-fillet-chamfer.h" -#include -#include -#include -#include -#include -#include <2geom/bezier-curve.h> #include <2geom/bezier-utils.h> #include <2geom/path-sink.h> -#include #include "ui/tool/path-manipulator.h" -#include "desktop.h" #include "display/sp-canvas.h" #include "display/sp-canvas-util.h" #include "display/curve.h" #include "display/canvas-bpath.h" -#include "document.h" -#include "live_effects/effect.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" -#include "sp-path.h" #include "helper/geom.h" -#include "preferences.h" #include "style.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/curve-drag-point.h" #include "ui/tool/event-utils.h" #include "ui/tool/multi-path-manipulator.h" -#include "xml/node.h" #include "xml/node-observer.h" namespace Inkscape { diff --git a/src/ui/tool/selector.cpp b/src/ui/tool/selector.cpp index 9acf7de88..84e96173d 100644 --- a/src/ui/tool/selector.cpp +++ b/src/ui/tool/selector.cpp @@ -14,7 +14,6 @@ #include "display/sodipodi-ctrlrect.h" #include "ui/tools/tool-base.h" -#include "preferences.h" #include "ui/tool/event-utils.h" #include "ui/tool/selector.h" diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp index 748b9d4cc..33015fe11 100644 --- a/src/ui/tool/transform-handle-set.cpp +++ b/src/ui/tool/transform-handle-set.cpp @@ -18,11 +18,7 @@ #include "sp-namedview.h" #include "display/sodipodi-ctrlrect.h" -#include "preferences.h" #include "pure-transform.h" -#include "snap.h" -#include "snap-candidate.h" -#include "sp-namedview.h" #include "ui/tool/commit-events.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/selectable-control-point.h" diff --git a/src/ui/tools-switch.cpp b/src/ui/tools-switch.cpp index ea0431b0a..d87bcc51d 100644 --- a/src/ui/tools-switch.cpp +++ b/src/ui/tools-switch.cpp @@ -13,16 +13,11 @@ #include // prevents deprecation warnings -#include -#include - #include "inkscape.h" #include "desktop.h" #include -#include - #include "ui/tools-switch.h" #include "box3d.h" @@ -52,7 +47,6 @@ #include "ui/tools/measure-tool.h" #include "ui/tools/mesh-tool.h" #include "ui/tools/node-tool.h" -#include "ui/tools/pen-tool.h" #include "ui/tools/pencil-tool.h" #include "ui/tools/rect-tool.h" #include "ui/tools/select-tool.h" diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp index c6a9bb23a..6652f7ab5 100644 --- a/src/ui/tools/arc-tool.cpp +++ b/src/ui/tools/arc-tool.cpp @@ -17,7 +17,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -30,7 +30,6 @@ #include "sp-namedview.h" #include "selection.h" -#include "snap.h" #include "pixmaps/cursor-ellipse.xpm" #include "xml/repr.h" #include "xml/node-event-vector.h" diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp index 27e755add..9b5b264bc 100644 --- a/src/ui/tools/box3d-tool.cpp +++ b/src/ui/tools/box3d-tool.cpp @@ -15,8 +15,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "config.h" - #include #include "macros.h" @@ -27,8 +25,6 @@ #include "selection.h" #include "selection-chemistry.h" -#include "snap.h" -#include "display/curve.h" #include "display/sp-canvas-item.h" #include "desktop.h" #include "message-context.h" @@ -36,17 +32,12 @@ #include "box3d.h" #include "ui/tools/box3d-tool.h" #include -#include "xml/repr.h" #include "xml/node-event-vector.h" -#include "preferences.h" #include "context-fns.h" #include "desktop-style.h" -#include "transf_mat_3x4.h" #include "perspective-line.h" -#include "persp3d.h" #include "box3d-side.h" #include "document-private.h" -#include "line-geometry.h" #include "ui/shape-editor.h" #include "verbs.h" diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp index 28195eb75..84c4adc89 100644 --- a/src/ui/tools/calligraphic-tool.cpp +++ b/src/ui/tools/calligraphic-tool.cpp @@ -23,8 +23,6 @@ #define noDYNA_DRAW_VERBOSE -#include "config.h" - #include #include #include @@ -35,12 +33,10 @@ #include "svg/svg.h" #include "display/canvas-bpath.h" #include "display/cairo-utils.h" -#include <2geom/math-utils.h> #include <2geom/pathvector.h> #include <2geom/bezier-utils.h> #include <2geom/circle.h> #include "display/curve.h" -#include #include "macros.h" #include "document.h" #include "document-undo.h" @@ -50,20 +46,15 @@ #include "desktop-style.h" #include "message-context.h" -#include "preferences.h" #include "pixmaps/cursor-calligraphy.xpm" -#include "xml/repr.h" #include "context-fns.h" -#include "sp-item.h" #include "inkscape.h" -#include "color.h" #include "splivarot.h" #include "sp-item-group.h" #include "sp-shape.h" #include "sp-path.h" #include "sp-text.h" #include "display/sp-canvas.h" -#include "display/canvas-bpath.h" #include "display/canvas-arena.h" #include "livarot/Shape.h" #include "verbs.h" diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp index 74f2664fe..605b573d7 100644 --- a/src/ui/tools/connector-tool.cpp +++ b/src/ui/tools/connector-tool.cpp @@ -75,7 +75,6 @@ #include "ui/tools/connector-tool.h" #include "pixmaps/cursor-connector.xpm" #include "xml/node-event-vector.h" -#include "xml/repr.h" #include "svg/svg.h" #include "desktop.h" #include "desktop-style.h" @@ -86,19 +85,13 @@ #include "message-stack.h" #include "selection.h" #include "inkscape.h" -#include "preferences.h" #include "sp-path.h" #include "display/sp-canvas.h" #include "display/canvas-bpath.h" -#include "display/sodipodi-ctrl.h" #include #include #include "snap.h" -#include "knot.h" #include "sp-conn-end.h" -#include "sp-conn-end-pair.h" -#include "conn-avoid-ref.h" -#include "libavoid/vertices.h" #include "libavoid/router.h" #include "context-fns.h" #include "sp-namedview.h" diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp index c838c27d5..4db720686 100644 --- a/src/ui/tools/dropper-tool.cpp +++ b/src/ui/tools/dropper-tool.cpp @@ -12,7 +12,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -27,7 +27,6 @@ #include "display/curve.h" #include "display/cairo-utils.h" #include "svg/svg-color.h" -#include "color.h" #include "color-rgba.h" #include "desktop-style.h" #include "preferences.h" @@ -36,7 +35,6 @@ #include "desktop.h" #include "selection.h" -#include "document.h" #include "document-undo.h" #include "pixmaps/cursor-dropper-f.xpm" @@ -45,7 +43,6 @@ #include "ui/tools/dropper-tool.h" #include "message-context.h" #include "verbs.h" -#include "ui/tools/tool-base.h" using Inkscape::DocumentUndo; diff --git a/src/ui/tools/dynamic-base.cpp b/src/ui/tools/dynamic-base.cpp index eb789d850..6627a470e 100644 --- a/src/ui/tools/dynamic-base.cpp +++ b/src/ui/tools/dynamic-base.cpp @@ -1,13 +1,7 @@ #include "ui/tools/dynamic-base.h" -#include - -#include "config.h" - #include "message-context.h" -#include "streq.h" -#include "preferences.h" #include "display/sp-canvas-item.h" #include "desktop.h" #include "display/curve.h" diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 6b32b5901..838522b34 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -24,8 +24,6 @@ #define noERASER_VERBOSE -#include "config.h" - #include #include #include @@ -38,7 +36,6 @@ #include "display/canvas-bpath.h" #include <2geom/bezier-utils.h> -#include #include "macros.h" #include "document.h" #include "selection.h" @@ -47,26 +44,18 @@ #include "desktop-style.h" #include "message-context.h" -#include "preferences.h" #include "pixmaps/cursor-eraser.xpm" -#include "xml/repr.h" #include "context-fns.h" -#include "sp-item.h" -#include "color.h" #include "rubberband.h" #include "splivarot.h" #include "sp-item-group.h" #include "sp-shape.h" #include "sp-path.h" #include "sp-text.h" -#include "display/canvas-bpath.h" #include "display/canvas-arena.h" -#include "livarot/Shape.h" #include "document-undo.h" #include "verbs.h" #include "style.h" -#include "style-enums.h" -#include <2geom/math-utils.h> #include <2geom/pathvector.h> #include "path-chemistry.h" #include "display/curve.h" diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index 748c82717..2f125e6ed 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -18,14 +18,13 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include "trace/potrace/inkscape-potrace.h" #include <2geom/pathvector.h> #include #include -#include #include #include "color.h" @@ -36,7 +35,6 @@ #include "display/cairo-utils.h" #include "display/drawing-context.h" #include "display/drawing-image.h" -#include "display/drawing-item.h" #include "display/drawing.h" #include "display/sp-canvas.h" #include "document.h" @@ -47,23 +45,15 @@ #include "macros.h" #include "message-context.h" #include "message-stack.h" -#include "preferences.h" #include "rubberband.h" #include "selection.h" #include "ui/shape-editor.h" -#include "sp-defs.h" -#include "sp-item.h" #include "splivarot.h" #include "sp-namedview.h" -#include "sp-object.h" -#include "sp-path.h" -#include "sp-rect.h" #include "sp-root.h" #include "svg/svg.h" #include "trace/imagemap.h" -#include "trace/trace.h" #include "xml/node-event-vector.h" -#include "xml/repr.h" #include "verbs.h" #include "pixmaps/cursor-paintbucket.xpm" diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 7697cd59c..eb29ed88d 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -17,43 +17,29 @@ #define DRAW_VERBOSE #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include "live_effects/lpe-bendpath.h" #include "live_effects/lpe-patternalongpath.h" #include "live_effects/lpe-simplify.h" #include "display/canvas-bpath.h" -#include "xml/repr.h" #include "svg/svg.h" -#include #include "display/curve.h" -#include "desktop.h" #include "desktop-style.h" -#include "document.h" #include "ui/draw-anchor.h" #include "macros.h" #include "message-stack.h" #include "ui/tools/pen-tool.h" #include "ui/tools/lpe-tool.h" -#include "preferences.h" -#include "selection.h" #include "selection-chemistry.h" -#include "snap.h" -#include "sp-path.h" -#include "sp-use.h" #include "sp-item-group.h" -#include "sp-namedview.h" #include "live_effects/lpe-powerstroke.h" #include "style.h" #include "ui/control-manager.h" -#include "util/units.h" // clipboard support #include "ui/clipboard.h" -#include "ui/tools/freehand-base.h" - -#include using Inkscape::DocumentUndo; diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp index 9d8101cc4..e4814c3de 100644 --- a/src/ui/tools/gradient-tool.cpp +++ b/src/ui/tools/gradient-tool.cpp @@ -13,7 +13,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif @@ -31,17 +31,10 @@ #include "ui/tools/gradient-tool.h" #include "gradient-chemistry.h" #include -#include "preferences.h" #include "gradient-drag.h" -#include "gradient-chemistry.h" -#include "xml/repr.h" -#include "sp-item.h" #include "display/sp-ctrlline.h" -#include "sp-linear-gradient.h" -#include "sp-radial-gradient.h" #include "sp-stop.h" #include "svg/css-ostringstream.h" -#include "svg/svg-color.h" #include "snap.h" #include "sp-namedview.h" #include "rubberband.h" diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp index 9bbc1ac20..ee85dd28c 100644 --- a/src/ui/tools/lpe-tool.cpp +++ b/src/ui/tools/lpe-tool.cpp @@ -15,19 +15,16 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include <2geom/sbasis-geometric.h> -#include #include -#include "macros.h" #include "pixmaps/cursor-crosshairs.xpm" #include #include "desktop.h" #include "message-context.h" -#include "preferences.h" #include "ui/shape-editor.h" #include "selection.h" diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index 63e2460ec..c941b9bee 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -11,11 +11,10 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include -#include #include #include "util/units.h" #include "display/curve.h" @@ -23,7 +22,6 @@ #include "display/sp-ctrlline.h" #include "display/sp-ctrlcurve.h" #include "display/sp-canvas.h" -#include "display/sp-canvas-item.h" #include "display/sp-canvas-util.h" #include "svg/svg.h" #include "svg/svg-color.h" @@ -31,34 +29,20 @@ #include "ui/tools/freehand-base.h" #include <2geom/line.h> #include <2geom/path-intersection.h> -#include <2geom/pathvector.h> -#include <2geom/crossing.h> -#include <2geom/angle.h> -#include <2geom/transforms.h> #include "ui/dialog/knot-properties.h" #include "sp-namedview.h" -#include "sp-shape.h" #include "sp-text.h" #include "sp-flowtext.h" #include "sp-defs.h" -#include "sp-item.h" #include "sp-root.h" -#include "macros.h" #include "svg/stringstream.h" #include "rubberband.h" #include "path-chemistry.h" #include "desktop.h" -#include "document.h" #include "document-undo.h" -#include "viewbox.h" -#include "snap.h" -#include "knot.h" #include "text-editing.h" #include "pixmaps/cursor-measure.xpm" -#include "preferences.h" #include "inkscape.h" -#include "enums.h" -#include "knot-enums.h" #include "desktop-style.h" #include "verbs.h" #include diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 47927667c..32e70bc19 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif //#define DEBUG_MESH @@ -33,7 +33,6 @@ #include "macros.h" #include "message-context.h" #include "message-stack.h" -#include "preferences.h" #include "rubberband.h" #include "selection.h" #include "snap.h" diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 23aaf6bb1..bf18d4a2e 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -24,25 +24,19 @@ #include "message-context.h" #include "selection.h" #include "ui/shape-editor.h" // temporary! -#include "live_effects/effect.h" -#include "display/curve.h" #include "snap.h" #include "sp-namedview.h" #include "sp-clippath.h" #include "sp-item-group.h" #include "sp-mask.h" -#include "sp-object-group.h" -#include "sp-path.h" #include "sp-text.h" #include "ui/control-manager.h" #include "ui/tools/node-tool.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" -#include "ui/tool/manipulator.h" #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/path-manipulator.h" #include "ui/tool/selector.h" -#include "ui/tool/shape-record.h" #include "pixmaps/cursor-node.xpm" #include "pixmaps/cursor-node-d.xpm" diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 18af8e105..49f28ad2c 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -32,8 +32,6 @@ #include "ui/draw-anchor.h" #include "message-stack.h" #include "message-context.h" -#include "preferences.h" -#include "sp-path.h" #include "display/sp-canvas.h" #include "display/curve.h" #include "pixmaps/cursor-pen.xpm" @@ -46,7 +44,6 @@ #include "ui/tools-switch.h" #include "ui/control-manager.h" // we include the necessary files for BSpline & Spiro -#include "live_effects/effect.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" @@ -54,25 +51,16 @@ #include "live_effects/lpe-spiro.h" -#include -#include <2geom/pathvector.h> -#include <2geom/affine.h> #include <2geom/curves.h> #include "helper/geom-nodetype.h" -#include "helper/geom-curves.h" // For handling un-continuous paths: -#include "message-stack.h" #include "inkscape.h" -#include "desktop.h" #include "live_effects/spiro.h" #define INKSCAPE_LPE_BSPLINE_C #include "live_effects/lpe-bspline.h" -#include <2geom/nearest-time.h> - -#include "live_effects/effect.h" using Inkscape::ControlManager; diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index b029ca613..7cc695040 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -27,7 +27,6 @@ #include "message-stack.h" #include "message-context.h" #include "sp-path.h" -#include "preferences.h" #include "snap.h" #include "pixmaps/cursor-pencil.xpm" #include <2geom/sbasis-to-bezier.h> @@ -36,13 +35,9 @@ #include #include "context-fns.h" #include "sp-namedview.h" -#include "xml/repr.h" -#include "document.h" #include "desktop-style.h" -#include "macros.h" #include "display/sp-canvas.h" #include "display/curve.h" -#include "livarot/Path.h" #include "ui/tool/event-utils.h" namespace Inkscape { diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp index 844965c4d..00330ef57 100644 --- a/src/ui/tools/rect-tool.cpp +++ b/src/ui/tools/rect-tool.cpp @@ -14,8 +14,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "config.h" - #include #include #include @@ -29,16 +27,13 @@ #include "selection.h" #include "selection-chemistry.h" -#include "snap.h" #include "desktop.h" #include "desktop-style.h" #include "message-context.h" #include "pixmaps/cursor-rect.xpm" #include "ui/tools/rect-tool.h" #include -#include "xml/repr.h" #include "xml/node-event-vector.h" -#include "preferences.h" #include "context-fns.h" #include "ui/shape-editor.h" #include "verbs.h" diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index b5ec3d88e..5d802d4da 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include #include @@ -40,14 +40,12 @@ #include "desktop.h" #include "sp-root.h" -#include "preferences.h" #include "ui/tools-switch.h" #include "message-stack.h" #include "selection-describer.h" #include "seltrans.h" #include "box3d.h" #include "display/sp-canvas.h" -#include "display/sp-canvas-item.h" #include "display/drawing-item.h" using Inkscape::DocumentUndo; diff --git a/src/ui/tools/spiral-tool.cpp b/src/ui/tools/spiral-tool.cpp index 833fef18d..0ba08853e 100644 --- a/src/ui/tools/spiral-tool.cpp +++ b/src/ui/tools/spiral-tool.cpp @@ -14,8 +14,6 @@ * Released under GNU GPL */ -#include "config.h" - #include #include #include @@ -28,16 +26,13 @@ #include "sp-namedview.h" #include "selection.h" -#include "snap.h" #include "desktop.h" #include "desktop-style.h" #include "message-context.h" #include "pixmaps/cursor-spiral.xpm" #include "ui/tools/spiral-tool.h" #include -#include "xml/repr.h" #include "xml/node-event-vector.h" -#include "preferences.h" #include "context-fns.h" #include "ui/shape-editor.h" #include "verbs.h" diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 9adaf3879..3fafac2a7 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -19,15 +19,12 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "config.h" - #include #include "ui/dialog/dialog-manager.h" #include "svg/svg.h" -#include #include "macros.h" #include "document.h" #include "document-undo.h" @@ -37,10 +34,7 @@ #include "message-context.h" #include "pixmaps/cursor-spray.xpm" -#include -#include "xml/repr.h" #include "context-fns.h" -#include "sp-item.h" #include "inkscape.h" #include "splivarot.h" @@ -57,17 +51,12 @@ #include "svg/svg-color.h" #include "sp-text.h" -#include "sp-root.h" #include "sp-flowtext.h" #include "display/sp-canvas.h" -#include "display/canvas-bpath.h" #include "display/canvas-arena.h" #include "display/curve.h" #include "livarot/Shape.h" #include <2geom/circle.h> -#include <2geom/transforms.h> -#include "preferences.h" -#include "style.h" #include "box3d.h" #include "sp-item-transform.h" #include "filter-chemistry.h" @@ -76,9 +65,6 @@ #include "helper/action.h" #include "verbs.h" -#include - -#include #include #include diff --git a/src/ui/tools/star-tool.cpp b/src/ui/tools/star-tool.cpp index 9190ae57b..ddee08189 100644 --- a/src/ui/tools/star-tool.cpp +++ b/src/ui/tools/star-tool.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include @@ -31,14 +31,11 @@ #include "sp-namedview.h" #include "selection.h" -#include "snap.h" #include "desktop.h" #include "desktop-style.h" #include "message-context.h" #include "pixmaps/cursor-star.xpm" #include -#include "preferences.h" -#include "xml/repr.h" #include "xml/node-event-vector.h" #include "context-fns.h" #include "ui/shape-editor.h" diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp index 1888551cf..559187764 100644 --- a/src/ui/tools/text-tool.cpp +++ b/src/ui/tools/text-tool.cpp @@ -14,7 +14,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -23,7 +23,6 @@ #include #include #include -#include #include "context-fns.h" @@ -36,7 +35,6 @@ #include "message-stack.h" #include "pixmaps/cursor-text-insert.xpm" #include "pixmaps/cursor-text.xpm" -#include "preferences.h" #include "rubberband.h" #include "selection-chemistry.h" #include "selection.h" @@ -50,8 +48,6 @@ #include "ui/control-manager.h" #include "verbs.h" #include "xml/node-event-vector.h" -#include "xml/repr.h" -#include using Inkscape::ControlManager; using Inkscape::DocumentUndo; diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 72ba499de..735f5bd42 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include "widgets/desktop-widget.h" @@ -24,12 +24,8 @@ #include "file.h" #include "ui/tools/tool-base.h" -#include #include -#include #include -#include -#include #include "display/sp-canvas.h" #include "xml/node-event-vector.h" @@ -43,18 +39,14 @@ #include "ui/interface.h" #include "macros.h" #include "ui/tools-switch.h" -#include "preferences.h" #include "message-context.h" #include "gradient-drag.h" -#include "attributes.h" #include "rubberband.h" #include "selcue.h" #include "ui/tools/lpe-tool.h" #include "ui/tool/control-point.h" #include "ui/shape-editor.h" #include "sp-guide.h" -#include "color.h" -#include "knot.h" #include "knot-ptr.h" // globals for temporary switching to selector by space diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index 39a7a3f0b..fbf1b2a0b 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -11,8 +11,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "config.h" - #include #include #include @@ -21,7 +19,6 @@ #include "svg/svg.h" -#include #include "macros.h" #include "document.h" #include "document-undo.h" @@ -48,19 +45,13 @@ #include "pixmaps/cursor-push.xpm" #include "pixmaps/cursor-roughen.xpm" #include "pixmaps/cursor-color.xpm" -#include -#include "xml/repr.h" #include "context-fns.h" -#include "sp-item.h" #include "inkscape.h" -#include "color.h" -#include "svg/svg-color.h" #include "splivarot.h" #include "sp-item-group.h" #include "sp-shape.h" #include "sp-path.h" #include "path-chemistry.h" -#include "sp-gradient.h" #include "sp-stop.h" #include "sp-gradient-reference.h" #include "sp-linear-gradient.h" @@ -69,13 +60,10 @@ #include "sp-text.h" #include "sp-flowtext.h" #include "display/sp-canvas.h" -#include "display/canvas-bpath.h" #include "display/canvas-arena.h" #include "display/curve.h" #include "livarot/Shape.h" -#include <2geom/transforms.h> #include <2geom/circle.h> -#include "preferences.h" #include "style.h" #include "box3d.h" #include "sp-item-transform.h" diff --git a/src/ui/tools/zoom-tool.cpp b/src/ui/tools/zoom-tool.cpp index 13e097c18..ca42d2d6f 100644 --- a/src/ui/tools/zoom-tool.cpp +++ b/src/ui/tools/zoom-tool.cpp @@ -21,7 +21,6 @@ #include "desktop.h" #include "pixmaps/cursor-zoom.xpm" #include "pixmaps/cursor-zoom-out.xpm" -#include "preferences.h" #include "selection-chemistry.h" #include "ui/tools/zoom-tool.h" diff --git a/src/ui/uxmanager.cpp b/src/ui/uxmanager.cpp index 036659661..cbce86cdb 100644 --- a/src/ui/uxmanager.cpp +++ b/src/ui/uxmanager.cpp @@ -10,18 +10,15 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include "widgets/desktop-widget.h" -#include #include "uxmanager.h" #include "desktop.h" #include "util/ege-tags.h" #include "widgets/toolbox.h" -#include "preferences.h" -#include "gdkmm/screen.h" #ifdef GDK_WINDOWING_X11 #include diff --git a/src/ui/view/view.h b/src/ui/view/view.h index 21a5d0dfc..7ff14afd9 100644 --- a/src/ui/view/view.h +++ b/src/ui/view/view.h @@ -11,14 +11,13 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include -#include #include #include "message.h" #include "inkgc/gc-managed.h" #include "gc-finalized.h" #include "gc-anchored.h" #include <2geom/forward.h> +#include /** * Iterates until true or returns false. diff --git a/src/ui/widget/addtoicon.cpp b/src/ui/widget/addtoicon.cpp index 10294125d..465423fc2 100644 --- a/src/ui/widget/addtoicon.cpp +++ b/src/ui/widget/addtoicon.cpp @@ -9,7 +9,7 @@ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "ui/widget/addtoicon.h" @@ -19,9 +19,7 @@ #include "widgets/icon.h" #include "widgets/toolbox.h" #include "ui/icon-names.h" -#include "preferences.h" #include "layertypeicon.h" -#include "addtoicon.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/anchor-selector.cpp b/src/ui/widget/anchor-selector.cpp index df00b786a..acf8aff79 100644 --- a/src/ui/widget/anchor-selector.cpp +++ b/src/ui/widget/anchor-selector.cpp @@ -8,7 +8,6 @@ */ #include "ui/widget/anchor-selector.h" -#include #include "widgets/icon.h" #include "ui/icon-names.h" diff --git a/src/ui/widget/clipmaskicon.cpp b/src/ui/widget/clipmaskicon.cpp index 421f1df1e..8715fdede 100644 --- a/src/ui/widget/clipmaskicon.cpp +++ b/src/ui/widget/clipmaskicon.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "ui/widget/clipmaskicon.h" diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp index e4f58fe8a..52c6ed2e3 100644 --- a/src/ui/widget/color-icc-selector.cpp +++ b/src/ui/widget/color-icc-selector.cpp @@ -2,14 +2,11 @@ #include "config.h" #endif -#include #include #include #include -#include #include -#include #include "ui/dialog-events.h" #include "ui/widget/color-icc-selector.h" diff --git a/src/ui/widget/color-notebook.cpp b/src/ui/widget/color-notebook.cpp index 6d7ada734..6634d8dad 100644 --- a/src/ui/widget/color-notebook.cpp +++ b/src/ui/widget/color-notebook.cpp @@ -20,10 +20,6 @@ #endif #include "widgets/icon.h" -#include -#include -#include -#include #include #include #include diff --git a/src/ui/widget/color-scales.cpp b/src/ui/widget/color-scales.cpp index 48a2693bc..832bc3a62 100644 --- a/src/ui/widget/color-scales.cpp +++ b/src/ui/widget/color-scales.cpp @@ -3,15 +3,13 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif -#include #include #include #include -#include "svg/svg-icc-color.h" #include "ui/dialog-events.h" #include "ui/widget/color-scales.h" #include "ui/widget/color-slider.h" diff --git a/src/ui/widget/color-slider.cpp b/src/ui/widget/color-slider.cpp index 0c9586a67..bf2156628 100644 --- a/src/ui/widget/color-slider.cpp +++ b/src/ui/widget/color-slider.cpp @@ -12,11 +12,10 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include -#include #include #include #if WITH_GTKMM_3_0 diff --git a/src/ui/widget/color-wheel-selector.cpp b/src/ui/widget/color-wheel-selector.cpp index 22c616325..decb02b4f 100644 --- a/src/ui/widget/color-wheel-selector.cpp +++ b/src/ui/widget/color-wheel-selector.cpp @@ -1,18 +1,14 @@ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include "color-wheel-selector.h" -#include -#include #include #include #include #include -#include "svg/svg-icc-color.h" #include "ui/dialog-events.h" -#include "ui/selected-color.h" #include "ui/widget/color-scales.h" #include "ui/widget/color-slider.h" #include "ui/widget/gimpcolorwheel.h" diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 8d960ddc3..910135fc1 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -9,16 +9,13 @@ #include "ui/widget/dock.h" -#include "dock-item.h" #include "desktop.h" #include "inkscape.h" -#include "preferences.h" #include "ui/icon-names.h" #include "widgets/icon.h" #include #include -#include namespace Inkscape { namespace UI { diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index a8de2f384..381f0a2e1 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -14,14 +14,13 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include #include #include "inkscape.h" -#include "sp-object.h" #include "rdf.h" #include "ui/widget/registry.h" #include "sp-root.h" diff --git a/src/ui/widget/entry.cpp b/src/ui/widget/entry.cpp index 64d28119a..b1dd9ae8e 100644 --- a/src/ui/widget/entry.cpp +++ b/src/ui/widget/entry.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "entry.h" diff --git a/src/ui/widget/filter-effect-chooser.cpp b/src/ui/widget/filter-effect-chooser.cpp index 242a99073..ae2f3e7c2 100644 --- a/src/ui/widget/filter-effect-chooser.cpp +++ b/src/ui/widget/filter-effect-chooser.cpp @@ -10,12 +10,8 @@ */ #include "filter-effect-chooser.h" -#include - -#include "desktop.h" #include "document.h" -#include "inkscape.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/font-variants.cpp b/src/ui/widget/font-variants.cpp index 62598dead..aca85f246 100644 --- a/src/ui/widget/font-variants.cpp +++ b/src/ui/widget/font-variants.cpp @@ -8,26 +8,18 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include #include #include -#include #include "font-variants.h" // For updating from selection #include "desktop.h" -#include "selection.h" -#include "style.h" #include "sp-text.h" -#include "sp-tspan.h" -#include "sp-tref.h" -#include "sp-textpath.h" -#include "sp-item-group.h" -#include "xml/repr.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/frame.cpp b/src/ui/widget/frame.cpp index eaa4336bb..65d10dcc4 100644 --- a/src/ui/widget/frame.cpp +++ b/src/ui/widget/frame.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "frame.h" diff --git a/src/ui/widget/highlight-picker.cpp b/src/ui/widget/highlight-picker.cpp index 09999b52d..c1068c9b2 100644 --- a/src/ui/widget/highlight-picker.cpp +++ b/src/ui/widget/highlight-picker.cpp @@ -14,9 +14,6 @@ #include "highlight-picker.h" #include "widgets/icon.h" -#include "widgets/toolbox.h" -#include "ui/icon-names.h" -#include namespace Inkscape { namespace UI { diff --git a/src/ui/widget/imageicon.cpp b/src/ui/widget/imageicon.cpp index df261b69a..7d7fb2d3b 100644 --- a/src/ui/widget/imageicon.cpp +++ b/src/ui/widget/imageicon.cpp @@ -15,12 +15,9 @@ #include "imageicon.h" -#include #include "svg-view-widget.h" #include "document.h" #include "inkscape.h" -#include -#include namespace Inkscape diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index 1a9ce617f..7ee34f3b3 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include @@ -25,9 +25,7 @@ #include "document.h" #include "document-undo.h" #include "layer-manager.h" -#include "sp-item.h" #include "ui/icon-names.h" -#include "ui/widget/layer-selector.h" #include "util/filter-list.h" #include "util/reverse-list.h" #include "verbs.h" diff --git a/src/ui/widget/layertypeicon.cpp b/src/ui/widget/layertypeicon.cpp index 672c607e5..e281d982a 100644 --- a/src/ui/widget/layertypeicon.cpp +++ b/src/ui/widget/layertypeicon.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "ui/widget/layertypeicon.h" @@ -18,7 +18,6 @@ #include "widgets/icon.h" #include "widgets/toolbox.h" #include "ui/icon-names.h" -#include "layertypeicon.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index d21e848f2..6acb5a4c7 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -13,7 +13,6 @@ */ #ifdef HAVE_CONFIG_H -# include #endif #include "licensor.h" @@ -27,7 +26,6 @@ #include "document-undo.h" #include "document-private.h" #include "verbs.h" -#include namespace Inkscape { diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index 8acf083d0..c8ac20c54 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -14,8 +14,6 @@ #include "ui/widget/object-composite-settings.h" -#include - #include "desktop.h" #include "desktop-style.h" @@ -23,17 +21,12 @@ #include "document-undo.h" #include "filter-chemistry.h" #include "inkscape.h" -#include "selection.h" #include "style.h" -#include "sp-item.h" #include "svg/css-ostringstream.h" #include "verbs.h" -#include "xml/repr.h" #include "widgets/icon.h" -#include "ui/icon-names.h" #include "display/sp-canvas.h" #include "ui/widget/style-subject.h" -#include "ui/widget/gimpspinscale.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 19ab1a280..4a1fe9ac6 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -18,35 +18,18 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "page-sizer.h" -#include -#include -#include -#include -#include - #include -#include <2geom/transforms.h> - -#include "document.h" -#include "desktop.h" #include "helper/action.h" -#include "helper/action-context.h" -#include "util/units.h" -#include "inkscape.h" -#include "sp-namedview.h" #include "sp-root.h" #include "ui/widget/button.h" -#include "ui/widget/scalar-unit.h" #include "verbs.h" -#include "xml/node.h" -#include "xml/repr.h" using std::pair; using Inkscape::Util::unit_table; diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index ab13577d7..6ccd8b81a 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -12,20 +12,15 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include // for Gtk::RESPONSE_* #include #include -#include -#include -#include #include -#include - #include "panel.h" #include "icon-size.h" #include "preferences.h" diff --git a/src/ui/widget/point.cpp b/src/ui/widget/point.cpp index 6aa6196bb..2c2eb5e8a 100644 --- a/src/ui/widget/point.cpp +++ b/src/ui/widget/point.cpp @@ -12,14 +12,11 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "ui/widget/point.h" -#include "ui/widget/labelled.h" -#include "ui/widget/scalar.h" -#include namespace Inkscape { namespace UI { diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index d56506d62..b4c09cc0f 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -26,19 +26,14 @@ #include "verbs.h" #include "selcue.h" #include "io/sys.h" -#include #include "desktop.h" -#include "enums.h" #include "inkscape.h" #include "message-stack.h" #include "style.h" -#include "selection.h" #include "selection-chemistry.h" #include "ui/dialog/filedialog.h" -#include "xml/repr.h" -#include #include #ifdef WIN32 diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 1d2d77699..cb192bf58 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -19,7 +19,6 @@ # include #endif -#include #include #include diff --git a/src/ui/widget/random.cpp b/src/ui/widget/random.cpp index 0a646b6fb..b6ea16b89 100644 --- a/src/ui/widget/random.cpp +++ b/src/ui/widget/random.cpp @@ -10,7 +10,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 572845668..af59fe1a0 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -14,29 +14,19 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "registered-widget.h" -#include -#include "ui/widget/color-picker.h" -#include "ui/widget/registry.h" -#include "ui/widget/scalar-unit.h" -#include "ui/widget/point.h" -#include "ui/widget/random.h" #include "widgets/spinbutton-events.h" -#include "xml/repr.h" #include "svg/svg-color.h" #include "svg/stringstream.h" #include "verbs.h" // for interruptability bug: -#include "display/sp-canvas.h" - -#include "desktop.h" #include "sp-root.h" diff --git a/src/ui/widget/rendering-options.cpp b/src/ui/widget/rendering-options.cpp index 837387f7b..220731b7e 100644 --- a/src/ui/widget/rendering-options.cpp +++ b/src/ui/widget/rendering-options.cpp @@ -9,7 +9,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include diff --git a/src/ui/widget/rotateable.cpp b/src/ui/widget/rotateable.cpp index 5e938dee6..e0de22335 100644 --- a/src/ui/widget/rotateable.cpp +++ b/src/ui/widget/rotateable.cpp @@ -8,12 +8,11 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include #include -#include #include <2geom/point.h> #include "ui/tools/tool-base.h" #include "rotateable.h" diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index f7fd63f51..299b904c6 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -10,11 +10,10 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "selected-style.h" -#include #include "widgets/spw-utilities.h" #include "ui/widget/color-preview.h" @@ -31,19 +30,14 @@ #include "ui/dialog/dialog-manager.h" #include "ui/dialog/fill-and-stroke.h" #include "ui/dialog/panel-dialog.h" -#include "xml/repr.h" -#include "document.h" #include "document-undo.h" #include "widgets/widget-sizes.h" #include "widgets/spinbutton-events.h" #include "widgets/gradient-image.h" -#include "sp-gradient.h" #include "svg/svg-color.h" #include "svg/css-ostringstream.h" #include "ui/tools/tool-base.h" #include "message-context.h" -#include "verbs.h" -#include "color.h" #include #include "pixmaps/cursor-adj-h.xpm" #include "pixmaps/cursor-adj-s.xpm" @@ -51,7 +45,6 @@ #include "pixmaps/cursor-adj-a.xpm" #include "sp-cursor.h" #include "gradient-chemistry.h" -#include "util/units.h" using Inkscape::Util::unit_table; diff --git a/src/ui/widget/spin-scale.cpp b/src/ui/widget/spin-scale.cpp index bb08d67df..cb95e7405 100644 --- a/src/ui/widget/spin-scale.cpp +++ b/src/ui/widget/spin-scale.cpp @@ -8,9 +8,7 @@ #include "spin-scale.h" -#include #include -#include #include "ui/widget/gimpspinscale.h" diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp index 9b361ae78..4242d8c7d 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -11,7 +11,6 @@ #include "spin-slider.h" #include -#include namespace Inkscape { namespace UI { diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp index d7669d4e5..d1776e630 100644 --- a/src/ui/widget/spinbutton.cpp +++ b/src/ui/widget/spinbutton.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "spinbutton.h" diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index da3bbcd20..811ed2221 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -8,7 +8,6 @@ #include "ui/widget/style-subject.h" #include "desktop.h" -#include "sp-object.h" #include "xml/sp-css-attr.h" #include "desktop-style.h" diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index 188be705d..2952a3f97 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -13,9 +13,6 @@ #include "style-swatch.h" -#include -#include - #include "widgets/spw-utilities.h" #include "ui/widget/color-preview.h" @@ -23,13 +20,10 @@ #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" #include "sp-pattern.h" -#include "xml/repr.h" #include "xml/sp-css-attr.h" #include "widgets/widget-sizes.h" #include "util/units.h" #include "helper/action.h" -#include "helper/action-context.h" -#include "preferences.h" #include "inkscape.h" #include "verbs.h" #include diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index ced811c57..e904666cc 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -9,7 +9,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include -- cgit v1.2.3 From 5c04358b2fd79db36b8064ad5e7a9fd8bbe314bb Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 28 Jul 2016 12:30:52 +0200 Subject: Finish linked path and add local number format (bzr r15017.1.9) --- src/ui/widget/font-selector.cpp | 8 ++++---- src/ui/widget/font-selector.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/widget/font-selector.cpp b/src/ui/widget/font-selector.cpp index 6b0bdca36..0fcb307eb 100644 --- a/src/ui/widget/font-selector.cpp +++ b/src/ui/widget/font-selector.cpp @@ -19,7 +19,7 @@ FontSelector::FontSelector(Glib::ustring const &label, Glib::ustring const &tool Glib::ustring const &suffix, Glib::ustring const &icon, bool mnemonic) - :_widget(new Gtk::HBox()), expanded(false) + :_widget(new Gtk::HBox()), expanded(false), _label(label) { Gtk::VBox * vbox_expander = Gtk::manage( new Gtk::VBox() ); GtkWidget *fontsel = sp_font_selector_new(); @@ -35,7 +35,7 @@ FontSelector::FontSelector(Glib::ustring const &label, Glib::ustring const &tool pButton->set_tooltip_text(_("Save the changes to font selector")); vbox_expander->pack_start(*Gtk::manage(Glib::wrap(fontsel)), true, true); vbox_expander->pack_start(*pButton, true, true); - expander = Gtk::manage(new Gtk::Expander(Glib::ustring(_("Font Selector:")))); + expander = Gtk::manage(new Gtk::Expander(label)); expander->add(*vbox_expander); expander->set_expanded(expanded); expander->set_spacing(5); @@ -52,9 +52,9 @@ FontSelector::onExpanderChanged() { expanded = expander->get_expanded(); if(expanded) { - expander->set_label (Glib::ustring(_("Font Selector:"))); + expander->set_label (Glib::ustring(_label)); } else { - expander->set_label (Glib::ustring(_("Font Selector: hided"))); + expander->set_label (Glib::ustring(_label + _(" hided"))); } } diff --git a/src/ui/widget/font-selector.h b/src/ui/widget/font-selector.h index cfea54bde..8146bc370 100644 --- a/src/ui/widget/font-selector.h +++ b/src/ui/widget/font-selector.h @@ -54,6 +54,7 @@ public: protected: Gtk::Widget *_widget; bool expanded; + Glib::ustring _label; Gtk::Expander * expander; SPFontSelector *fsel; Glib::ustring _fontspec; -- cgit v1.2.3 From 43b49e325db73cc19b1731db6c69545664ee8fbe Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 28 Jul 2016 13:26:17 +0200 Subject: Reverted changes to r15024 after many building problems (bzr r15027) --- src/ui/clipboard.cpp | 12 ++++++++++++ src/ui/control-manager.cpp | 1 + src/ui/dialog-events.cpp | 5 ++++- src/ui/dialog/align-and-distribute.cpp | 5 ++++- src/ui/dialog/clonetiler.cpp | 14 +++++++++++++- src/ui/dialog/color-item.cpp | 10 +++++++++- src/ui/dialog/debug.cpp | 3 ++- src/ui/dialog/desktop-tracker.cpp | 1 + src/ui/dialog/dialog-manager.cpp | 5 ++++- src/ui/dialog/dialog.cpp | 5 ++++- src/ui/dialog/dock-behavior.cpp | 6 +++++- src/ui/dialog/document-metadata.cpp | 3 ++- src/ui/dialog/document-properties.cpp | 13 +++++++++++++ src/ui/dialog/export.cpp | 16 +++++++++++++++- src/ui/dialog/extension-editor.cpp | 4 +++- src/ui/dialog/filedialog.cpp | 5 +++++ src/ui/dialog/fill-and-stroke.cpp | 4 ++++ src/ui/dialog/filter-effects-dialog.cpp | 23 ++++++++++++++++++++++- src/ui/dialog/find.cpp | 10 +++++++++- src/ui/dialog/floating-behavior.cpp | 5 ++++- src/ui/dialog/font-substitution.cpp | 8 +++++++- src/ui/dialog/glyphs.cpp | 5 +++++ src/ui/dialog/grid-arrange-tab.cpp | 4 ++++ src/ui/dialog/guides.cpp | 6 +++++- src/ui/dialog/icon-preview.cpp | 7 ++++++- src/ui/dialog/inkscape-preferences.cpp | 10 ++++++++++ src/ui/dialog/inkscape-preferences.h | 1 + src/ui/dialog/input.cpp | 9 +++++++++ src/ui/dialog/knot-properties.cpp | 11 ++++++++++- src/ui/dialog/layer-properties.cpp | 4 ++++ src/ui/dialog/layers.cpp | 13 ++++++++++++- src/ui/dialog/livepatheffect-add.cpp | 3 ++- src/ui/dialog/livepatheffect-editor.cpp | 11 ++++++++++- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 12 +++++++++++- src/ui/dialog/lpe-powerstroke-properties.cpp | 13 ++++++++++++- src/ui/dialog/memory.cpp | 3 ++- src/ui/dialog/messages.cpp | 2 +- src/ui/dialog/new-from-template.cpp | 3 ++- src/ui/dialog/object-attributes.cpp | 3 +++ src/ui/dialog/object-properties.cpp | 3 +++ src/ui/dialog/objects.cpp | 15 ++++++++++++++- src/ui/dialog/ocaldialogs.cpp | 11 +++++++++++ src/ui/dialog/pixelartdialog.cpp | 6 ++++++ src/ui/dialog/polar-arrange-tab.cpp | 2 ++ src/ui/dialog/print.cpp | 3 ++- src/ui/dialog/spellcheck.cpp | 9 ++++++++- src/ui/dialog/svg-fonts-dialog.cpp | 6 +++++- src/ui/dialog/swatches.cpp | 11 +++++++++++ src/ui/dialog/symbols.cpp | 7 +++++++ src/ui/dialog/tags.cpp | 17 ++++++++++++++++- src/ui/dialog/template-load-tab.cpp | 11 +++++++++++ src/ui/dialog/template-widget.cpp | 6 ++++++ src/ui/dialog/text-edit.cpp | 8 ++++++++ src/ui/dialog/tracedialog.cpp | 4 +++- src/ui/dialog/transformation.cpp | 6 +++++- src/ui/dialog/undo-history.cpp | 6 +++++- src/ui/dialog/xml-tree.cpp | 5 +++++ src/ui/interface.cpp | 13 ++++++++++++- src/ui/object-edit.cpp | 8 ++++++-- src/ui/previewholder.cpp | 1 + src/ui/selected-color.cpp | 2 +- src/ui/shape-editor.cpp | 5 ++++- src/ui/tool-factory.cpp | 2 ++ src/ui/tool/control-point-selection.cpp | 1 + src/ui/tool/control-point.cpp | 2 ++ src/ui/tool/curve-drag-point.cpp | 3 +++ src/ui/tool/manipulator.cpp | 4 ++-- src/ui/tool/modifier-tracker.cpp | 1 + src/ui/tool/multi-path-manipulator.cpp | 2 ++ src/ui/tool/node.cpp | 5 +++++ src/ui/tool/path-manipulator.cpp | 13 +++++++++++++ src/ui/tool/selector.cpp | 1 + src/ui/tool/transform-handle-set.cpp | 4 ++++ src/ui/tools-switch.cpp | 6 ++++++ src/ui/tools/arc-tool.cpp | 3 ++- src/ui/tools/box3d-tool.cpp | 9 +++++++++ src/ui/tools/calligraphic-tool.cpp | 9 +++++++++ src/ui/tools/connector-tool.cpp | 7 +++++++ src/ui/tools/dropper-tool.cpp | 5 ++++- src/ui/tools/dynamic-base.cpp | 6 ++++++ src/ui/tools/eraser-tool.cpp | 11 +++++++++++ src/ui/tools/flood-tool.cpp | 12 +++++++++++- src/ui/tools/freehand-base.cpp | 16 +++++++++++++++- src/ui/tools/gradient-tool.cpp | 9 ++++++++- src/ui/tools/lpe-tool.cpp | 5 ++++- src/ui/tools/measure-tool.cpp | 18 +++++++++++++++++- src/ui/tools/mesh-tool.cpp | 3 ++- src/ui/tools/node-tool.cpp | 6 ++++++ src/ui/tools/pen-tool.cpp | 12 ++++++++++++ src/ui/tools/pencil-tool.cpp | 5 +++++ src/ui/tools/rect-tool.cpp | 5 +++++ src/ui/tools/select-tool.cpp | 4 +++- src/ui/tools/spiral-tool.cpp | 5 +++++ src/ui/tools/spray-tool.cpp | 14 ++++++++++++++ src/ui/tools/star-tool.cpp | 5 ++++- src/ui/tools/text-tool.cpp | 6 +++++- src/ui/tools/tool-base.cpp | 10 +++++++++- src/ui/tools/tweak-tool.cpp | 12 ++++++++++++ src/ui/tools/zoom-tool.cpp | 1 + src/ui/uxmanager.cpp | 5 ++++- src/ui/view/view.h | 3 ++- src/ui/widget/addtoicon.cpp | 4 +++- src/ui/widget/anchor-selector.cpp | 1 + src/ui/widget/clipmaskicon.cpp | 2 +- src/ui/widget/color-icc-selector.cpp | 3 +++ src/ui/widget/color-notebook.cpp | 4 ++++ src/ui/widget/color-scales.cpp | 4 +++- src/ui/widget/color-slider.cpp | 3 ++- src/ui/widget/color-wheel-selector.cpp | 6 +++++- src/ui/widget/dock-item.cpp | 3 +++ src/ui/widget/entity-entry.cpp | 3 ++- src/ui/widget/entry.cpp | 2 +- src/ui/widget/filter-effect-chooser.cpp | 4 ++++ src/ui/widget/font-variants.cpp | 10 +++++++++- src/ui/widget/frame.cpp | 2 +- src/ui/widget/highlight-picker.cpp | 3 +++ src/ui/widget/imageicon.cpp | 3 +++ src/ui/widget/layer-selector.cpp | 4 +++- src/ui/widget/layertypeicon.cpp | 3 ++- src/ui/widget/licensor.cpp | 2 ++ src/ui/widget/object-composite-settings.cpp | 7 +++++++ src/ui/widget/page-sizer.cpp | 19 ++++++++++++++++++- src/ui/widget/panel.cpp | 7 ++++++- src/ui/widget/point.cpp | 5 ++++- src/ui/widget/preferences-widget.cpp | 7 ++++++- src/ui/widget/preferences-widget.h | 1 + src/ui/widget/random.cpp | 2 +- src/ui/widget/registered-widget.cpp | 12 +++++++++++- src/ui/widget/rendering-options.cpp | 2 +- src/ui/widget/rotateable.cpp | 3 ++- src/ui/widget/selected-style.cpp | 9 ++++++++- src/ui/widget/spin-scale.cpp | 2 ++ src/ui/widget/spin-slider.cpp | 1 + src/ui/widget/spinbutton.cpp | 2 +- src/ui/widget/style-subject.cpp | 1 + src/ui/widget/style-swatch.cpp | 6 ++++++ src/ui/widget/tolerance-slider.cpp | 2 +- 137 files changed, 770 insertions(+), 77 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 09ba9a1a9..d581dbf7e 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -27,6 +27,9 @@ // TODO: reduce header bloat if possible #include "file.h" // for file_import, used in _pasteImage +#include +#include +#include #include #include // for g_file_set_contents etc., used in _onGet and paste #include "inkgc/gc-core.h" @@ -38,6 +41,7 @@ #include "desktop-style.h" // for sp_desktop_set_style, used in _pasteStyle #include "document.h" #include "document-private.h" +#include "selection.h" #include "message-stack.h" #include "context-fns.h" #include "ui/tools/dropper-tool.h" // used in copy() @@ -46,13 +50,17 @@ #include "extension/input.h" #include "extension/output.h" #include "selection-chemistry.h" +#include <2geom/rect.h> #include <2geom/transforms.h> #include "box3d.h" #include "gradient-drag.h" #include "sp-marker.h" +#include "sp-item.h" #include "sp-item-transform.h" // for sp_item_scale_rel, used in _pasteSize #include "sp-path.h" #include "sp-pattern.h" +#include "sp-shape.h" +#include "sp-gradient.h" #include "sp-gradient-reference.h" #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" @@ -60,6 +68,8 @@ #include "sp-mask.h" #include "sp-textpath.h" #include "sp-rect.h" +#include "sp-use.h" +#include "sp-symbol.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" @@ -73,7 +83,9 @@ #include "helper/png-write.h" #include "svg/svg-color.h" #include "sp-namedview.h" +#include "snap.h" #include "persp3d.h" +#include "preferences.h" /// Made up mimetype to represent Gdk::Pixbuf clipboard contents. #define CLIPBOARD_GDK_PIXBUF_TARGET "image/x-gdk-pixbuf" diff --git a/src/ui/control-manager.cpp b/src/ui/control-manager.cpp index 973625574..a2c977533 100644 --- a/src/ui/control-manager.cpp +++ b/src/ui/control-manager.cpp @@ -17,6 +17,7 @@ #include #include "display/sodipodi-ctrl.h" // for SP_TYPE_CTRL +#include "display/sp-canvas-item.h" #include "display/sp-ctrlline.h" #include "display/sp-ctrlcurve.h" #include "preferences.h" diff --git a/src/ui/dialog-events.cpp b/src/ui/dialog-events.cpp index d7d56fa50..8856631c0 100644 --- a/src/ui/dialog-events.cpp +++ b/src/ui/dialog-events.cpp @@ -12,14 +12,17 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include #include +#include #include "macros.h" +#include #include "desktop.h" #include "inkscape.h" +#include "preferences.h" #include "ui/tools/tool-base.h" #include "ui/dialog-events.h" diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index f269d1cb9..8f87932b8 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -18,7 +18,7 @@ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "align-and-distribute.h" @@ -27,10 +27,13 @@ #include "unclump.h" #include "document.h" +#include "enums.h" #include "graphlayout.h" #include "inkscape.h" +#include "macros.h" #include "preferences.h" #include "removeoverlap.h" +#include "selection.h" #include "sp-flowtext.h" #include "sp-item-transform.h" #include "sp-text.h" diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index bdb826384..b727c87ee 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -15,11 +15,13 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include "config.h" #endif #include "clonetiler.h" +#include + #include #include <2geom/transforms.h> #include @@ -29,15 +31,23 @@ #include "display/cairo-utils.h" #include "display/drawing.h" #include "display/drawing-context.h" +#include "display/drawing-item.h" #include "document.h" #include "document-undo.h" #include "filter-chemistry.h" #include "ui/widget/unit-menu.h" +#include "util/units.h" #include "helper/window.h" #include "inkscape.h" #include "ui/interface.h" +#include "macros.h" #include "message-stack.h" +#include "preferences.h" +#include "selection.h" +#include "sp-filter.h" #include "sp-namedview.h" +#include "sp-use.h" +#include "style.h" #include "svg/svg-color.h" #include "svg/svg.h" #include "ui/icon-names.h" @@ -45,6 +55,8 @@ #include "unclump.h" #include "verbs.h" #include "widgets/icon.h" +#include "xml/repr.h" +#include "sp-root.h" using Inkscape::DocumentUndo; using Inkscape::Util::unit_table; diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp index df4ab6485..34cdb92e3 100644 --- a/src/ui/dialog/color-item.cpp +++ b/src/ui/dialog/color-item.cpp @@ -12,13 +12,15 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include "config.h" #endif #include #include #include +#include +#include #include "color-item.h" @@ -32,10 +34,16 @@ #include "io/resource.h" #include "io/sys.h" #include "message-context.h" +#include "sp-gradient.h" +#include "sp-item.h" #include "svg/svg-color.h" +#include "xml/node.h" +#include "xml/repr.h" #include "verbs.h" #include "widgets/gradient-vector.h" +#include "color.h" // for SP_RGBA32_U_COMPOSE + namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/debug.cpp b/src/ui/dialog/debug.cpp index d5ce6a160..d127261c0 100644 --- a/src/ui/dialog/debug.cpp +++ b/src/ui/dialog/debug.cpp @@ -10,12 +10,13 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include #include #include +#include #include #include #include diff --git a/src/ui/dialog/desktop-tracker.cpp b/src/ui/dialog/desktop-tracker.cpp index c18711a55..0659de67b 100644 --- a/src/ui/dialog/desktop-tracker.cpp +++ b/src/ui/dialog/desktop-tracker.cpp @@ -6,6 +6,7 @@ */ #include "widgets/desktop-widget.h" +#include #include "desktop-tracker.h" diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index c53112656..49853277c 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -14,7 +14,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "ui/dialog/dialog-manager.h" @@ -45,8 +45,11 @@ #include "ui/dialog/panel-dialog.h" #include "ui/dialog/layers.h" #include "ui/dialog/icon-preview.h" +#include "ui/dialog/floating-behavior.h" +#include "ui/dialog/dock-behavior.h" //#include "ui/dialog/print-colors-preview-dialog.h" #include "util/ege-appear-time-tracker.h" +#include "preferences.h" #include "ui/dialog/object-attributes.h" #include "ui/dialog/object-properties.h" #include "ui/dialog/text-edit.h" diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index d0b618c65..27d88bae7 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -14,7 +14,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "dialog-manager.h" @@ -27,10 +27,13 @@ #include "desktop.h" #include "shortcuts.h" +#include "preferences.h" #include "ui/interface.h" #include "verbs.h" #include "ui/tool/event-utils.h" +#include + #define MIN_ONSCREEN_DISTANCE 50 diff --git a/src/ui/dialog/dock-behavior.cpp b/src/ui/dialog/dock-behavior.cpp index ec630c08f..50a6db208 100644 --- a/src/ui/dialog/dock-behavior.cpp +++ b/src/ui/dialog/dock-behavior.cpp @@ -12,7 +12,7 @@ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "dock-behavior.h" @@ -23,11 +23,15 @@ #include "ui/widget/dock.h" #include "verbs.h" #include "dialog.h" +#include "preferences.h" #include "ui/dialog-events.h" #include +#include #include +#include + namespace Inkscape { namespace UI { namespace Dialog { diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index 40495456b..da1facc08 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -15,12 +15,13 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "document-metadata.h" #include "desktop.h" +#include "inkscape.h" #include "rdf.h" #include "sp-namedview.h" #include "ui/widget/entity-entry.h" diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index b2c6c6d9f..589973162 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -25,17 +25,27 @@ #include "ui/widget/notebook-page.h" #include "document-properties.h" #include "display/canvas-grid.h" +#include "document.h" +#include "desktop.h" +#include "inkscape.h" #include "io/sys.h" +#include "preferences.h" #include "ui/shape-editor.h" +#include "sp-namedview.h" #include "sp-root.h" #include "sp-script.h" #include "style.h" +#include "svg/stringstream.h" #include "ui/tools-switch.h" +#include "ui/widget/color-picker.h" +#include "ui/widget/scalar-unit.h" #include "ui/dialog/filedialog.h" #include "verbs.h" #include "widgets/icon.h" #include "xml/node-event-vector.h" +#include "xml/repr.h" +#include // std::min #include "rdf.h" #include "ui/widget/entity-entry.h" @@ -44,8 +54,11 @@ #include "color-profile.h" #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#include #include +#include +#include <2geom/transforms.h> #include "ui/icon-names.h" using std::pair; diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 2e78be8ac..2fb5f9e3b 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -24,28 +24,37 @@ #include #include #include +#include +#include #include #include - +#include #if WITH_GTKMM_3_0 # include #else # include #endif +#include +#include #ifdef WITH_GNOME_VFS # include // gnome_vfs_initialized #endif #include +#include #include "ui/widget/unit-menu.h" +#include "util/units.h" #include "helper/window.h" #include "inkscape.h" #include "document.h" #include "document-undo.h" +#include "sp-item.h" +#include "selection.h" #include "file.h" +#include "macros.h" #include "sp-namedview.h" #include "selection-chemistry.h" @@ -80,12 +89,17 @@ #include #endif +#include + #define SP_EXPORT_MIN_SIZE 1.0 #define DPI_BASE Inkscape::Util::Quantity::convert(1, "in", "px") #define EXPORT_COORD_PRECISION 3 +#include "../../document.h" +#include "../../document-undo.h" +#include "verbs.h" #include "export.h" using Inkscape::Util::unit_table; diff --git a/src/ui/dialog/extension-editor.cpp b/src/ui/dialog/extension-editor.cpp index 84840f22d..9bdddc0e0 100644 --- a/src/ui/dialog/extension-editor.cpp +++ b/src/ui/dialog/extension-editor.cpp @@ -12,13 +12,14 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "extension-editor.h" #include #include +#include #include #include @@ -26,6 +27,7 @@ #include "preferences.h" #include "ui/interface.h" +#include "extension/extension.h" #include "extension/db.h" namespace Inkscape { diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp index ee673aecf..4e4b0278a 100644 --- a/src/ui/dialog/filedialog.cpp +++ b/src/ui/dialog/filedialog.cpp @@ -17,9 +17,14 @@ #include "filedialogimpl-win32.h" #include "filedialogimpl-gtkmm.h" +#include "filedialog.h" +#include "inkgc/gc-core.h" #include "ui/dialog-events.h" #include "extension/output.h" +#include "preferences.h" + +#include namespace Inkscape { diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index fa69851e4..8141f7696 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -22,6 +22,7 @@ #include "fill-and-stroke.h" #include "filter-chemistry.h" #include "inkscape.h" +#include "selection.h" #include "preferences.h" #include "style.h" #include "svg/css-ostringstream.h" @@ -31,9 +32,12 @@ #include "widgets/icon.h" #include "widgets/paint-selector.h" #include "widgets/stroke-style.h" +#include "xml/repr.h" #include "ui/view/view-widget.h" +#include + namespace Inkscape { namespace UI { namespace Dialog { diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index e733d1b72..d3ad5d1da 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -16,7 +16,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "dialog-manager.h" @@ -28,36 +28,57 @@ #include "ui/widget/spinbutton.h" +#include #include +#include +#include #include "desktop.h" +#include "dir-util.h" #include "document.h" #include "document-undo.h" #include "filter-chemistry.h" #include "filter-effects-dialog.h" #include "filter-enums.h" #include "inkscape.h" +#include "path-prefix.h" +#include "preferences.h" +#include "selection.h" #include "filters/blend.h" #include "filters/colormatrix.h" #include "filters/componenttransfer.h" #include "filters/componenttransfer-funcnode.h" +#include "filters/composite.h" #include "filters/convolvematrix.h" +#include "filters/displacementmap.h" #include "filters/distantlight.h" +#include "filters/gaussian-blur.h" #include "filters/merge.h" #include "filters/mergenode.h" +#include "filters/offset.h" #include "filters/pointlight.h" #include "filters/spotlight.h" +#include "sp-filter-primitive.h" #include "style.h" #include "svg/svg-color.h" +#include "svg/stringstream.h" #include "ui/dialog/filedialog.h" #include "verbs.h" +#include "xml/node.h" +#include "xml/node-observer.h" +#include "xml/repr.h" +#include #include "io/sys.h" +#include #include "selection-chemistry.h" +#include #include +#include +#include #include #include diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index aa26342df..0f368c5ac 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -11,25 +11,30 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "find.h" #include +#include #include "verbs.h" #include "message-stack.h" #include "helper/window.h" +#include "macros.h" #include "inkscape.h" #include "desktop.h" #include "document.h" #include "document-undo.h" +#include "selection.h" #include "ui/dialog-events.h" +#include "verbs.h" #include "ui/interface.h" +#include "preferences.h" #include "sp-text.h" #include "sp-flowtext.h" #include "sp-flowdiv.h" @@ -46,13 +51,16 @@ #include "sp-line.h" #include "sp-polyline.h" #include "sp-item-group.h" +#include "sp-use.h" #include "sp-image.h" #include "sp-offset.h" #include "sp-root.h" +#include "xml/repr.h" #include "xml/node-iterators.h" #include "xml/attribute-record.h" #include +#include namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp index 2a4a6c028..55ef0c5bb 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -11,11 +11,13 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include "config.h" #endif #include #include +#include +#include #include "floating-behavior.h" #include "dialog.h" @@ -24,6 +26,7 @@ #include "desktop.h" #include "ui/dialog-events.h" #include "ui/interface.h" +#include "preferences.h" #include "verbs.h" namespace Inkscape { diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index 0a96188ca..f219f3db6 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -7,7 +7,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include @@ -21,11 +21,16 @@ #include "inkscape.h" #include "desktop.h" #include "document.h" +#include "selection.h" #include "ui/dialog-events.h" #include "selection-chemistry.h" +#include "preferences.h" +#include "xml/repr.h" + +#include "sp-defs.h" #include "sp-root.h" #include "sp-text.h" #include "sp-textpath.h" @@ -40,6 +45,7 @@ #include "libnrtype/font-instance.h" #include +#include namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 7ce3eabfc..56b001291 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -14,7 +14,9 @@ #include #include #include +#include #include +#include #include #include @@ -24,6 +26,9 @@ # include #endif +#include +#include + #include "desktop.h" #include "document.h" // for SPDocumentUndo::done() #include "document-undo.h" diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 8d83814b4..639e463ea 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -16,12 +16,14 @@ //#define DEBUG_GRID_ARRANGE 1 #include "ui/dialog/grid-arrange-tab.h" +#include //for GTK_RESPONSE* types #include #include #if WITH_GTKMM_3_0 # include #else +# include #endif #include <2geom/transforms.h> @@ -30,8 +32,10 @@ #include "preferences.h" #include "inkscape.h" +#include "selection.h" #include "document.h" #include "document-undo.h" +#include "sp-item.h" #include "widgets/icon.h" #include "desktop.h" //#include "sp-item-transform.h" FIXME diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 469bd5155..556d77a28 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -14,7 +14,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "guides.h" @@ -30,8 +30,12 @@ #include #include "ui/dialog-events.h" #include "message-context.h" +#include "xml/repr.h" #include "verbs.h" +#include <2geom/point.h> +#include <2geom/angle.h> + #include namespace Inkscape { diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 8709a5855..83656a1f2 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -14,13 +14,15 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include #include #include +#include +#include #include #include @@ -33,7 +35,10 @@ #include "display/drawing.h" #include "document.h" #include "inkscape.h" +#include "preferences.h" +#include "selection.h" #include "sp-root.h" +#include "xml/repr.h" #include "verbs.h" #include "icon-preview.h" diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index d53e3dd73..6dd62d3bb 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -19,20 +19,30 @@ #include "inkscape-preferences.h" #include +#include +#include #include +#include +#include #include #include "preferences.h" #include "verbs.h" #include "selcue.h" +#include "util/units.h" +#include +#include "enums.h" #include "extension/internal/gdkpixbuf-input.h" #include "message-stack.h" #include "style.h" #include "selection.h" #include "selection-chemistry.h" +#include "xml/repr.h" #include "ui/widget/style-swatch.h" +#include "ui/widget/spinbutton.h" #include "display/nr-filter-gaussian.h" +#include "display/nr-filter-types.h" #include "cms-system.h" #include "color-profile.h" #include "display/canvas-grid.h" diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index ea8ccf8fb..d1abcfc58 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -19,6 +19,7 @@ # include "config.h" #endif +#include #include #include "ui/widget/preferences-widget.h" #include "ui/widget/button.h" diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 1bfb59ae5..8343cd6fe 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -15,12 +15,18 @@ #include "ui/widget/panel.h" #include "ui/widget/frame.h" +#include #include +#include #include #include #include #include +#include +#include +#include +#include #include #include #include @@ -34,7 +40,10 @@ # include #endif +#include +#include #include +#include #include "device-manager.h" #include "preferences.h" diff --git a/src/ui/dialog/knot-properties.cpp b/src/ui/dialog/knot-properties.cpp index 133ed6f4c..a91a09a4f 100644 --- a/src/ui/dialog/knot-properties.cpp +++ b/src/ui/dialog/knot-properties.cpp @@ -14,10 +14,12 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "ui/dialog/knot-properties.h" #include +#include +#include #include #include "inkscape.h" #include "util/units.h" @@ -25,8 +27,15 @@ #include "document.h" #include "document-undo.h" #include "layer-manager.h" +#include "message-stack.h" +#include "sp-object.h" +#include "sp-item.h" +#include "verbs.h" +#include "selection.h" #include "selection-chemistry.h" +#include "ui/icon-names.h" +#include "ui/widget/imagetoggler.h" //#include "event-context.h" diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index 9af91eb92..5d550ed48 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -15,6 +15,7 @@ #include "layer-properties.h" #include +#include #include #include "inkscape.h" #include "desktop.h" @@ -23,7 +24,10 @@ #include "layer-manager.h" #include "message-stack.h" +#include "sp-object.h" +#include "sp-item.h" #include "verbs.h" +#include "selection.h" #include "selection-chemistry.h" #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index ce4fbeedc..1c022ecad 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -10,25 +10,36 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "layers.h" +#include #include +#include +#include + +#include +#include #include "desktop.h" #include "desktop-style.h" #include "document.h" #include "document-undo.h" #include "helper/action.h" +#include "helper/action-context.h" #include "inkscape.h" #include "layer-fns.h" #include "layer-manager.h" +#include "preferences.h" +#include "sp-item.h" +#include "sp-object.h" #include "svg/css-ostringstream.h" #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" #include "verbs.h" #include "widgets/icon.h" +#include "xml/repr.h" #include "sp-root.h" #include "ui/tools/tool-base.h" #include "selection-chemistry.h" diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp index 3602b04df..c558eddaf 100644 --- a/src/ui/dialog/livepatheffect-add.cpp +++ b/src/ui/dialog/livepatheffect-add.cpp @@ -9,7 +9,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "livepatheffect-add.h" @@ -17,6 +17,7 @@ #include #include "desktop.h" +#include "live_effects/effect-enum.h" namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index ac64143f1..422ec10ae 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -13,16 +13,20 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "livepatheffect-editor.h" +#include #include +#include +#include #include "desktop.h" #include "document.h" #include "document-undo.h" +#include "gtkmm/widget.h" #include "helper/action.h" #include "inkscape.h" #include "live_effects/effect.h" @@ -30,14 +34,19 @@ #include "live_effects/lpeobject-reference.h" #include "path-chemistry.h" #include "selection-chemistry.h" +#include "selection.h" #include "sp-item-group.h" +#include "sp-lpe-item.h" #include "sp-path.h" #include "sp-rect.h" +#include "sp-use.h" #include "sp-text.h" +#include "sp-shape.h" #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" #include "verbs.h" #include "widgets/icon.h" +#include "xml/node.h" #include "livepatheffect-add.h" namespace Inkscape { diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index d33ee758d..b0cc91868 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -5,20 +5,30 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include #include "lpe-fillet-chamfer-properties.h" #include +#include #include #include "inkscape.h" #include "desktop.h" +#include "document.h" #include "document-undo.h" #include "layer-manager.h" #include "message-stack.h" +#include "sp-object.h" +#include "sp-item.h" +#include "verbs.h" +#include "selection.h" #include "selection-chemistry.h" +#include "ui/icon-names.h" +#include "ui/widget/imagetoggler.h" +#include "live_effects/parameter/parameter.h" +#include //#include "event-context.h" diff --git a/src/ui/dialog/lpe-powerstroke-properties.cpp b/src/ui/dialog/lpe-powerstroke-properties.cpp index d5b3bb30d..a6dcce907 100644 --- a/src/ui/dialog/lpe-powerstroke-properties.cpp +++ b/src/ui/dialog/lpe-powerstroke-properties.cpp @@ -14,18 +14,29 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "lpe-powerstroke-properties.h" #include +#include +#include #include #include "inkscape.h" #include "desktop.h" +#include "document.h" #include "document-undo.h" #include "layer-manager.h" +#include "message-stack.h" +#include "sp-object.h" +#include "sp-item.h" +#include "verbs.h" +#include "selection.h" #include "selection-chemistry.h" +#include "ui/icon-names.h" +#include "ui/widget/imagetoggler.h" +#include "live_effects/parameter/parameter.h" //#include "event-context.h" namespace Inkscape { diff --git a/src/ui/dialog/memory.cpp b/src/ui/dialog/memory.cpp index f2813d4ce..c0bc884fa 100644 --- a/src/ui/dialog/memory.cpp +++ b/src/ui/dialog/memory.cpp @@ -11,10 +11,11 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "ui/dialog/memory.h" +#include #include #include #include diff --git a/src/ui/dialog/messages.cpp b/src/ui/dialog/messages.cpp index 3a8e7338d..df02215fe 100644 --- a/src/ui/dialog/messages.cpp +++ b/src/ui/dialog/messages.cpp @@ -11,7 +11,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "messages.h" diff --git a/src/ui/dialog/new-from-template.cpp b/src/ui/dialog/new-from-template.cpp index 96fa72791..74ec7111e 100644 --- a/src/ui/dialog/new-from-template.cpp +++ b/src/ui/dialog/new-from-template.cpp @@ -9,13 +9,14 @@ */ #if HAVE_CONFIG_H -#include "config.h" + #include "config.h" #endif #include "new-from-template.h" #include "file.h" #include +#include namespace Inkscape { diff --git a/src/ui/dialog/object-attributes.cpp b/src/ui/dialog/object-attributes.cpp index 72520d3d0..1bc570f43 100644 --- a/src/ui/dialog/object-attributes.cpp +++ b/src/ui/dialog/object-attributes.cpp @@ -23,12 +23,15 @@ #include "ui/dialog/dialog-manager.h" #include "desktop.h" +#include "macros.h" #include "sp-anchor.h" #include "sp-image.h" #include "verbs.h" +#include "xml/repr.h" #include "ui/dialog/object-attributes.h" #include "widgets/sp-attribute-widget.h" #include "inkscape.h" +#include "selection.h" #include namespace Inkscape { diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index 545c240fc..be46129c4 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -33,8 +33,11 @@ #include "document-undo.h" #include "verbs.h" #include "inkscape.h" +#include "selection.h" #include "desktop.h" +#include "sp-item.h" #include "sp-image.h" +#include "xml/repr.h" #include #if WITH_GTKMM_3_0 diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 007c48b71..27694a9ac 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -10,13 +10,19 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "objects.h" +#include #include +#include +#include #include +#include +#include + #include "desktop.h" #include "desktop-style.h" #include "ui/dialog-events.h" @@ -28,8 +34,12 @@ #include "helper/action.h" #include "inkscape.h" #include "layer-manager.h" +#include "preferences.h" +#include "selection.h" #include "sp-clippath.h" #include "sp-mask.h" +#include "sp-item.h" +#include "sp-object.h" #include "sp-root.h" #include "sp-shape.h" #include "style.h" @@ -42,10 +52,13 @@ #include "ui/widget/clipmaskicon.h" #include "ui/widget/highlight-picker.h" #include "ui/tools/node-tool.h" +#include "ui/tools/tool-base.h" #include "verbs.h" #include "ui/widget/color-notebook.h" #include "widgets/icon.h" +#include "xml/node.h" #include "xml/node-observer.h" +#include "xml/repr.h" //#define DUMP_LAYERS 1 diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index e271f190e..f2ee79d06 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -18,10 +18,16 @@ #include "ocaldialogs.h" +#include // rename() +#include // close() +#include // errno +#include // strerror() + #include "path-prefix.h" #include "filedialogimpl-gtkmm.h" #include "ui/interface.h" #include "inkgc/gc-core.h" +#include "ui/dialog-events.h" #include "io/sys.h" #include "preferences.h" @@ -31,7 +37,12 @@ #include #include +#include +#include #include +#include +#include +#include #include "ui/icon-names.h" namespace Inkscape diff --git a/src/ui/dialog/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp index 62e6bf591..f557ff0fc 100644 --- a/src/ui/dialog/pixelartdialog.cpp +++ b/src/ui/dialog/pixelartdialog.cpp @@ -31,6 +31,7 @@ #include #include +#include //for GTK_RESPONSE* types #include #include "ui/widget/spinbutton.h" @@ -40,13 +41,18 @@ #include "desktop-tracker.h" #include "message-stack.h" #include "selection.h" +#include "preferences.h" #include "sp-image.h" #include "display/cairo-utils.h" #include "libdepixelize/kopftracer2011.h" +#include #include "document.h" +#include "xml/repr.h" +#include "xml/document.h" #include "svg/svg.h" #include "svg/svg-color.h" +#include "color.h" #include "svg/css-ostringstream.h" #include "document-undo.h" diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index da914dcd4..5ec1285c1 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -17,8 +17,10 @@ #include "preferences.h" #include "inkscape.h" +#include "selection.h" #include "document.h" #include "document-undo.h" +#include "sp-item.h" #include "widgets/icon.h" #include "desktop.h" #include "sp-ellipse.h" diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index 9ebbf040c..c44d645a5 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include @@ -26,6 +26,7 @@ #include "extension/internal/cairo-render-context.h" #include "extension/internal/cairo-renderer.h" +#include "ui/widget/rendering-options.h" #include "document.h" #include "util/units.h" diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp index 61fa4c22b..6da8acb20 100644 --- a/src/ui/dialog/spellcheck.cpp +++ b/src/ui/dialog/spellcheck.cpp @@ -17,18 +17,25 @@ #include "message-stack.h" #include "helper/window.h" +#include "macros.h" #include "inkscape.h" #include "document.h" +#include "selection.h" #include "desktop.h" #include "ui/tools-switch.h" #include "ui/tools/text-tool.h" #include "ui/interface.h" +#include "preferences.h" +#include "sp-text.h" #include "sp-flowtext.h" #include "text-editing.h" +#include "sp-tspan.h" #include "sp-tref.h" #include "sp-defs.h" #include "selection-chemistry.h" +#include +#include "display/canvas-bpath.h" #include "display/curve.h" #include "document-undo.h" #include "sp-root.h" @@ -40,7 +47,7 @@ #endif #ifdef HAVE_CONFIG_H -#include "config.h" +# include "config.h" #endif diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index c940931ed..08ebbcf14 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -12,18 +12,21 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "svg-fonts-dialog.h" #include "document-private.h" #include "document-undo.h" #include +#include #include #include #include #include "selection.h" +#include #include "svg/svg.h" +#include "xml/node.h" #include "xml/repr.h" #include "sp-font-face.h" #include "desktop.h" @@ -36,6 +39,7 @@ #include "sp-glyph-kerning.h" #include +#include SvgFontDrawingArea::SvgFontDrawingArea(): _x(0), diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index fdc8efe1b..6577c8d4e 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -22,6 +22,9 @@ #include #include +#include +#include +#include #include "color-item.h" #include "desktop.h" @@ -32,20 +35,28 @@ #include "document-undo.h" #include "extension/db.h" #include "inkscape.h" +#include "inkscape.h" #include "io/sys.h" #include "io/resource.h" #include "message-context.h" #include "path-prefix.h" +#include "preferences.h" +#include "sp-item.h" +#include "sp-gradient.h" +#include "sp-gradient-vector.h" #include "style.h" #include "ui/previewholder.h" #include "widgets/desktop-widget.h" #include "widgets/gradient-vector.h" +#include "widgets/eek-preview.h" #include "display/cairo-utils.h" #include "sp-gradient-reference.h" #include "dialog-manager.h" +#include "selection.h" #include "verbs.h" #include "gradient-chemistry.h" #include "helper/action.h" +#include "helper/action-context.h" namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 8433073a6..06c17611f 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -31,6 +32,10 @@ #include #include #include +#include +#include +#include +#include #include #include "path-prefix.h" #include "io/sys.h" @@ -71,6 +76,8 @@ #include "verbs.h" #include "helper/action.h" +#include "helper/action-context.h" +#include "xml/repr.h" namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index d03c781f3..c99c1bff3 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -10,11 +10,17 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "tags.h" +#include #include +#include +#include + +#include +#include #include "desktop.h" #include "desktop-style.h" @@ -24,19 +30,28 @@ #include "inkscape.h" #include "layer-fns.h" #include "layer-manager.h" +#include "preferences.h" +#include "sp-item.h" +#include "sp-object.h" #include "sp-shape.h" #include "svg/css-ostringstream.h" +#include "ui/icon-names.h" #include "ui/widget/layertypeicon.h" #include "ui/widget/addtoicon.h" #include "verbs.h" #include "widgets/icon.h" +#include "xml/node.h" #include "xml/node-observer.h" +#include "xml/repr.h" #include "sp-root.h" #include "ui/tools/tool-base.h" //"event-context.h" +#include "selection.h" //#include "dialogs/dialog-events.h" #include "ui/widget/color-notebook.h" #include "style.h" #include "filter-chemistry.h" +#include "filters/blend.h" +#include "filters/gaussian-blur.h" #include "sp-clippath.h" #include "sp-mask.h" #include "sp-tag.h" diff --git a/src/ui/dialog/template-load-tab.cpp b/src/ui/dialog/template-load-tab.cpp index 780da4ce3..7eb04ff79 100644 --- a/src/ui/dialog/template-load-tab.cpp +++ b/src/ui/dialog/template-load-tab.cpp @@ -9,17 +9,28 @@ */ #include "template-widget.h" +#include "template-load-tab.h" #include "new-from-template.h" #include #include +#include +#include +#include +#include #include +#include #include "extension/db.h" +#include "extension/effect.h" #include "inkscape.h" #include "ui/interface.h" #include "file.h" #include "path-prefix.h" +#include "preferences.h" +#include "xml/repr.h" +#include "xml/document.h" +#include "xml/node.h" namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/template-widget.cpp b/src/ui/dialog/template-widget.cpp index 93b44fefe..0d110d853 100644 --- a/src/ui/dialog/template-widget.cpp +++ b/src/ui/dialog/template-widget.cpp @@ -11,8 +11,14 @@ #include "template-widget.h" #include +#include +#include #include +#include +#include + +#include "template-load-tab.h" #include "desktop.h" #include "document.h" diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 73d2cd042..c01da8864 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -22,6 +22,7 @@ #include "text-edit.h" #include +#include #ifdef WITH_GTKSPELL extern "C" { @@ -30,8 +31,11 @@ extern "C" { #endif #include +#include #include +#include +#include "macros.h" #include "helper/window.h" #include "inkscape.h" #include "document.h" @@ -39,16 +43,20 @@ extern "C" { #include "desktop-style.h" #include "document-undo.h" +#include "selection.h" +#include "style.h" #include "sp-text.h" #include "sp-flowtext.h" #include "text-editing.h" #include "ui/icon-names.h" +#include "preferences.h" #include "verbs.h" #include "ui/interface.h" #include "svg/css-ostringstream.h" #include "widgets/icon.h" #include "widgets/font-selector.h" #include +#include #include "util/units.h" #include "sp-textpath.h" diff --git a/src/ui/dialog/tracedialog.cpp b/src/ui/dialog/tracedialog.cpp index a264d83c8..11e75391b 100644 --- a/src/ui/dialog/tracedialog.cpp +++ b/src/ui/dialog/tracedialog.cpp @@ -12,7 +12,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "tracedialog.h" @@ -20,8 +20,10 @@ #include #include "ui/widget/spinbutton.h" #include "ui/widget/frame.h" +#include #include +#include //for GTK_RESPONSE* types #include #include "desktop.h" diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 031bc5ae1..b7638e8c1 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -12,7 +12,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include @@ -26,11 +26,15 @@ #include "transformation.h" #include "align-and-distribute.h" #include "inkscape.h" +#include "selection.h" #include "selection-chemistry.h" #include "message-stack.h" #include "verbs.h" +#include "preferences.h" #include "sp-namedview.h" #include "sp-item-transform.h" +#include "macros.h" +#include "sp-item.h" #include "ui/icon-names.h" #include "widgets/icon.h" diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index 38fab8f07..a50a169eb 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -12,14 +12,18 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "undo-history.h" +#include +#include +#include #include "document.h" #include "document-undo.h" #include "inkscape.h" +#include "verbs.h" #include "util/signal-blocker.h" diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index c2711bb02..99a4acc69 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -18,6 +18,7 @@ #include "xml-tree.h" #include "widgets/icon.h" +#include #include #include @@ -30,14 +31,18 @@ #include "helper/window.h" #include "inkscape.h" #include "ui/interface.h" +#include "macros.h" #include "message-context.h" #include "message-stack.h" +#include "preferences.h" +#include "selection.h" #include "shortcuts.h" #include "sp-root.h" #include "sp-string.h" #include "sp-tspan.h" #include "ui/icon-names.h" #include "verbs.h" +#include "widgets/icon.h" #include "widgets/sp-xmlview-attr-list.h" #include "widgets/sp-xmlview-content.h" diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 16fc5c474..ab29471ed 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include "ui/dialog/dialog-manager.h" @@ -35,20 +35,25 @@ #include "extension/input.h" #include "widgets/icon.h" #include "preferences.h" +#include "path-prefix.h" #include "shortcuts.h" #include "document.h" #include "ui/interface.h" #include "desktop.h" +#include "selection.h" #include "selection-chemistry.h" #include "svg-view-widget.h" #include "widgets/desktop-widget.h" #include "sp-item-group.h" #include "sp-text.h" +#include "sp-gradient.h" #include "sp-flowtext.h" #include "sp-namedview.h" #include "sp-root.h" +#include "ui/view/view.h" #include "helper/action.h" +#include "helper/action-context.h" #include "helper/gnome-utils.h" #include "helper/window.h" #include "io/sys.h" @@ -58,6 +63,7 @@ #include "ui/clipboard.h" #include "display/sp-canvas.h" +#include "color.h" #include "svg/svg-color.h" #include "desktop-style.h" #include "style.h" @@ -68,6 +74,7 @@ #include "sp-anchor.h" #include "sp-clippath.h" #include "sp-image.h" +#include "sp-item.h" #include "sp-mask.h" #include "message-stack.h" #include "ui/dialog/layer-properties.h" @@ -76,6 +83,10 @@ #include "widgets/image-menu-item.h" #endif +#include + +#include + using Inkscape::DocumentUndo; /* Drag and Drop */ diff --git a/src/ui/object-edit.cpp b/src/ui/object-edit.cpp index 90676dc5f..459acf002 100644 --- a/src/ui/object-edit.cpp +++ b/src/ui/object-edit.cpp @@ -12,9 +12,11 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif + + #include "sp-item.h" #include "sp-rect.h" #include "box3d.h" @@ -30,10 +32,12 @@ #include "sp-namedview.h" #include "live_effects/effect.h" #include "sp-pattern.h" +#include "sp-path.h" #include #include "ui/object-edit.h" +#include "xml/repr.h" +#include <2geom/math-utils.h> #include "knot-holder-entity.h" -#include #define sp_round(v,m) (((v) < 0.0) ? ((ceil((v) / (m) - 0.5)) * (m)) : ((floor((v) / (m) + 0.5)) * (m))) diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index ac1369ced..5e75179a3 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -12,6 +12,7 @@ #include "previewholder.h" +#include "preferences.h" #include #include diff --git a/src/ui/selected-color.cpp b/src/ui/selected-color.cpp index 08f4bd979..846d50a5b 100644 --- a/src/ui/selected-color.cpp +++ b/src/ui/selected-color.cpp @@ -11,7 +11,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include diff --git a/src/ui/shape-editor.cpp b/src/ui/shape-editor.cpp index 98320ed8c..aec5cde27 100644 --- a/src/ui/shape-editor.cpp +++ b/src/ui/shape-editor.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -#include +#include "config.h" #endif #include @@ -16,8 +16,11 @@ #include "desktop.h" #include "document.h" +#include "gc-anchored.h" #include "knotholder.h" #include "ui/object-edit.h" +#include "sp-item.h" +#include "sp-object.h" #include "ui/shape-editor.h" #include "xml/node-event-vector.h" diff --git a/src/ui/tool-factory.cpp b/src/ui/tool-factory.cpp index f101e5a24..c6c579c9e 100644 --- a/src/ui/tool-factory.cpp +++ b/src/ui/tool-factory.cpp @@ -27,12 +27,14 @@ #include "ui/tools/mesh-tool.h" #include "ui/tools/node-tool.h" #include "ui/tools/pencil-tool.h" +#include "ui/tools/pen-tool.h" #include "ui/tools/rect-tool.h" #include "ui/tools/select-tool.h" #include "ui/tools/spiral-tool.h" #include "ui/tools/spray-tool.h" #include "ui/tools/star-tool.h" #include "ui/tools/text-tool.h" +#include "ui/tools/tool-base.h" #include "ui/tools/tweak-tool.h" #include "ui/tools/zoom-tool.h" diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp index a5611addc..f36ad7374 100644 --- a/src/ui/tool/control-point-selection.cpp +++ b/src/ui/tool/control-point-selection.cpp @@ -13,6 +13,7 @@ #include "ui/tool/selectable-control-point.h" #include <2geom/transforms.h> #include "desktop.h" +#include "preferences.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" #include "ui/tool/transform-handle-set.h" diff --git a/src/ui/tool/control-point.cpp b/src/ui/tool/control-point.cpp index d9374c790..636595016 100644 --- a/src/ui/tool/control-point.cpp +++ b/src/ui/tool/control-point.cpp @@ -16,6 +16,8 @@ #include "display/snap-indicator.h" #include "ui/tools/tool-base.h" #include "message-context.h" +#include "preferences.h" +#include "snap-preferences.h" #include "sp-namedview.h" #include "ui/control-manager.h" #include "ui/tool/control-point.h" diff --git a/src/ui/tool/curve-drag-point.cpp b/src/ui/tool/curve-drag-point.cpp index 908e18474..e460b0fb7 100644 --- a/src/ui/tool/curve-drag-point.cpp +++ b/src/ui/tool/curve-drag-point.cpp @@ -8,12 +8,15 @@ #include "ui/tool/curve-drag-point.h" #include +#include <2geom/bezier-curve.h> #include "desktop.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/path-manipulator.h" +#include "ui/tool/node.h" #include "sp-namedview.h" +#include "snap.h" namespace Inkscape { namespace UI { diff --git a/src/ui/tool/manipulator.cpp b/src/ui/tool/manipulator.cpp index 82ff014e4..11dd220f4 100644 --- a/src/ui/tool/manipulator.cpp +++ b/src/ui/tool/manipulator.cpp @@ -8,8 +8,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -//#include "ui/tool/node.h" -//#include "ui/tool/manipulator.h" +#include "ui/tool/node.h" +#include "ui/tool/manipulator.h" namespace Inkscape { namespace UI { diff --git a/src/ui/tool/modifier-tracker.cpp b/src/ui/tool/modifier-tracker.cpp index f502acab2..cc4e4d0b2 100644 --- a/src/ui/tool/modifier-tracker.cpp +++ b/src/ui/tool/modifier-tracker.cpp @@ -12,6 +12,7 @@ #include #include "ui/tool/event-utils.h" #include "ui/tool/modifier-tracker.h" +#include namespace Inkscape { namespace UI { diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index f30c7e349..9ec6f733f 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -19,11 +19,13 @@ #include "document-undo.h" #include "live_effects/lpeobject.h" #include "message-stack.h" +#include "preferences.h" #include "sp-path.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/path-manipulator.h" +#include "util/unordered-containers.h" #include "verbs.h" #include diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 0e5a9279d..9268d9730 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -12,20 +12,25 @@ #include "multi-path-manipulator.h" #include #include <2geom/bezier-utils.h> +#include <2geom/transforms.h> #include "display/sp-ctrlline.h" #include "display/sp-canvas.h" #include "display/sp-canvas-util.h" #include "desktop.h" +#include "preferences.h" #include "snap.h" +#include "snap-preferences.h" #include "sp-namedview.h" #include "ui/control-manager.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" +#include "ui/tool/node.h" #include "ui/tool/path-manipulator.h" #include "ui/tools/node-tool.h" #include "ui/tools-switch.h" #include +#include namespace { diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index f316bea38..de071dad3 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -13,23 +13,36 @@ #include "live_effects/lpe-powerstroke.h" #include "live_effects/lpe-bspline.h" #include "live_effects/lpe-fillet-chamfer.h" +#include +#include +#include +#include +#include +#include <2geom/bezier-curve.h> #include <2geom/bezier-utils.h> #include <2geom/path-sink.h> +#include #include "ui/tool/path-manipulator.h" +#include "desktop.h" #include "display/sp-canvas.h" #include "display/sp-canvas-util.h" #include "display/curve.h" #include "display/canvas-bpath.h" +#include "document.h" +#include "live_effects/effect.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" +#include "sp-path.h" #include "helper/geom.h" +#include "preferences.h" #include "style.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/curve-drag-point.h" #include "ui/tool/event-utils.h" #include "ui/tool/multi-path-manipulator.h" +#include "xml/node.h" #include "xml/node-observer.h" namespace Inkscape { diff --git a/src/ui/tool/selector.cpp b/src/ui/tool/selector.cpp index 84e96173d..9acf7de88 100644 --- a/src/ui/tool/selector.cpp +++ b/src/ui/tool/selector.cpp @@ -14,6 +14,7 @@ #include "display/sodipodi-ctrlrect.h" #include "ui/tools/tool-base.h" +#include "preferences.h" #include "ui/tool/event-utils.h" #include "ui/tool/selector.h" diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp index 33015fe11..748b9d4cc 100644 --- a/src/ui/tool/transform-handle-set.cpp +++ b/src/ui/tool/transform-handle-set.cpp @@ -18,7 +18,11 @@ #include "sp-namedview.h" #include "display/sodipodi-ctrlrect.h" +#include "preferences.h" #include "pure-transform.h" +#include "snap.h" +#include "snap-candidate.h" +#include "sp-namedview.h" #include "ui/tool/commit-events.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/selectable-control-point.h" diff --git a/src/ui/tools-switch.cpp b/src/ui/tools-switch.cpp index d87bcc51d..ea0431b0a 100644 --- a/src/ui/tools-switch.cpp +++ b/src/ui/tools-switch.cpp @@ -13,11 +13,16 @@ #include // prevents deprecation warnings +#include +#include + #include "inkscape.h" #include "desktop.h" #include +#include + #include "ui/tools-switch.h" #include "box3d.h" @@ -47,6 +52,7 @@ #include "ui/tools/measure-tool.h" #include "ui/tools/mesh-tool.h" #include "ui/tools/node-tool.h" +#include "ui/tools/pen-tool.h" #include "ui/tools/pencil-tool.h" #include "ui/tools/rect-tool.h" #include "ui/tools/select-tool.h" diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp index 6652f7ab5..c6a9bb23a 100644 --- a/src/ui/tools/arc-tool.cpp +++ b/src/ui/tools/arc-tool.cpp @@ -17,7 +17,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include @@ -30,6 +30,7 @@ #include "sp-namedview.h" #include "selection.h" +#include "snap.h" #include "pixmaps/cursor-ellipse.xpm" #include "xml/repr.h" #include "xml/node-event-vector.h" diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp index 9b5b264bc..27e755add 100644 --- a/src/ui/tools/box3d-tool.cpp +++ b/src/ui/tools/box3d-tool.cpp @@ -15,6 +15,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include "config.h" + #include #include "macros.h" @@ -25,6 +27,8 @@ #include "selection.h" #include "selection-chemistry.h" +#include "snap.h" +#include "display/curve.h" #include "display/sp-canvas-item.h" #include "desktop.h" #include "message-context.h" @@ -32,12 +36,17 @@ #include "box3d.h" #include "ui/tools/box3d-tool.h" #include +#include "xml/repr.h" #include "xml/node-event-vector.h" +#include "preferences.h" #include "context-fns.h" #include "desktop-style.h" +#include "transf_mat_3x4.h" #include "perspective-line.h" +#include "persp3d.h" #include "box3d-side.h" #include "document-private.h" +#include "line-geometry.h" #include "ui/shape-editor.h" #include "verbs.h" diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp index 84c4adc89..28195eb75 100644 --- a/src/ui/tools/calligraphic-tool.cpp +++ b/src/ui/tools/calligraphic-tool.cpp @@ -23,6 +23,8 @@ #define noDYNA_DRAW_VERBOSE +#include "config.h" + #include #include #include @@ -33,10 +35,12 @@ #include "svg/svg.h" #include "display/canvas-bpath.h" #include "display/cairo-utils.h" +#include <2geom/math-utils.h> #include <2geom/pathvector.h> #include <2geom/bezier-utils.h> #include <2geom/circle.h> #include "display/curve.h" +#include #include "macros.h" #include "document.h" #include "document-undo.h" @@ -46,15 +50,20 @@ #include "desktop-style.h" #include "message-context.h" +#include "preferences.h" #include "pixmaps/cursor-calligraphy.xpm" +#include "xml/repr.h" #include "context-fns.h" +#include "sp-item.h" #include "inkscape.h" +#include "color.h" #include "splivarot.h" #include "sp-item-group.h" #include "sp-shape.h" #include "sp-path.h" #include "sp-text.h" #include "display/sp-canvas.h" +#include "display/canvas-bpath.h" #include "display/canvas-arena.h" #include "livarot/Shape.h" #include "verbs.h" diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp index 605b573d7..74f2664fe 100644 --- a/src/ui/tools/connector-tool.cpp +++ b/src/ui/tools/connector-tool.cpp @@ -75,6 +75,7 @@ #include "ui/tools/connector-tool.h" #include "pixmaps/cursor-connector.xpm" #include "xml/node-event-vector.h" +#include "xml/repr.h" #include "svg/svg.h" #include "desktop.h" #include "desktop-style.h" @@ -85,13 +86,19 @@ #include "message-stack.h" #include "selection.h" #include "inkscape.h" +#include "preferences.h" #include "sp-path.h" #include "display/sp-canvas.h" #include "display/canvas-bpath.h" +#include "display/sodipodi-ctrl.h" #include #include #include "snap.h" +#include "knot.h" #include "sp-conn-end.h" +#include "sp-conn-end-pair.h" +#include "conn-avoid-ref.h" +#include "libavoid/vertices.h" #include "libavoid/router.h" #include "context-fns.h" #include "sp-namedview.h" diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp index 4db720686..c838c27d5 100644 --- a/src/ui/tools/dropper-tool.cpp +++ b/src/ui/tools/dropper-tool.cpp @@ -12,7 +12,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include @@ -27,6 +27,7 @@ #include "display/curve.h" #include "display/cairo-utils.h" #include "svg/svg-color.h" +#include "color.h" #include "color-rgba.h" #include "desktop-style.h" #include "preferences.h" @@ -35,6 +36,7 @@ #include "desktop.h" #include "selection.h" +#include "document.h" #include "document-undo.h" #include "pixmaps/cursor-dropper-f.xpm" @@ -43,6 +45,7 @@ #include "ui/tools/dropper-tool.h" #include "message-context.h" #include "verbs.h" +#include "ui/tools/tool-base.h" using Inkscape::DocumentUndo; diff --git a/src/ui/tools/dynamic-base.cpp b/src/ui/tools/dynamic-base.cpp index 6627a470e..eb789d850 100644 --- a/src/ui/tools/dynamic-base.cpp +++ b/src/ui/tools/dynamic-base.cpp @@ -1,7 +1,13 @@ #include "ui/tools/dynamic-base.h" +#include + +#include "config.h" + #include "message-context.h" +#include "streq.h" +#include "preferences.h" #include "display/sp-canvas-item.h" #include "desktop.h" #include "display/curve.h" diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 838522b34..6b32b5901 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -24,6 +24,8 @@ #define noERASER_VERBOSE +#include "config.h" + #include #include #include @@ -36,6 +38,7 @@ #include "display/canvas-bpath.h" #include <2geom/bezier-utils.h> +#include #include "macros.h" #include "document.h" #include "selection.h" @@ -44,18 +47,26 @@ #include "desktop-style.h" #include "message-context.h" +#include "preferences.h" #include "pixmaps/cursor-eraser.xpm" +#include "xml/repr.h" #include "context-fns.h" +#include "sp-item.h" +#include "color.h" #include "rubberband.h" #include "splivarot.h" #include "sp-item-group.h" #include "sp-shape.h" #include "sp-path.h" #include "sp-text.h" +#include "display/canvas-bpath.h" #include "display/canvas-arena.h" +#include "livarot/Shape.h" #include "document-undo.h" #include "verbs.h" #include "style.h" +#include "style-enums.h" +#include <2geom/math-utils.h> #include <2geom/pathvector.h> #include "path-chemistry.h" #include "display/curve.h" diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index 2f125e6ed..748c82717 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -18,13 +18,14 @@ */ #ifdef HAVE_CONFIG_H -#include +#include "config.h" #endif #include "trace/potrace/inkscape-potrace.h" #include <2geom/pathvector.h> #include #include +#include #include #include "color.h" @@ -35,6 +36,7 @@ #include "display/cairo-utils.h" #include "display/drawing-context.h" #include "display/drawing-image.h" +#include "display/drawing-item.h" #include "display/drawing.h" #include "display/sp-canvas.h" #include "document.h" @@ -45,15 +47,23 @@ #include "macros.h" #include "message-context.h" #include "message-stack.h" +#include "preferences.h" #include "rubberband.h" #include "selection.h" #include "ui/shape-editor.h" +#include "sp-defs.h" +#include "sp-item.h" #include "splivarot.h" #include "sp-namedview.h" +#include "sp-object.h" +#include "sp-path.h" +#include "sp-rect.h" #include "sp-root.h" #include "svg/svg.h" #include "trace/imagemap.h" +#include "trace/trace.h" #include "xml/node-event-vector.h" +#include "xml/repr.h" #include "verbs.h" #include "pixmaps/cursor-paintbucket.xpm" diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index eb29ed88d..7697cd59c 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -17,29 +17,43 @@ #define DRAW_VERBOSE #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include "live_effects/lpe-bendpath.h" #include "live_effects/lpe-patternalongpath.h" #include "live_effects/lpe-simplify.h" #include "display/canvas-bpath.h" +#include "xml/repr.h" #include "svg/svg.h" +#include #include "display/curve.h" +#include "desktop.h" #include "desktop-style.h" +#include "document.h" #include "ui/draw-anchor.h" #include "macros.h" #include "message-stack.h" #include "ui/tools/pen-tool.h" #include "ui/tools/lpe-tool.h" +#include "preferences.h" +#include "selection.h" #include "selection-chemistry.h" +#include "snap.h" +#include "sp-path.h" +#include "sp-use.h" #include "sp-item-group.h" +#include "sp-namedview.h" #include "live_effects/lpe-powerstroke.h" #include "style.h" #include "ui/control-manager.h" +#include "util/units.h" // clipboard support #include "ui/clipboard.h" +#include "ui/tools/freehand-base.h" + +#include using Inkscape::DocumentUndo; diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp index e4814c3de..9d8101cc4 100644 --- a/src/ui/tools/gradient-tool.cpp +++ b/src/ui/tools/gradient-tool.cpp @@ -13,7 +13,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif @@ -31,10 +31,17 @@ #include "ui/tools/gradient-tool.h" #include "gradient-chemistry.h" #include +#include "preferences.h" #include "gradient-drag.h" +#include "gradient-chemistry.h" +#include "xml/repr.h" +#include "sp-item.h" #include "display/sp-ctrlline.h" +#include "sp-linear-gradient.h" +#include "sp-radial-gradient.h" #include "sp-stop.h" #include "svg/css-ostringstream.h" +#include "svg/svg-color.h" #include "snap.h" #include "sp-namedview.h" #include "rubberband.h" diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp index ee85dd28c..9bbc1ac20 100644 --- a/src/ui/tools/lpe-tool.cpp +++ b/src/ui/tools/lpe-tool.cpp @@ -15,16 +15,19 @@ */ #ifdef HAVE_CONFIG_H -#include +#include "config.h" #endif #include <2geom/sbasis-geometric.h> +#include #include +#include "macros.h" #include "pixmaps/cursor-crosshairs.xpm" #include #include "desktop.h" #include "message-context.h" +#include "preferences.h" #include "ui/shape-editor.h" #include "selection.h" diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index c941b9bee..63e2460ec 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -11,10 +11,11 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include +#include #include #include "util/units.h" #include "display/curve.h" @@ -22,6 +23,7 @@ #include "display/sp-ctrlline.h" #include "display/sp-ctrlcurve.h" #include "display/sp-canvas.h" +#include "display/sp-canvas-item.h" #include "display/sp-canvas-util.h" #include "svg/svg.h" #include "svg/svg-color.h" @@ -29,20 +31,34 @@ #include "ui/tools/freehand-base.h" #include <2geom/line.h> #include <2geom/path-intersection.h> +#include <2geom/pathvector.h> +#include <2geom/crossing.h> +#include <2geom/angle.h> +#include <2geom/transforms.h> #include "ui/dialog/knot-properties.h" #include "sp-namedview.h" +#include "sp-shape.h" #include "sp-text.h" #include "sp-flowtext.h" #include "sp-defs.h" +#include "sp-item.h" #include "sp-root.h" +#include "macros.h" #include "svg/stringstream.h" #include "rubberband.h" #include "path-chemistry.h" #include "desktop.h" +#include "document.h" #include "document-undo.h" +#include "viewbox.h" +#include "snap.h" +#include "knot.h" #include "text-editing.h" #include "pixmaps/cursor-measure.xpm" +#include "preferences.h" #include "inkscape.h" +#include "enums.h" +#include "knot-enums.h" #include "desktop-style.h" #include "verbs.h" #include diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 32e70bc19..47927667c 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif //#define DEBUG_MESH @@ -33,6 +33,7 @@ #include "macros.h" #include "message-context.h" #include "message-stack.h" +#include "preferences.h" #include "rubberband.h" #include "selection.h" #include "snap.h" diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index bf18d4a2e..23aaf6bb1 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -24,19 +24,25 @@ #include "message-context.h" #include "selection.h" #include "ui/shape-editor.h" // temporary! +#include "live_effects/effect.h" +#include "display/curve.h" #include "snap.h" #include "sp-namedview.h" #include "sp-clippath.h" #include "sp-item-group.h" #include "sp-mask.h" +#include "sp-object-group.h" +#include "sp-path.h" #include "sp-text.h" #include "ui/control-manager.h" #include "ui/tools/node-tool.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" +#include "ui/tool/manipulator.h" #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/path-manipulator.h" #include "ui/tool/selector.h" +#include "ui/tool/shape-record.h" #include "pixmaps/cursor-node.xpm" #include "pixmaps/cursor-node-d.xpm" diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 49f28ad2c..18af8e105 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -32,6 +32,8 @@ #include "ui/draw-anchor.h" #include "message-stack.h" #include "message-context.h" +#include "preferences.h" +#include "sp-path.h" #include "display/sp-canvas.h" #include "display/curve.h" #include "pixmaps/cursor-pen.xpm" @@ -44,6 +46,7 @@ #include "ui/tools-switch.h" #include "ui/control-manager.h" // we include the necessary files for BSpline & Spiro +#include "live_effects/effect.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" @@ -51,16 +54,25 @@ #include "live_effects/lpe-spiro.h" +#include +#include <2geom/pathvector.h> +#include <2geom/affine.h> #include <2geom/curves.h> #include "helper/geom-nodetype.h" +#include "helper/geom-curves.h" // For handling un-continuous paths: +#include "message-stack.h" #include "inkscape.h" +#include "desktop.h" #include "live_effects/spiro.h" #define INKSCAPE_LPE_BSPLINE_C #include "live_effects/lpe-bspline.h" +#include <2geom/nearest-time.h> + +#include "live_effects/effect.h" using Inkscape::ControlManager; diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index 7cc695040..b029ca613 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -27,6 +27,7 @@ #include "message-stack.h" #include "message-context.h" #include "sp-path.h" +#include "preferences.h" #include "snap.h" #include "pixmaps/cursor-pencil.xpm" #include <2geom/sbasis-to-bezier.h> @@ -35,9 +36,13 @@ #include #include "context-fns.h" #include "sp-namedview.h" +#include "xml/repr.h" +#include "document.h" #include "desktop-style.h" +#include "macros.h" #include "display/sp-canvas.h" #include "display/curve.h" +#include "livarot/Path.h" #include "ui/tool/event-utils.h" namespace Inkscape { diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp index 00330ef57..844965c4d 100644 --- a/src/ui/tools/rect-tool.cpp +++ b/src/ui/tools/rect-tool.cpp @@ -14,6 +14,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include "config.h" + #include #include #include @@ -27,13 +29,16 @@ #include "selection.h" #include "selection-chemistry.h" +#include "snap.h" #include "desktop.h" #include "desktop-style.h" #include "message-context.h" #include "pixmaps/cursor-rect.xpm" #include "ui/tools/rect-tool.h" #include +#include "xml/repr.h" #include "xml/node-event-vector.h" +#include "preferences.h" #include "context-fns.h" #include "ui/shape-editor.h" #include "verbs.h" diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 5d802d4da..b5ec3d88e 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include #include @@ -40,12 +40,14 @@ #include "desktop.h" #include "sp-root.h" +#include "preferences.h" #include "ui/tools-switch.h" #include "message-stack.h" #include "selection-describer.h" #include "seltrans.h" #include "box3d.h" #include "display/sp-canvas.h" +#include "display/sp-canvas-item.h" #include "display/drawing-item.h" using Inkscape::DocumentUndo; diff --git a/src/ui/tools/spiral-tool.cpp b/src/ui/tools/spiral-tool.cpp index 0ba08853e..833fef18d 100644 --- a/src/ui/tools/spiral-tool.cpp +++ b/src/ui/tools/spiral-tool.cpp @@ -14,6 +14,8 @@ * Released under GNU GPL */ +#include "config.h" + #include #include #include @@ -26,13 +28,16 @@ #include "sp-namedview.h" #include "selection.h" +#include "snap.h" #include "desktop.h" #include "desktop-style.h" #include "message-context.h" #include "pixmaps/cursor-spiral.xpm" #include "ui/tools/spiral-tool.h" #include +#include "xml/repr.h" #include "xml/node-event-vector.h" +#include "preferences.h" #include "context-fns.h" #include "ui/shape-editor.h" #include "verbs.h" diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 3fafac2a7..9adaf3879 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -19,12 +19,15 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include "config.h" + #include #include "ui/dialog/dialog-manager.h" #include "svg/svg.h" +#include #include "macros.h" #include "document.h" #include "document-undo.h" @@ -34,7 +37,10 @@ #include "message-context.h" #include "pixmaps/cursor-spray.xpm" +#include +#include "xml/repr.h" #include "context-fns.h" +#include "sp-item.h" #include "inkscape.h" #include "splivarot.h" @@ -51,12 +57,17 @@ #include "svg/svg-color.h" #include "sp-text.h" +#include "sp-root.h" #include "sp-flowtext.h" #include "display/sp-canvas.h" +#include "display/canvas-bpath.h" #include "display/canvas-arena.h" #include "display/curve.h" #include "livarot/Shape.h" #include <2geom/circle.h> +#include <2geom/transforms.h> +#include "preferences.h" +#include "style.h" #include "box3d.h" #include "sp-item-transform.h" #include "filter-chemistry.h" @@ -65,6 +76,9 @@ #include "helper/action.h" #include "verbs.h" +#include + +#include #include #include diff --git a/src/ui/tools/star-tool.cpp b/src/ui/tools/star-tool.cpp index ddee08189..9190ae57b 100644 --- a/src/ui/tools/star-tool.cpp +++ b/src/ui/tools/star-tool.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include @@ -31,11 +31,14 @@ #include "sp-namedview.h" #include "selection.h" +#include "snap.h" #include "desktop.h" #include "desktop-style.h" #include "message-context.h" #include "pixmaps/cursor-star.xpm" #include +#include "preferences.h" +#include "xml/repr.h" #include "xml/node-event-vector.h" #include "context-fns.h" #include "ui/shape-editor.h" diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp index 559187764..1888551cf 100644 --- a/src/ui/tools/text-tool.cpp +++ b/src/ui/tools/text-tool.cpp @@ -14,7 +14,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include @@ -23,6 +23,7 @@ #include #include #include +#include #include "context-fns.h" @@ -35,6 +36,7 @@ #include "message-stack.h" #include "pixmaps/cursor-text-insert.xpm" #include "pixmaps/cursor-text.xpm" +#include "preferences.h" #include "rubberband.h" #include "selection-chemistry.h" #include "selection.h" @@ -48,6 +50,8 @@ #include "ui/control-manager.h" #include "verbs.h" #include "xml/node-event-vector.h" +#include "xml/repr.h" +#include using Inkscape::ControlManager; using Inkscape::DocumentUndo; diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 735f5bd42..72ba499de 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include "widgets/desktop-widget.h" @@ -24,8 +24,12 @@ #include "file.h" #include "ui/tools/tool-base.h" +#include #include +#include #include +#include +#include #include "display/sp-canvas.h" #include "xml/node-event-vector.h" @@ -39,14 +43,18 @@ #include "ui/interface.h" #include "macros.h" #include "ui/tools-switch.h" +#include "preferences.h" #include "message-context.h" #include "gradient-drag.h" +#include "attributes.h" #include "rubberband.h" #include "selcue.h" #include "ui/tools/lpe-tool.h" #include "ui/tool/control-point.h" #include "ui/shape-editor.h" #include "sp-guide.h" +#include "color.h" +#include "knot.h" #include "knot-ptr.h" // globals for temporary switching to selector by space diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index fbf1b2a0b..39a7a3f0b 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -11,6 +11,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include "config.h" + #include #include #include @@ -19,6 +21,7 @@ #include "svg/svg.h" +#include #include "macros.h" #include "document.h" #include "document-undo.h" @@ -45,13 +48,19 @@ #include "pixmaps/cursor-push.xpm" #include "pixmaps/cursor-roughen.xpm" #include "pixmaps/cursor-color.xpm" +#include +#include "xml/repr.h" #include "context-fns.h" +#include "sp-item.h" #include "inkscape.h" +#include "color.h" +#include "svg/svg-color.h" #include "splivarot.h" #include "sp-item-group.h" #include "sp-shape.h" #include "sp-path.h" #include "path-chemistry.h" +#include "sp-gradient.h" #include "sp-stop.h" #include "sp-gradient-reference.h" #include "sp-linear-gradient.h" @@ -60,10 +69,13 @@ #include "sp-text.h" #include "sp-flowtext.h" #include "display/sp-canvas.h" +#include "display/canvas-bpath.h" #include "display/canvas-arena.h" #include "display/curve.h" #include "livarot/Shape.h" +#include <2geom/transforms.h> #include <2geom/circle.h> +#include "preferences.h" #include "style.h" #include "box3d.h" #include "sp-item-transform.h" diff --git a/src/ui/tools/zoom-tool.cpp b/src/ui/tools/zoom-tool.cpp index ca42d2d6f..13e097c18 100644 --- a/src/ui/tools/zoom-tool.cpp +++ b/src/ui/tools/zoom-tool.cpp @@ -21,6 +21,7 @@ #include "desktop.h" #include "pixmaps/cursor-zoom.xpm" #include "pixmaps/cursor-zoom-out.xpm" +#include "preferences.h" #include "selection-chemistry.h" #include "ui/tools/zoom-tool.h" diff --git a/src/ui/uxmanager.cpp b/src/ui/uxmanager.cpp index cbce86cdb..036659661 100644 --- a/src/ui/uxmanager.cpp +++ b/src/ui/uxmanager.cpp @@ -10,15 +10,18 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include "widgets/desktop-widget.h" +#include #include "uxmanager.h" #include "desktop.h" #include "util/ege-tags.h" #include "widgets/toolbox.h" +#include "preferences.h" +#include "gdkmm/screen.h" #ifdef GDK_WINDOWING_X11 #include diff --git a/src/ui/view/view.h b/src/ui/view/view.h index 7ff14afd9..21a5d0dfc 100644 --- a/src/ui/view/view.h +++ b/src/ui/view/view.h @@ -11,13 +11,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include +#include #include #include "message.h" #include "inkgc/gc-managed.h" #include "gc-finalized.h" #include "gc-anchored.h" #include <2geom/forward.h> -#include /** * Iterates until true or returns false. diff --git a/src/ui/widget/addtoicon.cpp b/src/ui/widget/addtoicon.cpp index 465423fc2..10294125d 100644 --- a/src/ui/widget/addtoicon.cpp +++ b/src/ui/widget/addtoicon.cpp @@ -9,7 +9,7 @@ #ifdef HAVE_CONFIG_H -#include +# include #endif #include "ui/widget/addtoicon.h" @@ -19,7 +19,9 @@ #include "widgets/icon.h" #include "widgets/toolbox.h" #include "ui/icon-names.h" +#include "preferences.h" #include "layertypeicon.h" +#include "addtoicon.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/anchor-selector.cpp b/src/ui/widget/anchor-selector.cpp index acf8aff79..df00b786a 100644 --- a/src/ui/widget/anchor-selector.cpp +++ b/src/ui/widget/anchor-selector.cpp @@ -8,6 +8,7 @@ */ #include "ui/widget/anchor-selector.h" +#include #include "widgets/icon.h" #include "ui/icon-names.h" diff --git a/src/ui/widget/clipmaskicon.cpp b/src/ui/widget/clipmaskicon.cpp index 8715fdede..421f1df1e 100644 --- a/src/ui/widget/clipmaskicon.cpp +++ b/src/ui/widget/clipmaskicon.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include "ui/widget/clipmaskicon.h" diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp index 52c6ed2e3..e4f58fe8a 100644 --- a/src/ui/widget/color-icc-selector.cpp +++ b/src/ui/widget/color-icc-selector.cpp @@ -2,11 +2,14 @@ #include "config.h" #endif +#include #include #include #include +#include #include +#include #include "ui/dialog-events.h" #include "ui/widget/color-icc-selector.h" diff --git a/src/ui/widget/color-notebook.cpp b/src/ui/widget/color-notebook.cpp index 6634d8dad..6d7ada734 100644 --- a/src/ui/widget/color-notebook.cpp +++ b/src/ui/widget/color-notebook.cpp @@ -20,6 +20,10 @@ #endif #include "widgets/icon.h" +#include +#include +#include +#include #include #include #include diff --git a/src/ui/widget/color-scales.cpp b/src/ui/widget/color-scales.cpp index 832bc3a62..48a2693bc 100644 --- a/src/ui/widget/color-scales.cpp +++ b/src/ui/widget/color-scales.cpp @@ -3,13 +3,15 @@ */ #ifdef HAVE_CONFIG_H -#include +#include "config.h" #endif +#include #include #include #include +#include "svg/svg-icc-color.h" #include "ui/dialog-events.h" #include "ui/widget/color-scales.h" #include "ui/widget/color-slider.h" diff --git a/src/ui/widget/color-slider.cpp b/src/ui/widget/color-slider.cpp index bf2156628..0c9586a67 100644 --- a/src/ui/widget/color-slider.cpp +++ b/src/ui/widget/color-slider.cpp @@ -12,10 +12,11 @@ */ #ifdef HAVE_CONFIG_H -#include +#include "config.h" #endif #include +#include #include #include #if WITH_GTKMM_3_0 diff --git a/src/ui/widget/color-wheel-selector.cpp b/src/ui/widget/color-wheel-selector.cpp index decb02b4f..22c616325 100644 --- a/src/ui/widget/color-wheel-selector.cpp +++ b/src/ui/widget/color-wheel-selector.cpp @@ -1,14 +1,18 @@ #ifdef HAVE_CONFIG_H -#include +#include "config.h" #endif #include "color-wheel-selector.h" +#include +#include #include #include #include #include +#include "svg/svg-icc-color.h" #include "ui/dialog-events.h" +#include "ui/selected-color.h" #include "ui/widget/color-scales.h" #include "ui/widget/color-slider.h" #include "ui/widget/gimpcolorwheel.h" diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 910135fc1..8d960ddc3 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -9,13 +9,16 @@ #include "ui/widget/dock.h" +#include "dock-item.h" #include "desktop.h" #include "inkscape.h" +#include "preferences.h" #include "ui/icon-names.h" #include "widgets/icon.h" #include #include +#include namespace Inkscape { namespace UI { diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index 381f0a2e1..a8de2f384 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -14,13 +14,14 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include #include #include "inkscape.h" +#include "sp-object.h" #include "rdf.h" #include "ui/widget/registry.h" #include "sp-root.h" diff --git a/src/ui/widget/entry.cpp b/src/ui/widget/entry.cpp index b1dd9ae8e..64d28119a 100644 --- a/src/ui/widget/entry.cpp +++ b/src/ui/widget/entry.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include "entry.h" diff --git a/src/ui/widget/filter-effect-chooser.cpp b/src/ui/widget/filter-effect-chooser.cpp index ae2f3e7c2..242a99073 100644 --- a/src/ui/widget/filter-effect-chooser.cpp +++ b/src/ui/widget/filter-effect-chooser.cpp @@ -10,8 +10,12 @@ */ #include "filter-effect-chooser.h" +#include + +#include "desktop.h" #include "document.h" +#include "inkscape.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/font-variants.cpp b/src/ui/widget/font-variants.cpp index aca85f246..62598dead 100644 --- a/src/ui/widget/font-variants.cpp +++ b/src/ui/widget/font-variants.cpp @@ -8,18 +8,26 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include #include #include +#include #include "font-variants.h" // For updating from selection #include "desktop.h" +#include "selection.h" +#include "style.h" #include "sp-text.h" +#include "sp-tspan.h" +#include "sp-tref.h" +#include "sp-textpath.h" +#include "sp-item-group.h" +#include "xml/repr.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/frame.cpp b/src/ui/widget/frame.cpp index 65d10dcc4..eaa4336bb 100644 --- a/src/ui/widget/frame.cpp +++ b/src/ui/widget/frame.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include "frame.h" diff --git a/src/ui/widget/highlight-picker.cpp b/src/ui/widget/highlight-picker.cpp index c1068c9b2..09999b52d 100644 --- a/src/ui/widget/highlight-picker.cpp +++ b/src/ui/widget/highlight-picker.cpp @@ -14,6 +14,9 @@ #include "highlight-picker.h" #include "widgets/icon.h" +#include "widgets/toolbox.h" +#include "ui/icon-names.h" +#include namespace Inkscape { namespace UI { diff --git a/src/ui/widget/imageicon.cpp b/src/ui/widget/imageicon.cpp index 7d7fb2d3b..df261b69a 100644 --- a/src/ui/widget/imageicon.cpp +++ b/src/ui/widget/imageicon.cpp @@ -15,9 +15,12 @@ #include "imageicon.h" +#include #include "svg-view-widget.h" #include "document.h" #include "inkscape.h" +#include +#include namespace Inkscape diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index 7ee34f3b3..1a9ce617f 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include @@ -25,7 +25,9 @@ #include "document.h" #include "document-undo.h" #include "layer-manager.h" +#include "sp-item.h" #include "ui/icon-names.h" +#include "ui/widget/layer-selector.h" #include "util/filter-list.h" #include "util/reverse-list.h" #include "verbs.h" diff --git a/src/ui/widget/layertypeicon.cpp b/src/ui/widget/layertypeicon.cpp index e281d982a..672c607e5 100644 --- a/src/ui/widget/layertypeicon.cpp +++ b/src/ui/widget/layertypeicon.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include "ui/widget/layertypeicon.h" @@ -18,6 +18,7 @@ #include "widgets/icon.h" #include "widgets/toolbox.h" #include "ui/icon-names.h" +#include "layertypeicon.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index 6acb5a4c7..d21e848f2 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -13,6 +13,7 @@ */ #ifdef HAVE_CONFIG_H +# include #endif #include "licensor.h" @@ -26,6 +27,7 @@ #include "document-undo.h" #include "document-private.h" #include "verbs.h" +#include namespace Inkscape { diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index c8ac20c54..8acf083d0 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -14,6 +14,8 @@ #include "ui/widget/object-composite-settings.h" +#include + #include "desktop.h" #include "desktop-style.h" @@ -21,12 +23,17 @@ #include "document-undo.h" #include "filter-chemistry.h" #include "inkscape.h" +#include "selection.h" #include "style.h" +#include "sp-item.h" #include "svg/css-ostringstream.h" #include "verbs.h" +#include "xml/repr.h" #include "widgets/icon.h" +#include "ui/icon-names.h" #include "display/sp-canvas.h" #include "ui/widget/style-subject.h" +#include "ui/widget/gimpspinscale.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 4a1fe9ac6..19ab1a280 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -18,18 +18,35 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include "page-sizer.h" +#include +#include +#include +#include +#include + #include +#include <2geom/transforms.h> + +#include "document.h" +#include "desktop.h" #include "helper/action.h" +#include "helper/action-context.h" +#include "util/units.h" +#include "inkscape.h" +#include "sp-namedview.h" #include "sp-root.h" #include "ui/widget/button.h" +#include "ui/widget/scalar-unit.h" #include "verbs.h" +#include "xml/node.h" +#include "xml/repr.h" using std::pair; using Inkscape::Util::unit_table; diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 6ccd8b81a..ab13577d7 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -12,15 +12,20 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include // for Gtk::RESPONSE_* #include #include +#include +#include +#include #include +#include + #include "panel.h" #include "icon-size.h" #include "preferences.h" diff --git a/src/ui/widget/point.cpp b/src/ui/widget/point.cpp index 2c2eb5e8a..6aa6196bb 100644 --- a/src/ui/widget/point.cpp +++ b/src/ui/widget/point.cpp @@ -12,11 +12,14 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include "ui/widget/point.h" +#include "ui/widget/labelled.h" +#include "ui/widget/scalar.h" +#include namespace Inkscape { namespace UI { diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index b4c09cc0f..d56506d62 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include @@ -26,14 +26,19 @@ #include "verbs.h" #include "selcue.h" #include "io/sys.h" +#include #include "desktop.h" +#include "enums.h" #include "inkscape.h" #include "message-stack.h" #include "style.h" +#include "selection.h" #include "selection-chemistry.h" #include "ui/dialog/filedialog.h" +#include "xml/repr.h" +#include #include #ifdef WIN32 diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index cb192bf58..1d2d77699 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -19,6 +19,7 @@ # include #endif +#include #include #include diff --git a/src/ui/widget/random.cpp b/src/ui/widget/random.cpp index b6ea16b89..0a646b6fb 100644 --- a/src/ui/widget/random.cpp +++ b/src/ui/widget/random.cpp @@ -10,7 +10,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index af59fe1a0..572845668 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -14,19 +14,29 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include "registered-widget.h" +#include +#include "ui/widget/color-picker.h" +#include "ui/widget/registry.h" +#include "ui/widget/scalar-unit.h" +#include "ui/widget/point.h" +#include "ui/widget/random.h" #include "widgets/spinbutton-events.h" +#include "xml/repr.h" #include "svg/svg-color.h" #include "svg/stringstream.h" #include "verbs.h" // for interruptability bug: +#include "display/sp-canvas.h" + +#include "desktop.h" #include "sp-root.h" diff --git a/src/ui/widget/rendering-options.cpp b/src/ui/widget/rendering-options.cpp index 220731b7e..837387f7b 100644 --- a/src/ui/widget/rendering-options.cpp +++ b/src/ui/widget/rendering-options.cpp @@ -9,7 +9,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include diff --git a/src/ui/widget/rotateable.cpp b/src/ui/widget/rotateable.cpp index e0de22335..5e938dee6 100644 --- a/src/ui/widget/rotateable.cpp +++ b/src/ui/widget/rotateable.cpp @@ -8,11 +8,12 @@ */ #ifdef HAVE_CONFIG_H -#include +# include "config.h" #endif #include #include +#include #include <2geom/point.h> #include "ui/tools/tool-base.h" #include "rotateable.h" diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index 299b904c6..f7fd63f51 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -10,10 +10,11 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include "selected-style.h" +#include #include "widgets/spw-utilities.h" #include "ui/widget/color-preview.h" @@ -30,14 +31,19 @@ #include "ui/dialog/dialog-manager.h" #include "ui/dialog/fill-and-stroke.h" #include "ui/dialog/panel-dialog.h" +#include "xml/repr.h" +#include "document.h" #include "document-undo.h" #include "widgets/widget-sizes.h" #include "widgets/spinbutton-events.h" #include "widgets/gradient-image.h" +#include "sp-gradient.h" #include "svg/svg-color.h" #include "svg/css-ostringstream.h" #include "ui/tools/tool-base.h" #include "message-context.h" +#include "verbs.h" +#include "color.h" #include #include "pixmaps/cursor-adj-h.xpm" #include "pixmaps/cursor-adj-s.xpm" @@ -45,6 +51,7 @@ #include "pixmaps/cursor-adj-a.xpm" #include "sp-cursor.h" #include "gradient-chemistry.h" +#include "util/units.h" using Inkscape::Util::unit_table; diff --git a/src/ui/widget/spin-scale.cpp b/src/ui/widget/spin-scale.cpp index cb95e7405..bb08d67df 100644 --- a/src/ui/widget/spin-scale.cpp +++ b/src/ui/widget/spin-scale.cpp @@ -8,7 +8,9 @@ #include "spin-scale.h" +#include #include +#include #include "ui/widget/gimpspinscale.h" diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp index 4242d8c7d..9b361ae78 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -11,6 +11,7 @@ #include "spin-slider.h" #include +#include namespace Inkscape { namespace UI { diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp index d1776e630..d7669d4e5 100644 --- a/src/ui/widget/spinbutton.cpp +++ b/src/ui/widget/spinbutton.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include "spinbutton.h" diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index 811ed2221..da3bbcd20 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -8,6 +8,7 @@ #include "ui/widget/style-subject.h" #include "desktop.h" +#include "sp-object.h" #include "xml/sp-css-attr.h" #include "desktop-style.h" diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index 2952a3f97..188be705d 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -13,6 +13,9 @@ #include "style-swatch.h" +#include +#include + #include "widgets/spw-utilities.h" #include "ui/widget/color-preview.h" @@ -20,10 +23,13 @@ #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" #include "sp-pattern.h" +#include "xml/repr.h" #include "xml/sp-css-attr.h" #include "widgets/widget-sizes.h" #include "util/units.h" #include "helper/action.h" +#include "helper/action-context.h" +#include "preferences.h" #include "inkscape.h" #include "verbs.h" #include diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index e904666cc..ced811c57 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -9,7 +9,7 @@ */ #ifdef HAVE_CONFIG_H -#include +# include #endif #include -- cgit v1.2.3 From 58111034d09da960cf9982b703c6ab2647422e0b Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 28 Jul 2016 13:19:42 +0100 Subject: ui/widgets: Drop GTK2 fallbacks (bzr r15023.2.6) --- src/ui/widget/addtoicon.cpp | 33 ----- src/ui/widget/addtoicon.h | 14 -- src/ui/widget/anchor-selector.cpp | 10 -- src/ui/widget/anchor-selector.h | 12 +- src/ui/widget/clipmaskicon.cpp | 33 ----- src/ui/widget/clipmaskicon.h | 13 -- src/ui/widget/color-icc-selector.cpp | 23 --- src/ui/widget/color-icc-selector.h | 8 - src/ui/widget/color-notebook.cpp | 30 ---- src/ui/widget/color-notebook.h | 8 - src/ui/widget/color-picker.cpp | 5 - src/ui/widget/color-preview.cpp | 26 ---- src/ui/widget/color-preview.h | 6 - src/ui/widget/color-scales.cpp | 27 ---- src/ui/widget/color-scales.h | 8 - src/ui/widget/color-slider.cpp | 122 +--------------- src/ui/widget/color-slider.h | 18 --- src/ui/widget/color-wheel-selector.cpp | 46 +----- src/ui/widget/color-wheel-selector.h | 12 -- src/ui/widget/dock-item.cpp | 8 - src/ui/widget/dock.cpp | 12 -- src/ui/widget/gimpspinscale.c | 260 +-------------------------------- src/ui/widget/highlight-picker.cpp | 33 ----- src/ui/widget/highlight-picker.h | 14 -- src/ui/widget/imagetoggler.cpp | 33 ----- src/ui/widget/imagetoggler.h | 14 -- src/ui/widget/insertordericon.cpp | 32 ---- src/ui/widget/insertordericon.h | 13 -- src/ui/widget/layertypeicon.cpp | 33 ----- src/ui/widget/layertypeicon.h | 14 -- src/ui/widget/licensor.cpp | 8 - src/ui/widget/notebook-page.cpp | 12 -- src/ui/widget/notebook-page.h | 13 -- src/ui/widget/page-sizer.cpp | 43 ------ src/ui/widget/page-sizer.h | 26 +--- src/ui/widget/panel.cpp | 6 - src/ui/widget/panel.h | 18 +-- src/ui/widget/point.cpp | 4 - src/ui/widget/point.h | 4 - src/ui/widget/preferences-widget.cpp | 80 +--------- src/ui/widget/preferences-widget.h | 25 ---- src/ui/widget/random.cpp | 4 - src/ui/widget/random.h | 4 - src/ui/widget/scalar.cpp | 10 +- src/ui/widget/scalar.h | 4 - src/ui/widget/selected-style.cpp | 37 ----- src/ui/widget/selected-style.h | 15 +- src/ui/widget/spin-scale.cpp | 28 +--- src/ui/widget/spin-scale.h | 25 +--- src/ui/widget/spin-slider.cpp | 61 +------- src/ui/widget/spin-slider.h | 18 +-- src/ui/widget/style-swatch.cpp | 23 +-- src/ui/widget/style-swatch.h | 8 - src/ui/widget/tolerance-slider.cpp | 10 +- src/ui/widget/tolerance-slider.h | 10 -- 55 files changed, 41 insertions(+), 1375 deletions(-) (limited to 'src/ui') diff --git a/src/ui/widget/addtoicon.cpp b/src/ui/widget/addtoicon.cpp index 10294125d..ab50fcd8f 100644 --- a/src/ui/widget/addtoicon.cpp +++ b/src/ui/widget/addtoicon.cpp @@ -51,8 +51,6 @@ AddToIcon::AddToIcon() : set_pixbuf(); } - -#if WITH_GTKMM_3_0 void AddToIcon::get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const @@ -82,47 +80,16 @@ void AddToIcon::get_preferred_width_vfunc(Gtk::Widget& widget, nat_w += (nat_w) >> 1; } } -#else -void AddToIcon::get_size_vfunc(Gtk::Widget& widget, - const Gdk::Rectangle* cell_area, - int* x_offset, - int* y_offset, - int* width, - int* height ) const -{ - Gtk::CellRendererPixbuf::get_size_vfunc( widget, cell_area, x_offset, y_offset, width, height ); - - if ( width ) { - *width = phys;//+= (*width) >> 1; - } - if ( height ) { - *height =phys;//+= (*height) >> 1; - } -} -#endif -#if WITH_GTKMM_3_0 void AddToIcon::render_vfunc( const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags ) -#else -void AddToIcon::render_vfunc( const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags ) -#endif { set_pixbuf(); -#if WITH_GTKMM_3_0 Gtk::CellRendererPixbuf::render_vfunc( cr, widget, background_area, cell_area, flags ); -#else - Gtk::CellRendererPixbuf::render_vfunc( window, widget, background_area, cell_area, expose_area, flags ); -#endif } bool AddToIcon::activate_vfunc(GdkEvent* /*event*/, diff --git a/src/ui/widget/addtoicon.h b/src/ui/widget/addtoicon.h index a8d900d1f..3b2228754 100644 --- a/src/ui/widget/addtoicon.h +++ b/src/ui/widget/addtoicon.h @@ -31,8 +31,6 @@ public: Glib::PropertyProxy< Glib::RefPtr > property_pixbuf_off(); protected: - -#if WITH_GTKMM_3_0 virtual void render_vfunc( const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, @@ -46,18 +44,6 @@ protected: virtual void get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const; -#else - virtual void render_vfunc( const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags ); - - virtual void get_size_vfunc( Gtk::Widget &widget, - Gdk::Rectangle const *cell_area, - int *x_offset, int *y_offset, int *width, int *height ) const; -#endif virtual bool activate_vfunc(GdkEvent *event, Gtk::Widget &widget, diff --git a/src/ui/widget/anchor-selector.cpp b/src/ui/widget/anchor-selector.cpp index df00b786a..0d6030ac6 100644 --- a/src/ui/widget/anchor-selector.cpp +++ b/src/ui/widget/anchor-selector.cpp @@ -28,11 +28,7 @@ void AnchorSelector::setupButton(const Glib::ustring& icon, Gtk::ToggleButton& b AnchorSelector::AnchorSelector() : Gtk::Alignment(0.5, 0, 0, 0), -#if WITH_GTKMM_3_0 _container() -#else - _container(3, 3, true) -#endif { setupButton(INKSCAPE_ICON("boundingbox_top_left"), _buttons[0]); setupButton(INKSCAPE_ICON("boundingbox_top"), _buttons[1]); @@ -44,20 +40,14 @@ AnchorSelector::AnchorSelector() setupButton(INKSCAPE_ICON("boundingbox_bottom"), _buttons[7]); setupButton(INKSCAPE_ICON("boundingbox_bottom_right"), _buttons[8]); -#if WITH_GTKMM_3_0 _container.set_row_homogeneous(); _container.set_column_homogeneous(true); -#endif for(int i = 0; i < 9; ++i) { _buttons[i].signal_clicked().connect( sigc::bind(sigc::mem_fun(*this, &AnchorSelector::btn_activated), i)); -#if WITH_GTKMM_3_0 _container.attach(_buttons[i], i % 3, i / 3, 1, 1); -#else - _container.attach(_buttons[i], i % 3, i % 3+1, i / 3, i / 3+1, Gtk::FILL, Gtk::FILL); -#endif } _selection = 4; _buttons[4].set_active(); diff --git a/src/ui/widget/anchor-selector.h b/src/ui/widget/anchor-selector.h index 0a702d296..96331fae3 100644 --- a/src/ui/widget/anchor-selector.h +++ b/src/ui/widget/anchor-selector.h @@ -16,12 +16,7 @@ #include #include - -#if WITH_GTKMM_3_0 - #include -#else - #include -#endif +#include namespace Inkscape { namespace UI { @@ -32,12 +27,7 @@ class AnchorSelector : public Gtk::Alignment private: Gtk::ToggleButton _buttons[9]; int _selection; - -#if WITH_GTKMM_3_0 Gtk::Grid _container; -#else - Gtk::Table _container; -#endif sigc::signal _selectionChanged; diff --git a/src/ui/widget/clipmaskicon.cpp b/src/ui/widget/clipmaskicon.cpp index 421f1df1e..b914eeb2d 100644 --- a/src/ui/widget/clipmaskicon.cpp +++ b/src/ui/widget/clipmaskicon.cpp @@ -63,8 +63,6 @@ ClipMaskIcon::ClipMaskIcon() : property_pixbuf() = Glib::RefPtr(0); } - -#if WITH_GTKMM_3_0 void ClipMaskIcon::get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const @@ -94,39 +92,12 @@ void ClipMaskIcon::get_preferred_width_vfunc(Gtk::Widget& widget, nat_w += (nat_w) >> 1; } } -#else -void ClipMaskIcon::get_size_vfunc(Gtk::Widget& widget, - const Gdk::Rectangle* cell_area, - int* x_offset, - int* y_offset, - int* width, - int* height ) const -{ - Gtk::CellRendererPixbuf::get_size_vfunc( widget, cell_area, x_offset, y_offset, width, height ); - - if ( width ) { - *width = phys;//+= (*width) >> 1; - } - if ( height ) { - *height =phys;//+= (*height) >> 1; - } -} -#endif -#if WITH_GTKMM_3_0 void ClipMaskIcon::render_vfunc( const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags ) -#else -void ClipMaskIcon::render_vfunc( const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags ) -#endif { switch (_property_active.get_value()) { @@ -143,11 +114,7 @@ void ClipMaskIcon::render_vfunc( const Glib::RefPtr& window, property_pixbuf() = Glib::RefPtr(0); break; } -#if WITH_GTKMM_3_0 Gtk::CellRendererPixbuf::render_vfunc( cr, widget, background_area, cell_area, flags ); -#else - Gtk::CellRendererPixbuf::render_vfunc( window, widget, background_area, cell_area, expose_area, flags ); -#endif } bool ClipMaskIcon::activate_vfunc(GdkEvent* /*event*/, diff --git a/src/ui/widget/clipmaskicon.h b/src/ui/widget/clipmaskicon.h index eca852a83..0d149edb8 100644 --- a/src/ui/widget/clipmaskicon.h +++ b/src/ui/widget/clipmaskicon.h @@ -32,7 +32,6 @@ public: protected: -#if WITH_GTKMM_3_0 virtual void render_vfunc( const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, @@ -46,18 +45,6 @@ protected: virtual void get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const; -#else - virtual void render_vfunc( const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags ); - - virtual void get_size_vfunc( Gtk::Widget &widget, - Gdk::Rectangle const *cell_area, - int *x_offset, int *y_offset, int *width, int *height ) const; -#endif virtual bool activate_vfunc(GdkEvent *event, Gtk::Widget &widget, diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp index e4f58fe8a..04a5ab368 100644 --- a/src/ui/widget/color-icc-selector.cpp +++ b/src/ui/widget/color-icc-selector.cpp @@ -87,7 +87,6 @@ GtkAttachOptions operator|(GtkAttachOptions lhs, GtkAttachOptions rhs) void attachToGridOrTable(GtkWidget *parent, GtkWidget *child, guint left, guint top, guint width, guint height, bool hexpand = false, bool centered = false, guint xpadding = XPAD, guint ypadding = YPAD) { -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_start(child, xpadding); gtk_widget_set_margin_end(child, xpadding); @@ -106,14 +105,6 @@ void attachToGridOrTable(GtkWidget *parent, GtkWidget *child, guint left, guint gtk_widget_set_valign(child, GTK_ALIGN_CENTER); } gtk_grid_attach(GTK_GRID(parent), child, left, top, width, height); -#else - GtkAttachOptions xoptions = - centered ? static_cast(0) : hexpand ? (GTK_EXPAND | GTK_FILL) : GTK_FILL; - GtkAttachOptions yoptions = centered ? static_cast(0) : GTK_FILL; - - gtk_table_attach(GTK_TABLE(parent), child, left, left + width, top, top + height, xoptions, yoptions, xpadding, - ypadding); -#endif } } // namespace @@ -431,12 +422,7 @@ void ColorICCSelector::init() _impl->_compUI[i]._label = gtk_label_new_with_mnemonic(labelStr.c_str()); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_set_halign(_impl->_compUI[i]._label, GTK_ALIGN_END); -#else - gtk_misc_set_alignment(GTK_MISC(_impl->_compUI[i]._label), 1.0, 0.5); -#endif - gtk_widget_show(_impl->_compUI[i]._label); gtk_widget_set_no_show_all(_impl->_compUI[i]._label, TRUE); @@ -495,12 +481,7 @@ void ColorICCSelector::init() // Label _impl->_label = gtk_label_new_with_mnemonic(_("_A:")); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_set_halign(_impl->_label, GTK_ALIGN_END); -#else - gtk_misc_set_alignment(GTK_MISC(_impl->_label), 1.0, 0.5); -#endif - gtk_widget_show(_impl->_label); attachToGridOrTable(t, _impl->_label, 0, row, 1, 1); @@ -727,11 +708,7 @@ void ColorICCSelectorImpl::_profilesChanged(std::string const & /*name*/) {} void ColorICCSelector::on_show() { -#if GTK_CHECK_VERSION(3, 0, 0) Gtk::Grid::on_show(); -#else - Gtk::Table::on_show(); -#endif _colorChanged(); } diff --git a/src/ui/widget/color-icc-selector.h b/src/ui/widget/color-icc-selector.h index 1bcb0a540..aaa8372b8 100644 --- a/src/ui/widget/color-icc-selector.h +++ b/src/ui/widget/color-icc-selector.h @@ -6,11 +6,7 @@ #endif #include -#if WITH_GTKMM_3_0 #include -#else -#include -#endif #include "ui/selected-color.h" @@ -24,11 +20,7 @@ namespace Widget { class ColorICCSelectorImpl; class ColorICCSelector -#if GTK_CHECK_VERSION(3, 0, 0) : public Gtk::Grid -#else - : public Gtk::Table -#endif { public: static const gchar *MODE_NAME; diff --git a/src/ui/widget/color-notebook.cpp b/src/ui/widget/color-notebook.cpp index 6d7ada734..d2c4efc74 100644 --- a/src/ui/widget/color-notebook.cpp +++ b/src/ui/widget/color-notebook.cpp @@ -56,13 +56,8 @@ namespace Widget { ColorNotebook::ColorNotebook(SelectedColor &color) -#if GTK_CHECK_VERSION(3, 0, 0) : Gtk::Grid() -#else - : Gtk::Table(2, 3, false) -#endif , _selected_color(color) - { Page *page; @@ -110,12 +105,8 @@ void ColorNotebook::_initUI() notebook->set_show_tabs(false); _book = GTK_WIDGET(notebook->gobj()); -#if GTK_CHECK_VERSION(3, 0, 0) _buttonbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_set_homogeneous(GTK_BOX(_buttonbox), TRUE); -#else - _buttonbox = gtk_hbox_new(TRUE, 2); -#endif gtk_widget_show(_buttonbox); _buttons = new GtkWidget *[_available_pages.size()]; @@ -126,7 +117,6 @@ void ColorNotebook::_initUI() sp_set_font_size_smaller(_buttonbox); -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_start(_buttonbox, XPAD); gtk_widget_set_margin_end(_buttonbox, XPAD); @@ -139,14 +129,9 @@ void ColorNotebook::_initUI() gtk_widget_set_hexpand(_buttonbox, TRUE); gtk_widget_set_valign(_buttonbox, GTK_ALIGN_CENTER); attach(*Glib::wrap(_buttonbox), 0, row, 2, 1); -#else - attach(*Glib::wrap(_buttonbox), 0, 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, static_cast(0), - XPAD, YPAD); -#endif row++; -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_start(_book, XPAD * 2); gtk_widget_set_margin_end(_book, XPAD * 2); @@ -159,20 +144,13 @@ void ColorNotebook::_initUI() gtk_widget_set_hexpand(_book, TRUE); gtk_widget_set_vexpand(_book, TRUE); attach(*notebook, 0, row, 2, 1); -#else - attach(*notebook, 0, 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, XPAD * 2, YPAD); -#endif // restore the last active page Inkscape::Preferences *prefs = Inkscape::Preferences::get(); _setCurrentPage(prefs->getInt("/colorselector/page", 0)); row++; -#if GTK_CHECK_VERSION(3, 0, 0) GtkWidget *rgbabox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); -#else - GtkWidget *rgbabox = gtk_hbox_new(FALSE, 0); -#endif #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* Create color management icons */ @@ -210,11 +188,7 @@ void ColorNotebook::_initUI() /* Create RGBA entry and color preview */ _rgbal = gtk_label_new_with_mnemonic(_("RGBA_:")); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_set_halign(_rgbal, GTK_ALIGN_END); -#else - gtk_misc_set_alignment(GTK_MISC(_rgbal), 1.0, 0.5); -#endif gtk_box_pack_start(GTK_BOX(rgbabox), _rgbal, TRUE, TRUE, 2); ColorEntry *rgba_entry = Gtk::manage(new ColorEntry(_selected_color)); @@ -230,7 +204,6 @@ void ColorNotebook::_initUI() gtk_widget_hide(GTK_WIDGET(_box_toomuchink)); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_start(rgbabox, XPAD); gtk_widget_set_margin_end(rgbabox, XPAD); @@ -241,9 +214,6 @@ void ColorNotebook::_initUI() gtk_widget_set_margin_top(rgbabox, YPAD); gtk_widget_set_margin_bottom(rgbabox, YPAD); attach(*Glib::wrap(rgbabox), 0, row, 2, 1); -#else - attach(*Glib::wrap(rgbabox), 0, 2, row, row + 1, Gtk::FILL, Gtk::SHRINK, XPAD, YPAD); -#endif #ifdef SPCS_PREVIEW _p = sp_color_preview_new(0xffffffff); diff --git a/src/ui/widget/color-notebook.h b/src/ui/widget/color-notebook.h index d28028c72..35e46ef14 100644 --- a/src/ui/widget/color-notebook.h +++ b/src/ui/widget/color-notebook.h @@ -19,11 +19,7 @@ #endif #include -#if WITH_GTKMM_3_0 #include -#else -#include -#endif #include #include @@ -35,11 +31,7 @@ namespace UI { namespace Widget { class ColorNotebook -#if GTK_CHECK_VERSION(3, 0, 0) : public Gtk::Grid -#else - : public Gtk::Table -#endif { public: ColorNotebook(SelectedColor &color); diff --git a/src/ui/widget/color-picker.cpp b/src/ui/widget/color-picker.cpp index a66fbfc9c..5a62c3c98 100644 --- a/src/ui/widget/color-picker.cpp +++ b/src/ui/widget/color-picker.cpp @@ -59,13 +59,8 @@ void ColorPicker::setupDialog(const Glib::ustring &title) _color_selector = Gtk::manage(new ColorNotebook(_selected_color)); -#if WITH_GTKMM_3_0 _colorSelectorDialog.get_content_area()->pack_start ( *_color_selector, true, true, 0); -#else - _colorSelectorDialog.get_vbox()->pack_start ( - *_color_selector, true, true, 0); -#endif _color_selector->show(); } diff --git a/src/ui/widget/color-preview.cpp b/src/ui/widget/color-preview.cpp index 62c7cca1d..c9b6e56d2 100644 --- a/src/ui/widget/color-preview.cpp +++ b/src/ui/widget/color-preview.cpp @@ -34,7 +34,6 @@ ColorPreview::on_size_allocate (Gtk::Allocation &all) queue_draw(); } -#if WITH_GTKMM_3_0 void ColorPreview::get_preferred_height_vfunc(int& minimum_height, int& natural_height) const { @@ -58,31 +57,6 @@ ColorPreview::get_preferred_width_for_height_vfunc(int /* height */, int& minimu { minimum_width = natural_width = SPCP_DEFAULT_WIDTH; } -#else -void -ColorPreview::on_size_request (Gtk::Requisition *req) -{ - req->width = SPCP_DEFAULT_WIDTH; - req->height = SPCP_DEFAULT_HEIGHT; -} - -bool -ColorPreview::on_expose_event (GdkEventExpose *event) -{ - bool result = true; - - if (get_is_drawable()) - { - Cairo::RefPtr cr = get_window()->create_cairo_context(); - cr->rectangle(event->area.x, event->area.y, - event->area.width, event->area.height); - cr->clip(); - result = on_draw(cr); - } - - return result; -} -#endif void ColorPreview::setRgba32 (guint32 rgba) diff --git a/src/ui/widget/color-preview.h b/src/ui/widget/color-preview.h index caddfb9a2..1276cf42b 100644 --- a/src/ui/widget/color-preview.h +++ b/src/ui/widget/color-preview.h @@ -33,16 +33,10 @@ public: protected: virtual void on_size_allocate (Gtk::Allocation &all); -#if WITH_GTKMM_3_0 virtual void get_preferred_height_vfunc(int& minimum_height, int& natural_height) const; virtual void get_preferred_height_for_width_vfunc(int width, int& minimum_height, int& natural_height) const; virtual void get_preferred_width_vfunc(int& minimum_width, int& natural_width) const; virtual void get_preferred_width_for_height_vfunc(int height, int& minimum_width, int& natural_width) const; -#else - virtual void on_size_request (Gtk::Requisition *req); - virtual bool on_expose_event(GdkEventExpose *event); -#endif - virtual bool on_draw(const Cairo::RefPtr& cr); guint32 _rgba; diff --git a/src/ui/widget/color-scales.cpp b/src/ui/widget/color-scales.cpp index 48a2693bc..6afa7f939 100644 --- a/src/ui/widget/color-scales.cpp +++ b/src/ui/widget/color-scales.cpp @@ -46,11 +46,7 @@ static const gchar *sp_color_scales_hue_map(); const gchar *ColorScales::SUBMODE_NAMES[] = { N_("None"), N_("RGB"), N_("HSL"), N_("CMYK") }; ColorScales::ColorScales(SelectedColor &color, SPColorScalesMode mode) -#if GTK_CHECK_VERSION(3, 0, 0) : Gtk::Grid() -#else - : Gtk::Table(5, 3, false) -#endif , _color(color) , _rangeLimit(255.0) , _updating(FALSE) @@ -93,15 +89,9 @@ void ColorScales::_initUI(SPColorScalesMode mode) /* Label */ _l[i] = gtk_label_new(""); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_set_halign(_l[i], GTK_ALIGN_END); -#else - gtk_misc_set_alignment(GTK_MISC(_l[i]), 1.0, 0.5); -#endif - gtk_widget_show(_l[i]); -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_start(_l[i], XPAD); gtk_widget_set_margin_end(_l[i], XPAD); @@ -112,9 +102,6 @@ void ColorScales::_initUI(SPColorScalesMode mode) gtk_widget_set_margin_top(_l[i], YPAD); gtk_widget_set_margin_bottom(_l[i], YPAD); gtk_grid_attach(GTK_GRID(t), _l[i], 0, i, 1, 1); -#else - gtk_table_attach(GTK_TABLE(t), _l[i], 0, 1, i, i + 1, GTK_FILL, GTK_FILL, XPAD, YPAD); -#endif /* Adjustment */ _a[i] = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, _rangeLimit, 1.0, 10.0, 10.0)); @@ -122,7 +109,6 @@ void ColorScales::_initUI(SPColorScalesMode mode) _s[i] = Gtk::manage(new Inkscape::UI::Widget::ColorSlider(Glib::wrap(_a[i], true))); _s[i]->show(); -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) _s[i]->set_margin_start(XPAD); _s[i]->set_margin_end(XPAD); @@ -134,10 +120,6 @@ void ColorScales::_initUI(SPColorScalesMode mode) _s[i]->set_margin_bottom(YPAD); _s[i]->set_hexpand(true); gtk_grid_attach(GTK_GRID(t), _s[i]->gobj(), 1, i, 1, 1); -#else - gtk_table_attach(GTK_TABLE(t), _s[i]->gobj(), 1, 2, i, i + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), - GTK_FILL, XPAD, YPAD); -#endif /* Spinbutton */ _b[i] = gtk_spin_button_new(GTK_ADJUSTMENT(_a[i]), 1.0, 0); @@ -145,7 +127,6 @@ void ColorScales::_initUI(SPColorScalesMode mode) gtk_label_set_mnemonic_widget(GTK_LABEL(_l[i]), _b[i]); gtk_widget_show(_b[i]); -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_start(_b[i], XPAD); gtk_widget_set_margin_end(_b[i], XPAD); @@ -158,9 +139,6 @@ void ColorScales::_initUI(SPColorScalesMode mode) gtk_widget_set_halign(_b[i], GTK_ALIGN_CENTER); gtk_widget_set_valign(_b[i], GTK_ALIGN_CENTER); gtk_grid_attach(GTK_GRID(t), _b[i], 2, i, 1, 1); -#else - gtk_table_attach(GTK_TABLE(t), _b[i], 2, 3, i, i + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD); -#endif /* Attach channel value to adjustment */ g_object_set_data(G_OBJECT(_a[i]), "channel", GINT_TO_POINTER(i)); @@ -272,7 +250,6 @@ void ColorScales::_setRangeLimit(gdouble upper) _rangeLimit = upper; for (gint i = 0; i < static_cast(G_N_ELEMENTS(_a)); i++) { gtk_adjustment_set_upper(_a[i], upper); - gtk_adjustment_changed(_a[i]); } } @@ -286,11 +263,7 @@ void ColorScales::_onColorChanged() void ColorScales::on_show() { -#if GTK_CHECK_VERSION(3, 0, 0) Gtk::Grid::on_show(); -#else - Gtk::Table::on_show(); -#endif _updateDisplay(); } diff --git a/src/ui/widget/color-scales.h b/src/ui/widget/color-scales.h index aeacfbcc1..1e86d762d 100644 --- a/src/ui/widget/color-scales.h +++ b/src/ui/widget/color-scales.h @@ -5,11 +5,7 @@ #include #endif -#if WITH_GTKMM_3_0 #include -#else -#include -#endif #include "ui/selected-color.h" @@ -27,11 +23,7 @@ typedef enum { } SPColorScalesMode; class ColorScales -#if GTK_CHECK_VERSION(3, 0, 0) : public Gtk::Grid -#else - : public Gtk::Table -#endif { public: static const gchar *SUBMODE_NAMES[]; diff --git a/src/ui/widget/color-slider.cpp b/src/ui/widget/color-slider.cpp index 0c9586a67..2a8b6a7a2 100644 --- a/src/ui/widget/color-slider.cpp +++ b/src/ui/widget/color-slider.cpp @@ -19,12 +19,7 @@ #include #include #include -#if WITH_GTKMM_3_0 #include -#else -#include -#endif -#include #include "ui/widget/color-scales.h" #include "ui/widget/color-slider.h" @@ -43,14 +38,8 @@ namespace Inkscape { namespace UI { namespace Widget { -#if GTK_CHECK_VERSION(3, 0, 0) ColorSlider::ColorSlider(Glib::RefPtr adjustment) : _dragging(false) -#else -ColorSlider::ColorSlider(Gtk::Adjustment *adjustment) - : _dragging(false) - , _adjustment(NULL) -#endif , _value(0.0) , _oldvalue(0.0) , _mapsize(0) @@ -83,12 +72,7 @@ ColorSlider::~ColorSlider() if (_adjustment) { _adjustment_changed_connection.disconnect(); _adjustment_value_changed_connection.disconnect(); -#if GTK_CHECK_VERSION(3, 0, 0) _adjustment.reset(); -#else - _adjustment->unreference(); - _adjustment = NULL; -#endif } } @@ -109,26 +93,15 @@ void ColorSlider::on_realize() attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gdk_screen_get_system_visual(gdk_screen_get_default()); -#if !GTK_CHECK_VERSION(3, 0, 0) - attributes.colormap = gdk_screen_get_system_colormap(gdk_screen_get_default()); -#endif attributes.event_mask = get_events(); attributes.event_mask |= (Gdk::EXPOSURE_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK); -#if GTK_CHECK_VERSION(3, 0, 0) attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; -#else - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; -#endif _gdk_window = Gdk::Window::create(get_parent_window(), &attributes, attributes_mask); set_window(_gdk_window); _gdk_window->set_user_data(gobj()); - -#if !GTK_CHECK_VERSION(3, 0, 0) - style_attach(); -#endif } } @@ -149,8 +122,6 @@ void ColorSlider::on_size_allocate(Gtk::Allocation &allocation) } } -#if GTK_CHECK_VERSION(3, 0, 0) - void ColorSlider::get_preferred_width_vfunc(int &minimum_width, int &natural_width) const { Glib::RefPtr style_context = get_style_context(); @@ -177,38 +148,12 @@ void ColorSlider::get_preferred_height_for_width_vfunc(int /*width*/, int &minim get_preferred_height(minimum_height, natural_height); } -#else - -void ColorSlider::on_size_request(Gtk::Requisition *requisition) -{ - GtkStyle *style = gtk_widget_get_style(gobj()); - requisition->width = SLIDER_WIDTH + style->xthickness * 2; - requisition->height = SLIDER_HEIGHT + style->ythickness * 2; -} - -bool ColorSlider::on_expose_event(GdkEventExpose *event) -{ - bool result = false; - - if (get_is_drawable()) { - Cairo::RefPtr cr = _gdk_window->create_cairo_context(); - result = on_draw(cr); - } - return result; -} - -#endif - bool ColorSlider::on_button_press_event(GdkEventButton *event) { if (event->button == 1) { Gtk::Allocation allocation = get_allocation(); gint cx, cw; -#if GTK_CHECK_VERSION(3, 0, 0) cx = get_style_context()->get_padding(get_state_flags()).get_left(); -#else - cx = get_style()->get_xthickness(); -#endif cw = allocation.get_width() - 2 * cx; signal_grabbed.emit(); _dragging = true; @@ -216,15 +161,9 @@ bool ColorSlider::on_button_press_event(GdkEventButton *event) ColorScales::setScaled(_adjustment->gobj(), CLAMP((gfloat)(event->x - cx) / cw, 0.0, 1.0)); signal_dragged.emit(); -#if GTK_CHECK_VERSION(3, 0, 0) gdk_device_grab( gdk_event_get_device(reinterpret_cast(event)), _gdk_window->gobj(), GDK_OWNERSHIP_NONE, FALSE, static_cast(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK), NULL, event->time); -#else - gdk_pointer_grab(get_window()->gobj(), FALSE, - static_cast(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK), NULL, NULL, - event->time); -#endif } return false; @@ -233,13 +172,8 @@ bool ColorSlider::on_button_press_event(GdkEventButton *event) bool ColorSlider::on_button_release_event(GdkEventButton *event) { if (event->button == 1) { - -#if GTK_CHECK_VERSION(3, 0, 0) gdk_device_ungrab(gdk_event_get_device(reinterpret_cast(event)), gdk_event_get_time(reinterpret_cast(event))); -#else - get_window()->pointer_ungrab(event->time); -#endif _dragging = false; signal_released.emit(); @@ -256,11 +190,7 @@ bool ColorSlider::on_motion_notify_event(GdkEventMotion *event) if (_dragging) { gint cx, cw; Gtk::Allocation allocation = get_allocation(); -#if GTK_CHECK_VERSION(3, 0, 0) cx = get_style_context()->get_padding(get_state_flags()).get_left(); -#else - cx = get_style()->get_xthickness(); -#endif cw = allocation.get_width() - 2 * cx; ColorScales::setScaled(_adjustment->gobj(), CLAMP((gfloat)(event->x - cx) / cw, 0.0, 1.0)); signal_dragged.emit(); @@ -269,19 +199,10 @@ bool ColorSlider::on_motion_notify_event(GdkEventMotion *event) return false; } -#if GTK_CHECK_VERSION(3, 0, 0) void ColorSlider::setAdjustment(Glib::RefPtr adjustment) { -#else -void ColorSlider::setAdjustment(Gtk::Adjustment *adjustment) -{ -#endif if (!adjustment) { -#if GTK_CHECK_VERSION(3, 0, 0) _adjustment = Gtk::Adjustment::create(0.0, 0.0, 1.0, 0.01, 0.0, 0.0); -#else - _adjustment = Gtk::manage(new Gtk::Adjustment(0.0, 0.0, 1.0, 0.01, 0.0, 0.0)); -#endif } else { adjustment->set_page_increment(0.0); @@ -292,9 +213,6 @@ void ColorSlider::setAdjustment(Gtk::Adjustment *adjustment) if (_adjustment) { _adjustment_changed_connection.disconnect(); _adjustment_value_changed_connection.disconnect(); -#if !GTK_CHECK_VERSION(3, 0, 0) - _adjustment->unreference(); -#endif } _adjustment = adjustment; @@ -315,18 +233,11 @@ void ColorSlider::_onAdjustmentValueChanged() { if (_value != ColorScales::getScaled(_adjustment->gobj())) { gint cx, cy, cw, ch; -#if GTK_CHECK_VERSION(3, 0, 0) - Glib::RefPtr style_context = get_style_context(); - Gtk::Allocation allocation = get_allocation(); - Gtk::Border padding = style_context->get_padding(get_state_flags()); + auto style_context = get_style_context(); + auto allocation = get_allocation(); + auto padding = style_context->get_padding(get_state_flags()); cx = padding.get_left(); cy = padding.get_top(); -#else - Glib::RefPtr style = get_style(); - Gtk::Allocation allocation = get_allocation(); - cx = style->get_xthickness(); - cy = style->get_ythickness(); -#endif cw = allocation.get_width() - 2 * cx; ch = allocation.get_height() - 2 * cy; if ((gint)(ColorScales::getScaled(_adjustment->gobj()) * cw) != (gint)(_value * cw)) { @@ -390,40 +301,22 @@ bool ColorSlider::on_draw(const Cairo::RefPtr &cr) { gboolean colorsOnTop = Inkscape::Preferences::get()->getBool("/options/workarounds/colorsontop", false); - Gtk::Allocation allocation = get_allocation(); - -#if GTK_CHECK_VERSION(3, 0, 0) - Glib::RefPtr style_context = get_style_context(); -#else - Glib::RefPtr window = get_window(); - Glib::RefPtr style = get_style(); -#endif + auto allocation = get_allocation(); + auto style_context = get_style_context(); // Draw shadow if (colorsOnTop) { -#if GTK_CHECK_VERSION(3, 0, 0) style_context->render_frame(cr, 0, 0, allocation.get_width(), allocation.get_height()); -#else - gtk_paint_shadow(style->gobj(), window->gobj(), gtk_widget_get_state(gobj()), GTK_SHADOW_IN, NULL, gobj(), - "colorslider", 0, 0, allocation.get_width(), allocation.get_height()); -#endif } /* Paintable part of color gradient area */ Gdk::Rectangle carea; - -#if GTK_CHECK_VERSION(3, 0, 0) Gtk::Border padding; padding = style_context->get_padding(get_state_flags()); carea.set_x(padding.get_left()); carea.set_y(padding.get_top()); - ; -#else - carea.set_x(style->get_xthickness()); - carea.set_y(style->get_ythickness()); -#endif carea.set_width(allocation.get_width() - 2 * carea.get_x()); carea.set_height(allocation.get_height() - 2 * carea.get_y()); @@ -491,12 +384,7 @@ bool ColorSlider::on_draw(const Cairo::RefPtr &cr) /* Draw shadow */ if (!colorsOnTop) { -#if GTK_CHECK_VERSION(3, 0, 0) style_context->render_frame(cr, 0, 0, allocation.get_width(), allocation.get_height()); -#else - gtk_paint_shadow(style->gobj(), window->gobj(), gtk_widget_get_state(gobj()), GTK_SHADOW_IN, NULL, gobj(), - "colorslider", 0, 0, allocation.get_width(), allocation.get_height()); -#endif } /* Draw arrow */ diff --git a/src/ui/widget/color-slider.h b/src/ui/widget/color-slider.h index 253f3123c..9be6c356a 100644 --- a/src/ui/widget/color-slider.h +++ b/src/ui/widget/color-slider.h @@ -24,18 +24,10 @@ namespace Widget { */ class ColorSlider : public Gtk::Widget { public: -#if GTK_CHECK_VERSION(3, 0, 0) ColorSlider(Glib::RefPtr adjustment); -#else - ColorSlider(Gtk::Adjustment *adjustment); -#endif ~ColorSlider(); -#if GTK_CHECK_VERSION(3, 0, 0) void setAdjustment(Glib::RefPtr adjustment); -#else - void setAdjustment(Gtk::Adjustment *adjustment); -#endif void setColors(guint32 start, guint32 mid, guint32 end); @@ -56,16 +48,10 @@ protected: bool on_button_release_event(GdkEventButton *event); bool on_motion_notify_event(GdkEventMotion *event); bool on_draw(const Cairo::RefPtr &cr); - -#if GTK_CHECK_VERSION(3, 0, 0) void get_preferred_width_vfunc(int &minimum_width, int &natural_width) const; void get_preferred_width_for_height_vfunc(int height, int &minimum_width, int &natural_width) const; void get_preferred_height_vfunc(int &minimum_height, int &natural_height) const; void get_preferred_height_for_width_vfunc(int width, int &minimum_height, int &natural_height) const; -#else - void on_size_request(Gtk::Requisition *requisition); - bool on_expose_event(GdkEventExpose *event); -#endif private: void _onAdjustmentChanged(); @@ -73,11 +59,7 @@ private: bool _dragging; -#if GTK_CHECK_VERSION(3, 0, 0) Glib::RefPtr _adjustment; -#else - Gtk::Adjustment *_adjustment; -#endif sigc::connection _adjustment_changed_connection; sigc::connection _adjustment_value_changed_connection; diff --git a/src/ui/widget/color-wheel-selector.cpp b/src/ui/widget/color-wheel-selector.cpp index 22c616325..9b4119572 100644 --- a/src/ui/widget/color-wheel-selector.cpp +++ b/src/ui/widget/color-wheel-selector.cpp @@ -29,16 +29,9 @@ namespace Widget { const gchar *ColorWheelSelector::MODE_NAME = N_("Wheel"); ColorWheelSelector::ColorWheelSelector(SelectedColor &color) -#if GTK_CHECK_VERSION(3, 0, 0) : Gtk::Grid() -#else - : Gtk::Table(5, 3, false) -#endif , _color(color) , _updating(false) -#if !GTK_CHECK_VERSION(3, 0, 0) - , _alpha_adjustment(NULL) -#endif , _wheel(0) , _slider(0) { @@ -50,9 +43,6 @@ ColorWheelSelector::ColorWheelSelector(SelectedColor &color) ColorWheelSelector::~ColorWheelSelector() { _wheel = 0; -#if !GTK_CHECK_VERSION(3, 0, 0) - delete _alpha_adjustment; -#endif _color_changed_connection.disconnect(); _color_dragged_connection.disconnect(); @@ -66,16 +56,11 @@ void ColorWheelSelector::_initUI() _wheel = gimp_color_wheel_new(); gtk_widget_show(_wheel); -#if GTK_CHECK_VERSION(3, 0, 0) gtk_widget_set_halign(_wheel, GTK_ALIGN_FILL); gtk_widget_set_valign(_wheel, GTK_ALIGN_FILL); gtk_widget_set_hexpand(_wheel, TRUE); gtk_widget_set_vexpand(_wheel, TRUE); gtk_grid_attach(GTK_GRID(gobj()), _wheel, 0, row, 3, 1); -#else - gtk_table_attach(GTK_TABLE(gobj()), _wheel, 0, 3, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), - (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0); -#endif row++; @@ -84,7 +69,6 @@ void ColorWheelSelector::_initUI() label->set_alignment(1.0, 0.5); label->show(); -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) label->set_margin_start(XPAD); label->set_margin_end(XPAD); @@ -97,22 +81,15 @@ void ColorWheelSelector::_initUI() label->set_halign(Gtk::ALIGN_FILL); label->set_valign(Gtk::ALIGN_FILL); attach(*label, 0, row, 1, 1); -#else - attach(*label, 0, 1, row, row + 1, Gtk::FILL, Gtk::FILL, XPAD, YPAD); -#endif -/* Adjustment */ -#if GTK_CHECK_VERSION(3, 0, 0) + /* Adjustment */ _alpha_adjustment = Gtk::Adjustment::create(0.0, 0.0, 255.0, 1.0, 10.0, 10.0); -#else - _alpha_adjustment = new Gtk::Adjustment(0.0, 0.0, 255.0, 1.0, 10.0, 10.0); -#endif + /* Slider */ _slider = Gtk::manage(new Inkscape::UI::Widget::ColorSlider(_alpha_adjustment)); _slider->set_tooltip_text(_("Alpha (opacity)")); _slider->show(); -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) _slider->set_margin_start(XPAD); _slider->set_margin_end(XPAD); @@ -126,25 +103,17 @@ void ColorWheelSelector::_initUI() _slider->set_halign(Gtk::ALIGN_FILL); _slider->set_valign(Gtk::ALIGN_FILL); attach(*_slider, 1, row, 1, 1); -#else - attach(*_slider, 1, 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::FILL, XPAD, YPAD); -#endif _slider->setColors(SP_RGBA32_F_COMPOSE(1.0, 1.0, 1.0, 0.0), SP_RGBA32_F_COMPOSE(1.0, 1.0, 1.0, 0.5), SP_RGBA32_F_COMPOSE(1.0, 1.0, 1.0, 1.0)); -/* Spinbutton */ -#if GTK_CHECK_VERSION(3, 0, 0) - Gtk::SpinButton *spin_button = Gtk::manage(new Gtk::SpinButton(_alpha_adjustment, 1.0, 0)); -#else - Gtk::SpinButton *spin_button = Gtk::manage(new Gtk::SpinButton(*_alpha_adjustment, 1.0, 0)); -#endif + /* Spinbutton */ + auto spin_button = Gtk::manage(new Gtk::SpinButton(_alpha_adjustment, 1.0, 0)); spin_button->set_tooltip_text(_("Alpha (opacity)")); sp_dialog_defocus_on_enter(GTK_WIDGET(spin_button->gobj())); label->set_mnemonic_widget(*spin_button); spin_button->show(); -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) spin_button->set_margin_start(XPAD); spin_button->set_margin_end(XPAD); @@ -157,9 +126,6 @@ void ColorWheelSelector::_initUI() spin_button->set_halign(Gtk::ALIGN_CENTER); spin_button->set_valign(Gtk::ALIGN_CENTER); attach(*spin_button, 2, row, 1, 1); -#else - attach(*spin_button, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, XPAD, YPAD); -#endif /* Signals */ _alpha_adjustment->signal_value_changed().connect(sigc::mem_fun(this, &ColorWheelSelector::_adjustmentChanged)); @@ -172,11 +138,7 @@ void ColorWheelSelector::_initUI() void ColorWheelSelector::on_show() { -#if GTK_CHECK_VERSION(3, 0, 0) Gtk::Grid::on_show(); -#else - Gtk::Table::on_show(); -#endif _updateDisplay(); } diff --git a/src/ui/widget/color-wheel-selector.h b/src/ui/widget/color-wheel-selector.h index 5711d417c..ee7bd9b83 100644 --- a/src/ui/widget/color-wheel-selector.h +++ b/src/ui/widget/color-wheel-selector.h @@ -16,11 +16,7 @@ #include #endif -#if WITH_GTKMM_3_0 #include -#else -#include -#endif #include "ui/selected-color.h" @@ -33,11 +29,7 @@ namespace Widget { class ColorSlider; class ColorWheelSelector -#if GTK_CHECK_VERSION(3, 0, 0) : public Gtk::Grid -#else - : public Gtk::Table -#endif { public: static const gchar *MODE_NAME; @@ -61,11 +53,7 @@ protected: SelectedColor &_color; bool _updating; -#if GTK_CHECK_VERSION(3, 0, 0) Glib::RefPtr _alpha_adjustment; -#else - Gtk::Adjustment *_alpha_adjustment; -#endif GtkWidget *_wheel; Inkscape::UI::Widget::ColorSlider *_slider; diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 8d960ddc3..fc41efe52 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -59,11 +59,7 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l Gtk::StockItem item; Gtk::StockID stockId(icon_name); if ( Gtk::StockItem::lookup(stockId, item) ) { -#if WITH_GTKMM_3_0 _icon_pixbuf = _dock.getWidget().render_icon_pixbuf( stockId, Gtk::ICON_SIZE_MENU ); -#else - _icon_pixbuf = _dock.getWidget().render_icon( stockId, Gtk::ICON_SIZE_MENU ); -#endif } } } @@ -175,12 +171,8 @@ DockItem::set_size_request(int width, int height) void DockItem::size_request(Gtk::Requisition& requisition) { -#if WITH_GTKMM_3_0 Gtk::Requisition req_natural; getWidget().get_preferred_size(req_natural, requisition); -#else - requisition = getWidget().size_request(); -#endif } void diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp index fda647182..7744cb695 100644 --- a/src/ui/widget/dock.cpp +++ b/src/ui/widget/dock.cpp @@ -65,7 +65,6 @@ Dock::Dock(Gtk::Orientation orientation) static_cast(orientation)); #endif -#if WITH_GTKMM_3_0 switch(orientation) { case Gtk::ORIENTATION_VERTICAL: _dock_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL)); @@ -75,17 +74,6 @@ Dock::Dock(Gtk::Orientation orientation) } _paned = Gtk::manage(new Gtk::Paned(orientation)); -#else - switch (orientation) { - case Gtk::ORIENTATION_VERTICAL: - _dock_box = Gtk::manage(new Gtk::HBox()); - _paned = Gtk::manage(new Gtk::VPaned()); - break; - case Gtk::ORIENTATION_HORIZONTAL: - _dock_box = Gtk::manage(new Gtk::VBox()); - _paned = Gtk::manage(new Gtk::HPaned()); - } -#endif _scrolled_window->add(*_dock_box); _scrolled_window->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); diff --git a/src/ui/widget/gimpspinscale.c b/src/ui/widget/gimpspinscale.c index d99646a64..8d8c6c935 100644 --- a/src/ui/widget/gimpspinscale.c +++ b/src/ui/widget/gimpspinscale.c @@ -41,10 +41,8 @@ typedef enum { TARGET_NUMBER, TARGET_UPPER, - TARGET_LOWER -#if WITH_GTKMM_3_0 - ,TARGET_NONE -#endif + TARGET_LOWER, + TARGET_NONE } SpinScaleTarget; typedef enum @@ -94,7 +92,6 @@ static void gimp_spin_scale_get_property (GObject *object, static void gimp_spin_scale_style_set (GtkWidget *widget, GtkStyle *prev_style); -#if WITH_GTKMM_3_0 static void gimp_spin_scale_get_preferred_width (GtkWidget *widget, gint *minimum_width, gint *natural_width); @@ -103,13 +100,6 @@ static void gimp_spin_scale_get_preferred_height (GtkWidget *widget gint *natural_width); static gboolean gimp_spin_scale_draw (GtkWidget *widget, cairo_t *cr); -#else -static void gimp_spin_scale_size_request (GtkWidget *widget, - GtkRequisition *requisition); - -static gboolean gimp_spin_scale_expose (GtkWidget *widget, - GdkEventExpose *event); -#endif static gboolean gimp_spin_scale_button_press (GtkWidget *widget, GdkEventButton *event); @@ -145,14 +135,9 @@ gimp_spin_scale_class_init (GimpSpinScaleClass *klass) object_class->get_property = gimp_spin_scale_get_property; widget_class->style_set = gimp_spin_scale_style_set; -#if WITH_GTKMM_3_0 widget_class->get_preferred_width = gimp_spin_scale_get_preferred_width; widget_class->get_preferred_height = gimp_spin_scale_get_preferred_height; widget_class->draw = gimp_spin_scale_draw; -#else - widget_class->size_request = gimp_spin_scale_size_request; - widget_class->expose_event = gimp_spin_scale_expose; -#endif widget_class->button_press_event = gimp_spin_scale_button_press; widget_class->button_release_event = gimp_spin_scale_button_release; widget_class->motion_notify_event = gimp_spin_scale_motion_notify; @@ -294,7 +279,6 @@ gimp_spin_scale_set_appearance( GtkWidget *widget, const gchar *appearance) } } -#if GTK_CHECK_VERSION(3,0,0) static void gimp_spin_scale_get_preferred_width (GtkWidget *widget, gint *minimum_width, @@ -355,48 +339,6 @@ gimp_spin_scale_get_preferred_height (GtkWidget *widget, pango_font_metrics_unref (metrics); } -#else -static void -gimp_spin_scale_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - GtkStyle *style = gtk_widget_get_style (widget); - PangoContext *context = gtk_widget_get_pango_context (widget); - PangoFontMetrics *metrics; - gint height; - - GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition); - - metrics = pango_context_get_metrics (context, style->font_desc, - pango_context_get_language (context)); - - height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + - pango_font_metrics_get_descent (metrics)); - - if (private->appearanceMode == APPEARANCE_COMPACT) { - requisition->height += 1; - } else { - requisition->height += height; - } - - if (private->label) - { - gint char_width; - gint digit_width; - gint char_pixels; - - char_width = pango_font_metrics_get_approximate_char_width (metrics); - digit_width = pango_font_metrics_get_approximate_digit_width (metrics); - char_pixels = PANGO_PIXELS (MAX (char_width, digit_width)); - - /* ~3 chars for the ellipses */ - requisition->width += char_pixels * 3; - } - - pango_font_metrics_unref (metrics); -} -#endif static void gimp_spin_scale_style_set (GtkWidget *widget, @@ -415,16 +357,10 @@ gimp_spin_scale_style_set (GtkWidget *widget, static gboolean -#if GTK_CHECK_VERSION(3,0,0) gimp_spin_scale_draw (GtkWidget *widget, cairo_t *cr) -#else - gimp_spin_scale_expose (GtkWidget *widget, - GdkEventExpose *event) -#endif { GimpSpinScalePrivate *private = GET_PRIVATE (widget); -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *style = gtk_widget_get_style_context(widget); GtkAllocation allocation; GdkRGBA color; @@ -434,66 +370,31 @@ static gboolean cairo_restore (cr); gtk_widget_get_allocation (widget, &allocation); -#else - GtkStyle *style = gtk_widget_get_style (widget); - cairo_t *cr; - gint w; - - GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); - - cr = gdk_cairo_create (event->window); - gdk_cairo_region (cr, event->region); - cairo_clip (cr); - - w = gdk_window_get_width (event->window); -#endif cairo_set_line_width (cr, 1.0); -#if GTK_CHECK_VERSION(3,0,0) if (private->label) { GdkRectangle text_area; gint minimum_width; gint natural_width; -#else - if (private->label && - gtk_widget_is_drawable (widget) && - event->window == gtk_entry_get_text_window (GTK_ENTRY (widget))) - { - GtkRequisition requisition; - GtkAllocation allocation; -#endif PangoRectangle logical; gint layout_offset_x; gint layout_offset_y; -#if GTK_CHECK_VERSION(3,0,0) GtkStateFlags state; GdkRGBA text_color; GdkRGBA bar_text_color; -#else - GtkStateType state; - GdkColor text_color; - GdkColor bar_text_color; - gint window_width; - gint window_height; -#endif gdouble progress_fraction; gint progress_x; gint progress_y; gint progress_width; gint progress_height; -#if GTK_CHECK_VERSION(3,0,0) gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area); GTK_WIDGET_CLASS (parent_class)->get_preferred_width (widget, &minimum_width, &natural_width); -#else - GTK_WIDGET_CLASS (parent_class)->size_request (widget, &requisition); - gtk_widget_get_allocation (widget, &allocation); -#endif if (! private->layout) { @@ -504,27 +405,18 @@ static gboolean pango_layout_set_width (private->layout, PANGO_SCALE * -#if GTK_CHECK_VERSION(3,0,0) (allocation.width - minimum_width)); -#else - (allocation.width - requisition.width)); -#endif pango_layout_get_pixel_extents (private->layout, NULL, &logical); gtk_entry_get_layout_offsets (GTK_ENTRY (widget), NULL, &layout_offset_y); if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) -#if GTK_CHECK_VERSION(3,0,0) layout_offset_x = text_area.x + text_area.width - logical.width - 4; -#else - layout_offset_x = w - logical.width - 4; -#endif else layout_offset_x = 4; layout_offset_x -= logical.x; -#if GTK_CHECK_VERSION(3,0,0) state = gtk_widget_get_state_flags (widget); gtk_style_context_get_color (style, state, &text_color); @@ -533,16 +425,6 @@ static gboolean gtk_style_context_add_class (style, GTK_STYLE_CLASS_PROGRESSBAR); gtk_style_context_get_color (style, state, &bar_text_color); gtk_style_context_restore (style); -#else - state = GTK_STATE_SELECTED; - if (! gtk_widget_get_sensitive (widget)) - state = GTK_STATE_INSENSITIVE; - text_color = style->text[gtk_widget_get_state (widget)]; - bar_text_color = style->fg[state]; - - window_width = gdk_window_get_width (event->window); - window_height = gdk_window_get_height (event->window); -#endif progress_fraction = gtk_entry_get_progress_fraction (GTK_ENTRY (widget)); @@ -550,53 +432,30 @@ static gboolean { progress_fraction = 1.0 - progress_fraction; -#if GTK_CHECK_VERSION(3,0,0) progress_x = text_area.width * progress_fraction; -#else - progress_x = window_width * progress_fraction; -#endif progress_y = 0; -#if GTK_CHECK_VERSION(3,0,0) progress_width = text_area.width - progress_x; progress_height = text_area.height; -#else - progress_width = window_width - progress_x; - progress_height = window_height; -#endif } else { progress_x = 0; progress_y = 0; -#if GTK_CHECK_VERSION(3,0,0) progress_width = text_area.width * progress_fraction; progress_height = text_area.height; -#else - progress_width = window_width * progress_fraction; - progress_height = window_height; -#endif } cairo_save (cr); cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); -#if GTK_CHECK_VERSION(3,0,0) cairo_rectangle (cr, 0, 0, text_area.width, text_area.height); -#else - cairo_rectangle (cr, 0, 0, window_width, window_height); -#endif cairo_rectangle (cr, progress_x, progress_y, progress_width, progress_height); cairo_clip (cr); cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING); -#if GTK_CHECK_VERSION(3,0,0) cairo_move_to (cr, layout_offset_x, text_area.y + layout_offset_y-3); gdk_cairo_set_source_rgba (cr, &text_color); -#else - cairo_move_to (cr, layout_offset_x, layout_offset_y-3); - gdk_cairo_set_source_color (cr, &text_color); -#endif pango_cairo_show_layout (cr, private->layout); cairo_restore (cr); @@ -604,24 +463,14 @@ static gboolean progress_width, progress_height); cairo_clip (cr); -#if GTK_CHECK_VERSION(3,0,0) cairo_move_to (cr, layout_offset_x, text_area.y + layout_offset_y-3); gdk_cairo_set_source_rgba (cr, &bar_text_color); -#else - cairo_move_to (cr, layout_offset_x, layout_offset_y-3); - gdk_cairo_set_source_color (cr, &bar_text_color); -#endif pango_cairo_show_layout (cr, private->layout); } -#if !GTK_CHECK_VERSION(3,0,0) - cairo_destroy (cr); -#endif - return FALSE; } -#if WITH_GTKMM_3_0 /* Returns TRUE if a translation should be done */ static gboolean gtk_widget_get_translation_to_window (GtkWidget *widget, @@ -685,7 +534,6 @@ gimp_spin_scale_event_to_widget_coords (GtkWidget *widget, *widget_x = event_x; *widget_y = event_y; } -#endif static SpinScaleTarget gimp_spin_scale_get_target (GtkWidget *widget, @@ -702,7 +550,6 @@ gimp_spin_scale_get_target (GtkWidget *widget, pango_layout_get_pixel_extents (gtk_entry_get_layout (GTK_ENTRY (widget)), NULL, &logical); -#if WITH_GTKMM_3_0 GdkRectangle text_area; gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area); @@ -726,19 +573,6 @@ gimp_spin_scale_get_target (GtkWidget *widget, } return TARGET_NONE; -#else - if (x > layout_x && x < layout_x + logical.width && - y > layout_y && y < layout_y + logical.height) - { - return TARGET_NUMBER; - } - - else if (y > allocation.height / 2) - { - return TARGET_LOWER; - } - return TARGET_UPPER; -#endif } static void @@ -773,49 +607,21 @@ gimp_spin_scale_change_value (GtkWidget *widget, gdouble lower; gdouble upper; gdouble value; -#if WITH_GTKMM_3_0 -#else -#endif -#if WITH_GTKMM_3_0 GdkRectangle text_area; gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area); gimp_spin_scale_get_limits (GIMP_SPIN_SCALE (widget), &lower, &upper); -#else - GdkWindow *text_window = gtk_entry_get_text_window (GTK_ENTRY (widget)); - gint width; - - gimp_spin_scale_get_limits (GIMP_SPIN_SCALE (widget), &lower, &upper); - - width = gdk_window_get_width (text_window); -#endif - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) -#if WITH_GTKMM_3_0 x = text_area.width - x; -#else - x = width - x; -#endif - if (private->relative_change) { gdouble diff; gdouble step; - -#if WITH_GTKMM_3_0 step = (upper - lower) / text_area.width / 10.0; -#else - step = (upper - lower) / width / 10.0; -#endif if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) - -#if WITH_GTKMM_3_0 diff = x - (text_area.width - private->start_x); -#else - diff = x - (width - private->start_x); -#endif else diff = x - private->start_x; @@ -825,12 +631,7 @@ gimp_spin_scale_change_value (GtkWidget *widget, { gdouble fraction; - -#if WITH_GTKMM_3_0 fraction = x / (gdouble) text_area.width; -#else - fraction = x / (gdouble) width; -#endif if (fraction > 0.0) fraction = pow (fraction, private->gamma); @@ -849,7 +650,6 @@ gimp_spin_scale_button_press (GtkWidget *widget, private->changing_value = FALSE; private->relative_change = FALSE; -#if WITH_GTKMM_3_0 gint x, y; gimp_spin_scale_event_to_widget_coords (widget, event->window, event->x, event->y, @@ -879,36 +679,6 @@ gimp_spin_scale_button_press (GtkWidget *widget, default: break; } -#else - if (event->window == gtk_entry_get_text_window (GTK_ENTRY (widget))) - { - switch (gimp_spin_scale_get_target (widget, event->x, event->y)) - { - case TARGET_UPPER: - private->changing_value = TRUE; - - gtk_widget_grab_focus (widget); - - gimp_spin_scale_change_value (widget, event->x); - - return TRUE; - - case TARGET_LOWER: - private->changing_value = TRUE; - - gtk_widget_grab_focus (widget); - - private->relative_change = TRUE; - private->start_x = event->x; - private->start_value = gtk_adjustment_get_value (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget))); - - return TRUE; - - default: - break; - } - } -#endif return GTK_WIDGET_CLASS (parent_class)->button_press_event (widget, event); } @@ -918,22 +688,16 @@ gimp_spin_scale_button_release (GtkWidget *widget, GdkEventButton *event) { GimpSpinScalePrivate *private = GET_PRIVATE (widget); -#if WITH_GTKMM_3_0 gint x, y; gimp_spin_scale_event_to_widget_coords (widget, event->window, event->x, event->y, &x, &y); -#endif if (private->changing_value) { private->changing_value = FALSE; -#if WITH_GTKMM_3_0 gimp_spin_scale_change_value (widget, x); -#else - gimp_spin_scale_change_value (widget, event->x); -#endif return TRUE; } @@ -948,21 +712,15 @@ gimp_spin_scale_motion_notify (GtkWidget *widget, gdk_event_request_motions (event); -#if WITH_GTKMM_3_0 gint x, y; gimp_spin_scale_event_to_widget_coords (widget, event->window, event->x, event->y, &x, &y); -#endif if (private->changing_value) { -#if WITH_GTKMM_3_0 gimp_spin_scale_change_value (widget, x); -#else - gimp_spin_scale_change_value (widget, event->x); -#endif return TRUE; } @@ -971,20 +729,12 @@ gimp_spin_scale_motion_notify (GtkWidget *widget, if (! (event->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) -#if WITH_GTKMM_3_0 -#else - && event->window == gtk_entry_get_text_window (GTK_ENTRY (widget)) -#endif ) { GdkDisplay *display = gtk_widget_get_display (widget); GdkCursor *cursor = NULL; -#if WITH_GTKMM_3_0 switch (gimp_spin_scale_get_target (widget, x, y)) -#else - switch (gimp_spin_scale_get_target (widget, event->x, event->y)) -#endif { case TARGET_NUMBER: cursor = gdk_cursor_new_for_display (display, GDK_XTERM); @@ -1002,17 +752,11 @@ gimp_spin_scale_motion_notify (GtkWidget *widget, break; } - -#if WITH_GTKMM_3_0 if (cursor) { gdk_window_set_cursor (event->window, cursor); g_object_unref (cursor); } -#else - gdk_window_set_cursor (event->window, cursor); - gdk_cursor_unref (cursor); -#endif } return FALSE; diff --git a/src/ui/widget/highlight-picker.cpp b/src/ui/widget/highlight-picker.cpp index 09999b52d..e4447cb9e 100644 --- a/src/ui/widget/highlight-picker.cpp +++ b/src/ui/widget/highlight-picker.cpp @@ -35,8 +35,6 @@ HighlightPicker::~HighlightPicker() { } - -#if WITH_GTKMM_3_0 void HighlightPicker::get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const @@ -66,39 +64,12 @@ void HighlightPicker::get_preferred_width_vfunc(Gtk::Widget& widget, nat_w += (nat_w) >> 1; } } -#else -void HighlightPicker::get_size_vfunc(Gtk::Widget& widget, - const Gdk::Rectangle* cell_area, - int* x_offset, - int* y_offset, - int* width, - int* height ) const -{ - Gtk::CellRendererPixbuf::get_size_vfunc( widget, cell_area, x_offset, y_offset, width, height ); - - if ( width ) { - *width = 10;//+= (*width) >> 1; - } - if ( height ) { - *height = 20; //cell_area ? cell_area->get_height() / 2 : 50; //+= (*height) >> 1; - } -} -#endif -#if WITH_GTKMM_3_0 void HighlightPicker::render_vfunc( const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags ) -#else -void HighlightPicker::render_vfunc( const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags ) -#endif { GdkRectangle carea; @@ -140,11 +111,7 @@ void HighlightPicker::render_vfunc( const Glib::RefPtr& window, convert_pixbuf_argb32_to_normal(pixbuf); property_pixbuf() = Glib::wrap(pixbuf); -#if WITH_GTKMM_3_0 Gtk::CellRendererPixbuf::render_vfunc( cr, widget, background_area, cell_area, flags ); -#else - Gtk::CellRendererPixbuf::render_vfunc( window, widget, background_area, cell_area, expose_area, flags ); -#endif } bool HighlightPicker::activate_vfunc(GdkEvent* /*event*/, diff --git a/src/ui/widget/highlight-picker.h b/src/ui/widget/highlight-picker.h index c5fe4c02c..c459b0dcd 100644 --- a/src/ui/widget/highlight-picker.h +++ b/src/ui/widget/highlight-picker.h @@ -29,8 +29,6 @@ public: Glib::PropertyProxy property_active() { return _property_active.get_proxy(); } protected: - -#if WITH_GTKMM_3_0 virtual void render_vfunc( const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, @@ -44,18 +42,6 @@ protected: virtual void get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const; -#else - virtual void render_vfunc( const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags ); - - virtual void get_size_vfunc( Gtk::Widget &widget, - Gdk::Rectangle const *cell_area, - int *x_offset, int *y_offset, int *width, int *height ) const; -#endif virtual bool activate_vfunc(GdkEvent *event, Gtk::Widget &widget, diff --git a/src/ui/widget/imagetoggler.cpp b/src/ui/widget/imagetoggler.cpp index 29907f4c9..987cc67bb 100644 --- a/src/ui/widget/imagetoggler.cpp +++ b/src/ui/widget/imagetoggler.cpp @@ -53,8 +53,6 @@ ImageToggler::ImageToggler( char const* on, char const* off) : property_pixbuf() = _property_pixbuf_off.get_value(); } - -#if WITH_GTKMM_3_0 void ImageToggler::get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const @@ -84,46 +82,15 @@ void ImageToggler::get_preferred_width_vfunc(Gtk::Widget& widget, nat_w += (nat_w) >> 1; } } -#else -void ImageToggler::get_size_vfunc(Gtk::Widget& widget, - const Gdk::Rectangle* cell_area, - int* x_offset, - int* y_offset, - int* width, - int* height ) const -{ - Gtk::CellRendererPixbuf::get_size_vfunc( widget, cell_area, x_offset, y_offset, width, height ); - - if ( width ) { - *width += (*width) >> 1; - } - if ( height ) { - *height += (*height) >> 1; - } -} -#endif -#if WITH_GTKMM_3_0 void ImageToggler::render_vfunc( const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags ) -#else -void ImageToggler::render_vfunc( const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags ) -#endif { property_pixbuf() = _property_active.get_value() ? _property_pixbuf_on : _property_pixbuf_off; -#if WITH_GTKMM_3_0 Gtk::CellRendererPixbuf::render_vfunc( cr, widget, background_area, cell_area, flags ); -#else - Gtk::CellRendererPixbuf::render_vfunc( window, widget, background_area, cell_area, expose_area, flags ); -#endif } bool diff --git a/src/ui/widget/imagetoggler.h b/src/ui/widget/imagetoggler.h index 7b02fa4dc..d4f27cf11 100644 --- a/src/ui/widget/imagetoggler.h +++ b/src/ui/widget/imagetoggler.h @@ -36,8 +36,6 @@ public: Glib::PropertyProxy< Glib::RefPtr > property_pixbuf_off(); protected: - -#if WITH_GTKMM_3_0 virtual void render_vfunc( const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, @@ -51,18 +49,6 @@ protected: virtual void get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const; -#else - virtual void render_vfunc( const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags ); - - virtual void get_size_vfunc( Gtk::Widget &widget, - Gdk::Rectangle const *cell_area, - int *x_offset, int *y_offset, int *width, int *height ) const; -#endif virtual bool activate_vfunc(GdkEvent *event, Gtk::Widget &widget, diff --git a/src/ui/widget/insertordericon.cpp b/src/ui/widget/insertordericon.cpp index 9aec7d135..7ed1ed2e2 100644 --- a/src/ui/widget/insertordericon.cpp +++ b/src/ui/widget/insertordericon.cpp @@ -52,7 +52,6 @@ InsertOrderIcon::InsertOrderIcon() : } -#if WITH_GTKMM_3_0 void InsertOrderIcon::get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const @@ -82,39 +81,12 @@ void InsertOrderIcon::get_preferred_width_vfunc(Gtk::Widget& widget, nat_w += (nat_w) >> 1; } } -#else -void InsertOrderIcon::get_size_vfunc(Gtk::Widget& widget, - const Gdk::Rectangle* cell_area, - int* x_offset, - int* y_offset, - int* width, - int* height ) const -{ - Gtk::CellRendererPixbuf::get_size_vfunc( widget, cell_area, x_offset, y_offset, width, height ); - - if ( width ) { - *width = phys;//+= (*width) >> 1; - } - if ( height ) { - *height =phys;//+= (*height) >> 1; - } -} -#endif -#if WITH_GTKMM_3_0 void InsertOrderIcon::render_vfunc( const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags ) -#else -void InsertOrderIcon::render_vfunc( const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags ) -#endif { switch (_property_active.get_value()) { @@ -128,11 +100,7 @@ void InsertOrderIcon::render_vfunc( const Glib::RefPtr& window, property_pixbuf() = Glib::RefPtr(0); break; } -#if WITH_GTKMM_3_0 Gtk::CellRendererPixbuf::render_vfunc( cr, widget, background_area, cell_area, flags ); -#else - Gtk::CellRendererPixbuf::render_vfunc( window, widget, background_area, cell_area, expose_area, flags ); -#endif } bool InsertOrderIcon::activate_vfunc(GdkEvent* /*event*/, diff --git a/src/ui/widget/insertordericon.h b/src/ui/widget/insertordericon.h index bf8ac4fa7..43188fa5b 100644 --- a/src/ui/widget/insertordericon.h +++ b/src/ui/widget/insertordericon.h @@ -33,7 +33,6 @@ public: protected: -#if WITH_GTKMM_3_0 virtual void render_vfunc( const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, @@ -47,18 +46,6 @@ protected: virtual void get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const; -#else - virtual void render_vfunc( const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags ); - - virtual void get_size_vfunc( Gtk::Widget &widget, - Gdk::Rectangle const *cell_area, - int *x_offset, int *y_offset, int *width, int *height ) const; -#endif virtual bool activate_vfunc(GdkEvent *event, Gtk::Widget &widget, diff --git a/src/ui/widget/layertypeicon.cpp b/src/ui/widget/layertypeicon.cpp index 672c607e5..36742b953 100644 --- a/src/ui/widget/layertypeicon.cpp +++ b/src/ui/widget/layertypeicon.cpp @@ -64,8 +64,6 @@ LayerTypeIcon::LayerTypeIcon() : property_pixbuf() = _property_pixbuf_path.get_value(); } - -#if WITH_GTKMM_3_0 void LayerTypeIcon::get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const @@ -95,46 +93,15 @@ void LayerTypeIcon::get_preferred_width_vfunc(Gtk::Widget& widget, nat_w += (nat_w) >> 1; } } -#else -void LayerTypeIcon::get_size_vfunc(Gtk::Widget& widget, - const Gdk::Rectangle* cell_area, - int* x_offset, - int* y_offset, - int* width, - int* height ) const -{ - Gtk::CellRendererPixbuf::get_size_vfunc( widget, cell_area, x_offset, y_offset, width, height ); - - if ( width ) { - *width += (*width) >> 1; - } - if ( height ) { - *height += (*height) >> 1; - } -} -#endif -#if WITH_GTKMM_3_0 void LayerTypeIcon::render_vfunc( const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags ) -#else -void LayerTypeIcon::render_vfunc( const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags ) -#endif { property_pixbuf() = _property_active.get_value() == 1 ? _property_pixbuf_group : (_property_active.get_value() == 2 ? _property_pixbuf_layer : _property_pixbuf_path); -#if WITH_GTKMM_3_0 Gtk::CellRendererPixbuf::render_vfunc( cr, widget, background_area, cell_area, flags ); -#else - Gtk::CellRendererPixbuf::render_vfunc( window, widget, background_area, cell_area, expose_area, flags ); -#endif } bool diff --git a/src/ui/widget/layertypeicon.h b/src/ui/widget/layertypeicon.h index 6c71ce361..f12029c12 100644 --- a/src/ui/widget/layertypeicon.h +++ b/src/ui/widget/layertypeicon.h @@ -35,8 +35,6 @@ public: Glib::PropertyProxy< Glib::RefPtr > property_pixbuf_off(); protected: - -#if WITH_GTKMM_3_0 virtual void render_vfunc( const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, @@ -50,18 +48,6 @@ protected: virtual void get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const; -#else - virtual void render_vfunc( const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags ); - - virtual void get_size_vfunc( Gtk::Widget &widget, - Gdk::Rectangle const *cell_area, - int *x_offset, int *y_offset, int *width, int *height ) const; -#endif virtual bool activate_vfunc(GdkEvent *event, Gtk::Widget &widget, diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index d21e848f2..66ee612bf 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -134,18 +134,10 @@ void Licensor::update (SPDocument *doc) for (i=0; rdf_licenses[i].name; i++) if (license == &rdf_licenses[i]) break; -#if WITH_GTKMM_3_0 static_cast(get_children()[i+1])->set_active(); -#else - static_cast(children()[i+1].get_widget())->set_active(); -#endif } else { -#if WITH_GTKMM_3_0 static_cast(get_children()[0])->set_active(); -#else - static_cast(children()[0].get_widget())->set_active(); -#endif } /* update the URI */ diff --git a/src/ui/widget/notebook-page.cpp b/src/ui/widget/notebook-page.cpp index 2f03ed23b..6d8ff1d75 100644 --- a/src/ui/widget/notebook-page.cpp +++ b/src/ui/widget/notebook-page.cpp @@ -11,31 +11,19 @@ #include "notebook-page.h" -#if WITH_GTKMM_3_0 # include -#else -# include -#endif namespace Inkscape { namespace UI { namespace Widget { NotebookPage::NotebookPage(int n_rows, int n_columns, bool expand, bool fill, guint padding) -#if WITH_GTKMM_3_0 :_table(Gtk::manage(new Gtk::Grid())) -#else - :_table(Gtk::manage(new Gtk::Table(n_rows, n_columns))) -#endif { set_border_width(2); -#if WITH_GTKMM_3_0 _table->set_row_spacing(2); _table->set_column_spacing(2); -#else - _table->set_spacings(2); -#endif pack_start(*_table, expand, fill, padding); } diff --git a/src/ui/widget/notebook-page.h b/src/ui/widget/notebook-page.h index c11de1b5b..6eb23907c 100644 --- a/src/ui/widget/notebook-page.h +++ b/src/ui/widget/notebook-page.h @@ -17,11 +17,7 @@ #include namespace Gtk { -#if WITH_GTKMM_3_0 class Grid; -#else -class Table; -#endif } namespace Inkscape { @@ -42,19 +38,10 @@ public: */ NotebookPage(int n_rows, int n_columns, bool expand=false, bool fill=false, guint padding=0); -#if WITH_GTKMM_3_0 Gtk::Grid& table() { return *_table; } -#else - Gtk::Table& table() { return *_table; } -#endif protected: - -#if WITH_GTKMM_3_0 Gtk::Grid *_table; -#else - Gtk::Table *_table; -#endif }; } // namespace Widget diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 19ab1a280..c71130586 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -353,7 +353,6 @@ PageSizer::PageSizer(Registry & _wr) _customDimTable.set_border_width(4); -#if WITH_GTKMM_3_0 _customDimTable.set_row_spacing(4); _customDimTable.set_column_spacing(4); @@ -372,15 +371,6 @@ PageSizer::PageSizer(Registry & _wr) _fitPageMarginExpander.set_hexpand(); _fitPageMarginExpander.set_vexpand(); _customDimTable.attach(_fitPageMarginExpander, 0, 2, 2, 1); -#else - _customDimTable.resize(3, 2); - _customDimTable.set_row_spacings(4); - _customDimTable.set_col_spacings(4); - _customDimTable.attach(_dimensionWidth, 0,1, 0,1); - _customDimTable.attach(_dimensionUnits, 1,2, 0,1); - _customDimTable.attach(_dimensionHeight, 0,1, 1,2); - _customDimTable.attach(_fitPageMarginExpander, 0,2, 2,3); -#endif _dimTabOrderGList = NULL; _dimTabOrderGList = g_list_append(_dimTabOrderGList, _dimensionWidth.gobj()); @@ -398,7 +388,6 @@ PageSizer::PageSizer(Registry & _wr) //## Set up margin settings _marginTable.set_border_width(4); -#if WITH_GTKMM_3_0 _marginTable.set_row_spacing(4); _marginTable.set_column_spacing(4); @@ -421,16 +410,6 @@ PageSizer::PageSizer(Registry & _wr) _fitPageButtonAlign.set_hexpand(); _fitPageButtonAlign.set_vexpand(); _marginTable.attach(_fitPageButtonAlign, 0, 3, 2, 1); -#else - _marginTable.set_border_width(4); - _marginTable.set_row_spacings(4); - _marginTable.set_col_spacings(4); - _marginTable.attach(_marginTopAlign, 0,2, 0,1); - _marginTable.attach(_marginLeftAlign, 0,1, 1,2); - _marginTable.attach(_marginRightAlign, 1,2, 1,2); - _marginTable.attach(_marginBottomAlign, 0,2, 2,3); - _marginTable.attach(_fitPageButtonAlign, 0,2, 3,4); -#endif _marginTopAlign.set(0.5, 0.5, 0.0, 1.0); _marginTopAlign.add(_marginTop); @@ -453,7 +432,6 @@ PageSizer::PageSizer(Registry & _wr) _scaleTable.set_border_width(4); -#if WITH_GTKMM_3_0 _scaleTable.set_row_spacing(4); _scaleTable.set_column_spacing(4); @@ -465,16 +443,6 @@ PageSizer::PageSizer(Registry & _wr) _viewboxExpander.set_hexpand(); _viewboxExpander.set_vexpand(); _scaleTable.attach(_viewboxExpander, 0, 2, 2, 1); -#else - _scaleTable.resize(3, 2); - _scaleTable.set_row_spacings(4); - _scaleTable.set_col_spacings(4); - _scaleTable.attach(_scaleX, 0,1, 0,1); - _scaleTable.attach(_scaleY, 1,2, 0,1); - _scaleTable.attach(_scaleLabel, 2,3, 0,1); - _scaleTable.attach(_scaleWarning, 0,3, 1,2, Gtk::FILL); - _scaleTable.attach(_viewboxExpander, 0,3, 2,3); -#endif _scaleWarning.set_label(_("While SVG allows non-uniform scaling it is recommended to use only uniform scaling in Inkscape. To set a non-uniform scaling, set the 'viewBox' directly.")); _scaleWarning.set_line_wrap( true ); @@ -483,7 +451,6 @@ PageSizer::PageSizer(Registry & _wr) _viewboxExpander.set_label(_("_Viewbox...")); _viewboxExpander.add(_viewboxTable); -#if WITH_GTKMM_3_0 _viewboxTable.set_row_spacing(2); _viewboxTable.set_column_spacing(2); @@ -503,16 +470,6 @@ PageSizer::PageSizer(Registry & _wr) _viewboxH.set_vexpand(); _viewboxTable.attach(_viewboxH, 1, 1, 1, 1); -#else - _viewboxTable.set_border_width(4); - _viewboxTable.set_row_spacings(2); - _viewboxTable.set_col_spacings(2); - _viewboxTable.attach(_viewboxX, 0,1, 0,1); - _viewboxTable.attach(_viewboxY, 1,2, 0,1); - _viewboxTable.attach(_viewboxW, 0,1, 1,2); - _viewboxTable.attach(_viewboxH, 1,2, 1,2); -#endif - _wr.setUpdating (true); updateScaleUI(); _wr.setUpdating (false); diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h index 0eea28e61..f1966f848 100644 --- a/src/ui/widget/page-sizer.h +++ b/src/ui/widget/page-sizer.h @@ -23,15 +23,9 @@ #include #include #include +#include #include #include - -#if WITH_GTKMM_3_0 -# include -#else -# include -#endif - #include namespace Inkscape { @@ -222,12 +216,7 @@ protected: //### Custom size frame Gtk::Frame _customFrame; - -#if WITH_GTKMM_3_0 Gtk::Grid _customDimTable; -#else - Gtk::Table _customDimTable; -#endif RegisteredUnitMenu _dimensionUnits; RegisteredScalarUnit _dimensionWidth; @@ -237,12 +226,7 @@ protected: //### Fit Page options Gtk::Expander _fitPageMarginExpander; -#if WITH_GTKMM_3_0 Gtk::Grid _marginTable; -#else - Gtk::Table _marginTable; -#endif - Gtk::Alignment _marginTopAlign; Gtk::Alignment _marginLeftAlign; Gtk::Alignment _marginRightAlign; @@ -257,11 +241,7 @@ protected: // Document scale Gtk::Frame _scaleFrame; -#if WITH_GTKMM_3_0 Gtk::Grid _scaleTable; -#else - Gtk::Table _scaleTable; -#endif Gtk::Label _scaleLabel; Gtk::Label _scaleWarning; @@ -271,11 +251,7 @@ protected: // Viewbox Gtk::Expander _viewboxExpander; -#if WITH_GTKMM_3_0 Gtk::Grid _viewboxTable; -#else - Gtk::Table _viewboxTable; -#endif RegisteredScalar _viewboxX; RegisteredScalar _viewboxY; diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index ab13577d7..8f695013d 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -74,9 +74,7 @@ Panel::Panel(Glib::ustring const &label, gchar const *prefs_path, _fillable(0) { set_name( "InkscapePanel" ); -#if WITH_GTKMM_3_0 set_orientation( Gtk::ORIENTATION_VERTICAL ); -#endif _init(); } @@ -598,13 +596,9 @@ void Panel::_addResponseButton(Gtk::Button *button, int response_id, bool pack_s { // Create a button box for the response buttons if it's the first button to be added if (!_action_area) { -#if WITH_GTKMM_3_0 _action_area = new Gtk::ButtonBox(); _action_area->set_layout(Gtk::BUTTONBOX_END); _action_area->set_spacing(6); -#else - _action_area = new Gtk::HButtonBox(Gtk::BUTTONBOX_END, 6); -#endif _action_area->set_border_width(4); pack_end(*_action_area, Gtk::PACK_SHRINK, 0); } diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 7b2836fe8..370779586 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -31,13 +31,7 @@ class SPDocument; namespace Gtk { class CheckMenuItem; - -#if WITH_GTKMM_3_0 class ButtonBox; -#else - class HButtonBox; -#endif - class MenuItem; } @@ -64,12 +58,7 @@ namespace Widget { * @see UI::Dialog::DesktopTracker to handle desktop change, selection change and selected object modifications. * @see UI::Dialog::DialogManager manages the dialogs within inkscape. */ -#if WITH_GTKMM_3_0 class Panel : public Gtk::Box { -#else -class Panel : public Gtk::VBox { -#endif - public: static void prep(); @@ -172,12 +161,7 @@ private: Gtk::EventBox _menu_popper; Gtk::Button _close_button; Gtk::Menu *_menu; - -#if WITH_GTKMM_3_0 - Gtk::ButtonBox *_action_area; //< stores response buttons -#else - Gtk::HButtonBox *_action_area; //< stores response buttons -#endif + Gtk::ButtonBox *_action_area; //< stores response buttons std::vector _non_horizontal; std::vector _non_vertical; diff --git a/src/ui/widget/point.cpp b/src/ui/widget/point.cpp index 6aa6196bb..66f5e41a3 100644 --- a/src/ui/widget/point.cpp +++ b/src/ui/widget/point.cpp @@ -53,11 +53,7 @@ Point::Point(Glib::ustring const &label, Glib::ustring const &tooltip, } Point::Point(Glib::ustring const &label, Glib::ustring const &tooltip, -#if WITH_GTKMM_3_0 Glib::RefPtr &adjust, -#else - Gtk::Adjustment &adjust, -#endif unsigned digits, Glib::ustring const &suffix, Glib::ustring const &icon, diff --git a/src/ui/widget/point.h b/src/ui/widget/point.h index 17078df8f..71bfd8473 100644 --- a/src/ui/widget/point.h +++ b/src/ui/widget/point.h @@ -82,11 +82,7 @@ public: */ Point( Glib::ustring const &label, Glib::ustring const &tooltip, -#if WITH_GTKMM_3_0 Glib::RefPtr &adjust, -#else - Gtk::Adjustment &adjust, -#endif unsigned digits = 0, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index d56506d62..2e6e3f0db 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -55,14 +55,9 @@ DialogPage::DialogPage() { set_border_width(12); -#if WITH_GTKMM_3_0 set_orientation(Gtk::ORIENTATION_VERTICAL); set_column_spacing(12); set_row_spacing(6); -#else - set_col_spacings(12); - set_row_spacings(6); -#endif } /** @@ -101,12 +96,7 @@ void DialogPage::add_line(bool indent, // be indented if desired Gtk::Alignment* w_alignment = Gtk::manage(new Gtk::Alignment()); w_alignment->add(*hb); - -#if WITH_GTKMM_3_0 w_alignment->set_valign(Gtk::ALIGN_CENTER); -#else - guint row = property_n_rows(); -#endif // Add a label in the first column if provided if (label != "") @@ -122,17 +112,12 @@ void DialogPage::add_line(bool indent, if (indent) label_alignment->set_padding(0, 0, 12, 0); -#if WITH_GTKMM_3_0 label_alignment->set_valign(Gtk::ALIGN_CENTER); add(*label_alignment); attach_next_to(*w_alignment, *label_alignment, Gtk::POS_RIGHT, 1, 1); -#else - attach(*label_alignment, 0, 1, row, row + 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); -#endif } // Now add the widget to the bottom of the dialog -#if WITH_GTKMM_3_0 if (label == "") { if (indent) @@ -145,17 +130,6 @@ void DialogPage::add_line(bool indent, g_value_set_int(&width, 2); gtk_container_child_set_property(GTK_CONTAINER(gobj()), GTK_WIDGET(w_alignment->gobj()), "width", &width); } -#else - // The widget should span two columns if there is no label - int w_col_span = 1; - if (label == "") - w_col_span = 2; - - attach(*w_alignment, 2 - w_col_span, 2, row, row + 1, - Gtk::FILL | Gtk::EXPAND, - Gtk::AttachOptions(), - 0, 0); -#endif // Add a label on the right of the widget if desired if (suffix != "") @@ -174,18 +148,8 @@ void DialogPage::add_group_header(Glib::ustring name) Glib::ustring(""/*"*/) , Gtk::ALIGN_START , Gtk::ALIGN_CENTER, true)); label_widget->set_use_markup(true); - -#if WITH_GTKMM_3_0 label_widget->set_valign(Gtk::ALIGN_CENTER); add(*label_widget); -// if (row != 1) - // set_row_spacing(row - 1, 18); -#else - int row = property_n_rows(); - attach(*label_widget , 0, 4, row, row + 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); - if (row != 1) - set_row_spacing(row - 1, 18); -#endif } } @@ -427,24 +391,6 @@ ZoomCorrRuler::draw_marks(Cairo::RefPtr cr, double dist, int maj } } -#if !WITH_GTKMM_3_0 -bool -ZoomCorrRuler::on_expose_event(GdkEventExpose *event) { - bool result = false; - - if(get_is_drawable()) - { - Cairo::RefPtr cr = get_window()->create_cairo_context(); - cr->rectangle(event->area.x, event->area.y, - event->area.width, event->area.height); - cr->clip(); - result = on_draw(cr); - } - - return result; -} -#endif - bool ZoomCorrRuler::on_draw(const Cairo::RefPtr& cr) { Glib::RefPtr window = get_window(); @@ -548,11 +494,7 @@ ZoomCorrRulerSlider::init(int ruler_width, int ruler_height, double lower, doubl _ruler.set_size(ruler_width, ruler_height); -#if WITH_GTKMM_3_0 _slider = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL)); -#else - _slider = Gtk::manage(new Gtk::HScale()); -#endif _slider->set_size_request(_ruler.width(), -1); _slider->set_range (lower, upper); @@ -579,21 +521,13 @@ ZoomCorrRulerSlider::init(int ruler_width, int ruler_height, double lower, doubl alignment1->add(_sb); alignment2->add(_unit); -#if WITH_GTKMM_3_0 - Gtk::Grid *table = Gtk::manage(new Gtk::Grid()); + auto table = Gtk::manage(new Gtk::Grid()); table->attach(*_slider, 0, 0, 1, 1); alignment1->set_halign(Gtk::ALIGN_CENTER); table->attach(*alignment1, 1, 0, 1, 1); table->attach(_ruler, 0, 1, 1, 1); alignment2->set_halign(Gtk::ALIGN_CENTER); table->attach(*alignment2, 1, 1, 1, 1); -#else - Gtk::Table *table = Gtk::manage(new Gtk::Table()); - table->attach(*_slider, 0, 1, 0, 1); - table->attach(*alignment1, 1, 2, 0, 1, static_cast(0)); - table->attach(_ruler, 0, 1, 1, 2); - table->attach(*alignment2, 1, 2, 1, 2, static_cast(0)); -#endif pack_start(*table, Gtk::PACK_SHRINK); } @@ -640,11 +574,7 @@ PrefSlider::init(Glib::ustring const &prefs_path, freeze = false; -#if WITH_GTKMM_3_0 _slider = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL)); -#else - _slider = Gtk::manage(new Gtk::HScale()); -#endif _slider->set_range (lower, upper); _slider->set_increments (step_increment, page_increment); @@ -661,17 +591,11 @@ PrefSlider::init(Glib::ustring const &prefs_path, Gtk::Alignment *alignment1 = Gtk::manage(new Gtk::Alignment(0.5,1,0,0)); alignment1->add(_sb); -#if WITH_GTKMM_3_0 - Gtk::Grid *table = Gtk::manage(new Gtk::Grid()); + auto table = Gtk::manage(new Gtk::Grid()); _slider->set_hexpand(); table->attach(*_slider, 0, 0, 1, 1); alignment1->set_halign(Gtk::ALIGN_CENTER); table->attach(*alignment1, 1, 0, 1, 1); -#else - Gtk::Table *table = Gtk::manage(new Gtk::Table()); - table->attach(*_slider, 0, 1, 0, 1); - table->attach(*alignment1, 1, 2, 0, 1, static_cast(0)); -#endif this->pack_start(*table, Gtk::PACK_EXPAND_WIDGET); } diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 1d2d77699..142793509 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -30,12 +30,7 @@ #include #include #include - -#if WITH_GTKMM_3_0 #include -#else -#include -#endif #include "ui/widget/color-picker.h" #include "ui/widget/unit-menu.h" @@ -43,11 +38,7 @@ #include "ui/widget/scalar-unit.h" namespace Gtk { -#if WITH_GTKMM_3_0 class Scale; -#else -class HScale; -#endif } namespace Inkscape { @@ -126,10 +117,6 @@ public: static const double textpadding; private: -#if !WITH_GTKMM_3_0 - bool on_expose_event(GdkEventExpose *event); -#endif - bool on_draw(const Cairo::RefPtr& cr); void draw_marks(Cairo::RefPtr cr, double dist, int major_interval); @@ -155,11 +142,7 @@ private: Inkscape::UI::Widget::SpinButton _sb; UnitMenu _unit; -#if WITH_GTKMM_3_0 Gtk::Scale* _slider; -#else - Gtk::HScale* _slider; -#endif ZoomCorrRuler _ruler; bool freeze; // used to block recursive updates of slider and spinbutton }; @@ -178,11 +161,7 @@ private: Glib::ustring _prefs_path; Inkscape::UI::Widget::SpinButton _sb; -#if WITH_GTKMM_3_0 Gtk::Scale* _slider; -#else - Gtk::HScale* _slider; -#endif bool freeze; // used to block recursive updates of slider and spinbutton }; @@ -279,11 +258,7 @@ protected: void on_changed(); }; -#if WITH_GTKMM_3_0 class DialogPage : public Gtk::Grid -#else -class DialogPage : public Gtk::Table -#endif { public: DialogPage(); diff --git a/src/ui/widget/random.cpp b/src/ui/widget/random.cpp index 0a646b6fb..8551e2add 100644 --- a/src/ui/widget/random.cpp +++ b/src/ui/widget/random.cpp @@ -47,11 +47,7 @@ Random::Random(Glib::ustring const &label, Glib::ustring const &tooltip, } Random::Random(Glib::ustring const &label, Glib::ustring const &tooltip, -#if WITH_GTKMM_3_0 Glib::RefPtr &adjust, -#else - Gtk::Adjustment &adjust, -#endif unsigned digits, Glib::ustring const &suffix, Glib::ustring const &icon, diff --git a/src/ui/widget/random.h b/src/ui/widget/random.h index dc2b457c2..d86ab6246 100644 --- a/src/ui/widget/random.h +++ b/src/ui/widget/random.h @@ -75,11 +75,7 @@ public: */ Random(Glib::ustring const &label, Glib::ustring const &tooltip, -#if WITH_GTKMM_3_0 Glib::RefPtr &adjust, -#else - Gtk::Adjustment &adjust, -#endif unsigned digits = 0, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", diff --git a/src/ui/widget/scalar.cpp b/src/ui/widget/scalar.cpp index fca8a7974..434c2c0bb 100644 --- a/src/ui/widget/scalar.cpp +++ b/src/ui/widget/scalar.cpp @@ -43,11 +43,7 @@ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, } Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, -#if WITH_GTKMM_3_0 Glib::RefPtr &adjust, -#else - Gtk::Adjustment &adjust, -#endif unsigned digits, Glib::ustring const &suffix, Glib::ustring const &icon, @@ -141,11 +137,7 @@ void Scalar::update() void Scalar::addSlider() { -#if WITH_GTKMM_3_0 - Gtk::Scale *scale = new Gtk::Scale(static_cast(_widget)->get_adjustment()); -#else - Gtk::HScale *scale = new Gtk::HScale( * static_cast(_widget)->get_adjustment() ); -#endif + auto scale = new Gtk::Scale(static_cast(_widget)->get_adjustment()); scale->set_draw_value(false); add (*manage (scale)); } diff --git a/src/ui/widget/scalar.h b/src/ui/widget/scalar.h index 86d7aee28..847790b96 100644 --- a/src/ui/widget/scalar.h +++ b/src/ui/widget/scalar.h @@ -73,11 +73,7 @@ public: */ Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, -#if WITH_GTKMM_3_0 Glib::RefPtr &adjust, -#else - Gtk::Adjustment &adjust, -#endif unsigned digits = 0, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index f7fd63f51..7679fadb4 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -123,11 +123,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) current_stroke_width(0), _desktop (NULL), -#if WITH_GTKMM_3_0 _table(), -#else - _table(2, 6), -#endif _fill_label (_("Fill:")), _stroke_label (_("Stroke:")), _opacity_label (_("O:")), @@ -139,11 +135,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _stroke_flag_place (), _opacity_place (), -#if WITH_GTKMM_3_0 _opacity_adjustment(Gtk::Adjustment::create(100, 0.0, 100, 1.0, 10.0)), -#else - _opacity_adjustment (100, 0.0, 100, 1.0, 10.0), -#endif _opacity_sb (0.02, 0), _stroke (), @@ -166,13 +158,8 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _opacity_label.set_alignment(0.0, 0.5); _opacity_label.set_padding(0, 0); -#if WITH_GTKMM_3_0 _table.set_column_spacing(2); _table.set_row_spacing(0); -#else - _table.set_col_spacings (2); - _table.set_row_spacings (0); -#endif for (int i = SS_FILL; i <= SS_STROKE; i++) { @@ -379,7 +366,6 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _opacity_sb.set_size_request (SELECTED_STYLE_SB_WIDTH, -1); _opacity_sb.set_sensitive (false); -#if WITH_GTKMM_3_0 _table.attach(_fill_label, 0, 0, 1, 1); _table.attach(_stroke_label, 0, 1, 1, 1); @@ -388,26 +374,11 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _table.attach(_fill_place, 2, 0, 1, 1); _table.attach(_stroke, 2, 1, 1, 1); -#else - _table.attach(_fill_label, 0,1, 0,1, Gtk::FILL, Gtk::SHRINK); - _table.attach(_stroke_label, 0,1, 1,2, Gtk::FILL, Gtk::SHRINK); - - _table.attach(_fill_flag_place, 1,2, 0,1, Gtk::SHRINK, Gtk::SHRINK); - _table.attach(_stroke_flag_place, 1,2, 1,2, Gtk::SHRINK, Gtk::SHRINK); - - _table.attach(_fill_place, 2,3, 0,1); - _table.attach(_stroke, 2,3, 1,2); -#endif _opacity_place.add(_opacity_label); -#if WITH_GTKMM_3_0 _table.attach(_opacity_place, 4, 0, 1, 2); _table.attach(_opacity_sb, 5, 0, 1, 2); -#else - _table.attach(_opacity_place, 4,5, 0,2, Gtk::SHRINK, Gtk::SHRINK); - _table.attach(_opacity_sb, 5,6, 0,2, Gtk::SHRINK, Gtk::SHRINK); -#endif pack_start(_table, true, true, 2); @@ -1120,11 +1091,7 @@ SelectedStyle::update() if (_opacity_blocked) break; _opacity_blocked = true; _opacity_sb.set_sensitive(true); -#if WITH_GTKMM_3_0 _opacity_adjustment->set_value(SP_SCALE24_TO_FLOAT(query.opacity.value) * 100); -#else - _opacity_adjustment.set_value(SP_SCALE24_TO_FLOAT(query.opacity.value) * 100); -#endif _opacity_blocked = false; break; } @@ -1224,11 +1191,7 @@ void SelectedStyle::on_opacity_changed () _opacity_blocked = true; SPCSSAttr *css = sp_repr_css_attr_new (); Inkscape::CSSOStringStream os; -#if WITH_GTKMM_3_0 os << CLAMP ((_opacity_adjustment->get_value() / 100), 0.0, 1.0); -#else - os << CLAMP ((_opacity_adjustment.get_value() / 100), 0.0, 1.0); -#endif sp_repr_css_set_property (css, "opacity", os.str().c_str()); // FIXME: workaround for GTK breakage: display interruptibility sometimes results in GTK // sending multiple value-changed events. As if when Inkscape interrupts redraw for main loop diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h index 804a6fef6..efac29f73 100644 --- a/src/ui/widget/selected-style.h +++ b/src/ui/widget/selected-style.h @@ -16,12 +16,7 @@ #endif #include - -#if WITH_GTKMM_3_0 -# include -#else -# include -#endif +#include #include #include @@ -140,11 +135,7 @@ public: protected: SPDesktop *_desktop; -#if WITH_GTKMM_3_0 Gtk::Grid _table; -#else - Gtk::Table _table; -#endif Gtk::Label _fill_label; Gtk::Label _stroke_label; @@ -157,11 +148,7 @@ protected: Gtk::EventBox _stroke_flag_place; Gtk::EventBox _opacity_place; -#if WITH_GTKMM_3_0 Glib::RefPtr _opacity_adjustment; -#else - Gtk::Adjustment _opacity_adjustment; -#endif Inkscape::UI::Widget::SpinButton _opacity_sb; Gtk::Label _na[2]; diff --git a/src/ui/widget/spin-scale.cpp b/src/ui/widget/spin-scale.cpp index bb08d67df..f2a163c84 100644 --- a/src/ui/widget/spin-scale.cpp +++ b/src/ui/widget/spin-scale.cpp @@ -22,13 +22,8 @@ SpinScale::SpinScale(const char* label, double value, double lower, double upper double /*climb_rate*/, int digits, const SPAttributeEnum a, const char* tip_text) : AttrWidget(a, value) { -#if WITH_GTKMM_3_0 _adjustment = Gtk::Adjustment::create(value, lower, upper, step_inc); _spinscale = gimp_spin_scale_new (_adjustment->gobj(), label, digits); -#else - _adjustment = new Gtk::Adjustment(value, lower, upper, step_inc); - _spinscale = gimp_spin_scale_new (_adjustment->gobj(), label, digits); -#endif signal_value_changed().connect(signal_attr_changed().make_slot()); @@ -42,12 +37,10 @@ SpinScale::SpinScale(const char* label, double value, double lower, double upper } SpinScale::SpinScale(const char* label, -#if WITH_GTKMM_3_0 - Glib::RefPtr adj, -#else - Gtk::Adjustment *adj, -#endif - int digits, const SPAttributeEnum a, const char* tip_text) + Glib::RefPtr adj, + int digits, + const SPAttributeEnum a, + const char* tip_text) : AttrWidget(a, 0.0), _adjustment(adj) @@ -111,19 +104,12 @@ void SpinScale::set_appearance(const gchar* appearance) gimp_spin_scale_set_appearance(_spinscale, appearance); } -#if WITH_GTKMM_3_0 -const Glib::RefPtr SpinScale::get_adjustment() const -#else -const Gtk::Adjustment *SpinScale::get_adjustment() const -#endif +const decltype(SpinScale::_adjustment) SpinScale::get_adjustment() const { return _adjustment; } -#if WITH_GTKMM_3_0 -Glib::RefPtr SpinScale::get_adjustment() -#else -Gtk::Adjustment *SpinScale::get_adjustment() -#endif + +decltype(SpinScale::_adjustment) SpinScale::get_adjustment() { return _adjustment; } diff --git a/src/ui/widget/spin-scale.h b/src/ui/widget/spin-scale.h index 50e4fc953..d7030bed3 100644 --- a/src/ui/widget/spin-scale.h +++ b/src/ui/widget/spin-scale.h @@ -36,12 +36,8 @@ public: int digits, const SPAttributeEnum a = SP_ATTR_INVALID, const char* tip_text = NULL); SpinScale(const char* label, -#if WITH_GTKMM_3_0 - Glib::RefPtr adj, -#else - Gtk::Adjustment *adj, -#endif - int digits, const SPAttributeEnum a = SP_ATTR_INVALID, const char* tip_text = NULL); + Glib::RefPtr adj, + int digits, const SPAttributeEnum a = SP_ATTR_INVALID, const char* tip_text = NULL); virtual Glib::ustring get_as_attribute() const; virtual void set_from_attribute(SPObject*); @@ -52,23 +48,14 @@ public: void set_value(const double); void set_focuswidget(GtkWidget *widget); void set_appearance(const gchar* appearance); - -#if WITH_GTKMM_3_0 - const Glib::RefPtr get_adjustment() const; - Glib::RefPtr get_adjustment(); -#else - const Gtk::Adjustment *get_adjustment() const; - Gtk::Adjustment *get_adjustment(); -#endif private: -#if WITH_GTKMM_3_0 Glib::RefPtr _adjustment; -#else - Gtk::Adjustment *_adjustment; -#endif - GtkWidget *_spinscale; + +public: + const decltype(_adjustment) get_adjustment() const; + decltype(_adjustment) get_adjustment(); }; diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp index 9b361ae78..f17b9b26c 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -20,11 +20,7 @@ namespace Widget { SpinSlider::SpinSlider(double value, double lower, double upper, double step_inc, double climb_rate, int digits, const SPAttributeEnum a, const char* tip_text) : AttrWidget(a, value), -#if WITH_GTKMM_3_0 _adjustment(Gtk::Adjustment::create(value, lower, upper, step_inc)), -#else - _adjustment(value, lower, upper, step_inc), -#endif _scale(_adjustment), _spin(_adjustment, climb_rate, digits) { signal_value_changed().connect(signal_attr_changed().make_slot()); @@ -43,11 +39,7 @@ SpinSlider::SpinSlider(double value, double lower, double upper, double step_inc Glib::ustring SpinSlider::get_as_attribute() const { -#if WITH_GTKMM_3_0 - const double val = _adjustment->get_value(); -#else - const double val = _adjustment.get_value(); -#endif + const auto val = _adjustment->get_value(); if(_spin.get_digits() == 0) return Glib::Ascii::dtostr((int)val); @@ -58,77 +50,43 @@ Glib::ustring SpinSlider::get_as_attribute() const void SpinSlider::set_from_attribute(SPObject* o) { const gchar* val = attribute_value(o); -#if WITH_GTKMM_3_0 if(val) _adjustment->set_value(Glib::Ascii::strtod(val)); else _adjustment->set_value(get_default()->as_double()); -#else - if(val) - _adjustment.set_value(Glib::Ascii::strtod(val)); - else - _adjustment.set_value(get_default()->as_double()); -#endif } Glib::SignalProxy0 SpinSlider::signal_value_changed() { -#if WITH_GTKMM_3_0 return _adjustment->signal_value_changed(); -#else - return _adjustment.signal_value_changed(); -#endif } double SpinSlider::get_value() const { -#if WITH_GTKMM_3_0 return _adjustment->get_value(); -#else - return _adjustment.get_value(); -#endif } void SpinSlider::set_value(const double val) { -#if WITH_GTKMM_3_0 _adjustment->set_value(val); -#else - _adjustment.set_value(val); -#endif } -#if WITH_GTKMM_3_0 -const Glib::RefPtr SpinSlider::get_adjustment() const -#else -const Gtk::Adjustment& SpinSlider::get_adjustment() const -#endif +const decltype(SpinSlider::_adjustment) SpinSlider::get_adjustment() const { return _adjustment; } -#if WITH_GTKMM_3_0 -Glib::RefPtr SpinSlider::get_adjustment() -#else -Gtk::Adjustment& SpinSlider::get_adjustment() -#endif + +decltype(SpinSlider::_adjustment) SpinSlider::get_adjustment() { return _adjustment; } -#if WITH_GTKMM_3_0 const Gtk::Scale& SpinSlider::get_scale() const -#else -const Gtk::HScale& SpinSlider::get_scale() const -#endif { return _scale; } -#if WITH_GTKMM_3_0 Gtk::Scale& SpinSlider::get_scale() -#else -Gtk::HScale& SpinSlider::get_scale() -#endif { return _scale; } @@ -157,15 +115,9 @@ DualSpinSlider::DualSpinSlider(double value, double lower, double upper, double { signal_value_changed().connect(signal_attr_changed().make_slot()); -#if WITH_GTKMM_3_0 _s1.get_adjustment()->signal_value_changed().connect(_signal_value_changed.make_slot()); _s2.get_adjustment()->signal_value_changed().connect(_signal_value_changed.make_slot()); _s1.get_adjustment()->signal_value_changed().connect(sigc::mem_fun(*this, &DualSpinSlider::update_linked)); -#else - _s1.get_adjustment().signal_value_changed().connect(_signal_value_changed.make_slot()); - _s2.get_adjustment().signal_value_changed().connect(_signal_value_changed.make_slot()); - _s1.get_adjustment().signal_value_changed().connect(sigc::mem_fun(*this, &DualSpinSlider::update_linked)); -#endif _link.signal_toggled().connect(sigc::mem_fun(*this, &DualSpinSlider::link_toggled)); Gtk::VBox* vb = Gtk::manage(new Gtk::VBox); @@ -202,13 +154,8 @@ void DualSpinSlider::set_from_attribute(SPObject* o) _link.set_active(toks[1] == 0); -#if WITH_GTKMM_3_0 _s1.get_adjustment()->set_value(v1); _s2.get_adjustment()->set_value(v2); -#else - _s1.get_adjustment().set_value(v1); - _s2.get_adjustment().set_value(v2); -#endif g_strfreev(toks); } diff --git a/src/ui/widget/spin-slider.h b/src/ui/widget/spin-slider.h index a5999f14f..5a29c1b67 100644 --- a/src/ui/widget/spin-slider.h +++ b/src/ui/widget/spin-slider.h @@ -42,17 +42,8 @@ public: double get_value() const; void set_value(const double); -#if WITH_GTKMM_3_0 - const Glib::RefPtr get_adjustment() const; - Glib::RefPtr get_adjustment(); const Gtk::Scale& get_scale() const; Gtk::Scale& get_scale(); -#else - const Gtk::Adjustment& get_adjustment() const; - Gtk::Adjustment& get_adjustment(); - const Gtk::HScale& get_scale() const; - Gtk::HScale& get_scale(); -#endif const Inkscape::UI::Widget::SpinButton& get_spin_button() const; Inkscape::UI::Widget::SpinButton& get_spin_button(); @@ -60,14 +51,13 @@ public: // Change the SpinSlider into a SpinButton with AttrWidget support) void remove_scale(); private: -#if WITH_GTKMM_3_0 Glib::RefPtr _adjustment; Gtk::Scale _scale; -#else - Gtk::Adjustment _adjustment; - Gtk::HScale _scale; -#endif Inkscape::UI::Widget::SpinButton _spin; + +public: + const decltype(_adjustment) get_adjustment() const; + decltype(_adjustment) get_adjustment(); }; /** diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index 188be705d..21701c4c0 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -34,11 +34,7 @@ #include "verbs.h" #include -#if WITH_GTKMM_3_0 -# include -#else -# include -#endif +#include enum { SS_FILL, @@ -117,11 +113,7 @@ StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) _css(NULL), _tool_obs(NULL), _style_obs(NULL), -#if WITH_GTKMM_3_0 _table(Gtk::manage(new Gtk::Grid())), -#else - _table(Gtk::manage(new Gtk::Table(2, 6))), -#endif _sw_unit(NULL) { set_name("StyleSwatch"); @@ -139,13 +131,8 @@ StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) _opacity_value.set_alignment(0.0, 0.5); _opacity_value.set_padding(0, 0); -#if WITH_GTKMM_3_0 _table->set_column_spacing(2); _table->set_row_spacing(0); -#else - _table->set_col_spacings(2); - _table->set_row_spacings(0); -#endif _stroke.pack_start(_place[SS_STROKE]); _stroke_width_place.add(_stroke_width); @@ -153,19 +140,11 @@ StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) _opacity_place.add(_opacity_value); -#if WITH_GTKMM_3_0 _table->attach(_label[SS_FILL], 0, 0, 1, 1); _table->attach(_label[SS_STROKE], 0, 1, 1, 1); _table->attach(_place[SS_FILL], 1, 0, 1, 1); _table->attach(_stroke, 1, 1, 1, 1); _table->attach(_opacity_place, 2, 0, 1, 2); -#else - _table->attach(_label[SS_FILL], 0,1, 0,1, Gtk::FILL, Gtk::SHRINK); - _table->attach(_label[SS_STROKE], 0,1, 1,2, Gtk::FILL, Gtk::SHRINK); - _table->attach(_place[SS_FILL], 1,2, 0,1); - _table->attach(_stroke, 1,2, 1,2); - _table->attach(_opacity_place, 2,3, 0,2, Gtk::SHRINK, Gtk::SHRINK); -#endif _swatch.add(*_table); pack_start(_swatch, true, true, 0); diff --git a/src/ui/widget/style-swatch.h b/src/ui/widget/style-swatch.h index 0016e0256..81a907d16 100644 --- a/src/ui/widget/style-swatch.h +++ b/src/ui/widget/style-swatch.h @@ -29,11 +29,7 @@ class SPStyle; class SPCSSAttr; namespace Gtk { -#if WITH_GTKMM_3_0 class Grid; -#else -class Table; -#endif } namespace Inkscape { @@ -75,11 +71,7 @@ private: Gtk::EventBox _swatch; -#if WITH_GTKMM_3_0 Gtk::Grid *_table; -#else - Gtk::Table *_table; -#endif Gtk::Label _label[2]; Gtk::EventBox _place[2]; diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index ced811c57..a87ed7c0f 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -76,12 +76,8 @@ void ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& la // align the label with the checkbox text above by indenting 22 px. _hbox->pack_start(*theLabel1, Gtk::PACK_EXPAND_WIDGET, 22); -#if WITH_GTKMM_3_0 _hscale = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL)); _hscale->set_range(1.0, 51.0); -#else - _hscale = Gtk::manage (new Gtk::HScale (1.0, 51, 1.0)); -#endif theLabel1->set_mnemonic_widget (*_hscale); _hscale->set_draw_value (true); @@ -121,11 +117,7 @@ void ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& la void ToleranceSlider::setValue (double val) { -#if WITH_GTKMM_3_0 - Glib::RefPtr adj = _hscale->get_adjustment(); -#else - Gtk::Adjustment *adj = _hscale->get_adjustment(); -#endif + auto adj = _hscale->get_adjustment(); adj->set_lower (1.0); adj->set_upper (51.0); diff --git a/src/ui/widget/tolerance-slider.h b/src/ui/widget/tolerance-slider.h index 7ae8e4712..3d2548ebe 100644 --- a/src/ui/widget/tolerance-slider.h +++ b/src/ui/widget/tolerance-slider.h @@ -14,11 +14,7 @@ namespace Gtk { class RadioButton; -#if WITH_GTKMM_3_0 class Scale; -#else -class HScale; -#endif } namespace Inkscape { @@ -60,13 +56,7 @@ protected: void on_toggled(); void update (double val); Gtk::HBox *_hbox; - -#if WITH_GTKMM_3_0 Gtk::Scale *_hscale; -#else - Gtk::HScale *_hscale; -#endif - Gtk::RadioButtonGroup _radio_button_group; Gtk::RadioButton *_button1; Gtk::RadioButton *_button2; -- cgit v1.2.3 From dcd91f59f597ab4af07cee5929ce0e2e1f9104d5 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 28 Jul 2016 16:16:18 +0100 Subject: Drop remaining GTKMM 2 fallback support (bzr r15023.2.7) --- src/ui/clipboard.cpp | 11 +- src/ui/dialog/aboutbox.cpp | 14 +- src/ui/dialog/align-and-distribute.cpp | 38 +---- src/ui/dialog/align-and-distribute.h | 38 +---- src/ui/dialog/calligraphic-profile-rename.cpp | 25 +-- src/ui/dialog/calligraphic-profile-rename.h | 9 -- src/ui/dialog/clonetiler.cpp | 217 ++++---------------------- src/ui/dialog/clonetiler.h | 5 - src/ui/dialog/debug.cpp | 7 +- src/ui/dialog/document-metadata.cpp | 31 ---- src/ui/dialog/document-metadata.h | 12 +- src/ui/dialog/document-properties.cpp | 129 +-------------- src/ui/dialog/document-properties.h | 6 +- src/ui/dialog/export.cpp | 90 +---------- src/ui/dialog/export.h | 40 ----- src/ui/dialog/filedialogimpl-gtkmm.cpp | 86 ++-------- src/ui/dialog/filedialogimpl-win32.cpp | 4 - src/ui/dialog/fill-and-stroke.cpp | 19 --- src/ui/dialog/fill-and-stroke.h | 4 - src/ui/dialog/filter-effects-dialog.cpp | 164 ++----------------- src/ui/dialog/filter-effects-dialog.h | 12 -- src/ui/dialog/find.h | 6 - src/ui/dialog/floating-behavior.cpp | 8 - src/ui/dialog/glyphs.cpp | 79 +--------- src/ui/dialog/grid-arrange-tab.cpp | 20 +-- src/ui/dialog/grid-arrange-tab.h | 5 - src/ui/dialog/guides.cpp | 58 +------ src/ui/dialog/guides.h | 12 +- src/ui/dialog/icon-preview.h | 6 - src/ui/dialog/inkscape-preferences.cpp | 42 +---- src/ui/dialog/inkscape-preferences.h | 8 - src/ui/dialog/input.cpp | 131 +--------------- src/ui/dialog/layer-properties.cpp | 31 +--- src/ui/dialog/layer-properties.h | 10 -- src/ui/dialog/layers.cpp | 4 - src/ui/dialog/layers.h | 6 - src/ui/dialog/livepatheffect-add.cpp | 6 +- src/ui/dialog/livepatheffect-editor.cpp | 7 - src/ui/dialog/livepatheffect-editor.h | 4 - src/ui/dialog/new-from-template.cpp | 8 - src/ui/dialog/object-properties.cpp | 94 +---------- src/ui/dialog/object-properties.h | 4 - src/ui/dialog/objects.cpp | 21 --- src/ui/dialog/objects.h | 10 -- src/ui/dialog/ocaldialogs.cpp | 162 +------------------ src/ui/dialog/ocaldialogs.h | 41 +---- src/ui/dialog/polar-arrange-tab.cpp | 31 ---- src/ui/dialog/polar-arrange-tab.h | 11 +- src/ui/dialog/spellcheck.h | 15 -- src/ui/dialog/svg-fonts-dialog.cpp | 5 - src/ui/dialog/svg-fonts-dialog.h | 9 -- src/ui/dialog/swatches.cpp | 4 - src/ui/dialog/symbols.cpp | 49 +----- src/ui/dialog/tags.cpp | 4 - src/ui/dialog/tags.h | 6 - src/ui/dialog/text-edit.cpp | 25 +-- src/ui/dialog/text-edit.h | 11 -- src/ui/dialog/tile.h | 5 - src/ui/dialog/transformation.cpp | 102 ------------ src/ui/dialog/transformation.h | 4 - src/ui/dialog/undo-history.cpp | 33 ---- src/ui/dialog/undo-history.h | 18 --- src/ui/dialog/xml-tree.cpp | 18 --- src/ui/dialog/xml-tree.h | 11 -- src/ui/previewholder.cpp | 119 +++----------- src/ui/previewholder.h | 9 -- src/ui/tools/tool-base.cpp | 6 - 67 files changed, 129 insertions(+), 2110 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index d581dbf7e..6b24c5a2d 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -1300,11 +1300,7 @@ Geom::Scale ClipboardManagerImpl::_getScale(SPDesktop *desktop, Geom::Point cons */ Glib::ustring ClipboardManagerImpl::_getBestTarget() { -#if WITH_GTKMM_3_0 - std::vector targets = _clipboard->wait_for_targets(); -#else - std::list targets = _clipboard->wait_for_targets(); -#endif + auto targets = _clipboard->wait_for_targets(); // clipboard target debugging snippet /* @@ -1363,12 +1359,7 @@ void ClipboardManagerImpl::_setClipboardTargets() { Inkscape::Extension::DB::OutputList outlist; Inkscape::Extension::db.get_output_list(outlist); - -#if WITH_GTKMM_3_0 std::vector target_list; -#else - std::list target_list; -#endif bool plaintextSet = false; for (Inkscape::Extension::DB::OutputList::const_iterator out = outlist.begin() ; out != outlist.end() ; ++out) { diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index 6276d3391..ffb46fd1b 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -98,11 +98,7 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) { tabs->append_page(*manage( make_scrolled_text(license_text)), _("_License"), true); -#if WITH_GTKMM_3_0 get_content_area()->pack_end(*manage(tabs), true, true); -#else - get_vbox()->pack_end(*manage(tabs), true, true); -#endif tabs->show_all(); @@ -130,20 +126,12 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) { link->set_selectable(true); link->show(); -#if WITH_GTKMM_3_0 get_content_area()->pack_start(*manage(label), false, false); get_content_area()->pack_start(*manage(link), false, false); -#else - get_vbox()->pack_start(*manage(label), false, false); - get_vbox()->pack_start(*manage(link), false, false); -#endif Gtk::Requisition requisition; -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_get_preferred_size(reinterpret_cast(gobj()), &requisition, NULL); -#else - gtk_widget_size_request (reinterpret_cast(gobj()), &requisition); -#endif + // allow window to shrink set_size_request(0, 0); set_default_size(requisition.width, requisition.height); diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 8f87932b8..971275e59 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -61,11 +61,7 @@ namespace Dialog { Action::Action(const Glib::ustring &id, const Glib::ustring &tiptext, guint row, guint column, -#if WITH_GTKMM_3_0 - Gtk::Grid &parent, -#else - Gtk::Table &parent, -#endif + Gtk::Grid &parent, AlignAndDistribute &dialog): _dialog(dialog), _id(id), @@ -81,11 +77,7 @@ Action::Action(const Glib::ustring &id, pButton->signal_clicked() .connect(sigc::mem_fun(*this, &Action::on_button_click)); pButton->set_tooltip_text(tiptext); -#if WITH_GTKMM_3_0 parent.attach(*pButton, column, row, 1, 1); -#else - parent.attach(*pButton, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL); -#endif } @@ -447,11 +439,7 @@ public: Action(id, tiptext, row, column + 4, dialog.removeOverlap_table(), dialog) { -#if WITH_GTKMM_3_0 dialog.removeOverlap_table().set_column_spacing(3); -#else - dialog.removeOverlap_table().set_col_spacings(3); -#endif removeOverlapXGap.set_digits(1); removeOverlapXGap.set_size_request(60, -1); @@ -473,17 +461,10 @@ public: removeOverlapYGapLabel.set_text_with_mnemonic(C_("Gap", "_V:")); removeOverlapYGapLabel.set_mnemonic_widget(removeOverlapYGap); -#if WITH_GTKMM_3_0 dialog.removeOverlap_table().attach(removeOverlapXGapLabel, column, row, 1, 1); dialog.removeOverlap_table().attach(removeOverlapXGap, column+1, row, 1, 1); dialog.removeOverlap_table().attach(removeOverlapYGapLabel, column+2, row, 1, 1); dialog.removeOverlap_table().attach(removeOverlapYGap, column+3, row, 1, 1); -#else - dialog.removeOverlap_table().attach(removeOverlapXGapLabel, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL); - dialog.removeOverlap_table().attach(removeOverlapXGap, column+1, column+2, row, row+1, Gtk::FILL, Gtk::FILL); - dialog.removeOverlap_table().attach(removeOverlapYGapLabel, column+2, column+3, row, row+1, Gtk::FILL, Gtk::FILL); - dialog.removeOverlap_table().attach(removeOverlapYGap, column+3, column+4, row, row+1, Gtk::FILL, Gtk::FILL); -#endif } private : @@ -762,11 +743,7 @@ public : guint row, guint column, AlignAndDistribute &dialog, -#if WITH_GTKMM_3_0 Gtk::Grid &table, -#else - Gtk::Table &table, -#endif Geom::Dim2 orientation, bool distribute): Action(id, tiptext, row, column, table, dialog), @@ -939,19 +916,11 @@ AlignAndDistribute::AlignAndDistribute() _rearrangeFrame(_("Rearrange")), _removeOverlapFrame(_("Remove overlaps")), _nodesFrame(_("Nodes")), -#if WITH_GTKMM_3_0 _alignTable(), _distributeTable(), _rearrangeTable(), _removeOverlapTable(), _nodesTable(), -#else - _alignTable(2, 6, true), - _distributeTable(2, 6, true), - _rearrangeTable(1, 5, false), - _removeOverlapTable(1, 5, false), - _nodesTable(1, 4, true), -#endif _anchorLabel(_("Relative to: ")), _anchorLabelNode(_("Relative to: ")), _selgrpLabel(_("_Treat selection as group: "), 1) @@ -1316,13 +1285,8 @@ void AlignAndDistribute::addRandomizeButton(const Glib::ustring &id, const Glib: ); } -#if WITH_GTKMM_3_0 void AlignAndDistribute::addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext, guint row, guint col, Gtk::Grid &table, Geom::Dim2 orientation, bool distribute) -#else -void AlignAndDistribute::addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext, - guint row, guint col, Gtk::Table &table, Geom::Dim2 orientation, bool distribute) -#endif { _actionList.push_back( new ActionBaseline( diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h index f8cc61af2..acb3d02ed 100644 --- a/src/ui/dialog/align-and-distribute.h +++ b/src/ui/dialog/align-and-distribute.h @@ -22,15 +22,11 @@ #include #include #include -#include "2geom/rect.h" -#include "ui/dialog/desktop-tracker.h" - -#if WITH_GTKMM_3_0 #include #include -#else -#include -#endif + +#include "2geom/rect.h" +#include "ui/dialog/desktop-tracker.h" class SPItem; @@ -51,19 +47,11 @@ public: static AlignAndDistribute &getInstance() { return *new AlignAndDistribute(); } -#if WITH_GTKMM_3_0 Gtk::Grid &align_table(){return _alignTable;} Gtk::Grid &distribute_table(){return _distributeTable;} Gtk::Grid &rearrange_table(){return _rearrangeTable;} Gtk::Grid &removeOverlap_table(){return _removeOverlapTable;} Gtk::Grid &nodes_table(){return _nodesTable;} -#else - Gtk::Table &align_table(){return _alignTable;} - Gtk::Table &distribute_table(){return _distributeTable;} - Gtk::Table &rearrange_table(){return _rearrangeTable;} - Gtk::Table &removeOverlap_table(){return _removeOverlapTable;} - Gtk::Table &nodes_table(){return _nodesTable;} -#endif void setMode(bool nodeEdit); @@ -100,22 +88,13 @@ protected: guint row, guint col); void addRandomizeButton(const Glib::ustring &id, const Glib::ustring tiptext, guint row, guint col); -#if WITH_GTKMM_3_0 void addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext, guint row, guint col, Gtk::Grid &table, Geom::Dim2 orientation, bool distribute); -#else - void addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext, - guint row, guint col, Gtk::Table &table, Geom::Dim2 orientation, bool distribute); -#endif void setTargetDesktop(SPDesktop *desktop); std::list _actionList; UI::Widget::Frame _alignFrame, _distributeFrame, _rearrangeFrame, _removeOverlapFrame, _nodesFrame; -#if WITH_GTKMM_3_0 Gtk::Grid _alignTable, _distributeTable, _rearrangeTable, _removeOverlapTable, _nodesTable; -#else - Gtk::Table _alignTable, _distributeTable, _rearrangeTable, _removeOverlapTable, _nodesTable; -#endif Gtk::HBox _anchorBox; Gtk::HBox _selgrpBox; Gtk::VBox _alignBox; @@ -163,11 +142,7 @@ public : Action(const Glib::ustring &id, const Glib::ustring &tiptext, guint row, guint column, - #if WITH_GTKMM_3_0 - Gtk::Grid &parent, - #else - Gtk::Table &parent, - #endif + Gtk::Grid &parent, AlignAndDistribute &dialog); virtual ~Action(){} @@ -178,12 +153,7 @@ private : virtual void on_button_click(){} Glib::ustring _id; - -#if WITH_GTKMM_3_0 Gtk::Grid &_parent; -#else - Gtk::Table &_parent; -#endif }; diff --git a/src/ui/dialog/calligraphic-profile-rename.cpp b/src/ui/dialog/calligraphic-profile-rename.cpp index 9ae22db2d..50dae0fd8 100644 --- a/src/ui/dialog/calligraphic-profile-rename.cpp +++ b/src/ui/dialog/calligraphic-profile-rename.cpp @@ -16,12 +16,7 @@ #include "calligraphic-profile-rename.h" #include #include - -#if WITH_GTKMM_3_0 -# include -#else -# include -#endif +#include #include "desktop.h" @@ -30,40 +25,24 @@ namespace UI { namespace Dialog { CalligraphicProfileRename::CalligraphicProfileRename() : -#if WITH_GTKMM_3_0 _layout_table(Gtk::manage(new Gtk::Grid())), -#else - _layout_table(Gtk::manage(new Gtk::Table(1, 2))), -#endif _applied(false) { set_title(_("Edit profile")); -#if WITH_GTKMM_3_0 - Gtk::Box *mainVBox = get_content_area(); + auto mainVBox = get_content_area(); _layout_table->set_column_spacing(4); _layout_table->set_row_spacing(4); -#else - Gtk::Box *mainVBox = get_vbox(); - _layout_table->set_spacings(4); -#endif _profile_name_entry.set_activates_default(true); _profile_name_label.set_label(_("Profile name:")); _profile_name_label.set_alignment(1.0, 0.5); -#if WITH_GTKMM_3_0 _layout_table->attach(_profile_name_label, 0, 0, 1, 1); _profile_name_entry.set_hexpand(); _layout_table->attach(_profile_name_entry, 1, 0, 1, 1); -#else - _layout_table->attach(_profile_name_label, - 0, 1, 0, 1, Gtk::FILL, Gtk::FILL); - _layout_table->attach(_profile_name_entry, - 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL); -#endif mainVBox->pack_start(*_layout_table, false, false, 4); // Buttons diff --git a/src/ui/dialog/calligraphic-profile-rename.h b/src/ui/dialog/calligraphic-profile-rename.h index 4ef71900b..b7a97a1e7 100644 --- a/src/ui/dialog/calligraphic-profile-rename.h +++ b/src/ui/dialog/calligraphic-profile-rename.h @@ -20,11 +20,7 @@ #include namespace Gtk { -#if WITH_GTKMM_3_0 class Grid; -#else -class Table; -#endif } class SPDesktop; @@ -59,12 +55,7 @@ protected: Gtk::Label _profile_name_label; Gtk::Entry _profile_name_entry; - -#if WITH_GTKMM_3_0 Gtk::Grid* _layout_table; -#else - Gtk::Table* _layout_table; -#endif Gtk::Button _close_button; Gtk::Button _delete_button; diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index b727c87ee..da00b7b00 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -91,12 +91,8 @@ CloneTiler::CloneTiler () : dlg = GTK_WIDGET(gobj()); -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *mainbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); + auto mainbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); gtk_box_set_homogeneous(GTK_BOX(mainbox), FALSE); -#else - GtkWidget *mainbox = gtk_vbox_new(FALSE, 4); -#endif gtk_container_set_border_width (GTK_CONTAINER (mainbox), 6); contents->pack_start (*Gtk::manage(Glib::wrap(mainbox)), true, true, 0); @@ -651,12 +647,8 @@ CloneTiler::CloneTiler () : GtkWidget *vb = clonetiler_new_tab (nb, _("Co_lor")); { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new (FALSE, 0); -#endif GtkWidget *l = gtk_label_new (_("Initial color: ")); gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0); @@ -777,12 +769,8 @@ CloneTiler::CloneTiler () : { GtkWidget *vb = clonetiler_new_tab (nb, _("_Trace")); { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); + auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN); -#endif gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0); b = gtk_check_button_new_with_label (_("Trace the drawing under the clones/sprayed items")); @@ -797,12 +785,8 @@ CloneTiler::CloneTiler () : } { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *vvb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + auto vvb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_set_homogeneous(GTK_BOX(vvb), FALSE); -#else - GtkWidget *vvb = gtk_vbox_new (FALSE, 0); -#endif gtk_box_pack_start (GTK_BOX (vb), vvb, FALSE, FALSE, 0); g_object_set_data (G_OBJECT(dlg), "dotrace", (gpointer) vvb); @@ -811,15 +795,9 @@ CloneTiler::CloneTiler () : GtkWidget *frame = gtk_frame_new (_("1. Pick from the drawing:")); gtk_box_pack_start (GTK_BOX (vvb), frame, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *table = gtk_grid_new(); + auto table = gtk_grid_new(); gtk_grid_set_row_spacing(GTK_GRID(table), 4); gtk_grid_set_column_spacing(GTK_GRID(table), 6); -#else - GtkWidget *table = gtk_table_new (3, 3, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 4); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); -#endif gtk_container_add(GTK_CONTAINER(frame), table); @@ -895,15 +873,9 @@ CloneTiler::CloneTiler () : GtkWidget *frame = gtk_frame_new (_("2. Tweak the picked value:")); gtk_box_pack_start (GTK_BOX (vvb), frame, FALSE, FALSE, VB_MARGIN); -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *table = gtk_grid_new(); + auto table = gtk_grid_new(); gtk_grid_set_row_spacing(GTK_GRID(table), 4); gtk_grid_set_column_spacing(GTK_GRID(table), 6); -#else - GtkWidget *table = gtk_table_new (4, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 4); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); -#endif gtk_container_add(GTK_CONTAINER(frame), table); @@ -944,15 +916,9 @@ CloneTiler::CloneTiler () : GtkWidget *frame = gtk_frame_new (_("3. Apply the value to the clones':")); gtk_box_pack_start (GTK_BOX (vvb), frame, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *table = gtk_grid_new(); + auto table = gtk_grid_new(); gtk_grid_set_row_spacing(GTK_GRID(table), 4); gtk_grid_set_column_spacing(GTK_GRID(table), 6); -#else - GtkWidget *table = gtk_table_new (2, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 4); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); -#endif gtk_container_add(GTK_CONTAINER(frame), table); { @@ -1000,12 +966,8 @@ CloneTiler::CloneTiler () : } { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); + auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN); -#endif gtk_box_pack_start (GTK_BOX (mainbox), hb, FALSE, FALSE, 0); GtkWidget *l = gtk_label_new(_("")); gtk_label_set_markup (GTK_LABEL(l), _("Apply to tiled clones:")); @@ -1013,42 +975,24 @@ CloneTiler::CloneTiler () : } // Rows/columns, width/height { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *table = gtk_grid_new(); + auto table = gtk_grid_new(); gtk_grid_set_row_spacing(GTK_GRID(table), 4); gtk_grid_set_column_spacing(GTK_GRID(table), 6); -#else - GtkWidget *table = gtk_table_new (2, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 4); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); -#endif gtk_container_set_border_width (GTK_CONTAINER (table), VB_MARGIN); gtk_box_pack_start (GTK_BOX (mainbox), table, FALSE, FALSE, 0); { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); + auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN); -#endif g_object_set_data (G_OBJECT(dlg), "rowscols", (gpointer) hb); { -#if WITH_GTKMM_3_0 - Glib::RefPtra = Gtk::Adjustment::create(0.0, 1, 500, 1, 10, 0); -#else - Gtk::Adjustment *a = new Gtk::Adjustment (0.0, 1, 500, 1, 10, 0); -#endif + auto a = Gtk::Adjustment::create(0.0, 1, 500, 1, 10, 0); int value = prefs->getInt(prefs_path + "jmax", 2); a->set_value (value); -#if WITH_GTKMM_3_0 - Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton(a, 1.0, 0); -#else - Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton (*a, 1.0, 0); -#endif + auto sb = new Inkscape::UI::Widget::SpinButton(a, 1.0, 0); sb->set_tooltip_text (_("How many rows in the tiling")); sb->set_width_chars (7); gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(sb->gobj()), TRUE, TRUE, 0); @@ -1061,28 +1005,16 @@ CloneTiler::CloneTiler () : { GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), "×"); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_set_halign(l, GTK_ALIGN_END); -#else - gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0.5); -#endif gtk_box_pack_start (GTK_BOX (hb), l, TRUE, TRUE, 0); } { -#if WITH_GTKMM_3_0 - Glib::RefPtr a = Gtk::Adjustment::create(0.0, 1, 500, 1, 10, 0); -#else - Gtk::Adjustment *a = new Gtk::Adjustment (0.0, 1, 500, 1, 10, 0); -#endif + auto a = Gtk::Adjustment::create(0.0, 1, 500, 1, 10, 0); int value = prefs->getInt(prefs_path + "imax", 2); a->set_value (value); -#if WITH_GTKMM_3_0 - Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton(a, 1.0, 0); -#else - Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton (*a, 1.0, 0); -#endif + auto sb = new Inkscape::UI::Widget::SpinButton(a, 1.0, 0); sb->set_tooltip_text (_("How many columns in the tiling")); sb->set_width_chars (7); gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(sb->gobj()), TRUE, TRUE, 0); @@ -1096,12 +1028,8 @@ CloneTiler::CloneTiler () : } { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); + auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN); -#endif g_object_set_data (G_OBJECT(dlg), "widthheight", (gpointer) hb); // unitmenu @@ -1112,59 +1040,39 @@ CloneTiler::CloneTiler () : { // Width spinbutton -#if WITH_GTKMM_3_0 fill_width = Gtk::Adjustment::create(0.0, -1e6, 1e6, 1.0, 10.0, 0); -#else - fill_width = new Gtk::Adjustment (0.0, -1e6, 1e6, 1.0, 10.0, 0); -#endif double value = prefs->getDouble(prefs_path + "fillwidth", 50.0); Inkscape::Util::Unit const *unit = unit_menu->getUnit(); gdouble const units = Inkscape::Util::Quantity::convert(value, "px", unit); fill_width->set_value (units); -#if WITH_GTKMM_3_0 - Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton(fill_width, 1.0, 2); -#else - Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton (*fill_width, 1.0, 2); -#endif + auto e = new Inkscape::UI::Widget::SpinButton(fill_width, 1.0, 2); e->set_tooltip_text (_("Width of the rectangle to be filled")); e->set_width_chars (7); e->set_digits (4); gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(e->gobj()), TRUE, TRUE, 0); // TODO: C++ification - g_signal_connect(G_OBJECT(fill_width->gobj()), "value_changed", + g_signal_connect(G_OBJECT(fill_width->gobj()), "value_changed", G_CALLBACK(clonetiler_fill_width_changed), unit_menu); } { GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), "×"); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_set_halign(l, GTK_ALIGN_END); -#else - gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0.5); -#endif gtk_box_pack_start (GTK_BOX (hb), l, TRUE, TRUE, 0); } { // Height spinbutton -#if WITH_GTKMM_3_0 fill_height = Gtk::Adjustment::create(0.0, -1e6, 1e6, 1.0, 10.0, 0); -#else - fill_height = new Gtk::Adjustment (0.0, -1e6, 1e6, 1.0, 10.0, 0); -#endif double value = prefs->getDouble(prefs_path + "fillheight", 50.0); Inkscape::Util::Unit const *unit = unit_menu->getUnit(); gdouble const units = Inkscape::Util::Quantity::convert(value, "px", unit); fill_height->set_value (units); -#if WITH_GTKMM_3_0 - Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton(fill_height, 1.0, 2); -#else - Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton (*fill_height, 1.0, 2); -#endif + auto e = new Inkscape::UI::Widget::SpinButton(fill_height, 1.0, 2); e->set_tooltip_text (_("Height of the rectangle to be filled")); e->set_width_chars (7); e->set_digits (4); @@ -1206,12 +1114,8 @@ CloneTiler::CloneTiler () : // Use saved pos { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); + auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN); -#endif gtk_box_pack_start (GTK_BOX (mainbox), hb, FALSE, FALSE, 0); GtkWidget *b = gtk_check_button_new_with_label (_("Use saved size and position of the tile")); @@ -1226,12 +1130,8 @@ CloneTiler::CloneTiler () : // Statusbar { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); + auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN); -#endif gtk_box_pack_end (GTK_BOX (mainbox), hb, FALSE, FALSE, 0); GtkWidget *l = gtk_label_new(""); g_object_set_data (G_OBJECT(dlg), "status", (gpointer) l); @@ -1240,12 +1140,8 @@ CloneTiler::CloneTiler () : // Buttons { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); + auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN); -#endif gtk_box_pack_start (GTK_BOX (mainbox), hb, FALSE, FALSE, 0); { @@ -1259,12 +1155,8 @@ CloneTiler::CloneTiler () : } { // buttons which are enabled only when there are tiled clones -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *sb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + auto sb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous(GTK_BOX(sb), FALSE); -#else - GtkWidget *sb = gtk_hbox_new(FALSE, 0); -#endif gtk_box_pack_end (GTK_BOX (hb), sb, FALSE, FALSE, 0); g_object_set_data (G_OBJECT(dlg), "buttons_on_tiles", (gpointer) sb); { @@ -2673,12 +2565,8 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) GtkWidget * CloneTiler::clonetiler_new_tab(GtkWidget *nb, const gchar *label) { GtkWidget *l = gtk_label_new_with_mnemonic (label); -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, VB_MARGIN); + auto vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(vb), FALSE); -#else - GtkWidget *vb = gtk_vbox_new (FALSE, VB_MARGIN); -#endif gtk_container_set_border_width (GTK_CONTAINER (vb), VB_MARGIN); gtk_notebook_append_page (GTK_NOTEBOOK (nb), vb, l); return vb; @@ -2693,12 +2581,8 @@ void CloneTiler::clonetiler_checkbox_toggled(GtkToggleButton *tb, gpointer *data GtkWidget * CloneTiler::clonetiler_checkbox(const char *tip, const char *attr) { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); + auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN); -#endif GtkWidget *b = gtk_check_button_new (); gtk_widget_set_tooltip_text (b, tip); @@ -2725,44 +2609,23 @@ void CloneTiler::clonetiler_value_changed(GtkAdjustment *adj, gpointer data) GtkWidget * CloneTiler::clonetiler_spinbox(const char *tip, const char *attr, double lower, double upper, const gchar *suffix, bool exponent/* = false*/) { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new(FALSE, 0); -#endif { -#if WITH_GTKMM_3_0 Glib::RefPtr a; if (exponent) { a = Gtk::Adjustment::create(1.0, lower, upper, 0.01, 0.05, 0); } else { a = Gtk::Adjustment::create(0.0, lower, upper, 0.1, 0.5, 0); } -#else - Gtk::Adjustment *a; - if (exponent) { - a = new Gtk::Adjustment (1.0, lower, upper, 0.01, 0.05, 0); - } else { - a = new Gtk::Adjustment (0.0, lower, upper, 0.1, 0.5, 0); - } -#endif Inkscape::UI::Widget::SpinButton *sb; -#if WITH_GTKMM_3_0 if (exponent) { sb = new Inkscape::UI::Widget::SpinButton(a, 0.01, 2); } else { sb = new Inkscape::UI::Widget::SpinButton(a, 0.1, 1); } -#else - if (exponent) { - sb = new Inkscape::UI::Widget::SpinButton (*a, 0.01, 2); - } else { - sb = new Inkscape::UI::Widget::SpinButton (*a, 0.1, 1); - } -#endif sb->set_tooltip_text (tip); sb->set_width_chars (5); @@ -2786,12 +2649,8 @@ GtkWidget * CloneTiler::clonetiler_spinbox(const char *tip, const char *attr, do { GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), suffix); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_set_halign(l, GTK_ALIGN_END); gtk_widget_set_valign(l, GTK_ALIGN_START); -#else - gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0); -#endif gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0); } @@ -2867,38 +2726,22 @@ void CloneTiler::clonetiler_reset(GtkWidget */*widget*/, GtkWidget *dlg) void CloneTiler::clonetiler_table_attach(GtkWidget *table, GtkWidget *widget, float align, int row, int col) { -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_set_halign(widget, GTK_ALIGN_FILL); gtk_widget_set_valign(widget, GTK_ALIGN_START); gtk_grid_attach(GTK_GRID(table), widget, col, row, 1, 1); -#else - GtkWidget *a = gtk_alignment_new (align, 0, 0, 0); - gtk_container_add(GTK_CONTAINER(a), widget); - gtk_table_attach ( GTK_TABLE (table), a, col, col + 1, row, row + 1, GTK_FILL, (GtkAttachOptions)0, 0, 0 ); -#endif } GtkWidget * CloneTiler::clonetiler_table_x_y_rand(int values) { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *table = gtk_grid_new(); + auto table = gtk_grid_new(); gtk_grid_set_row_spacing(GTK_GRID(table), 6); gtk_grid_set_column_spacing(GTK_GRID(table), 8); -#else - GtkWidget *table = gtk_table_new (values + 2, 5, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 8); -#endif gtk_container_set_border_width (GTK_CONTAINER (table), VB_MARGIN); { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new (FALSE, 0); -#endif GtkWidget *i = sp_icon_new (Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON("object-rows")); gtk_box_pack_start (GTK_BOX (hb), i, FALSE, FALSE, 2); @@ -2911,12 +2754,8 @@ GtkWidget * CloneTiler::clonetiler_table_x_y_rand(int values) } { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new (FALSE, 0); -#endif GtkWidget *i = sp_icon_new (Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON("object-columns")); gtk_box_pack_start (GTK_BOX (hb), i, FALSE, FALSE, 2); diff --git a/src/ui/dialog/clonetiler.h b/src/ui/dialog/clonetiler.h index a8f1df0a0..e76ad028e 100644 --- a/src/ui/dialog/clonetiler.h +++ b/src/ui/dialog/clonetiler.h @@ -121,13 +121,8 @@ private: GtkSizeGroup* table_row_labels; Inkscape::UI::Widget::UnitMenu *unit_menu; -#if WITH_GTKMM_3_0 Glib::RefPtr fill_width; Glib::RefPtr fill_height; -#else - Gtk::Adjustment *fill_width; - Gtk::Adjustment *fill_height; -#endif sigc::connection desktopChangeConn; sigc::connection selectChangedConn; diff --git a/src/ui/dialog/debug.cpp b/src/ui/dialog/debug.cpp index d127261c0..48d7abbdd 100644 --- a/src/ui/dialog/debug.cpp +++ b/src/ui/dialog/debug.cpp @@ -68,12 +68,7 @@ DebugDialogImpl::DebugDialogImpl() { set_title(_("Messages")); set_size_request(300, 400); - -#if WITH_GTKMM_3_0 - Gtk::Box *mainVBox = get_content_area(); -#else - Gtk::Box *mainVBox = get_vbox(); -#endif + auto mainVBox = get_content_area(); //## Add a menu for clear() Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem(_("_File"), true)); diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index da1facc08..602c3d6be 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -61,12 +61,7 @@ DocumentMetadata::getInstance() DocumentMetadata::DocumentMetadata() -#if WITH_GTKMM_3_0 : UI::Widget::Panel ("", "/dialogs/documentmetadata", SP_VERB_DIALOG_METADATA) -#else - : UI::Widget::Panel ("", "/dialogs/documentmetadata", SP_VERB_DIALOG_METADATA), - _page_metadata1(1, 1), _page_metadata2(1, 1) -#endif { hide(); _getContents()->set_spacing (4); @@ -75,15 +70,10 @@ DocumentMetadata::DocumentMetadata() _page_metadata1.set_border_width(2); _page_metadata2.set_border_width(2); -#if WITH_GTKMM_3_0 _page_metadata1.set_column_spacing(2); _page_metadata2.set_column_spacing(2); _page_metadata1.set_row_spacing(2); _page_metadata2.set_row_spacing(2); -#else - _page_metadata1.set_spacings(2); - _page_metadata2.set_spacings(2); -#endif _notebook.append_page(_page_metadata1, _("Metadata")); _notebook.append_page(_page_metadata2, _("License")); @@ -126,12 +116,8 @@ DocumentMetadata::build_metadata() label->set_markup (_("Dublin Core Entities")); label->set_alignment (0.0); -#if WITH_GTKMM_3_0 label->set_valign(Gtk::ALIGN_CENTER); _page_metadata1.attach(*label, 0, 0, 3, 1); -#else - _page_metadata1.attach(*label, 0,3,0,1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); -#endif /* add generic metadata entry areas */ struct rdf_work_entity_t * entity; @@ -143,7 +129,6 @@ DocumentMetadata::build_metadata() Gtk::HBox *space = Gtk::manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); -#if WITH_GTKMM_3_0 space->set_valign(Gtk::ALIGN_CENTER); _page_metadata1.attach(*space, 0, row, 1, 1); @@ -153,11 +138,6 @@ DocumentMetadata::build_metadata() w->_packable->set_hexpand(); w->_packable->set_valign(Gtk::ALIGN_CENTER); _page_metadata1.attach(*w->_packable, 2, row, 1, 1); -#else - _page_metadata1.attach(*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata1.attach(w->_label, 1,2, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata1.attach(*w->_packable, 2,3, row, row+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); -#endif } } @@ -167,31 +147,20 @@ DocumentMetadata::build_metadata() Gtk::Label *llabel = Gtk::manage (new Gtk::Label); llabel->set_markup (_("License")); llabel->set_alignment (0.0); - -#if WITH_GTKMM_3_0 llabel->set_valign(Gtk::ALIGN_CENTER); _page_metadata2.attach(*llabel, 0, row, 3, 1); -#else - _page_metadata2.attach(*llabel, 0,3, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); -#endif /* add license selector pull-down and URI */ ++row; _licensor.init (_wr); Gtk::HBox *space = Gtk::manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); - -#if WITH_GTKMM_3_0 space->set_valign(Gtk::ALIGN_CENTER); _page_metadata2.attach(*space, 0, row, 1, 1); _licensor.set_hexpand(); _licensor.set_valign(Gtk::ALIGN_CENTER); _page_metadata2.attach(_licensor, 1, row, 2, 1); -#else - _page_metadata2.attach(*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata2.attach(_licensor, 1,3, row, row+1, Gtk::EXPAND|Gtk::FILL, (Gtk::AttachOptions)0,0,0); -#endif } /** diff --git a/src/ui/dialog/document-metadata.h b/src/ui/dialog/document-metadata.h index cde5d92fd..2c56e9317 100644 --- a/src/ui/dialog/document-metadata.h +++ b/src/ui/dialog/document-metadata.h @@ -21,12 +21,7 @@ #include #include "ui/widget/panel.h" #include - -#if WITH_GTKMM_3_0 -# include -#else -# include -#endif +#include #include "inkscape.h" #include "ui/widget/licensor.h" @@ -62,13 +57,8 @@ protected: Gtk::Notebook _notebook; -#if WITH_GTKMM_3_0 Gtk::Grid _page_metadata1; Gtk::Grid _page_metadata2; -#else - Gtk::Table _page_metadata1; - Gtk::Table _page_metadata2; -#endif //--------------------------------------------------------------- RDElist _rdflist; diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 589973162..33f134c11 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -223,25 +223,16 @@ DocumentProperties::~DocumentProperties() * widget in columns 2-3; (non-0, 0) means label in columns 1-3; and * (non-0, non-0) means two widgets in columns 2 and 3. */ -#if WITH_GTKMM_3_0 inline void attach_all(Gtk::Grid &table, Gtk::Widget *const arr[], unsigned const n, int start = 0, int docum_prop_flag = 0) -#else -inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned const n, int start = 0, int docum_prop_flag = 0) -#endif { for (unsigned i = 0, r = start; i < n; i += 2) { if (arr[i] && arr[i+1]) { -#if WITH_GTKMM_3_0 arr[i]->set_hexpand(); arr[i+1]->set_hexpand(); arr[i]->set_valign(Gtk::ALIGN_CENTER); arr[i+1]->set_valign(Gtk::ALIGN_CENTER); table.attach(*arr[i], 1, r, 1, 1); table.attach(*arr[i+1], 2, r, 1, 1); -#else - table.attach(*arr[i], 1, 2, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); - table.attach(*arr[i+1], 2, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); -#endif } else { if (arr[i+1]) { Gtk::AttachOptions yoptions = (Gtk::AttachOptions)0; @@ -252,7 +243,6 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con if (docum_prop_flag) { // this sets the padding for subordinate widgets on the "Page" page if( i==(n-8) || i==(n-10) ) { -#if WITH_GTKMM_3_0 arr[i+1]->set_hexpand(); arr[i+1]->set_margin_left(20); arr[i+1]->set_margin_right(20); @@ -263,11 +253,7 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con arr[i+1]->set_valign(Gtk::ALIGN_CENTER); table.attach(*arr[i+1], 1, r, 2, 1); -#else - table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 20,0); -#endif } else { -#if WITH_GTKMM_3_0 arr[i+1]->set_hexpand(); if (yoptions & Gtk::EXPAND) @@ -276,12 +262,8 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con arr[i+1]->set_valign(Gtk::ALIGN_CENTER); table.attach(*arr[i+1], 1, r, 2, 1); -#else - table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 0,0); -#endif } } else { -#if WITH_GTKMM_3_0 arr[i+1]->set_hexpand(); if (yoptions & Gtk::EXPAND) @@ -290,32 +272,21 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con arr[i+1]->set_valign(Gtk::ALIGN_CENTER); table.attach(*arr[i+1], 1, r, 2, 1); -#else - table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 0,0); -#endif } } else if (arr[i]) { Gtk::Label& label = reinterpret_cast(*arr[i]); label.set_alignment (0.0); -#if WITH_GTKMM_3_0 label.set_hexpand(); label.set_valign(Gtk::ALIGN_CENTER); table.attach(label, 0, r, 3, 1); -#else - table.attach (label, 0, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); -#endif } else { Gtk::HBox *space = Gtk::manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); -#if WITH_GTKMM_3_0 space->set_halign(Gtk::ALIGN_CENTER); space->set_valign(Gtk::ALIGN_CENTER); table.attach(*space, 0, r, 1, 1); -#else - table.attach (*space, 0, 1, r, r+1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0,0,0); -#endif } } ++r; @@ -685,52 +656,35 @@ void DocumentProperties::build_cms() label_link->set_alignment(0.0); -#if WITH_GTKMM_3_0 label_link->set_hexpand(); label_link->set_valign(Gtk::ALIGN_CENTER); _page_cms->table().attach(*label_link, 0, row, 3, 1); -#else - _page_cms->table().attach(*label_link, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; -#if WITH_GTKMM_3_0 _LinkedProfilesListScroller.set_hexpand(); _LinkedProfilesListScroller.set_valign(Gtk::ALIGN_CENTER); _page_cms->table().attach(_LinkedProfilesListScroller, 0, row, 3, 1); -#else - _page_cms->table().attach(_LinkedProfilesListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; Gtk::HBox* spacer = Gtk::manage(new Gtk::HBox()); spacer->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); -#if WITH_GTKMM_3_0 spacer->set_hexpand(); spacer->set_valign(Gtk::ALIGN_CENTER); _page_cms->table().attach(*spacer, 0, row, 3, 1); -#else - _page_cms->table().attach(*spacer, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; label_avail->set_alignment(0.0); -#if WITH_GTKMM_3_0 label_avail->set_hexpand(); label_avail->set_valign(Gtk::ALIGN_CENTER); _page_cms->table().attach(*label_avail, 0, row, 3, 1); -#else - _page_cms->table().attach(*label_avail, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; -#if WITH_GTKMM_3_0 _AvailableProfilesList.set_hexpand(); _AvailableProfilesList.set_valign(Gtk::ALIGN_CENTER); _page_cms->table().attach(_AvailableProfilesList, 0, row, 1, 1); @@ -744,11 +698,6 @@ void DocumentProperties::build_cms() _unlink_btn.set_halign(Gtk::ALIGN_CENTER); _unlink_btn.set_valign(Gtk::ALIGN_CENTER); _page_cms->table().attach(_unlink_btn, 2, row, 1, 1); -#else - _page_cms->table().attach(_AvailableProfilesList, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); - _page_cms->table().attach(_link_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); - _page_cms->table().attach(_unlink_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); -#endif // Set up the Avialable Profiles combo box _AvailableProfilesListStore = Gtk::ListStore::create(_AvailableProfilesListColumns); @@ -815,41 +764,27 @@ void DocumentProperties::build_scripting() gint row = 0; label_external->set_alignment(0.0); - -#if WITH_GTKMM_3_0 label_external->set_hexpand(); label_external->set_valign(Gtk::ALIGN_CENTER); _page_external_scripts->table().attach(*label_external, 0, row, 3, 1); -#else - _page_external_scripts->table().attach(*label_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; -#if WITH_GTKMM_3_0 _ExternalScriptsListScroller.set_hexpand(); _ExternalScriptsListScroller.set_valign(Gtk::ALIGN_CENTER); _page_external_scripts->table().attach(_ExternalScriptsListScroller, 0, row, 3, 1); -#else - _page_external_scripts->table().attach(_ExternalScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; Gtk::HBox* spacer_external = Gtk::manage(new Gtk::HBox()); spacer_external->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); -#if WITH_GTKMM_3_0 spacer_external->set_hexpand(); spacer_external->set_valign(Gtk::ALIGN_CENTER); _page_external_scripts->table().attach(*spacer_external, 0, row, 3, 1); -#else - _page_external_scripts->table().attach(*spacer_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; -#if WITH_GTKMM_3_0 _script_entry.set_hexpand(); _script_entry.set_valign(Gtk::ALIGN_CENTER); _page_external_scripts->table().attach(_script_entry, 0, row, 1, 1); @@ -863,11 +798,6 @@ void DocumentProperties::build_scripting() _external_remove_btn.set_halign(Gtk::ALIGN_CENTER); _external_remove_btn.set_valign(Gtk::ALIGN_CENTER); _page_external_scripts->table().attach(_external_remove_btn, 2, row, 1, 1); -#else - _page_external_scripts->table().attach(_script_entry, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); - _page_external_scripts->table().attach(_external_add_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); - _page_external_scripts->table().attach(_external_remove_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); -#endif //# Set up the External Scripts box _ExternalScriptsListStore = Gtk::ListStore::create(_ExternalScriptsListColumns); @@ -888,12 +818,6 @@ void DocumentProperties::build_scripting() _embed_remove_btn.set_tooltip_text(_("Remove")); docprops_style_button(_embed_remove_btn, INKSCAPE_ICON("list-remove")); -#if !WITH_GTKMM_3_0 - // TODO: This has been removed from Gtkmm 3.0. Check that - // everything still looks OK! - _embed_button_box.set_child_min_width( 16 ); - _embed_button_box.set_spacing( 4 ); -#endif _embed_button_box.set_layout (Gtk::BUTTONBOX_START); _embed_button_box.add(_embed_new_btn); _embed_button_box.add(_embed_remove_btn); @@ -902,47 +826,29 @@ void DocumentProperties::build_scripting() row = 0; label_embedded->set_alignment(0.0); - -#if WITH_GTKMM_3_0 label_embedded->set_hexpand(); label_embedded->set_valign(Gtk::ALIGN_CENTER); _page_embedded_scripts->table().attach(*label_embedded, 0, row, 3, 1); -#else - _page_embedded_scripts->table().attach(*label_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; -#if WITH_GTKMM_3_0 _EmbeddedScriptsListScroller.set_hexpand(); _EmbeddedScriptsListScroller.set_valign(Gtk::ALIGN_CENTER); _page_embedded_scripts->table().attach(_EmbeddedScriptsListScroller, 0, row, 3, 1); -#else - _page_embedded_scripts->table().attach(_EmbeddedScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; -#if WITH_GTKMM_3_0 _embed_button_box.set_hexpand(); _embed_button_box.set_valign(Gtk::ALIGN_CENTER); _page_embedded_scripts->table().attach(_embed_button_box, 0, row, 1, 1); -#else - _page_embedded_scripts->table().attach(_embed_button_box, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; Gtk::HBox* spacer_embedded = Gtk::manage(new Gtk::HBox()); spacer_embedded->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); - -#if WITH_GTKMM_3_0 spacer_embedded->set_hexpand(); spacer_embedded->set_valign(Gtk::ALIGN_CENTER); _page_embedded_scripts->table().attach(*spacer_embedded, 0, row, 3, 1); -#else - _page_embedded_scripts->table().attach(*spacer_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; @@ -958,24 +864,15 @@ void DocumentProperties::build_scripting() label_embedded_content->set_markup (_("Content:")); label_embedded_content->set_alignment(0.0); - -#if WITH_GTKMM_3_0 label_embedded_content->set_hexpand(); label_embedded_content->set_valign(Gtk::ALIGN_CENTER); _page_embedded_scripts->table().attach(*label_embedded_content, 0, row, 3, 1); -#else - _page_embedded_scripts->table().attach(*label_embedded_content, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; -#if WITH_GTKMM_3_0 _EmbeddedContentScroller.set_hexpand(); _EmbeddedContentScroller.set_valign(Gtk::ALIGN_CENTER); _page_embedded_scripts->table().attach(_EmbeddedContentScroller, 0, row, 3, 1); -#else - _page_embedded_scripts->table().attach(_EmbeddedContentScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif _EmbeddedContentScroller.add(_EmbeddedContent); _EmbeddedContentScroller.set_shadow_type(Gtk::SHADOW_IN); @@ -1037,12 +934,8 @@ void DocumentProperties::build_metadata() label->set_markup (_("Dublin Core Entities")); label->set_alignment (0.0); -#if WITH_GTKMM_3_0 label->set_valign(Gtk::ALIGN_CENTER); _page_metadata1->table().attach (*label, 0,0,3,1); -#else - _page_metadata1->table().attach (*label, 0,3,0,1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); -#endif /* add generic metadata entry areas */ struct rdf_work_entity_t * entity; @@ -1053,8 +946,6 @@ void DocumentProperties::build_metadata() _rdflist.push_back (w); Gtk::HBox *space = Gtk::manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); - -#if WITH_GTKMM_3_0 space->set_valign(Gtk::ALIGN_CENTER); _page_metadata1->table().attach(*space, 0, row, 1, 1); @@ -1064,11 +955,6 @@ void DocumentProperties::build_metadata() w->_packable->set_hexpand(); w->_packable->set_valign(Gtk::ALIGN_CENTER); _page_metadata1->table().attach(*w->_packable, 2, row, 1, 1); -#else - _page_metadata1->table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata1->table().attach (w->_label, 1,2, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata1->table().attach (*w->_packable, 2,3, row, row+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); -#endif } } @@ -1077,11 +963,7 @@ void DocumentProperties::build_metadata() Gtk::Button *button_load = Gtk::manage (new Gtk::Button(_("Use _default"),1)); button_load->set_tooltip_text(_("Use the previously saved default metadata here")); -#if WITH_GTKMM_3_0 - Gtk::ButtonBox *box_buttons = Gtk::manage (new Gtk::ButtonBox); -#else - Gtk::HButtonBox *box_buttons = Gtk::manage (new Gtk::HButtonBox); -#endif + auto box_buttons = Gtk::manage (new Gtk::ButtonBox); box_buttons->set_layout(Gtk::BUTTONBOX_END); box_buttons->set_spacing(4); @@ -1099,12 +981,8 @@ void DocumentProperties::build_metadata() llabel->set_markup (_("License")); llabel->set_alignment (0.0); -#if WITH_GTKMM_3_0 llabel->set_valign(Gtk::ALIGN_CENTER); _page_metadata2->table().attach(*llabel, 0, row, 3, 1); -#else - _page_metadata2->table().attach (*llabel, 0,3, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); -#endif /* add license selector pull-down and URI */ ++row; @@ -1112,17 +990,12 @@ void DocumentProperties::build_metadata() Gtk::HBox *space = Gtk::manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); -#if WITH_GTKMM_3_0 space->set_valign(Gtk::ALIGN_CENTER); _page_metadata2->table().attach(*space, 0, row, 1, 1); _licensor.set_hexpand(); _licensor.set_valign(Gtk::ALIGN_CENTER); _page_metadata2->table().attach(_licensor, 1, row, 3, 1); -#else - _page_metadata2->table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata2->table().attach (_licensor, 1,3, row, row+1, Gtk::EXPAND|Gtk::FILL, (Gtk::AttachOptions)0,0,0); -#endif } void DocumentProperties::addExternalScript(){ diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index 7f91d9ea0..8d1c6b38a 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -173,11 +173,7 @@ protected: Gtk::Button _external_remove_btn; Gtk::Button _embed_new_btn; Gtk::Button _embed_remove_btn; -#if WITH_GTKMM_3_0 - Gtk::ButtonBox _embed_button_box; -#else - Gtk::HButtonBox _embed_button_box; -#endif + Gtk::ButtonBox _embed_button_box; class ExternalScriptsColumns : public Gtk::TreeModel::ColumnRecord { diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 2fb5f9e3b..5e7c68985 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -29,11 +29,7 @@ #include #include #include -#if WITH_GTKMM_3_0 -# include -#else -# include -#endif +#include #include #include @@ -218,15 +214,9 @@ Export::Export (void) : selectiontype_buttons[i]->signal_clicked().connect(sigc::mem_fun(*this, &Export::onAreaToggled)); } -#if WITH_GTKMM_3_0 - Gtk::Grid* t = new Gtk::Grid(); + auto t = new Gtk::Grid(); t->set_row_spacing(4); t->set_column_spacing(4); -#else - Gtk::Table* t = new Gtk::Table(3, 4, false); - t->set_row_spacings (4); - t->set_col_spacings (4); -#endif x0_adj = createSpinbutton ( "x0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, t, 0, 0, _("_x0:"), "", EXPORT_COORD_PRECISION, 1, @@ -268,15 +258,9 @@ Export::Export (void) : bm_label->set_use_markup(true); size_box.pack_start(*bm_label, false, false, 0); -#if WITH_GTKMM_3_0 - Gtk::Grid *t = new Gtk::Grid(); + auto t = new Gtk::Grid(); t->set_row_spacing(4); t->set_column_spacing(4); -#else - Gtk::Table *t = new Gtk::Table(2, 5, false); - t->set_row_spacings (4); - t->set_col_spacings (4); -#endif size_box.pack_start(*t); @@ -484,27 +468,14 @@ void Export::set_default_filename () { } } -#if WITH_GTKMM_3_0 Glib::RefPtr Export::createSpinbutton( gchar const * /*key*/, float val, float min, float max, float step, float page, Gtk::Grid *t, int x, int y, const Glib::ustring& ll, const Glib::ustring& lr, int digits, unsigned int sensitive, void (Export::*cb)() ) -#else -Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, float min, float max, - float step, float page, - Gtk::Table *t, int x, int y, - const Glib::ustring& ll, const Glib::ustring& lr, - int digits, unsigned int sensitive, - void (Export::*cb)() ) -#endif { -#if WITH_GTKMM_3_0 - Glib::RefPtr adj = Gtk::Adjustment::create(val, min, max, step, page, 0); -#else - Gtk::Adjustment *adj = new Gtk::Adjustment ( val, min, max, step, page, 0 ); -#endif + auto adj = Gtk::Adjustment::create(val, min, max, step, page, 0); int pos = 0; Gtk::Label *l = NULL; @@ -512,28 +483,17 @@ Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, fl if (!ll.empty()) { l = new Gtk::Label(ll,true); l->set_alignment (1.0, 0.5); - -#if WITH_GTKMM_3_0 l->set_hexpand(); l->set_vexpand(); t->attach(*l, x + pos, y, 1, 1); -#else - t->attach (*l, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 ); -#endif - l->set_sensitive(sensitive); pos++; } -#if WITH_GTKMM_3_0 - Gtk::SpinButton *sb = new Gtk::SpinButton(adj, 1.0, digits); + auto sb = new Gtk::SpinButton(adj, 1.0, digits); sb->set_hexpand(); sb->set_vexpand(); t->attach(*sb, x + pos, y, 1, 1); -#else - Gtk::SpinButton *sb = new Gtk::SpinButton(*adj, 1.0, digits); - t->attach (*sb, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 ); -#endif sb->set_width_chars(7); sb->set_sensitive (sensitive); @@ -546,15 +506,9 @@ Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, fl if (!lr.empty()) { l = new Gtk::Label(lr,true); l->set_alignment (0.0, 0.5); - -#if WITH_GTKMM_3_0 l->set_hexpand(); l->set_vexpand(); t->attach(*l, x + pos, y, 1, 1); -#else - t->attach (*l, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 ); -#endif - l->set_sensitive (sensitive); pos++; l->set_mnemonic_widget (*sb); @@ -932,11 +886,7 @@ Gtk::Dialog * Export::create_progress_dialog (Glib::ustring progress_text) { Gtk::ProgressBar *prg = new Gtk::ProgressBar (); prg->set_text(progress_text); dlg->set_data ("progress", prg); -#if GTK_CHECK_VERSION(3,0,0) - Gtk::Box* CA = dlg->get_content_area(); -#else - Gtk::Box* CA = dlg->get_vbox(); -#endif + auto CA = dlg->get_content_area(); CA->pack_start(*prg, FALSE, FALSE, 4); Gtk::Button* btn = dlg->add_button (Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL ); @@ -1357,11 +1307,7 @@ void Export::onBrowse () Glib::RefPtr parentWindow = desktop->getToplevel()->get_window(); g_assert(parentWindow->gobj() != NULL); -#if WITH_GTKMM_3_0 opf.hwndOwner = (HWND)gdk_win32_window_get_handle((GdkWindow*)parentWindow->gobj()); -#else - opf.hwndOwner = (HWND)gdk_win32_drawable_get_handle((GdkDrawable*)parentWindow->gobj()); -#endif opf.lpstrFilter = filter_string; opf.lpstrCustomFilter = 0; opf.nMaxCustFilter = 0L; @@ -1521,11 +1467,7 @@ void Export::detectSize() { } /* sp_export_detect_size */ /// Called when area x0 value is changed -#if WITH_GTKMM_3_0 void Export::areaXChange(Glib::RefPtr& adj) -#else -void Export::areaXChange (Gtk::Adjustment *adj) -#endif { float x0, x1, xdpi, width; @@ -1564,11 +1506,7 @@ void Export::areaXChange (Gtk::Adjustment *adj) } // end of sp_export_area_x_value_changed() /// Called when area y0 value is changed. -#if WITH_GTKMM_3_0 void Export::areaYChange(Glib::RefPtr& adj) -#else -void Export::areaYChange (Gtk::Adjustment *adj) -#endif { float y0, y1, ydpi, height; @@ -1875,11 +1813,7 @@ void Export::setArea( double x0, double y0, double x1, double y1 ) * @param adj The adjustment widget * @param val What value to set it to. */ -#if WITH_GTKMM_3_0 void Export::setValue(Glib::RefPtr& adj, double val ) -#else -void Export::setValue( Gtk::Adjustment *adj, double val ) -#endif { if (adj) { adj->set_value(val); @@ -1897,11 +1831,7 @@ void Export::setValue( Gtk::Adjustment *adj, double val ) * @param adj The adjustment widget * @param val What the value should be in points. */ -#if WITH_GTKMM_3_0 void Export::setValuePx(Glib::RefPtr& adj, double val) -#else -void Export::setValuePx( Gtk::Adjustment *adj, double val) -#endif { Unit const *unit = unit_selector.getUnit(); @@ -1920,11 +1850,7 @@ void Export::setValuePx( Gtk::Adjustment *adj, double val) * * @return The value in the specified adjustment. */ -#if WITH_GTKMM_3_0 float Export::getValue(Glib::RefPtr& adj) -#else -float Export::getValue( Gtk::Adjustment *adj ) -#endif { if (!adj) { g_message("sp_export_value_get : adj is NULL"); @@ -1946,11 +1872,7 @@ float Export::getValue( Gtk::Adjustment *adj ) * * @return The value in the adjustment in points. */ -#if WITH_GTKMM_3_0 float Export::getValuePx(Glib::RefPtr& adj) -#else -float Export::getValuePx( Gtk::Adjustment *adj ) -#endif { float value = getValue( adj); Unit const *unit = unit_selector.getUnit(); diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h index 23af0109b..a1c44714b 100644 --- a/src/ui/dialog/export.h +++ b/src/ui/dialog/export.h @@ -79,17 +79,10 @@ private: /* * Getter/setter style functions for the spinbuttons */ -#if WITH_GTKMM_3_0 void setValue(Glib::RefPtr& adj, double val); void setValuePx(Glib::RefPtr& adj, double val); float getValue(Glib::RefPtr& adj); float getValuePx(Glib::RefPtr& adj); -#else - void setValue (Gtk::Adjustment *adj, double val); - void setValuePx (Gtk::Adjustment *adj, double val); - float getValue (Gtk::Adjustment *adj); - float getValuePx (Gtk::Adjustment *adj); -#endif /** * Helper function to create, style and pack spinbuttons for the export dialog. @@ -112,21 +105,12 @@ private: * * No unit_selector is stored in the created spinbutton, relies on external unit management */ -#if WITH_GTKMM_3_0 Glib::RefPtr createSpinbutton( gchar const *key, float val, float min, float max, float step, float page, Gtk::Grid *t, int x, int y, const Glib::ustring& ll, const Glib::ustring& lr, int digits, unsigned int sensitive, void (Export::*cb)() ); -#else - Gtk::Adjustment * createSpinbutton( gchar const *key, float val, float min, float max, - float step, float page, - Gtk::Table *t, int x, int y, - const Glib::ustring& ll, const Glib::ustring& lr, - int digits, unsigned int sensitive, - void (Export::*cb)() ); -#endif /** * One of the area select radio buttons was pressed @@ -152,11 +136,7 @@ private: void onAreaX1Change() { areaXChange(x1_adj); } ; -#if WITH_GTKMM_3_0 void areaXChange(Glib::RefPtr& adj); -#else - void areaXChange ( Gtk::Adjustment *adj); -#endif /** * Area Y value changed callback @@ -167,11 +147,7 @@ private: void onAreaY1Change() { areaYChange(y1_adj); } ; -#if WITH_GTKMM_3_0 void areaYChange(Glib::RefPtr& adj); -#else - void areaYChange ( Gtk::Adjustment *adj); -#endif /** * Unit changed callback @@ -298,7 +274,6 @@ private: Gtk::VBox area_box; Gtk::VBox singleexport_box; -#if WITH_GTKMM_3_0 /* Custom size widgets */ Glib::RefPtr x0_adj; Glib::RefPtr x1_adj; @@ -312,21 +287,6 @@ private: Glib::RefPtr bmheight_adj; Glib::RefPtr xdpi_adj; Glib::RefPtr ydpi_adj; -#else - /* Custom size widgets */ - Gtk::Adjustment *x0_adj; - Gtk::Adjustment *x1_adj; - Gtk::Adjustment *y0_adj; - Gtk::Adjustment *y1_adj; - Gtk::Adjustment *width_adj; - Gtk::Adjustment *height_adj; - - /* Bitmap size widgets */ - Gtk::Adjustment *bmwidth_adj; - Gtk::Adjustment *bmheight_adj; - Gtk::Adjustment *xdpi_adj; - Gtk::Adjustment *ydpi_adj; -#endif Gtk::VBox size_box; Gtk::Label* bm_label; diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 042637d22..e8c1bf723 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -754,16 +754,9 @@ FileOpenDialogImplGtk::~FileOpenDialogImplGtk() void FileOpenDialogImplGtk::addFilterMenu(Glib::ustring name, Glib::ustring pattern) { - -#if WITH_GTKMM_3_0 - Glib::RefPtr allFilter = Gtk::FileFilter::create(); + auto allFilter = Gtk::FileFilter::create(); allFilter->set_name(_(name.c_str())); allFilter->add_pattern(pattern); -#else - Gtk::FileFilter allFilter; - allFilter.set_name(_(name.c_str())); - allFilter.add_pattern(pattern); -#endif extensionMap[Glib::ustring(_("All Files"))] = NULL; add_filter(allFilter); } @@ -775,51 +768,27 @@ void FileOpenDialogImplGtk::createFilterMenu() } if (_dialogType == EXE_TYPES) { -#if WITH_GTKMM_3_0 - Glib::RefPtr allFilter = Gtk::FileFilter::create(); + auto allFilter = Gtk::FileFilter::create(); allFilter->set_name(_("All Files")); allFilter->add_pattern("*"); -#else - Gtk::FileFilter allFilter; - allFilter.set_name(_("All Files")); - allFilter.add_pattern("*"); -#endif extensionMap[Glib::ustring(_("All Files"))] = NULL; add_filter(allFilter); } else { -#if WITH_GTKMM_3_0 - Glib::RefPtr allInkscapeFilter = Gtk::FileFilter::create(); + auto allInkscapeFilter = Gtk::FileFilter::create(); allInkscapeFilter->set_name(_("All Inkscape Files")); - Glib::RefPtr allFilter = Gtk::FileFilter::create(); + auto allFilter = Gtk::FileFilter::create(); allFilter->set_name(_("All Files")); allFilter->add_pattern("*"); - Glib::RefPtr allImageFilter = Gtk::FileFilter::create(); + auto allImageFilter = Gtk::FileFilter::create(); allImageFilter->set_name(_("All Images")); - Glib::RefPtr allVectorFilter = Gtk::FileFilter::create(); + auto allVectorFilter = Gtk::FileFilter::create(); allVectorFilter->set_name(_("All Vectors")); - Glib::RefPtr allBitmapFilter = Gtk::FileFilter::create(); + auto allBitmapFilter = Gtk::FileFilter::create(); allBitmapFilter->set_name(_("All Bitmaps")); -#else - Gtk::FileFilter allInkscapeFilter; - allInkscapeFilter.set_name(_("All Inkscape Files")); - - Gtk::FileFilter allFilter; - allFilter.set_name(_("All Files")); - allFilter.add_pattern("*"); - - Gtk::FileFilter allImageFilter; - allImageFilter.set_name(_("All Images")); - - Gtk::FileFilter allVectorFilter; - allVectorFilter.set_name(_("All Vectors")); - - Gtk::FileFilter allBitmapFilter; - allBitmapFilter.set_name(_("All Bitmaps")); -#endif extensionMap[Glib::ustring(_("All Inkscape Files"))] = NULL; add_filter(allInkscapeFilter); @@ -854,29 +823,16 @@ void FileOpenDialogImplGtk::createFilterMenu() Glib::ustring uname(_(imod->get_filetypename())); -#if WITH_GTKMM_3_0 - Glib::RefPtr filter = Gtk::FileFilter::create(); + auto filter = Gtk::FileFilter::create(); filter->set_name(uname); filter->add_pattern(upattern); -#else - Gtk::FileFilter filter; - filter.set_name(uname); - filter.add_pattern(upattern); -#endif - add_filter(filter); extensionMap[uname] = imod; // g_message("ext %s:%s '%s'\n", ioext->name, ioext->mimetype, upattern.c_str()); -#if WITH_GTKMM_3_0 allInkscapeFilter->add_pattern(upattern); if (strncmp("image", imod->get_mimetype(), 5) == 0) allImageFilter->add_pattern(upattern); -#else - allInkscapeFilter.add_pattern(upattern); - if (strncmp("image", imod->get_mimetype(), 5) == 0) - allImageFilter.add_pattern(upattern); -#endif // uncomment this to find out all mime types supported by Inkscape import/open // g_print ("%s\n", imod->get_mimetype()); @@ -896,17 +852,9 @@ void FileOpenDialogImplGtk::createFilterMenu() strncmp("image/x-tga", imod->get_mimetype(), 11) == 0 || strncmp("image/x-pcx", imod->get_mimetype(), 11) == 0) { -#if WITH_GTKMM_3_0 allBitmapFilter->add_pattern(upattern); -#else - allBitmapFilter.add_pattern(upattern); -#endif } else { -#if WITH_GTKMM_3_0 allVectorFilter->add_pattern(upattern); -#else - allVectorFilter.add_pattern(upattern); -#endif } } } @@ -972,18 +920,13 @@ Glib::ustring FileOpenDialogImplGtk::getFilename(void) */ std::vector FileOpenDialogImplGtk::getFilenames() { -#if WITH_GTKMM_3_0 - std::vector result_tmp = get_filenames(); + auto result_tmp = get_filenames(); // Copy filenames to a vector of type Glib::ustring std::vector result; - for (std::vector::iterator it = result_tmp.begin(); it != result_tmp.end(); ++it) - result.push_back(*it); - -#else - std::vector result = get_filenames(); -#endif + for (auto it : result_tmp) + result.push_back(it); #ifdef WITH_GNOME_VFS if (result.empty() && gnome_vfs_initialized()) @@ -1170,13 +1113,8 @@ void FileSaveDialogImplGtk::fileTypeChangedCallback() // g_message("selected: %s\n", type.name.c_str()); extension = type.extension; -#if WITH_GTKMM_3_0 - Glib::RefPtr filter = Gtk::FileFilter::create(); + auto filter = Gtk::FileFilter::create(); filter->add_pattern(type.pattern); -#else - Gtk::FileFilter filter; - filter.add_pattern(type.pattern); -#endif set_filter(filter); updateNameAndExtension(); diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index cafc3be4f..02d77cba1 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -128,11 +128,7 @@ FileDialogBaseWin32::FileDialogBaseWin32(Gtk::Window &parent, Glib::RefPtr parentWindow = parent.get_window(); g_assert(parentWindow->gobj() != NULL); -#if WITH_GTKMM_3_0 _ownerHwnd = (HWND)gdk_win32_window_get_handle((GdkWindow*)parentWindow->gobj()); -#else - _ownerHwnd = (HWND)gdk_win32_drawable_get_handle((GdkDrawable*)parentWindow->gobj()); -#endif } FileDialogBaseWin32::~FileDialogBaseWin32() diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index 8141f7696..923993514 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -111,11 +111,7 @@ void FillAndStroke::setTargetDesktop(SPDesktop *desktop) } } -#if WITH_GTKMM_3_0 void FillAndStroke::_onSwitchPage(Gtk::Widget * /*page*/, guint pagenum) -#else -void FillAndStroke::_onSwitchPage(GtkNotebookPage * /*page*/, guint pagenum) -#endif { _savePagePref(pagenum); } @@ -132,24 +128,14 @@ void FillAndStroke::_layoutPageFill() { fillWdgt = Gtk::manage(sp_fill_style_widget_new()); - -#if WITH_GTKMM_3_0 _page_fill->table().attach(*fillWdgt, 0, 0, 1, 1); -#else - _page_fill->table().attach(*fillWdgt, 0, 1, 0, 1); -#endif } void FillAndStroke::_layoutPageStrokePaint() { strokeWdgt = Gtk::manage(sp_stroke_style_paint_widget_new()); - -#if WITH_GTKMM_3_0 _page_stroke_paint->table().attach(*strokeWdgt, 0, 0, 1, 1); -#else - _page_stroke_paint->table().attach(*strokeWdgt, 0, 1, 0, 1); -#endif } void @@ -158,12 +144,7 @@ FillAndStroke::_layoutPageStrokeStyle() //Gtk::Widget *strokeStyleWdgt = manage(Glib::wrap(sp_stroke_style_line_widget_new())); //Gtk::Widget *strokeStyleWdgt = static_cast(sp_stroke_style_line_widget_new()); strokeStyleWdgt = sp_stroke_style_line_widget_new(); - -#if WITH_GTKMM_3_0 _page_stroke_style->table().attach(*strokeStyleWdgt, 0, 0, 1, 1); -#else - _page_stroke_style->table().attach(*strokeStyleWdgt, 0, 1, 0, 1); -#endif } void diff --git a/src/ui/dialog/fill-and-stroke.h b/src/ui/dialog/fill-and-stroke.h index f2a6bf39d..67e9d60ed 100644 --- a/src/ui/dialog/fill-and-stroke.h +++ b/src/ui/dialog/fill-and-stroke.h @@ -64,11 +64,7 @@ protected: void _layoutPageStrokePaint(); void _layoutPageStrokeStyle(); void _savePagePref(guint page_num); -#if WITH_GTKMM_3_0 void _onSwitchPage(Gtk::Widget *page, guint pagenum); -#else - void _onSwitchPage(GtkNotebookPage *page, guint pagenum); -#endif private: FillAndStroke(FillAndStroke const &d); diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index d3ad5d1da..acf230b7f 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -22,9 +22,7 @@ #include "dialog-manager.h" #include -#if GTK_CHECK_VERSION(3,0,0) -# include -#endif +#include #include "ui/widget/spinbutton.h" @@ -319,15 +317,9 @@ public: set_tooltip_text(tip_text); } -#if WITH_GTKMM_3_0 Gdk::RGBA col; col.set_rgba_u(65535, 65535, 65535); set_rgba(col); -#else - Gdk::Color col; - col.set_rgb(65535, 65535, 65535); - set_color(col); -#endif } // Returns the color in 'rgb(r,g,b)' form. @@ -336,13 +328,8 @@ public: // no doubles here, so we can use the standard string stream. std::ostringstream os; -#if WITH_GTKMM_3_0 - const Gdk::RGBA c = get_rgba(); - const int r = c.get_red_u() / 257, g = c.get_green_u() / 257, b = c.get_blue_u() / 257;//TO-DO: verify this. This sounds a lot strange! shouldn't it be 256? -#else - const Gdk::Color c = get_color(); - const int r = c.get_red() / 257, g = c.get_green() / 257, b = c.get_blue() / 257;//TO-DO: verify this. This sounds a lot strange! shouldn't it be 256? -#endif + const auto c = get_rgba(); + const int r = c.get_red_u() / 257, g = c.get_green_u() / 257, b = c.get_blue_u() / 257;//TO-DO: verify this. This sounds a lot strange! shouldn't it be 256? os << "rgb(" << r << "," << g << "," << b << ")"; return os.str(); } @@ -359,15 +346,9 @@ public: } const int r = SP_RGBA32_R_U(i), g = SP_RGBA32_G_U(i), b = SP_RGBA32_B_U(i); -#if WITH_GTKMM_3_0 Gdk::RGBA col; col.set_rgba_u(r * 256, g * 256, b * 256); set_rgba(col); -#else - Gdk::Color col; - col.set_rgb(r * 256, g * 256, b * 256); - set_color(col); -#endif } }; @@ -1730,7 +1711,6 @@ Glib::PropertyProxy FilterEffectsDialog::CellRendererConnection::property return _primitive.get_proxy(); } -#if WITH_GTKMM_3_0 void FilterEffectsDialog::CellRendererConnection::get_preferred_width_vfunc(Gtk::Widget& widget, int& minimum_width, int& natural_width) const @@ -1764,27 +1744,6 @@ void FilterEffectsDialog::CellRendererConnection::get_preferred_height_for_width { get_preferred_height(widget, minimum_height, natural_height); } -#else -void FilterEffectsDialog::CellRendererConnection::get_size_vfunc( - Gtk::Widget& widget, const Gdk::Rectangle* /*cell_area*/, - int* x_offset, int* y_offset, int* width, int* height) const -{ - PrimitiveList& primlist = dynamic_cast(widget); - - if(x_offset) - (*x_offset) = 0; - if(y_offset) - (*y_offset) = 0; - if(width) - (*width) = size * primlist.primitive_count() + (primlist.get_input_type_width()) * 6; - if(height) { - // Scale the height depending on the number of inputs, unless it's - // the first primitive, in which case there are no connections - SPFilterPrimitive* prim = SP_FILTER_PRIMITIVE(_primitive.get_value()); - (*height) = size * input_count(prim); - } -} -#endif /*** PrimitiveList ***/ FilterEffectsDialog::PrimitiveList::PrimitiveList(FilterEffectsDialog& d) @@ -1792,13 +1751,8 @@ FilterEffectsDialog::PrimitiveList::PrimitiveList(FilterEffectsDialog& d) _in_drag(0), _observer(new Inkscape::XML::SignalObserver) { -#if WITH_GTKMM_3_0 d.signal_draw().connect(sigc::mem_fun(*this, &PrimitiveList::on_draw_signal)); signal_draw().connect(sigc::mem_fun(*this, &PrimitiveList::on_draw_signal)); -#else - d.signal_expose_event().connect(sigc::mem_fun(*this, &PrimitiveList::on_expose_signal)); - signal_expose_event().connect(sigc::mem_fun(*this, &PrimitiveList::on_expose_signal)); -#endif add_events(Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); @@ -1961,25 +1915,9 @@ void FilterEffectsDialog::PrimitiveList::remove_selected() } } -#if !WITH_GTKMM_3_0 -bool FilterEffectsDialog::PrimitiveList::on_expose_signal(GdkEventExpose * /*evt*/) -{ - bool result = false; - - if (get_is_drawable()) - { - Cairo::RefPtr cr = get_bin_window()->create_cairo_context(); - result = on_draw_signal(cr); - } - - return result; -} -#endif - bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtr & cr) { cr->set_line_width(1.0); -#if GTK_CHECK_VERSION(3,0,0) // In GTK+ 3, the draw function receives the widget window, not the // bin_window (i.e., just the area under the column headers). We // therefore translate the origin of our coordinate system to account for this @@ -1987,7 +1925,7 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtrtranslate(x_origin, y_origin); - GtkStyleContext *sc = gtk_widget_get_style_context(GTK_WIDGET(gobj())); + auto sc = gtk_widget_get_style_context(GTK_WIDGET(gobj())); GdkRGBA bg_color, fg_color; gtk_style_context_get_background_color(sc, GTK_STATE_FLAG_NORMAL, &bg_color); gtk_style_context_get_color(sc, GTK_STATE_FLAG_NORMAL, &fg_color); @@ -2005,9 +1943,6 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtrchildren().size(); @@ -2026,25 +1961,15 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtrsave(); cr->rectangle(x, 0, get_input_type_width(), vis.get_height()); -#if GTK_CHECK_VERSION(3,0,0) gdk_cairo_set_source_rgba(cr->cobj(), &bg_color); cr->fill_preserve(); gdk_cairo_set_source_rgba(cr->cobj(), &fg_color); -#else - gdk_cairo_set_source_color(cr->cobj(), &(style->bg[GTK_STATE_NORMAL])); - cr->fill_preserve(); - gdk_cairo_set_source_color(cr->cobj(), &(style->text[GTK_STATE_NORMAL])); -#endif cr->move_to(x+get_input_type_width(), 0); cr->rotate_degrees(90); _vertical_layout->show_in_cairo_context(cr); -#if GTK_CHECK_VERSION(3,0,0) gdk_cairo_set_source_rgba(cr->cobj(), &mid_color); -#else - gdk_cairo_set_source_color(cr->cobj(), &(style->dark[GTK_STATE_NORMAL])); -#endif cr->move_to(x, 0); cr->line_to(x, vis.get_height()); cr->stroke(); @@ -2061,24 +1986,16 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtr display = get_bin_window()->get_display(); - Glib::RefPtr dm = display->get_device_manager(); - Glib::RefPtr device = dm->get_client_pointer(); + auto display = get_bin_window()->get_display(); + auto dm = display->get_device_manager(); + auto device = dm->get_client_pointer(); get_bin_window()->get_device_position(device, mx, my, mask); -#else - get_bin_window()->get_pointer(mx, my, mask); -#endif // Outline the bottom of the connection area const int outline_x = x + fheight * (row_count - row_index); cr->save(); -#if GTK_CHECK_VERSION(3,0,0) gdk_cairo_set_source_rgba(cr->cobj(), &mid_color); -#else - gdk_cairo_set_source_color(cr->cobj(), &(style->dark[GTK_STATE_NORMAL])); -#endif cr->move_to(x, y + h); cr->line_to(outline_x, y + h); @@ -2101,17 +2018,10 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtrsave(); -#if GTK_CHECK_VERSION(3,0,0) gdk_cairo_set_source_rgba(cr->cobj(), inside && mask & GDK_BUTTON1_MASK ? &mid_color : &mid_color_active); -#else - gdk_cairo_set_source_color(cr->cobj(), - inside && mask & GDK_BUTTON1_MASK ? - &(style->dark[GTK_STATE_NORMAL]) : - &(style->dark[GTK_STATE_ACTIVE])); -#endif draw_connection_node(cr, con_poly, inside); @@ -2137,17 +2047,10 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtrsave(); -#if GTK_CHECK_VERSION(3,0,0) gdk_cairo_set_source_rgba(cr->cobj(), inside && mask & GDK_BUTTON1_MASK ? &mid_color : &mid_color_active); -#else - gdk_cairo_set_source_color(cr->cobj(), - inside && mask & GDK_BUTTON1_MASK ? - &(style->dark[GTK_STATE_NORMAL]) : - &(style->dark[GTK_STATE_ACTIVE])); -#endif draw_connection_node(cr, con_poly, inside); @@ -2170,17 +2073,10 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtrsave(); -#if GTK_CHECK_VERSION(3,0,0) gdk_cairo_set_source_rgba(cr->cobj(), inside && mask & GDK_BUTTON1_MASK ? &mid_color : &mid_color_active); -#else - gdk_cairo_set_source_color(cr->cobj(), - inside && mask & GDK_BUTTON1_MASK ? - &(style->dark[GTK_STATE_NORMAL]) : - &(style->dark[GTK_STATE_ACTIVE])); -#endif draw_connection_node(cr, con_poly, inside); @@ -2216,8 +2112,7 @@ void FilterEffectsDialog::PrimitiveList::draw_connection(const Cairo::RefPtrsave(); -#if GTK_CHECK_VERSION(3,0,0) - GtkStyleContext *sc = gtk_widget_get_style_context(GTK_WIDGET(gobj())); + auto sc = gtk_widget_get_style_context(GTK_WIDGET(gobj())); GdkRGBA bg_color, fg_color; gtk_style_context_get_background_color(sc, GTK_STATE_FLAG_NORMAL, &bg_color); @@ -2227,9 +2122,6 @@ void FilterEffectsDialog::PrimitiveList::draw_connection(const Cairo::RefPtrcobj(), &mid_color); -#else - gdk_cairo_set_source_color(cr->cobj(), &(style->dark[GTK_STATE_NORMAL])); -#endif else cr->set_source_rgb(0.0, 0.0, 0.0); @@ -2669,8 +2557,7 @@ void FilterEffectsDialog::PrimitiveList::on_drag_end(const Glib::RefPtr a = dynamic_cast(get_parent())->get_vadjustment(); + auto a = dynamic_cast(get_parent())->get_vadjustment(); double v = a->get_value() + _autoscroll_y; if(v < 0) @@ -2679,25 +2566,13 @@ bool FilterEffectsDialog::PrimitiveList::on_scroll_timeout() v = a->get_upper() - a->get_page_size(); a->set_value(v); -#else - Gtk::Adjustment& a = *dynamic_cast(get_parent())->get_vadjustment(); - double v = a.get_value() + _autoscroll_y; - - if(v < 0) - v = 0; - if(v > a.get_upper() - a.get_page_size()) - v = a.get_upper() - a.get_page_size(); - - a.set_value(v); -#endif queue_draw(); } if(_autoscroll_x) { -#if WITH_GTKMM_3_0 - Glib::RefPtr a_h = dynamic_cast(get_parent())->get_hadjustment(); + auto a_h = dynamic_cast(get_parent())->get_hadjustment(); double h = a_h->get_value() + _autoscroll_x; if(h < 0) @@ -2706,18 +2581,6 @@ bool FilterEffectsDialog::PrimitiveList::on_scroll_timeout() h = a_h->get_upper() - a_h->get_page_size(); a_h->set_value(h); -#else - Gtk::Adjustment& a_h = *dynamic_cast(get_parent())->get_hadjustment(); - double h = a_h.get_value() + _autoscroll_x; - - if(h < 0) - h = 0; - if(h > a_h.get_upper() - a_h.get_page_size()) - h = a_h.get_upper() - a_h.get_page_size(); - - a_h.set_value(h); - -#endif queue_draw(); } @@ -2759,13 +2622,8 @@ FilterEffectsDialog::FilterEffectsDialog() _sizegroup->set_ignore_hidden(); // Initialize widget hierarchy -#if WITH_GTKMM_3_0 - Gtk::Paned* hpaned = Gtk::manage(new Gtk::Paned); + auto hpaned = Gtk::manage(new Gtk::Paned); _primitive_box = Gtk::manage(new Gtk::Paned); -#else - Gtk::HPaned* hpaned = Gtk::manage(new Gtk::HPaned); - _primitive_box = Gtk::manage(new Gtk::VPaned); -#endif _sw_infobox = Gtk::manage(new Gtk::ScrolledWindow); Gtk::ScrolledWindow* sw_prims = Gtk::manage(new Gtk::ScrolledWindow); diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index 7c715327e..eae0fc317 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -163,7 +163,6 @@ private: static const int size = 24; protected: -#if WITH_GTKMM_3_0 virtual void get_preferred_width_vfunc(Gtk::Widget& widget, int& minimum_width, int& natural_width) const; @@ -181,10 +180,6 @@ private: int width, int& minimum_height, int& natural_height) const; -#else - virtual void get_size_vfunc(Gtk::Widget& widget, const Gdk::Rectangle* cell_area, - int* x_offset, int* y_offset, int* width, int* height) const; -#endif private: // void* should be SPFilterPrimitive*, some weirdness with properties prevents this Glib::Property _primitive; @@ -211,9 +206,6 @@ private: protected: bool on_draw_signal(const Cairo::RefPtr &cr); -#if !WITH_GTKMM_3_0 - bool on_expose_signal(GdkEventExpose*); -#endif bool on_button_press_event(GdkEventButton*); bool on_motion_notify_event(GdkEventMotion*); @@ -283,11 +275,7 @@ private: Gtk::ScrolledWindow* _sw_infobox; // View/add primitives -#if WITH_GTKMM_3_0 Gtk::Paned* _primitive_box; -#else - Gtk::VPaned* _primitive_box; -#endif UI::Widget::ComboBoxEnum _add_primitive_type; Gtk::Button _add_primitive; diff --git a/src/ui/dialog/find.h b/src/ui/dialog/find.h index 4bcb900b6..94d635037 100644 --- a/src/ui/dialog/find.h +++ b/src/ui/dialog/find.h @@ -286,13 +286,7 @@ private: Gtk::Label status; UI::Widget::Button button_find; UI::Widget::Button button_replace; - -#if WITH_GTKMM_3_0 Gtk::ButtonBox box_buttons; -#else - Gtk::HButtonBox box_buttons; -#endif - Gtk::HBox hboxbutton_row; /** diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp index 55ef0c5bb..20209e2c9 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -140,11 +140,7 @@ FloatingBehavior::create(Dialog &dialog) inline FloatingBehavior::operator Gtk::Widget &() { return *_d; } inline GtkWidget *FloatingBehavior::gobj() { return GTK_WIDGET(_d->gobj()); } inline Gtk::Box* FloatingBehavior::get_vbox() { -#if WITH_GTKMM_3_0 return _d->get_content_area(); -#else - return _d->get_vbox(); -#endif } inline void FloatingBehavior::present() { _d->present(); } inline void FloatingBehavior::hide() { _d->hide(); } @@ -155,12 +151,8 @@ inline void FloatingBehavior::move(int x, int y) { _d-> inline void FloatingBehavior::set_position(Gtk::WindowPosition position) { _d->set_position(position); } inline void FloatingBehavior::set_size_request(int width, int height) { _d->set_size_request(width, height); } inline void FloatingBehavior::size_request(Gtk::Requisition &requisition) { -#if WITH_GTKMM_3_0 Gtk::Requisition requisition_natural; _d->get_preferred_size(requisition, requisition_natural); -#else - requisition = _d->size_request(); -#endif } inline void FloatingBehavior::get_position(int &x, int &y) { _d->get_position(x, y); } inline void FloatingBehavior::get_size(int &width, int &height) { _d->get_size(width, height); } diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 56b001291..1453797de 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -19,13 +19,7 @@ #include #include #include - -#if WITH_GTKMM_3_0 -# include -#else -# include -#endif - +#include #include #include @@ -342,12 +336,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : instanceConns(), desktopConns() { -#if WITH_GTKMM_3_0 - Gtk::Grid *table = new Gtk::Grid(); -#else - Gtk::Table *table = new Gtk::Table(3, 1, false); -#endif - + auto table = new Gtk::Grid(); _getContents()->pack_start(*Gtk::manage(table), Gtk::PACK_EXPAND_WIDGET); guint row = 0; @@ -360,29 +349,16 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : gtk_widget_set_size_request (fontsel, 0, 150); g_signal_connect( G_OBJECT(fontsel), "font_set", G_CALLBACK(fontChangeCB), this ); -#if WITH_GTKMM_3_0 table->attach(*Gtk::manage(Glib::wrap(fontsel)), 0, row, 3, 1); -#else - table->attach(*Gtk::manage(Glib::wrap(fontsel)), - 0, 3, row, row + 1, - Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL); -#endif - row++; // ------------------------------- { - Gtk::Label *label = new Gtk::Label(_("Script: ")); + auto label = new Gtk::Label(_("Script: ")); -#if WITH_GTKMM_3_0 table->attach( *Gtk::manage(label), 0, row, 1, 1); -#else - table->attach( *Gtk::manage(label), - 0, 1, row, row + 1, - Gtk::SHRINK, Gtk::SHRINK); -#endif scriptCombo = new Gtk::ComboBoxText(); for (std::map::iterator it = getScriptToName().begin(); it != getScriptToName().end(); ++it) @@ -396,14 +372,8 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : Gtk::Alignment *align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0)); align->add(*Gtk::manage(scriptCombo)); -#if WITH_GTKMM_3_0 align->set_hexpand(); table->attach( *align, 1, row, 1, 1); -#else - table->attach( *align, - 1, 2, row, row + 1, - Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); -#endif } row++; @@ -411,15 +381,8 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : // ------------------------------- { - Gtk::Label *label = new Gtk::Label(_("Range: ")); - -#if WITH_GTKMM_3_0 + auto label = new Gtk::Label(_("Range: ")); table->attach( *Gtk::manage(label), 0, row, 1, 1); -#else - table->attach( *Gtk::manage(label), - 0, 1, row, row + 1, - Gtk::SHRINK, Gtk::SHRINK); -#endif rangeCombo = new Gtk::ComboBoxText(); for ( std::vector::iterator it = getRanges().begin(); it != getRanges().end(); ++it ) { @@ -431,15 +394,8 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : instanceConns.push_back(conn); Gtk::Alignment *align = new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0); align->add(*Gtk::manage(rangeCombo)); - -#if WITH_GTKMM_3_0 align->set_hexpand(); table->attach( *Gtk::manage(align), 1, row, 1, 1); -#else - table->attach( *Gtk::manage(align), - 1, 2, row, row + 1, - Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); -#endif } row++; @@ -462,16 +418,9 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow(); scroller->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS); scroller->add(*Gtk::manage(iconView)); - -#if WITH_GTKMM_3_0 scroller->set_hexpand(); scroller->set_vexpand(); table->attach(*Gtk::manage(scroller), 0, row, 3, 1); -#else - table->attach(*Gtk::manage(scroller), - 0, 3, row, row + 1, - Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL); -#endif row++; @@ -501,15 +450,8 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : insertBtn->set_sensitive(false); box->pack_end(*Gtk::manage(insertBtn), Gtk::PACK_SHRINK); - -#if WITH_GTKMM_3_0 box->set_hexpand(); table->attach( *Gtk::manage(box), 0, row, 3, 1); -#else - table->attach( *Gtk::manage(box), - 0, 3, row, row + 1, - Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); -#endif row++; @@ -591,12 +533,7 @@ void GlyphsPanel::insertText() if (entry->get_text_length() > 0) { glyphs = entry->get_text(); } else { - -#if WITH_GTKMM_3_0 - std::vector itemArray = iconView->get_selected_items(); -#else - Gtk::IconView::ArrayHandle_TreePaths itemArray = iconView->get_selected_items(); -#endif + auto itemArray = iconView->get_selected_items(); if (!itemArray.empty()) { Gtk::TreeModel::Path const & path = *itemArray.begin(); @@ -641,11 +578,7 @@ void GlyphsPanel::glyphActivated(Gtk::TreeModel::Path const & path) void GlyphsPanel::glyphSelectionChanged() { -#if WITH_GTKMM_3_0 - std::vector itemArray = iconView->get_selected_items(); -#else - Gtk::IconView::ArrayHandle_TreePaths itemArray = iconView->get_selected_items(); -#endif + auto itemArray = iconView->get_selected_items(); if (itemArray.empty()) { label->set_text(" "); diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 639e463ea..eaf4e8ec0 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -19,12 +19,7 @@ #include //for GTK_RESPONSE* types #include #include - -#if WITH_GTKMM_3_0 -# include -#else -# include -#endif +#include #include <2geom/transforms.h> @@ -570,11 +565,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) : Parent(parent), XPadding(_("X:"), _("Horizontal spacing between columns."), UNIT_TYPE_LINEAR, "", "object-columns", &PaddingUnitMenu), YPadding(_("Y:"), _("Vertical spacing between rows."), XPadding, "", "object-rows", &PaddingUnitMenu), -#if WITH_GTKMM_3_0 PaddingTable(Gtk::manage(new Gtk::Grid())) -#else - PaddingTable(Gtk::manage(new Gtk::Table(2, 2, false))) -#endif { // bool used by spin button callbacks to stop loops where they change each other. updating = false; @@ -736,20 +727,11 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) } PaddingTable->set_border_width(MARGIN); - -#if WITH_GTKMM_3_0 PaddingTable->set_row_spacing(MARGIN); PaddingTable->set_column_spacing(MARGIN); PaddingTable->attach(XPadding, 0, 0, 1, 1); PaddingTable->attach(PaddingUnitMenu, 1, 0, 1, 1); PaddingTable->attach(YPadding, 0, 1, 1, 1); -#else - PaddingTable->set_row_spacings(MARGIN); - PaddingTable->set_col_spacings(MARGIN); - PaddingTable->attach(XPadding, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - PaddingTable->attach(PaddingUnitMenu, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - PaddingTable->attach(YPadding, 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK); -#endif TileBox.pack_start(*PaddingTable, false, false, MARGIN); diff --git a/src/ui/dialog/grid-arrange-tab.h b/src/ui/dialog/grid-arrange-tab.h index a137d1694..891849f1a 100644 --- a/src/ui/dialog/grid-arrange-tab.h +++ b/src/ui/dialog/grid-arrange-tab.h @@ -111,12 +111,7 @@ private: Inkscape::UI::Widget::UnitMenu PaddingUnitMenu; Inkscape::UI::Widget::ScalarUnit XPadding; Inkscape::UI::Widget::ScalarUnit YPadding; - -#if WITH_GTKMM_3_0 Gtk::Grid *PaddingTable; -#else - Gtk::Table *PaddingTable; -#endif // BBox or manual spacing Gtk::VBox SpacingVBox; diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 556d77a28..eb0fce978 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -124,13 +124,8 @@ void GuidelinePropertiesDialog::_onOK() g_free((gpointer) name); -#if WITH_GTKMM_3_0 - const Gdk::RGBA c = _color.get_rgba(); + const auto c = _color.get_rgba(); unsigned r = c.get_red_u()/257, g = c.get_green_u()/257, b = c.get_blue_u()/257; -#else - const Gdk::Color c = _color.get_color(); - unsigned r = c.get_red()/257, g = c.get_green()/257, b = c.get_blue()/257; -#endif //TODO: why 257? verify this! _guide->set_color(r, g, b, true); @@ -171,15 +166,9 @@ void GuidelinePropertiesDialog::_setup() { add_button(Gtk::Stock::DELETE, -12); add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); -#if WITH_GTKMM_3_0 - Gtk::Box *mainVBox = get_content_area(); + auto mainVBox = get_content_area(); _layout_table.set_row_spacing(4); _layout_table.set_column_spacing(4); -#else - Gtk::Box *mainVBox = get_vbox(); - _layout_table.set_spacings(4); - _layout_table.resize (3, 4); -#endif mainVBox->pack_start(_layout_table, false, false, 0); @@ -189,7 +178,6 @@ void GuidelinePropertiesDialog::_setup() { _label_descr.set_label("foo1"); _label_descr.set_alignment(0, 0.5); -#if WITH_GTKMM_3_0 _label_name.set_halign(Gtk::ALIGN_FILL); _label_name.set_valign(Gtk::ALIGN_FILL); _layout_table.attach(_label_name, 0, 0, 3, 1); @@ -207,19 +195,6 @@ void GuidelinePropertiesDialog::_setup() { _color.set_valign(Gtk::ALIGN_FILL); _color.set_hexpand(); _layout_table.attach(_color, 1, 3, 2, 1); -#else - _layout_table.attach(_label_name, - 0, 3, 0, 1, Gtk::FILL, Gtk::FILL); - - _layout_table.attach(_label_descr, - 0, 3, 1, 2, Gtk::FILL, Gtk::FILL); - - _layout_table.attach(_label_entry, - 1, 3, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - - _layout_table.attach(_color, - 1, 3, 3, 4, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); -#endif // unitmenus /* fixme: We should allow percents here too, as percents of the canvas size */ @@ -238,7 +213,6 @@ void GuidelinePropertiesDialog::_setup() { _spin_button_y.setIncrements(1.0, 10.0); _spin_button_y.setRange(-1e6, 1e6); -#if WITH_GTKMM_3_0 _spin_button_x.set_halign(Gtk::ALIGN_FILL); _spin_button_x.set_valign(Gtk::ALIGN_FILL); _spin_button_x.set_hexpand(); @@ -252,22 +226,12 @@ void GuidelinePropertiesDialog::_setup() { _unit_menu.set_halign(Gtk::ALIGN_FILL); _unit_menu.set_valign(Gtk::ALIGN_FILL); _layout_table.attach(_unit_menu, 2, 4, 1, 1); -#else - _layout_table.attach(_spin_button_x, - 1, 2, 4, 5, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - _layout_table.attach(_spin_button_y, - 1, 2, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - - _layout_table.attach(_unit_menu, - 2, 3, 4, 5, Gtk::FILL, Gtk::FILL); -#endif // angle spinbutton _spin_angle.setDigits(3); _spin_angle.setIncrements(1.0, 10.0); _spin_angle.setRange(-3600., 3600.); -#if WITH_GTKMM_3_0 _spin_angle.set_halign(Gtk::ALIGN_FILL); _spin_angle.set_valign(Gtk::ALIGN_FILL); _spin_angle.set_hexpand(); @@ -284,18 +248,6 @@ void GuidelinePropertiesDialog::_setup() { _locked_toggle.set_valign(Gtk::ALIGN_FILL); _locked_toggle.set_hexpand(); _layout_table.attach(_locked_toggle, 1, 8, 2, 1); -#else - _layout_table.attach(_spin_angle, - 1, 3, 6, 7, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - - // mode radio button - _layout_table.attach(_relative_toggle, - 1, 3, 7, 8, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - - // locked radio button - _layout_table.attach(_locked_toggle, - 1, 3, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); -#endif _relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged)); _relative_toggle.set_active(_relative_toggle_status); @@ -348,15 +300,9 @@ void GuidelinePropertiesDialog::_setup() { // init name entry _label_entry.getEntry()->set_text(_guide->getLabel() ? _guide->getLabel() : ""); -#if WITH_GTKMM_3_0 Gdk::RGBA c; c.set_rgba(((_guide->getColor()>>24)&0xff) / 255.0, ((_guide->getColor()>>16)&0xff) / 255.0, ((_guide->getColor()>>8)&0xff) / 255.0); _color.set_rgba(c); -#else - Gdk::Color c; - c.set_rgb_p(((_guide->getColor()>>24)&0xff) / 255.0, ((_guide->getColor()>>16)&0xff) / 255.0, ((_guide->getColor()>>8)&0xff) / 255.0); - _color.set_color(c); -#endif _modeChanged(); // sets values of spinboxes. diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h index 5dce0d6ed..25d32015c 100644 --- a/src/ui/dialog/guides.h +++ b/src/ui/dialog/guides.h @@ -16,12 +16,7 @@ #endif #include - -#if WITH_GTKMM_3_0 #include -#else -#include -#endif #include #include @@ -71,12 +66,7 @@ private: SPDesktop *_desktop; SPGuide *_guide; -#if WITH_GTKMM_3_0 - Gtk::Grid _layout_table; -#else - Gtk::Table _layout_table; -#endif - + Gtk::Grid _layout_table; Gtk::Label _label_name; Gtk::Label _label_descr; Inkscape::UI::Widget::CheckButton _locked_toggle; diff --git a/src/ui/dialog/icon-preview.h b/src/ui/dialog/icon-preview.h index 8a6e19a25..caec7e3b5 100644 --- a/src/ui/dialog/icon-preview.h +++ b/src/ui/dialog/icon-preview.h @@ -66,13 +66,7 @@ private: gdouble minDelay; Gtk::VBox iconBox; - -#if WITH_GTKMM_3_0 Gtk::Paned splitter; -#else - Gtk::HPaned splitter; -#endif - Glib::ustring targetId; int hot; int numEntries; diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 6dd62d3bb..8a69ef8e1 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -86,12 +86,8 @@ InkscapePreferences::InkscapePreferences() _getContents()->add(*sb); show_all_children(); Gtk::Requisition sreq; -#if WITH_GTKMM_3_0 Gtk::Requisition sreq_natural; sb->get_preferred_size(sreq_natural, sreq); -#else - sreq = sb->size_request(); -#endif _sb_width = sreq.width; _getContents()->remove(*sb); delete sb; @@ -863,17 +859,10 @@ static void proofComboChanged( Gtk::ComboBoxText* combo ) } static void gamutColorChanged( Gtk::ColorButton* btn ) { -#if WITH_GTKMM_3_0 - Gdk::RGBA rgba = btn->get_rgba(); - gushort r = rgba.get_red_u(); - gushort g = rgba.get_green_u(); - gushort b = rgba.get_blue_u(); -#else - Gdk::Color color = btn->get_color(); - gushort r = color.get_red(); - gushort g = color.get_green(); - gushort b = color.get_blue(); -#endif + auto rgba = btn->get_rgba(); + auto r = rgba.get_red_u(); + auto g = rgba.get_green_u(); + auto b = rgba.get_blue_u(); gchar* tmp = g_strdup_printf("#%02x%02x%02x", (r >> 8), (g >> 8), (b >> 8) ); @@ -1043,13 +1032,8 @@ void InkscapePreferences::initPageIO() Glib::ustring colorStr = prefs->getString("/options/softproof/gamutcolor"); -#if WITH_GTKMM_3_0 Gdk::RGBA tmpColor( colorStr.empty() ? "#00ff00" : colorStr); _cms_gamutcolor.set_rgba( tmpColor ); -#else - Gdk::Color tmpColor( colorStr.empty() ? "#00ff00" : colorStr); - _cms_gamutcolor.set_color( tmpColor ); -#endif _page_cms.add_line( true, _("Out of gamut warning color:"), _cms_gamutcolor, "", _("Selects the color used for out of gamut warning"), false); @@ -1594,31 +1578,19 @@ void InkscapePreferences::initKeyboardShortcuts(Gtk::TreeModel::iterator iter_ui int row = 3; -#if WITH_GTKMM_3_0 scroller->set_hexpand(); scroller->set_vexpand(); _page_keyshortcuts.attach(*scroller, 0, row, 2, 1); -#else - _page_keyshortcuts.attach(*scroller, 0, 2, row, row+1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL); -#endif row++; -#if WITH_GTKMM_3_0 - Gtk::ButtonBox *box_buttons = Gtk::manage(new Gtk::ButtonBox); -#else - Gtk::HButtonBox *box_buttons = Gtk::manage (new Gtk::HButtonBox); -#endif + auto box_buttons = Gtk::manage(new Gtk::ButtonBox); box_buttons->set_layout(Gtk::BUTTONBOX_END); box_buttons->set_spacing(4); -#if WITH_GTKMM_3_0 box_buttons->set_hexpand(); _page_keyshortcuts.attach(*box_buttons, 0, row, 3, 1); -#else - _page_keyshortcuts.attach(*box_buttons, 0, 3, row, row+1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); -#endif UI::Widget::Button *kb_reset = Gtk::manage(new UI::Widget::Button(_("Reset"), _("Remove all your customized keyboard shortcuts, and revert to the shortcuts in the shortcut file listed above"))); box_buttons->pack_start(*kb_reset, true, true, 6); @@ -2051,12 +2023,8 @@ bool InkscapePreferences::SetMaxDialogSize(const Gtk::TreeModel::iterator& iter) _page_frame.add(*page); this->show_all_children(); Gtk::Requisition sreq; -#if WITH_GTKMM_3_0 Gtk::Requisition sreq_natural; this->get_preferred_size(sreq_natural, sreq); -#else - sreq = this->size_request(); -#endif _max_dialog_width=std::max(_max_dialog_width, sreq.width); _max_dialog_height=std::max(_max_dialog_height, sreq.height); _page_frame.remove(); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index d1abcfc58..781b5e48e 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -97,11 +97,7 @@ enum { }; namespace Gtk { -#if WITH_GTKMM_3_0 class Scale; -#else -class HScale; -#endif } namespace Inkscape { @@ -206,11 +202,7 @@ protected: UI::Widget::PrefCheckButton _scroll_space; UI::Widget::PrefCheckButton _wheel_zoom; -#if WITH_GTKMM_3_0 Gtk::Scale *_slider_snapping_delay; -#else - Gtk::HScale *_slider_snapping_delay; -#endif UI::Widget::PrefCheckButton _snap_indicator; UI::Widget::PrefCheckButton _snap_closest_only; diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 8343cd6fe..e731ed3ff 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -33,13 +33,7 @@ #include #include #include - -#if WITH_GTKMM_3_0 -# include -#else -# include -#endif - +#include #include #include #include @@ -431,13 +425,7 @@ private: Blink watcher; Gtk::CheckButton useExt; Gtk::Button save; - -#if WITH_GTKMM_3_0 Gtk::Paned pane; -#else - Gtk::HPaned pane; -#endif - Gtk::VBox detailsBox; Gtk::HBox titleFrame; Gtk::Label titleLabel; @@ -498,27 +486,14 @@ private: Inkscape::UI::Widget::Frame axisFrame; Gtk::ScrolledWindow treeScroller; Gtk::ScrolledWindow detailScroller; - -#if WITH_GTKMM_3_0 Gtk::Paned splitter; Gtk::Paned split2; -#else - Gtk::HPaned splitter; - Gtk::VPaned split2; -#endif - Gtk::Label devName; Gtk::Label devKeyCount; Gtk::Label devAxesCount; Gtk::ComboBoxText axesCombo; Gtk::ProgressBar axesValues[6]; - -#if WITH_GTKMM_3_0 Gtk::Grid axisTable; -#else - Gtk::Table axisTable; -#endif - Gtk::ComboBoxText buttonCombo; Gtk::ComboBoxText linkCombo; sigc::connection linkConnection; @@ -528,13 +503,7 @@ private: Gtk::Image testThumb; Gtk::Image testButtons[24]; Gtk::Image testAxes[8]; - -#if WITH_GTKMM_3_0 Gtk::Grid imageTable; -#else - Gtk::Table imageTable; -#endif - Gtk::EventBox testDetector; ConfPanel cfgPanel; @@ -620,20 +589,11 @@ InputDialogImpl::InputDialogImpl() : treeScroller(), detailScroller(), splitter(), -#if WITH_GTKMM_3_0 split2(Gtk::ORIENTATION_VERTICAL), axisTable(), -#else - split2(), - axisTable(11, 2), -#endif linkCombo(), topHolder(), -#if WITH_GTKMM_3_0 imageTable(), -#else - imageTable(8, 7), -#endif testDetector(), cfgPanel() { @@ -655,27 +615,16 @@ InputDialogImpl::InputDialogImpl() : testFrame.add(testDetector); testThumb.set(getPix(PIX_TABLET)); testThumb.set_padding(24, 24); - -#if WITH_GTKMM_3_0 testThumb.set_hexpand(); testThumb.set_vexpand(); imageTable.attach(testThumb, 0, 0, 8, 1); -#else - imageTable.attach(testThumb, 0, 8, 0, 1, ::Gtk::EXPAND, ::Gtk::EXPAND); -#endif { guint col = 0; guint row = 1; for ( guint num = 0; num < G_N_ELEMENTS(testButtons); num++ ) { testButtons[num].set(getPix(PIX_BUTTONS_NONE)); - -#if WITH_GTKMM_3_0 imageTable.attach(testButtons[num], col, row, 1, 1); -#else - imageTable.attach(testButtons[num], col, col + 1, row, row + 1, ::Gtk::FILL, ::Gtk::FILL); -#endif - col++; if (col > 7) { col = 0; @@ -686,13 +635,7 @@ InputDialogImpl::InputDialogImpl() : col = 0; for ( guint num = 0; num < G_N_ELEMENTS(testAxes); num++ ) { testAxes[num].set(getPix(PIX_AXIS_NONE)); - -#if WITH_GTKMM_3_0 imageTable.attach(testAxes[num], col * 2, row, 2, 1); -#else - imageTable.attach(testAxes[num], col * 2, (col + 1) * 2, row, row + 1, ::Gtk::FILL, ::Gtk::FILL); -#endif - col++; if (col > 3) { col = 0; @@ -730,45 +673,17 @@ InputDialogImpl::InputDialogImpl() : axisFrame.add(axisTable); Gtk::Label *lbl = Gtk::manage(new Gtk::Label(_("Link:"))); - -#if WITH_GTKMM_3_0 axisTable.attach(*lbl, 0, rowNum, 1, 1); -#else - axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, - ::Gtk::FILL, - ::Gtk::SHRINK); -#endif - linkCombo.append(_("None")); linkCombo.set_active_text(_("None")); linkCombo.set_sensitive(false); linkConnection = linkCombo.signal_changed().connect(sigc::mem_fun(*this, &InputDialogImpl::linkComboChanged)); - -#if WITH_GTKMM_3_0 axisTable.attach(linkCombo, 1, rowNum, 1, 1); -#else - axisTable.attach(linkCombo, 1, 2, rowNum, rowNum + 1, - ::Gtk::FILL, - ::Gtk::SHRINK); -#endif - rowNum++; - lbl = Gtk::manage(new Gtk::Label(_("Axes count:"))); - -#if WITH_GTKMM_3_0 axisTable.attach(*lbl, 0, rowNum, 1, 1); axisTable.attach(devAxesCount, 1, rowNum, 1, 1); -#else - axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, - ::Gtk::FILL, - ::Gtk::SHRINK); - axisTable.attach(devAxesCount, 1, 2, rowNum, rowNum + 1, - ::Gtk::SHRINK, - ::Gtk::SHRINK); -#endif - rowNum++; @@ -786,22 +701,11 @@ InputDialogImpl::InputDialogImpl() : for ( guint barNum = 0; barNum < static_cast(G_N_ELEMENTS(axesValues)); barNum++ ) { lbl = Gtk::manage(new Gtk::Label(_("axis:"))); - -#if WITH_GTKMM_3_0 lbl->set_hexpand(); axisTable.attach(*lbl, 0, rowNum, 1, 1); axesValues[barNum].set_hexpand(); axisTable.attach(axesValues[barNum], 1, rowNum, 1, 1); -#else - axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, - ::Gtk::EXPAND, - ::Gtk::SHRINK); - axisTable.attach(axesValues[barNum], 1, 2, rowNum, rowNum + 1, - ::Gtk::EXPAND, - ::Gtk::SHRINK); -#endif - axesValues[barNum].set_sensitive(false); rowNum++; @@ -811,17 +715,8 @@ InputDialogImpl::InputDialogImpl() : lbl = Gtk::manage(new Gtk::Label(_("Button count:"))); -#if WITH_GTKMM_3_0 axisTable.attach(*lbl, 0, rowNum, 1, 1); axisTable.attach(devKeyCount, 1, rowNum, 1, 1); -#else - axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, - ::Gtk::FILL, - ::Gtk::SHRINK); - axisTable.attach(devKeyCount, 1, 2, rowNum, rowNum + 1, - ::Gtk::SHRINK, - ::Gtk::SHRINK); -#endif rowNum++; @@ -837,13 +732,7 @@ InputDialogImpl::InputDialogImpl() : rowNum++; */ -#if WITH_GTKMM_3_0 axisTable.attach(keyVal, 0, rowNum, 2, 1); -#else - axisTable.attach(keyVal, 0, 2, rowNum, rowNum + 1, - ::Gtk::FILL, - ::Gtk::SHRINK); -#endif rowNum++; @@ -857,18 +746,9 @@ InputDialogImpl::InputDialogImpl() : // TODO: Extension event stuff has been removed from public API in GTK+ 3 // Need to check that this hasn't broken anything -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_extension_events( GTK_WIDGET(testDetector.gobj()), GDK_EXTENSION_EVENTS_ALL ); -#endif testDetector.add_events(Gdk::POINTER_MOTION_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK |Gdk::PROXIMITY_IN_MASK|Gdk::PROXIMITY_OUT_MASK|Gdk::SCROLL_MASK); -#if WITH_GTKMM_3_0 axisTable.attach(keyEntry, 0, rowNum, 2, 1); -#else - axisTable.attach(keyEntry, 0, 2, rowNum, rowNum + 1, - ::Gtk::FILL, - ::Gtk::SHRINK); -#endif rowNum++; @@ -1150,12 +1030,7 @@ InputDialogImpl::ConfPanel::ConfPanel() : useExt.set_active(Preferences::get()->getBool("/options/useextinput/value")); useExt.signal_toggled().connect(sigc::mem_fun(*this, &InputDialogImpl::ConfPanel::useExtToggled)); -#if WITH_GTKMM_3_0 - Gtk::ButtonBox *buttonBox = Gtk::manage(new Gtk::ButtonBox); -#else - Gtk::HButtonBox *buttonBox = Gtk::manage (new Gtk::HButtonBox); -#endif - + auto buttonBox = Gtk::manage(new Gtk::ButtonBox); buttonBox->set_layout (Gtk::BUTTONBOX_END); //Gtk::Alignment *align = new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_START, 0, 0); buttonBox->add(save); @@ -1939,7 +1814,6 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event) testThumb.set(getPix(PIX_ERASER)); break; } -#if WITH_GTKMM_3_0 /// \fixme GTK3 added new GDK_SOURCEs that should be handled here! case GDK_SOURCE_KEYBOARD: case GDK_SOURCE_TOUCHSCREEN: @@ -1947,7 +1821,6 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event) g_warning("InputDialogImpl::eventSnoop : unhandled GDK_SOURCE type!"); break; } -#endif } updateTestButtons(key, hotButton); diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index 5d550ed48..6f5def886 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -40,22 +40,15 @@ namespace Dialogs { LayerPropertiesDialog::LayerPropertiesDialog() : _strategy(NULL), _desktop(NULL), _layer(NULL), _position_visible(false) { -#if WITH_GTKMM_3_0 - Gtk::Box *mainVBox = get_content_area(); + auto mainVBox = get_content_area(); _layout_table.set_row_spacing(4); _layout_table.set_column_spacing(4); -#else - Gtk::Box *mainVBox = get_vbox(); - _layout_table.set_spacings(4); - _layout_table.resize (1, 2); -#endif // Layer name widgets _layer_name_entry.set_activates_default(true); _layer_name_label.set_label(_("Layer name:")); _layer_name_label.set_alignment(1.0, 0.5); -#if WITH_GTKMM_3_0 _layer_name_label.set_halign(Gtk::ALIGN_FILL); _layer_name_label.set_valign(Gtk::ALIGN_FILL); _layout_table.attach(_layer_name_label, 0, 0, 1, 1); @@ -64,12 +57,6 @@ LayerPropertiesDialog::LayerPropertiesDialog() _layer_name_entry.set_valign(Gtk::ALIGN_FILL); _layer_name_entry.set_hexpand(); _layout_table.attach(_layer_name_entry, 1, 0, 1, 1); -#else - _layout_table.attach(_layer_name_label, - 0, 1, 0, 1, Gtk::FILL, Gtk::FILL); - _layout_table.attach(_layer_name_entry, - 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL); -#endif mainVBox->pack_start(_layout_table, true, true, 4); @@ -166,10 +153,6 @@ LayerPropertiesDialog::_setup_position_controls() { _layer_position_combo.set_cell_data_func(_label_renderer, sigc::mem_fun(*this, &LayerPropertiesDialog::_prepareLabelRenderer)); -#if !WITH_GTKMM_3_0 - _layout_table.resize (2, 2); -#endif - Gtk::ListStore::iterator row; row = _dropdown_list->append(); row->set_value(_dropdown_columns.position, LPOS_ABOVE); @@ -185,7 +168,6 @@ LayerPropertiesDialog::_setup_position_controls() { _layer_position_label.set_label(_("Position:")); _layer_position_label.set_alignment(1.0, 0.5); -#if WITH_GTKMM_3_0 _layer_position_combo.set_halign(Gtk::ALIGN_FILL); _layer_position_combo.set_valign(Gtk::ALIGN_FILL); _layer_position_combo.set_hexpand(); @@ -194,12 +176,6 @@ LayerPropertiesDialog::_setup_position_controls() { _layer_position_label.set_halign(Gtk::ALIGN_FILL); _layer_position_label.set_valign(Gtk::ALIGN_FILL); _layout_table.attach(_layer_position_label, 0, 1, 1, 1); -#else - _layout_table.attach(_layer_position_combo, - 1, 2, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::FILL); - _layout_table.attach(_layer_position_label, - 0, 1, 1, 2, Gtk::FILL, Gtk::FILL); -#endif show_all_children(); } @@ -254,16 +230,11 @@ LayerPropertiesDialog::_setup_layers_controls() { _layout_table.remove(_layer_name_entry); _layout_table.remove(_layer_name_label); -#if WITH_GTKMM_3_0 _scroller.set_halign(Gtk::ALIGN_FILL); _scroller.set_valign(Gtk::ALIGN_FILL); _scroller.set_hexpand(); _scroller.set_vexpand(); _layout_table.attach(_scroller, 0, 1, 2, 1); -#else - _layout_table.attach(_scroller, - 0, 2, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::FILL | Gtk::EXPAND); -#endif show_all_children(); } diff --git a/src/ui/dialog/layer-properties.h b/src/ui/dialog/layer-properties.h index c75a7f190..f62f22782 100644 --- a/src/ui/dialog/layer-properties.h +++ b/src/ui/dialog/layer-properties.h @@ -19,12 +19,7 @@ #include #include #include - -#if WITH_GTKMM_3_0 #include -#else -#include -#endif #include #include @@ -102,12 +97,7 @@ protected: Gtk::Entry _layer_name_entry; Gtk::Label _layer_position_label; Gtk::ComboBox _layer_position_combo; - -#if WITH_GTKMM_3_0 Gtk::Grid _layout_table; -#else - Gtk::Table _layout_table; -#endif bool _position_visible; diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 1c022ecad..77ced6d71 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -866,12 +866,8 @@ LayersPanel::LayersPanel() : _scroller.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); _scroller.set_shadow_type(Gtk::SHADOW_IN); Gtk::Requisition sreq; -#if WITH_GTKMM_3_0 Gtk::Requisition sreq_natural; _scroller.get_preferred_size(sreq_natural, sreq); -#else - sreq = _scroller.size_request(); -#endif int minHeight = 70; if (sreq.height < minHeight) { // Set a min height to see the layers when used with Ubuntu liboverlay-scrollbar diff --git a/src/ui/dialog/layers.h b/src/ui/dialog/layers.h index 9cd2c3b92..893b31557 100644 --- a/src/ui/dialog/layers.h +++ b/src/ui/dialog/layers.h @@ -124,15 +124,9 @@ private: Gtk::TreeView _tree; Gtk::CellRendererText *_text_renderer; Gtk::TreeView::Column *_name_column; -#if WITH_GTKMM_3_0 Gtk::Box _buttonsRow; Gtk::Box _buttonsPrimary; Gtk::Box _buttonsSecondary; -#else - Gtk::HBox _buttonsRow; - Gtk::HBox _buttonsPrimary; - Gtk::HBox _buttonsSecondary; -#endif Gtk::ScrolledWindow _scroller; Gtk::Menu _popupMenu; Inkscape::UI::Widget::SpinButton _spinBtn; diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp index c558eddaf..4346ebd3d 100644 --- a/src/ui/dialog/livepatheffect-add.cpp +++ b/src/ui/dialog/livepatheffect-add.cpp @@ -74,11 +74,7 @@ LivePathEffectAdd::LivePathEffectAdd() : add_button.set_use_underline(true); add_button.set_can_default(); -#if WITH_GTKMM_3_0 - Gtk::Box *mainVBox = get_content_area(); -#else - Gtk::Box *mainVBox = get_vbox(); -#endif + auto mainVBox = get_content_area(); mainVBox->pack_start(scrolled_window, true, true); add_action_widget(close_button, Gtk::RESPONSE_CLOSE); diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 422ec10ae..f19652746 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -134,13 +134,6 @@ LivePathEffectEditor::LivePathEffectEditor() // Add toolbar items to toolbar toolbar_hbox.set_layout (Gtk::BUTTONBOX_END); - -#if !WITH_GTKMM_3_0 - // TODO: This has been removed from Gtkmm 3.0. Check that - // everything still looks OK! - toolbar_hbox.set_child_min_width( 16 ); -#endif - toolbar_hbox.add( button_add ); toolbar_hbox.set_child_secondary( button_add , true); toolbar_hbox.add( button_remove ); diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index 4aac25eaa..b69ee007a 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -112,11 +112,7 @@ private: void on_visibility_toggled( Glib::ustring const& str ); -#if WITH_GTKMM_3_0 Gtk::ButtonBox toolbar_hbox; -#else - Gtk::HButtonBox toolbar_hbox; -#endif Gtk::Button button_add; Gtk::Button button_remove; Gtk::Button button_up; diff --git a/src/ui/dialog/new-from-template.cpp b/src/ui/dialog/new-from-template.cpp index 74ec7111e..aed57871a 100644 --- a/src/ui/dialog/new-from-template.cpp +++ b/src/ui/dialog/new-from-template.cpp @@ -31,20 +31,12 @@ NewFromTemplate::NewFromTemplate() _main_widget = new TemplateLoadTab(this); -#if WITH_GTKMM_3_0 get_content_area()->pack_start(*_main_widget); -#else - get_vbox()->pack_start(*_main_widget); -#endif Gtk::Alignment *align; align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER, 0.0, 0.0)); -#if WITH_GTKMM_3_0 get_content_area()->pack_end(*align, Gtk::PACK_SHRINK); -#else - get_vbox()->pack_end(*align, Gtk::PACK_SHRINK); -#endif align->set_padding(0, 0, 0, 15); align->add(_create_template_button); diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index be46129c4..9e10bbbeb 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -40,12 +40,7 @@ #include "xml/repr.h" #include -#if WITH_GTKMM_3_0 -# include -#else -# include -#endif - +#include namespace Inkscape { namespace UI { @@ -106,16 +101,9 @@ void ObjectProperties::_init() Gtk::Box *contents = _getContents(); contents->set_spacing(0); -#if WITH_GTKMM_3_0 - Gtk::Grid *grid_top = Gtk::manage(new Gtk::Grid()); + auto grid_top = Gtk::manage(new Gtk::Grid()); grid_top->set_row_spacing(4); grid_top->set_column_spacing(0); -#else - Gtk::Table *grid_top = Gtk::manage(new Gtk::Table(4, 4)); - grid_top->set_row_spacings(4); - grid_top->set_col_spacings(0); -#endif - grid_top->set_border_width(4); contents->pack_start(*grid_top, false, false, 0); @@ -124,29 +112,14 @@ void ObjectProperties::_init() /* Create the label for the object id */ _label_id.set_label(_label_id.get_label() + " "); _label_id.set_alignment(1, 0.5); - -#if WITH_GTKMM_3_0 _label_id.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_label_id, 0, 0, 1, 1); -#else - grid_top->attach(_label_id, 0, 1, 0, 1, - Gtk::SHRINK | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif - /* Create the entry box for the object id */ _entry_id.set_tooltip_text(_("The id= attribute (only letters, digits, and the characters .-_: allowed)")); _entry_id.set_max_length(64); - -#if WITH_GTKMM_3_0 _entry_id.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_entry_id, 1, 0, 1, 1); -#else - grid_top->attach(_entry_id, 1, 2, 0, 1, - Gtk::EXPAND | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif _label_id.set_mnemonic_widget(_entry_id); @@ -160,29 +133,16 @@ void ObjectProperties::_init() _label_label.set_label(_label_label.get_label() + " "); _label_label.set_alignment(1, 0.5); -#if WITH_GTKMM_3_0 _label_label.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_label_label, 0, 1, 1, 1); -#else - grid_top->attach(_label_label, 0, 1, 1, 2, - Gtk::SHRINK | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif - /* Create the entry box for the object label */ _entry_label.set_tooltip_text(_("A freeform label for the object")); _entry_label.set_max_length(256); -#if WITH_GTKMM_3_0 _entry_label.set_hexpand(); _entry_label.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_entry_label, 1, 1, 1, 1); -#else - grid_top->attach(_entry_label, 1, 2, 1, 2, - Gtk::EXPAND | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif _label_label.set_mnemonic_widget(_entry_label); @@ -194,28 +154,16 @@ void ObjectProperties::_init() _label_title.set_label(_label_title.get_label() + " "); _label_title.set_alignment (1, 0.5); -#if WITH_GTKMM_3_0 _label_title.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_label_title, 0, 2, 1, 1); -#else - grid_top->attach(_label_title, 0, 1, 2, 3, - Gtk::SHRINK | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif /* Create the entry box for the object title */ _entry_title.set_sensitive (FALSE); _entry_title.set_max_length (256); -#if WITH_GTKMM_3_0 _entry_title.set_hexpand(); _entry_title.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_entry_title, 1, 2, 1, 1); -#else - grid_top->attach(_entry_title, 1, 2, 2, 3, - Gtk::EXPAND | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif _label_title.set_mnemonic_widget(_entry_title); // pressing enter in the label field is the same as clicking Set: @@ -244,14 +192,8 @@ void ObjectProperties::_init() _label_image_rendering.set_label(_label_image_rendering.get_label() + " "); _label_image_rendering.set_alignment(1, 0.5); -#if WITH_GTKMM_3_0 _label_image_rendering.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_label_image_rendering, 0, 3, 1, 1); -#else - grid_top->attach(_label_image_rendering, 0, 1, 3, 4, - Gtk::SHRINK | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif /* Create the combo box text for the 'image-rendering' property */ _combo_image_rendering.append( "auto" ); @@ -259,14 +201,8 @@ void ObjectProperties::_init() _combo_image_rendering.append( "optimizeSpeed" ); _combo_image_rendering.set_tooltip_text(_("The 'image-rendering' property can influence how a bitmap is up-scaled:\n\t'auto' no preference;\n\t'optimizeQuality' smooth;\n\t'optimizeSpeed' blocky.\nNote that this behaviour is not defined in the SVG 1.1 specification and not all browsers follow this interpretation.")); -#if WITH_GTKMM_3_0 _combo_image_rendering.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_combo_image_rendering, 1, 3, 1, 1); -#else - grid_top->attach(_combo_image_rendering, 1, 2, 3, 4, - Gtk::EXPAND | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif _label_image_rendering.set_mnemonic_widget(_combo_image_rendering); @@ -278,60 +214,36 @@ void ObjectProperties::_init() Gtk::HBox *hb_checkboxes = Gtk::manage(new Gtk::HBox()); contents->pack_start(*hb_checkboxes, FALSE, FALSE, 0); -#if WITH_GTKMM_3_0 - Gtk::Grid *grid_cb = Gtk::manage(new Gtk::Grid()); + auto grid_cb = Gtk::manage(new Gtk::Grid()); grid_cb->set_row_homogeneous(); grid_cb->set_column_homogeneous(true); -#else - Gtk::Table *grid_cb = Gtk::manage(new Gtk::Table(1, 2, true)); -#endif grid_cb->set_border_width(4); hb_checkboxes->pack_start(*grid_cb, true, true, 0); /* Hide */ _cb_hide.set_tooltip_text (_("Check to make the object invisible")); - -#if WITH_GTKMM_3_0 _cb_hide.set_hexpand(); _cb_hide.set_valign(Gtk::ALIGN_CENTER); grid_cb->attach(_cb_hide, 0, 0, 1, 1); -#else - grid_cb->attach(_cb_hide, 0, 1, 0, 1, - Gtk::EXPAND | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif _cb_hide.signal_toggled().connect(sigc::mem_fun(this, &ObjectProperties::_hiddenToggled)); /* Lock */ // TRANSLATORS: "Lock" is a verb here _cb_lock.set_tooltip_text(_("Check to make the object insensitive (not selectable by mouse)")); - -#if WITH_GTKMM_3_0 _cb_lock.set_hexpand(); _cb_lock.set_valign(Gtk::ALIGN_CENTER); grid_cb->attach(_cb_lock, 1, 0, 1, 1); -#else - grid_cb->attach(_cb_lock, 1, 2, 0, 1, - Gtk::EXPAND | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif _cb_lock.signal_toggled().connect(sigc::mem_fun(this, &ObjectProperties::_sensitivityToggled)); /* Button for setting the object's id, label, title and description. */ Gtk::Button *btn_set = Gtk::manage(new Gtk::Button(_("_Set"), 1)); -#if WITH_GTKMM_3_0 btn_set->set_hexpand(); btn_set->set_valign(Gtk::ALIGN_CENTER); grid_cb->attach(*btn_set, 2, 0, 1, 1); -#else - grid_cb->attach(*btn_set, 2, 3, 0, 1, - Gtk::EXPAND | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif btn_set->signal_clicked().connect(sigc::mem_fun(this, &ObjectProperties::_labelChanged)); diff --git a/src/ui/dialog/object-properties.h b/src/ui/dialog/object-properties.h index dc28c0bad..8551d5fca 100644 --- a/src/ui/dialog/object-properties.h +++ b/src/ui/dialog/object-properties.h @@ -50,11 +50,7 @@ class SPDesktop; class SPItem; namespace Gtk { -#if WITH_GTKMM_3_0 class Grid; -#else -class Table; -#endif } namespace Inkscape { diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 27694a9ac..e4b48d10b 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -511,11 +511,7 @@ void ObjectsPanel::_setCompositingValues(SPItem *item) _blurConnection.block(); //Set the opacity -#if WITH_GTKMM_3_0 _opacity_adjustment->set_value((item->style->opacity.set ? SP_SCALE24_TO_FLOAT(item->style->opacity.value) : 1) * _opacity_adjustment->get_upper()); -#else - _opacity_adjustment.set_value((item->style->opacity.set ? SP_SCALE24_TO_FLOAT(item->style->opacity.value) : 1) * _opacity_adjustment.get_upper()); -#endif SPFeBlend *spblend = NULL; SPGaussianBlur *spblur = NULL; if (item->style->getFilter()) @@ -1481,11 +1477,7 @@ void ObjectsPanel::_opacityChangedIter(const Gtk::TreeIter& iter) if (item) { item->style->opacity.set = TRUE; -#if WITH_GTKMM_3_0 item->style->opacity.value = SP_SCALE24_FROM_FLOAT(_opacity_adjustment->get_value() / _opacity_adjustment->get_upper()); -#else - item->style->opacity.value = SP_SCALE24_FROM_FLOAT(_opacity_adjustment.get_value() / _opacity_adjustment.get_upper()); -#endif item->updateRepr(SP_OBJECT_WRITE_NO_CHILDREN | SP_OBJECT_WRITE_EXT); } } @@ -1628,11 +1620,7 @@ ObjectsPanel::ObjectsPanel() : _opacity_vbox(false, 0), _opacity_label(_("Opacity:")), _opacity_label_unit(_("%")), -#if WITH_GTKMM_3_0 _opacity_adjustment(Gtk::Adjustment::create(100.0, 0.0, 100.0, 1.0, 1.0, 0.0)), -#else - _opacity_adjustment(100.0, 0.0, 100.0, 1.0, 1.0, 0.0), -#endif _opacity_hscale(_opacity_adjustment), _opacity_spin_button(_opacity_adjustment, 0.01, 1), _fe_cb(UI::Widget::SimpleFilterModifier::BLEND), @@ -1762,12 +1750,8 @@ ObjectsPanel::ObjectsPanel() : _scroller.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); _scroller.set_shadow_type(Gtk::SHADOW_IN); Gtk::Requisition sreq; -#if WITH_GTKMM_3_0 Gtk::Requisition sreq_natural; _scroller.get_preferred_size(sreq_natural, sreq); -#else - sreq = _scroller.size_request(); -#endif int minHeight = 70; if (sreq.height < minHeight) { // Set a min height to see the layers when used with Ubuntu liboverlay-scrollbar @@ -1800,13 +1784,8 @@ ObjectsPanel::ObjectsPanel() : _opacity_hbox.pack_start(_opacity_spin_button, false, false, 0); _opacity_hbox.pack_start(_opacity_label_unit, false, false, 3); _opacity_hscale.set_draw_value(false); -#if WITH_GTKMM_3_0 _opacityConnection = _opacity_adjustment->signal_value_changed().connect(sigc::mem_fun(*this, &ObjectsPanel::_opacityValueChanged)); _opacity_label.set_mnemonic_widget(_opacity_hscale); -#else - _opacityConnection = _opacity_adjustment.signal_value_changed().connect(sigc::mem_fun(*this, &ObjectsPanel::_opacityValueChanged)); - _opacity_label.set_mnemonic_widget(_opacity_hscale); -#endif //Keep the labels aligned GtkSizeGroup *labels = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); diff --git a/src/ui/dialog/objects.h b/src/ui/dialog/objects.h index 9b9a6025a..018f9191f 100644 --- a/src/ui/dialog/objects.h +++ b/src/ui/dialog/objects.h @@ -134,15 +134,9 @@ private: Gtk::TreeView _tree; Gtk::CellRendererText *_text_renderer; Gtk::TreeView::Column *_name_column; -#if WITH_GTKMM_3_0 Gtk::Box _buttonsRow; Gtk::Box _buttonsPrimary; Gtk::Box _buttonsSecondary; -#else - Gtk::HBox _buttonsRow; - Gtk::HBox _buttonsPrimary; - Gtk::HBox _buttonsSecondary; -#endif Gtk::ScrolledWindow _scroller; Gtk::Menu _popupMenu; Inkscape::UI::Widget::SpinButton _spinBtn; @@ -161,11 +155,7 @@ private: Gtk::HBox _opacity_hbox; Gtk::Label _opacity_label; Gtk::Label _opacity_label_unit; -#if WITH_GTKMM_3_0 Glib::RefPtr _opacity_adjustment; -#else - Gtk::Adjustment _opacity_adjustment; -#endif Gtk::HScale _opacity_hscale; Inkscape::UI::Widget::SpinButton _opacity_spin_button; diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index f2ee79d06..9e9037fdd 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -316,27 +316,10 @@ LoadingBox::LoadingBox() : Gtk::EventBox() draw_spinner = false; spinner_step = 0; -#if WITH_GTKMM_3_0 signal_draw().connect(sigc::mem_fun(*this, &LoadingBox::_on_draw), false); -#else - signal_expose_event().connect(sigc::mem_fun(*this, &LoadingBox::_on_expose_event), false); -#endif -} - -#if !WITH_GTKMM_3_0 -bool LoadingBox::_on_expose_event(GdkEventExpose* /*event*/) -{ - Cairo::RefPtr cr = get_window()->create_cairo_context(); - - return _on_draw(cr); } -#endif -bool LoadingBox::_on_draw(const Cairo::RefPtr & -#if WITH_GTKMM_3_0 -cr -#endif -) +bool LoadingBox::_on_draw(const Cairo::RefPtr &cr) { // Draw shadow int x = get_allocation().get_x(); @@ -344,27 +327,14 @@ cr int width = get_allocation().get_width(); int height = get_allocation().get_height(); -#if WITH_GTKMM_3_0 get_style_context()->render_frame(cr, x, y, width, height); -#else - get_style()->paint_shadow(get_window(), get_state(), Gtk::SHADOW_IN, - Gdk::Rectangle(x, y, width, height), - *this, Glib::ustring("viewport"), x, y, width, height); -#endif if (draw_spinner) { int spinner_size = 16; int spinner_x = x + (width - spinner_size) / 2; int spinner_y = y + (height - spinner_size) / 2; -#if WITH_GTKMM_3_0 get_style_context()->render_activity(cr, spinner_x, spinner_y, spinner_size, spinner_size); -#else - gtk_paint_spinner(gtk_widget_get_style(GTK_WIDGET(gobj())), - gtk_widget_get_window(GTK_WIDGET(gobj())), - gtk_widget_get_state(GTK_WIDGET(gobj())), NULL, GTK_WIDGET(gobj()), - NULL, spinner_step, spinner_x, spinner_y, spinner_size, spinner_size); -#endif } return false; @@ -434,11 +404,7 @@ PreviewWidget::PreviewWidget() : Gtk::VBox(false, 12) box_loading->set_size_request(90, 90); set_border_width(12); -#if WITH_GTKMM_3_0 signal_draw().connect(sigc::mem_fun(*this, &PreviewWidget::_on_draw), false); -#else - signal_expose_event().connect(sigc::mem_fun(*this, &PreviewWidget::_on_expose_event), false); -#endif clear(); } @@ -482,15 +448,6 @@ void PreviewWidget::clear() image->hide(); } -#if !WITH_GTKMM_3_0 -bool PreviewWidget::_on_expose_event(GdkEventExpose* /*event*/) -{ - Cairo::RefPtr cr = get_window()->create_cairo_context(); - - return _on_draw(cr); -} -#endif - bool PreviewWidget::_on_draw(const Cairo::RefPtr& cr) { // Draw background @@ -499,16 +456,10 @@ bool PreviewWidget::_on_draw(const Cairo::RefPtr& cr) int width = get_allocation().get_width(); int height = get_allocation().get_height(); -#if WITH_GTKMM_3_0 Gdk::RGBA background_fill; get_style_context()->lookup_color("base_color", background_fill); cr->rectangle(x, y, width, height); Gdk::Cairo::set_source_rgba(cr, background_fill); -#else - Gdk::Color background_fill = get_style()->get_base(get_state()); - cr->rectangle(x, y, width, height); - Gdk::Cairo::set_source_color(cr, background_fill); -#endif cr->fill(); @@ -573,57 +524,12 @@ void StatusWidget::end_process() clear(); } -#if !GTK_CHECK_VERSION(3,0,0) -SearchEntry::SearchEntry() : Gtk::Entry() -{ - signal_changed().connect(sigc::mem_fun(*this, &SearchEntry::_on_changed)); - signal_icon_press().connect(sigc::mem_fun(*this, &SearchEntry::_on_icon_pressed)); - - set_icon_from_icon_name(INKSCAPE_ICON("edit-find"), Gtk::ENTRY_ICON_PRIMARY); - gtk_entry_set_icon_from_icon_name(gobj(), GTK_ENTRY_ICON_SECONDARY, NULL); -} - -void SearchEntry::_on_icon_pressed(Gtk::EntryIconPosition icon_position, const GdkEventButton* /*event*/) -{ - if (icon_position == Gtk::ENTRY_ICON_SECONDARY) { - grab_focus(); - delete_text(0, -1); - } else if (icon_position == Gtk::ENTRY_ICON_PRIMARY) { - select_region(0, -1); - grab_focus(); - } -} - -void SearchEntry::_on_changed() -{ - if (get_text().empty()) { - gtk_entry_set_icon_from_icon_name(gobj(), GTK_ENTRY_ICON_SECONDARY, NULL); - } else { - set_icon_from_icon_name(INKSCAPE_ICON("edit-clear"), Gtk::ENTRY_ICON_SECONDARY); - } -} -#endif - - BaseBox::BaseBox() : Gtk::EventBox() { -#if WITH_GTKMM_3_0 signal_draw().connect(sigc::mem_fun(*this, &BaseBox::_on_draw), false); -#else - signal_expose_event().connect(sigc::mem_fun(*this, &BaseBox::_on_expose_event), false); -#endif set_visible_window(false); } -#if !WITH_GTKMM_3_0 -bool BaseBox::_on_expose_event(GdkEventExpose* /*event*/) -{ - Cairo::RefPtr cr = get_window()->create_cairo_context(); - - return _on_draw(cr); -} -#endif - bool BaseBox::_on_draw(const Cairo::RefPtr& cr) { // Draw background and shadow @@ -632,23 +538,12 @@ bool BaseBox::_on_draw(const Cairo::RefPtr& cr) int width = get_allocation().get_width(); int height = get_allocation().get_height(); -#if WITH_GTKMM_3_0 Gdk::RGBA background_fill; get_style_context()->lookup_color("base_color", background_fill); cr->rectangle(x, y, width, height); Gdk::Cairo::set_source_rgba(cr, background_fill); cr->fill(); get_style_context()->render_frame(cr, x, y, width, height); -#else - Gdk::Color background_fill = get_style()->get_base(get_state()); - cr->rectangle(x, y, width, height); - Gdk::Cairo::set_source_color(cr, background_fill); - cr->fill(); - - get_style()->paint_shadow(get_window(), get_state(), Gtk::SHADOW_IN, - Gdk::Rectangle(x, y, width, height), - *this, Glib::ustring("viewport"), x, y, width, height); -#endif return false; } @@ -665,23 +560,10 @@ LogoArea::LogoArea() : Gtk::EventBox() draw_logo = false; } -#if WITH_GTKMM_3_0 signal_draw().connect(sigc::mem_fun(*this, &LogoArea::_on_draw)); -#else - signal_expose_event().connect(sigc::mem_fun(*this, &LogoArea::_on_expose_event)); -#endif set_visible_window(false); } -#if !WITH_GTKMM_3_0 -bool LogoArea::_on_expose_event(GdkEventExpose* /*event*/) -{ - Cairo::RefPtr cr = get_window()->create_cairo_context(); - - return _on_draw(cr); -} -#endif - bool LogoArea::_on_draw(const Cairo::RefPtr& cr) { if (draw_logo) { @@ -692,16 +574,9 @@ bool LogoArea::_on_draw(const Cairo::RefPtr& cr) int x_logo = x + (width - 220) / 2; int y_logo = y + (height - 76) / 2; - // Draw logo, we mask [read fill] it with the mid colour from the - // user's GTK theme -#if WITH_GTKMM_3_0 - // For GTK+ 3, use grey + // Draw logo, we mask [read fill] it with grey Gdk::RGBA logo_fill("grey"); Gdk::Cairo::set_source_rgba(cr, logo_fill); -#else - Gdk::Color logo_fill = get_style()->get_mid(get_state()); - Gdk::Cairo::set_source_color(cr, logo_fill); -#endif cr->mask(logo_mask, x_logo, y_logo); } @@ -1179,16 +1054,9 @@ void ImportDialog::update_label_no_search_results() Glib::ustring msg_two = _("Please make sure all keywords are spelled correctly," " or try again with different keywords."); -#if WITH_GTKMM_3_0 - Glib::ustring markup = Glib::ustring::compose( + auto markup = Glib::ustring::compose( "%1\n%2", msg_one, msg_two); -#else - Gdk::Color grey = entry_search->get_style()->get_text_aa(entry_search->get_state()); - Glib::ustring markup = Glib::ustring::compose( - "%1\n%3", - msg_one, grey.to_string(), msg_two); -#endif label_not_found->set_markup(markup); } @@ -1208,33 +1076,17 @@ ImportDialog::ImportDialog(Gtk::Window& parent_window, FileDialogType file_types dialogType = file_types; // Creation - Gtk::VBox *vbox = new Gtk::VBox(false, 0); - -#if WITH_GTKMM_3_0 - Gtk::ButtonBox *hbuttonbox_bottom = new Gtk::ButtonBox(); -#else - Gtk::HButtonBox *hbuttonbox_bottom = new Gtk::HButtonBox(); -#endif - - Gtk::HBox *hbox_bottom = new Gtk::HBox(false, 12); + auto vbox = new Gtk::VBox(false, 0); + auto hbuttonbox_bottom = new Gtk::ButtonBox(); + auto hbox_bottom = new Gtk::HBox(false, 12); BaseBox *basebox_logo = new BaseBox(); BaseBox *basebox_no_search_results = new BaseBox(); label_not_found = new Gtk::Label(); label_description = new Gtk::Label(); - -#if GTK_CHECK_VERSION(3,0,0) entry_search = new Gtk::SearchEntry(); -#else - entry_search = new SearchEntry(); -#endif - button_search = new Gtk::Button(_("Search")); -#if WITH_GTKMM_3_0 - Gtk::ButtonBox* hbuttonbox_search = new Gtk::ButtonBox(); -#else - Gtk::HButtonBox* hbuttonbox_search = new Gtk::HButtonBox(); -#endif + auto hbuttonbox_search = new Gtk::ButtonBox(); Gtk::ScrolledWindow* scrolledwindow_preview = new Gtk::ScrolledWindow(); preview_files = new PreviewWidget(); diff --git a/src/ui/dialog/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h index 9de24d821..db3c60786 100644 --- a/src/ui/dialog/ocaldialogs.h +++ b/src/ui/dialog/ocaldialogs.h @@ -17,19 +17,16 @@ # include #endif -//Gtk includes +// Gtkmm includes #include #include #include #include +#include #include #include -#if GTK_CHECK_VERSION(3,0,0) -# include -#endif - #include //Inkscape includes @@ -283,10 +280,6 @@ private: sigc::connection timeout; bool draw_spinner; -#if !WITH_GTKMM_3_0 - bool _on_expose_event(GdkEventExpose* event); -#endif - bool _on_draw(const Cairo::RefPtr& cr); bool on_timeout(); }; @@ -310,10 +303,6 @@ private: WrapLabel* label_description; WrapLabel* label_time; -#if !WITH_GTKMM_3_0 - bool _on_expose_event(GdkEventExpose* event); -#endif - bool _on_draw(const Cairo::RefPtr& cr); }; @@ -336,21 +325,6 @@ public: Gtk::Label* label; }; -#if !GTK_CHECK_VERSION(3,0,0) -/** - * A Gtk::Entry with search & clear icons - */ -class SearchEntry : public Gtk::Entry -{ -public: - SearchEntry(); - -private: - void _on_icon_pressed(Gtk::EntryIconPosition icon_position, const GdkEventButton* event); - void _on_changed(); -}; -#endif - /** * A box which paints an overlay of the OCAL logo */ @@ -359,9 +333,6 @@ class LogoArea : public Gtk::EventBox public: LogoArea(); private: -#if !WITH_GTKMM_3_0 - bool _on_expose_event(GdkEventExpose* event); -#endif bool _on_draw(const Cairo::RefPtr& cr); bool draw_logo; Cairo::RefPtr logo_mask; @@ -375,9 +346,6 @@ class BaseBox : public Gtk::EventBox public: BaseBox(); private: -#if !WITH_GTKMM_3_0 - bool _on_expose_event(GdkEventExpose* event); -#endif bool _on_draw(const Cairo::RefPtr& cr); }; @@ -459,12 +427,7 @@ protected: private: Glib::ustring filename_image; Glib::ustring filename_thumbnail; - -#if GTK_CHECK_VERSION(3,0,0) Gtk::SearchEntry *entry_search; -#else - SearchEntry *entry_search; -#endif LogoArea *drawingarea_logo; SearchResultList *list_results; diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index 5ec1285c1..5c588ebac 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -33,11 +33,7 @@ namespace Dialog { PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) : parent(parent_), -#if WITH_GTKMM_3_0 parametersTable(), -#else - parametersTable(3, 3, false), -#endif centerY("", C_("Polar arrange tab", "Y coordinate of the center"), UNIT_TYPE_LINEAR), centerX("", C_("Polar arrange tab", "X coordinate of the center"), centerY), radiusY("", C_("Polar arrange tab", "Y coordinate of the radius"), UNIT_TYPE_LINEAR), @@ -81,11 +77,7 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) pack_start(arrangeOnParametersRadio, false, false); centerLabel.set_text(C_("Polar arrange tab", "Center X/Y:")); -#if WITH_GTKMM_3_0 parametersTable.attach(centerLabel, 0, 0, 1, 1); -#else - parametersTable.attach(centerLabel, 0, 1, 0, 1, Gtk::FILL); -#endif centerX.setDigits(2); centerX.setIncrements(0.2, 0); centerX.setRange(-10000, 10000); @@ -94,20 +86,11 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) centerY.setIncrements(0.2, 0); centerY.setRange(-10000, 10000); centerY.setValue(0, "px"); -#if WITH_GTKMM_3_0 parametersTable.attach(centerX, 1, 0, 1, 1); parametersTable.attach(centerY, 2, 0, 1, 1); -#else - parametersTable.attach(centerX, 1, 2, 0, 1, Gtk::FILL); - parametersTable.attach(centerY, 2, 3, 0, 1, Gtk::FILL); -#endif radiusLabel.set_text(C_("Polar arrange tab", "Radius X/Y:")); -#if WITH_GTKMM_3_0 parametersTable.attach(radiusLabel, 0, 1, 1, 1); -#else - parametersTable.attach(radiusLabel, 0, 1, 1, 2, Gtk::FILL); -#endif radiusX.setDigits(2); radiusX.setIncrements(0.2, 0); radiusX.setRange(0.001, 10000); @@ -116,20 +99,11 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) radiusY.setIncrements(0.2, 0); radiusY.setRange(0.001, 10000); radiusY.setValue(100, "px"); -#if WITH_GTKMM_3_0 parametersTable.attach(radiusX, 1, 1, 1, 1); parametersTable.attach(radiusY, 2, 1, 1, 1); -#else - parametersTable.attach(radiusX, 1, 2, 1, 2, Gtk::FILL); - parametersTable.attach(radiusY, 2, 3, 1, 2, Gtk::FILL); -#endif angleLabel.set_text(_("Angle X/Y:")); -#if WITH_GTKMM_3_0 parametersTable.attach(angleLabel, 0, 2, 1, 1); -#else - parametersTable.attach(angleLabel, 0, 1, 2, 3, Gtk::FILL); -#endif angleX.setDigits(2); angleX.setIncrements(0.2, 0); angleX.setRange(-10000, 10000); @@ -138,13 +112,8 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) angleY.setIncrements(0.2, 0); angleY.setRange(-10000, 10000); angleY.setValue(180, "°"); -#if WITH_GTKMM_3_0 parametersTable.attach(angleX, 1, 2, 1, 1); parametersTable.attach(angleY, 2, 2, 1, 1); -#else - parametersTable.attach(angleX, 1, 2, 2, 3, Gtk::FILL); - parametersTable.attach(angleY, 2, 3, 2, 3, Gtk::FILL); -#endif pack_start(parametersTable, false, false); rotateObjectsCheckBox.set_label(_("Rotate objects")); diff --git a/src/ui/dialog/polar-arrange-tab.h b/src/ui/dialog/polar-arrange-tab.h index f7d7bf11f..1a4e04eda 100644 --- a/src/ui/dialog/polar-arrange-tab.h +++ b/src/ui/dialog/polar-arrange-tab.h @@ -20,12 +20,7 @@ #include #include - -#if WITH_GTKMM_3_0 - #include -#else - #include -#endif +#include namespace Inkscape { namespace UI { @@ -75,11 +70,7 @@ private: Gtk::RadioButton arrangeOnLastCircleRadio; Gtk::RadioButton arrangeOnParametersRadio; -#if WITH_GTKMM_3_0 Gtk::Grid parametersTable; -#else - Gtk::Table parametersTable; -#endif Gtk::Label centerLabel; Inkscape::UI::Widget::ScalarUnit centerY; diff --git a/src/ui/dialog/spellcheck.h b/src/ui/dialog/spellcheck.h index e98a9d80e..834f23c24 100644 --- a/src/ui/dialog/spellcheck.h +++ b/src/ui/dialog/spellcheck.h @@ -225,11 +225,7 @@ private: * Dialogs widgets */ Gtk::Label banner_label; -#if WITH_GTKMM_3_0 Gtk::ButtonBox banner_hbox; -#else - Gtk::HButtonBox banner_hbox; -#endif Gtk::ScrolledWindow scrolled_window; Gtk::TreeView tree_view; Glib::RefPtr model; @@ -243,21 +239,10 @@ private: Gtk::Button add_button; GtkWidget * dictionary_combo; Gtk::HBox dictionary_hbox; - -#if WITH_GTKMM_3_0 Gtk::Separator action_sep; -#else - Gtk::HSeparator action_sep; -#endif - Gtk::Button stop_button; Gtk::Button start_button; - -#if WITH_GTKMM_3_0 Gtk::ButtonBox actionbutton_hbox; -#else - Gtk::HButtonBox actionbutton_hbox; -#endif SPDesktop * desktop; DesktopTracker deskTrack; diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 08ebbcf14..58ac62cb0 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -890,12 +890,7 @@ void SvgFontsDialog::add_font(){ SvgFontsDialog::SvgFontsDialog() : UI::Widget::Panel("", "/dialogs/svgfonts", SP_VERB_DIALOG_SVG_FONTS), _add(Gtk::Stock::NEW) { -#if WITH_GTKMM_3_0 kerning_slider = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL)); -#else - kerning_slider = Gtk::manage(new Gtk::HScale); -#endif - _add.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::add_font)); Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox()); diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h index e80bbfd39..1588c0fc2 100644 --- a/src/ui/dialog/svg-fonts-dialog.h +++ b/src/ui/dialog/svg-fonts-dialog.h @@ -27,11 +27,7 @@ #include "xml/helper-observer.h" namespace Gtk { -#if WITH_GTKMM_3_0 class Scale; -#else -class HScale; -#endif } class SPGlyph; @@ -216,12 +212,7 @@ private: GlyphComboBox first_glyph, second_glyph; SPGlyphKerning* kerning_pair; Inkscape::UI::Widget::SpinButton setwidth_spin; - -#if WITH_GTKMM_3_0 Gtk::Scale* kerning_slider; -#else - Gtk::HScale* kerning_slider; -#endif class EntryWidget : public Gtk::HBox { diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 6577c8d4e..964e844b2 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -658,12 +658,8 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : if (Glib::ustring(prefsPath) == "/dialogs/swatches") { Gtk::Requisition sreq; -#if WITH_GTKMM_3_0 Gtk::Requisition sreq_natural; get_preferred_size(sreq_natural, sreq); -#else - sreq = size_request(); -#endif int minHeight = 60; if (sreq.height < minHeight) { set_size_request(70, minHeight); diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 06c17611f..597f90e95 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -20,14 +20,8 @@ #include #include - -#if WITH_GTKMM_3_0 -# include -# include -#else -# include -#endif - +#include +#include #include #include #include @@ -121,11 +115,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : { /******************** Table *************************/ -#if WITH_GTKMM_3_0 - Gtk::Grid *table = new Gtk::Grid(); -#else - Gtk::Table *table = new Gtk::Table(2, 4, false); -#endif + auto table = new Gtk::Grid(); // panel is a cloked Gtk::VBox _getContents()->pack_start(*Gtk::manage(table), Gtk::PACK_EXPAND_WIDGET); @@ -133,24 +123,12 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : /******************** Symbol Sets *************************/ Gtk::Label* labelSet = new Gtk::Label(_("Symbol set: ")); - -#if WITH_GTKMM_3_0 table->attach(*Gtk::manage(labelSet),0,row,1,1); -#else - table->attach(*Gtk::manage(labelSet),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); -#endif - symbolSet = new Gtk::ComboBoxText(); // Fill in later symbolSet->append(_("Current Document")); symbolSet->set_active_text(_("Current Document")); - -#if WITH_GTKMM_3_0 symbolSet->set_hexpand(); table->attach(*Gtk::manage(symbolSet),1,row,1,1); -#else - table->attach(*Gtk::manage(symbolSet),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); -#endif - sigc::connection connSet = symbolSet->signal_changed().connect( sigc::mem_fun(*this, &SymbolsDialog::rebuild)); instanceConns.push_back(connSet); @@ -183,14 +161,9 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow(); scroller->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS); scroller->add(*Gtk::manage(iconView)); - -#if WITH_GTKMM_3_0 scroller->set_hexpand(); scroller->set_vexpand(); table->attach(*Gtk::manage(scroller),0,row,2,1); -#else - table->attach(*Gtk::manage(scroller),0,2,row,row+1,Gtk::EXPAND|Gtk::FILL,Gtk::EXPAND|Gtk::FILL); -#endif ++row; @@ -199,12 +172,8 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : Gtk::HBox* tools = new Gtk::HBox(); //tools->set_layout( Gtk::BUTTONBOX_END ); -#if WITH_GTKMM_3_0 scroller->set_hexpand(); table->attach(*Gtk::manage(tools),0,row,2,1); -#else - table->attach(*Gtk::manage(tools),0,2,row,row+1,Gtk::EXPAND|Gtk::FILL,Gtk::FILL); -#endif addSymbol = Gtk::manage(new Gtk::Button()); addSymbol->add(*Gtk::manage(Glib::wrap( @@ -398,11 +367,7 @@ void SymbolsDialog::revertSymbol() { void SymbolsDialog::iconDragDataGet(const Glib::RefPtr& /*context*/, Gtk::SelectionData& data, guint /*info*/, guint /*time*/) { -#if WITH_GTKMM_3_0 - std::vector iconArray = iconView->get_selected_items(); -#else - Gtk::IconView::ArrayHandle_TreePaths iconArray = iconView->get_selected_items(); -#endif + auto iconArray = iconView->get_selected_items(); if( iconArray.empty() ) { //std::cout << " iconArray empty: huh? " << std::endl; @@ -455,11 +420,7 @@ SPDocument* SymbolsDialog::selectedSymbols() { Glib::ustring SymbolsDialog::selectedSymbolId() { -#if WITH_GTKMM_3_0 - std::vector iconArray = iconView->get_selected_items(); -#else - Gtk::IconView::ArrayHandle_TreePaths iconArray = iconView->get_selected_items(); -#endif + auto iconArray = iconView->get_selected_items(); if( !iconArray.empty() ) { Gtk::TreeModel::Path const & path = *iconArray.begin(); diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index c99c1bff3..be91ca8af 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -980,12 +980,8 @@ TagsPanel::TagsPanel() : _scroller.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); _scroller.set_shadow_type(Gtk::SHADOW_IN); Gtk::Requisition sreq; -#if WITH_GTKMM_3_0 Gtk::Requisition sreq_natural; _scroller.get_preferred_size(sreq_natural, sreq); -#else - sreq = _scroller.size_request(); -#endif int minHeight = 70; if (sreq.height < minHeight) { // Set a min height to see the layers when used with Ubuntu liboverlay-scrollbar diff --git a/src/ui/dialog/tags.h b/src/ui/dialog/tags.h index 3576bd111..bdda22dd4 100644 --- a/src/ui/dialog/tags.h +++ b/src/ui/dialog/tags.h @@ -141,15 +141,9 @@ private: Gtk::TreeView _tree; Gtk::CellRendererText *_text_renderer; Gtk::TreeView::Column *_name_column; -#if WITH_GTKMM_3_0 Gtk::Box _buttonsRow; Gtk::Box _buttonsPrimary; Gtk::Box _buttonsSecondary; -#else - Gtk::HBox _buttonsRow; - Gtk::HBox _buttonsPrimary; - Gtk::HBox _buttonsSecondary; -#endif Gtk::ScrolledWindow _scroller; Gtk::Menu _popupMenu; Inkscape::UI::Widget::SpinButton _spinBtn; diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index c01da8864..83b636ae2 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -99,9 +99,7 @@ TextEdit::TextEdit() styleButton(&align_right, _("Align right"), INKSCAPE_ICON("format-justify-right"), &align_left); styleButton(&align_justify, _("Justify (only flowed text)"), INKSCAPE_ICON("format-justify-fill"), &align_left); -#if WITH_GTKMM_3_0 align_sep.set_orientation(Gtk::ORIENTATION_VERTICAL); -#endif layout_hbox.pack_start(align_sep, false, false, 10); @@ -109,9 +107,7 @@ TextEdit::TextEdit() styleButton(&text_horizontal, _("Horizontal text"), INKSCAPE_ICON("format-text-direction-horizontal"), NULL); styleButton(&text_vertical, _("Vertical text"), INKSCAPE_ICON("format-text-direction-vertical"), &text_horizontal); -#if WITH_GTKMM_3_0 text_sep.set_orientation(Gtk::ORIENTATION_VERTICAL); -#endif layout_hbox.pack_start(text_sep, false, false, 10); @@ -146,12 +142,8 @@ TextEdit::TextEdit() gtk_widget_set_tooltip_text(startOffset, _("Text path offset")); -#if WITH_GTKMM_3_0 - Gtk::Separator *sep = Gtk::manage(new Gtk::Separator()); + auto sep = Gtk::manage(new Gtk::Separator()); sep->set_orientation(Gtk::ORIENTATION_VERTICAL); -#else - Gtk::VSeparator *sep = Gtk::manage(new Gtk::VSeparator); -#endif layout_hbox.pack_start(*sep, false, false, 10); layout_hbox.pack_start(*Gtk::manage(Glib::wrap(startOffset)), false, false); @@ -175,7 +167,6 @@ TextEdit::TextEdit() gtk_text_view_set_wrap_mode ((GtkTextView *) text_view, GTK_WRAP_WORD); #ifdef WITH_GTKSPELL -#ifdef WITH_GTKMM_3_0 /* TODO: Use computed xml:lang attribute of relevant element, if present, to specify the language (either as 2nd arg of gtkspell_new_attach, or with explicit @@ -187,20 +178,6 @@ TextEdit::TextEdit() if (! gtk_spell_checker_attach(speller, GTK_TEXT_VIEW(text_view))) { g_print("gtkspell error:\n"); } -#else - GError *error = NULL; - -/* - TODO: Use computed xml:lang attribute of relevant element, if present, to specify the - language (either as 2nd arg of gtkspell_new_attach, or with explicit - gtkspell_set_language call in; see advanced.c example in gtkspell docs). - onReadSelection looks like a suitable place. -*/ - if (gtkspell_new_attach(GTK_TEXT_VIEW(text_view), NULL, &error) == NULL) { - g_print("gtkspell error: %s\n", error->message); - g_error_free(error); - } -#endif #endif gtk_widget_set_size_request (text_view, -1, 64); diff --git a/src/ui/dialog/text-edit.h b/src/ui/dialog/text-edit.h index cfe612268..e974874d2 100644 --- a/src/ui/dialog/text-edit.h +++ b/src/ui/dialog/text-edit.h @@ -198,21 +198,10 @@ private: Gtk::RadioButton align_center; Gtk::RadioButton align_right; Gtk::RadioButton align_justify; - -#if WITH_GTKMM_3_0 Gtk::Separator align_sep; -#else - Gtk::VSeparator align_sep; -#endif - Gtk::RadioButton text_vertical; Gtk::RadioButton text_horizontal; - -#if WITH_GTKMM_3_0 Gtk::Separator text_sep; -#else - Gtk::VSeparator text_sep; -#endif GtkWidget *spacing_combo; diff --git a/src/ui/dialog/tile.h b/src/ui/dialog/tile.h index de1d3028b..2c29f85b8 100644 --- a/src/ui/dialog/tile.h +++ b/src/ui/dialog/tile.h @@ -29,12 +29,7 @@ namespace Gtk { class Button; - -#if WITH_GTKMM_3_0 class Grid; -#else -class Table; -#endif } namespace Inkscape { diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index b7638e8c1..72133f448 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -216,38 +216,20 @@ void Transformation::layoutPageMove() //_scalar_move_vertical.set_label_image( INKSCAPE_STOCK_ARROWS_HOR ); -#if WITH_GTKMM_3_0 _page_move.table().attach(_scalar_move_horizontal, 0, 0, 2, 1); _page_move.table().attach(_units_move, 2, 0, 1, 1); -#else - _page_move.table() - .attach(_scalar_move_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); - - _page_move.table() - .attach(_units_move, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); -#endif _scalar_move_horizontal.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onMoveValueChanged)); //_scalar_move_vertical.set_label_image( INKSCAPE_STOCK_ARROWS_VER ); -#if WITH_GTKMM_3_0 _page_move.table().attach(_scalar_move_vertical, 0, 1, 2, 1); -#else - _page_move.table() - .attach(_scalar_move_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); -#endif _scalar_move_vertical.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onMoveValueChanged)); // Relative moves -#if WITH_GTKMM_3_0 _page_move.table().attach(_check_move_relative, 0, 2, 2, 1); -#else - _page_move.table() - .attach(_check_move_relative, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK); -#endif _check_move_relative.set_active(true); _check_move_relative.signal_toggled() @@ -273,36 +255,18 @@ void Transformation::layoutPageScale() _scalar_scale_vertical.setAbsoluteIsIncrement(true); _scalar_scale_vertical.setPercentageIsIncrement(true); -#if WITH_GTKMM_3_0 _page_scale.table().attach(_scalar_scale_horizontal, 0, 0, 2, 1); -#else - _page_scale.table() - .attach(_scalar_scale_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); -#endif _scalar_scale_horizontal.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onScaleXValueChanged)); -#if WITH_GTKMM_3_0 _page_scale.table().attach(_units_scale, 2, 0, 1, 1); _page_scale.table().attach(_scalar_scale_vertical, 0, 1, 2, 1); -#else - _page_scale.table() - .attach(_units_scale, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - - _page_scale.table() - .attach(_scalar_scale_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); -#endif _scalar_scale_vertical.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onScaleYValueChanged)); -#if WITH_GTKMM_3_0 _page_scale.table().attach(_check_scale_proportional, 0, 2, 2, 1); -#else - _page_scale.table() - .attach(_check_scale_proportional, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK); -#endif _check_scale_proportional.set_active(false); _check_scale_proportional.signal_toggled() @@ -334,24 +298,10 @@ void Transformation::layoutPageRotate() Gtk::RadioButton::Group group = _counterclockwise_rotate.get_group(); _clockwise_rotate.set_group(group); -#if WITH_GTKMM_3_0 _page_rotate.table().attach(_scalar_rotate, 0, 0, 2, 1); _page_rotate.table().attach(_units_rotate, 2, 0, 1, 1); _page_rotate.table().attach(_counterclockwise_rotate, 3, 0, 1, 1); _page_rotate.table().attach(_clockwise_rotate, 4, 0, 1, 1); -#else - _page_rotate.table() - .attach(_scalar_rotate, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); - - _page_rotate.table() - .attach(_units_rotate, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - - _page_rotate.table() - .attach(_counterclockwise_rotate, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - - _page_rotate.table() - .attach(_clockwise_rotate, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK); -#endif Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (prefs->getBool("/dialogs/transformation/rotateCounterClockwise", TRUE)) { @@ -385,26 +335,13 @@ void Transformation::layoutPageSkew() _scalar_skew_vertical.setDigits(3); _scalar_skew_vertical.setIncrements(0.1, 1.0); -#if WITH_GTKMM_3_0 _page_skew.table().attach(_scalar_skew_horizontal, 0, 0, 2, 1); -#else - _page_skew.table() - .attach(_scalar_skew_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); -#endif _scalar_skew_horizontal.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onSkewValueChanged)); -#if WITH_GTKMM_3_0 _page_skew.table().attach(_units_skew, 2, 0, 1, 1); _page_skew.table().attach(_scalar_skew_vertical, 0, 1, 2, 1); -#else - _page_skew.table() - .attach(_units_skew, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - - _page_skew.table() - .attach(_scalar_skew_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); -#endif _scalar_skew_vertical.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onSkewValueChanged)); @@ -422,12 +359,7 @@ void Transformation::layoutPageTransform() _scalar_transform_a.setIncrements(0.1, 1.0); _scalar_transform_a.setValue(1.0); -#if WITH_GTKMM_3_0 _page_transform.table().attach(_scalar_transform_a, 0, 0, 1, 1); -#else - _page_transform.table() - .attach(_scalar_transform_a, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); -#endif _scalar_transform_a.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -438,12 +370,7 @@ void Transformation::layoutPageTransform() _scalar_transform_b.setIncrements(0.1, 1.0); _scalar_transform_b.setValue(0.0); -#if WITH_GTKMM_3_0 _page_transform.table().attach(_scalar_transform_b, 0, 1, 1, 1); -#else - _page_transform.table() - .attach(_scalar_transform_b, 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK); -#endif _scalar_transform_b.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -454,12 +381,7 @@ void Transformation::layoutPageTransform() _scalar_transform_c.setIncrements(0.1, 1.0); _scalar_transform_c.setValue(0.0); -#if WITH_GTKMM_3_0 _page_transform.table().attach(_scalar_transform_c, 1, 0, 1, 1); -#else - _page_transform.table() - .attach(_scalar_transform_c, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK); -#endif _scalar_transform_c.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -471,12 +393,7 @@ void Transformation::layoutPageTransform() _scalar_transform_d.setIncrements(0.1, 1.0); _scalar_transform_d.setValue(1.0); -#if WITH_GTKMM_3_0 _page_transform.table().attach(_scalar_transform_d, 1, 1, 1, 1); -#else - _page_transform.table() - .attach(_scalar_transform_d, 1, 2, 1, 2, Gtk::SHRINK, Gtk::SHRINK); -#endif _scalar_transform_d.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -488,12 +405,7 @@ void Transformation::layoutPageTransform() _scalar_transform_e.setIncrements(0.1, 1.0); _scalar_transform_e.setValue(0.0); -#if WITH_GTKMM_3_0 _page_transform.table().attach(_scalar_transform_e, 2, 0, 1, 1); -#else - _page_transform.table() - .attach(_scalar_transform_e, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); -#endif _scalar_transform_e.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -505,23 +417,13 @@ void Transformation::layoutPageTransform() _scalar_transform_f.setIncrements(0.1, 1.0); _scalar_transform_f.setValue(0.0); -#if WITH_GTKMM_3_0 _page_transform.table().attach(_scalar_transform_f, 2, 1, 1, 1); -#else - _page_transform.table() - .attach(_scalar_transform_f, 2, 3, 1, 2, Gtk::SHRINK, Gtk::SHRINK); -#endif _scalar_transform_f.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); // Edit existing matrix -#if WITH_GTKMM_3_0 _page_transform.table().attach(_check_replace_matrix, 0, 2, 2, 1); -#else - _page_transform.table() - .attach(_check_replace_matrix, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK); -#endif _check_replace_matrix.set_active(false); _check_replace_matrix.signal_toggled() @@ -568,11 +470,7 @@ void Transformation::updateSelection(PageType page, Inkscape::Selection *selecti selection && !selection->isEmpty()); } -#if WITH_GTKMM_3_0 void Transformation::onSwitchPage(Gtk::Widget * /*page*/, guint pagenum) -#else -void Transformation::onSwitchPage(GtkNotebookPage * /*page*/, guint pagenum) -#endif { updateSelection((PageType)pagenum, getDesktop()->getSelection()); } diff --git a/src/ui/dialog/transformation.h b/src/ui/dialog/transformation.h index 89aa95d90..9595e87bc 100644 --- a/src/ui/dialog/transformation.h +++ b/src/ui/dialog/transformation.h @@ -169,11 +169,7 @@ protected: virtual void _apply(); void presentPage(PageType page); -#if WITH_GTKMM_3_0 void onSwitchPage(Gtk::Widget *page, guint pagenum); -#else - void onSwitchPage(GtkNotebookPage *page, guint pagenum); -#endif /** * Callbacks for when a user changes values on the panels diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index a50a169eb..e7e68ed87 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -35,20 +35,11 @@ namespace UI { namespace Dialog { /* Rendering functions for custom cell renderers */ -#if WITH_GTKMM_3_0 void CellRendererSPIcon::render_vfunc(const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags) -#else -void CellRendererSPIcon::render_vfunc(const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags) -#endif { // if this event type doesn't have an icon... if ( !Inkscape::Verb::get(_property_event_type)->get_image() ) return; @@ -67,13 +58,8 @@ void CellRendererSPIcon::render_vfunc(const Glib::RefPtr& window, sp_icon_fetch_pixbuf(sp_icon); _property_icon = Glib::wrap(sp_icon->pb, true); } else if ( GTK_IS_IMAGE(icon->gobj()) ) { -#if WITH_GTKMM_3_0 _property_icon = Gtk::Invisible().render_icon_pixbuf(Gtk::StockID(image), Gtk::ICON_SIZE_MENU); -#else - _property_icon = Gtk::Invisible().render_icon(Gtk::StockID(image), - Gtk::ICON_SIZE_MENU); -#endif } else { delete icon; return; @@ -87,42 +73,23 @@ void CellRendererSPIcon::render_vfunc(const Glib::RefPtr& window, property_pixbuf() = _icon_cache[_property_event_type]; } -#if WITH_GTKMM_3_0 Gtk::CellRendererPixbuf::render_vfunc(cr, widget, background_area, cell_area, flags); -#else - Gtk::CellRendererPixbuf::render_vfunc(window, widget, background_area, - cell_area, expose_area, flags); -#endif } -#if WITH_GTKMM_3_0 void CellRendererInt::render_vfunc(const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags) -#else -void CellRendererInt::render_vfunc(const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags) -#endif { if( _filter(_property_number) ) { std::ostringstream s; s << _property_number << std::flush; property_text() = s.str(); -#if WITH_GTKMM_3_0 Gtk::CellRendererText::render_vfunc(cr, widget, background_area, cell_area, flags); -#else - Gtk::CellRendererText::render_vfunc(window, widget, background_area, - cell_area, expose_area, flags); -#endif } } diff --git a/src/ui/dialog/undo-history.h b/src/ui/dialog/undo-history.h index b0cc283cf..48929a0d0 100644 --- a/src/ui/dialog/undo-history.h +++ b/src/ui/dialog/undo-history.h @@ -50,20 +50,11 @@ public: property_event_type() { return _property_event_type.get_proxy(); } protected: -#if WITH_GTKMM_3_0 virtual void render_vfunc(const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags); -#else - virtual void render_vfunc(const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags); -#endif private: Glib::Property > _property_icon; @@ -95,20 +86,11 @@ public: static const Filter& no_filter; protected: -#if WITH_GTKMM_3_0 virtual void render_vfunc(const Cairo::RefPtr& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags); -#else - virtual void render_vfunc(const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags); -#endif private: diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index 99a4acc69..714d59c50 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -79,11 +79,7 @@ XmlTree::XmlTree (void) : xml_attribute_delete_button (_("Delete attribute")), text_container (), attr_container (), -#if WITH_GTKMM_3_0 attr_subpaned_container(Gtk::ORIENTATION_VERTICAL), -#else - attr_subpaned_container(), -#endif set_attr (_("Set")), new_window(NULL) { @@ -100,9 +96,7 @@ XmlTree::XmlTree (void) : status.set_alignment( 0.0, 0.5); status.set_size_request(1, -1); status.set_markup(""); -#if WITH_GTKMM_3_0 status.set_line_wrap(true); -#endif status_box.pack_start( status, TRUE, TRUE, 0); contents->pack_end(status_box, false, false, 2); @@ -881,31 +875,19 @@ void XmlTree::cmd_new_element_node() g_signal_connect(G_OBJECT(new_window), "destroy", gtk_main_quit, NULL); g_signal_connect(G_OBJECT(new_window), "key-press-event", G_CALLBACK(quit_on_esc), new_window); -#if GTK_CHECK_VERSION(3,0,0) vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE); -#else - vbox = gtk_vbox_new(FALSE, 4); -#endif gtk_container_add(GTK_CONTAINER(new_window), vbox); name_entry = new Gtk::Entry(); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(name_entry->gobj()), FALSE, TRUE, 0); -#if GTK_CHECK_VERSION(3,0,0) sep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); -#else - sep = gtk_hseparator_new(); -#endif gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, TRUE, 0); -#if GTK_CHECK_VERSION(3,0,0) bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); -#else - bbox = gtk_hbutton_box_new(); -#endif gtk_container_set_border_width(GTK_CONTAINER(bbox), 4); gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); diff --git a/src/ui/dialog/xml-tree.h b/src/ui/dialog/xml-tree.h index 58ef3aef8..a4c3fffcb 100644 --- a/src/ui/dialog/xml-tree.h +++ b/src/ui/dialog/xml-tree.h @@ -218,13 +218,7 @@ private: Gtk::Button *create_button; Gtk::Entry *name_entry; - -#if WITH_GTKMM_3_0 Gtk::Paned paned; -#else - Gtk::HPaned paned; -#endif - Gtk::VBox left_box; Gtk::VBox right_box; Gtk::HBox status_box; @@ -248,12 +242,7 @@ private: Gtk::ScrolledWindow text_container; Gtk::HBox attr_hbox; Gtk::VBox attr_container; - -#if WITH_GTKMM_3_0 Gtk::Paned attr_subpaned_container; -#else - Gtk::VPaned attr_subpaned_container; -#endif Gtk::Button set_attr; diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index 5e75179a3..8336467c4 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -18,12 +18,7 @@ #include #include #include - -#if WITH_GTKMM_3_0 -# include -#else -# include -#endif +#include #define COLUMNS_FOR_SMALL 16 #define COLUMNS_FOR_LARGE 8 @@ -55,7 +50,6 @@ PreviewHolder::PreviewHolder() : ((Gtk::ScrolledWindow *)_scroller)->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); -#if WITH_GTKMM_3_0 _insides = Gtk::manage(new Gtk::Grid()); _insides->set_name( "PreviewHolderGrid" ); _insides->set_column_spacing(8); @@ -66,21 +60,9 @@ PreviewHolder::PreviewHolder() : _scroller->set_hexpand(); _scroller->set_vexpand(); -#else - _insides = Gtk::manage(new Gtk::Table( 1, 2 )); - _insides->set_col_spacings( 8 ); - - // Add a container with the scroller and a spacer - Gtk::Table* spaceHolder = Gtk::manage( new Gtk::Table(1, 2) ); -#endif - _scroller->add( *_insides ); -#if WITH_GTKMM_3_0 spaceHolder->attach( *_scroller, 0, 0, 1, 1); -#else - spaceHolder->attach( *_scroller, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); -#endif pack_start(*spaceHolder, Gtk::PACK_EXPAND_WIDGET); } @@ -93,11 +75,7 @@ PreviewHolder::~PreviewHolder() bool PreviewHolder::on_scroll_event(GdkEventScroll *event) { // Scroll horizontally by page on mouse wheel -#if WITH_GTKMM_3_0 - Glib::RefPtr adj = dynamic_cast(_scroller)->get_hadjustment(); -#else - Gtk::Adjustment *adj = dynamic_cast(_scroller)->get_hadjustment(); -#endif + auto adj = dynamic_cast(_scroller)->get_hadjustment(); if (!adj) { return FALSE; @@ -141,7 +119,6 @@ void PreviewHolder::addPreview( Previewable* preview ) Gtk::Widget* label = Gtk::manage(preview->getPreview(PREVIEW_STYLE_BLURB, VIEW_TYPE_LIST, _baseSize, _ratio, _border)); Gtk::Widget* thing = Gtk::manage(preview->getPreview(PREVIEW_STYLE_PREVIEW, VIEW_TYPE_LIST, _baseSize, _ratio, _border)); -#if WITH_GTKMM_3_0 thing->set_hexpand(); thing->set_vexpand(); _insides->attach(*thing, 0, i, 1, 1); @@ -149,10 +126,6 @@ void PreviewHolder::addPreview( Previewable* preview ) label->set_hexpand(); label->set_valign(Gtk::ALIGN_CENTER); _insides->attach(*label, 1, i, 1, 1); -#else - _insides->attach( *thing, 0, 1, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); - _insides->attach( *label, 1, 2, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK ); -#endif } break; @@ -168,44 +141,25 @@ void PreviewHolder::addPreview( Previewable* preview ) int col = i % width; int row = i / width; -#if !WITH_GTKMM_3_0 - // If the existing grid isn't wide enough, we need to resize - // it and re-pack the existing widgets - if ( _insides && width > (int)_insides->property_n_columns() ) { - _insides->resize( height, width ); -#endif - std::vectorkids = _insides->get_children(); - int childCount = (int)kids.size(); - // g_message(" %3d resize from %d to %d (r:%d, c:%d) with %d children", i, oldWidth, width, row, col, childCount ); - - // Loop through the existing widgets and move them to new location - for ( int j = 1; j < childCount; j++ ) { - Gtk::Widget* target = kids[childCount - (j + 1)]; - int col2 = j % width; - int row2 = j / width; - Glib::RefPtr handle(target); - _insides->remove( *target ); - -#if WITH_GTKMM_3_0 - target->set_hexpand(); - target->set_vexpand(); - _insides->attach( *target, col2, row2, 1, 1); -#else - _insides->attach( *target, col2, col2+1, row2, row2+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); -#endif - } -#if WITH_GTKMM_3_0 - thing->set_hexpand(); - thing->set_vexpand(); - _insides->attach(*thing, col, row, 1, 1); -#else - } else if ( col == 0 ) { - // we just started a new row - _insides->resize( row + 1, width ); - } - - _insides->attach( *thing, col, col+1, row, row+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); -#endif + auto kids = _insides->get_children(); + int childCount = (int)kids.size(); + // g_message(" %3d resize from %d to %d (r:%d, c:%d) with %d children", i, oldWidth, width, row, col, childCount ); + + // Loop through the existing widgets and move them to new location + for ( int j = 1; j < childCount; j++ ) { + auto target = kids[childCount - (j + 1)]; + int col2 = j % width; + int row2 = j / width; + Glib::RefPtr handle(target); + _insides->remove( *target ); + + target->set_hexpand(); + target->set_vexpand(); + _insides->attach( *target, col2, row2, 1, 1); + } + thing->set_hexpand(); + thing->set_vexpand(); + _insides->attach(*thing, col, row, 1, 1); } } @@ -416,21 +370,11 @@ void PreviewHolder::rebuildUI() switch(_view) { case VIEW_TYPE_LIST: { - -#if WITH_GTKMM_3_0 _insides = Gtk::manage(new Gtk::Grid()); _insides->set_column_spacing(8); -#else - _insides = Gtk::manage(new Gtk::Table( 1, 2 )); - _insides->set_col_spacings( 8 ); -#endif if (_border == BORDER_WIDE) { -#if WITH_GTKMM_3_0 _insides->set_row_spacing(1); -#else - _insides->set_row_spacings( 1 ); -#endif } for ( unsigned int i = 0; i < items.size(); i++ ) { @@ -439,7 +383,6 @@ void PreviewHolder::rebuildUI() Gtk::Widget* thing = Gtk::manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, _view, _baseSize, _ratio, _border)); -#if WITH_GTKMM_3_0 thing->set_hexpand(); thing->set_vexpand(); _insides->attach(*thing, 0, i, 1, 1); @@ -447,10 +390,6 @@ void PreviewHolder::rebuildUI() label->set_hexpand(); label->set_valign(Gtk::ALIGN_CENTER); _insides->attach(*label, 1, i, 1, 1); -#else - _insides->attach( *thing, 0, 1, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); - _insides->attach( *label, 1, 2, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK ); -#endif } _scroller->add( *_insides ); @@ -473,28 +412,16 @@ void PreviewHolder::rebuildUI() if ( !_insides ) { calcGridSize( thing, items.size(), width, height ); -#if WITH_GTKMM_3_0 _insides = Gtk::manage(new Gtk::Grid()); if (_border == BORDER_WIDE) { _insides->set_column_spacing(1); _insides->set_row_spacing(1); } -#else - _insides = Gtk::manage(new Gtk::Table( height, width )); - if (_border == BORDER_WIDE) { - _insides->set_col_spacings( 1 ); - _insides->set_row_spacings( 1 ); - } -#endif } -#if WITH_GTKMM_3_0 thing->set_hexpand(); thing->set_vexpand(); _insides->attach( *thing, col, row, 1, 1); -#else - _insides->attach( *thing, col, col+1, row, row+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); -#endif if ( ++col >= width ) { col = 0; @@ -502,11 +429,7 @@ void PreviewHolder::rebuildUI() } } if ( !_insides ) { -#if WITH_GTKMM_3_0 _insides = Gtk::manage(new Gtk::Grid()); -#else - _insides = Gtk::manage(new Gtk::Table( 1, 2 )); -#endif } _scroller->add( *_insides ); diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h index 28c0fd865..d370e8fc8 100644 --- a/src/ui/previewholder.h +++ b/src/ui/previewholder.h @@ -21,11 +21,7 @@ #include namespace Gtk { -#if WITH_GTKMM_3_0 class Grid; -#else -class Table; -#endif } #include "previewfillable.h" @@ -68,12 +64,7 @@ private: std::vector items; Gtk::Bin *_scroller; - -#if WITH_GTKMM_3_0 Gtk::Grid *_insides; -#else - Gtk::Table *_insides; -#endif int _prefCols; bool _updatesFrozen; diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 72ba499de..17debb59c 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -149,16 +149,10 @@ void ToolBase::sp_event_context_set_cursor(GdkCursorType cursor_type) { GdkDisplay *display = gdk_display_get_default(); GdkCursor *cursor = gdk_cursor_new_for_display(display, cursor_type); -#if WITH_GTKMM_3_0 if (cursor) { gdk_window_set_cursor (gtk_widget_get_window (w), cursor); g_object_unref (cursor); } -#else - gdk_window_set_cursor (gtk_widget_get_window (w), cursor); - gdk_cursor_unref (cursor); -#endif - } /** -- cgit v1.2.3 From 49a7927ecf31ace696e9e5770e8d6543c356db7a Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 28 Jul 2016 19:15:34 +0100 Subject: Finish removing GTK+ 2 fallbacks (bzr r15023.2.8) --- src/ui/dialog/export.cpp | 5 -- src/ui/dialog/font-substitution.cpp | 6 +- src/ui/interface.cpp | 32 +-------- src/ui/previewholder.cpp | 22 +----- src/ui/tools/dropper-tool.cpp | 8 --- src/ui/tools/select-tool.cpp | 8 --- src/ui/tools/tool-base.cpp | 16 ----- src/ui/widget/dock-item.h | 4 -- src/ui/widget/gimpcolorwheel.c | 137 ------------------------------------ src/ui/widget/selected-style.cpp | 8 --- src/ui/widget/spinbutton.h | 4 -- 11 files changed, 3 insertions(+), 247 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 5e7c68985..5167ca2a2 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -67,12 +67,7 @@ #include "helper/png-write.h" -#if WITH_EXT_GDL #include -#else -#include "libgdl/gdl-dock-item.h" -#endif - // required to set status message after export #include "desktop.h" diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index f219f3db6..18a7241a4 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -106,11 +106,7 @@ FontSubstitution::show(Glib::ustring out, std::vector &l) cbWarning->set_label(_("Don't show this warning again")); cbWarning->show(); -#if GTK_CHECK_VERSION(3,0,0) - Gtk::Box * box = warning.get_content_area(); -#else - Gtk::Box * box = warning.get_vbox(); -#endif + auto box = warning.get_content_area(); box->set_spacing(2); box->pack_start(*scrollwindow, true, true, 4); box->pack_start(*cbSelect, false, false, 0); diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index ab29471ed..1d2fa5b34 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -79,9 +79,7 @@ #include "message-stack.h" #include "ui/dialog/layer-properties.h" -#if GTK_CHECK_VERSION(3,0,0) - #include "widgets/image-menu-item.h" -#endif +#include "widgets/image-menu-item.h" #include @@ -417,11 +415,7 @@ sp_ui_menuitem_add_icon( GtkWidget *item, gchar *icon_name ) icon = sp_icon_new( Inkscape::ICON_SIZE_MENU, icon_name ); gtk_widget_show(icon); -#if GTK_CHECK_VERSION(3,0,0) image_menu_item_set_image((ImageMenuItem *) item, icon); -#else - gtk_image_menu_item_set_image((GtkImageMenuItem *) item, icon); -#endif } // end of sp_ui_menu_add_icon void @@ -475,11 +469,7 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb if (radio) { item = gtk_radio_menu_item_new_with_mnemonic(group, action->name); } else { -#if GTK_CHECK_VERSION(3,0,0) item = image_menu_item_new_with_mnemonic(action->name); -#else - item = gtk_image_menu_item_new_with_mnemonic(action->name); -#endif } gtk_label_set_markup_with_mnemonic( GTK_LABEL(gtk_bin_get_child(GTK_BIN (item))), action->name); @@ -570,11 +560,7 @@ static bool getViewStateFromPref(Inkscape::UI::View::View *view, gchar const *pr return prefs->getBool(pref_path, true); } -#if GTK_CHECK_VERSION(3,0,0) static gboolean checkitem_update(GtkWidget *widget, cairo_t * /*cr*/, gpointer user_data) -#else -static gboolean checkitem_update(GtkWidget *widget, GdkEventExpose * /*event*/, gpointer user_data) -#endif { GtkCheckMenuItem *menuitem=GTK_CHECK_MENU_ITEM(widget); @@ -631,11 +617,7 @@ static void taskToggled(GtkCheckMenuItem *menuitem, gpointer userData) /** * Callback function to update the status of the radio buttons in the View -> Display mode menu (Normal, No Filters, Outline) and Color display mode. */ -#if GTK_CHECK_VERSION(3,0,0) static gboolean update_view_menu(GtkWidget *widget, cairo_t * /*cr*/, gpointer user_data) -#else -static gboolean update_view_menu(GtkWidget *widget, GdkEventExpose * /*event*/, gpointer user_data) -#endif { SPAction *action = (SPAction *) user_data; g_assert(action->id != NULL); @@ -679,11 +661,7 @@ static gboolean update_view_menu(GtkWidget *widget, GdkEventExpose * /*event*/, static void sp_ui_menu_append_check_item_from_verb(GtkMenu *menu, Inkscape::UI::View::View *view, gchar const *label, gchar const *tip, gchar const *pref, void (*callback_toggle)(GtkCheckMenuItem *, gpointer user_data), -#if GTK_CHECK_VERSION(3,0,0) gboolean (*callback_update)(GtkWidget *widget, cairo_t *cr, gpointer user_data), -#else - gboolean (*callback_update)(GtkWidget *widget, GdkEventExpose *event, gpointer user_data), -#endif Inkscape::Verb *verb) { unsigned int shortcut = (verb) ? sp_shortcut_get_primary(verb) : 0; @@ -707,11 +685,7 @@ sp_ui_menu_append_check_item_from_verb(GtkMenu *menu, Inkscape::UI::View::View * g_signal_connect( G_OBJECT(item), "toggled", (GCallback) callback_toggle, (void *) pref); -#if GTK_CHECK_VERSION(3,0,0) g_signal_connect( G_OBJECT(item), "draw", (GCallback) callback_update, (void *) pref); -#else - g_signal_connect( G_OBJECT(item), "expose_event", (GCallback) callback_update, (void *) pref); -#endif (*callback_update)(item, NULL, (void *)pref); @@ -854,11 +828,7 @@ static void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, I } if (verb->get_code() != SP_VERB_NONE) { SPAction *action = verb->get_action(Inkscape::ActionContext(view)); -#if GTK_CHECK_VERSION(3,0,0) g_signal_connect( G_OBJECT(item), "draw", (GCallback) update_view_menu, (void *) action); -#else - g_signal_connect( G_OBJECT(item), "expose_event", (GCallback) update_view_menu, (void *) action); -#endif } } else if (menu_pntr->attribute("check") != NULL) { if (verb->get_code() != SP_VERB_NONE) { diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index 8336467c4..bb7f077b0 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -259,12 +259,8 @@ void PreviewHolder::on_size_allocate( Gtk::Allocation& allocation ) if ( _insides && !_wrap && (_view != VIEW_TYPE_LIST) && (_anchor == SP_ANCHOR_NORTH || _anchor == SP_ANCHOR_SOUTH) ) { Gtk::Requisition req; -#if GTK_CHECK_VERSION(3,0,0) Gtk::Requisition req_natural; _insides->get_preferred_size(req, req_natural); -#else - req = _insides->size_request(); -#endif gint delta = allocation.get_width() - req.width; if ( (delta > 4) && req.height < allocation.get_height() ) { @@ -306,43 +302,27 @@ void PreviewHolder::calcGridSize( const Gtk::Widget* thing, int itemCount, int& if ( _anchor == SP_ANCHOR_SOUTH || _anchor == SP_ANCHOR_NORTH ) { Gtk::Requisition req; -#if GTK_CHECK_VERSION(3,0,0) Gtk::Requisition req_natural; _scroller->get_preferred_size(req, req_natural); -#else - req = _scroller->size_request(); -#endif int currW = _scroller->get_width(); if ( currW > req.width ) { req.width = currW; } -#if GTK_CHECK_VERSION(3,0,0) - Gtk::Scrollbar* hs = dynamic_cast(_scroller)->get_hscrollbar(); -#else - Gtk::HScrollbar* hs = dynamic_cast(_scroller)->get_hscrollbar(); -#endif + auto hs = dynamic_cast(_scroller)->get_hscrollbar(); if ( hs ) { Gtk::Requisition scrollReq; -#if GTK_CHECK_VERSION(3,0,0) Gtk::Requisition scrollReq_natural; hs->get_preferred_size(scrollReq, scrollReq_natural); -#else - scrollReq = hs->size_request(); -#endif // the +8 is a temporary hack req.height -= scrollReq.height + 8; } Gtk::Requisition req2; -#if GTK_CHECK_VERSION(3,0,0) Gtk::Requisition req2_natural; const_cast(thing)->get_preferred_size(req2, req2_natural); -#else - req2 = const_cast(thing)->size_request(); -#endif int h2 = ((req2.height > 0) && (req.height > req2.height)) ? (req.height / req2.height) : 1; int w2 = ((req2.width > 0) && (req.width > req2.width)) ? (req.width / req2.width) : 1; diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp index c838c27d5..fbc5f088c 100644 --- a/src/ui/tools/dropper-tool.cpp +++ b/src/ui/tools/dropper-tool.cpp @@ -121,20 +121,12 @@ void DropperTool::finish() { } if (cursor_dropper_fill) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(cursor_dropper_fill); -#else - gdk_cursor_unref (cursor_dropper_fill); -#endif cursor_dropper_fill = NULL; } if (cursor_dropper_stroke) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(cursor_dropper_stroke); -#else - gdk_cursor_unref (cursor_dropper_stroke); -#endif cursor_dropper_fill = NULL; } diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index b5ec3d88e..b29fb6979 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -128,20 +128,12 @@ SelectTool::~SelectTool() { this->_describer = NULL; if (CursorSelectDragging) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(CursorSelectDragging); -#else - gdk_cursor_unref (CursorSelectDragging); -#endif CursorSelectDragging = NULL; } if (CursorSelectMouseover) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(CursorSelectMouseover); -#else - gdk_cursor_unref (CursorSelectMouseover); -#endif CursorSelectMouseover = NULL; } } diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 17debb59c..d504d82eb 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -118,11 +118,7 @@ ToolBase::~ToolBase() { } if (this->cursor != NULL) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(this->cursor); -#else - gdk_cursor_unref(this->cursor); -#endif this->cursor = NULL; } @@ -182,11 +178,7 @@ void ToolBase::sp_event_context_update_cursor() { ); if (pixbuf != NULL) { if (this->cursor) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(this->cursor); -#else - gdk_cursor_unref(this->cursor); -#endif } this->cursor = gdk_cursor_new_from_pixbuf(display, pixbuf, this->hot_x, this->hot_y); g_object_unref(pixbuf); @@ -196,11 +188,7 @@ void ToolBase::sp_event_context_update_cursor() { if (pixbuf) { if (this->cursor) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(this->cursor); -#else - gdk_cursor_unref(this->cursor); -#endif } this->cursor = gdk_cursor_new_from_pixbuf(display, pixbuf, this->hot_x, this->hot_y); @@ -771,11 +759,9 @@ bool ToolBase::root_handler(GdkEvent* event) { int const wheel_scroll = prefs->getIntLimited( "/options/wheelscroll/value", 40, 0, 1000); -#if GTK_CHECK_VERSION(3,0,0) // Size of smooth-scrolls (only used in GTK+ 3) gdouble delta_x = 0; gdouble delta_y = 0; -#endif /* shift + wheel, pan left--right */ if (event->scroll.state & GDK_SHIFT_MASK) { @@ -836,12 +822,10 @@ bool ToolBase::root_handler(GdkEvent* event) { desktop->scroll_world(-wheel_scroll, 0); break; -#if GTK_CHECK_VERSION(3,0,0) case GDK_SCROLL_SMOOTH: gdk_event_get_scroll_deltas(event, &delta_x, &delta_y); desktop->scroll_world(delta_x, delta_y); break; -#endif } } break; diff --git a/src/ui/widget/dock-item.h b/src/ui/widget/dock-item.h index 25a69d94c..2df45b207 100644 --- a/src/ui/widget/dock-item.h +++ b/src/ui/widget/dock-item.h @@ -19,11 +19,7 @@ #include #include -#if WITH_EXT_GDL #include -#else -#include "libgdl/gdl.h" -#endif namespace Gtk { class HButtonBox; diff --git a/src/ui/widget/gimpcolorwheel.c b/src/ui/widget/gimpcolorwheel.c index d54486505..212391497 100644 --- a/src/ui/widget/gimpcolorwheel.c +++ b/src/ui/widget/gimpcolorwheel.c @@ -110,7 +110,6 @@ static gboolean gimp_color_wheel_button_release (GtkWidget *widget, GdkEventButton *event); static gboolean gimp_color_wheel_motion (GtkWidget *widget, GdkEventMotion *event); -#if GTK_CHECK_VERSION(3,0,0) static gboolean gimp_color_wheel_draw (GtkWidget *widget, cairo_t *cr); static void gimp_color_wheel_get_preferred_width (GtkWidget *widget, @@ -119,13 +118,6 @@ static void gimp_color_wheel_get_preferred_width (GtkWidget *widget, static void gimp_color_wheel_get_preferred_height (GtkWidget *widget, gint *minimum_height, gint *natural_height); -#else -static gboolean gimp_color_wheel_expose (GtkWidget *widget, - GdkEventExpose *event); -static void gimp_color_wheel_size_request (GtkWidget *widget, - GtkRequisition *requisition); -#endif - static gboolean gimp_color_wheel_grab_broken (GtkWidget *widget, GdkEventGrabBroken *event); static gboolean gimp_color_wheel_focus (GtkWidget *widget, @@ -157,16 +149,9 @@ gimp_color_wheel_class_init (GimpColorWheelClass *class) widget_class->button_press_event = gimp_color_wheel_button_press; widget_class->button_release_event = gimp_color_wheel_button_release; widget_class->motion_notify_event = gimp_color_wheel_motion; - -#if GTK_CHECK_VERSION(3,0,0) widget_class->get_preferred_width = gimp_color_wheel_get_preferred_width; widget_class->get_preferred_height = gimp_color_wheel_get_preferred_height; widget_class->draw = gimp_color_wheel_draw; -#else - widget_class->size_request = gimp_color_wheel_size_request; - widget_class->expose_event = gimp_color_wheel_expose; -#endif - widget_class->focus = gimp_color_wheel_focus; widget_class->grab_broken_event = gimp_color_wheel_grab_broken; @@ -302,10 +287,6 @@ gimp_color_wheel_realize (GtkWidget *widget) priv->window = gdk_window_new (parent_window, &attr, attr_mask); gdk_window_set_user_data (priv->window, wheel); - -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_style_attach (widget); -#endif } static void @@ -321,7 +302,6 @@ gimp_color_wheel_unrealize (GtkWidget *widget) GTK_WIDGET_CLASS (parent_class)->unrealize (widget); } -#if GTK_CHECK_VERSION(3,0,0) static void gimp_color_wheel_get_preferred_width (GtkWidget *widget, gint *minimum_width, @@ -353,23 +333,6 @@ gimp_color_wheel_get_preferred_height (GtkWidget *widget, *minimum_height = *natural_height = DEFAULT_SIZE + 2 * (focus_width + focus_pad); } -#else -static void -gimp_color_wheel_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - gint focus_width; - gint focus_pad; - - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); - - requisition->width = DEFAULT_SIZE + 2 * (focus_width + focus_pad); - requisition->height = DEFAULT_SIZE + 2 * (focus_width + focus_pad); -} -#endif static void gimp_color_wheel_size_allocate (GtkWidget *widget, @@ -688,7 +651,6 @@ set_cross_grab (GimpColorWheel *wheel, gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (wheel)), GDK_CROSSHAIR); -#if GTK_CHECK_VERSION(3,0,0) gdk_device_grab (gtk_get_current_event_device(), priv->window, GDK_OWNERSHIP_NONE, @@ -698,14 +660,6 @@ set_cross_grab (GimpColorWheel *wheel, GDK_BUTTON_RELEASE_MASK, cursor, time); g_object_unref (cursor); -#else - gdk_pointer_grab (priv->window, FALSE, - GDK_POINTER_MOTION_MASK | - GDK_POINTER_MOTION_HINT_MASK | - GDK_BUTTON_RELEASE_MASK, - NULL, cursor, time); - gdk_cursor_unref (cursor); -#endif } static gboolean gimp_color_wheel_grab_broken(GtkWidget *widget, GdkEventGrabBroken *event) @@ -805,13 +759,8 @@ gimp_color_wheel_button_release (GtkWidget *widget, else g_assert_not_reached (); -#if GTK_CHECK_VERSION(3,0,0) gdk_device_ungrab (gtk_get_current_event_device(), event->time); -#else - gdk_display_pointer_ungrab (gdk_window_get_display (event->window), - event->time); -#endif return TRUE; } @@ -859,11 +808,7 @@ static void paint_ring (GimpColorWheel *wheel, cairo_t *cr) { -#if GTK_CHECK_VERSION(3,0,0) GtkWidget *widget = GTK_WIDGET (wheel); -#else - GtkAllocation allocation; -#endif GimpColorWheelPrivate *priv = wheel->priv; gint width, height; gint xx, yy; @@ -879,14 +824,8 @@ paint_ring (GimpColorWheel *wheel, cairo_t *source_cr; gint stride; -#if GTK_CHECK_VERSION(3,0,0) width = gtk_widget_get_allocated_width (widget); height = gtk_widget_get_allocated_height (widget); -#else - gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation); - width = allocation.width; - height = allocation.height; -#endif center_x = width / 2.0; center_y = height / 2.0; @@ -1027,19 +966,10 @@ paint_triangle (GimpColorWheel *wheel, gdouble r, g, b; gint stride; gint width, height; -#if GTK_CHECK_VERSION(3,0,0) GtkStyleContext *context; width = gtk_widget_get_allocated_width (widget); height = gtk_widget_get_allocated_height (widget); -#else - gchar *detail; - - GtkAllocation allocation; - gtk_widget_get_allocation (widget, &allocation); - width = allocation.width; - height = allocation.height; -#endif /* Compute triangle's vertices */ @@ -1180,28 +1110,18 @@ paint_triangle (GimpColorWheel *wheel, b = priv->v; hsv_to_rgb (&r, &g, &b); -#if GTK_CHECK_VERSION(3,0,0) context = gtk_widget_get_style_context (widget); gtk_style_context_save (context); -#endif if (INTENSITY (r, g, b) > 0.5) { -#if GTK_CHECK_VERSION(3,0,0) gtk_style_context_add_class (context, "light-area-focus"); -#else - detail = "colorwheel_light"; -#endif cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); } else { -#if GTK_CHECK_VERSION(3,0,0) gtk_style_context_add_class (context, "dark-area-focus"); -#else - detail = "colorwheel_dark"; -#endif cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); } @@ -1224,31 +1144,16 @@ paint_triangle (GimpColorWheel *wheel, "focus-padding", &focus_pad, NULL); -#if GTK_CHECK_VERSION(3,0,0) gtk_render_focus (context, cr, xx - FOCUS_RADIUS - focus_width - focus_pad, yy - FOCUS_RADIUS - focus_width - focus_pad, 2 * (FOCUS_RADIUS + focus_width + focus_pad), 2 * (FOCUS_RADIUS + focus_width + focus_pad)); -#else - gtk_widget_get_allocation (widget, &allocation); - gtk_paint_focus (gtk_widget_get_style (widget), - gtk_widget_get_window (widget), - gtk_widget_get_state (widget), - NULL, widget, detail, - allocation.x + xx - FOCUS_RADIUS - focus_width - focus_pad, - allocation.y + yy - FOCUS_RADIUS - focus_width - focus_pad, - 2 * (FOCUS_RADIUS + focus_width + focus_pad), - 2 * (FOCUS_RADIUS + focus_width + focus_pad)); -#endif } -#if GTK_CHECK_VERSION(3,0,0) gtk_style_context_restore (context); -#endif } -#if GTK_CHECK_VERSION(3,0,0) static gboolean gimp_color_wheel_draw (GtkWidget *widget, cairo_t *cr) @@ -1273,48 +1178,6 @@ gimp_color_wheel_draw (GtkWidget *widget, return FALSE; } -#else -static gint -gimp_color_wheel_expose (GtkWidget *widget, - GdkEventExpose *event) -{ - cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); - - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - gboolean draw_focus; - GtkAllocation allocation; - - if (! (event->window == gtk_widget_get_window (widget) && - gtk_widget_is_drawable (widget))) - return FALSE; - - gdk_cairo_region (cr, event->region); - cairo_clip (cr); - - gtk_widget_get_allocation (widget, &allocation); - cairo_translate (cr, allocation.x, allocation.y); - - draw_focus = gtk_widget_has_focus (widget); - - paint_ring (wheel, cr); - paint_triangle (wheel, cr, draw_focus); - - cairo_destroy (cr); - - if (draw_focus && priv->focus_on_ring) - gtk_paint_focus (gtk_widget_get_style (widget), - gtk_widget_get_window (widget), - gtk_widget_get_state (widget), - &event->area, widget, NULL, - allocation.x, - allocation.y, - allocation.width, - allocation.height); - - return FALSE; -} -#endif static gboolean gimp_color_wheel_focus (GtkWidget *widget, diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index 7679fadb4..418cd13ae 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -1320,11 +1320,7 @@ RotateableSwatch::do_motion(double by, guint modifier) { g_object_unref(pixbuf); gdk_window_set_cursor(gtk_widget_get_window(w), cr); -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(cr); -#else - gdk_cursor_unref(cr); -#endif cr = NULL; cr_set = true; } @@ -1388,11 +1384,7 @@ RotateableSwatch::do_release(double by, guint modifier) { GtkWidget *w = GTK_WIDGET(gobj()); gdk_window_set_cursor(gtk_widget_get_window(w), NULL); if (cr) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(cr); -#else - gdk_cursor_unref (cr); -#endif cr = NULL; } cr_set = false; diff --git a/src/ui/widget/spinbutton.h b/src/ui/widget/spinbutton.h index 30ffc7d77..ae571994b 100644 --- a/src/ui/widget/spinbutton.h +++ b/src/ui/widget/spinbutton.h @@ -36,11 +36,7 @@ public: { connect_signals(); }; -#if GTK_CHECK_VERSION(3,0,0) explicit SpinButton(Glib::RefPtr& adjustment, double climb_rate = 0.0, guint digits = 0) -#else - explicit SpinButton(Gtk::Adjustment& adjustment, double climb_rate = 0.0, guint digits = 0) -#endif : Gtk::SpinButton(adjustment, climb_rate, digits), _unit_menu(NULL), _unit_tracker(NULL), -- cgit v1.2.3 From 53500549df51879d6a7aaec5a0c8c37ca7087817 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 29 Jul 2016 20:28:00 +0200 Subject: Add orientation and alow unsort combobox enum widget (bzr r15017.1.12) --- src/ui/widget/combo-enums.h | 9 +++++---- src/ui/widget/registered-enums.h | 6 +++--- src/ui/widget/registered-widget.h | 2 ++ 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src/ui') diff --git a/src/ui/widget/combo-enums.h b/src/ui/widget/combo-enums.h index 4678ab83b..e7524ac71 100644 --- a/src/ui/widget/combo-enums.h +++ b/src/ui/widget/combo-enums.h @@ -16,7 +16,6 @@ #include #include "attr-widget.h" #include "util/enums.h" - #include namespace Inkscape { @@ -190,9 +189,11 @@ public: const Util::EnumDataConverter& c, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", - bool mnemonic = true) - : Labelled(label, tooltip, new ComboBoxEnum(c), suffix, icon, mnemonic) - { } + bool mnemonic = true, + bool sorted = true) + : Labelled(label, tooltip, new ComboBoxEnum(c, SP_ATTR_INVALID, sorted), suffix, icon, mnemonic) + { + } ComboBoxEnum* getCombobox() { return static_cast< ComboBoxEnum* > (_widget); diff --git a/src/ui/widget/registered-enums.h b/src/ui/widget/registered-enums.h index 9e1682c7d..1d5074836 100644 --- a/src/ui/widget/registered-enums.h +++ b/src/ui/widget/registered-enums.h @@ -33,11 +33,11 @@ public: const Util::EnumDataConverter& c, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ) - : RegisteredWidget< LabelledComboBoxEnum >(label, tip, c) + SPDocument *doc_in = NULL, + bool sorted = true ) + : RegisteredWidget< LabelledComboBoxEnum >(label, tip, c, (const Glib::ustring &)"", (const Glib::ustring &)"", true, sorted) { RegisteredWidget< LabelledComboBoxEnum >::init_parent(key, wr, repr_in, doc_in); - _changed_connection = combobox()->signal_changed().connect (sigc::mem_fun (*this, &RegisteredEnum::on_changed)); } diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index 3c8205058..2b4d98b88 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -78,6 +78,8 @@ protected: RegisteredWidget( A& a, B& b, C c, D d ): W( a, b, c, d ) { construct(); } template< typename A, typename B, typename C, typename D, typename E , typename F> RegisteredWidget( A& a, B& b, C c, D& d, E& e, F* f): W( a, b, c, d, e, f) { construct(); } + template< typename A, typename B, typename C, typename D, typename E , typename F, typename G> + RegisteredWidget( A& a, B& b, C& c, D& d, E& e, F f, G& g): W( a, b, c, d, e, f, g) { construct(); } virtual ~RegisteredWidget() {}; -- cgit v1.2.3 From d60fb000cfc3717ef51b716d9ccb9b63ecb38aa8 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 30 Jul 2016 01:44:17 +0200 Subject: Remove font-Dialog and useGtk::FontSelector instead (bzr r15017.1.13) --- src/ui/CMakeLists.txt | 4 +- src/ui/widget/Makefile_insert | 4 +- src/ui/widget/font-button.cpp | 58 ++++++++++++++++++ src/ui/widget/font-button.h | 63 ++++++++++++++++++++ src/ui/widget/font-selector.cpp | 115 ------------------------------------ src/ui/widget/font-selector.h | 82 ------------------------- src/ui/widget/registered-widget.cpp | 24 ++++---- src/ui/widget/registered-widget.h | 12 ++-- 8 files changed, 142 insertions(+), 220 deletions(-) create mode 100644 src/ui/widget/font-button.cpp create mode 100644 src/ui/widget/font-button.h delete mode 100644 src/ui/widget/font-selector.cpp delete mode 100644 src/ui/widget/font-selector.h (limited to 'src/ui') diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 62f341962..af375f1f9 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -128,7 +128,7 @@ set(ui_SRC widget/entity-entry.cpp widget/entry.cpp widget/filter-effect-chooser.cpp - widget/font-selector.cpp + widget/font-button.cpp widget/font-variants.cpp widget/frame.cpp widget/gimpcolorwheel.c @@ -313,7 +313,7 @@ set(ui_SRC widget/entity-entry.h widget/entry.h widget/filter-effect-chooser.h - widget/font-selector.h + widget/font-button.h widget/font-variants.h widget/frame.h widget/gimpspinscale.h diff --git a/src/ui/widget/Makefile_insert b/src/ui/widget/Makefile_insert index bb833e5ec..b5d8a74f6 100644 --- a/src/ui/widget/Makefile_insert +++ b/src/ui/widget/Makefile_insert @@ -33,8 +33,8 @@ ink_common_sources += \ ui/widget/entry.h \ ui/widget/filter-effect-chooser.h \ ui/widget/filter-effect-chooser.cpp \ - ui/widget/font-selector.h \ - ui/widget/font-selector.cpp \ + ui/widget/font-button.h \ + ui/widget/font-button.cpp \ ui/widget/font-variants.h \ ui/widget/font-variants.cpp \ ui/widget/gimpspinscale.c \ diff --git a/src/ui/widget/font-button.cpp b/src/ui/widget/font-button.cpp new file mode 100644 index 000000000..2c79347b2 --- /dev/null +++ b/src/ui/widget/font-button.cpp @@ -0,0 +1,58 @@ +/* + * + * Released under GNU GPL. Read the file 'COPYING' for more information. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "font-button.h" +#include + +namespace Inkscape { +namespace UI { +namespace Widget { + +FontButton::FontButton(Glib::ustring const &label, Glib::ustring const &tooltip, + Glib::ustring const &suffix, + Glib::ustring const &icon, + bool mnemonic) + : Labelled(label, tooltip, new Gtk::FontButton("sans"), suffix, icon, mnemonic) +{ +} + +Glib::ustring FontButton::getValue() const +{ + g_assert(_widget != NULL); + return static_cast(_widget)->get_font_name(); +} + + +void FontButton::setValue (Glib::ustring fontspec) +{ + g_assert(_widget != NULL); + static_cast(_widget)->set_font_name(fontspec); +} + +Glib::SignalProxy0 FontButton::signal_font_value_changed() +{ + g_assert(_widget != NULL); + return static_cast(_widget)->signal_font_set(); +} + + +} // namespace Widget +} // namespace UI +} // namespace Inkscape + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/font-button.h b/src/ui/widget/font-button.h new file mode 100644 index 000000000..1f1ad2d01 --- /dev/null +++ b/src/ui/widget/font-button.h @@ -0,0 +1,63 @@ +/* + * + * Copyright (C) 2007 Author + * + * Released under GNU GPL. Read the file 'COPYING' for more information. + */ + +#ifndef INKSCAPE_UI_WIDGET_FONT_BUTTON_H +#define INKSCAPE_UI_WIDGET_FONT_BUTTON_H + +#include +#include "labelled.h" + +namespace Inkscape { +namespace UI { +namespace Widget { + +/** + * A labelled font button for entering font values + */ +class FontButton : public Labelled +{ +public: + /** + * Construct a FontButton Widget. + * + * @param label Label. + * @param suffix Suffix, placed after the widget (defaults to ""). + * @param icon Icon filename, placed before the label (defaults to ""). + * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label + * indicates the next character should be used for the + * mnemonic accelerator key (defaults to false). + */ + FontButton( Glib::ustring const &label, + Glib::ustring const &tooltip, + Glib::ustring const &suffix = "", + Glib::ustring const &icon = "", + bool mnemonic = true); + + Glib::ustring getValue() const; + void setValue (Glib::ustring fontspec); + /** + * Signal raised when the font button's value changes. + */ + Glib::SignalProxy0 signal_font_value_changed(); +}; + +} // namespace Widget +} // namespace UI +} // namespace Inkscape + +#endif // INKSCAPE_UI_WIDGET_RANDOM_H + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/font-selector.cpp b/src/ui/widget/font-selector.cpp deleted file mode 100644 index 0fcb307eb..000000000 --- a/src/ui/widget/font-selector.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * - * Released under GNU GPL. Read the file 'COPYING' for more information. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "font-selector.h" -#include "widgets/icon.h" -#include - -namespace Inkscape { -namespace UI { -namespace Widget { - -FontSelector::FontSelector(Glib::ustring const &label, Glib::ustring const &tooltip, - Glib::ustring const &suffix, - Glib::ustring const &icon, - bool mnemonic) - :_widget(new Gtk::HBox()), expanded(false), _label(label) -{ - Gtk::VBox * vbox_expander = Gtk::manage( new Gtk::VBox() ); - GtkWidget *fontsel = sp_font_selector_new(); - gtk_widget_set_size_request (fontsel, 290, 150); - fsel = SP_FONT_SELECTOR(fontsel); - Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( "on", Inkscape::ICON_SIZE_BUTTON) ); - Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); - pButton->set_relief(Gtk::RELIEF_NONE); - pIcon->show(); - pButton->add(*pIcon); - pButton->show(); - pButton->signal_clicked().connect(sigc::mem_fun(*this, &FontSelector::onFontSelectorSave)); - pButton->set_tooltip_text(_("Save the changes to font selector")); - vbox_expander->pack_start(*Gtk::manage(Glib::wrap(fontsel)), true, true); - vbox_expander->pack_start(*pButton, true, true); - expander = Gtk::manage(new Gtk::Expander(label)); - expander->add(*vbox_expander); - expander->set_expanded(expanded); - expander->set_spacing(5); - expander->set_use_markup(true); - onExpanderChanged(); - _widget->set_tooltip_text(tooltip); - expander->property_expanded().signal_changed().connect(sigc::mem_fun(*this, &FontSelector::onExpanderChanged) ); - pack_start(*expander, true, true); - pack_start(*Gtk::manage(_widget), true, true); -} - -void -FontSelector::onExpanderChanged() -{ - expanded = expander->get_expanded(); - if(expanded) { - expander->set_label (Glib::ustring(_label)); - } else { - expander->set_label (Glib::ustring(_label + _(" hided"))); - } -} - -Glib::ustring FontSelector::getFontSpec() const -{ - return _fontspec; -} - -void FontSelector::setFontSpec(Glib::ustring fontspec) -{ - _fontspec = fontspec; -} - -double FontSelector::getFontSize() const -{ - return _fontsize; -} - -void FontSelector::setFontSize(double fontsize) -{ - _fontsize = fontsize; -} - -void FontSelector::setValue (Glib::ustring fontspec, double fontsize) -{ - if (_fontsize != fontsize || _fontspec != fontspec) { - setFontSize(fontsize); - setFontSpec(fontspec); - sp_font_selector_set_fontspec(fsel, fontspec, fontsize); - } -} - -void -FontSelector::onFontSelectorSave() -{ - if (_fontspec != sp_font_selector_get_fontspec(fsel) || _fontsize != sp_font_selector_get_size(fsel)) { - setFontSpec(sp_font_selector_get_fontspec(fsel)); - setFontSize(sp_font_selector_get_size(fsel)); - signal_fontselupd.emit(); - onExpanderChanged(); - } -} - - -} // namespace Widget -} // namespace UI -} // namespace Inkscape - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/font-selector.h b/src/ui/widget/font-selector.h deleted file mode 100644 index 8146bc370..000000000 --- a/src/ui/widget/font-selector.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * - * Copyright (C) 2007 Author - * - * Released under GNU GPL. Read the file 'COPYING' for more information. - */ - -#ifndef INKSCAPE_UI_WIDGET_FONT_SELECTOR_H -#define INKSCAPE_UI_WIDGET_FONT_SELECTOR_H - -#include -#include "widgets/font-selector.h" - -struct SPFontSelector; -namespace Inkscape { -namespace UI { -namespace Widget { - -/** - * A labelled text box, with spin buttons and optional - * icon or suffix, for entering arbitrary number values. It adds an extra - * number called "startseed", that is not UI edittable, but should be put in SVG. - * This does NOT generate a random number, but provides merely the saving of - * the startseed value. - */ -class FontSelector : public Gtk::HBox -{ -public: - - /** - * Construct a FontSelector Widget. - * - * @param label Label. - * @param suffix Suffix, placed after the widget (defaults to ""). - * @param icon Icon filename, placed before the label (defaults to ""). - * @param mnemonic Mnemonic toggle; if true, an underscore (_) in the label - * indicates the next character should be used for the - * mnemonic accelerator key (defaults to false). - */ - FontSelector( Glib::ustring const &label, - Glib::ustring const &tooltip, - Glib::ustring const &suffix = "", - Glib::ustring const &icon = "", - bool mnemonic = true); - - Glib::ustring getFontSpec() const; - void onExpanderChanged(); - void setFontSpec(Glib::ustring fontspec); - double getFontSize() const; - void setFontSize(double fontsize); - void setValue (Glib::ustring fontspec, double fontsize); - sigc::signal signal_fontselupd; - -protected: - Gtk::Widget *_widget; - bool expanded; - Glib::ustring _label; - Gtk::Expander * expander; - SPFontSelector *fsel; - Glib::ustring _fontspec; - double _fontsize; - -private: - void onFontSelectorSave(); -}; - -} // namespace Widget -} // namespace UI -} // namespace Inkscape - -#endif // INKSCAPE_UI_WIDGET_RANDOM_H - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index c58e599ee..38bb7f7cc 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -25,7 +25,7 @@ #include "ui/widget/scalar-unit.h" #include "ui/widget/point.h" #include "ui/widget/random.h" -#include "ui/widget/font-selector.h" +#include "ui/widget/font-button.h" #include "widgets/spinbutton-events.h" #include "xml/repr.h" @@ -805,33 +805,31 @@ RegisteredRandom::on_value_changed() } /*######################################### - * Registered FONT-SELECTOR + * Registered FONT-BUTTON */ -RegisteredFontSelector::~RegisteredFontSelector() +RegisteredFontButton::~RegisteredFontButton() { - _value_changed_connection.disconnect(); + _signal_font_set.disconnect(); } -RegisteredFontSelector::RegisteredFontSelector ( const Glib::ustring& label, const Glib::ustring& tip, +RegisteredFontButton::RegisteredFontButton ( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument* doc_in ) - : RegisteredWidget (label, tip) + : RegisteredWidget(label, tip) { init_parent(key, wr, repr_in, doc_in); - _value_changed_connection = signal_fontselupd.connect (sigc::mem_fun (*this, &RegisteredFontSelector::on_value_changed)); + _signal_font_set = signal_font_value_changed().connect (sigc::mem_fun (*this, &RegisteredFontButton::on_value_changed)); } void -RegisteredFontSelector::setValue (Glib::ustring fontspec, double fontsize) +RegisteredFontButton::setValue (Glib::ustring fontspec) { - if (fontsize != 0) { //have value in the effect - FontSelector::setValue (fontspec, fontsize); - } + FontButton::setValue(fontspec); } void -RegisteredFontSelector::on_value_changed() +RegisteredFontButton::on_value_changed() { if (_wr->isUpdating()) @@ -840,7 +838,7 @@ RegisteredFontSelector::on_value_changed() _wr->setUpdating (true); Inkscape::SVGOStringStream os; - os << getFontSpec() << " @ " << getFontSize(); + os << getValue(); write_to_xml(os.str().c_str()); diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index 2b4d98b88..d410dbfe6 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -22,7 +22,7 @@ #include "ui/widget/text.h" #include "ui/widget/random.h" #include "ui/widget/unit-menu.h" -#include "ui/widget/font-selector.h" +#include "ui/widget/font-button.h" #include "ui/widget/color-picker.h" #include "inkscape.h" @@ -421,20 +421,20 @@ protected: void on_value_changed(); }; -class RegisteredFontSelector : public RegisteredWidget { +class RegisteredFontButton : public RegisteredWidget { public: - virtual ~RegisteredFontSelector(); - RegisteredFontSelector ( const Glib::ustring& label, + virtual ~RegisteredFontButton(); + RegisteredFontButton ( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, SPDocument *doc_in = NULL); - void setValue (Glib::ustring fontspec, double fontsize); + void setValue (Glib::ustring fontspec); protected: - sigc::connection _value_changed_connection; + sigc::connection _signal_font_set; void on_value_changed(); }; -- cgit v1.2.3 From f391d1cb5c644cd325f64a88d6d3a9da73fdb9de Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 30 Jul 2016 02:50:36 +0200 Subject: Fixes positions of labels (bzr r15017.1.14) --- src/ui/widget/font-button.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/widget/font-button.cpp b/src/ui/widget/font-button.cpp index 2c79347b2..a472ac6a4 100644 --- a/src/ui/widget/font-button.cpp +++ b/src/ui/widget/font-button.cpp @@ -18,7 +18,7 @@ FontButton::FontButton(Glib::ustring const &label, Glib::ustring const &tooltip, Glib::ustring const &suffix, Glib::ustring const &icon, bool mnemonic) - : Labelled(label, tooltip, new Gtk::FontButton("sans"), suffix, icon, mnemonic) + : Labelled(label, tooltip, new Gtk::FontButton("Sans 10"), suffix, icon, mnemonic) { } -- cgit v1.2.3 From 7f16afbb515eceed9c63afacec73cd528a662327 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 30 Jul 2016 19:04:34 +0200 Subject: Full rewrite on working mode now no linked paths necesary (bzr r15017.1.15) --- src/ui/dialog/livepatheffect-editor.cpp | 8 ++++++++ src/ui/widget/registered-widget.cpp | 1 - src/ui/widget/scalar.cpp | 6 ++++-- src/ui/widget/scalar.h | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 7205beaa8..e177ae01e 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -589,6 +589,14 @@ void LivePathEffectEditor::on_visibility_toggled( Glib::ustring const& str ) /* FIXME: this explicit writing to SVG is wrong. The lpe_item should have a method to disable/enable an effect within its stack. * So one can call: lpe_item->setActive(lpeobjref->lpeobject); */ lpeobjref->lpeobject->get_lpe()->getRepr()->setAttribute("is_visible", newValue ? "true" : "false"); + Inkscape::Selection *sel = _getSelection(); + if ( sel && !sel->isEmpty() ) { + SPItem *item = sel->singleItem(); + SPLPEItem *lpeitem = dynamic_cast(item); + if ( lpeitem ) { + lpeobjref->lpeobject->get_lpe()->doOnVisibilityToggled(lpeitem); + } + } DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, newValue ? _("Activate path effect") : _("Deactivate path effect")); } diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 38bb7f7cc..923949b72 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -298,7 +298,6 @@ RegisteredScalar::on_value_changed() setProgrammatically = false; return; } - if (_wr->isUpdating()) { return; } diff --git a/src/ui/widget/scalar.cpp b/src/ui/widget/scalar.cpp index fca8a7974..80a2454b0 100644 --- a/src/ui/widget/scalar.cpp +++ b/src/ui/widget/scalar.cpp @@ -126,10 +126,12 @@ void Scalar::setRange(double min, double max) static_cast(_widget)->set_range(min, max); } -void Scalar::setValue(double value) +void Scalar::setValue(double value, bool setProg) { g_assert(_widget != NULL); - setProgrammatically = true; // callback is supposed to reset back, if it cares + if (setProg) { + setProgrammatically = true; // callback is supposed to reset back, if it cares + } static_cast(_widget)->set_value(value); } diff --git a/src/ui/widget/scalar.h b/src/ui/widget/scalar.h index 86d7aee28..9cceeaa1f 100644 --- a/src/ui/widget/scalar.h +++ b/src/ui/widget/scalar.h @@ -139,7 +139,7 @@ public: /** * Sets the value of the spin button. */ - void setValue(double value); + void setValue(double value, bool setProg = true); /** * Manually forces an update of the spin button. -- cgit v1.2.3 From 28d25258de5d2274382dbb592f62e21ca8f91729 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 1 Aug 2016 00:47:38 +0200 Subject: Fix text param and alow run from commandline (bzr r15017.1.21) --- src/ui/widget/registered-widget.cpp | 13 ++++--------- src/ui/widget/text.cpp | 6 +++--- src/ui/widget/text.h | 4 ++-- 3 files changed, 9 insertions(+), 14 deletions(-) (limited to 'src/ui') diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 923949b72..8b8bdc8e4 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -331,8 +331,6 @@ RegisteredText::RegisteredText ( const Glib::ustring& label, const Glib::ustring init_parent(key, wr, repr_in, doc_in); setProgrammatically = false; - - setText(""); _activate_connection = signal_activate().connect (sigc::mem_fun (*this, &RegisteredText::on_activate)); } @@ -348,16 +346,13 @@ RegisteredText::on_activate() return; } _wr->setUpdating (true); - - Inkscape::SVGOStringStream os; - os << getText(); - + Glib::ustring str(getText()); set_sensitive(false); + Inkscape::SVGOStringStream os; + os << str; write_to_xml(os.str().c_str()); - set_sensitive(true); - setText(os.str().c_str()); - + set_sensitive(true); _wr->setUpdating (false); } diff --git a/src/ui/widget/text.cpp b/src/ui/widget/text.cpp index ec58d5bb4..e6795b138 100644 --- a/src/ui/widget/text.cpp +++ b/src/ui/widget/text.cpp @@ -28,13 +28,13 @@ Text::Text(Glib::ustring const &label, Glib::ustring const &tooltip, { } -const char *Text::getText() const +Glib::ustring const Text::getText() const { g_assert(_widget != NULL); - return static_cast(_widget)->get_text().c_str(); + return static_cast(_widget)->get_text(); } -void Text::setText(const char* text) +void Text::setText(Glib::ustring const text) { g_assert(_widget != NULL); setProgrammatically = true; // callback is supposed to reset back, if it cares diff --git a/src/ui/widget/text.h b/src/ui/widget/text.h index b90788940..593875b23 100644 --- a/src/ui/widget/text.h +++ b/src/ui/widget/text.h @@ -44,12 +44,12 @@ public: /** * Get the text in the entry. */ - const char* getText() const; + Glib::ustring const getText() const; /** * Sets the text of the text entry. */ - void setText(const char* text); + void setText(Glib::ustring const text); void update(); -- cgit v1.2.3 From b7556c8456244e9cc884f721d8a728c1377d565e Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 1 Aug 2016 18:11:45 +0200 Subject: Noumerous bug fixes, font size, stroke with arroow position, and text input response (bzr r15017.1.25) --- src/ui/widget/registered-widget.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 8b8bdc8e4..dc2e4e14a 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -351,7 +351,6 @@ RegisteredText::on_activate() Inkscape::SVGOStringStream os; os << str; write_to_xml(os.str().c_str()); - setText(os.str().c_str()); set_sensitive(true); _wr->setUpdating (false); } -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/ui/clipboard.cpp | 12 ------------ src/ui/control-manager.cpp | 1 - src/ui/dialog-events.cpp | 5 +---- src/ui/dialog/align-and-distribute.cpp | 5 +---- src/ui/dialog/clonetiler.cpp | 14 +------------- src/ui/dialog/color-item.cpp | 10 +--------- src/ui/dialog/debug.cpp | 3 +-- src/ui/dialog/desktop-tracker.cpp | 1 - src/ui/dialog/dialog-manager.cpp | 5 +---- src/ui/dialog/dialog.cpp | 5 +---- src/ui/dialog/dock-behavior.cpp | 6 +----- src/ui/dialog/document-metadata.cpp | 3 +-- src/ui/dialog/document-properties.cpp | 14 +------------- src/ui/dialog/export.cpp | 15 +-------------- src/ui/dialog/extension-editor.cpp | 4 +--- src/ui/dialog/filedialog.cpp | 5 ----- src/ui/dialog/fill-and-stroke.cpp | 4 ---- src/ui/dialog/filter-effects-dialog.cpp | 25 ++++--------------------- src/ui/dialog/find.cpp | 9 +-------- src/ui/dialog/floating-behavior.cpp | 4 +--- src/ui/dialog/font-substitution.cpp | 7 +------ src/ui/dialog/glyphs.cpp | 5 ----- src/ui/dialog/grid-arrange-tab.cpp | 4 ---- src/ui/dialog/guides.cpp | 6 +----- src/ui/dialog/icon-preview.cpp | 7 ++----- src/ui/dialog/inkscape-preferences.cpp | 10 +--------- src/ui/dialog/input.cpp | 9 --------- src/ui/dialog/knot-properties.cpp | 11 +---------- src/ui/dialog/layer-properties.cpp | 6 ++---- src/ui/dialog/layers.cpp | 10 +--------- src/ui/dialog/livepatheffect-add.cpp | 3 +-- src/ui/dialog/livepatheffect-editor.cpp | 11 +---------- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 12 +----------- src/ui/dialog/lpe-powerstroke-properties.cpp | 13 +------------ src/ui/dialog/memory.cpp | 5 +++-- src/ui/dialog/messages.cpp | 2 +- src/ui/dialog/new-from-template.cpp | 3 +-- src/ui/dialog/object-attributes.cpp | 3 --- src/ui/dialog/object-properties.cpp | 3 --- src/ui/dialog/objects.cpp | 14 ++------------ src/ui/dialog/ocaldialogs.cpp | 13 ++++--------- src/ui/dialog/pixelartdialog.cpp | 6 ------ src/ui/dialog/polar-arrange-tab.cpp | 2 -- src/ui/dialog/print.cpp | 3 +-- src/ui/dialog/spellcheck.cpp | 9 +-------- src/ui/dialog/svg-fonts-dialog.cpp | 6 ++---- src/ui/dialog/swatches.cpp | 9 --------- src/ui/dialog/symbols.cpp | 5 ----- src/ui/dialog/tags.cpp | 15 +-------------- src/ui/dialog/template-load-tab.cpp | 14 +++----------- src/ui/dialog/template-widget.cpp | 7 +------ src/ui/dialog/text-edit.cpp | 7 ------- src/ui/dialog/tracedialog.cpp | 5 ++--- src/ui/dialog/transformation.cpp | 6 +----- src/ui/dialog/undo-history.cpp | 6 +----- src/ui/dialog/xml-tree.cpp | 5 ----- src/ui/interface.cpp | 14 ++------------ src/ui/object-edit.cpp | 7 +------ src/ui/previewholder.cpp | 1 - src/ui/selected-color.cpp | 2 +- src/ui/shape-editor.cpp | 5 +---- src/ui/tool-factory.cpp | 2 -- src/ui/tool/control-point-selection.cpp | 1 - src/ui/tool/control-point.cpp | 2 -- src/ui/tool/curve-drag-point.cpp | 3 --- src/ui/tool/manipulator.cpp | 4 ++-- src/ui/tool/modifier-tracker.cpp | 1 - src/ui/tool/multi-path-manipulator.cpp | 2 -- src/ui/tool/node.cpp | 5 ----- src/ui/tool/path-manipulator.cpp | 13 ------------- src/ui/tool/selector.cpp | 1 - src/ui/tool/transform-handle-set.cpp | 4 ---- src/ui/tools-switch.cpp | 6 ------ src/ui/tools/arc-tool.cpp | 3 +-- src/ui/tools/box3d-tool.cpp | 9 --------- src/ui/tools/calligraphic-tool.cpp | 9 --------- src/ui/tools/connector-tool.cpp | 7 ------- src/ui/tools/dropper-tool.cpp | 5 +---- src/ui/tools/dynamic-base.cpp | 6 ------ src/ui/tools/eraser-tool.cpp | 11 ----------- src/ui/tools/flood-tool.cpp | 12 +----------- src/ui/tools/freehand-base.cpp | 16 +--------------- src/ui/tools/gradient-tool.cpp | 9 +-------- src/ui/tools/lpe-tool.cpp | 5 +---- src/ui/tools/measure-tool.cpp | 18 +----------------- src/ui/tools/mesh-tool.cpp | 3 +-- src/ui/tools/node-tool.cpp | 6 ------ src/ui/tools/pen-tool.cpp | 12 ------------ src/ui/tools/pencil-tool.cpp | 5 ----- src/ui/tools/rect-tool.cpp | 5 ----- src/ui/tools/select-tool.cpp | 4 +--- src/ui/tools/spiral-tool.cpp | 5 ----- src/ui/tools/spray-tool.cpp | 14 -------------- src/ui/tools/star-tool.cpp | 5 +---- src/ui/tools/text-tool.cpp | 6 +----- src/ui/tools/tool-base.cpp | 10 +--------- src/ui/tools/tweak-tool.cpp | 12 ------------ src/ui/tools/zoom-tool.cpp | 1 - src/ui/uxmanager.cpp | 5 +---- src/ui/widget/addtoicon.cpp | 4 +--- src/ui/widget/anchor-selector.cpp | 1 - src/ui/widget/clipmaskicon.cpp | 2 +- src/ui/widget/color-icc-selector.cpp | 3 --- src/ui/widget/color-notebook.cpp | 4 ---- src/ui/widget/color-scales.cpp | 4 +--- src/ui/widget/color-slider.cpp | 3 +-- src/ui/widget/color-wheel-selector.cpp | 6 +----- src/ui/widget/dock-item.cpp | 2 -- src/ui/widget/entity-entry.cpp | 3 +-- src/ui/widget/entry.cpp | 2 +- src/ui/widget/filter-effect-chooser.cpp | 4 ---- src/ui/widget/font-variants.cpp | 10 +--------- src/ui/widget/frame.cpp | 2 +- src/ui/widget/highlight-picker.cpp | 3 --- src/ui/widget/imageicon.cpp | 7 +------ src/ui/widget/layer-selector.cpp | 4 +--- src/ui/widget/layertypeicon.cpp | 3 +-- src/ui/widget/licensor.cpp | 4 ++-- src/ui/widget/object-composite-settings.cpp | 7 ------- src/ui/widget/page-sizer.cpp | 19 +------------------ src/ui/widget/panel.cpp | 6 ++---- src/ui/widget/point.cpp | 5 +---- src/ui/widget/preferences-widget.cpp | 8 ++------ src/ui/widget/random.cpp | 2 +- src/ui/widget/registered-widget.cpp | 18 +++--------------- src/ui/widget/rendering-options.cpp | 2 +- src/ui/widget/rotateable.cpp | 3 +-- src/ui/widget/selected-style.cpp | 11 +++-------- src/ui/widget/spin-scale.cpp | 1 - src/ui/widget/spinbutton.cpp | 2 +- src/ui/widget/style-subject.cpp | 1 - src/ui/widget/style-swatch.cpp | 6 ------ src/ui/widget/tolerance-slider.cpp | 2 +- 133 files changed, 106 insertions(+), 746 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index d581dbf7e..09ba9a1a9 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -27,9 +27,6 @@ // TODO: reduce header bloat if possible #include "file.h" // for file_import, used in _pasteImage -#include -#include -#include #include #include // for g_file_set_contents etc., used in _onGet and paste #include "inkgc/gc-core.h" @@ -41,7 +38,6 @@ #include "desktop-style.h" // for sp_desktop_set_style, used in _pasteStyle #include "document.h" #include "document-private.h" -#include "selection.h" #include "message-stack.h" #include "context-fns.h" #include "ui/tools/dropper-tool.h" // used in copy() @@ -50,17 +46,13 @@ #include "extension/input.h" #include "extension/output.h" #include "selection-chemistry.h" -#include <2geom/rect.h> #include <2geom/transforms.h> #include "box3d.h" #include "gradient-drag.h" #include "sp-marker.h" -#include "sp-item.h" #include "sp-item-transform.h" // for sp_item_scale_rel, used in _pasteSize #include "sp-path.h" #include "sp-pattern.h" -#include "sp-shape.h" -#include "sp-gradient.h" #include "sp-gradient-reference.h" #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" @@ -68,8 +60,6 @@ #include "sp-mask.h" #include "sp-textpath.h" #include "sp-rect.h" -#include "sp-use.h" -#include "sp-symbol.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" @@ -83,9 +73,7 @@ #include "helper/png-write.h" #include "svg/svg-color.h" #include "sp-namedview.h" -#include "snap.h" #include "persp3d.h" -#include "preferences.h" /// Made up mimetype to represent Gdk::Pixbuf clipboard contents. #define CLIPBOARD_GDK_PIXBUF_TARGET "image/x-gdk-pixbuf" diff --git a/src/ui/control-manager.cpp b/src/ui/control-manager.cpp index a2c977533..973625574 100644 --- a/src/ui/control-manager.cpp +++ b/src/ui/control-manager.cpp @@ -17,7 +17,6 @@ #include #include "display/sodipodi-ctrl.h" // for SP_TYPE_CTRL -#include "display/sp-canvas-item.h" #include "display/sp-ctrlline.h" #include "display/sp-ctrlcurve.h" #include "preferences.h" diff --git a/src/ui/dialog-events.cpp b/src/ui/dialog-events.cpp index 8856631c0..d7d56fa50 100644 --- a/src/ui/dialog-events.cpp +++ b/src/ui/dialog-events.cpp @@ -12,17 +12,14 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include #include -#include #include "macros.h" -#include #include "desktop.h" #include "inkscape.h" -#include "preferences.h" #include "ui/tools/tool-base.h" #include "ui/dialog-events.h" diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 8f87932b8..f269d1cb9 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -18,7 +18,7 @@ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "align-and-distribute.h" @@ -27,13 +27,10 @@ #include "unclump.h" #include "document.h" -#include "enums.h" #include "graphlayout.h" #include "inkscape.h" -#include "macros.h" #include "preferences.h" #include "removeoverlap.h" -#include "selection.h" #include "sp-flowtext.h" #include "sp-item-transform.h" #include "sp-text.h" diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index b727c87ee..bdb826384 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -15,13 +15,11 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include "clonetiler.h" -#include - #include #include <2geom/transforms.h> #include @@ -31,23 +29,15 @@ #include "display/cairo-utils.h" #include "display/drawing.h" #include "display/drawing-context.h" -#include "display/drawing-item.h" #include "document.h" #include "document-undo.h" #include "filter-chemistry.h" #include "ui/widget/unit-menu.h" -#include "util/units.h" #include "helper/window.h" #include "inkscape.h" #include "ui/interface.h" -#include "macros.h" #include "message-stack.h" -#include "preferences.h" -#include "selection.h" -#include "sp-filter.h" #include "sp-namedview.h" -#include "sp-use.h" -#include "style.h" #include "svg/svg-color.h" #include "svg/svg.h" #include "ui/icon-names.h" @@ -55,8 +45,6 @@ #include "unclump.h" #include "verbs.h" #include "widgets/icon.h" -#include "xml/repr.h" -#include "sp-root.h" using Inkscape::DocumentUndo; using Inkscape::Util::unit_table; diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp index 34cdb92e3..df4ab6485 100644 --- a/src/ui/dialog/color-item.cpp +++ b/src/ui/dialog/color-item.cpp @@ -12,15 +12,13 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include #include #include -#include -#include #include "color-item.h" @@ -34,16 +32,10 @@ #include "io/resource.h" #include "io/sys.h" #include "message-context.h" -#include "sp-gradient.h" -#include "sp-item.h" #include "svg/svg-color.h" -#include "xml/node.h" -#include "xml/repr.h" #include "verbs.h" #include "widgets/gradient-vector.h" -#include "color.h" // for SP_RGBA32_U_COMPOSE - namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/debug.cpp b/src/ui/dialog/debug.cpp index d127261c0..d5ce6a160 100644 --- a/src/ui/dialog/debug.cpp +++ b/src/ui/dialog/debug.cpp @@ -10,13 +10,12 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include #include #include -#include #include #include #include diff --git a/src/ui/dialog/desktop-tracker.cpp b/src/ui/dialog/desktop-tracker.cpp index 0659de67b..c18711a55 100644 --- a/src/ui/dialog/desktop-tracker.cpp +++ b/src/ui/dialog/desktop-tracker.cpp @@ -6,7 +6,6 @@ */ #include "widgets/desktop-widget.h" -#include #include "desktop-tracker.h" diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 49853277c..c53112656 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -14,7 +14,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "ui/dialog/dialog-manager.h" @@ -45,11 +45,8 @@ #include "ui/dialog/panel-dialog.h" #include "ui/dialog/layers.h" #include "ui/dialog/icon-preview.h" -#include "ui/dialog/floating-behavior.h" -#include "ui/dialog/dock-behavior.h" //#include "ui/dialog/print-colors-preview-dialog.h" #include "util/ege-appear-time-tracker.h" -#include "preferences.h" #include "ui/dialog/object-attributes.h" #include "ui/dialog/object-properties.h" #include "ui/dialog/text-edit.h" diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 27d88bae7..d0b618c65 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -14,7 +14,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "dialog-manager.h" @@ -27,13 +27,10 @@ #include "desktop.h" #include "shortcuts.h" -#include "preferences.h" #include "ui/interface.h" #include "verbs.h" #include "ui/tool/event-utils.h" -#include - #define MIN_ONSCREEN_DISTANCE 50 diff --git a/src/ui/dialog/dock-behavior.cpp b/src/ui/dialog/dock-behavior.cpp index 50a6db208..ec630c08f 100644 --- a/src/ui/dialog/dock-behavior.cpp +++ b/src/ui/dialog/dock-behavior.cpp @@ -12,7 +12,7 @@ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "dock-behavior.h" @@ -23,15 +23,11 @@ #include "ui/widget/dock.h" #include "verbs.h" #include "dialog.h" -#include "preferences.h" #include "ui/dialog-events.h" #include -#include #include -#include - namespace Inkscape { namespace UI { namespace Dialog { diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index da1facc08..40495456b 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -15,13 +15,12 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "document-metadata.h" #include "desktop.h" -#include "inkscape.h" #include "rdf.h" #include "sp-namedview.h" #include "ui/widget/entity-entry.h" diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 589973162..5b7887b35 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -25,27 +25,17 @@ #include "ui/widget/notebook-page.h" #include "document-properties.h" #include "display/canvas-grid.h" -#include "document.h" -#include "desktop.h" -#include "inkscape.h" #include "io/sys.h" -#include "preferences.h" #include "ui/shape-editor.h" -#include "sp-namedview.h" #include "sp-root.h" #include "sp-script.h" #include "style.h" -#include "svg/stringstream.h" #include "ui/tools-switch.h" -#include "ui/widget/color-picker.h" -#include "ui/widget/scalar-unit.h" #include "ui/dialog/filedialog.h" #include "verbs.h" #include "widgets/icon.h" #include "xml/node-event-vector.h" -#include "xml/repr.h" -#include // std::min #include "rdf.h" #include "ui/widget/entity-entry.h" @@ -54,11 +44,9 @@ #include "color-profile.h" #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -#include #include -#include +#include -#include <2geom/transforms.h> #include "ui/icon-names.h" using std::pair; diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 2fb5f9e3b..28acfdfb5 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -24,18 +24,14 @@ #include #include #include -#include -#include #include #include -#include + #if WITH_GTKMM_3_0 # include #else # include #endif -#include -#include #ifdef WITH_GNOME_VFS # include // gnome_vfs_initialized @@ -45,16 +41,12 @@ #include #include "ui/widget/unit-menu.h" -#include "util/units.h" #include "helper/window.h" #include "inkscape.h" #include "document.h" #include "document-undo.h" -#include "sp-item.h" -#include "selection.h" #include "file.h" -#include "macros.h" #include "sp-namedview.h" #include "selection-chemistry.h" @@ -89,17 +81,12 @@ #include #endif -#include - #define SP_EXPORT_MIN_SIZE 1.0 #define DPI_BASE Inkscape::Util::Quantity::convert(1, "in", "px") #define EXPORT_COORD_PRECISION 3 -#include "../../document.h" -#include "../../document-undo.h" -#include "verbs.h" #include "export.h" using Inkscape::Util::unit_table; diff --git a/src/ui/dialog/extension-editor.cpp b/src/ui/dialog/extension-editor.cpp index 9bdddc0e0..84840f22d 100644 --- a/src/ui/dialog/extension-editor.cpp +++ b/src/ui/dialog/extension-editor.cpp @@ -12,14 +12,13 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "extension-editor.h" #include #include -#include #include #include @@ -27,7 +26,6 @@ #include "preferences.h" #include "ui/interface.h" -#include "extension/extension.h" #include "extension/db.h" namespace Inkscape { diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp index 4e4b0278a..ee673aecf 100644 --- a/src/ui/dialog/filedialog.cpp +++ b/src/ui/dialog/filedialog.cpp @@ -17,14 +17,9 @@ #include "filedialogimpl-win32.h" #include "filedialogimpl-gtkmm.h" -#include "filedialog.h" -#include "inkgc/gc-core.h" #include "ui/dialog-events.h" #include "extension/output.h" -#include "preferences.h" - -#include namespace Inkscape { diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index 8141f7696..fa69851e4 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -22,7 +22,6 @@ #include "fill-and-stroke.h" #include "filter-chemistry.h" #include "inkscape.h" -#include "selection.h" #include "preferences.h" #include "style.h" #include "svg/css-ostringstream.h" @@ -32,12 +31,9 @@ #include "widgets/icon.h" #include "widgets/paint-selector.h" #include "widgets/stroke-style.h" -#include "xml/repr.h" #include "ui/view/view-widget.h" -#include - namespace Inkscape { namespace UI { namespace Dialog { diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index d3ad5d1da..cbf6d3516 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -16,7 +16,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "dialog-manager.h" @@ -28,59 +28,42 @@ #include "ui/widget/spinbutton.h" -#include #include -#include #include +#include +#include #include "desktop.h" -#include "dir-util.h" #include "document.h" #include "document-undo.h" #include "filter-chemistry.h" #include "filter-effects-dialog.h" #include "filter-enums.h" #include "inkscape.h" -#include "path-prefix.h" -#include "preferences.h" -#include "selection.h" #include "filters/blend.h" #include "filters/colormatrix.h" #include "filters/componenttransfer.h" #include "filters/componenttransfer-funcnode.h" -#include "filters/composite.h" #include "filters/convolvematrix.h" -#include "filters/displacementmap.h" #include "filters/distantlight.h" -#include "filters/gaussian-blur.h" #include "filters/merge.h" #include "filters/mergenode.h" -#include "filters/offset.h" #include "filters/pointlight.h" #include "filters/spotlight.h" -#include "sp-filter-primitive.h" #include "style.h" #include "svg/svg-color.h" -#include "svg/stringstream.h" #include "ui/dialog/filedialog.h" #include "verbs.h" -#include "xml/node.h" -#include "xml/node-observer.h" -#include "xml/repr.h" -#include #include "io/sys.h" -#include #include "selection-chemistry.h" -#include #include -#include -#include #include #include +#include using namespace Inkscape::Filters; diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index 0f368c5ac..8b6067e82 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -11,30 +11,25 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "find.h" #include -#include #include "verbs.h" #include "message-stack.h" #include "helper/window.h" -#include "macros.h" #include "inkscape.h" #include "desktop.h" #include "document.h" #include "document-undo.h" -#include "selection.h" #include "ui/dialog-events.h" -#include "verbs.h" #include "ui/interface.h" -#include "preferences.h" #include "sp-text.h" #include "sp-flowtext.h" #include "sp-flowdiv.h" @@ -51,11 +46,9 @@ #include "sp-line.h" #include "sp-polyline.h" #include "sp-item-group.h" -#include "sp-use.h" #include "sp-image.h" #include "sp-offset.h" #include "sp-root.h" -#include "xml/repr.h" #include "xml/node-iterators.h" #include "xml/attribute-record.h" diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp index 55ef0c5bb..5ac3a25ad 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -11,13 +11,12 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include #include #include -#include #include "floating-behavior.h" #include "dialog.h" @@ -26,7 +25,6 @@ #include "desktop.h" #include "ui/dialog-events.h" #include "ui/interface.h" -#include "preferences.h" #include "verbs.h" namespace Inkscape { diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index f219f3db6..0a88770b9 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -7,7 +7,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include @@ -21,16 +21,11 @@ #include "inkscape.h" #include "desktop.h" #include "document.h" -#include "selection.h" #include "ui/dialog-events.h" #include "selection-chemistry.h" -#include "preferences.h" -#include "xml/repr.h" - -#include "sp-defs.h" #include "sp-root.h" #include "sp-text.h" #include "sp-textpath.h" diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 56b001291..7ce3eabfc 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -14,9 +14,7 @@ #include #include #include -#include #include -#include #include #include @@ -26,9 +24,6 @@ # include #endif -#include -#include - #include "desktop.h" #include "document.h" // for SPDocumentUndo::done() #include "document-undo.h" diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 639e463ea..8d83814b4 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -16,14 +16,12 @@ //#define DEBUG_GRID_ARRANGE 1 #include "ui/dialog/grid-arrange-tab.h" -#include //for GTK_RESPONSE* types #include #include #if WITH_GTKMM_3_0 # include #else -# include #endif #include <2geom/transforms.h> @@ -32,10 +30,8 @@ #include "preferences.h" #include "inkscape.h" -#include "selection.h" #include "document.h" #include "document-undo.h" -#include "sp-item.h" #include "widgets/icon.h" #include "desktop.h" //#include "sp-item-transform.h" FIXME diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 556d77a28..469bd5155 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -14,7 +14,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "guides.h" @@ -30,12 +30,8 @@ #include #include "ui/dialog-events.h" #include "message-context.h" -#include "xml/repr.h" #include "verbs.h" -#include <2geom/point.h> -#include <2geom/angle.h> - #include namespace Inkscape { diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 83656a1f2..8dd0ae489 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -14,15 +14,15 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include #include #include -#include #include +#include #include #include @@ -35,10 +35,7 @@ #include "display/drawing.h" #include "document.h" #include "inkscape.h" -#include "preferences.h" -#include "selection.h" #include "sp-root.h" -#include "xml/repr.h" #include "verbs.h" #include "icon-preview.h" diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 6dd62d3bb..2f4ac8606 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -19,30 +19,22 @@ #include "inkscape-preferences.h" #include -#include #include +#include #include -#include -#include #include #include "preferences.h" #include "verbs.h" #include "selcue.h" -#include "util/units.h" -#include -#include "enums.h" #include "extension/internal/gdkpixbuf-input.h" #include "message-stack.h" #include "style.h" #include "selection.h" #include "selection-chemistry.h" -#include "xml/repr.h" #include "ui/widget/style-swatch.h" -#include "ui/widget/spinbutton.h" #include "display/nr-filter-gaussian.h" -#include "display/nr-filter-types.h" #include "cms-system.h" #include "color-profile.h" #include "display/canvas-grid.h" diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 8343cd6fe..1bfb59ae5 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -15,18 +15,12 @@ #include "ui/widget/panel.h" #include "ui/widget/frame.h" -#include #include -#include #include #include #include #include -#include -#include -#include -#include #include #include #include @@ -40,10 +34,7 @@ # include #endif -#include -#include #include -#include #include "device-manager.h" #include "preferences.h" diff --git a/src/ui/dialog/knot-properties.cpp b/src/ui/dialog/knot-properties.cpp index a91a09a4f..133ed6f4c 100644 --- a/src/ui/dialog/knot-properties.cpp +++ b/src/ui/dialog/knot-properties.cpp @@ -14,12 +14,10 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "ui/dialog/knot-properties.h" #include -#include -#include #include #include "inkscape.h" #include "util/units.h" @@ -27,15 +25,8 @@ #include "document.h" #include "document-undo.h" #include "layer-manager.h" -#include "message-stack.h" -#include "sp-object.h" -#include "sp-item.h" -#include "verbs.h" -#include "selection.h" #include "selection-chemistry.h" -#include "ui/icon-names.h" -#include "ui/widget/imagetoggler.h" //#include "event-context.h" diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index 5d550ed48..9cfc21e18 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -15,8 +15,9 @@ #include "layer-properties.h" #include -#include #include +#include + #include "inkscape.h" #include "desktop.h" #include "document.h" @@ -24,10 +25,7 @@ #include "layer-manager.h" #include "message-stack.h" -#include "sp-object.h" -#include "sp-item.h" #include "verbs.h" -#include "selection.h" #include "selection-chemistry.h" #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 1c022ecad..c75c631d7 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -10,16 +10,13 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "layers.h" -#include #include #include #include - -#include #include #include "desktop.h" @@ -27,19 +24,14 @@ #include "document.h" #include "document-undo.h" #include "helper/action.h" -#include "helper/action-context.h" #include "inkscape.h" #include "layer-fns.h" #include "layer-manager.h" -#include "preferences.h" -#include "sp-item.h" -#include "sp-object.h" #include "svg/css-ostringstream.h" #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" #include "verbs.h" #include "widgets/icon.h" -#include "xml/repr.h" #include "sp-root.h" #include "ui/tools/tool-base.h" #include "selection-chemistry.h" diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp index c558eddaf..3602b04df 100644 --- a/src/ui/dialog/livepatheffect-add.cpp +++ b/src/ui/dialog/livepatheffect-add.cpp @@ -9,7 +9,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "livepatheffect-add.h" @@ -17,7 +17,6 @@ #include #include "desktop.h" -#include "live_effects/effect-enum.h" namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 422ec10ae..ac64143f1 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -13,20 +13,16 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "livepatheffect-editor.h" -#include #include -#include -#include #include "desktop.h" #include "document.h" #include "document-undo.h" -#include "gtkmm/widget.h" #include "helper/action.h" #include "inkscape.h" #include "live_effects/effect.h" @@ -34,19 +30,14 @@ #include "live_effects/lpeobject-reference.h" #include "path-chemistry.h" #include "selection-chemistry.h" -#include "selection.h" #include "sp-item-group.h" -#include "sp-lpe-item.h" #include "sp-path.h" #include "sp-rect.h" -#include "sp-use.h" #include "sp-text.h" -#include "sp-shape.h" #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" #include "verbs.h" #include "widgets/icon.h" -#include "xml/node.h" #include "livepatheffect-add.h" namespace Inkscape { diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index b0cc91868..d33ee758d 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -5,30 +5,20 @@ */ #ifdef HAVE_CONFIG_H -#include +#include "config.h" #endif #include #include "lpe-fillet-chamfer-properties.h" #include -#include #include #include "inkscape.h" #include "desktop.h" -#include "document.h" #include "document-undo.h" #include "layer-manager.h" #include "message-stack.h" -#include "sp-object.h" -#include "sp-item.h" -#include "verbs.h" -#include "selection.h" #include "selection-chemistry.h" -#include "ui/icon-names.h" -#include "ui/widget/imagetoggler.h" -#include "live_effects/parameter/parameter.h" -#include //#include "event-context.h" diff --git a/src/ui/dialog/lpe-powerstroke-properties.cpp b/src/ui/dialog/lpe-powerstroke-properties.cpp index a6dcce907..d5b3bb30d 100644 --- a/src/ui/dialog/lpe-powerstroke-properties.cpp +++ b/src/ui/dialog/lpe-powerstroke-properties.cpp @@ -14,29 +14,18 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "lpe-powerstroke-properties.h" #include -#include -#include #include #include "inkscape.h" #include "desktop.h" -#include "document.h" #include "document-undo.h" #include "layer-manager.h" -#include "message-stack.h" -#include "sp-object.h" -#include "sp-item.h" -#include "verbs.h" -#include "selection.h" #include "selection-chemistry.h" -#include "ui/icon-names.h" -#include "ui/widget/imagetoggler.h" -#include "live_effects/parameter/parameter.h" //#include "event-context.h" namespace Inkscape { diff --git a/src/ui/dialog/memory.cpp b/src/ui/dialog/memory.cpp index c0bc884fa..f08089774 100644 --- a/src/ui/dialog/memory.cpp +++ b/src/ui/dialog/memory.cpp @@ -11,12 +11,13 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "ui/dialog/memory.h" -#include #include +#include + #include #include diff --git a/src/ui/dialog/messages.cpp b/src/ui/dialog/messages.cpp index df02215fe..3a8e7338d 100644 --- a/src/ui/dialog/messages.cpp +++ b/src/ui/dialog/messages.cpp @@ -11,7 +11,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "messages.h" diff --git a/src/ui/dialog/new-from-template.cpp b/src/ui/dialog/new-from-template.cpp index 74ec7111e..96fa72791 100644 --- a/src/ui/dialog/new-from-template.cpp +++ b/src/ui/dialog/new-from-template.cpp @@ -9,14 +9,13 @@ */ #if HAVE_CONFIG_H - #include "config.h" +#include "config.h" #endif #include "new-from-template.h" #include "file.h" #include -#include namespace Inkscape { diff --git a/src/ui/dialog/object-attributes.cpp b/src/ui/dialog/object-attributes.cpp index 1bc570f43..72520d3d0 100644 --- a/src/ui/dialog/object-attributes.cpp +++ b/src/ui/dialog/object-attributes.cpp @@ -23,15 +23,12 @@ #include "ui/dialog/dialog-manager.h" #include "desktop.h" -#include "macros.h" #include "sp-anchor.h" #include "sp-image.h" #include "verbs.h" -#include "xml/repr.h" #include "ui/dialog/object-attributes.h" #include "widgets/sp-attribute-widget.h" #include "inkscape.h" -#include "selection.h" #include namespace Inkscape { diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index be46129c4..545c240fc 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -33,11 +33,8 @@ #include "document-undo.h" #include "verbs.h" #include "inkscape.h" -#include "selection.h" #include "desktop.h" -#include "sp-item.h" #include "sp-image.h" -#include "xml/repr.h" #include #if WITH_GTKMM_3_0 diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 27694a9ac..43aa663e2 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -10,17 +10,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "objects.h" -#include #include +#include #include #include -#include - -#include #include #include "desktop.h" @@ -34,12 +31,8 @@ #include "helper/action.h" #include "inkscape.h" #include "layer-manager.h" -#include "preferences.h" -#include "selection.h" #include "sp-clippath.h" #include "sp-mask.h" -#include "sp-item.h" -#include "sp-object.h" #include "sp-root.h" #include "sp-shape.h" #include "style.h" @@ -52,13 +45,10 @@ #include "ui/widget/clipmaskicon.h" #include "ui/widget/highlight-picker.h" #include "ui/tools/node-tool.h" -#include "ui/tools/tool-base.h" #include "verbs.h" #include "ui/widget/color-notebook.h" #include "widgets/icon.h" -#include "xml/node.h" #include "xml/node-observer.h" -#include "xml/repr.h" //#define DUMP_LAYERS 1 diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index f2ee79d06..3353d2878 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -18,16 +18,10 @@ #include "ocaldialogs.h" -#include // rename() -#include // close() -#include // errno -#include // strerror() - #include "path-prefix.h" #include "filedialogimpl-gtkmm.h" #include "ui/interface.h" #include "inkgc/gc-core.h" -#include "ui/dialog-events.h" #include "io/sys.h" #include "preferences.h" @@ -37,12 +31,13 @@ #include #include +#include +#include +#include #include #include -#include #include -#include -#include + #include "ui/icon-names.h" namespace Inkscape diff --git a/src/ui/dialog/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp index f557ff0fc..62e6bf591 100644 --- a/src/ui/dialog/pixelartdialog.cpp +++ b/src/ui/dialog/pixelartdialog.cpp @@ -31,7 +31,6 @@ #include #include -#include //for GTK_RESPONSE* types #include #include "ui/widget/spinbutton.h" @@ -41,18 +40,13 @@ #include "desktop-tracker.h" #include "message-stack.h" #include "selection.h" -#include "preferences.h" #include "sp-image.h" #include "display/cairo-utils.h" #include "libdepixelize/kopftracer2011.h" -#include #include "document.h" -#include "xml/repr.h" -#include "xml/document.h" #include "svg/svg.h" #include "svg/svg-color.h" -#include "color.h" #include "svg/css-ostringstream.h" #include "document-undo.h" diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index 5ec1285c1..da914dcd4 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -17,10 +17,8 @@ #include "preferences.h" #include "inkscape.h" -#include "selection.h" #include "document.h" #include "document-undo.h" -#include "sp-item.h" #include "widgets/icon.h" #include "desktop.h" #include "sp-ellipse.h" diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index c44d645a5..9ebbf040c 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include @@ -26,7 +26,6 @@ #include "extension/internal/cairo-render-context.h" #include "extension/internal/cairo-renderer.h" -#include "ui/widget/rendering-options.h" #include "document.h" #include "util/units.h" diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp index 6da8acb20..61fa4c22b 100644 --- a/src/ui/dialog/spellcheck.cpp +++ b/src/ui/dialog/spellcheck.cpp @@ -17,25 +17,18 @@ #include "message-stack.h" #include "helper/window.h" -#include "macros.h" #include "inkscape.h" #include "document.h" -#include "selection.h" #include "desktop.h" #include "ui/tools-switch.h" #include "ui/tools/text-tool.h" #include "ui/interface.h" -#include "preferences.h" -#include "sp-text.h" #include "sp-flowtext.h" #include "text-editing.h" -#include "sp-tspan.h" #include "sp-tref.h" #include "sp-defs.h" #include "selection-chemistry.h" -#include -#include "display/canvas-bpath.h" #include "display/curve.h" #include "document-undo.h" #include "sp-root.h" @@ -47,7 +40,7 @@ #endif #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 08ebbcf14..9dd2342f8 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -12,21 +12,19 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "svg-fonts-dialog.h" #include "document-private.h" #include "document-undo.h" #include -#include #include #include +#include #include #include "selection.h" -#include #include "svg/svg.h" -#include "xml/node.h" #include "xml/repr.h" #include "sp-font-face.h" #include "desktop.h" diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 6577c8d4e..e7bf96e8b 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include "color-item.h" #include "desktop.h" @@ -35,28 +34,20 @@ #include "document-undo.h" #include "extension/db.h" #include "inkscape.h" -#include "inkscape.h" #include "io/sys.h" #include "io/resource.h" #include "message-context.h" #include "path-prefix.h" -#include "preferences.h" -#include "sp-item.h" -#include "sp-gradient.h" -#include "sp-gradient-vector.h" #include "style.h" #include "ui/previewholder.h" #include "widgets/desktop-widget.h" #include "widgets/gradient-vector.h" -#include "widgets/eek-preview.h" #include "display/cairo-utils.h" #include "sp-gradient-reference.h" #include "dialog-manager.h" -#include "selection.h" #include "verbs.h" #include "gradient-chemistry.h" #include "helper/action.h" -#include "helper/action-context.h" namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 06c17611f..92bb5c605 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -32,8 +31,6 @@ #include #include #include -#include -#include #include #include #include @@ -76,8 +73,6 @@ #include "verbs.h" #include "helper/action.h" -#include "helper/action-context.h" -#include "xml/repr.h" namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index c99c1bff3..2ec710501 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -10,17 +10,13 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "tags.h" -#include #include #include -#include - #include -#include #include "desktop.h" #include "desktop-style.h" @@ -30,28 +26,19 @@ #include "inkscape.h" #include "layer-fns.h" #include "layer-manager.h" -#include "preferences.h" -#include "sp-item.h" -#include "sp-object.h" #include "sp-shape.h" #include "svg/css-ostringstream.h" -#include "ui/icon-names.h" #include "ui/widget/layertypeicon.h" #include "ui/widget/addtoicon.h" #include "verbs.h" #include "widgets/icon.h" -#include "xml/node.h" #include "xml/node-observer.h" -#include "xml/repr.h" #include "sp-root.h" #include "ui/tools/tool-base.h" //"event-context.h" -#include "selection.h" //#include "dialogs/dialog-events.h" #include "ui/widget/color-notebook.h" #include "style.h" #include "filter-chemistry.h" -#include "filters/blend.h" -#include "filters/gaussian-blur.h" #include "sp-clippath.h" #include "sp-mask.h" #include "sp-tag.h" diff --git a/src/ui/dialog/template-load-tab.cpp b/src/ui/dialog/template-load-tab.cpp index 7eb04ff79..7b96c2b97 100644 --- a/src/ui/dialog/template-load-tab.cpp +++ b/src/ui/dialog/template-load-tab.cpp @@ -9,28 +9,20 @@ */ #include "template-widget.h" -#include "template-load-tab.h" #include "new-from-template.h" -#include -#include -#include -#include #include #include +#include +#include +#include #include -#include #include "extension/db.h" -#include "extension/effect.h" #include "inkscape.h" #include "ui/interface.h" #include "file.h" #include "path-prefix.h" -#include "preferences.h" -#include "xml/repr.h" -#include "xml/document.h" -#include "xml/node.h" namespace Inkscape { namespace UI { diff --git a/src/ui/dialog/template-widget.cpp b/src/ui/dialog/template-widget.cpp index 0d110d853..3b7fbe88c 100644 --- a/src/ui/dialog/template-widget.cpp +++ b/src/ui/dialog/template-widget.cpp @@ -10,15 +10,10 @@ #include "template-widget.h" +#include #include -#include -#include #include -#include -#include - -#include "template-load-tab.h" #include "desktop.h" #include "document.h" diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index c01da8864..6ce377419 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -22,7 +22,6 @@ #include "text-edit.h" #include -#include #ifdef WITH_GTKSPELL extern "C" { @@ -31,11 +30,8 @@ extern "C" { #endif #include -#include #include -#include -#include "macros.h" #include "helper/window.h" #include "inkscape.h" #include "document.h" @@ -43,13 +39,10 @@ extern "C" { #include "desktop-style.h" #include "document-undo.h" -#include "selection.h" -#include "style.h" #include "sp-text.h" #include "sp-flowtext.h" #include "text-editing.h" #include "ui/icon-names.h" -#include "preferences.h" #include "verbs.h" #include "ui/interface.h" #include "svg/css-ostringstream.h" diff --git a/src/ui/dialog/tracedialog.cpp b/src/ui/dialog/tracedialog.cpp index 11e75391b..1c0cb5708 100644 --- a/src/ui/dialog/tracedialog.cpp +++ b/src/ui/dialog/tracedialog.cpp @@ -12,18 +12,17 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "tracedialog.h" #include #include +#include #include "ui/widget/spinbutton.h" #include "ui/widget/frame.h" -#include #include -#include //for GTK_RESPONSE* types #include #include "desktop.h" diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index b7638e8c1..031bc5ae1 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -12,7 +12,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include @@ -26,15 +26,11 @@ #include "transformation.h" #include "align-and-distribute.h" #include "inkscape.h" -#include "selection.h" #include "selection-chemistry.h" #include "message-stack.h" #include "verbs.h" -#include "preferences.h" #include "sp-namedview.h" #include "sp-item-transform.h" -#include "macros.h" -#include "sp-item.h" #include "ui/icon-names.h" #include "widgets/icon.h" diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index a50a169eb..38fab8f07 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -12,18 +12,14 @@ */ #ifdef HAVE_CONFIG_H -# include +#include "config.h" #endif #include "undo-history.h" -#include -#include -#include #include "document.h" #include "document-undo.h" #include "inkscape.h" -#include "verbs.h" #include "util/signal-blocker.h" diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index 99a4acc69..c2711bb02 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -18,7 +18,6 @@ #include "xml-tree.h" #include "widgets/icon.h" -#include #include #include @@ -31,18 +30,14 @@ #include "helper/window.h" #include "inkscape.h" #include "ui/interface.h" -#include "macros.h" #include "message-context.h" #include "message-stack.h" -#include "preferences.h" -#include "selection.h" #include "shortcuts.h" #include "sp-root.h" #include "sp-string.h" #include "sp-tspan.h" #include "ui/icon-names.h" #include "verbs.h" -#include "widgets/icon.h" #include "widgets/sp-xmlview-attr-list.h" #include "widgets/sp-xmlview-content.h" diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index ab29471ed..a7048c402 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -20,12 +20,13 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include "ui/dialog/dialog-manager.h" #include #include "file.h" +#include #include #include @@ -35,25 +36,20 @@ #include "extension/input.h" #include "widgets/icon.h" #include "preferences.h" -#include "path-prefix.h" #include "shortcuts.h" #include "document.h" #include "ui/interface.h" #include "desktop.h" -#include "selection.h" #include "selection-chemistry.h" #include "svg-view-widget.h" #include "widgets/desktop-widget.h" #include "sp-item-group.h" #include "sp-text.h" -#include "sp-gradient.h" #include "sp-flowtext.h" #include "sp-namedview.h" #include "sp-root.h" -#include "ui/view/view.h" #include "helper/action.h" -#include "helper/action-context.h" #include "helper/gnome-utils.h" #include "helper/window.h" #include "io/sys.h" @@ -63,7 +59,6 @@ #include "ui/clipboard.h" #include "display/sp-canvas.h" -#include "color.h" #include "svg/svg-color.h" #include "desktop-style.h" #include "style.h" @@ -74,7 +69,6 @@ #include "sp-anchor.h" #include "sp-clippath.h" #include "sp-image.h" -#include "sp-item.h" #include "sp-mask.h" #include "message-stack.h" #include "ui/dialog/layer-properties.h" @@ -83,10 +77,6 @@ #include "widgets/image-menu-item.h" #endif -#include - -#include - using Inkscape::DocumentUndo; /* Drag and Drop */ diff --git a/src/ui/object-edit.cpp b/src/ui/object-edit.cpp index 459acf002..ddf770f59 100644 --- a/src/ui/object-edit.cpp +++ b/src/ui/object-edit.cpp @@ -12,11 +12,9 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif - - #include "sp-item.h" #include "sp-rect.h" #include "box3d.h" @@ -32,11 +30,8 @@ #include "sp-namedview.h" #include "live_effects/effect.h" #include "sp-pattern.h" -#include "sp-path.h" #include #include "ui/object-edit.h" -#include "xml/repr.h" -#include <2geom/math-utils.h> #include "knot-holder-entity.h" #define sp_round(v,m) (((v) < 0.0) ? ((ceil((v) / (m) - 0.5)) * (m)) : ((floor((v) / (m) + 0.5)) * (m))) diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index 5e75179a3..ac1369ced 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -12,7 +12,6 @@ #include "previewholder.h" -#include "preferences.h" #include #include diff --git a/src/ui/selected-color.cpp b/src/ui/selected-color.cpp index 846d50a5b..08f4bd979 100644 --- a/src/ui/selected-color.cpp +++ b/src/ui/selected-color.cpp @@ -11,7 +11,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include diff --git a/src/ui/shape-editor.cpp b/src/ui/shape-editor.cpp index aec5cde27..98320ed8c 100644 --- a/src/ui/shape-editor.cpp +++ b/src/ui/shape-editor.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include @@ -16,11 +16,8 @@ #include "desktop.h" #include "document.h" -#include "gc-anchored.h" #include "knotholder.h" #include "ui/object-edit.h" -#include "sp-item.h" -#include "sp-object.h" #include "ui/shape-editor.h" #include "xml/node-event-vector.h" diff --git a/src/ui/tool-factory.cpp b/src/ui/tool-factory.cpp index c6c579c9e..f101e5a24 100644 --- a/src/ui/tool-factory.cpp +++ b/src/ui/tool-factory.cpp @@ -27,14 +27,12 @@ #include "ui/tools/mesh-tool.h" #include "ui/tools/node-tool.h" #include "ui/tools/pencil-tool.h" -#include "ui/tools/pen-tool.h" #include "ui/tools/rect-tool.h" #include "ui/tools/select-tool.h" #include "ui/tools/spiral-tool.h" #include "ui/tools/spray-tool.h" #include "ui/tools/star-tool.h" #include "ui/tools/text-tool.h" -#include "ui/tools/tool-base.h" #include "ui/tools/tweak-tool.h" #include "ui/tools/zoom-tool.h" diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp index f36ad7374..a5611addc 100644 --- a/src/ui/tool/control-point-selection.cpp +++ b/src/ui/tool/control-point-selection.cpp @@ -13,7 +13,6 @@ #include "ui/tool/selectable-control-point.h" #include <2geom/transforms.h> #include "desktop.h" -#include "preferences.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" #include "ui/tool/transform-handle-set.h" diff --git a/src/ui/tool/control-point.cpp b/src/ui/tool/control-point.cpp index 636595016..d9374c790 100644 --- a/src/ui/tool/control-point.cpp +++ b/src/ui/tool/control-point.cpp @@ -16,8 +16,6 @@ #include "display/snap-indicator.h" #include "ui/tools/tool-base.h" #include "message-context.h" -#include "preferences.h" -#include "snap-preferences.h" #include "sp-namedview.h" #include "ui/control-manager.h" #include "ui/tool/control-point.h" diff --git a/src/ui/tool/curve-drag-point.cpp b/src/ui/tool/curve-drag-point.cpp index e460b0fb7..908e18474 100644 --- a/src/ui/tool/curve-drag-point.cpp +++ b/src/ui/tool/curve-drag-point.cpp @@ -8,15 +8,12 @@ #include "ui/tool/curve-drag-point.h" #include -#include <2geom/bezier-curve.h> #include "desktop.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/path-manipulator.h" -#include "ui/tool/node.h" #include "sp-namedview.h" -#include "snap.h" namespace Inkscape { namespace UI { diff --git a/src/ui/tool/manipulator.cpp b/src/ui/tool/manipulator.cpp index 11dd220f4..82ff014e4 100644 --- a/src/ui/tool/manipulator.cpp +++ b/src/ui/tool/manipulator.cpp @@ -8,8 +8,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "ui/tool/node.h" -#include "ui/tool/manipulator.h" +//#include "ui/tool/node.h" +//#include "ui/tool/manipulator.h" namespace Inkscape { namespace UI { diff --git a/src/ui/tool/modifier-tracker.cpp b/src/ui/tool/modifier-tracker.cpp index cc4e4d0b2..f502acab2 100644 --- a/src/ui/tool/modifier-tracker.cpp +++ b/src/ui/tool/modifier-tracker.cpp @@ -12,7 +12,6 @@ #include #include "ui/tool/event-utils.h" #include "ui/tool/modifier-tracker.h" -#include namespace Inkscape { namespace UI { diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 9ec6f733f..f30c7e349 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -19,13 +19,11 @@ #include "document-undo.h" #include "live_effects/lpeobject.h" #include "message-stack.h" -#include "preferences.h" #include "sp-path.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/path-manipulator.h" -#include "util/unordered-containers.h" #include "verbs.h" #include diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 9268d9730..0e5a9279d 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -12,25 +12,20 @@ #include "multi-path-manipulator.h" #include #include <2geom/bezier-utils.h> -#include <2geom/transforms.h> #include "display/sp-ctrlline.h" #include "display/sp-canvas.h" #include "display/sp-canvas-util.h" #include "desktop.h" -#include "preferences.h" #include "snap.h" -#include "snap-preferences.h" #include "sp-namedview.h" #include "ui/control-manager.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" -#include "ui/tool/node.h" #include "ui/tool/path-manipulator.h" #include "ui/tools/node-tool.h" #include "ui/tools-switch.h" #include -#include namespace { diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index de071dad3..f316bea38 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -13,36 +13,23 @@ #include "live_effects/lpe-powerstroke.h" #include "live_effects/lpe-bspline.h" #include "live_effects/lpe-fillet-chamfer.h" -#include -#include -#include -#include -#include -#include <2geom/bezier-curve.h> #include <2geom/bezier-utils.h> #include <2geom/path-sink.h> -#include #include "ui/tool/path-manipulator.h" -#include "desktop.h" #include "display/sp-canvas.h" #include "display/sp-canvas-util.h" #include "display/curve.h" #include "display/canvas-bpath.h" -#include "document.h" -#include "live_effects/effect.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" -#include "sp-path.h" #include "helper/geom.h" -#include "preferences.h" #include "style.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/curve-drag-point.h" #include "ui/tool/event-utils.h" #include "ui/tool/multi-path-manipulator.h" -#include "xml/node.h" #include "xml/node-observer.h" namespace Inkscape { diff --git a/src/ui/tool/selector.cpp b/src/ui/tool/selector.cpp index 9acf7de88..84e96173d 100644 --- a/src/ui/tool/selector.cpp +++ b/src/ui/tool/selector.cpp @@ -14,7 +14,6 @@ #include "display/sodipodi-ctrlrect.h" #include "ui/tools/tool-base.h" -#include "preferences.h" #include "ui/tool/event-utils.h" #include "ui/tool/selector.h" diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp index 748b9d4cc..33015fe11 100644 --- a/src/ui/tool/transform-handle-set.cpp +++ b/src/ui/tool/transform-handle-set.cpp @@ -18,11 +18,7 @@ #include "sp-namedview.h" #include "display/sodipodi-ctrlrect.h" -#include "preferences.h" #include "pure-transform.h" -#include "snap.h" -#include "snap-candidate.h" -#include "sp-namedview.h" #include "ui/tool/commit-events.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/selectable-control-point.h" diff --git a/src/ui/tools-switch.cpp b/src/ui/tools-switch.cpp index ea0431b0a..d87bcc51d 100644 --- a/src/ui/tools-switch.cpp +++ b/src/ui/tools-switch.cpp @@ -13,16 +13,11 @@ #include // prevents deprecation warnings -#include -#include - #include "inkscape.h" #include "desktop.h" #include -#include - #include "ui/tools-switch.h" #include "box3d.h" @@ -52,7 +47,6 @@ #include "ui/tools/measure-tool.h" #include "ui/tools/mesh-tool.h" #include "ui/tools/node-tool.h" -#include "ui/tools/pen-tool.h" #include "ui/tools/pencil-tool.h" #include "ui/tools/rect-tool.h" #include "ui/tools/select-tool.h" diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp index c6a9bb23a..6652f7ab5 100644 --- a/src/ui/tools/arc-tool.cpp +++ b/src/ui/tools/arc-tool.cpp @@ -17,7 +17,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -30,7 +30,6 @@ #include "sp-namedview.h" #include "selection.h" -#include "snap.h" #include "pixmaps/cursor-ellipse.xpm" #include "xml/repr.h" #include "xml/node-event-vector.h" diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp index 27e755add..9b5b264bc 100644 --- a/src/ui/tools/box3d-tool.cpp +++ b/src/ui/tools/box3d-tool.cpp @@ -15,8 +15,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "config.h" - #include #include "macros.h" @@ -27,8 +25,6 @@ #include "selection.h" #include "selection-chemistry.h" -#include "snap.h" -#include "display/curve.h" #include "display/sp-canvas-item.h" #include "desktop.h" #include "message-context.h" @@ -36,17 +32,12 @@ #include "box3d.h" #include "ui/tools/box3d-tool.h" #include -#include "xml/repr.h" #include "xml/node-event-vector.h" -#include "preferences.h" #include "context-fns.h" #include "desktop-style.h" -#include "transf_mat_3x4.h" #include "perspective-line.h" -#include "persp3d.h" #include "box3d-side.h" #include "document-private.h" -#include "line-geometry.h" #include "ui/shape-editor.h" #include "verbs.h" diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp index 28195eb75..84c4adc89 100644 --- a/src/ui/tools/calligraphic-tool.cpp +++ b/src/ui/tools/calligraphic-tool.cpp @@ -23,8 +23,6 @@ #define noDYNA_DRAW_VERBOSE -#include "config.h" - #include #include #include @@ -35,12 +33,10 @@ #include "svg/svg.h" #include "display/canvas-bpath.h" #include "display/cairo-utils.h" -#include <2geom/math-utils.h> #include <2geom/pathvector.h> #include <2geom/bezier-utils.h> #include <2geom/circle.h> #include "display/curve.h" -#include #include "macros.h" #include "document.h" #include "document-undo.h" @@ -50,20 +46,15 @@ #include "desktop-style.h" #include "message-context.h" -#include "preferences.h" #include "pixmaps/cursor-calligraphy.xpm" -#include "xml/repr.h" #include "context-fns.h" -#include "sp-item.h" #include "inkscape.h" -#include "color.h" #include "splivarot.h" #include "sp-item-group.h" #include "sp-shape.h" #include "sp-path.h" #include "sp-text.h" #include "display/sp-canvas.h" -#include "display/canvas-bpath.h" #include "display/canvas-arena.h" #include "livarot/Shape.h" #include "verbs.h" diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp index 74f2664fe..605b573d7 100644 --- a/src/ui/tools/connector-tool.cpp +++ b/src/ui/tools/connector-tool.cpp @@ -75,7 +75,6 @@ #include "ui/tools/connector-tool.h" #include "pixmaps/cursor-connector.xpm" #include "xml/node-event-vector.h" -#include "xml/repr.h" #include "svg/svg.h" #include "desktop.h" #include "desktop-style.h" @@ -86,19 +85,13 @@ #include "message-stack.h" #include "selection.h" #include "inkscape.h" -#include "preferences.h" #include "sp-path.h" #include "display/sp-canvas.h" #include "display/canvas-bpath.h" -#include "display/sodipodi-ctrl.h" #include #include #include "snap.h" -#include "knot.h" #include "sp-conn-end.h" -#include "sp-conn-end-pair.h" -#include "conn-avoid-ref.h" -#include "libavoid/vertices.h" #include "libavoid/router.h" #include "context-fns.h" #include "sp-namedview.h" diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp index c838c27d5..4db720686 100644 --- a/src/ui/tools/dropper-tool.cpp +++ b/src/ui/tools/dropper-tool.cpp @@ -12,7 +12,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -27,7 +27,6 @@ #include "display/curve.h" #include "display/cairo-utils.h" #include "svg/svg-color.h" -#include "color.h" #include "color-rgba.h" #include "desktop-style.h" #include "preferences.h" @@ -36,7 +35,6 @@ #include "desktop.h" #include "selection.h" -#include "document.h" #include "document-undo.h" #include "pixmaps/cursor-dropper-f.xpm" @@ -45,7 +43,6 @@ #include "ui/tools/dropper-tool.h" #include "message-context.h" #include "verbs.h" -#include "ui/tools/tool-base.h" using Inkscape::DocumentUndo; diff --git a/src/ui/tools/dynamic-base.cpp b/src/ui/tools/dynamic-base.cpp index eb789d850..6627a470e 100644 --- a/src/ui/tools/dynamic-base.cpp +++ b/src/ui/tools/dynamic-base.cpp @@ -1,13 +1,7 @@ #include "ui/tools/dynamic-base.h" -#include - -#include "config.h" - #include "message-context.h" -#include "streq.h" -#include "preferences.h" #include "display/sp-canvas-item.h" #include "desktop.h" #include "display/curve.h" diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 6b32b5901..838522b34 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -24,8 +24,6 @@ #define noERASER_VERBOSE -#include "config.h" - #include #include #include @@ -38,7 +36,6 @@ #include "display/canvas-bpath.h" #include <2geom/bezier-utils.h> -#include #include "macros.h" #include "document.h" #include "selection.h" @@ -47,26 +44,18 @@ #include "desktop-style.h" #include "message-context.h" -#include "preferences.h" #include "pixmaps/cursor-eraser.xpm" -#include "xml/repr.h" #include "context-fns.h" -#include "sp-item.h" -#include "color.h" #include "rubberband.h" #include "splivarot.h" #include "sp-item-group.h" #include "sp-shape.h" #include "sp-path.h" #include "sp-text.h" -#include "display/canvas-bpath.h" #include "display/canvas-arena.h" -#include "livarot/Shape.h" #include "document-undo.h" #include "verbs.h" #include "style.h" -#include "style-enums.h" -#include <2geom/math-utils.h> #include <2geom/pathvector.h> #include "path-chemistry.h" #include "display/curve.h" diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index 748c82717..2f125e6ed 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -18,14 +18,13 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include "trace/potrace/inkscape-potrace.h" #include <2geom/pathvector.h> #include #include -#include #include #include "color.h" @@ -36,7 +35,6 @@ #include "display/cairo-utils.h" #include "display/drawing-context.h" #include "display/drawing-image.h" -#include "display/drawing-item.h" #include "display/drawing.h" #include "display/sp-canvas.h" #include "document.h" @@ -47,23 +45,15 @@ #include "macros.h" #include "message-context.h" #include "message-stack.h" -#include "preferences.h" #include "rubberband.h" #include "selection.h" #include "ui/shape-editor.h" -#include "sp-defs.h" -#include "sp-item.h" #include "splivarot.h" #include "sp-namedview.h" -#include "sp-object.h" -#include "sp-path.h" -#include "sp-rect.h" #include "sp-root.h" #include "svg/svg.h" #include "trace/imagemap.h" -#include "trace/trace.h" #include "xml/node-event-vector.h" -#include "xml/repr.h" #include "verbs.h" #include "pixmaps/cursor-paintbucket.xpm" diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 7697cd59c..eb29ed88d 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -17,43 +17,29 @@ #define DRAW_VERBOSE #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include "live_effects/lpe-bendpath.h" #include "live_effects/lpe-patternalongpath.h" #include "live_effects/lpe-simplify.h" #include "display/canvas-bpath.h" -#include "xml/repr.h" #include "svg/svg.h" -#include #include "display/curve.h" -#include "desktop.h" #include "desktop-style.h" -#include "document.h" #include "ui/draw-anchor.h" #include "macros.h" #include "message-stack.h" #include "ui/tools/pen-tool.h" #include "ui/tools/lpe-tool.h" -#include "preferences.h" -#include "selection.h" #include "selection-chemistry.h" -#include "snap.h" -#include "sp-path.h" -#include "sp-use.h" #include "sp-item-group.h" -#include "sp-namedview.h" #include "live_effects/lpe-powerstroke.h" #include "style.h" #include "ui/control-manager.h" -#include "util/units.h" // clipboard support #include "ui/clipboard.h" -#include "ui/tools/freehand-base.h" - -#include using Inkscape::DocumentUndo; diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp index 9d8101cc4..e4814c3de 100644 --- a/src/ui/tools/gradient-tool.cpp +++ b/src/ui/tools/gradient-tool.cpp @@ -13,7 +13,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif @@ -31,17 +31,10 @@ #include "ui/tools/gradient-tool.h" #include "gradient-chemistry.h" #include -#include "preferences.h" #include "gradient-drag.h" -#include "gradient-chemistry.h" -#include "xml/repr.h" -#include "sp-item.h" #include "display/sp-ctrlline.h" -#include "sp-linear-gradient.h" -#include "sp-radial-gradient.h" #include "sp-stop.h" #include "svg/css-ostringstream.h" -#include "svg/svg-color.h" #include "snap.h" #include "sp-namedview.h" #include "rubberband.h" diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp index 9bbc1ac20..ee85dd28c 100644 --- a/src/ui/tools/lpe-tool.cpp +++ b/src/ui/tools/lpe-tool.cpp @@ -15,19 +15,16 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include <2geom/sbasis-geometric.h> -#include #include -#include "macros.h" #include "pixmaps/cursor-crosshairs.xpm" #include #include "desktop.h" #include "message-context.h" -#include "preferences.h" #include "ui/shape-editor.h" #include "selection.h" diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index 63e2460ec..c941b9bee 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -11,11 +11,10 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include -#include #include #include "util/units.h" #include "display/curve.h" @@ -23,7 +22,6 @@ #include "display/sp-ctrlline.h" #include "display/sp-ctrlcurve.h" #include "display/sp-canvas.h" -#include "display/sp-canvas-item.h" #include "display/sp-canvas-util.h" #include "svg/svg.h" #include "svg/svg-color.h" @@ -31,34 +29,20 @@ #include "ui/tools/freehand-base.h" #include <2geom/line.h> #include <2geom/path-intersection.h> -#include <2geom/pathvector.h> -#include <2geom/crossing.h> -#include <2geom/angle.h> -#include <2geom/transforms.h> #include "ui/dialog/knot-properties.h" #include "sp-namedview.h" -#include "sp-shape.h" #include "sp-text.h" #include "sp-flowtext.h" #include "sp-defs.h" -#include "sp-item.h" #include "sp-root.h" -#include "macros.h" #include "svg/stringstream.h" #include "rubberband.h" #include "path-chemistry.h" #include "desktop.h" -#include "document.h" #include "document-undo.h" -#include "viewbox.h" -#include "snap.h" -#include "knot.h" #include "text-editing.h" #include "pixmaps/cursor-measure.xpm" -#include "preferences.h" #include "inkscape.h" -#include "enums.h" -#include "knot-enums.h" #include "desktop-style.h" #include "verbs.h" #include diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 47927667c..32e70bc19 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif //#define DEBUG_MESH @@ -33,7 +33,6 @@ #include "macros.h" #include "message-context.h" #include "message-stack.h" -#include "preferences.h" #include "rubberband.h" #include "selection.h" #include "snap.h" diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 23aaf6bb1..bf18d4a2e 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -24,25 +24,19 @@ #include "message-context.h" #include "selection.h" #include "ui/shape-editor.h" // temporary! -#include "live_effects/effect.h" -#include "display/curve.h" #include "snap.h" #include "sp-namedview.h" #include "sp-clippath.h" #include "sp-item-group.h" #include "sp-mask.h" -#include "sp-object-group.h" -#include "sp-path.h" #include "sp-text.h" #include "ui/control-manager.h" #include "ui/tools/node-tool.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" -#include "ui/tool/manipulator.h" #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/path-manipulator.h" #include "ui/tool/selector.h" -#include "ui/tool/shape-record.h" #include "pixmaps/cursor-node.xpm" #include "pixmaps/cursor-node-d.xpm" diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 18af8e105..49f28ad2c 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -32,8 +32,6 @@ #include "ui/draw-anchor.h" #include "message-stack.h" #include "message-context.h" -#include "preferences.h" -#include "sp-path.h" #include "display/sp-canvas.h" #include "display/curve.h" #include "pixmaps/cursor-pen.xpm" @@ -46,7 +44,6 @@ #include "ui/tools-switch.h" #include "ui/control-manager.h" // we include the necessary files for BSpline & Spiro -#include "live_effects/effect.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" @@ -54,25 +51,16 @@ #include "live_effects/lpe-spiro.h" -#include -#include <2geom/pathvector.h> -#include <2geom/affine.h> #include <2geom/curves.h> #include "helper/geom-nodetype.h" -#include "helper/geom-curves.h" // For handling un-continuous paths: -#include "message-stack.h" #include "inkscape.h" -#include "desktop.h" #include "live_effects/spiro.h" #define INKSCAPE_LPE_BSPLINE_C #include "live_effects/lpe-bspline.h" -#include <2geom/nearest-time.h> - -#include "live_effects/effect.h" using Inkscape::ControlManager; diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index b029ca613..7cc695040 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -27,7 +27,6 @@ #include "message-stack.h" #include "message-context.h" #include "sp-path.h" -#include "preferences.h" #include "snap.h" #include "pixmaps/cursor-pencil.xpm" #include <2geom/sbasis-to-bezier.h> @@ -36,13 +35,9 @@ #include #include "context-fns.h" #include "sp-namedview.h" -#include "xml/repr.h" -#include "document.h" #include "desktop-style.h" -#include "macros.h" #include "display/sp-canvas.h" #include "display/curve.h" -#include "livarot/Path.h" #include "ui/tool/event-utils.h" namespace Inkscape { diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp index 844965c4d..00330ef57 100644 --- a/src/ui/tools/rect-tool.cpp +++ b/src/ui/tools/rect-tool.cpp @@ -14,8 +14,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "config.h" - #include #include #include @@ -29,16 +27,13 @@ #include "selection.h" #include "selection-chemistry.h" -#include "snap.h" #include "desktop.h" #include "desktop-style.h" #include "message-context.h" #include "pixmaps/cursor-rect.xpm" #include "ui/tools/rect-tool.h" #include -#include "xml/repr.h" #include "xml/node-event-vector.h" -#include "preferences.h" #include "context-fns.h" #include "ui/shape-editor.h" #include "verbs.h" diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index b5ec3d88e..5d802d4da 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include #include @@ -40,14 +40,12 @@ #include "desktop.h" #include "sp-root.h" -#include "preferences.h" #include "ui/tools-switch.h" #include "message-stack.h" #include "selection-describer.h" #include "seltrans.h" #include "box3d.h" #include "display/sp-canvas.h" -#include "display/sp-canvas-item.h" #include "display/drawing-item.h" using Inkscape::DocumentUndo; diff --git a/src/ui/tools/spiral-tool.cpp b/src/ui/tools/spiral-tool.cpp index 833fef18d..0ba08853e 100644 --- a/src/ui/tools/spiral-tool.cpp +++ b/src/ui/tools/spiral-tool.cpp @@ -14,8 +14,6 @@ * Released under GNU GPL */ -#include "config.h" - #include #include #include @@ -28,16 +26,13 @@ #include "sp-namedview.h" #include "selection.h" -#include "snap.h" #include "desktop.h" #include "desktop-style.h" #include "message-context.h" #include "pixmaps/cursor-spiral.xpm" #include "ui/tools/spiral-tool.h" #include -#include "xml/repr.h" #include "xml/node-event-vector.h" -#include "preferences.h" #include "context-fns.h" #include "ui/shape-editor.h" #include "verbs.h" diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 9adaf3879..3fafac2a7 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -19,15 +19,12 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "config.h" - #include #include "ui/dialog/dialog-manager.h" #include "svg/svg.h" -#include #include "macros.h" #include "document.h" #include "document-undo.h" @@ -37,10 +34,7 @@ #include "message-context.h" #include "pixmaps/cursor-spray.xpm" -#include -#include "xml/repr.h" #include "context-fns.h" -#include "sp-item.h" #include "inkscape.h" #include "splivarot.h" @@ -57,17 +51,12 @@ #include "svg/svg-color.h" #include "sp-text.h" -#include "sp-root.h" #include "sp-flowtext.h" #include "display/sp-canvas.h" -#include "display/canvas-bpath.h" #include "display/canvas-arena.h" #include "display/curve.h" #include "livarot/Shape.h" #include <2geom/circle.h> -#include <2geom/transforms.h> -#include "preferences.h" -#include "style.h" #include "box3d.h" #include "sp-item-transform.h" #include "filter-chemistry.h" @@ -76,9 +65,6 @@ #include "helper/action.h" #include "verbs.h" -#include - -#include #include #include diff --git a/src/ui/tools/star-tool.cpp b/src/ui/tools/star-tool.cpp index 9190ae57b..ddee08189 100644 --- a/src/ui/tools/star-tool.cpp +++ b/src/ui/tools/star-tool.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include @@ -31,14 +31,11 @@ #include "sp-namedview.h" #include "selection.h" -#include "snap.h" #include "desktop.h" #include "desktop-style.h" #include "message-context.h" #include "pixmaps/cursor-star.xpm" #include -#include "preferences.h" -#include "xml/repr.h" #include "xml/node-event-vector.h" #include "context-fns.h" #include "ui/shape-editor.h" diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp index 1888551cf..559187764 100644 --- a/src/ui/tools/text-tool.cpp +++ b/src/ui/tools/text-tool.cpp @@ -14,7 +14,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -23,7 +23,6 @@ #include #include #include -#include #include "context-fns.h" @@ -36,7 +35,6 @@ #include "message-stack.h" #include "pixmaps/cursor-text-insert.xpm" #include "pixmaps/cursor-text.xpm" -#include "preferences.h" #include "rubberband.h" #include "selection-chemistry.h" #include "selection.h" @@ -50,8 +48,6 @@ #include "ui/control-manager.h" #include "verbs.h" #include "xml/node-event-vector.h" -#include "xml/repr.h" -#include using Inkscape::ControlManager; using Inkscape::DocumentUndo; diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 72ba499de..735f5bd42 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -15,7 +15,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include "widgets/desktop-widget.h" @@ -24,12 +24,8 @@ #include "file.h" #include "ui/tools/tool-base.h" -#include #include -#include #include -#include -#include #include "display/sp-canvas.h" #include "xml/node-event-vector.h" @@ -43,18 +39,14 @@ #include "ui/interface.h" #include "macros.h" #include "ui/tools-switch.h" -#include "preferences.h" #include "message-context.h" #include "gradient-drag.h" -#include "attributes.h" #include "rubberband.h" #include "selcue.h" #include "ui/tools/lpe-tool.h" #include "ui/tool/control-point.h" #include "ui/shape-editor.h" #include "sp-guide.h" -#include "color.h" -#include "knot.h" #include "knot-ptr.h" // globals for temporary switching to selector by space diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index 39a7a3f0b..fbf1b2a0b 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -11,8 +11,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "config.h" - #include #include #include @@ -21,7 +19,6 @@ #include "svg/svg.h" -#include #include "macros.h" #include "document.h" #include "document-undo.h" @@ -48,19 +45,13 @@ #include "pixmaps/cursor-push.xpm" #include "pixmaps/cursor-roughen.xpm" #include "pixmaps/cursor-color.xpm" -#include -#include "xml/repr.h" #include "context-fns.h" -#include "sp-item.h" #include "inkscape.h" -#include "color.h" -#include "svg/svg-color.h" #include "splivarot.h" #include "sp-item-group.h" #include "sp-shape.h" #include "sp-path.h" #include "path-chemistry.h" -#include "sp-gradient.h" #include "sp-stop.h" #include "sp-gradient-reference.h" #include "sp-linear-gradient.h" @@ -69,13 +60,10 @@ #include "sp-text.h" #include "sp-flowtext.h" #include "display/sp-canvas.h" -#include "display/canvas-bpath.h" #include "display/canvas-arena.h" #include "display/curve.h" #include "livarot/Shape.h" -#include <2geom/transforms.h> #include <2geom/circle.h> -#include "preferences.h" #include "style.h" #include "box3d.h" #include "sp-item-transform.h" diff --git a/src/ui/tools/zoom-tool.cpp b/src/ui/tools/zoom-tool.cpp index 13e097c18..ca42d2d6f 100644 --- a/src/ui/tools/zoom-tool.cpp +++ b/src/ui/tools/zoom-tool.cpp @@ -21,7 +21,6 @@ #include "desktop.h" #include "pixmaps/cursor-zoom.xpm" #include "pixmaps/cursor-zoom-out.xpm" -#include "preferences.h" #include "selection-chemistry.h" #include "ui/tools/zoom-tool.h" diff --git a/src/ui/uxmanager.cpp b/src/ui/uxmanager.cpp index 036659661..cbce86cdb 100644 --- a/src/ui/uxmanager.cpp +++ b/src/ui/uxmanager.cpp @@ -10,18 +10,15 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include "widgets/desktop-widget.h" -#include #include "uxmanager.h" #include "desktop.h" #include "util/ege-tags.h" #include "widgets/toolbox.h" -#include "preferences.h" -#include "gdkmm/screen.h" #ifdef GDK_WINDOWING_X11 #include diff --git a/src/ui/widget/addtoicon.cpp b/src/ui/widget/addtoicon.cpp index 10294125d..465423fc2 100644 --- a/src/ui/widget/addtoicon.cpp +++ b/src/ui/widget/addtoicon.cpp @@ -9,7 +9,7 @@ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "ui/widget/addtoicon.h" @@ -19,9 +19,7 @@ #include "widgets/icon.h" #include "widgets/toolbox.h" #include "ui/icon-names.h" -#include "preferences.h" #include "layertypeicon.h" -#include "addtoicon.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/anchor-selector.cpp b/src/ui/widget/anchor-selector.cpp index df00b786a..acf8aff79 100644 --- a/src/ui/widget/anchor-selector.cpp +++ b/src/ui/widget/anchor-selector.cpp @@ -8,7 +8,6 @@ */ #include "ui/widget/anchor-selector.h" -#include #include "widgets/icon.h" #include "ui/icon-names.h" diff --git a/src/ui/widget/clipmaskicon.cpp b/src/ui/widget/clipmaskicon.cpp index 421f1df1e..8715fdede 100644 --- a/src/ui/widget/clipmaskicon.cpp +++ b/src/ui/widget/clipmaskicon.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "ui/widget/clipmaskicon.h" diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp index e4f58fe8a..52c6ed2e3 100644 --- a/src/ui/widget/color-icc-selector.cpp +++ b/src/ui/widget/color-icc-selector.cpp @@ -2,14 +2,11 @@ #include "config.h" #endif -#include #include #include #include -#include #include -#include #include "ui/dialog-events.h" #include "ui/widget/color-icc-selector.h" diff --git a/src/ui/widget/color-notebook.cpp b/src/ui/widget/color-notebook.cpp index 6d7ada734..6634d8dad 100644 --- a/src/ui/widget/color-notebook.cpp +++ b/src/ui/widget/color-notebook.cpp @@ -20,10 +20,6 @@ #endif #include "widgets/icon.h" -#include -#include -#include -#include #include #include #include diff --git a/src/ui/widget/color-scales.cpp b/src/ui/widget/color-scales.cpp index 48a2693bc..832bc3a62 100644 --- a/src/ui/widget/color-scales.cpp +++ b/src/ui/widget/color-scales.cpp @@ -3,15 +3,13 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif -#include #include #include #include -#include "svg/svg-icc-color.h" #include "ui/dialog-events.h" #include "ui/widget/color-scales.h" #include "ui/widget/color-slider.h" diff --git a/src/ui/widget/color-slider.cpp b/src/ui/widget/color-slider.cpp index 0c9586a67..bf2156628 100644 --- a/src/ui/widget/color-slider.cpp +++ b/src/ui/widget/color-slider.cpp @@ -12,11 +12,10 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include -#include #include #include #if WITH_GTKMM_3_0 diff --git a/src/ui/widget/color-wheel-selector.cpp b/src/ui/widget/color-wheel-selector.cpp index 22c616325..decb02b4f 100644 --- a/src/ui/widget/color-wheel-selector.cpp +++ b/src/ui/widget/color-wheel-selector.cpp @@ -1,18 +1,14 @@ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif #include "color-wheel-selector.h" -#include -#include #include #include #include #include -#include "svg/svg-icc-color.h" #include "ui/dialog-events.h" -#include "ui/selected-color.h" #include "ui/widget/color-scales.h" #include "ui/widget/color-slider.h" #include "ui/widget/gimpcolorwheel.h" diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 8d960ddc3..1b3490ffe 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -9,10 +9,8 @@ #include "ui/widget/dock.h" -#include "dock-item.h" #include "desktop.h" #include "inkscape.h" -#include "preferences.h" #include "ui/icon-names.h" #include "widgets/icon.h" diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index a8de2f384..381f0a2e1 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -14,14 +14,13 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include #include #include "inkscape.h" -#include "sp-object.h" #include "rdf.h" #include "ui/widget/registry.h" #include "sp-root.h" diff --git a/src/ui/widget/entry.cpp b/src/ui/widget/entry.cpp index 64d28119a..b1dd9ae8e 100644 --- a/src/ui/widget/entry.cpp +++ b/src/ui/widget/entry.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "entry.h" diff --git a/src/ui/widget/filter-effect-chooser.cpp b/src/ui/widget/filter-effect-chooser.cpp index 242a99073..ae2f3e7c2 100644 --- a/src/ui/widget/filter-effect-chooser.cpp +++ b/src/ui/widget/filter-effect-chooser.cpp @@ -10,12 +10,8 @@ */ #include "filter-effect-chooser.h" -#include - -#include "desktop.h" #include "document.h" -#include "inkscape.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/font-variants.cpp b/src/ui/widget/font-variants.cpp index 62598dead..aca85f246 100644 --- a/src/ui/widget/font-variants.cpp +++ b/src/ui/widget/font-variants.cpp @@ -8,26 +8,18 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include #include #include -#include #include "font-variants.h" // For updating from selection #include "desktop.h" -#include "selection.h" -#include "style.h" #include "sp-text.h" -#include "sp-tspan.h" -#include "sp-tref.h" -#include "sp-textpath.h" -#include "sp-item-group.h" -#include "xml/repr.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/frame.cpp b/src/ui/widget/frame.cpp index eaa4336bb..65d10dcc4 100644 --- a/src/ui/widget/frame.cpp +++ b/src/ui/widget/frame.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "frame.h" diff --git a/src/ui/widget/highlight-picker.cpp b/src/ui/widget/highlight-picker.cpp index 09999b52d..c1068c9b2 100644 --- a/src/ui/widget/highlight-picker.cpp +++ b/src/ui/widget/highlight-picker.cpp @@ -14,9 +14,6 @@ #include "highlight-picker.h" #include "widgets/icon.h" -#include "widgets/toolbox.h" -#include "ui/icon-names.h" -#include namespace Inkscape { namespace UI { diff --git a/src/ui/widget/imageicon.cpp b/src/ui/widget/imageicon.cpp index df261b69a..8e7df7a68 100644 --- a/src/ui/widget/imageicon.cpp +++ b/src/ui/widget/imageicon.cpp @@ -11,17 +11,12 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ - - - #include "imageicon.h" -#include #include "svg-view-widget.h" #include "document.h" #include "inkscape.h" -#include #include - +#include namespace Inkscape { diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index 1a9ce617f..7ee34f3b3 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include @@ -25,9 +25,7 @@ #include "document.h" #include "document-undo.h" #include "layer-manager.h" -#include "sp-item.h" #include "ui/icon-names.h" -#include "ui/widget/layer-selector.h" #include "util/filter-list.h" #include "util/reverse-list.h" #include "verbs.h" diff --git a/src/ui/widget/layertypeicon.cpp b/src/ui/widget/layertypeicon.cpp index 672c607e5..e281d982a 100644 --- a/src/ui/widget/layertypeicon.cpp +++ b/src/ui/widget/layertypeicon.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "ui/widget/layertypeicon.h" @@ -18,7 +18,6 @@ #include "widgets/icon.h" #include "widgets/toolbox.h" #include "ui/icon-names.h" -#include "layertypeicon.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index d21e848f2..09f3fac8d 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -13,12 +13,13 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "licensor.h" #include +#include #include "ui/widget/entity-entry.h" #include "ui/widget/registry.h" @@ -27,7 +28,6 @@ #include "document-undo.h" #include "document-private.h" #include "verbs.h" -#include namespace Inkscape { diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index 8acf083d0..c8ac20c54 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -14,8 +14,6 @@ #include "ui/widget/object-composite-settings.h" -#include - #include "desktop.h" #include "desktop-style.h" @@ -23,17 +21,12 @@ #include "document-undo.h" #include "filter-chemistry.h" #include "inkscape.h" -#include "selection.h" #include "style.h" -#include "sp-item.h" #include "svg/css-ostringstream.h" #include "verbs.h" -#include "xml/repr.h" #include "widgets/icon.h" -#include "ui/icon-names.h" #include "display/sp-canvas.h" #include "ui/widget/style-subject.h" -#include "ui/widget/gimpspinscale.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 19ab1a280..4a1fe9ac6 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -18,35 +18,18 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "page-sizer.h" -#include -#include -#include -#include -#include - #include -#include <2geom/transforms.h> - -#include "document.h" -#include "desktop.h" #include "helper/action.h" -#include "helper/action-context.h" -#include "util/units.h" -#include "inkscape.h" -#include "sp-namedview.h" #include "sp-root.h" #include "ui/widget/button.h" -#include "ui/widget/scalar-unit.h" #include "verbs.h" -#include "xml/node.h" -#include "xml/repr.h" using std::pair; using Inkscape::Util::unit_table; diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index ab13577d7..98d9d41f3 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -12,20 +12,18 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include // for Gtk::RESPONSE_* #include #include -#include +#include #include #include #include -#include - #include "panel.h" #include "icon-size.h" #include "preferences.h" diff --git a/src/ui/widget/point.cpp b/src/ui/widget/point.cpp index 6aa6196bb..2c2eb5e8a 100644 --- a/src/ui/widget/point.cpp +++ b/src/ui/widget/point.cpp @@ -12,14 +12,11 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "ui/widget/point.h" -#include "ui/widget/labelled.h" -#include "ui/widget/scalar.h" -#include namespace Inkscape { namespace UI { diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index d56506d62..e0eba3934 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -26,20 +26,16 @@ #include "verbs.h" #include "selcue.h" #include "io/sys.h" -#include #include "desktop.h" -#include "enums.h" #include "inkscape.h" #include "message-stack.h" #include "style.h" -#include "selection.h" #include "selection-chemistry.h" #include "ui/dialog/filedialog.h" -#include "xml/repr.h" -#include #include +#include #ifdef WIN32 #include diff --git a/src/ui/widget/random.cpp b/src/ui/widget/random.cpp index 0a646b6fb..b6ea16b89 100644 --- a/src/ui/widget/random.cpp +++ b/src/ui/widget/random.cpp @@ -10,7 +10,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 572845668..7dc5abc75 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -14,33 +14,21 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "registered-widget.h" -#include -#include "ui/widget/color-picker.h" -#include "ui/widget/registry.h" -#include "ui/widget/scalar-unit.h" -#include "ui/widget/point.h" -#include "ui/widget/random.h" #include "widgets/spinbutton-events.h" -#include "xml/repr.h" #include "svg/svg-color.h" #include "svg/stringstream.h" #include "verbs.h" - -// for interruptability bug: -#include "display/sp-canvas.h" - -#include "desktop.h" - - #include "sp-root.h" +#include + namespace Inkscape { namespace UI { namespace Widget { diff --git a/src/ui/widget/rendering-options.cpp b/src/ui/widget/rendering-options.cpp index 837387f7b..220731b7e 100644 --- a/src/ui/widget/rendering-options.cpp +++ b/src/ui/widget/rendering-options.cpp @@ -9,7 +9,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include diff --git a/src/ui/widget/rotateable.cpp b/src/ui/widget/rotateable.cpp index 5e938dee6..e0de22335 100644 --- a/src/ui/widget/rotateable.cpp +++ b/src/ui/widget/rotateable.cpp @@ -8,12 +8,11 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include #endif #include #include -#include #include <2geom/point.h> #include "ui/tools/tool-base.h" #include "rotateable.h" diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index f7fd63f51..7bbfa08db 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -10,11 +10,10 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "selected-style.h" -#include #include "widgets/spw-utilities.h" #include "ui/widget/color-preview.h" @@ -31,19 +30,14 @@ #include "ui/dialog/dialog-manager.h" #include "ui/dialog/fill-and-stroke.h" #include "ui/dialog/panel-dialog.h" -#include "xml/repr.h" -#include "document.h" #include "document-undo.h" #include "widgets/widget-sizes.h" #include "widgets/spinbutton-events.h" #include "widgets/gradient-image.h" -#include "sp-gradient.h" #include "svg/svg-color.h" #include "svg/css-ostringstream.h" #include "ui/tools/tool-base.h" #include "message-context.h" -#include "verbs.h" -#include "color.h" #include #include "pixmaps/cursor-adj-h.xpm" #include "pixmaps/cursor-adj-s.xpm" @@ -51,7 +45,8 @@ #include "pixmaps/cursor-adj-a.xpm" #include "sp-cursor.h" #include "gradient-chemistry.h" -#include "util/units.h" + +#include using Inkscape::Util::unit_table; diff --git a/src/ui/widget/spin-scale.cpp b/src/ui/widget/spin-scale.cpp index bb08d67df..d6b34a5b4 100644 --- a/src/ui/widget/spin-scale.cpp +++ b/src/ui/widget/spin-scale.cpp @@ -8,7 +8,6 @@ #include "spin-scale.h" -#include #include #include diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp index d7669d4e5..d1776e630 100644 --- a/src/ui/widget/spinbutton.cpp +++ b/src/ui/widget/spinbutton.cpp @@ -8,7 +8,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "spinbutton.h" diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index da3bbcd20..811ed2221 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -8,7 +8,6 @@ #include "ui/widget/style-subject.h" #include "desktop.h" -#include "sp-object.h" #include "xml/sp-css-attr.h" #include "desktop-style.h" diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index 188be705d..2952a3f97 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -13,9 +13,6 @@ #include "style-swatch.h" -#include -#include - #include "widgets/spw-utilities.h" #include "ui/widget/color-preview.h" @@ -23,13 +20,10 @@ #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" #include "sp-pattern.h" -#include "xml/repr.h" #include "xml/sp-css-attr.h" #include "widgets/widget-sizes.h" #include "util/units.h" #include "helper/action.h" -#include "helper/action-context.h" -#include "preferences.h" #include "inkscape.h" #include "verbs.h" #include diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index ced811c57..e904666cc 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -9,7 +9,7 @@ */ #ifdef HAVE_CONFIG_H -# include +#include #endif #include -- cgit v1.2.3 From eb5f0b5abdd139e2ded503eba6642f18deac2159 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Thu, 4 Aug 2016 11:51:07 +0530 Subject: Solve crash when deleting CSS property (bzr r14949.1.63) --- src/ui/dialog/styledialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 7deac22d8..370b0ab47 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -915,12 +915,12 @@ bool StyleDialog::_delProperty(GdkEventButton *event) value.erase(found, toDelProperty.length()+1); (*it)._xmlContent = key + "{" + value + "}\n"; _updateStyleContent(); + _cssPane->_store->erase(cssRow); } } } } } - _cssPane->_store->erase(cssRow); } } } -- cgit v1.2.3 From cc54d0bc9da8aafcb3d4a6529d829f76f218dc29 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 4 Aug 2016 10:22:20 +0100 Subject: Fix Win32 build Fixed bugs: - https://launchpad.net/bugs/1609572 (bzr r15037) --- src/ui/dialog/filedialog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp index ee673aecf..0d4fa5c84 100644 --- a/src/ui/dialog/filedialog.cpp +++ b/src/ui/dialog/filedialog.cpp @@ -15,7 +15,11 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "filedialogimpl-win32.h" +#ifdef WIN32 +# include "filedialogimpl-win32.h" +# include "preferences.h" +#endif + #include "filedialogimpl-gtkmm.h" #include "ui/dialog-events.h" -- cgit v1.2.3 From 4f02d390a622c0e95f52c850e07578abbe0ddf7d Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sun, 7 Aug 2016 14:41:48 +0100 Subject: aboutbox: Gtkmmify (bzr r15043.1.1) --- src/ui/dialog/aboutbox.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index ffb46fd1b..04cf9d02a 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -129,12 +129,13 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) { get_content_area()->pack_start(*manage(label), false, false); get_content_area()->pack_start(*manage(link), false, false); - Gtk::Requisition requisition; - gtk_widget_get_preferred_size(reinterpret_cast(gobj()), &requisition, NULL); + Gtk::Requisition minimum_size; + Gtk::Requisition natural_size; + get_preferred_size(minimum_size, natural_size); // allow window to shrink set_size_request(0, 0); - set_default_size(requisition.width, requisition.height); + set_default_size(minimum_size.width, minimum_size.height); } -- cgit v1.2.3 From 56fa2433ef69a260f68b8c3147ad3769ee5c8fdb Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 8 Aug 2016 11:01:15 +0100 Subject: Move GIMP widgets to their own folder (bzr r15043.1.2) --- src/ui/CMakeLists.txt | 4 - src/ui/dialog-events.h | 1 + src/ui/widget/color-icc-selector.cpp | 1 - src/ui/widget/color-notebook.h | 1 - src/ui/widget/color-scales.cpp | 1 - src/ui/widget/color-wheel-selector.cpp | 2 +- src/ui/widget/gimpcolorwheel.c | 1467 -------------------------------- src/ui/widget/gimpcolorwheel.h | 95 --- src/ui/widget/gimpspinscale.c | 969 --------------------- src/ui/widget/gimpspinscale.h | 82 -- src/ui/widget/spin-scale.cpp | 2 +- 11 files changed, 3 insertions(+), 2622 deletions(-) delete mode 100644 src/ui/widget/gimpcolorwheel.c delete mode 100644 src/ui/widget/gimpcolorwheel.h delete mode 100644 src/ui/widget/gimpspinscale.c delete mode 100644 src/ui/widget/gimpspinscale.h (limited to 'src/ui') diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 587974b90..edcc41cd2 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -130,8 +130,6 @@ set(ui_SRC widget/filter-effect-chooser.cpp widget/font-variants.cpp widget/frame.cpp - widget/gimpcolorwheel.c - widget/gimpspinscale.c widget/highlight-picker.cpp widget/imageicon.cpp widget/imagetoggler.cpp @@ -314,8 +312,6 @@ set(ui_SRC widget/filter-effect-chooser.h widget/font-variants.h widget/frame.h - widget/gimpspinscale.h - widget/gimpcolorwheel.h widget/highlight-picker.h widget/insertordericon.h widget/imageicon.h diff --git a/src/ui/dialog-events.h b/src/ui/dialog-events.h index b4a5d7c35..547cfb95d 100644 --- a/src/ui/dialog-events.h +++ b/src/ui/dialog-events.h @@ -12,6 +12,7 @@ #ifndef SEEN_DIALOG_EVENTS_H #define SEEN_DIALOG_EVENTS_H +#include /* * event callback can only accept one argument, but we need two, diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp index fea6543ea..616e9afa8 100644 --- a/src/ui/widget/color-icc-selector.cpp +++ b/src/ui/widget/color-icc-selector.cpp @@ -5,7 +5,6 @@ #include #include -#include #include #include "ui/dialog-events.h" diff --git a/src/ui/widget/color-notebook.h b/src/ui/widget/color-notebook.h index 35e46ef14..0948e3d46 100644 --- a/src/ui/widget/color-notebook.h +++ b/src/ui/widget/color-notebook.h @@ -20,7 +20,6 @@ #include #include -#include #include #include "color.h" diff --git a/src/ui/widget/color-scales.cpp b/src/ui/widget/color-scales.cpp index 7fcca215f..89913b01b 100644 --- a/src/ui/widget/color-scales.cpp +++ b/src/ui/widget/color-scales.cpp @@ -8,7 +8,6 @@ #include #include -#include #include "ui/dialog-events.h" #include "ui/widget/color-scales.h" diff --git a/src/ui/widget/color-wheel-selector.cpp b/src/ui/widget/color-wheel-selector.cpp index 18f932f10..4f011c6c3 100644 --- a/src/ui/widget/color-wheel-selector.cpp +++ b/src/ui/widget/color-wheel-selector.cpp @@ -11,7 +11,7 @@ #include "ui/dialog-events.h" #include "ui/widget/color-scales.h" #include "ui/widget/color-slider.h" -#include "ui/widget/gimpcolorwheel.h" +#include "widgets/gimp/gimpcolorwheel.h" namespace Inkscape { namespace UI { diff --git a/src/ui/widget/gimpcolorwheel.c b/src/ui/widget/gimpcolorwheel.c deleted file mode 100644 index 212391497..000000000 --- a/src/ui/widget/gimpcolorwheel.c +++ /dev/null @@ -1,1467 +0,0 @@ -/* HSV color selector for GTK+ - * - * Copyright (C) 1999 The Free Software Foundation - * - * Authors: Simon Budig (original code) - * Federico Mena-Quintero (cleanup for GTK+) - * Jonathan Blandford (cleanup for GTK+) - * Michael Natterer (ported back to GIMP) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -/* - * This widget was adopted by Inkscape by Alex Valavanis - * on 2013-01-08. Last merges with GIMP code were applied using the following - * commits from the GIMP git repository at - * http://git.gnome.org/browse/gimp/tree/modules/gimpcolorwheel.c - * - * Gtk+ 2 code merge: commit 632c5 (2013-01-06) - * Gtk+ 3 code merge: commit bcfc6, gtk3-port branch (2013-01-06) - */ - -#include "config.h" - -#include -#include - -#include "gimpcolorwheel.h" -#include - - -/* Default ring fraction */ -#define DEFAULT_FRACTION 0.1 - -/* Default width/height */ -#define DEFAULT_SIZE 100 - -/* Default ring width */ -#define DEFAULT_RING_WIDTH 10 - - -/* Dragging modes */ -typedef enum -{ - DRAG_NONE, - DRAG_H, - DRAG_SV -} DragMode; - -/* Private part of the GimpColorWheel structure */ -typedef struct -{ - /* Color value */ - gdouble h; - gdouble s; - gdouble v; - - /* ring_width is this fraction of size */ - gdouble ring_fraction; - - /* Size and ring width */ - gint size; - gint ring_width; - - /* Window for capturing events */ - GdkWindow *window; - - /* Dragging mode */ - DragMode mode; - - guint focus_on_ring : 1; -} GimpColorWheelPrivate; - -enum -{ - CHANGED, - MOVE, - LAST_SIGNAL -}; - -static void gimp_color_wheel_map (GtkWidget *widget); -static void gimp_color_wheel_unmap (GtkWidget *widget); -static void gimp_color_wheel_realize (GtkWidget *widget); -static void gimp_color_wheel_unrealize (GtkWidget *widget); -static void gimp_color_wheel_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static gboolean gimp_color_wheel_button_press (GtkWidget *widget, - GdkEventButton *event); -static gboolean gimp_color_wheel_button_release (GtkWidget *widget, - GdkEventButton *event); -static gboolean gimp_color_wheel_motion (GtkWidget *widget, - GdkEventMotion *event); -static gboolean gimp_color_wheel_draw (GtkWidget *widget, - cairo_t *cr); -static void gimp_color_wheel_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width); -static void gimp_color_wheel_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height); -static gboolean gimp_color_wheel_grab_broken (GtkWidget *widget, - GdkEventGrabBroken *event); -static gboolean gimp_color_wheel_focus (GtkWidget *widget, - GtkDirectionType direction); -static void gimp_color_wheel_move (GimpColorWheel *wheel, - GtkDirectionType dir); - - -static guint wheel_signals[LAST_SIGNAL]; - -G_DEFINE_TYPE (GimpColorWheel, gimp_color_wheel, GTK_TYPE_WIDGET) - -#define parent_class gimp_color_wheel_parent_class - - -static void -gimp_color_wheel_class_init (GimpColorWheelClass *class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (class); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); - GimpColorWheelClass *wheel_class = GIMP_COLOR_WHEEL_CLASS (class); - GtkBindingSet *binding_set; - - widget_class->map = gimp_color_wheel_map; - widget_class->unmap = gimp_color_wheel_unmap; - widget_class->realize = gimp_color_wheel_realize; - widget_class->unrealize = gimp_color_wheel_unrealize; - widget_class->size_allocate = gimp_color_wheel_size_allocate; - widget_class->button_press_event = gimp_color_wheel_button_press; - widget_class->button_release_event = gimp_color_wheel_button_release; - widget_class->motion_notify_event = gimp_color_wheel_motion; - widget_class->get_preferred_width = gimp_color_wheel_get_preferred_width; - widget_class->get_preferred_height = gimp_color_wheel_get_preferred_height; - widget_class->draw = gimp_color_wheel_draw; - widget_class->focus = gimp_color_wheel_focus; - widget_class->grab_broken_event = gimp_color_wheel_grab_broken; - - wheel_class->move = gimp_color_wheel_move; - - wheel_signals[CHANGED] = - g_signal_new ("changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GimpColorWheelClass, changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - wheel_signals[MOVE] = - g_signal_new ("move", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (GimpColorWheelClass, move), - NULL, NULL, - g_cclosure_marshal_VOID__ENUM, - G_TYPE_NONE, 1, - GTK_TYPE_DIRECTION_TYPE); - - binding_set = gtk_binding_set_by_class (class); - - gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_UP); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Up, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_UP); - - gtk_binding_entry_add_signal (binding_set, GDK_KEY_Down, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_DOWN); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Down, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_DOWN); - - - gtk_binding_entry_add_signal (binding_set, GDK_KEY_Right, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_RIGHT); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Right, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_RIGHT); - - gtk_binding_entry_add_signal (binding_set, GDK_KEY_Left, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_LEFT); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Left, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_LEFT); - - g_type_class_add_private (object_class, sizeof (GimpColorWheelPrivate)); -} - -static void -gimp_color_wheel_init (GimpColorWheel *wheel) -{ - GimpColorWheelPrivate *priv; - - priv = G_TYPE_INSTANCE_GET_PRIVATE (wheel, GIMP_TYPE_COLOR_WHEEL, - GimpColorWheelPrivate); - - wheel->priv = priv; - - gtk_widget_set_has_window (GTK_WIDGET (wheel), FALSE); - gtk_widget_set_can_focus (GTK_WIDGET (wheel), TRUE); - - priv->ring_fraction = DEFAULT_FRACTION; - priv->size = DEFAULT_SIZE; - priv->ring_width = DEFAULT_RING_WIDTH; -} - -static void -gimp_color_wheel_map (GtkWidget *widget) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - - GTK_WIDGET_CLASS (parent_class)->map (widget); - - gdk_window_show (priv->window); -} - -static void -gimp_color_wheel_unmap (GtkWidget *widget) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - - gdk_window_hide (priv->window); - - GTK_WIDGET_CLASS (parent_class)->unmap (widget); -} - -static void -gimp_color_wheel_realize (GtkWidget *widget) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - GtkAllocation allocation; - GdkWindowAttr attr; - gint attr_mask; - GdkWindow *parent_window; - - gtk_widget_get_allocation (widget, &allocation); - - gtk_widget_set_realized (widget, TRUE); - - attr.window_type = GDK_WINDOW_CHILD; - attr.x = allocation.x; - attr.y = allocation.y; - attr.width = allocation.width; - attr.height = allocation.height; - attr.wclass = GDK_INPUT_ONLY; - attr.event_mask = (gtk_widget_get_events (widget) | - GDK_KEY_PRESS_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_POINTER_MOTION_MASK | - GDK_ENTER_NOTIFY_MASK | - GDK_LEAVE_NOTIFY_MASK); - - attr_mask = GDK_WA_X | GDK_WA_Y; - - parent_window = gtk_widget_get_parent_window (widget); - - gtk_widget_set_window (widget, parent_window); - g_object_ref (parent_window); - - priv->window = gdk_window_new (parent_window, &attr, attr_mask); - gdk_window_set_user_data (priv->window, wheel); -} - -static void -gimp_color_wheel_unrealize (GtkWidget *widget) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - - gdk_window_set_user_data (priv->window, NULL); - gdk_window_destroy (priv->window); - priv->window = NULL; - - GTK_WIDGET_CLASS (parent_class)->unrealize (widget); -} - -static void -gimp_color_wheel_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width) -{ - gint focus_width; - gint focus_pad; - - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); - - *minimum_width = *natural_width = DEFAULT_SIZE + 2 * (focus_width + focus_pad); -} - -static void -gimp_color_wheel_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height) -{ - gint focus_width; - gint focus_pad; - - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); - - *minimum_height = *natural_height = DEFAULT_SIZE + 2 * (focus_width + focus_pad); -} - -static void -gimp_color_wheel_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - gint focus_width; - gint focus_pad; - - gtk_widget_set_allocation (widget, allocation); - - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); - - priv->size = MIN (allocation->width - 2 * (focus_width + focus_pad), - allocation->height - 2 * (focus_width + focus_pad)); - - priv->ring_width = priv->size * priv->ring_fraction; - - if (gtk_widget_get_realized (widget)) - gdk_window_move_resize (priv->window, - allocation->x, - allocation->y, - allocation->width, - allocation->height); -} - - -/* Utility functions */ - -#define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11) - -/* Converts from HSV to RGB */ -static void -hsv_to_rgb (gdouble *h, - gdouble *s, - gdouble *v) -{ - gdouble hue, saturation, value; - gdouble f, p, q, t; - - if (*s == 0.0) - { - *h = *v; - *s = *v; - *v = *v; /* heh */ - } - else - { - hue = *h * 6.0; - saturation = *s; - value = *v; - - if (hue == 6.0) - hue = 0.0; - - f = hue - (int) hue; - p = value * (1.0 - saturation); - q = value * (1.0 - saturation * f); - t = value * (1.0 - saturation * (1.0 - f)); - - switch ((int) hue) - { - case 0: - *h = value; - *s = t; - *v = p; - break; - - case 1: - *h = q; - *s = value; - *v = p; - break; - - case 2: - *h = p; - *s = value; - *v = t; - break; - - case 3: - *h = p; - *s = q; - *v = value; - break; - - case 4: - *h = t; - *s = p; - *v = value; - break; - - case 5: - *h = value; - *s = p; - *v = q; - break; - - default: - g_assert_not_reached (); - } - } -} - -/* Computes the vertices of the saturation/value triangle */ -static void -compute_triangle (GimpColorWheel *wheel, - gint *hx, - gint *hy, - gint *sx, - gint *sy, - gint *vx, - gint *vy) -{ - GimpColorWheelPrivate *priv = wheel->priv; - GtkAllocation allocation; - gdouble center_x; - gdouble center_y; - gdouble inner, outer; - gdouble angle; - - gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation); - - center_x = allocation.width / 2.0; - center_y = allocation.height / 2.0; - - outer = priv->size / 2.0; - inner = outer - priv->ring_width; - angle = priv->h * 2.0 * G_PI; - - *hx = floor (center_x + cos (angle) * inner + 0.5); - *hy = floor (center_y - sin (angle) * inner + 0.5); - *sx = floor (center_x + cos (angle + 2.0 * G_PI / 3.0) * inner + 0.5); - *sy = floor (center_y - sin (angle + 2.0 * G_PI / 3.0) * inner + 0.5); - *vx = floor (center_x + cos (angle + 4.0 * G_PI / 3.0) * inner + 0.5); - *vy = floor (center_y - sin (angle + 4.0 * G_PI / 3.0) * inner + 0.5); -} - -/* Computes whether a point is inside the hue ring */ -static gboolean -is_in_ring (GimpColorWheel *wheel, - gdouble x, - gdouble y) -{ - GimpColorWheelPrivate *priv = wheel->priv; - GtkAllocation allocation; - gdouble dx, dy, dist; - gdouble center_x; - gdouble center_y; - gdouble inner, outer; - - gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation); - - center_x = allocation.width / 2.0; - center_y = allocation.height / 2.0; - - outer = priv->size / 2.0; - inner = outer - priv->ring_width; - - dx = x - center_x; - dy = center_y - y; - dist = dx * dx + dy * dy; - - return (dist >= inner * inner && dist <= outer * outer); -} - -/* Computes a saturation/value pair based on the mouse coordinates */ -static void -compute_sv (GimpColorWheel *wheel, - gdouble x, - gdouble y, - gdouble *s, - gdouble *v) -{ - GtkAllocation allocation; - gint ihx, ihy, isx, isy, ivx, ivy; - gdouble hx, hy, sx, sy, vx, vy; - gdouble center_x; - gdouble center_y; - - gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation); - - compute_triangle (wheel, &ihx, &ihy, &isx, &isy, &ivx, &ivy); - - center_x = allocation.width / 2.0; - center_y = allocation.height / 2.0; - - hx = ihx - center_x; - hy = center_y - ihy; - sx = isx - center_x; - sy = center_y - isy; - vx = ivx - center_x; - vy = center_y - ivy; - x -= center_x; - y = center_y - y; - - if (vx * (x - sx) + vy * (y - sy) < 0.0) - { - *s = 1.0; - *v = (((x - sx) * (hx - sx) + (y - sy) * (hy-sy)) - / ((hx - sx) * (hx - sx) + (hy - sy) * (hy - sy))); - - if (*v < 0.0) - *v = 0.0; - else if (*v > 1.0) - *v = 1.0; - } - else if (hx * (x - sx) + hy * (y - sy) < 0.0) - { - *s = 0.0; - *v = (((x - sx) * (vx - sx) + (y - sy) * (vy - sy)) - / ((vx - sx) * (vx - sx) + (vy - sy) * (vy - sy))); - - if (*v < 0.0) - *v = 0.0; - else if (*v > 1.0) - *v = 1.0; - } - else if (sx * (x - hx) + sy * (y - hy) < 0.0) - { - *v = 1.0; - *s = (((x - vx) * (hx - vx) + (y - vy) * (hy - vy)) / - ((hx - vx) * (hx - vx) + (hy - vy) * (hy - vy))); - - if (*s < 0.0) - *s = 0.0; - else if (*s > 1.0) - *s = 1.0; - } - else - { - *v = (((x - sx) * (hy - vy) - (y - sy) * (hx - vx)) - / ((vx - sx) * (hy - vy) - (vy - sy) * (hx - vx))); - - if (*v<= 0.0) - { - *v = 0.0; - *s = 0.0; - } - else - { - if (*v > 1.0) - *v = 1.0; - - if (fabs (hy - vy) < fabs (hx - vx)) - *s = (x - sx - *v * (vx - sx)) / (*v * (hx - vx)); - else - *s = (y - sy - *v * (vy - sy)) / (*v * (hy - vy)); - - if (*s < 0.0) - *s = 0.0; - else if (*s > 1.0) - *s = 1.0; - } - } -} - -/* Computes whether a point is inside the saturation/value triangle */ -static gboolean -is_in_triangle (GimpColorWheel *wheel, - gdouble x, - gdouble y) -{ - gint hx, hy, sx, sy, vx, vy; - gdouble det, s, v; - - compute_triangle (wheel, &hx, &hy, &sx, &sy, &vx, &vy); - - det = (vx - sx) * (hy - sy) - (vy - sy) * (hx - sx); - - s = ((x - sx) * (hy - sy) - (y - sy) * (hx - sx)) / det; - v = ((vx - sx) * (y - sy) - (vy - sy) * (x - sx)) / det; - - return (s >= 0.0 && v >= 0.0 && s + v <= 1.0); -} - -/* Computes a value based on the mouse coordinates */ -static double -compute_v (GimpColorWheel *wheel, - gdouble x, - gdouble y) -{ - GtkAllocation allocation; - gdouble center_x; - gdouble center_y; - gdouble dx, dy; - gdouble angle; - - gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation); - - center_x = allocation.width / 2.0; - center_y = allocation.height / 2.0; - - dx = x - center_x; - dy = center_y - y; - - angle = atan2 (dy, dx); - if (angle < 0.0) - angle += 2.0 * G_PI; - - return angle / (2.0 * G_PI); -} - -static void -set_cross_grab (GimpColorWheel *wheel, - guint32 time) -{ - GimpColorWheelPrivate *priv = wheel->priv; - GdkCursor *cursor; - - cursor = - gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (wheel)), - GDK_CROSSHAIR); - - gdk_device_grab (gtk_get_current_event_device(), - priv->window, - GDK_OWNERSHIP_NONE, - FALSE, - GDK_POINTER_MOTION_MASK | - GDK_POINTER_MOTION_HINT_MASK | - GDK_BUTTON_RELEASE_MASK, - cursor, time); - g_object_unref (cursor); -} - -static gboolean gimp_color_wheel_grab_broken(GtkWidget *widget, GdkEventGrabBroken *event) -{ - (void)event; - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - - priv->mode = DRAG_NONE; - - return TRUE; -} - -static gboolean -gimp_color_wheel_button_press (GtkWidget *widget, - GdkEventButton *event) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - gdouble x, y; - - if (priv->mode != DRAG_NONE || event->button != 1) - return FALSE; - - x = event->x; - y = event->y; - - if (is_in_ring (wheel, x, y)) - { - priv->mode = DRAG_H; - set_cross_grab (wheel, event->time); - - gimp_color_wheel_set_color (wheel, - compute_v (wheel, x, y), - priv->s, - priv->v); - - gtk_widget_grab_focus (widget); - priv->focus_on_ring = TRUE; - - return TRUE; - } - - if (is_in_triangle (wheel, x, y)) - { - gdouble s, v; - - priv->mode = DRAG_SV; - set_cross_grab (wheel, event->time); - - compute_sv (wheel, x, y, &s, &v); - gimp_color_wheel_set_color (wheel, priv->h, s, v); - - gtk_widget_grab_focus (widget); - priv->focus_on_ring = FALSE; - - return TRUE; - } - - return FALSE; -} - -static gboolean -gimp_color_wheel_button_release (GtkWidget *widget, - GdkEventButton *event) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - DragMode mode; - gdouble x, y; - - if (priv->mode == DRAG_NONE || event->button != 1) - return FALSE; - - /* Set the drag mode to DRAG_NONE so that signal handlers for "catched" - * can see that this is the final color state. - */ - - mode = priv->mode; - priv->mode = DRAG_NONE; - - x = event->x; - y = event->y; - - if (mode == DRAG_H) - { - gimp_color_wheel_set_color (wheel, - compute_v (wheel, x, y), priv->s, priv->v); - } - else if (mode == DRAG_SV) - { - gdouble s, v; - - compute_sv (wheel, x, y, &s, &v); - gimp_color_wheel_set_color (wheel, priv->h, s, v); - } - else - g_assert_not_reached (); - - gdk_device_ungrab (gtk_get_current_event_device(), - event->time); - - return TRUE; -} - -static gboolean -gimp_color_wheel_motion (GtkWidget *widget, - GdkEventMotion *event) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - gdouble x, y; - - if (priv->mode == DRAG_NONE) - return FALSE; - - gdk_event_request_motions (event); - x = event->x; - y = event->y; - - if (priv->mode == DRAG_H) - { - gimp_color_wheel_set_color (wheel, - compute_v (wheel, x, y), priv->s, priv->v); - return TRUE; - } - else if (priv->mode == DRAG_SV) - { - gdouble s, v; - - compute_sv (wheel, x, y, &s, &v); - gimp_color_wheel_set_color (wheel, priv->h, s, v); - return TRUE; - } - - g_assert_not_reached (); - - return FALSE; -} - - -/* Redrawing */ - -/* Paints the hue ring */ -static void -paint_ring (GimpColorWheel *wheel, - cairo_t *cr) -{ - GtkWidget *widget = GTK_WIDGET (wheel); - GimpColorWheelPrivate *priv = wheel->priv; - gint width, height; - gint xx, yy; - gdouble dx, dy, dist; - gdouble center_x; - gdouble center_y; - gdouble inner, outer; - guint32 *buf, *p; - gdouble angle; - gdouble hue; - gdouble r, g, b; - cairo_surface_t *source; - cairo_t *source_cr; - gint stride; - - width = gtk_widget_get_allocated_width (widget); - height = gtk_widget_get_allocated_height (widget); - - center_x = width / 2.0; - center_y = height / 2.0; - - outer = priv->size / 2.0; - inner = outer - priv->ring_width; - - /* Create an image initialized with the ring colors */ - - stride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, width); - buf = g_new (guint32, height * stride / 4); - - for (yy = 0; yy < height; yy++) - { - p = buf + yy * width; - dy = -(yy - center_y); - - for (xx = 0; xx < width; xx++) - { - dx = xx - center_x; - - dist = dx * dx + dy * dy; - if (dist < ((inner-1) * (inner-1)) || dist > ((outer+1) * (outer+1))) - { - *p++ = 0; - continue; - } - - angle = atan2 (dy, dx); - if (angle < 0.0) - angle += 2.0 * G_PI; - - hue = angle / (2.0 * G_PI); - - r = hue; - g = 1.0; - b = 1.0; - hsv_to_rgb (&r, &g, &b); - - *p++ = (((int)floor (r * 255 + 0.5) << 16) | - ((int)floor (g * 255 + 0.5) << 8) | - (int)floor (b * 255 + 0.5)); - } - } - - source = cairo_image_surface_create_for_data ((unsigned char *)buf, - CAIRO_FORMAT_RGB24, - width, height, stride); - - /* Now draw the value marker onto the source image, so that it - * will get properly clipped at the edges of the ring - */ - source_cr = cairo_create (source); - - r = priv->h; - g = 1.0; - b = 1.0; - hsv_to_rgb (&r, &g, &b); - - if (INTENSITY (r, g, b) > 0.5) - cairo_set_source_rgb (source_cr, 0.0, 0.0, 0.0); - else - cairo_set_source_rgb (source_cr, 1.0, 1.0, 1.0); - - cairo_move_to (source_cr, center_x, center_y); - cairo_line_to (source_cr, - center_x + cos (priv->h * 2.0 * G_PI) * priv->size / 2, - center_y - sin (priv->h * 2.0 * G_PI) * priv->size / 2); - cairo_stroke (source_cr); - cairo_destroy (source_cr); - - /* Draw the ring using the source image */ - - cairo_save (cr); - - cairo_set_source_surface (cr, source, 0, 0); - cairo_surface_destroy (source); - - cairo_set_line_width (cr, priv->ring_width); - cairo_new_path (cr); - cairo_arc (cr, - center_x, center_y, - priv->size / 2.0 - priv->ring_width / 2.0, - 0, 2 * G_PI); - cairo_stroke (cr); - - cairo_restore (cr); - - g_free (buf); -} - -/* Converts an HSV triplet to an integer RGB triplet */ -static void -get_color (gdouble h, - gdouble s, - gdouble v, - gint *r, - gint *g, - gint *b) -{ - hsv_to_rgb (&h, &s, &v); - - *r = floor (h * 255 + 0.5); - *g = floor (s * 255 + 0.5); - *b = floor (v * 255 + 0.5); -} - -#define SWAP(a, b, t) ((t) = (a), (a) = (b), (b) = (t)) - -#define LERP(a, b, v1, v2, i) (((v2) - (v1) != 0) \ - ? ((a) + ((b) - (a)) * ((i) - (v1)) / ((v2) - (v1))) \ - : (a)) - -/* Number of pixels we extend out from the edges when creating - * color source to avoid artifacts - */ -#define PAD 3 - -/* Paints the HSV triangle */ -static void -paint_triangle (GimpColorWheel *wheel, - cairo_t *cr, - gboolean draw_focus) -{ - GtkWidget *widget = GTK_WIDGET (wheel); - GimpColorWheelPrivate *priv = wheel->priv; - gint hx, hy, sx, sy, vx, vy; /* HSV vertices */ - gint x1, y1, r1, g1, b1; /* First vertex in scanline order */ - gint x2, y2, r2, g2, b2; /* Second vertex */ - gint x3, y3, r3, g3, b3; /* Third vertex */ - gint t; - guint32 *buf, *p, c; - gint xl, xr, rl, rr, gl, gr, bl, br; /* Scanline data */ - gint xx, yy; - gint x_interp, y_interp; - gint x_start, x_end; - cairo_surface_t *source; - gdouble r, g, b; - gint stride; - gint width, height; - GtkStyleContext *context; - - width = gtk_widget_get_allocated_width (widget); - height = gtk_widget_get_allocated_height (widget); - - /* Compute triangle's vertices */ - - compute_triangle (wheel, &hx, &hy, &sx, &sy, &vx, &vy); - - x1 = hx; - y1 = hy; - get_color (priv->h, 1.0, 1.0, &r1, &g1, &b1); - - x2 = sx; - y2 = sy; - get_color (priv->h, 1.0, 0.0, &r2, &g2, &b2); - - x3 = vx; - y3 = vy; - get_color (priv->h, 0.0, 1.0, &r3, &g3, &b3); - - if (y2 > y3) - { - SWAP (x2, x3, t); - SWAP (y2, y3, t); - SWAP (r2, r3, t); - SWAP (g2, g3, t); - SWAP (b2, b3, t); - } - - if (y1 > y3) - { - SWAP (x1, x3, t); - SWAP (y1, y3, t); - SWAP (r1, r3, t); - SWAP (g1, g3, t); - SWAP (b1, b3, t); - } - - if (y1 > y2) - { - SWAP (x1, x2, t); - SWAP (y1, y2, t); - SWAP (r1, r2, t); - SWAP (g1, g2, t); - SWAP (b1, b2, t); - } - - /* Shade the triangle */ - - stride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, width); - buf = g_new (guint32, height * stride / 4); - - for (yy = 0; yy < height; yy++) - { - p = buf + yy * width; - - if (yy >= y1 - PAD && yy < y3 + PAD) - { - y_interp = CLAMP (yy, y1, y3); - - if (y_interp < y2) - { - xl = LERP (x1, x2, y1, y2, y_interp); - - rl = LERP (r1, r2, y1, y2, y_interp); - gl = LERP (g1, g2, y1, y2, y_interp); - bl = LERP (b1, b2, y1, y2, y_interp); - } - else - { - xl = LERP (x2, x3, y2, y3, y_interp); - - rl = LERP (r2, r3, y2, y3, y_interp); - gl = LERP (g2, g3, y2, y3, y_interp); - bl = LERP (b2, b3, y2, y3, y_interp); - } - - xr = LERP (x1, x3, y1, y3, y_interp); - - rr = LERP (r1, r3, y1, y3, y_interp); - gr = LERP (g1, g3, y1, y3, y_interp); - br = LERP (b1, b3, y1, y3, y_interp); - - if (xl > xr) - { - SWAP (xl, xr, t); - SWAP (rl, rr, t); - SWAP (gl, gr, t); - SWAP (bl, br, t); - } - - x_start = MAX (xl - PAD, 0); - x_end = MIN (xr + PAD, width); - x_start = MIN (x_start, x_end); - - c = (rl << 16) | (gl << 8) | bl; - - for (xx = 0; xx < x_start; xx++) - *p++ = c; - - for (; xx < x_end; xx++) - { - x_interp = CLAMP (xx, xl, xr); - - *p++ = ((LERP (rl, rr, xl, xr, x_interp) << 16) | - (LERP (gl, gr, xl, xr, x_interp) << 8) | - LERP (bl, br, xl, xr, x_interp)); - } - - c = (rr << 16) | (gr << 8) | br; - - for (; xx < width; xx++) - *p++ = c; - } - } - - source = cairo_image_surface_create_for_data ((unsigned char *)buf, - CAIRO_FORMAT_RGB24, - width, height, stride); - - /* Draw a triangle with the image as a source */ - - cairo_set_source_surface (cr, source, 0, 0); - cairo_surface_destroy (source); - - cairo_move_to (cr, x1, y1); - cairo_line_to (cr, x2, y2); - cairo_line_to (cr, x3, y3); - cairo_close_path (cr); - cairo_fill (cr); - - g_free (buf); - - /* Draw value marker */ - - xx = floor (sx + (vx - sx) * priv->v + (hx - vx) * priv->s * priv->v + 0.5); - yy = floor (sy + (vy - sy) * priv->v + (hy - vy) * priv->s * priv->v + 0.5); - - r = priv->h; - g = priv->s; - b = priv->v; - hsv_to_rgb (&r, &g, &b); - - context = gtk_widget_get_style_context (widget); - - gtk_style_context_save (context); - - if (INTENSITY (r, g, b) > 0.5) - { - gtk_style_context_add_class (context, "light-area-focus"); - cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); - } - else - { - gtk_style_context_add_class (context, "dark-area-focus"); - cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); - } - -#define RADIUS 4 -#define FOCUS_RADIUS 6 - - cairo_new_path (cr); - cairo_arc (cr, xx, yy, RADIUS, 0, 2 * G_PI); - cairo_stroke (cr); - - /* Draw focus outline */ - - if (draw_focus && ! priv->focus_on_ring) - { - gint focus_width; - gint focus_pad; - - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); - - gtk_render_focus (context, cr, - xx - FOCUS_RADIUS - focus_width - focus_pad, - yy - FOCUS_RADIUS - focus_width - focus_pad, - 2 * (FOCUS_RADIUS + focus_width + focus_pad), - 2 * (FOCUS_RADIUS + focus_width + focus_pad)); - } - - gtk_style_context_restore (context); -} - -static gboolean -gimp_color_wheel_draw (GtkWidget *widget, - cairo_t *cr) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - gboolean draw_focus; - - draw_focus = gtk_widget_has_visible_focus (widget); - - paint_ring (wheel, cr); - paint_triangle (wheel, cr, draw_focus); - - if (draw_focus && priv->focus_on_ring) - { - GtkStyleContext *context = gtk_widget_get_style_context (widget); - - gtk_render_focus (context, cr, 0, 0, - gtk_widget_get_allocated_width (widget), - gtk_widget_get_allocated_height (widget)); - } - - return FALSE; -} - -static gboolean -gimp_color_wheel_focus (GtkWidget *widget, - GtkDirectionType dir) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - - if (!gtk_widget_has_focus (widget)) - { - if (dir == GTK_DIR_TAB_BACKWARD) - priv->focus_on_ring = FALSE; - else - priv->focus_on_ring = TRUE; - - gtk_widget_grab_focus (widget); - return TRUE; - } - - switch (dir) - { - case GTK_DIR_UP: - if (priv->focus_on_ring) - return FALSE; - else - priv->focus_on_ring = TRUE; - break; - - case GTK_DIR_DOWN: - if (priv->focus_on_ring) - priv->focus_on_ring = FALSE; - else - return FALSE; - break; - - case GTK_DIR_LEFT: - case GTK_DIR_TAB_BACKWARD: - if (priv->focus_on_ring) - return FALSE; - else - priv->focus_on_ring = TRUE; - break; - - case GTK_DIR_RIGHT: - case GTK_DIR_TAB_FORWARD: - if (priv->focus_on_ring) - priv->focus_on_ring = FALSE; - else - return FALSE; - break; - } - - gtk_widget_queue_draw (widget); - - return TRUE; -} - -/** - * gimp_color_wheel_new: - * - * Creates a new HSV color selector. - * - * Return value: A newly-created HSV color selector. - * - * Since: 2.14 - */ -GtkWidget* -gimp_color_wheel_new (void) -{ - return g_object_new (GIMP_TYPE_COLOR_WHEEL, NULL); -} - -/** - * gimp_color_wheel_set_color: - * @hsv: An HSV color selector - * @h: Hue - * @s: Saturation - * @v: Value - * - * Sets the current color in an HSV color selector. - * Color component values must be in the [0.0, 1.0] range. - * - * Since: 2.14 - */ -void -gimp_color_wheel_set_color (GimpColorWheel *wheel, - gdouble h, - gdouble s, - gdouble v) -{ - GimpColorWheelPrivate *priv; - - g_return_if_fail (GIMP_IS_COLOR_WHEEL (wheel)); - g_return_if_fail (h >= 0.0 && h <= 1.0); - g_return_if_fail (s >= 0.0 && s <= 1.0); - g_return_if_fail (v >= 0.0 && v <= 1.0); - - priv = wheel->priv; - - if(h == 0.0 && s == 0.0) { - h = priv->h; - } - - priv->h = h; - priv->s = s; - priv->v = v; - - g_signal_emit (wheel, wheel_signals[CHANGED], 0); - - gtk_widget_queue_draw (GTK_WIDGET (wheel)); -} - -/** - * gimp_color_wheel_get_color: - * @hsv: An HSV color selector - * @h: (out): Return value for the hue - * @s: (out): Return value for the saturation - * @v: (out): Return value for the value - * - * Queries the current color in an HSV color selector. - * Returned values will be in the [0.0, 1.0] range. - * - * Since: 2.14 - */ -void -gimp_color_wheel_get_color (GimpColorWheel *wheel, - gdouble *h, - gdouble *s, - gdouble *v) -{ - GimpColorWheelPrivate *priv; - - g_return_if_fail (GIMP_IS_COLOR_WHEEL (wheel)); - - priv = wheel->priv; - - if (h) *h = priv->h; - if (s) *s = priv->s; - if (v) *v = priv->v; -} - -/** - * gimp_color_wheel_set_ring_fraction: - * @ring: A wheel color selector - * @fraction: Ring fraction - * - * Sets the ring fraction of a wheel color selector. - * - * Since: GIMP 2.10 - */ -void -gimp_color_wheel_set_ring_fraction (GimpColorWheel *hsv, - gdouble fraction) -{ - GimpColorWheelPrivate *priv; - - g_return_if_fail (GIMP_IS_COLOR_WHEEL (hsv)); - - priv = hsv->priv; - - priv->ring_fraction = CLAMP (fraction, 0.01, 0.99); - - gtk_widget_queue_draw (GTK_WIDGET (hsv)); -} - -/** - * gimp_color_wheel_get_ring_fraction: - * @ring: A wheel color selector - * - * Returns value: The ring fraction of the wheel color selector. - * - * Since: GIMP 2.10 - */ -gdouble -gimp_color_wheel_get_ring_fraction (GimpColorWheel *wheel) -{ - GimpColorWheelPrivate *priv; - - g_return_val_if_fail (GIMP_IS_COLOR_WHEEL (wheel), DEFAULT_FRACTION); - - priv = wheel->priv; - - return priv->ring_fraction; -} - -/** - * gimp_color_wheel_is_adjusting: - * @hsv: A #GimpColorWheel - * - * An HSV color selector can be said to be adjusting if multiple rapid - * changes are being made to its value, for example, when the user is - * adjusting the value with the mouse. This function queries whether - * the HSV color selector is being adjusted or not. - * - * Return value: %TRUE if clients can ignore changes to the color value, - * since they may be transitory, or %FALSE if they should consider - * the color value status to be final. - * - * Since: 2.14 - */ -gboolean -gimp_color_wheel_is_adjusting (GimpColorWheel *wheel) -{ - GimpColorWheelPrivate *priv; - - g_return_val_if_fail (GIMP_IS_COLOR_WHEEL (wheel), FALSE); - - priv = wheel->priv; - - return priv->mode != DRAG_NONE; -} - -static void -gimp_color_wheel_move (GimpColorWheel *wheel, - GtkDirectionType dir) -{ - GimpColorWheelPrivate *priv = wheel->priv; - gdouble hue, sat, val; - gint hx, hy, sx, sy, vx, vy; /* HSV vertices */ - gint x, y; /* position in triangle */ - - hue = priv->h; - sat = priv->s; - val = priv->v; - - compute_triangle (wheel, &hx, &hy, &sx, &sy, &vx, &vy); - - x = floor (sx + (vx - sx) * priv->v + (hx - vx) * priv->s * priv->v + 0.5); - y = floor (sy + (vy - sy) * priv->v + (hy - vy) * priv->s * priv->v + 0.5); - -#define HUE_DELTA 0.002 - switch (dir) - { - case GTK_DIR_UP: - if (priv->focus_on_ring) - hue += HUE_DELTA; - else - { - y -= 1; - compute_sv (wheel, x, y, &sat, &val); - } - break; - - case GTK_DIR_DOWN: - if (priv->focus_on_ring) - hue -= HUE_DELTA; - else - { - y += 1; - compute_sv (wheel, x, y, &sat, &val); - } - break; - - case GTK_DIR_LEFT: - if (priv->focus_on_ring) - hue += HUE_DELTA; - else - { - x -= 1; - compute_sv (wheel, x, y, &sat, &val); - } - break; - - case GTK_DIR_RIGHT: - if (priv->focus_on_ring) - hue -= HUE_DELTA - ; - else - { - x += 1; - compute_sv (wheel, x, y, &sat, &val); - } - break; - - default: - /* we don't care about the tab directions */ - break; - } - - /* Wrap */ - if (hue < 0.0) - hue = 1.0; - else if (hue > 1.0) - hue = 0.0; - - gimp_color_wheel_set_color (wheel, hue, sat, val); -} diff --git a/src/ui/widget/gimpcolorwheel.h b/src/ui/widget/gimpcolorwheel.h deleted file mode 100644 index 016fb593f..000000000 --- a/src/ui/widget/gimpcolorwheel.h +++ /dev/null @@ -1,95 +0,0 @@ -/* HSV color selector for GTK+ - * - * Copyright (C) 1999 The Free Software Foundation - * - * Authors: Simon Budig (original code) - * Federico Mena-Quintero (cleanup for GTK+) - * Jonathan Blandford (cleanup for GTK+) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __GIMP_COLOR_WHEEL_H__ -#define __GIMP_COLOR_WHEEL_H__ - -G_BEGIN_DECLS - -#define GIMP_TYPE_COLOR_WHEEL (gimp_color_wheel_get_type ()) -#define GIMP_COLOR_WHEEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_WHEEL, GimpColorWheel)) -#define GIMP_COLOR_WHEEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_WHEEL, GimpColorWheelClass)) -#define GIMP_IS_COLOR_WHEEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_WHEEL)) -#define GIMP_IS_COLOR_WHEEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_WHEEL)) -#define GIMP_COLOR_WHEEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_WHEEL, GimpColorWheelClass)) - - -typedef struct _GimpColorWheel GimpColorWheel; -typedef struct _GimpColorWheelClass GimpColorWheelClass; - -struct _GimpColorWheel -{ - GtkWidget parent_instance; - - /* Private data */ - gpointer priv; -}; - -struct _GimpColorWheelClass -{ - GtkWidgetClass parent_class; - - /* Notification signals */ - void (* changed) (GimpColorWheel *wheel); - - /* Keybindings */ - void (* move) (GimpColorWheel *wheel, - GtkDirectionType type); - - /* Padding for future expansion */ - void (*_gimp_reserved1) (void); - void (*_gimp_reserved2) (void); - void (*_gimp_reserved3) (void); - void (*_gimp_reserved4) (void); -}; - - -GType gimp_color_wheel_get_type (void) G_GNUC_CONST; -GtkWidget * gimp_color_wheel_new (void); - -void gimp_color_wheel_set_color (GimpColorWheel *wheel, - double h, - double s, - double v); -void gimp_color_wheel_get_color (GimpColorWheel *wheel, - gdouble *h, - gdouble *s, - gdouble *v); - -void gimp_color_wheel_set_ring_fraction (GimpColorWheel *wheel, - gdouble fraction); -gdouble gimp_color_wheel_get_ring_fraction (GimpColorWheel *wheel); - -gboolean gimp_color_wheel_is_adjusting (GimpColorWheel *wheel); - -G_END_DECLS - -#endif /* __GIMP_COLOR_WHEEL_H__ */ diff --git a/src/ui/widget/gimpspinscale.c b/src/ui/widget/gimpspinscale.c deleted file mode 100644 index 8d8c6c935..000000000 --- a/src/ui/widget/gimpspinscale.c +++ /dev/null @@ -1,969 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpspinscale.c - * Copyright (C) 2010 Michael Natterer - * 2012 Øyvind Kolås - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include - -#include "gimpspinscale.h" - - -enum -{ - PROP_0, - PROP_LABEL, - PROP_FOCUS_WIDGET -}; - -typedef enum -{ - TARGET_NUMBER, - TARGET_UPPER, - TARGET_LOWER, - TARGET_NONE -} SpinScaleTarget; - -typedef enum -{ - APPEARANCE_FULL = 1, /* Full size suitable for tablets */ - APPEARANCE_COMPACT, /* Compact, suitable for desktops with mouse control */ -} SpinScaleAppearance; - -typedef struct _GimpSpinScalePrivate GimpSpinScalePrivate; - -struct _GimpSpinScalePrivate -{ - gchar *label; - - gboolean scale_limits_set; - gdouble scale_lower; - gdouble scale_upper; - gdouble gamma; - - PangoLayout *layout; - gboolean changing_value; - gboolean relative_change; - gdouble start_x; - gdouble start_value; - - GtkWidget* focusWidget; - gboolean transferFocus; - SpinScaleAppearance appearanceMode; -}; - -#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - GIMP_TYPE_SPIN_SCALE, \ - GimpSpinScalePrivate)) - - -static void gimp_spin_scale_dispose (GObject *object); -static void gimp_spin_scale_finalize (GObject *object); -static void gimp_spin_scale_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_spin_scale_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); - -static void gimp_spin_scale_style_set (GtkWidget *widget, - GtkStyle *prev_style); - -static void gimp_spin_scale_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width); -static void gimp_spin_scale_get_preferred_height (GtkWidget *widget, - gint *minimum_width, - gint *natural_width); -static gboolean gimp_spin_scale_draw (GtkWidget *widget, - cairo_t *cr); - -static gboolean gimp_spin_scale_button_press (GtkWidget *widget, - GdkEventButton *event); -static gboolean gimp_spin_scale_button_release (GtkWidget *widget, - GdkEventButton *event); -static gboolean gimp_spin_scale_motion_notify (GtkWidget *widget, - GdkEventMotion *event); -static gboolean gimp_spin_scale_leave_notify (GtkWidget *widget, - GdkEventCrossing *event); -static gboolean gimp_spin_scale_keypress( GtkWidget *widget, - GdkEventKey *event); - -static void gimp_spin_scale_defocus( GtkSpinButton *spin_button ); - -static void gimp_spin_scale_value_changed (GtkSpinButton *spin_button); - - -G_DEFINE_TYPE (GimpSpinScale, gimp_spin_scale, GTK_TYPE_SPIN_BUTTON); - -#define parent_class gimp_spin_scale_parent_class - - -static void -gimp_spin_scale_class_init (GimpSpinScaleClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - GtkSpinButtonClass *spin_button_class = GTK_SPIN_BUTTON_CLASS (klass); - - object_class->dispose = gimp_spin_scale_dispose; - object_class->finalize = gimp_spin_scale_finalize; - object_class->set_property = gimp_spin_scale_set_property; - object_class->get_property = gimp_spin_scale_get_property; - - widget_class->style_set = gimp_spin_scale_style_set; - widget_class->get_preferred_width = gimp_spin_scale_get_preferred_width; - widget_class->get_preferred_height = gimp_spin_scale_get_preferred_height; - widget_class->draw = gimp_spin_scale_draw; - widget_class->button_press_event = gimp_spin_scale_button_press; - widget_class->button_release_event = gimp_spin_scale_button_release; - widget_class->motion_notify_event = gimp_spin_scale_motion_notify; - widget_class->leave_notify_event = gimp_spin_scale_leave_notify; - widget_class->key_press_event = gimp_spin_scale_keypress; - - spin_button_class->value_changed = gimp_spin_scale_value_changed; - - g_object_class_install_property (object_class, PROP_LABEL, - g_param_spec_string ("label", NULL, NULL, - NULL, - G_PARAM_READWRITE)); - - g_type_class_add_private (klass, sizeof (GimpSpinScalePrivate)); -} - -static void -gimp_spin_scale_init (GimpSpinScale *scale) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (scale); - - gtk_widget_add_events (GTK_WIDGET (scale), - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_POINTER_MOTION_MASK | - GDK_BUTTON1_MOTION_MASK | - GDK_LEAVE_NOTIFY_MASK); - - gtk_entry_set_alignment (GTK_ENTRY (scale), 1.0); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (scale), TRUE); - - private->gamma = 1.0; - private->focusWidget = NULL; - private->transferFocus = FALSE; - private->appearanceMode = APPEARANCE_COMPACT; -} - -static void -gimp_spin_scale_dispose (GObject *object) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (object); - - if (private->layout) - { - g_object_unref (private->layout); - private->layout = NULL; - } - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -gimp_spin_scale_finalize (GObject *object) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (object); - - if (private->label) - { - g_free (private->label); - private->label = NULL; - } - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gimp_spin_scale_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (object); - GimpSpinScale *scale = GIMP_SPIN_SCALE (object); - - switch (property_id) - { - case PROP_LABEL: - gimp_spin_scale_set_label (scale, g_value_get_string (value)); - break; - - case PROP_FOCUS_WIDGET: - { - /* TODO unhook prior */ - private->focusWidget = GTK_WIDGET (g_value_get_pointer (value)); - } - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -gimp_spin_scale_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (object); - GimpSpinScale *scale = GIMP_SPIN_SCALE (object); - - switch (property_id) - { - case PROP_LABEL: - g_value_set_string (value, gimp_spin_scale_get_label (scale)); - break; - - case PROP_FOCUS_WIDGET: - g_value_set_pointer (value, private->focusWidget); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -void -gimp_spin_scale_set_focuswidget( GtkWidget *scale, GtkWidget* widget ) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (scale); - - /* TODO unhook prior */ - - private->focusWidget = widget; -} - -void -gimp_spin_scale_set_appearance( GtkWidget *widget, const gchar *appearance) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - - if ( strcmp("full", appearance) == 0 ) { - private->appearanceMode = APPEARANCE_FULL; - } else if ( strcmp("compact", appearance) == 0 ) { - private->appearanceMode = APPEARANCE_COMPACT; - } -} - -static void -gimp_spin_scale_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - PangoContext *context = gtk_widget_get_pango_context (widget); - PangoFontMetrics *metrics; - - GTK_WIDGET_CLASS (parent_class)->get_preferred_width (widget, - minimum_width, - natural_width); - - metrics = pango_context_get_metrics (context, - pango_context_get_font_description (context), - pango_context_get_language (context)); - - if (private->label) - { - gint char_width; - gint digit_width; - gint char_pixels; - - char_width = pango_font_metrics_get_approximate_char_width (metrics); - digit_width = pango_font_metrics_get_approximate_digit_width (metrics); - char_pixels = PANGO_PIXELS (MAX (char_width, digit_width)); - - /* ~3 chars for the ellipse */ - *minimum_width += char_pixels * 3; - *natural_width += char_pixels * 3; - } - - pango_font_metrics_unref (metrics); -} - -static void -gimp_spin_scale_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height) -{ - PangoContext *context = gtk_widget_get_pango_context (widget); - PangoFontMetrics *metrics; - //gint height; - - GTK_WIDGET_CLASS (parent_class)->get_preferred_height (widget, - minimum_height, - natural_height); - - metrics = pango_context_get_metrics (context, - pango_context_get_font_description (context), - pango_context_get_language (context)); - - //height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + - // pango_font_metrics_get_descent (metrics)); - - *minimum_height += 1; - *natural_height += 1; - - pango_font_metrics_unref (metrics); -} - -static void -gimp_spin_scale_style_set (GtkWidget *widget, - GtkStyle *prev_style) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - - GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style); - - if (private->layout) - { - g_object_unref (private->layout); - private->layout = NULL; - } -} - - -static gboolean - gimp_spin_scale_draw (GtkWidget *widget, - cairo_t *cr) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - GtkStyleContext *style = gtk_widget_get_style_context(widget); - GtkAllocation allocation; - GdkRGBA color; - - cairo_save (cr); - GTK_WIDGET_CLASS (parent_class)->draw (widget, cr); - cairo_restore (cr); - - gtk_widget_get_allocation (widget, &allocation); - - cairo_set_line_width (cr, 1.0); - - if (private->label) - { - GdkRectangle text_area; - gint minimum_width; - gint natural_width; - PangoRectangle logical; - gint layout_offset_x; - gint layout_offset_y; - GtkStateFlags state; - GdkRGBA text_color; - GdkRGBA bar_text_color; - gdouble progress_fraction; - gint progress_x; - gint progress_y; - gint progress_width; - gint progress_height; - - gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area); - - GTK_WIDGET_CLASS (parent_class)->get_preferred_width (widget, - &minimum_width, - &natural_width); - - if (! private->layout) - { - private->layout = gtk_widget_create_pango_layout (widget, - private->label); - pango_layout_set_ellipsize (private->layout, PANGO_ELLIPSIZE_END); - } - - pango_layout_set_width (private->layout, - PANGO_SCALE * - (allocation.width - minimum_width)); - pango_layout_get_pixel_extents (private->layout, NULL, &logical); - - gtk_entry_get_layout_offsets (GTK_ENTRY (widget), NULL, &layout_offset_y); - - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) - layout_offset_x = text_area.x + text_area.width - logical.width - 4; - else - layout_offset_x = 4; - - layout_offset_x -= logical.x; - - state = gtk_widget_get_state_flags (widget); - - gtk_style_context_get_color (style, state, &text_color); - - gtk_style_context_save (style); - gtk_style_context_add_class (style, GTK_STYLE_CLASS_PROGRESSBAR); - gtk_style_context_get_color (style, state, &bar_text_color); - gtk_style_context_restore (style); - - progress_fraction = gtk_entry_get_progress_fraction (GTK_ENTRY (widget)); - - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) - { - progress_fraction = 1.0 - progress_fraction; - - progress_x = text_area.width * progress_fraction; - progress_y = 0; - progress_width = text_area.width - progress_x; - progress_height = text_area.height; - } - else - { - progress_x = 0; - progress_y = 0; - progress_width = text_area.width * progress_fraction; - progress_height = text_area.height; - } - - cairo_save (cr); - - cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); - cairo_rectangle (cr, 0, 0, text_area.width, text_area.height); - cairo_rectangle (cr, progress_x, progress_y, - progress_width, progress_height); - cairo_clip (cr); - cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING); - - cairo_move_to (cr, layout_offset_x, text_area.y + layout_offset_y-3); - gdk_cairo_set_source_rgba (cr, &text_color); - pango_cairo_show_layout (cr, private->layout); - cairo_restore (cr); - - cairo_rectangle (cr, progress_x, progress_y, - progress_width, progress_height); - cairo_clip (cr); - - cairo_move_to (cr, layout_offset_x, text_area.y + layout_offset_y-3); - gdk_cairo_set_source_rgba (cr, &bar_text_color); - pango_cairo_show_layout (cr, private->layout); - } - - return FALSE; -} - -/* Returns TRUE if a translation should be done */ -static gboolean -gtk_widget_get_translation_to_window (GtkWidget *widget, - GdkWindow *window, - int *x, - int *y) -{ - GdkWindow *w, *widget_window; - - if (!gtk_widget_get_has_window (widget)) - { - GtkAllocation allocation; - - gtk_widget_get_allocation (widget, &allocation); - - *x = -allocation.x; - *y = -allocation.y; - } - else - { - *x = 0; - *y = 0; - } - - widget_window = gtk_widget_get_window (widget); - - for (w = window; w && w != widget_window; w = gdk_window_get_parent (w)) - { - int wx, wy; - gdk_window_get_position (w, &wx, &wy); - *x += wx; - *y += wy; - } - - if (w == NULL) - { - *x = 0; - *y = 0; - return FALSE; - } - - return TRUE; -} - -static void -gimp_spin_scale_event_to_widget_coords (GtkWidget *widget, - GdkWindow *window, - gdouble event_x, - gdouble event_y, - gint *widget_x, - gint *widget_y) -{ - gint tx, ty; - - if (gtk_widget_get_translation_to_window (widget, window, &tx, &ty)) - { - event_x += tx; - event_y += ty; - } - - *widget_x = event_x; - *widget_y = event_y; -} - -static SpinScaleTarget -gimp_spin_scale_get_target (GtkWidget *widget, - gdouble x, - gdouble y) -{ - GtkAllocation allocation; - PangoRectangle logical; - gint layout_x; - gint layout_y; - - gtk_widget_get_allocation (widget, &allocation); - gtk_entry_get_layout_offsets (GTK_ENTRY (widget), &layout_x, &layout_y); - pango_layout_get_pixel_extents (gtk_entry_get_layout (GTK_ENTRY (widget)), - NULL, &logical); - - GdkRectangle text_area; - gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area); - - if (x >= text_area.x && x < text_area.width && - y >= text_area.y && y < text_area.height) - { - x -= text_area.x; - y -= text_area.y; - - if (x > layout_x && x < layout_x + logical.width && - y > layout_y && y < layout_y + logical.height) - { - return TARGET_NUMBER; - } - else if (y > text_area.height / 2) - { - return TARGET_LOWER; - } - - return TARGET_UPPER; - } - - return TARGET_NONE; -} - -static void -gimp_spin_scale_get_limits (GimpSpinScale *scale, - gdouble *lower, - gdouble *upper) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (scale); - - if (private->scale_limits_set) - { - *lower = private->scale_lower; - *upper = private->scale_upper; - } - else - { - GtkSpinButton *spin_button = GTK_SPIN_BUTTON (scale); - GtkAdjustment *adjustment = gtk_spin_button_get_adjustment (spin_button); - - *lower = gtk_adjustment_get_lower (adjustment); - *upper = gtk_adjustment_get_upper (adjustment); - } -} - -static void -gimp_spin_scale_change_value (GtkWidget *widget, - gdouble x) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget); - GtkAdjustment *adjustment = gtk_spin_button_get_adjustment (spin_button); - gdouble lower; - gdouble upper; - gdouble value; - GdkRectangle text_area; - gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area); - gimp_spin_scale_get_limits (GIMP_SPIN_SCALE (widget), &lower, &upper); - - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) - x = text_area.width - x; - - if (private->relative_change) - { - gdouble diff; - gdouble step; - - step = (upper - lower) / text_area.width / 10.0; - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) - diff = x - (text_area.width - private->start_x); - else - diff = x - private->start_x; - - value = (private->start_value + diff * step); - } - else - { - gdouble fraction; - - fraction = x / (gdouble) text_area.width; - if (fraction > 0.0) - fraction = pow (fraction, private->gamma); - - value = fraction * (upper - lower) + lower; - } - - gtk_adjustment_set_value (adjustment, value); -} - -static gboolean -gimp_spin_scale_button_press (GtkWidget *widget, - GdkEventButton *event) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - - private->changing_value = FALSE; - private->relative_change = FALSE; - - gint x, y; - gimp_spin_scale_event_to_widget_coords (widget, event->window, - event->x, event->y, - &x, &y); - switch (gimp_spin_scale_get_target (widget, x, y)) - { - case TARGET_UPPER: - private->changing_value = TRUE; - - gtk_widget_grab_focus (widget); - - gimp_spin_scale_change_value (widget, x); - - return TRUE; - - case TARGET_LOWER: - private->changing_value = TRUE; - - gtk_widget_grab_focus (widget); - - private->relative_change = TRUE; - private->start_x = x; - private->start_value = gtk_adjustment_get_value (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget))); - - return TRUE; - - default: - break; - } - - return GTK_WIDGET_CLASS (parent_class)->button_press_event (widget, event); -} - -static gboolean -gimp_spin_scale_button_release (GtkWidget *widget, - GdkEventButton *event) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - gint x, y; - - gimp_spin_scale_event_to_widget_coords (widget, event->window, - event->x, event->y, - &x, &y); - - if (private->changing_value) - { - private->changing_value = FALSE; - gimp_spin_scale_change_value (widget, x); - return TRUE; - } - - return GTK_WIDGET_CLASS (parent_class)->button_release_event (widget, event); -} - -static gboolean -gimp_spin_scale_motion_notify (GtkWidget *widget, - GdkEventMotion *event) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - - gdk_event_request_motions (event); - - gint x, y; - - gimp_spin_scale_event_to_widget_coords (widget, event->window, - event->x, event->y, - &x, &y); - - if (private->changing_value) - { - gimp_spin_scale_change_value (widget, x); - - return TRUE; - } - - GTK_WIDGET_CLASS (parent_class)->motion_notify_event (widget, event); - - if (! (event->state & - (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) - ) - { - GdkDisplay *display = gtk_widget_get_display (widget); - GdkCursor *cursor = NULL; - - switch (gimp_spin_scale_get_target (widget, x, y)) - { - case TARGET_NUMBER: - cursor = gdk_cursor_new_for_display (display, GDK_XTERM); - break; - - case TARGET_UPPER: - cursor = gdk_cursor_new_for_display (display, GDK_SB_UP_ARROW); - break; - - case TARGET_LOWER: - cursor = gdk_cursor_new_for_display (display, GDK_SB_H_DOUBLE_ARROW); - break; - - default: - break; - } - - if (cursor) - { - gdk_window_set_cursor (event->window, cursor); - g_object_unref (cursor); - } - } - - return FALSE; -} - -static gboolean -gimp_spin_scale_leave_notify (GtkWidget *widget, - GdkEventCrossing *event) -{ - gdk_window_set_cursor (event->window, NULL); - - return GTK_WIDGET_CLASS (parent_class)->leave_notify_event (widget, event); -} - -gboolean gimp_spin_scale_keypress( GtkWidget *widget, GdkEventKey *event) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - guint key = 0; - gdk_keymap_translate_keyboard_state( gdk_keymap_get_for_display( gdk_display_get_default() ), - event->hardware_keycode, (GdkModifierType)event->state, - 0, &key, 0, 0, 0 ); - - switch ( key ) { - - case GDK_KEY_Escape: - case GDK_KEY_Return: - case GDK_KEY_KP_Enter: - { - private->transferFocus = TRUE; - gimp_spin_scale_defocus( GTK_SPIN_BUTTON(widget) ); - } - break; - - } - - return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event); -} - -static void -gimp_spin_scale_defocus( GtkSpinButton *spin_button ) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (spin_button); - - if ( private->transferFocus ) { - if ( private->focusWidget ) { - gtk_widget_grab_focus( private->focusWidget ); - } - } -} - -static void -gimp_spin_scale_value_changed (GtkSpinButton *spin_button) -{ - GtkAdjustment *adjustment = gtk_spin_button_get_adjustment (spin_button); - GimpSpinScalePrivate *private = GET_PRIVATE (spin_button); - gdouble lower; - gdouble upper; - gdouble value; - - gimp_spin_scale_get_limits (GIMP_SPIN_SCALE (spin_button), &lower, &upper); - - value = CLAMP (gtk_adjustment_get_value (adjustment), lower, upper); - - gtk_entry_set_progress_fraction (GTK_ENTRY (spin_button), - pow ((value - lower) / (upper - lower), - 1.0 / private->gamma)); - - // TODO - Allow scrollwheel to change value then return focus, - // but clicks/keypress should keep focus in the control - //if ( gtk_widget_has_focus( GTK_WIDGET(spin_button) ) ) { - // gimp_spin_scale_defocus( spin_button ); - //} -} - - -/* public functions */ - -GtkWidget * -gimp_spin_scale_new (GtkAdjustment *adjustment, - const gchar *label, - gint digits) -{ - g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), NULL); - - return g_object_new (GIMP_TYPE_SPIN_SCALE, - "adjustment", adjustment, - "label", label, - "digits", digits, - NULL); -} - -void -gimp_spin_scale_set_label (GimpSpinScale *scale, - const gchar *label) -{ - GimpSpinScalePrivate *private; - - g_return_if_fail (GIMP_IS_SPIN_SCALE (scale)); - - private = GET_PRIVATE (scale); - - if (label == private->label) - return; - - g_free (private->label); - private->label = g_strdup (label); - - if (private->layout) - { - g_object_unref (private->layout); - private->layout = NULL; - } - - gtk_widget_queue_resize (GTK_WIDGET (scale)); - - g_object_notify (G_OBJECT (scale), "label"); -} - -const gchar * -gimp_spin_scale_get_label (GimpSpinScale *scale) -{ - g_return_val_if_fail (GIMP_IS_SPIN_SCALE (scale), NULL); - - return GET_PRIVATE (scale)->label; -} - -void -gimp_spin_scale_set_scale_limits (GimpSpinScale *scale, - gdouble lower, - gdouble upper) -{ - GimpSpinScalePrivate *private; - GtkSpinButton *spin_button; - GtkAdjustment *adjustment; - - g_return_if_fail (GIMP_IS_SPIN_SCALE (scale)); - - private = GET_PRIVATE (scale); - spin_button = GTK_SPIN_BUTTON (scale); - adjustment = gtk_spin_button_get_adjustment (spin_button); - - g_return_if_fail (lower >= gtk_adjustment_get_lower (adjustment)); - g_return_if_fail (upper <= gtk_adjustment_get_upper (adjustment)); - - private->scale_limits_set = TRUE; - private->scale_lower = lower; - private->scale_upper = upper; - private->gamma = 1.0; - - gimp_spin_scale_value_changed (spin_button); -} - -void -gimp_spin_scale_unset_scale_limits (GimpSpinScale *scale) -{ - GimpSpinScalePrivate *private; - - g_return_if_fail (GIMP_IS_SPIN_SCALE (scale)); - - private = GET_PRIVATE (scale); - - private->scale_limits_set = FALSE; - private->scale_lower = 0.0; - private->scale_upper = 0.0; - - gimp_spin_scale_value_changed (GTK_SPIN_BUTTON (scale)); -} - -gboolean -gimp_spin_scale_get_scale_limits (GimpSpinScale *scale, - gdouble *lower, - gdouble *upper) -{ - GimpSpinScalePrivate *private; - - g_return_val_if_fail (GIMP_IS_SPIN_SCALE (scale), FALSE); - - private = GET_PRIVATE (scale); - - if (lower) - *lower = private->scale_lower; - - if (upper) - *upper = private->scale_upper; - - return private->scale_limits_set; -} - -void -gimp_spin_scale_set_gamma (GimpSpinScale *scale, - gdouble gamma) -{ - GimpSpinScalePrivate *private; - - g_return_if_fail (GIMP_IS_SPIN_SCALE (scale)); - - private = GET_PRIVATE (scale); - - private->gamma = gamma; - - gimp_spin_scale_value_changed (GTK_SPIN_BUTTON (scale)); -} - -gdouble -gimp_spin_scale_get_gamma (GimpSpinScale *scale) -{ - g_return_val_if_fail (GIMP_IS_SPIN_SCALE (scale), 1.0); - - return GET_PRIVATE(scale)->gamma; -} diff --git a/src/ui/widget/gimpspinscale.h b/src/ui/widget/gimpspinscale.h deleted file mode 100644 index b42a0faf8..000000000 --- a/src/ui/widget/gimpspinscale.h +++ /dev/null @@ -1,82 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpspinscale.h - * Copyright (C) 2010 Michael Natterer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef __GIMP_SPIN_SCALE_H__ -#define __GIMP_SPIN_SCALE_H__ - -#ifndef WITH_GIMP -#include -#endif - -G_BEGIN_DECLS - -#define GIMP_TYPE_SPIN_SCALE (gimp_spin_scale_get_type ()) -#define GIMP_SPIN_SCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_SPIN_SCALE, GimpSpinScale)) -#define GIMP_SPIN_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SPIN_SCALE, GimpSpinScaleClass)) -#define GIMP_IS_SPIN_SCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_SPIN_SCALE)) -#define GIMP_IS_SPIN_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SPIN_SCALE)) -#define GIMP_SPIN_SCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_SPIN_SCALE, GimpSpinScaleClass)) - - -typedef struct _GimpSpinScale GimpSpinScale; -typedef struct _GimpSpinScaleClass GimpSpinScaleClass; - -struct _GimpSpinScale -{ - GtkSpinButton parent_instance; -}; - -struct _GimpSpinScaleClass -{ - GtkSpinButtonClass parent_class; -}; - - -GType gimp_spin_scale_get_type (void) G_GNUC_CONST; - -GtkWidget * gimp_spin_scale_new (GtkAdjustment *adjustment, - const gchar *label, - gint digits); - -void gimp_spin_scale_set_label (GimpSpinScale *scale, - const gchar *label); -const gchar * gimp_spin_scale_get_label (GimpSpinScale *scale); - -void gimp_spin_scale_set_scale_limits (GimpSpinScale *scale, - gdouble lower, - gdouble upper); -void gimp_spin_scale_unset_scale_limits (GimpSpinScale *scale); -gboolean gimp_spin_scale_get_scale_limits (GimpSpinScale *scale, - gdouble *lower, - gdouble *upper); - -void gimp_spin_scale_set_gamma (GimpSpinScale *scale, - gdouble gamma); -gdouble gimp_spin_scale_get_gamma (GimpSpinScale *scale); - -void gimp_spin_scale_set_focuswidget (GtkWidget *scale, - GtkWidget *widget); - -void gimp_spin_scale_set_appearance (GtkWidget *scale, - const gchar *appearance); - -G_END_DECLS - -#endif /* __GIMP_SPIN_SCALE_H__ */ diff --git a/src/ui/widget/spin-scale.cpp b/src/ui/widget/spin-scale.cpp index eb91aaf39..f74626d9b 100644 --- a/src/ui/widget/spin-scale.cpp +++ b/src/ui/widget/spin-scale.cpp @@ -11,7 +11,7 @@ #include #include -#include "ui/widget/gimpspinscale.h" +#include "widgets/gimp/gimpspinscale.h" namespace Inkscape { namespace UI { -- cgit v1.2.3 From 41e0cdaf25ae70d09f1283e74dd3c47d64bf0ec0 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 8 Aug 2016 11:35:00 +0100 Subject: Fix autotools build (bzr r15045) --- src/ui/widget/Makefile_insert | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/widget/Makefile_insert b/src/ui/widget/Makefile_insert index eb98e6872..b22e4bd74 100644 --- a/src/ui/widget/Makefile_insert +++ b/src/ui/widget/Makefile_insert @@ -35,10 +35,6 @@ ink_common_sources += \ ui/widget/filter-effect-chooser.cpp \ ui/widget/font-variants.h \ ui/widget/font-variants.cpp \ - ui/widget/gimpspinscale.c \ - ui/widget/gimpspinscale.h \ - ui/widget/gimpcolorwheel.c \ - ui/widget/gimpcolorwheel.h \ ui/widget/frame.cpp \ ui/widget/frame.h \ ui/widget/imageicon.cpp \ -- cgit v1.2.3 From e471a664f923f517b68071f2e33fbb6ce070f8b7 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 8 Aug 2016 13:56:40 +0100 Subject: Remove deprecated Autotools and btool files. Please use CMake instead (bzr r15046) --- src/ui/Makefile_insert | 31 ---------- src/ui/cache/Makefile_insert | 6 -- src/ui/dialog/Makefile_insert | 133 ------------------------------------------ src/ui/tool/Makefile_insert | 30 ---------- src/ui/tools/Makefile_insert | 34 ----------- src/ui/view/Makefile_insert | 9 --- src/ui/widget/Makefile_insert | 106 --------------------------------- 7 files changed, 349 deletions(-) delete mode 100644 src/ui/Makefile_insert delete mode 100644 src/ui/cache/Makefile_insert delete mode 100644 src/ui/dialog/Makefile_insert delete mode 100644 src/ui/tool/Makefile_insert delete mode 100644 src/ui/tools/Makefile_insert delete mode 100644 src/ui/view/Makefile_insert delete mode 100644 src/ui/widget/Makefile_insert (limited to 'src/ui') diff --git a/src/ui/Makefile_insert b/src/ui/Makefile_insert deleted file mode 100644 index bbfdb532c..000000000 --- a/src/ui/Makefile_insert +++ /dev/null @@ -1,31 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - ui/clipboard.cpp \ - ui/clipboard.h \ - ui/control-manager.cpp \ - ui/control-manager.h \ - ui/control-types.h \ - ui/dialog-events.cpp \ - ui/dialog-events.h \ - ui/draw-anchor.cpp \ - ui/draw-anchor.h \ - ui/icon-names.h \ - ui/interface.cpp \ - ui/interface.h \ - ui/object-edit.cpp \ - ui/object-edit.h \ - ui/previewable.h \ - ui/previewfillable.h \ - ui/previewholder.cpp \ - ui/previewholder.h \ - ui/selected-color.h \ - ui/selected-color.cpp \ - ui/shape-editor.cpp \ - ui/shape-editor.h \ - ui/tool-factory.cpp \ - ui/tool-factory.h \ - ui/tools-switch.cpp \ - ui/tools-switch.h \ - ui/uxmanager.cpp \ - ui/uxmanager.h diff --git a/src/ui/cache/Makefile_insert b/src/ui/cache/Makefile_insert deleted file mode 100644 index c648777f8..000000000 --- a/src/ui/cache/Makefile_insert +++ /dev/null @@ -1,6 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - ui/cache/svg_preview_cache.h \ - ui/cache/svg_preview_cache.cpp - diff --git a/src/ui/dialog/Makefile_insert b/src/ui/dialog/Makefile_insert deleted file mode 100644 index 71628973e..000000000 --- a/src/ui/dialog/Makefile_insert +++ /dev/null @@ -1,133 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - ui/dialog/aboutbox.cpp \ - ui/dialog/aboutbox.h \ - ui/dialog/align-and-distribute.cpp \ - ui/dialog/align-and-distribute.h \ - ui/dialog/arrange-tab.h \ - ui/dialog/behavior.h \ - ui/dialog/calligraphic-profile-rename.h \ - ui/dialog/calligraphic-profile-rename.cpp \ - ui/dialog/clonetiler.cpp \ - ui/dialog/clonetiler.h \ - ui/dialog/color-item.cpp \ - ui/dialog/color-item.h \ - ui/dialog/debug.cpp \ - ui/dialog/debug.h \ - ui/dialog/desktop-tracker.cpp \ - ui/dialog/desktop-tracker.h \ - ui/dialog/dialog.cpp \ - ui/dialog/dialog.h \ - ui/dialog/dialog-manager.cpp \ - ui/dialog/dialog-manager.h \ - ui/dialog/dock-behavior.cpp \ - ui/dialog/dock-behavior.h \ - ui/dialog/document-metadata.cpp \ - ui/dialog/document-metadata.h \ - ui/dialog/document-properties.cpp \ - ui/dialog/document-properties.h \ - ui/dialog/export.cpp \ - ui/dialog/export.h \ - ui/dialog/extension-editor.cpp \ - ui/dialog/extension-editor.h \ - ui/dialog/extensions.cpp \ - ui/dialog/extensions.h \ - ui/dialog/filedialog.cpp \ - ui/dialog/filedialog.h \ - ui/dialog/filedialogimpl-gtkmm.cpp \ - ui/dialog/filedialogimpl-gtkmm.h \ - ui/dialog/filedialogimpl-win32.cpp \ - ui/dialog/filedialogimpl-win32.h \ - ui/dialog/fill-and-stroke.cpp \ - ui/dialog/fill-and-stroke.h \ - ui/dialog/filter-effects-dialog.cpp \ - ui/dialog/filter-effects-dialog.h \ - ui/dialog/find.cpp \ - ui/dialog/find.h \ - ui/dialog/font-substitution.cpp \ - ui/dialog/font-substitution.h \ - ui/dialog/floating-behavior.cpp \ - ui/dialog/floating-behavior.h \ - ui/dialog/glyphs.cpp \ - ui/dialog/glyphs.h \ - ui/dialog/grid-arrange-tab.h \ - ui/dialog/grid-arrange-tab.cpp \ - ui/dialog/guides.cpp \ - ui/dialog/guides.h \ - ui/dialog/icon-preview.cpp \ - ui/dialog/icon-preview.h \ - ui/dialog/inkscape-preferences.cpp \ - ui/dialog/inkscape-preferences.h \ - ui/dialog/input.cpp \ - ui/dialog/input.h \ - ui/dialog/knot-properties.cpp \ - ui/dialog/knot-properties.h \ - ui/dialog/layer-properties.cpp \ - ui/dialog/layer-properties.h \ - ui/dialog/layers.cpp \ - ui/dialog/layers.h \ - ui/dialog/livepatheffect-add.cpp \ - ui/dialog/livepatheffect-add.h \ - ui/dialog/livepatheffect-editor.cpp \ - ui/dialog/livepatheffect-editor.h \ - ui/dialog/memory.cpp \ - ui/dialog/memory.h \ - ui/dialog/messages.cpp \ - ui/dialog/messages.h \ - ui/dialog/new-from-template.cpp \ - ui/dialog/new-from-template.h \ - ui/dialog/ocaldialogs.cpp \ - ui/dialog/ocaldialogs.h \ - ui/dialog/object-attributes.cpp \ - ui/dialog/object-attributes.h \ - ui/dialog/object-properties.cpp \ - ui/dialog/object-properties.h \ - ui/dialog/panel-dialog.h \ - ui/dialog/polar-arrange-tab.cpp \ - ui/dialog/polar-arrange-tab.h \ - ui/dialog/print.cpp \ - ui/dialog/print.h \ - ui/dialog/print-colors-preview-dialog.cpp \ - ui/dialog/print-colors-preview-dialog.h \ - ui/dialog/spellcheck.cpp \ - ui/dialog/spellcheck.h \ - ui/dialog/svg-fonts-dialog.cpp \ - ui/dialog/svg-fonts-dialog.h \ - ui/dialog/swatches.cpp \ - ui/dialog/swatches.h \ - ui/dialog/symbols.cpp \ - ui/dialog/symbols.h \ - ui/dialog/template-load-tab.cpp \ - ui/dialog/template-load-tab.h \ - ui/dialog/template-widget.cpp \ - ui/dialog/template-widget.h \ - ui/dialog/tags.cpp \ - ui/dialog/tags.h \ - ui/dialog/text-edit.cpp \ - ui/dialog/text-edit.h \ - ui/dialog/tile.cpp \ - ui/dialog/tile.h \ - ui/dialog/pixelartdialog.cpp \ - ui/dialog/pixelartdialog.h \ - ui/dialog/transformation.cpp \ - ui/dialog/transformation.h \ - ui/dialog/undo-history.cpp \ - ui/dialog/undo-history.h \ - ui/dialog/xml-tree.cpp \ - ui/dialog/xml-tree.h \ - ui/dialog/lpe-powerstroke-properties.cpp \ - ui/dialog/lpe-powerstroke-properties.h \ - ui/dialog/objects.cpp \ - ui/dialog/objects.h \ - ui/dialog/lpe-fillet-chamfer-properties.cpp \ - ui/dialog/lpe-fillet-chamfer-properties.h \ - $(inkboard_dialogs) - -if HAVE_POTRACE - -ink_common_sources += \ - ui/dialog/tracedialog.cpp \ - ui/dialog/tracedialog.h - -endif diff --git a/src/ui/tool/Makefile_insert b/src/ui/tool/Makefile_insert deleted file mode 100644 index f46f48b72..000000000 --- a/src/ui/tool/Makefile_insert +++ /dev/null @@ -1,30 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - ui/tool/control-point.cpp \ - ui/tool/control-point.h \ - ui/tool/control-point-selection.cpp \ - ui/tool/control-point-selection.h \ - ui/tool/commit-events.h \ - ui/tool/curve-drag-point.cpp \ - ui/tool/curve-drag-point.h \ - ui/tool/event-utils.cpp \ - ui/tool/event-utils.h \ - ui/tool/manipulator.cpp \ - ui/tool/manipulator.h \ - ui/tool/modifier-tracker.cpp \ - ui/tool/modifier-tracker.h \ - ui/tool/multi-path-manipulator.cpp \ - ui/tool/multi-path-manipulator.h \ - ui/tool/node.cpp \ - ui/tool/node.h \ - ui/tool/node-types.h \ - ui/tool/path-manipulator.cpp \ - ui/tool/path-manipulator.h \ - ui/tool/selectable-control-point.cpp \ - ui/tool/selectable-control-point.h \ - ui/tool/selector.cpp \ - ui/tool/selector.h \ - ui/tool/shape-record.h \ - ui/tool/transform-handle-set.cpp \ - ui/tool/transform-handle-set.h diff --git a/src/ui/tools/Makefile_insert b/src/ui/tools/Makefile_insert deleted file mode 100644 index 686dfedd8..000000000 --- a/src/ui/tools/Makefile_insert +++ /dev/null @@ -1,34 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - ui/tools/arc-tool.cpp ui/tools/arc-tool.h \ - ui/tools/box3d-tool.cpp ui/tools/box3d-tool.h \ - ui/tools/calligraphic-tool.cpp ui/tools/calligraphic-tool.h \ - ui/tools/connector-tool.cpp ui/tools/connector-tool.h \ - ui/tools/dropper-tool.cpp ui/tools/dropper-tool.h \ - ui/tools/dynamic-base.cpp ui/tools/dynamic-base.h \ - ui/tools/eraser-tool.cpp ui/tools/eraser-tool.h \ - ui/tools/freehand-base.cpp ui/tools/freehand-base.h \ - ui/tools/gradient-tool.cpp ui/tools/gradient-tool.h \ - ui/tools/lpe-tool.cpp ui/tools/lpe-tool.h \ - ui/tools/measure-tool.cpp ui/tools/measure-tool.h \ - ui/tools/mesh-tool.cpp ui/tools/mesh-tool.h \ - ui/tools/node-tool.cpp ui/tools/node-tool.h \ - ui/tools/pen-tool.cpp ui/tools/pen-tool.h \ - ui/tools/pencil-tool.cpp ui/tools/pencil-tool.h \ - ui/tools/rect-tool.cpp ui/tools/rect-tool.h \ - ui/tools/select-tool.cpp ui/tools/select-tool.h \ - ui/tools/spiral-tool.cpp ui/tools/spiral-tool.h \ - ui/tools/spray-tool.cpp ui/tools/spray-tool.h \ - ui/tools/star-tool.cpp ui/tools/star-tool.h \ - ui/tools/text-tool.cpp ui/tools/text-tool.h \ - ui/tools/tool-base.cpp ui/tools/tool-base.h \ - ui/tools/tweak-tool.cpp ui/tools/tweak-tool.h \ - ui/tools/zoom-tool.cpp ui/tools/zoom-tool.h - -if HAVE_POTRACE - -ink_common_sources += \ - ui/tools/flood-tool.cpp ui/tools/flood-tool.h - -endif diff --git a/src/ui/view/Makefile_insert b/src/ui/view/Makefile_insert deleted file mode 100644 index b3ab598d4..000000000 --- a/src/ui/view/Makefile_insert +++ /dev/null @@ -1,9 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - ui/view/edit-widget-interface.h \ - ui/view/view.h \ - ui/view/view.cpp \ - ui/view/view-widget.cpp \ - ui/view/view-widget.h - diff --git a/src/ui/widget/Makefile_insert b/src/ui/widget/Makefile_insert deleted file mode 100644 index b22e4bd74..000000000 --- a/src/ui/widget/Makefile_insert +++ /dev/null @@ -1,106 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - ui/widget/anchor-selector.h \ - ui/widget/anchor-selector.cpp \ - ui/widget/attr-widget.h \ - ui/widget/button.h \ - ui/widget/button.cpp \ - ui/widget/color-entry.cpp \ - ui/widget/color-entry.h \ - ui/widget/color-icc-selector.cpp \ - ui/widget/color-icc-selector.h \ - ui/widget/color-notebook.cpp \ - ui/widget/color-notebook.h \ - ui/widget/color-wheel-selector.cpp \ - ui/widget/color-wheel-selector.h \ - ui/widget/color-picker.cpp \ - ui/widget/color-picker.h \ - ui/widget/color-preview.cpp \ - ui/widget/color-preview.h \ - ui/widget/color-slider.cpp \ - ui/widget/color-slider.h \ - ui/widget/color-scales.cpp \ - ui/widget/color-scales.h \ - ui/widget/combo-enums.h \ - ui/widget/dock.h \ - ui/widget/dock.cpp \ - ui/widget/dock-item.h \ - ui/widget/dock-item.cpp \ - ui/widget/entity-entry.cpp \ - ui/widget/entity-entry.h \ - ui/widget/entry.cpp \ - ui/widget/entry.h \ - ui/widget/filter-effect-chooser.h \ - ui/widget/filter-effect-chooser.cpp \ - ui/widget/font-variants.h \ - ui/widget/font-variants.cpp \ - ui/widget/frame.cpp \ - ui/widget/frame.h \ - ui/widget/imageicon.cpp \ - ui/widget/imageicon.h \ - ui/widget/imagetoggler.cpp \ - ui/widget/imagetoggler.h \ - ui/widget/labelled.cpp \ - ui/widget/labelled.h \ - ui/widget/layer-selector.cpp \ - ui/widget/layer-selector.h \ - ui/widget/licensor.cpp \ - ui/widget/licensor.h \ - ui/widget/notebook-page.cpp \ - ui/widget/notebook-page.h \ - ui/widget/object-composite-settings.cpp \ - ui/widget/object-composite-settings.h \ - ui/widget/page-sizer.cpp \ - ui/widget/page-sizer.h \ - ui/widget/panel.cpp \ - ui/widget/panel.h \ - ui/widget/point.cpp \ - ui/widget/point.h \ - ui/widget/preferences-widget.cpp \ - ui/widget/preferences-widget.h \ - ui/widget/random.cpp \ - ui/widget/random.h \ - ui/widget/registered-widget.cpp \ - ui/widget/registered-widget.h \ - ui/widget/registered-enums.h \ - ui/widget/registry.cpp \ - ui/widget/registry.h \ - ui/widget/rendering-options.cpp \ - ui/widget/rendering-options.h \ - ui/widget/rotateable.h \ - ui/widget/rotateable.cpp \ - ui/widget/scalar-unit.cpp \ - ui/widget/scalar-unit.h \ - ui/widget/scalar.cpp \ - ui/widget/scalar.h \ - ui/widget/selected-style.h \ - ui/widget/selected-style.cpp \ - ui/widget/spinbutton.h \ - ui/widget/spinbutton.cpp \ - ui/widget/spin-scale.h \ - ui/widget/spin-scale.cpp \ - ui/widget/spin-slider.h \ - ui/widget/spin-slider.cpp \ - ui/widget/style-subject.h \ - ui/widget/style-subject.cpp \ - ui/widget/style-swatch.h \ - ui/widget/style-swatch.cpp \ - ui/widget/text.cpp \ - ui/widget/text.h \ - ui/widget/tolerance-slider.cpp \ - ui/widget/tolerance-slider.h \ - ui/widget/unit-menu.cpp \ - ui/widget/unit-menu.h \ - ui/widget/unit-tracker.h \ - ui/widget/unit-tracker.cpp \ - ui/widget/clipmaskicon.cpp \ - ui/widget/clipmaskicon.h \ - ui/widget/highlight-picker.cpp \ - ui/widget/highlight-picker.h \ - ui/widget/layertypeicon.cpp \ - ui/widget/layertypeicon.h \ - ui/widget/insertordericon.cpp \ - ui/widget/insertordericon.h \ - ui/widget/addtoicon.cpp \ - ui/widget/addtoicon.h -- cgit v1.2.3 From d975ffe7b06db18ba418207270f58ec79eb07ae1 Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Mon, 8 Aug 2016 17:57:01 -0600 Subject: Use Gdk::Seat instead of Gdk::DeviceManager (bzr r15046.1.1) --- src/ui/dialog/filter-effects-dialog.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 97fa47f2f..676dcf31f 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -22,7 +22,12 @@ #include "dialog-manager.h" #include -#include +#include +#if GTK_CHECK_VERSION(3, 20, 0) +# include +#else +# include +#endif #include "ui/widget/spinbutton.h" @@ -1970,8 +1975,13 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtrget_display(); +#if GTK_CHECK_VERSION(3, 20, 0) + auto seat = display->get_default_seat(); + auto device = seat->get_pointer(); +#else auto dm = display->get_device_manager(); auto device = dm->get_client_pointer(); +#endif get_bin_window()->get_device_position(device, mx, my, mask); // Outline the bottom of the connection area -- cgit v1.2.3 From 860883afa75a3a2f60ed5ffc299447409138736f Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Wed, 10 Aug 2016 11:39:55 +0100 Subject: CloneTiler: C++ify (bzr r15050) --- src/ui/dialog/clonetiler.cpp | 116 ++++++++++++++++--------------------------- src/ui/dialog/clonetiler.h | 18 ++++--- 2 files changed, 56 insertions(+), 78 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index 1fa7a6c71..eb55e06c6 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -66,7 +66,6 @@ static SPDocument *trace_doc = NULL; CloneTiler::CloneTiler () : UI::Widget::Panel ("", "/dialogs/clonetiler/", SP_VERB_DIALOG_CLONETILER), - dlg(NULL), desktop(NULL), deskTrack(), table_row_labels(NULL) @@ -75,9 +74,7 @@ CloneTiler::CloneTiler () : contents->set_spacing(0); { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - - dlg = GTK_WIDGET(gobj()); + auto prefs = Inkscape::Preferences::get(); auto mainbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); gtk_box_set_homogeneous(GTK_BOX(mainbox), FALSE); @@ -769,15 +766,14 @@ CloneTiler::CloneTiler () : gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(b), "toggled", - G_CALLBACK(clonetiler_do_pick_toggled), (gpointer)dlg); + G_CALLBACK(clonetiler_do_pick_toggled), (gpointer)this); } { auto vvb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_set_homogeneous(GTK_BOX(vvb), FALSE); gtk_box_pack_start (GTK_BOX (vb), vvb, FALSE, FALSE, 0); - g_object_set_data (G_OBJECT(dlg), "dotrace", (gpointer) vvb); - + _dotrace = vvb; { GtkWidget *frame = gtk_frame_new (_("1. Pick from the drawing:")); @@ -973,7 +969,7 @@ CloneTiler::CloneTiler () : { auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); - g_object_set_data (G_OBJECT(dlg), "rowscols", (gpointer) hb); + _rowscols = hb; { auto a = Gtk::Adjustment::create(0.0, 1, 500, 1, 10, 0); @@ -1018,7 +1014,7 @@ CloneTiler::CloneTiler () : { auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); - g_object_set_data (G_OBJECT(dlg), "widthheight", (gpointer) hb); + _widthheight = hb; // unitmenu unit_menu = new Inkscape::UI::Widget::UnitMenu(); @@ -1081,7 +1077,7 @@ CloneTiler::CloneTiler () : radio = gtk_radio_button_new_with_label (NULL, _("Rows, columns: ")); gtk_widget_set_tooltip_text (radio, _("Create the specified number of rows and columns")); clonetiler_table_attach (table, radio, 0.0, 1, 1); - g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (clonetiler_switch_to_create), (gpointer) dlg); + g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (clonetiler_switch_to_create), (gpointer) this); } if (!prefs->getBool(prefs_path + "fillrect")) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); @@ -1091,7 +1087,7 @@ CloneTiler::CloneTiler () : radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("Width, height: ")); gtk_widget_set_tooltip_text (radio, _("Fill the specified width and height with the tiling")); clonetiler_table_attach (table, radio, 0.0, 2, 1); - g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (clonetiler_switch_to_fill), (gpointer) dlg); + g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (clonetiler_switch_to_fill), (gpointer) this); } if (prefs->getBool(prefs_path + "fillrect")) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); @@ -1122,7 +1118,7 @@ CloneTiler::CloneTiler () : gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); gtk_box_pack_end (GTK_BOX (mainbox), hb, FALSE, FALSE, 0); GtkWidget *l = gtk_label_new(""); - g_object_set_data (G_OBJECT(dlg), "status", (gpointer) l); + _status = l; gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0); } @@ -1133,20 +1129,20 @@ CloneTiler::CloneTiler () : gtk_box_pack_start (GTK_BOX (mainbox), hb, FALSE, FALSE, 0); { - GtkWidget *b = gtk_button_new (); - GtkWidget *l = gtk_label_new (""); - gtk_label_set_markup_with_mnemonic (GTK_LABEL(l), _(" _Create ")); - gtk_container_add (GTK_CONTAINER(b), l); - gtk_widget_set_tooltip_text (b, _("Create and tile the clones of the selection")); - g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (clonetiler_apply), dlg); - gtk_box_pack_end (GTK_BOX (hb), b, FALSE, FALSE, 0); + auto b = Gtk::manage(new Gtk::Button()); + auto l = Gtk::manage(new Gtk::Label("")); + l->set_markup_with_mnemonic(_(" _Create ")); + b->add(*l); + b->set_tooltip_text(_("Create and tile the clones of the selection")); + b->signal_clicked().connect(sigc::mem_fun(*this, &CloneTiler::apply)); + gtk_box_pack_end (GTK_BOX (hb), GTK_WIDGET(b->gobj()), FALSE, FALSE, 0); } { // buttons which are enabled only when there are tiled clones auto sb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous(GTK_BOX(sb), FALSE); gtk_box_pack_end (GTK_BOX (hb), sb, FALSE, FALSE, 0); - g_object_set_data (G_OBJECT(dlg), "buttons_on_tiles", (gpointer) sb); + _buttons_on_tiles = sb; { // TRANSLATORS: if a group of objects are "clumped" together, then they // are unevenly spread in the given amount of space - as shown in the @@ -1160,28 +1156,26 @@ CloneTiler::CloneTiler () : } { - GtkWidget *b = gtk_button_new_with_mnemonic (_(" Re_move ")); - gtk_widget_set_tooltip_text (b, _("Remove existing tiled clones of the selected object (siblings only)")); - g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (clonetiler_remove), gpointer(dlg)); - gtk_box_pack_end (GTK_BOX (sb), b, FALSE, FALSE, 0); + auto b = Gtk::manage(new Gtk::Button(_(" Re_move "), true)); + b->set_tooltip_text(_("Remove existing tiled clones of the selected object (siblings only)")); + b->signal_clicked().connect(sigc::mem_fun(*this, &CloneTiler::on_remove_button_clicked)); + gtk_box_pack_end (GTK_BOX (sb), GTK_WIDGET(b->gobj()), FALSE, FALSE, 0); } // connect to global selection changed signal (so we can change desktops) and // external_change (so we're not fooled by undo) - selectChangedConn = INKSCAPE.signal_selection_changed.connect(sigc::bind(sigc::ptr_fun(&CloneTiler::clonetiler_change_selection), dlg)); - externChangedConn = INKSCAPE.signal_external_change.connect (sigc::bind(sigc::ptr_fun(&CloneTiler::clonetiler_external_change), dlg)); - - g_signal_connect(G_OBJECT(dlg), "destroy", G_CALLBACK(clonetiler_disconnect_gsignal), this); + selectChangedConn = INKSCAPE.signal_selection_changed.connect(sigc::mem_fun(*this, &CloneTiler::change_selection)); + externChangedConn = INKSCAPE.signal_external_change.connect(sigc::mem_fun(*this, &CloneTiler::external_change)); // update now - clonetiler_change_selection (SP_ACTIVE_DESKTOP->getSelection(), dlg); + change_selection(SP_ACTIVE_DESKTOP->getSelection()); } { GtkWidget *b = gtk_button_new_with_mnemonic (_(" R_eset ")); // TRANSLATORS: "change" is a noun here gtk_widget_set_tooltip_text (b, _("Reset all shifts, scales, rotates, opacity and color changes in the dialog to zero")); - g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (clonetiler_reset), dlg); + g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (clonetiler_reset), this); gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); } } @@ -1199,8 +1193,9 @@ CloneTiler::CloneTiler () : CloneTiler::~CloneTiler (void) { //subselChangedConn.disconnect(); - //selectChangedConn.disconnect(); //selectModifiedConn.disconnect(); + selectChangedConn.disconnect(); + externChangedConn.disconnect(); desktopChangeConn.disconnect(); deskTrack.disconnect(); color_changed_connection.disconnect(); @@ -1215,17 +1210,7 @@ void CloneTiler::setDesktop(SPDesktop *desktop) void CloneTiler::setTargetDesktop(SPDesktop *desktop) { if (this->desktop != desktop) { - if (this->desktop) { - //selectModifiedConn.disconnect(); - //subselChangedConn.disconnect(); - //selectChangedConn.disconnect(); - } this->desktop = desktop; - if (desktop && desktop->selection) { - //selectChangedConn = desktop->selection->connectChanged(sigc::hide(sigc::mem_fun(*this, &CloneTiler::clonetiler_change_selection))); - //subselChangedConn = desktop->connectToolSubselectionChanged(sigc::hide(sigc::mem_fun(*this, &CloneTiler::clonetiler_change_selection))); - //selectModifiedConn = desktop->selection->connectModified(sigc::hide<0>(sigc::mem_fun(*this, &CloneTiler::clonetiler_change_selection))); - } } } @@ -1245,47 +1230,35 @@ void CloneTiler::on_picker_color_changed(guint rgba) is_updating = false; } -void CloneTiler::clonetiler_change_selection(Inkscape::Selection *selection, GtkWidget *dlg) +void CloneTiler::change_selection(Inkscape::Selection *selection) { - GtkWidget *buttons = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "buttons_on_tiles")); - GtkWidget *status = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "status")); - if (selection->isEmpty()) { - gtk_widget_set_sensitive (buttons, FALSE); - gtk_label_set_markup (GTK_LABEL(status), _("Nothing selected.")); + gtk_widget_set_sensitive (_buttons_on_tiles, FALSE); + gtk_label_set_markup (GTK_LABEL(_status), _("Nothing selected.")); return; } if (boost::distance(selection->items()) > 1) { - gtk_widget_set_sensitive (buttons, FALSE); - gtk_label_set_markup (GTK_LABEL(status), _("More than one object selected.")); + gtk_widget_set_sensitive (_buttons_on_tiles, FALSE); + gtk_label_set_markup (GTK_LABEL(_status), _("More than one object selected.")); return; } guint n = clonetiler_number_of_clones(selection->singleItem()); if (n > 0) { - gtk_widget_set_sensitive (buttons, TRUE); + gtk_widget_set_sensitive (_buttons_on_tiles, TRUE); gchar *sta = g_strdup_printf (_("Object has %d tiled clones."), n); - gtk_label_set_markup (GTK_LABEL(status), sta); + gtk_label_set_markup (GTK_LABEL(_status), sta); g_free (sta); } else { - gtk_widget_set_sensitive (buttons, FALSE); - gtk_label_set_markup (GTK_LABEL(status), _("Object has no tiled clones.")); + gtk_widget_set_sensitive (_buttons_on_tiles, FALSE); + gtk_label_set_markup (GTK_LABEL(_status), _("Object has no tiled clones.")); } } -void CloneTiler::clonetiler_external_change(GtkWidget *dlg) -{ - clonetiler_change_selection (SP_ACTIVE_DESKTOP->getSelection(), dlg); -} - -void CloneTiler::clonetiler_disconnect_gsignal(GObject *, gpointer source) +void CloneTiler::external_change() { - g_return_if_fail(source != NULL); - - CloneTiler* dlg = reinterpret_cast(source); - dlg->selectChangedConn.disconnect(); - dlg->externChangedConn.disconnect(); + change_selection(SP_ACTIVE_DESKTOP->getSelection()); } Geom::Affine CloneTiler::clonetiler_get_transform( @@ -2032,7 +2005,7 @@ guint CloneTiler::clonetiler_number_of_clones(SPObject *obj) return n; } -void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool do_undo/* = true*/) +void CloneTiler::remove(bool do_undo/* = true*/) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop == NULL) { @@ -2064,7 +2037,7 @@ void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool d } g_slist_free (to_delete); - clonetiler_change_selection (selection, dlg); + change_selection (selection); if (do_undo) { DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_CLONETILER, @@ -2104,7 +2077,7 @@ double CloneTiler::randomize01(double val, double rand) } -void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) +void CloneTiler::apply() { SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop == NULL) { @@ -2129,9 +2102,8 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) desktop->setWaitingCursor(); // set statusbar text - GtkWidget *status = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "status")); - gtk_label_set_markup (GTK_LABEL(status), _("Creating tiled clones...")); - gtk_widget_queue_draw(GTK_WIDGET(status)); + gtk_label_set_markup (GTK_LABEL(_status), _("Creating tiled clones...")); + gtk_widget_queue_draw(GTK_WIDGET(_status)); gdk_window_process_all_updates(); SPObject *obj = selection->singleItem(); @@ -2144,7 +2116,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) const char *id_href = g_strdup_printf("#%s", obj_repr->attribute("id")); SPObject *parent = obj->parent; - clonetiler_remove (NULL, dlg, false); + remove(false); Geom::Scale scale = desktop->getDocument()->getDocumentScale().inverse(); double scale_units = scale[Geom::X]; // Use just x direction.... @@ -2542,7 +2514,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) clonetiler_trace_finish (); } - clonetiler_change_selection (selection, dlg); + change_selection(selection); desktop->clearWaitingCursor(); diff --git a/src/ui/dialog/clonetiler.h b/src/ui/dialog/clonetiler.h index e76ad028e..9ad3fa878 100644 --- a/src/ui/dialog/clonetiler.h +++ b/src/ui/dialog/clonetiler.h @@ -41,7 +41,6 @@ protected: void clonetiler_table_attach(GtkWidget *table, GtkWidget *widget, float align, int row, int col); static void clonetiler_symgroup_changed(GtkComboBox *cb, gpointer /*data*/); - static void clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool do_undo = true); static void on_picker_color_changed(guint rgba); static void clonetiler_trace_hide_tiled_clones_recursively(SPObject *from); static void clonetiler_checkbox_toggled(GtkToggleButton *tb, gpointer *data); @@ -55,11 +54,7 @@ protected: static void clonetiler_switch_to_create(GtkToggleButton */*tb*/, GtkWidget *dlg); static void clonetiler_switch_to_fill(GtkToggleButton */*tb*/, GtkWidget *dlg); static void clonetiler_keep_bbox_toggled(GtkToggleButton *tb, gpointer /*data*/); - static void clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg); static void clonetiler_unclump(GtkWidget */*widget*/, void *); - static void clonetiler_change_selection(Inkscape::Selection *selection, GtkWidget *dlg); - static void clonetiler_external_change(GtkWidget *dlg); - static void clonetiler_disconnect_gsignal(GObject *widget, gpointer source); static void clonetiler_reset(GtkWidget */*widget*/, GtkWidget *dlg); static guint clonetiler_number_of_clones(SPObject *obj); static void clonetiler_trace_setup(SPDocument *doc, gdouble zoom, SPItem *original); @@ -71,6 +66,12 @@ protected: static void clonetiler_value_changed(GtkAdjustment *adj, gpointer data); static void clonetiler_reset_recursive(GtkWidget *w); + void apply(); + void change_selection(Inkscape::Selection *selection); + void external_change(); + void remove(bool do_undo = true); + void on_remove_button_clicked() {remove();} + static Geom::Affine clonetiler_get_transform( // symmetry group int type, @@ -112,7 +113,6 @@ private: CloneTiler(CloneTiler const &d); CloneTiler& operator=(CloneTiler const &d); - GtkWidget *dlg; GtkWidget *nb; GtkWidget *b; SPDesktop *desktop; @@ -142,6 +142,12 @@ private: */ void setTargetDesktop(SPDesktop *desktop); + // Variables that used to be set using GObject + GtkWidget *_buttons_on_tiles; + GtkWidget *_dotrace; + GtkWidget *_status; + GtkWidget *_rowscols; + GtkWidget *_widthheight; }; -- cgit v1.2.3 From 349e2e3bc0b11c89a0a791e7feedfc9e0c457e5d Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Wed, 10 Aug 2016 12:39:30 +0100 Subject: CloneTiler: Further C++ification (bzr r15051) --- src/ui/dialog/clonetiler.cpp | 511 ++++++++++++++++++++++--------------------- src/ui/dialog/clonetiler.h | 65 +++--- 2 files changed, 292 insertions(+), 284 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index eb55e06c6..8bd5cd5f6 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -22,7 +22,9 @@ #include #include <2geom/transforms.h> + #include +#include #include "desktop.h" @@ -88,7 +90,7 @@ CloneTiler::CloneTiler () : // Symmetry { - GtkWidget *vb = clonetiler_new_tab (nb, _("_Symmetry")); + GtkWidget *vb = new_tab (nb, _("_Symmetry")); /* TRANSLATORS: For the following 17 symmetry groups, see * http://www.bib.ulb.ac.be/coursmath/doc/17.htm (visual examples); @@ -149,16 +151,16 @@ CloneTiler::CloneTiler () : gtk_combo_box_set_active (GTK_COMBO_BOX (combo), current); g_signal_connect(G_OBJECT(combo), "changed", - G_CALLBACK(clonetiler_symgroup_changed), NULL); + G_CALLBACK(symgroup_changed), NULL); } table_row_labels = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); // Shift { - GtkWidget *vb = clonetiler_new_tab (nb, _("S_hift")); + GtkWidget *vb = new_tab (nb, _("S_hift")); - GtkWidget *table = clonetiler_table_x_y_rand (3); + GtkWidget *table = table_x_y_rand (3); gtk_box_pack_start (GTK_BOX (vb), table, FALSE, FALSE, 0); // X @@ -168,29 +170,29 @@ CloneTiler::CloneTiler () : // xgettext:no-c-format gtk_label_set_markup (GTK_LABEL(l), _("Shift X:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 2, 1); + table_attach (table, l, 1, 2, 1); } { - GtkWidget *l = clonetiler_spinbox ( + GtkWidget *l = spinbox ( // xgettext:no-c-format _("Horizontal shift per row (in % of tile width)"), "shiftx_per_j", -10000, 10000, "%"); - clonetiler_table_attach (table, l, 0, 2, 2); + table_attach (table, l, 0, 2, 2); } { - GtkWidget *l = clonetiler_spinbox ( + GtkWidget *l = spinbox ( // xgettext:no-c-format _("Horizontal shift per column (in % of tile width)"), "shiftx_per_i", -10000, 10000, "%"); - clonetiler_table_attach (table, l, 0, 2, 3); + table_attach (table, l, 0, 2, 3); } { - GtkWidget *l = clonetiler_spinbox (_("Randomize the horizontal shift by this percentage"), "shiftx_rand", + GtkWidget *l = spinbox (_("Randomize the horizontal shift by this percentage"), "shiftx_rand", 0, 1000, "%"); - clonetiler_table_attach (table, l, 0, 2, 4); + table_attach (table, l, 0, 2, 4); } // Y @@ -200,30 +202,30 @@ CloneTiler::CloneTiler () : // xgettext:no-c-format gtk_label_set_markup (GTK_LABEL(l), _("Shift Y:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 3, 1); + table_attach (table, l, 1, 3, 1); } { - GtkWidget *l = clonetiler_spinbox ( + GtkWidget *l = spinbox ( // xgettext:no-c-format _("Vertical shift per row (in % of tile height)"), "shifty_per_j", -10000, 10000, "%"); - clonetiler_table_attach (table, l, 0, 3, 2); + table_attach (table, l, 0, 3, 2); } { - GtkWidget *l = clonetiler_spinbox ( + GtkWidget *l = spinbox ( // xgettext:no-c-format _("Vertical shift per column (in % of tile height)"), "shifty_per_i", -10000, 10000, "%"); - clonetiler_table_attach (table, l, 0, 3, 3); + table_attach (table, l, 0, 3, 3); } { - GtkWidget *l = clonetiler_spinbox ( + GtkWidget *l = spinbox ( _("Randomize the vertical shift by this percentage"), "shifty_rand", 0, 1000, "%"); - clonetiler_table_attach (table, l, 0, 3, 4); + table_attach (table, l, 0, 3, 4); } // Exponent @@ -231,21 +233,21 @@ CloneTiler::CloneTiler () : GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("Exponent:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 4, 1); + table_attach (table, l, 1, 4, 1); } { - GtkWidget *l = clonetiler_spinbox ( + GtkWidget *l = spinbox ( _("Whether rows are spaced evenly (1), converge (<1) or diverge (>1)"), "shifty_exp", 0, 10, "", true); - clonetiler_table_attach (table, l, 0, 4, 2); + table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = clonetiler_spinbox ( + GtkWidget *l = spinbox ( _("Whether columns are spaced evenly (1), converge (<1) or diverge (>1)"), "shiftx_exp", 0, 10, "", true); - clonetiler_table_attach (table, l, 0, 4, 3); + table_attach (table, l, 0, 4, 3); } { // alternates @@ -253,17 +255,17 @@ CloneTiler::CloneTiler () : // TRANSLATORS: "Alternate" is a verb here gtk_label_set_markup (GTK_LABEL(l), _("Alternate:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 5, 1); + table_attach (table, l, 1, 5, 1); } { - GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of shifts for each row"), "shifty_alternate"); - clonetiler_table_attach (table, l, 0, 5, 2); + GtkWidget *l = checkbox (_("Alternate the sign of shifts for each row"), "shifty_alternate"); + table_attach (table, l, 0, 5, 2); } { - GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of shifts for each column"), "shiftx_alternate"); - clonetiler_table_attach (table, l, 0, 5, 3); + GtkWidget *l = checkbox (_("Alternate the sign of shifts for each column"), "shiftx_alternate"); + table_attach (table, l, 0, 5, 3); } { // Cumulate @@ -271,17 +273,17 @@ CloneTiler::CloneTiler () : // TRANSLATORS: "Cumulate" is a verb here gtk_label_set_markup (GTK_LABEL(l), _("Cumulate:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 6, 1); + table_attach (table, l, 1, 6, 1); } { - GtkWidget *l = clonetiler_checkbox (_("Cumulate the shifts for each row"), "shifty_cumulate"); - clonetiler_table_attach (table, l, 0, 6, 2); + GtkWidget *l = checkbox (_("Cumulate the shifts for each row"), "shifty_cumulate"); + table_attach (table, l, 0, 6, 2); } { - GtkWidget *l = clonetiler_checkbox (_("Cumulate the shifts for each column"), "shiftx_cumulate"); - clonetiler_table_attach (table, l, 0, 6, 3); + GtkWidget *l = checkbox (_("Cumulate the shifts for each column"), "shiftx_cumulate"); + table_attach (table, l, 0, 6, 3); } { // Exclude tile width and height in shift @@ -289,17 +291,17 @@ CloneTiler::CloneTiler () : // TRANSLATORS: "Cumulate" is a verb here gtk_label_set_markup (GTK_LABEL(l), _("Exclude tile:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 7, 1); + table_attach (table, l, 1, 7, 1); } { - GtkWidget *l = clonetiler_checkbox (_("Exclude tile height in shift"), "shifty_excludeh"); - clonetiler_table_attach (table, l, 0, 7, 2); + GtkWidget *l = checkbox (_("Exclude tile height in shift"), "shifty_excludeh"); + table_attach (table, l, 0, 7, 2); } { - GtkWidget *l = clonetiler_checkbox (_("Exclude tile width in shift"), "shiftx_excludew"); - clonetiler_table_attach (table, l, 0, 7, 3); + GtkWidget *l = checkbox (_("Exclude tile width in shift"), "shiftx_excludew"); + table_attach (table, l, 0, 7, 3); } } @@ -307,9 +309,9 @@ CloneTiler::CloneTiler () : // Scale { - GtkWidget *vb = clonetiler_new_tab (nb, _("Sc_ale")); + GtkWidget *vb = new_tab (nb, _("Sc_ale")); - GtkWidget *table = clonetiler_table_x_y_rand (2); + GtkWidget *table = table_x_y_rand (2); gtk_box_pack_start (GTK_BOX (vb), table, FALSE, FALSE, 0); // X @@ -317,29 +319,29 @@ CloneTiler::CloneTiler () : GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("Scale X:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 2, 1); + table_attach (table, l, 1, 2, 1); } { - GtkWidget *l = clonetiler_spinbox ( + GtkWidget *l = spinbox ( // xgettext:no-c-format _("Horizontal scale per row (in % of tile width)"), "scalex_per_j", -100, 1000, "%"); - clonetiler_table_attach (table, l, 0, 2, 2); + table_attach (table, l, 0, 2, 2); } { - GtkWidget *l = clonetiler_spinbox ( + GtkWidget *l = spinbox ( // xgettext:no-c-format _("Horizontal scale per column (in % of tile width)"), "scalex_per_i", -100, 1000, "%"); - clonetiler_table_attach (table, l, 0, 2, 3); + table_attach (table, l, 0, 2, 3); } { - GtkWidget *l = clonetiler_spinbox (_("Randomize the horizontal scale by this percentage"), "scalex_rand", + GtkWidget *l = spinbox (_("Randomize the horizontal scale by this percentage"), "scalex_rand", 0, 1000, "%"); - clonetiler_table_attach (table, l, 0, 2, 4); + table_attach (table, l, 0, 2, 4); } // Y @@ -347,29 +349,29 @@ CloneTiler::CloneTiler () : GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("Scale Y:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 3, 1); + table_attach (table, l, 1, 3, 1); } { - GtkWidget *l = clonetiler_spinbox ( + GtkWidget *l = spinbox ( // xgettext:no-c-format _("Vertical scale per row (in % of tile height)"), "scaley_per_j", -100, 1000, "%"); - clonetiler_table_attach (table, l, 0, 3, 2); + table_attach (table, l, 0, 3, 2); } { - GtkWidget *l = clonetiler_spinbox ( + GtkWidget *l = spinbox ( // xgettext:no-c-format _("Vertical scale per column (in % of tile height)"), "scaley_per_i", -100, 1000, "%"); - clonetiler_table_attach (table, l, 0, 3, 3); + table_attach (table, l, 0, 3, 3); } { - GtkWidget *l = clonetiler_spinbox (_("Randomize the vertical scale by this percentage"), "scaley_rand", + GtkWidget *l = spinbox (_("Randomize the vertical scale by this percentage"), "scaley_rand", 0, 1000, "%"); - clonetiler_table_attach (table, l, 0, 3, 4); + table_attach (table, l, 0, 3, 4); } // Exponent @@ -377,19 +379,19 @@ CloneTiler::CloneTiler () : GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("Exponent:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 4, 1); + table_attach (table, l, 1, 4, 1); } { - GtkWidget *l = clonetiler_spinbox (_("Whether row scaling is uniform (1), converge (<1) or diverge (>1)"), "scaley_exp", + GtkWidget *l = spinbox (_("Whether row scaling is uniform (1), converge (<1) or diverge (>1)"), "scaley_exp", 0, 10, "", true); - clonetiler_table_attach (table, l, 0, 4, 2); + table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = clonetiler_spinbox (_("Whether column scaling is uniform (1), converge (<1) or diverge (>1)"), "scalex_exp", + GtkWidget *l = spinbox (_("Whether column scaling is uniform (1), converge (<1) or diverge (>1)"), "scalex_exp", 0, 10, "", true); - clonetiler_table_attach (table, l, 0, 4, 3); + table_attach (table, l, 0, 4, 3); } // Logarithmic (as in logarithmic spiral) @@ -397,19 +399,19 @@ CloneTiler::CloneTiler () : GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("Base:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 5, 1); + table_attach (table, l, 1, 5, 1); } { - GtkWidget *l = clonetiler_spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scaley_log", + GtkWidget *l = spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scaley_log", 0, 10, "", false); - clonetiler_table_attach (table, l, 0, 5, 2); + table_attach (table, l, 0, 5, 2); } { - GtkWidget *l = clonetiler_spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scalex_log", + GtkWidget *l = spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scalex_log", 0, 10, "", false); - clonetiler_table_attach (table, l, 0, 5, 3); + table_attach (table, l, 0, 5, 3); } { // alternates @@ -417,17 +419,17 @@ CloneTiler::CloneTiler () : // TRANSLATORS: "Alternate" is a verb here gtk_label_set_markup (GTK_LABEL(l), _("Alternate:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 6, 1); + table_attach (table, l, 1, 6, 1); } { - GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of scales for each row"), "scaley_alternate"); - clonetiler_table_attach (table, l, 0, 6, 2); + GtkWidget *l = checkbox (_("Alternate the sign of scales for each row"), "scaley_alternate"); + table_attach (table, l, 0, 6, 2); } { - GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of scales for each column"), "scalex_alternate"); - clonetiler_table_attach (table, l, 0, 6, 3); + GtkWidget *l = checkbox (_("Alternate the sign of scales for each column"), "scalex_alternate"); + table_attach (table, l, 0, 6, 3); } { // Cumulate @@ -435,17 +437,17 @@ CloneTiler::CloneTiler () : // TRANSLATORS: "Cumulate" is a verb here gtk_label_set_markup (GTK_LABEL(l), _("Cumulate:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 7, 1); + table_attach (table, l, 1, 7, 1); } { - GtkWidget *l = clonetiler_checkbox (_("Cumulate the scales for each row"), "scaley_cumulate"); - clonetiler_table_attach (table, l, 0, 7, 2); + GtkWidget *l = checkbox (_("Cumulate the scales for each row"), "scaley_cumulate"); + table_attach (table, l, 0, 7, 2); } { - GtkWidget *l = clonetiler_checkbox (_("Cumulate the scales for each column"), "scalex_cumulate"); - clonetiler_table_attach (table, l, 0, 7, 3); + GtkWidget *l = checkbox (_("Cumulate the scales for each column"), "scalex_cumulate"); + table_attach (table, l, 0, 7, 3); } } @@ -453,9 +455,9 @@ CloneTiler::CloneTiler () : // Rotation { - GtkWidget *vb = clonetiler_new_tab (nb, _("_Rotation")); + GtkWidget *vb = new_tab (nb, _("_Rotation")); - GtkWidget *table = clonetiler_table_x_y_rand (1); + GtkWidget *table = table_x_y_rand (1); gtk_box_pack_start (GTK_BOX (vb), table, FALSE, FALSE, 0); // Angle @@ -463,29 +465,29 @@ CloneTiler::CloneTiler () : GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("Angle:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 2, 1); + table_attach (table, l, 1, 2, 1); } { - GtkWidget *l = clonetiler_spinbox ( + GtkWidget *l = spinbox ( // xgettext:no-c-format _("Rotate tiles by this angle for each row"), "rotate_per_j", -180, 180, "°"); - clonetiler_table_attach (table, l, 0, 2, 2); + table_attach (table, l, 0, 2, 2); } { - GtkWidget *l = clonetiler_spinbox ( + GtkWidget *l = spinbox ( // xgettext:no-c-format _("Rotate tiles by this angle for each column"), "rotate_per_i", -180, 180, "°"); - clonetiler_table_attach (table, l, 0, 2, 3); + table_attach (table, l, 0, 2, 3); } { - GtkWidget *l = clonetiler_spinbox (_("Randomize the rotation angle by this percentage"), "rotate_rand", + GtkWidget *l = spinbox (_("Randomize the rotation angle by this percentage"), "rotate_rand", 0, 100, "%"); - clonetiler_table_attach (table, l, 0, 2, 4); + table_attach (table, l, 0, 2, 4); } { // alternates @@ -493,17 +495,17 @@ CloneTiler::CloneTiler () : // TRANSLATORS: "Alternate" is a verb here gtk_label_set_markup (GTK_LABEL(l), _("Alternate:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 3, 1); + table_attach (table, l, 1, 3, 1); } { - GtkWidget *l = clonetiler_checkbox (_("Alternate the rotation direction for each row"), "rotate_alternatej"); - clonetiler_table_attach (table, l, 0, 3, 2); + GtkWidget *l = checkbox (_("Alternate the rotation direction for each row"), "rotate_alternatej"); + table_attach (table, l, 0, 3, 2); } { - GtkWidget *l = clonetiler_checkbox (_("Alternate the rotation direction for each column"), "rotate_alternatei"); - clonetiler_table_attach (table, l, 0, 3, 3); + GtkWidget *l = checkbox (_("Alternate the rotation direction for each column"), "rotate_alternatei"); + table_attach (table, l, 0, 3, 3); } { // Cumulate @@ -511,17 +513,17 @@ CloneTiler::CloneTiler () : // TRANSLATORS: "Cumulate" is a verb here gtk_label_set_markup (GTK_LABEL(l), _("Cumulate:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 4, 1); + table_attach (table, l, 1, 4, 1); } { - GtkWidget *l = clonetiler_checkbox (_("Cumulate the rotation for each row"), "rotate_cumulatej"); - clonetiler_table_attach (table, l, 0, 4, 2); + GtkWidget *l = checkbox (_("Cumulate the rotation for each row"), "rotate_cumulatej"); + table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = clonetiler_checkbox (_("Cumulate the rotation for each column"), "rotate_cumulatei"); - clonetiler_table_attach (table, l, 0, 4, 3); + GtkWidget *l = checkbox (_("Cumulate the rotation for each column"), "rotate_cumulatei"); + table_attach (table, l, 0, 4, 3); } } @@ -529,9 +531,9 @@ CloneTiler::CloneTiler () : // Blur and opacity { - GtkWidget *vb = clonetiler_new_tab (nb, _("_Blur & opacity")); + GtkWidget *vb = new_tab (nb, _("_Blur & opacity")); - GtkWidget *table = clonetiler_table_x_y_rand (1); + GtkWidget *table = table_x_y_rand (1); gtk_box_pack_start (GTK_BOX (vb), table, FALSE, FALSE, 0); @@ -540,25 +542,25 @@ CloneTiler::CloneTiler () : GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("Blur:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 2, 1); + table_attach (table, l, 1, 2, 1); } { - GtkWidget *l = clonetiler_spinbox (_("Blur tiles by this percentage for each row"), "blur_per_j", + GtkWidget *l = spinbox (_("Blur tiles by this percentage for each row"), "blur_per_j", 0, 100, "%"); - clonetiler_table_attach (table, l, 0, 2, 2); + table_attach (table, l, 0, 2, 2); } { - GtkWidget *l = clonetiler_spinbox (_("Blur tiles by this percentage for each column"), "blur_per_i", + GtkWidget *l = spinbox (_("Blur tiles by this percentage for each column"), "blur_per_i", 0, 100, "%"); - clonetiler_table_attach (table, l, 0, 2, 3); + table_attach (table, l, 0, 2, 3); } { - GtkWidget *l = clonetiler_spinbox (_("Randomize the tile blur by this percentage"), "blur_rand", + GtkWidget *l = spinbox (_("Randomize the tile blur by this percentage"), "blur_rand", 0, 100, "%"); - clonetiler_table_attach (table, l, 0, 2, 4); + table_attach (table, l, 0, 2, 4); } { // alternates @@ -566,17 +568,17 @@ CloneTiler::CloneTiler () : // TRANSLATORS: "Alternate" is a verb here gtk_label_set_markup (GTK_LABEL(l), _("Alternate:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 3, 1); + table_attach (table, l, 1, 3, 1); } { - GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of blur change for each row"), "blur_alternatej"); - clonetiler_table_attach (table, l, 0, 3, 2); + GtkWidget *l = checkbox (_("Alternate the sign of blur change for each row"), "blur_alternatej"); + table_attach (table, l, 0, 3, 2); } { - GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of blur change for each column"), "blur_alternatei"); - clonetiler_table_attach (table, l, 0, 3, 3); + GtkWidget *l = checkbox (_("Alternate the sign of blur change for each column"), "blur_alternatei"); + table_attach (table, l, 0, 3, 3); } @@ -586,25 +588,25 @@ CloneTiler::CloneTiler () : GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("Opacity:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 4, 1); + table_attach (table, l, 1, 4, 1); } { - GtkWidget *l = clonetiler_spinbox (_("Decrease tile opacity by this percentage for each row"), "opacity_per_j", + GtkWidget *l = spinbox (_("Decrease tile opacity by this percentage for each row"), "opacity_per_j", 0, 100, "%"); - clonetiler_table_attach (table, l, 0, 4, 2); + table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = clonetiler_spinbox (_("Decrease tile opacity by this percentage for each column"), "opacity_per_i", + GtkWidget *l = spinbox (_("Decrease tile opacity by this percentage for each column"), "opacity_per_i", 0, 100, "%"); - clonetiler_table_attach (table, l, 0, 4, 3); + table_attach (table, l, 0, 4, 3); } { - GtkWidget *l = clonetiler_spinbox (_("Randomize the tile opacity by this percentage"), "opacity_rand", + GtkWidget *l = spinbox (_("Randomize the tile opacity by this percentage"), "opacity_rand", 0, 100, "%"); - clonetiler_table_attach (table, l, 0, 4, 4); + table_attach (table, l, 0, 4, 4); } { // alternates @@ -612,24 +614,24 @@ CloneTiler::CloneTiler () : // TRANSLATORS: "Alternate" is a verb here gtk_label_set_markup (GTK_LABEL(l), _("Alternate:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 5, 1); + table_attach (table, l, 1, 5, 1); } { - GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of opacity change for each row"), "opacity_alternatej"); - clonetiler_table_attach (table, l, 0, 5, 2); + GtkWidget *l = checkbox (_("Alternate the sign of opacity change for each row"), "opacity_alternatej"); + table_attach (table, l, 0, 5, 2); } { - GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of opacity change for each column"), "opacity_alternatei"); - clonetiler_table_attach (table, l, 0, 5, 3); + GtkWidget *l = checkbox (_("Alternate the sign of opacity change for each column"), "opacity_alternatei"); + table_attach (table, l, 0, 5, 3); } } // Color { - GtkWidget *vb = clonetiler_new_tab (nb, _("Co_lor")); + GtkWidget *vb = new_tab (nb, _("Co_lor")); { auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); @@ -648,7 +650,7 @@ CloneTiler::CloneTiler () : } - GtkWidget *table = clonetiler_table_x_y_rand (3); + GtkWidget *table = table_x_y_rand (3); gtk_box_pack_start (GTK_BOX (vb), table, FALSE, FALSE, 0); // Hue @@ -656,25 +658,25 @@ CloneTiler::CloneTiler () : GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("H:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 2, 1); + table_attach (table, l, 1, 2, 1); } { - GtkWidget *l = clonetiler_spinbox (_("Change the tile hue by this percentage for each row"), "hue_per_j", + GtkWidget *l = spinbox (_("Change the tile hue by this percentage for each row"), "hue_per_j", -100, 100, "%"); - clonetiler_table_attach (table, l, 0, 2, 2); + table_attach (table, l, 0, 2, 2); } { - GtkWidget *l = clonetiler_spinbox (_("Change the tile hue by this percentage for each column"), "hue_per_i", + GtkWidget *l = spinbox (_("Change the tile hue by this percentage for each column"), "hue_per_i", -100, 100, "%"); - clonetiler_table_attach (table, l, 0, 2, 3); + table_attach (table, l, 0, 2, 3); } { - GtkWidget *l = clonetiler_spinbox (_("Randomize the tile hue by this percentage"), "hue_rand", + GtkWidget *l = spinbox (_("Randomize the tile hue by this percentage"), "hue_rand", 0, 100, "%"); - clonetiler_table_attach (table, l, 0, 2, 4); + table_attach (table, l, 0, 2, 4); } @@ -683,25 +685,25 @@ CloneTiler::CloneTiler () : GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("S:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 3, 1); + table_attach (table, l, 1, 3, 1); } { - GtkWidget *l = clonetiler_spinbox (_("Change the color saturation by this percentage for each row"), "saturation_per_j", + GtkWidget *l = spinbox (_("Change the color saturation by this percentage for each row"), "saturation_per_j", -100, 100, "%"); - clonetiler_table_attach (table, l, 0, 3, 2); + table_attach (table, l, 0, 3, 2); } { - GtkWidget *l = clonetiler_spinbox (_("Change the color saturation by this percentage for each column"), "saturation_per_i", + GtkWidget *l = spinbox (_("Change the color saturation by this percentage for each column"), "saturation_per_i", -100, 100, "%"); - clonetiler_table_attach (table, l, 0, 3, 3); + table_attach (table, l, 0, 3, 3); } { - GtkWidget *l = clonetiler_spinbox (_("Randomize the color saturation by this percentage"), "saturation_rand", + GtkWidget *l = spinbox (_("Randomize the color saturation by this percentage"), "saturation_rand", 0, 100, "%"); - clonetiler_table_attach (table, l, 0, 3, 4); + table_attach (table, l, 0, 3, 4); } // Lightness @@ -709,25 +711,25 @@ CloneTiler::CloneTiler () : GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("L:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 4, 1); + table_attach (table, l, 1, 4, 1); } { - GtkWidget *l = clonetiler_spinbox (_("Change the color lightness by this percentage for each row"), "lightness_per_j", + GtkWidget *l = spinbox (_("Change the color lightness by this percentage for each row"), "lightness_per_j", -100, 100, "%"); - clonetiler_table_attach (table, l, 0, 4, 2); + table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = clonetiler_spinbox (_("Change the color lightness by this percentage for each column"), "lightness_per_i", + GtkWidget *l = spinbox (_("Change the color lightness by this percentage for each column"), "lightness_per_i", -100, 100, "%"); - clonetiler_table_attach (table, l, 0, 4, 3); + table_attach (table, l, 0, 4, 3); } { - GtkWidget *l = clonetiler_spinbox (_("Randomize the color lightness by this percentage"), "lightness_rand", + GtkWidget *l = spinbox (_("Randomize the color lightness by this percentage"), "lightness_rand", 0, 100, "%"); - clonetiler_table_attach (table, l, 0, 4, 4); + table_attach (table, l, 0, 4, 4); } @@ -735,38 +737,36 @@ CloneTiler::CloneTiler () : GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("Alternate:")); gtk_size_group_add_widget(table_row_labels, l); - clonetiler_table_attach (table, l, 1, 5, 1); + table_attach (table, l, 1, 5, 1); } { - GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of color changes for each row"), "color_alternatej"); - clonetiler_table_attach (table, l, 0, 5, 2); + GtkWidget *l = checkbox (_("Alternate the sign of color changes for each row"), "color_alternatej"); + table_attach (table, l, 0, 5, 2); } { - GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of color changes for each column"), "color_alternatei"); - clonetiler_table_attach (table, l, 0, 5, 3); + GtkWidget *l = checkbox (_("Alternate the sign of color changes for each column"), "color_alternatei"); + table_attach (table, l, 0, 5, 3); } } // Trace { - GtkWidget *vb = clonetiler_new_tab (nb, _("_Trace")); + GtkWidget *vb = new_tab (nb, _("_Trace")); { auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0); - b = gtk_check_button_new_with_label (_("Trace the drawing under the clones/sprayed items")); - g_object_set_data (G_OBJECT(b), "uncheckable", GINT_TO_POINTER(TRUE)); + _b = Gtk::manage(new Gtk::CheckButton(_("Trace the drawing under the clones/sprayed items"))); + _b->set_data("uncheckable", GINT_TO_POINTER(TRUE)); bool old = prefs->getBool(prefs_path + "dotrace"); - gtk_toggle_button_set_active ((GtkToggleButton *) b, old); - gtk_widget_set_tooltip_text (b, _("For each clone/sprayed item, pick a value from the drawing in its location and apply it")); - gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); - - g_signal_connect(G_OBJECT(b), "toggled", - G_CALLBACK(clonetiler_do_pick_toggled), (gpointer)this); + _b->set_active(old); + _b->set_tooltip_text(_("For each clone/sprayed item, pick a value from the drawing in its location and apply it")); + gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(_b->gobj()), FALSE, FALSE, 0); + _b->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::do_pick_toggled),_b)); } { @@ -789,65 +789,65 @@ CloneTiler::CloneTiler () : { radio = gtk_radio_button_new_with_label (NULL, _("Color")); gtk_widget_set_tooltip_text (radio, _("Pick the visible color and opacity")); - clonetiler_table_attach (table, radio, 0.0, 1, 1); + table_attach (table, radio, 0.0, 1, 1); g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_COLOR)); + G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_COLOR)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_COLOR); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("Opacity")); gtk_widget_set_tooltip_text (radio, _("Pick the total accumulated opacity")); - clonetiler_table_attach (table, radio, 0.0, 2, 1); + table_attach (table, radio, 0.0, 2, 1); g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_OPACITY)); + G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_OPACITY)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_OPACITY); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("R")); gtk_widget_set_tooltip_text (radio, _("Pick the Red component of the color")); - clonetiler_table_attach (table, radio, 0.0, 1, 2); + table_attach (table, radio, 0.0, 1, 2); g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_R)); + G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_R)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_R); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("G")); gtk_widget_set_tooltip_text (radio, _("Pick the Green component of the color")); - clonetiler_table_attach (table, radio, 0.0, 2, 2); + table_attach (table, radio, 0.0, 2, 2); g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_G)); + G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_G)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_G); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("B")); gtk_widget_set_tooltip_text (radio, _("Pick the Blue component of the color")); - clonetiler_table_attach (table, radio, 0.0, 3, 2); + table_attach (table, radio, 0.0, 3, 2); g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_B)); + G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_B)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_B); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color hue", "H")); gtk_widget_set_tooltip_text (radio, _("Pick the hue of the color")); - clonetiler_table_attach (table, radio, 0.0, 1, 3); + table_attach (table, radio, 0.0, 1, 3); g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_H)); + G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_H)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_H); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color saturation", "S")); gtk_widget_set_tooltip_text (radio, _("Pick the saturation of the color")); - clonetiler_table_attach (table, radio, 0.0, 2, 3); + table_attach (table, radio, 0.0, 2, 3); g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_S)); + G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_S)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_S); } { radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color lightness", "L")); gtk_widget_set_tooltip_text (radio, _("Pick the lightness of the color")); - clonetiler_table_attach (table, radio, 0.0, 3, 3); + table_attach (table, radio, 0.0, 3, 3); g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_L)); + G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_L)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_L); } @@ -866,33 +866,33 @@ CloneTiler::CloneTiler () : { GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("Gamma-correct:")); - clonetiler_table_attach (table, l, 1.0, 1, 1); + table_attach (table, l, 1.0, 1, 1); } { - GtkWidget *l = clonetiler_spinbox (_("Shift the mid-range of the picked value upwards (>0) or downwards (<0)"), "gamma_picked", + GtkWidget *l = spinbox (_("Shift the mid-range of the picked value upwards (>0) or downwards (<0)"), "gamma_picked", -10, 10, ""); - clonetiler_table_attach (table, l, 0.0, 1, 2); + table_attach (table, l, 0.0, 1, 2); } { GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("Randomize:")); - clonetiler_table_attach (table, l, 1.0, 1, 3); + table_attach (table, l, 1.0, 1, 3); } { - GtkWidget *l = clonetiler_spinbox (_("Randomize the picked value by this percentage"), "rand_picked", + GtkWidget *l = spinbox (_("Randomize the picked value by this percentage"), "rand_picked", 0, 100, "%"); - clonetiler_table_attach (table, l, 0.0, 1, 4); + table_attach (table, l, 0.0, 1, 4); } { GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("Invert:")); - clonetiler_table_attach (table, l, 1.0, 2, 1); + table_attach (table, l, 1.0, 2, 1); } { - GtkWidget *l = clonetiler_checkbox (_("Invert the picked value"), "invert_picked"); - clonetiler_table_attach (table, l, 0.0, 2, 2); + GtkWidget *l = checkbox (_("Invert the picked value"), "invert_picked"); + table_attach (table, l, 0.0, 2, 2); } } @@ -910,9 +910,9 @@ CloneTiler::CloneTiler () : bool old = prefs->getBool(prefs_path + "pick_to_presence", true); gtk_toggle_button_set_active ((GtkToggleButton *) b, old); gtk_widget_set_tooltip_text (b, _("Each clone is created with the probability determined by the picked value in that point")); - clonetiler_table_attach (table, b, 0.0, 1, 1); + table_attach (table, b, 0.0, 1, 1); g_signal_connect(G_OBJECT(b), "toggled", - G_CALLBACK(clonetiler_pick_to), (gpointer) "pick_to_presence"); + G_CALLBACK(pick_to), (gpointer) "pick_to_presence"); } { @@ -920,9 +920,9 @@ CloneTiler::CloneTiler () : bool old = prefs->getBool(prefs_path + "pick_to_size"); gtk_toggle_button_set_active ((GtkToggleButton *) b, old); gtk_widget_set_tooltip_text (b, _("Each clone's size is determined by the picked value in that point")); - clonetiler_table_attach (table, b, 0.0, 2, 1); + table_attach (table, b, 0.0, 2, 1); g_signal_connect(G_OBJECT(b), "toggled", - G_CALLBACK(clonetiler_pick_to), (gpointer) "pick_to_size"); + G_CALLBACK(pick_to), (gpointer) "pick_to_size"); } { @@ -930,9 +930,9 @@ CloneTiler::CloneTiler () : bool old = prefs->getBool(prefs_path + "pick_to_color", 0); gtk_toggle_button_set_active ((GtkToggleButton *) b, old); gtk_widget_set_tooltip_text (b, _("Each clone is painted by the picked color (the original must have unset fill or stroke)")); - clonetiler_table_attach (table, b, 0.0, 1, 2); + table_attach (table, b, 0.0, 1, 2); g_signal_connect(G_OBJECT(b), "toggled", - G_CALLBACK(clonetiler_pick_to), (gpointer) "pick_to_color"); + G_CALLBACK(pick_to), (gpointer) "pick_to_color"); } { @@ -940,9 +940,9 @@ CloneTiler::CloneTiler () : bool old = prefs->getBool(prefs_path + "pick_to_opacity", 0); gtk_toggle_button_set_active ((GtkToggleButton *) b, old); gtk_widget_set_tooltip_text (b, _("Each clone's opacity is determined by the picked value in that point")); - clonetiler_table_attach (table, b, 0.0, 2, 2); + table_attach (table, b, 0.0, 2, 2); g_signal_connect(G_OBJECT(b), "toggled", - G_CALLBACK(clonetiler_pick_to), (gpointer) "pick_to_opacity"); + G_CALLBACK(pick_to), (gpointer) "pick_to_opacity"); } } gtk_widget_set_sensitive (vvb, prefs->getBool(prefs_path + "dotrace")); @@ -983,7 +983,7 @@ CloneTiler::CloneTiler () : // TODO: C++ification g_signal_connect(G_OBJECT(a->gobj()), "value_changed", - G_CALLBACK(clonetiler_xy_changed), (gpointer) "jmax"); + G_CALLBACK(xy_changed), (gpointer) "jmax"); } { @@ -1005,10 +1005,10 @@ CloneTiler::CloneTiler () : // TODO: C++ification g_signal_connect(G_OBJECT(a->gobj()), "value_changed", - G_CALLBACK(clonetiler_xy_changed), (gpointer) "imax"); + G_CALLBACK(xy_changed), (gpointer) "imax"); } - clonetiler_table_attach (table, hb, 0.0, 1, 2); + table_attach (table, hb, 0.0, 1, 2); } { @@ -1020,7 +1020,7 @@ CloneTiler::CloneTiler () : unit_menu = new Inkscape::UI::Widget::UnitMenu(); unit_menu->setUnitType(Inkscape::Util::UNIT_TYPE_LINEAR); unit_menu->setUnit(SP_ACTIVE_DESKTOP->getNamedView()->display_units->abbr); - unitChangedConn = unit_menu->signal_changed().connect(sigc::mem_fun(*this, &CloneTiler::clonetiler_unit_changed)); + unitChangedConn = unit_menu->signal_changed().connect(sigc::mem_fun(*this, &CloneTiler::unit_changed)); { // Width spinbutton @@ -1038,7 +1038,7 @@ CloneTiler::CloneTiler () : gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(e->gobj()), TRUE, TRUE, 0); // TODO: C++ification g_signal_connect(G_OBJECT(fill_width->gobj()), "value_changed", - G_CALLBACK(clonetiler_fill_width_changed), unit_menu); + G_CALLBACK(fill_width_changed), unit_menu); } { GtkWidget *l = gtk_label_new (""); @@ -1063,11 +1063,11 @@ CloneTiler::CloneTiler () : gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(e->gobj()), TRUE, TRUE, 0); // TODO: C++ification g_signal_connect(G_OBJECT(fill_height->gobj()), "value_changed", - G_CALLBACK(clonetiler_fill_height_changed), unit_menu); + G_CALLBACK(fill_height_changed), unit_menu); } gtk_box_pack_start (GTK_BOX (hb), (GtkWidget*) unit_menu->gobj(), TRUE, TRUE, 0); - clonetiler_table_attach (table, hb, 0.0, 2, 2); + table_attach (table, hb, 0.0, 2, 2); } @@ -1076,8 +1076,8 @@ CloneTiler::CloneTiler () : { radio = gtk_radio_button_new_with_label (NULL, _("Rows, columns: ")); gtk_widget_set_tooltip_text (radio, _("Create the specified number of rows and columns")); - clonetiler_table_attach (table, radio, 0.0, 1, 1); - g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (clonetiler_switch_to_create), (gpointer) this); + table_attach (table, radio, 0.0, 1, 1); + g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (switch_to_create), (gpointer) this); } if (!prefs->getBool(prefs_path + "fillrect")) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); @@ -1086,8 +1086,8 @@ CloneTiler::CloneTiler () : { radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("Width, height: ")); gtk_widget_set_tooltip_text (radio, _("Fill the specified width and height with the tiling")); - clonetiler_table_attach (table, radio, 0.0, 2, 1); - g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (clonetiler_switch_to_fill), (gpointer) this); + table_attach (table, radio, 0.0, 2, 1); + g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (switch_to_fill), (gpointer) this); } if (prefs->getBool(prefs_path + "fillrect")) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); @@ -1109,7 +1109,7 @@ CloneTiler::CloneTiler () : gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(b), "toggled", - G_CALLBACK(clonetiler_keep_bbox_toggled), NULL); + G_CALLBACK(keep_bbox_toggled), NULL); } // Statusbar @@ -1151,7 +1151,7 @@ CloneTiler::CloneTiler () : // So unclumping is the process of spreading a number of objects out more evenly. GtkWidget *b = gtk_button_new_with_mnemonic (_(" _Unclump ")); gtk_widget_set_tooltip_text (b, _("Spread out clones to reduce clumping; can be applied repeatedly")); - g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (clonetiler_unclump), NULL); + g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (unclump), NULL); gtk_box_pack_end (GTK_BOX (sb), b, FALSE, FALSE, 0); } @@ -1175,7 +1175,7 @@ CloneTiler::CloneTiler () : GtkWidget *b = gtk_button_new_with_mnemonic (_(" R_eset ")); // TRANSLATORS: "change" is a noun here gtk_widget_set_tooltip_text (b, _("Reset all shifts, scales, rotates, opacity and color changes in the dialog to zero")); - g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (clonetiler_reset), this); + g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (reset), this); gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); } } @@ -1244,7 +1244,7 @@ void CloneTiler::change_selection(Inkscape::Selection *selection) return; } - guint n = clonetiler_number_of_clones(selection->singleItem()); + guint n = number_of_clones(selection->singleItem()); if (n > 0) { gtk_widget_set_sensitive (_buttons_on_tiles, TRUE); gchar *sta = g_strdup_printf (_("Object has %d tiled clones."), n); @@ -1261,7 +1261,7 @@ void CloneTiler::external_change() change_selection(SP_ACTIVE_DESKTOP->getSelection()); } -Geom::Affine CloneTiler::clonetiler_get_transform( +Geom::Affine CloneTiler::get_transform( // symmetry group int type, @@ -1863,7 +1863,7 @@ Geom::Affine CloneTiler::clonetiler_get_transform( return Geom::identity(); } -bool CloneTiler::clonetiler_is_a_clone_of(SPObject *tile, SPObject *obj) +bool CloneTiler::is_a_clone_of(SPObject *tile, SPObject *obj) { bool result = false; char *id_href = NULL; @@ -1890,21 +1890,21 @@ bool CloneTiler::clonetiler_is_a_clone_of(SPObject *tile, SPObject *obj) return result; } -void CloneTiler::clonetiler_trace_hide_tiled_clones_recursively(SPObject *from) +void CloneTiler::trace_hide_tiled_clones_recursively(SPObject *from) { if (!trace_drawing) return; for (auto& o: from->children) { SPItem *item = dynamic_cast(&o); - if (item && clonetiler_is_a_clone_of(&o, NULL)) { + if (item && is_a_clone_of(&o, NULL)) { item->invoke_hide(trace_visionkey); // FIXME: hide each tiled clone's original too! } - clonetiler_trace_hide_tiled_clones_recursively (&o); + trace_hide_tiled_clones_recursively (&o); } } -void CloneTiler::clonetiler_trace_setup(SPDocument *doc, gdouble zoom, SPItem *original) +void CloneTiler::trace_setup(SPDocument *doc, gdouble zoom, SPItem *original) { trace_drawing = new Inkscape::Drawing(); /* Create ArenaItem and set transform */ @@ -1914,7 +1914,7 @@ void CloneTiler::clonetiler_trace_setup(SPDocument *doc, gdouble zoom, SPItem *o // hide the (current) original and any tiled clones, we only want to pick the background original->invoke_hide(trace_visionkey); - clonetiler_trace_hide_tiled_clones_recursively(trace_doc->getRoot()); + trace_hide_tiled_clones_recursively(trace_doc->getRoot()); trace_doc->getRoot()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); trace_doc->ensureUpToDate(); @@ -1922,7 +1922,7 @@ void CloneTiler::clonetiler_trace_setup(SPDocument *doc, gdouble zoom, SPItem *o trace_zoom = zoom; } -guint32 CloneTiler::clonetiler_trace_pick(Geom::Rect box) +guint32 CloneTiler::trace_pick(Geom::Rect box) { if (!trace_drawing) { return 0; @@ -1946,7 +1946,7 @@ guint32 CloneTiler::clonetiler_trace_pick(Geom::Rect box) return SP_RGBA32_F_COMPOSE (R, G, B, A); } -void CloneTiler::clonetiler_trace_finish() +void CloneTiler::trace_finish() { if (trace_doc) { trace_doc->getRoot()->invoke_hide(trace_visionkey); @@ -1956,7 +1956,7 @@ void CloneTiler::clonetiler_trace_finish() } } -void CloneTiler::clonetiler_unclump(GtkWidget */*widget*/, void *) +void CloneTiler::unclump(GtkWidget */*widget*/, void *) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; if (desktop == NULL) { @@ -1977,27 +1977,27 @@ void CloneTiler::clonetiler_unclump(GtkWidget */*widget*/, void *) std::vector to_unclump; // not including the original for (auto& child: parent->children) { - if (clonetiler_is_a_clone_of (&child, obj)) { + if (is_a_clone_of (&child, obj)) { to_unclump.push_back((SPItem*)&child); } } desktop->getDocument()->ensureUpToDate(); reverse(to_unclump.begin(),to_unclump.end()); - unclump (to_unclump); + ::unclump (to_unclump); DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_CLONETILER, _("Unclump tiled clones")); } -guint CloneTiler::clonetiler_number_of_clones(SPObject *obj) +guint CloneTiler::number_of_clones(SPObject *obj) { SPObject *parent = obj->parent; guint n = 0; for (auto& child: parent->children) { - if (clonetiler_is_a_clone_of (&child, obj)) { + if (is_a_clone_of (&child, obj)) { n ++; } } @@ -2026,7 +2026,7 @@ void CloneTiler::remove(bool do_undo/* = true*/) // remove old tiling GSList *to_delete = NULL; for (auto& child: parent->children) { - if (clonetiler_is_a_clone_of (&child, obj)) { + if (is_a_clone_of (&child, obj)) { to_delete = g_slist_prepend (to_delete, &child); } } @@ -2205,7 +2205,7 @@ void CloneTiler::apply() SPItem *item = dynamic_cast(obj); if (dotrace) { - clonetiler_trace_setup (desktop->getDocument(), 1.0, item); + trace_setup (desktop->getDocument(), 1.0, item); } Geom::Point center; @@ -2277,7 +2277,7 @@ void CloneTiler::apply() // Note: We create a clone at 0,0 too, right over the original, in case our clones are colored // Get transform from symmetry, shift, scale, rotation - Geom::Affine orig_t = clonetiler_get_transform (type, i, j, center[Geom::X], center[Geom::Y], w, h, + Geom::Affine orig_t = get_transform (type, i, j, center[Geom::X], center[Geom::Y], w, h, shiftx_per_i, shifty_per_i, shiftx_per_j, shifty_per_j, shiftx_rand, shifty_rand, @@ -2351,7 +2351,7 @@ void CloneTiler::apply() if (dotrace) { Geom::Rect bbox_t = transform_rect (bbox_original, t*Geom::Scale(1.0/scale_units)); - guint32 rgba = clonetiler_trace_pick (bbox_t); + guint32 rgba = trace_pick (bbox_t); float r = SP_RGBA32_R_F(rgba); float g = SP_RGBA32_G_F(rgba); float b = SP_RGBA32_B_F(rgba); @@ -2511,7 +2511,7 @@ void CloneTiler::apply() } if (dotrace) { - clonetiler_trace_finish (); + trace_finish (); } change_selection(selection); @@ -2522,7 +2522,7 @@ void CloneTiler::apply() _("Create tiled clones")); } -GtkWidget * CloneTiler::clonetiler_new_tab(GtkWidget *nb, const gchar *label) +GtkWidget * CloneTiler::new_tab(GtkWidget *nb, const gchar *label) { GtkWidget *l = gtk_label_new_with_mnemonic (label); auto vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, VB_MARGIN); @@ -2532,14 +2532,14 @@ GtkWidget * CloneTiler::clonetiler_new_tab(GtkWidget *nb, const gchar *label) return vb; } -void CloneTiler::clonetiler_checkbox_toggled(GtkToggleButton *tb, gpointer *data) +void CloneTiler::checkbox_toggled(GtkToggleButton *tb, gpointer *data) { const gchar *attr = (const gchar *) data; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool(prefs_path + attr, gtk_toggle_button_get_active(tb)); } -GtkWidget * CloneTiler::clonetiler_checkbox(const char *tip, const char *attr) +GtkWidget * CloneTiler::checkbox(const char *tip, const char *attr) { auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); @@ -2553,21 +2553,21 @@ GtkWidget * CloneTiler::clonetiler_checkbox(const char *tip, const char *attr) gtk_box_pack_end (GTK_BOX (hb), b, FALSE, TRUE, 0); g_signal_connect ( G_OBJECT (b), "clicked", - G_CALLBACK (clonetiler_checkbox_toggled), (gpointer) attr); + G_CALLBACK (checkbox_toggled), (gpointer) attr); g_object_set_data (G_OBJECT(b), "uncheckable", GINT_TO_POINTER(TRUE)); return hb; } -void CloneTiler::clonetiler_value_changed(GtkAdjustment *adj, gpointer data) +void CloneTiler::value_changed(GtkAdjustment *adj, gpointer data) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); const gchar *pref = (const gchar *) data; prefs->setDouble(prefs_path + pref, gtk_adjustment_get_value (adj)); } -GtkWidget * CloneTiler::clonetiler_spinbox(const char *tip, const char *attr, double lower, double upper, const gchar *suffix, bool exponent/* = false*/) +GtkWidget * CloneTiler::spinbox(const char *tip, const char *attr, double lower, double upper, const gchar *suffix, bool exponent/* = false*/) { auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); @@ -2597,7 +2597,7 @@ GtkWidget * CloneTiler::clonetiler_spinbox(const char *tip, const char *attr, do a->set_value (value); // TODO: C++ification g_signal_connect(G_OBJECT(a->gobj()), "value_changed", - G_CALLBACK(clonetiler_value_changed), (gpointer) attr); + G_CALLBACK(value_changed), (gpointer) attr); if (exponent) { sb->set_data ("oneable", GINT_TO_POINTER(TRUE)); @@ -2617,27 +2617,27 @@ GtkWidget * CloneTiler::clonetiler_spinbox(const char *tip, const char *attr, do return hb; } -void CloneTiler::clonetiler_symgroup_changed(GtkComboBox *cb, gpointer /*data*/) +void CloneTiler::symgroup_changed(GtkComboBox *cb, gpointer /*data*/) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gint group_new = gtk_combo_box_get_active (cb); prefs->setInt(prefs_path + "symmetrygroup", group_new); } -void CloneTiler::clonetiler_xy_changed(GtkAdjustment *adj, gpointer data) +void CloneTiler::xy_changed(GtkAdjustment *adj, gpointer data) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); const gchar *pref = (const gchar *) data; prefs->setInt(prefs_path + pref, (int) floor(gtk_adjustment_get_value (adj) + 0.5)); } -void CloneTiler::clonetiler_keep_bbox_toggled(GtkToggleButton *tb, gpointer /*data*/) +void CloneTiler::keep_bbox_toggled(GtkToggleButton *tb, gpointer /*data*/) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setBool(prefs_path + "keepbbox", gtk_toggle_button_get_active(tb)); } -void CloneTiler::clonetiler_pick_to(GtkToggleButton *tb, gpointer data) +void CloneTiler::pick_to(GtkToggleButton *tb, gpointer data) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); const gchar *pref = (const gchar *) data; @@ -2645,7 +2645,7 @@ void CloneTiler::clonetiler_pick_to(GtkToggleButton *tb, gpointer data) } -void CloneTiler::clonetiler_reset_recursive(GtkWidget *w) +void CloneTiler::reset_recursive(GtkWidget *w) { if (w && G_IS_OBJECT(w)) { { @@ -2673,25 +2673,25 @@ void CloneTiler::clonetiler_reset_recursive(GtkWidget *w) if (GTK_IS_CONTAINER(w)) { GList *ch = gtk_container_get_children (GTK_CONTAINER(w)); for (GList *i = ch; i != NULL; i = i->next) { - clonetiler_reset_recursive (GTK_WIDGET(i->data)); + reset_recursive (GTK_WIDGET(i->data)); } g_list_free (ch); } } -void CloneTiler::clonetiler_reset(GtkWidget */*widget*/, GtkWidget *dlg) +void CloneTiler::reset(GtkWidget */*widget*/, GtkWidget *dlg) { - clonetiler_reset_recursive (dlg); + reset_recursive (dlg); } -void CloneTiler::clonetiler_table_attach(GtkWidget *table, GtkWidget *widget, float align, int row, int col) +void CloneTiler::table_attach(GtkWidget *table, GtkWidget *widget, float align, int row, int col) { gtk_widget_set_halign(widget, GTK_ALIGN_FILL); gtk_widget_set_valign(widget, GTK_ALIGN_START); gtk_grid_attach(GTK_GRID(table), widget, col, row, 1, 1); } -GtkWidget * CloneTiler::clonetiler_table_x_y_rand(int values) +GtkWidget * CloneTiler::table_x_y_rand(int values) { auto table = gtk_grid_new(); gtk_grid_set_row_spacing(GTK_GRID(table), 6); @@ -2710,7 +2710,7 @@ GtkWidget * CloneTiler::clonetiler_table_x_y_rand(int values) gtk_label_set_markup (GTK_LABEL(l), _("Per row:")); gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 2); - clonetiler_table_attach (table, hb, 0, 1, 2); + table_attach (table, hb, 0, 1, 2); } { @@ -2724,19 +2724,19 @@ GtkWidget * CloneTiler::clonetiler_table_x_y_rand(int values) gtk_label_set_markup (GTK_LABEL(l), _("Per column:")); gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 2); - clonetiler_table_attach (table, hb, 0, 1, 3); + table_attach (table, hb, 0, 1, 3); } { GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), _("Randomize:")); - clonetiler_table_attach (table, l, 0, 1, 4); + table_attach (table, l, 0, 1, 4); } return table; } -void CloneTiler::clonetiler_pick_switched(GtkToggleButton */*tb*/, gpointer data) +void CloneTiler::pick_switched(GtkToggleButton */*tb*/, gpointer data) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint v = GPOINTER_TO_INT (data); @@ -2744,7 +2744,7 @@ void CloneTiler::clonetiler_pick_switched(GtkToggleButton */*tb*/, gpointer data } -void CloneTiler::clonetiler_switch_to_create(GtkToggleButton * /*tb*/, GtkWidget *dlg) +void CloneTiler::switch_to_create(GtkToggleButton * /*tb*/, GtkWidget *dlg) { GtkWidget *rowscols = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "rowscols")); GtkWidget *widthheight = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "widthheight")); @@ -2761,7 +2761,7 @@ void CloneTiler::clonetiler_switch_to_create(GtkToggleButton * /*tb*/, GtkWidget } -void CloneTiler::clonetiler_switch_to_fill(GtkToggleButton * /*tb*/, GtkWidget *dlg) +void CloneTiler::switch_to_fill(GtkToggleButton * /*tb*/, GtkWidget *dlg) { GtkWidget *rowscols = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "rowscols")); GtkWidget *widthheight = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "widthheight")); @@ -2780,7 +2780,7 @@ void CloneTiler::clonetiler_switch_to_fill(GtkToggleButton * /*tb*/, GtkWidget * -void CloneTiler::clonetiler_fill_width_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u) +void CloneTiler::fill_width_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u) { gdouble const raw_dist = gtk_adjustment_get_value (adj); Inkscape::Util::Unit const *unit = u->getUnit(); @@ -2790,7 +2790,7 @@ void CloneTiler::clonetiler_fill_width_changed(GtkAdjustment *adj, Inkscape::UI: prefs->setDouble(prefs_path + "fillwidth", pixels); } -void CloneTiler::clonetiler_fill_height_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u) +void CloneTiler::fill_height_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u) { gdouble const raw_dist = gtk_adjustment_get_value (adj); Inkscape::Util::Unit const *unit = u->getUnit(); @@ -2800,7 +2800,7 @@ void CloneTiler::clonetiler_fill_height_changed(GtkAdjustment *adj, Inkscape::UI prefs->setDouble(prefs_path + "fillheight", pixels); } -void CloneTiler::clonetiler_unit_changed() +void CloneTiler::unit_changed() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gdouble width_pixels = prefs->getDouble(prefs_path + "fillwidth"); @@ -2814,22 +2814,23 @@ void CloneTiler::clonetiler_unit_changed() gtk_adjustment_set_value(fill_height->gobj(), height_value); } -void CloneTiler::clonetiler_do_pick_toggled(GtkToggleButton *tb, GtkWidget *dlg) +void CloneTiler::do_pick_toggled(Gtk::ToggleButton *tb) { - GtkWidget *vvb = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "dotrace")); + GtkWidget *vvb = GTK_WIDGET(_dotrace); - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool(prefs_path + "dotrace", gtk_toggle_button_get_active (tb)); + auto prefs = Inkscape::Preferences::get(); + auto active = tb->get_active(); + prefs->setBool(prefs_path + "dotrace", active); if (vvb) { - gtk_widget_set_sensitive (vvb, gtk_toggle_button_get_active (tb)); + gtk_widget_set_sensitive (vvb, active); } } void CloneTiler::show_page_trace() { gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),6); - gtk_toggle_button_set_active ((GtkToggleButton *) b, false); + _b->set_active(false); } diff --git a/src/ui/dialog/clonetiler.h b/src/ui/dialog/clonetiler.h index 9ad3fa878..e1c8bab35 100644 --- a/src/ui/dialog/clonetiler.h +++ b/src/ui/dialog/clonetiler.h @@ -16,6 +16,11 @@ #include "ui/widget/color-picker.h" #include "sp-root.h" +namespace Gtk { + class CheckButton; + class ToggleButton; +} + namespace Inkscape { namespace UI { @@ -34,45 +39,47 @@ public: void show_page_trace(); protected: - GtkWidget * clonetiler_new_tab(GtkWidget *nb, const gchar *label); - GtkWidget * clonetiler_table_x_y_rand(int values); - GtkWidget * clonetiler_spinbox(const char *tip, const char *attr, double lower, double upper, const gchar *suffix, bool exponent = false); - GtkWidget * clonetiler_checkbox(const char *tip, const char *attr); - void clonetiler_table_attach(GtkWidget *table, GtkWidget *widget, float align, int row, int col); + GtkWidget * new_tab(GtkWidget *nb, const gchar *label); + GtkWidget * table_x_y_rand(int values); + GtkWidget * spinbox(const char *tip, const char *attr, double lower, double upper, const gchar *suffix, bool exponent = false); + GtkWidget * checkbox(const char *tip, const char *attr); + void table_attach(GtkWidget *table, GtkWidget *widget, float align, int row, int col); - static void clonetiler_symgroup_changed(GtkComboBox *cb, gpointer /*data*/); + // TODO: Improve encapsulation by using SigC++ signal handling, and convert all of these into + // non-static member functions + static void symgroup_changed(GtkComboBox *cb, gpointer /*data*/); static void on_picker_color_changed(guint rgba); - static void clonetiler_trace_hide_tiled_clones_recursively(SPObject *from); - static void clonetiler_checkbox_toggled(GtkToggleButton *tb, gpointer *data); - static void clonetiler_pick_switched(GtkToggleButton */*tb*/, gpointer data); - static void clonetiler_do_pick_toggled(GtkToggleButton *tb, GtkWidget *dlg); - static void clonetiler_pick_to(GtkToggleButton *tb, gpointer data); - static void clonetiler_xy_changed(GtkAdjustment *adj, gpointer data); - static void clonetiler_fill_width_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u); - static void clonetiler_fill_height_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u); - void clonetiler_unit_changed(); - static void clonetiler_switch_to_create(GtkToggleButton */*tb*/, GtkWidget *dlg); - static void clonetiler_switch_to_fill(GtkToggleButton */*tb*/, GtkWidget *dlg); - static void clonetiler_keep_bbox_toggled(GtkToggleButton *tb, gpointer /*data*/); - static void clonetiler_unclump(GtkWidget */*widget*/, void *); - static void clonetiler_reset(GtkWidget */*widget*/, GtkWidget *dlg); - static guint clonetiler_number_of_clones(SPObject *obj); - static void clonetiler_trace_setup(SPDocument *doc, gdouble zoom, SPItem *original); - static guint32 clonetiler_trace_pick(Geom::Rect box); - static void clonetiler_trace_finish(); - static bool clonetiler_is_a_clone_of(SPObject *tile, SPObject *obj); + static void trace_hide_tiled_clones_recursively(SPObject *from); + static void checkbox_toggled(GtkToggleButton *tb, gpointer *data); + static void pick_switched(GtkToggleButton */*tb*/, gpointer data); + static void pick_to(GtkToggleButton *tb, gpointer data); + static void xy_changed(GtkAdjustment *adj, gpointer data); + static void fill_width_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u); + static void fill_height_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u); + static void switch_to_create(GtkToggleButton */*tb*/, GtkWidget *dlg); + static void switch_to_fill(GtkToggleButton */*tb*/, GtkWidget *dlg); + static void keep_bbox_toggled(GtkToggleButton *tb, gpointer /*data*/); + static void unclump(GtkWidget */*widget*/, void *); + static void reset(GtkWidget */*widget*/, GtkWidget *dlg); + static guint number_of_clones(SPObject *obj); + static void trace_setup(SPDocument *doc, gdouble zoom, SPItem *original); + static guint32 trace_pick(Geom::Rect box); + static void trace_finish(); + static bool is_a_clone_of(SPObject *tile, SPObject *obj); static Geom::Rect transform_rect(Geom::Rect const &r, Geom::Affine const &m); static double randomize01(double val, double rand); - static void clonetiler_value_changed(GtkAdjustment *adj, gpointer data); - static void clonetiler_reset_recursive(GtkWidget *w); + static void value_changed(GtkAdjustment *adj, gpointer data); + static void reset_recursive(GtkWidget *w); void apply(); void change_selection(Inkscape::Selection *selection); + void do_pick_toggled(Gtk::ToggleButton *tb); void external_change(); void remove(bool do_undo = true); void on_remove_button_clicked() {remove();} + void unit_changed(); - static Geom::Affine clonetiler_get_transform( // symmetry group + static Geom::Affine get_transform( // symmetry group int type, // row, column @@ -113,8 +120,8 @@ private: CloneTiler(CloneTiler const &d); CloneTiler& operator=(CloneTiler const &d); + Gtk::CheckButton *_b; GtkWidget *nb; - GtkWidget *b; SPDesktop *desktop; DesktopTracker deskTrack; Inkscape::UI::Widget::ColorPicker *color_picker; -- cgit v1.2.3 From 93a6d057d8b8dac9e4d81d84511dbae60a958788 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Fri, 12 Aug 2016 00:31:53 +0100 Subject: CloneTiler: Further C++ification (bzr r15052) --- src/ui/dialog/clonetiler.cpp | 177 +++++++++++++++++++------------------------ src/ui/dialog/clonetiler.h | 17 +++-- 2 files changed, 88 insertions(+), 106 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index 8bd5cd5f6..a9bec8227 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -25,6 +25,7 @@ #include #include +#include #include "desktop.h" @@ -766,7 +767,7 @@ CloneTiler::CloneTiler () : _b->set_active(old); _b->set_tooltip_text(_("For each clone/sprayed item, pick a value from the drawing in its location and apply it")); gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(_b->gobj()), FALSE, FALSE, 0); - _b->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::do_pick_toggled),_b)); + _b->signal_toggled().connect(sigc::mem_fun(*this, &CloneTiler::do_pick_toggled)); } { @@ -967,9 +968,7 @@ CloneTiler::CloneTiler () : gtk_box_pack_start (GTK_BOX (mainbox), table, FALSE, FALSE, 0); { - auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); - gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); - _rowscols = hb; + _rowscols = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, VB_MARGIN)); { auto a = Gtk::Adjustment::create(0.0, 1, 500, 1, 10, 0); @@ -979,7 +978,7 @@ CloneTiler::CloneTiler () : auto sb = new Inkscape::UI::Widget::SpinButton(a, 1.0, 0); sb->set_tooltip_text (_("How many rows in the tiling")); sb->set_width_chars (7); - gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(sb->gobj()), TRUE, TRUE, 0); + _rowscols->pack_start(*sb, true, true, 0); // TODO: C++ification g_signal_connect(G_OBJECT(a->gobj()), "value_changed", @@ -987,10 +986,10 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = gtk_label_new (""); - gtk_label_set_markup (GTK_LABEL(l), "×"); - gtk_widget_set_halign(l, GTK_ALIGN_END); - gtk_box_pack_start (GTK_BOX (hb), l, TRUE, TRUE, 0); + auto l = Gtk::manage(new Gtk::Label("")); + l->set_markup("×"); + l->set_halign(Gtk::ALIGN_END); + _rowscols->pack_start(*l, true, true, 0); } { @@ -1001,20 +1000,18 @@ CloneTiler::CloneTiler () : auto sb = new Inkscape::UI::Widget::SpinButton(a, 1.0, 0); sb->set_tooltip_text (_("How many columns in the tiling")); sb->set_width_chars (7); - gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(sb->gobj()), TRUE, TRUE, 0); + _rowscols->pack_start(*sb, true, true, 0); // TODO: C++ification g_signal_connect(G_OBJECT(a->gobj()), "value_changed", G_CALLBACK(xy_changed), (gpointer) "imax"); } - table_attach (table, hb, 0.0, 1, 2); + table_attach (table, GTK_WIDGET(_rowscols->gobj()), 0.0, 1, 2); } { - auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); - gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); - _widthheight = hb; + _widthheight = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, VB_MARGIN)); // unitmenu unit_menu = new Inkscape::UI::Widget::UnitMenu(); @@ -1035,16 +1032,14 @@ CloneTiler::CloneTiler () : e->set_tooltip_text (_("Width of the rectangle to be filled")); e->set_width_chars (7); e->set_digits (4); - gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(e->gobj()), TRUE, TRUE, 0); - // TODO: C++ification - g_signal_connect(G_OBJECT(fill_width->gobj()), "value_changed", - G_CALLBACK(fill_width_changed), unit_menu); + _widthheight->pack_start(*e, true, true, 0); + fill_width->signal_value_changed().connect(sigc::mem_fun(*this, &CloneTiler::fill_width_changed)); } { - GtkWidget *l = gtk_label_new (""); - gtk_label_set_markup (GTK_LABEL(l), "×"); - gtk_widget_set_halign(l, GTK_ALIGN_END); - gtk_box_pack_start (GTK_BOX (hb), l, TRUE, TRUE, 0); + auto l = Gtk::manage(new Gtk::Label("")); + l->set_markup("×"); + l->set_halign(Gtk::ALIGN_END); + _widthheight->pack_start(*l, true, true, 0); } { @@ -1060,56 +1055,53 @@ CloneTiler::CloneTiler () : e->set_tooltip_text (_("Height of the rectangle to be filled")); e->set_width_chars (7); e->set_digits (4); - gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(e->gobj()), TRUE, TRUE, 0); - // TODO: C++ification - g_signal_connect(G_OBJECT(fill_height->gobj()), "value_changed", - G_CALLBACK(fill_height_changed), unit_menu); + _widthheight->pack_start(*e, true, true, 0); + fill_height->signal_value_changed().connect(sigc::mem_fun(*this, &CloneTiler::fill_height_changed)); } - gtk_box_pack_start (GTK_BOX (hb), (GtkWidget*) unit_menu->gobj(), TRUE, TRUE, 0); - table_attach (table, hb, 0.0, 2, 2); + _widthheight->pack_start(*unit_menu, true, true, 0); + table_attach (table, GTK_WIDGET(_widthheight->gobj()), 0.0, 2, 2); } // Switch - GtkWidget* radio; + Gtk::RadioButtonGroup rb_group; { - radio = gtk_radio_button_new_with_label (NULL, _("Rows, columns: ")); - gtk_widget_set_tooltip_text (radio, _("Create the specified number of rows and columns")); - table_attach (table, radio, 0.0, 1, 1); - g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (switch_to_create), (gpointer) this); - } - if (!prefs->getBool(prefs_path + "fillrect")) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); - gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (radio)); + auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, _("Rows, columns: "))); + radio->set_tooltip_text(_("Create the specified number of rows and columns")); + table_attach (table, GTK_WIDGET(radio->gobj()), 0.0, 1, 1); + radio->signal_toggled().connect(sigc::mem_fun(*this, &CloneTiler::switch_to_create)); + + if (!prefs->getBool(prefs_path + "fillrect")) { + radio->set_active(true); + } } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("Width, height: ")); - gtk_widget_set_tooltip_text (radio, _("Fill the specified width and height with the tiling")); - table_attach (table, radio, 0.0, 2, 1); - g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (switch_to_fill), (gpointer) this); - } - if (prefs->getBool(prefs_path + "fillrect")) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); - gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (radio)); + auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, _("Width, height: "))); + radio->set_tooltip_text(_("Fill the specified width and height with the tiling")); + table_attach (table, GTK_WIDGET(radio->gobj()), 0.0, 2, 1); + radio->signal_toggled().connect(sigc::mem_fun(*this, &CloneTiler::switch_to_fill)); + + if (prefs->getBool(prefs_path + "fillrect")) { + radio->set_active(true); + } } } // Use saved pos { - auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); - gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); - gtk_box_pack_start (GTK_BOX (mainbox), hb, FALSE, FALSE, 0); - - GtkWidget *b = gtk_check_button_new_with_label (_("Use saved size and position of the tile")); - bool keepbbox = prefs->getBool(prefs_path + "keepbbox", true); - gtk_toggle_button_set_active ((GtkToggleButton *) b, keepbbox); - gtk_widget_set_tooltip_text (b, _("Pretend that the size and position of the tile are the same as the last time you tiled it (if any), instead of using the current size")); - gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); - - g_signal_connect(G_OBJECT(b), "toggled", - G_CALLBACK(keep_bbox_toggled), NULL); + auto hb = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, VB_MARGIN)); + gtk_box_pack_start (GTK_BOX (mainbox), GTK_WIDGET(hb->gobj()), FALSE, FALSE, 0); + + _cb_keep_bbox = Gtk::manage(new Gtk::CheckButton(_("Use saved size and position of the tile"))); + auto keepbbox = prefs->getBool(prefs_path + "keepbbox", true); + _cb_keep_bbox->set_active(keepbbox); + _cb_keep_bbox->set_tooltip_text(_("Pretend that the size and position of the tile are the same " + "as the last time you tiled it (if any), instead of using the " + "current size")); + hb->pack_start(*_cb_keep_bbox, false, false, 0); + _cb_keep_bbox->signal_toggled().connect(sigc::mem_fun(*this, &CloneTiler::keep_bbox_toggled)); } // Statusbar @@ -2631,10 +2623,10 @@ void CloneTiler::xy_changed(GtkAdjustment *adj, gpointer data) prefs->setInt(prefs_path + pref, (int) floor(gtk_adjustment_get_value (adj) + 0.5)); } -void CloneTiler::keep_bbox_toggled(GtkToggleButton *tb, gpointer /*data*/) +void CloneTiler::keep_bbox_toggled() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool(prefs_path + "keepbbox", gtk_toggle_button_get_active(tb)); + auto prefs = Inkscape::Preferences::get(); + prefs->setBool(prefs_path + "keepbbox", _cb_keep_bbox->get_active()); } void CloneTiler::pick_to(GtkToggleButton *tb, gpointer data) @@ -2744,59 +2736,50 @@ void CloneTiler::pick_switched(GtkToggleButton */*tb*/, gpointer data) } -void CloneTiler::switch_to_create(GtkToggleButton * /*tb*/, GtkWidget *dlg) +void CloneTiler::switch_to_create() { - GtkWidget *rowscols = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "rowscols")); - GtkWidget *widthheight = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "widthheight")); - - if (rowscols) { - gtk_widget_set_sensitive (rowscols, TRUE); + if (_rowscols) { + _rowscols->set_sensitive(true); } - if (widthheight) { - gtk_widget_set_sensitive (widthheight, FALSE); + if (_widthheight) { + _widthheight->set_sensitive(false); } - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + auto prefs = Inkscape::Preferences::get(); prefs->setBool(prefs_path + "fillrect", false); } -void CloneTiler::switch_to_fill(GtkToggleButton * /*tb*/, GtkWidget *dlg) +void CloneTiler::switch_to_fill() { - GtkWidget *rowscols = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "rowscols")); - GtkWidget *widthheight = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "widthheight")); - - if (rowscols) { - gtk_widget_set_sensitive (rowscols, FALSE); + if (_rowscols) { + _rowscols->set_sensitive(false); } - if (widthheight) { - gtk_widget_set_sensitive (widthheight, TRUE); + if (_widthheight) { + _widthheight->set_sensitive(true); } - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + auto prefs = Inkscape::Preferences::get(); prefs->setBool(prefs_path + "fillrect", true); } - - - -void CloneTiler::fill_width_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u) +void CloneTiler::fill_width_changed() { - gdouble const raw_dist = gtk_adjustment_get_value (adj); - Inkscape::Util::Unit const *unit = u->getUnit(); - gdouble const pixels = Inkscape::Util::Quantity::convert(raw_dist, unit, "px"); + auto const raw_dist = fill_width->get_value(); + auto const unit = unit_menu->getUnit(); + auto const pixels = Inkscape::Util::Quantity::convert(raw_dist, unit, "px"); - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + auto prefs = Inkscape::Preferences::get(); prefs->setDouble(prefs_path + "fillwidth", pixels); } -void CloneTiler::fill_height_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u) +void CloneTiler::fill_height_changed() { - gdouble const raw_dist = gtk_adjustment_get_value (adj); - Inkscape::Util::Unit const *unit = u->getUnit(); - gdouble const pixels = Inkscape::Util::Quantity::convert(raw_dist, unit, "px"); + auto const raw_dist = fill_height->get_value(); + auto const unit = unit_menu->getUnit(); + auto const pixels = Inkscape::Util::Quantity::convert(raw_dist, unit, "px"); - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + auto prefs = Inkscape::Preferences::get(); prefs->setDouble(prefs_path + "fillheight", pixels); } @@ -2814,16 +2797,14 @@ void CloneTiler::unit_changed() gtk_adjustment_set_value(fill_height->gobj(), height_value); } -void CloneTiler::do_pick_toggled(Gtk::ToggleButton *tb) +void CloneTiler::do_pick_toggled() { - GtkWidget *vvb = GTK_WIDGET(_dotrace); - - auto prefs = Inkscape::Preferences::get(); - auto active = tb->get_active(); + auto prefs = Inkscape::Preferences::get(); + auto active = _b->get_active(); prefs->setBool(prefs_path + "dotrace", active); - if (vvb) { - gtk_widget_set_sensitive (vvb, active); + if (_dotrace) { + gtk_widget_set_sensitive (_dotrace, active); } } diff --git a/src/ui/dialog/clonetiler.h b/src/ui/dialog/clonetiler.h index e1c8bab35..70a22d3d0 100644 --- a/src/ui/dialog/clonetiler.h +++ b/src/ui/dialog/clonetiler.h @@ -54,11 +54,9 @@ protected: static void pick_switched(GtkToggleButton */*tb*/, gpointer data); static void pick_to(GtkToggleButton *tb, gpointer data); static void xy_changed(GtkAdjustment *adj, gpointer data); - static void fill_width_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u); - static void fill_height_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u); - static void switch_to_create(GtkToggleButton */*tb*/, GtkWidget *dlg); - static void switch_to_fill(GtkToggleButton */*tb*/, GtkWidget *dlg); - static void keep_bbox_toggled(GtkToggleButton *tb, gpointer /*data*/); + void switch_to_create(); + void switch_to_fill(); + void keep_bbox_toggled(); static void unclump(GtkWidget */*widget*/, void *); static void reset(GtkWidget */*widget*/, GtkWidget *dlg); static guint number_of_clones(SPObject *obj); @@ -73,8 +71,10 @@ protected: void apply(); void change_selection(Inkscape::Selection *selection); - void do_pick_toggled(Gtk::ToggleButton *tb); + void do_pick_toggled(); void external_change(); + void fill_width_changed(); + void fill_height_changed(); void remove(bool do_undo = true); void on_remove_button_clicked() {remove();} void unit_changed(); @@ -121,6 +121,7 @@ private: CloneTiler& operator=(CloneTiler const &d); Gtk::CheckButton *_b; + Gtk::CheckButton *_cb_keep_bbox; GtkWidget *nb; SPDesktop *desktop; DesktopTracker deskTrack; @@ -153,8 +154,8 @@ private: GtkWidget *_buttons_on_tiles; GtkWidget *_dotrace; GtkWidget *_status; - GtkWidget *_rowscols; - GtkWidget *_widthheight; + Gtk::Box *_rowscols; + Gtk::Box *_widthheight; }; -- cgit v1.2.3 From ded71e7f2330ae5abbb0b09e12f89a8fefc2820a Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Fri, 12 Aug 2016 00:45:47 +0100 Subject: CloneTiler: Further C++ification (bzr r15053) --- src/ui/dialog/clonetiler.cpp | 18 +++++++++--------- src/ui/dialog/clonetiler.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index a9bec8227..c27d5d35a 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -1141,10 +1141,10 @@ CloneTiler::CloneTiler () : // diagrams on the left in the following screenshot: // http://www.inkscape.org/screenshots/gallery/inkscape-0.42-CVS-tiles-unclump.png // So unclumping is the process of spreading a number of objects out more evenly. - GtkWidget *b = gtk_button_new_with_mnemonic (_(" _Unclump ")); - gtk_widget_set_tooltip_text (b, _("Spread out clones to reduce clumping; can be applied repeatedly")); - g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (unclump), NULL); - gtk_box_pack_end (GTK_BOX (sb), b, FALSE, FALSE, 0); + auto b = Gtk::manage(new Gtk::Button(_(" _Unclump "), true)); + b->set_tooltip_text(_("Spread out clones to reduce clumping; can be applied repeatedly")); + b->signal_clicked().connect(sigc::mem_fun(*this, &CloneTiler::unclump)); + gtk_box_pack_end (GTK_BOX (sb), GTK_WIDGET(b->gobj()), FALSE, FALSE, 0); } { @@ -1948,14 +1948,14 @@ void CloneTiler::trace_finish() } } -void CloneTiler::unclump(GtkWidget */*widget*/, void *) +void CloneTiler::unclump() { - SPDesktop *desktop = SP_ACTIVE_DESKTOP; + auto desktop = SP_ACTIVE_DESKTOP; if (desktop == NULL) { return; } - Inkscape::Selection *selection = desktop->getSelection(); + auto selection = desktop->getSelection(); // check if something is selected if (selection->isEmpty() || boost::distance(selection->items()) > 1) { @@ -1963,8 +1963,8 @@ void CloneTiler::unclump(GtkWidget */*widget*/, void *) return; } - SPObject *obj = selection->singleItem(); - SPObject *parent = obj->parent; + auto obj = selection->singleItem(); + auto parent = obj->parent; std::vector to_unclump; // not including the original diff --git a/src/ui/dialog/clonetiler.h b/src/ui/dialog/clonetiler.h index 70a22d3d0..04f676800 100644 --- a/src/ui/dialog/clonetiler.h +++ b/src/ui/dialog/clonetiler.h @@ -57,7 +57,7 @@ protected: void switch_to_create(); void switch_to_fill(); void keep_bbox_toggled(); - static void unclump(GtkWidget */*widget*/, void *); + void unclump(); static void reset(GtkWidget */*widget*/, GtkWidget *dlg); static guint number_of_clones(SPObject *obj); static void trace_setup(SPDocument *doc, gdouble zoom, SPItem *original); -- cgit v1.2.3 From dffaf2ab2ab1cd1ca21c0ff9e9cc9f077faf17f1 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Fri, 12 Aug 2016 21:10:12 +0100 Subject: CloneTiler: Replace all remaining g_signal usage (bzr r15055) --- src/ui/dialog/clonetiler.cpp | 425 +++++++++++++++++++++---------------------- src/ui/dialog/clonetiler.h | 87 +++++---- 2 files changed, 251 insertions(+), 261 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index c27d5d35a..8e9d3dbbf 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -25,6 +25,8 @@ #include #include +#include +#include #include #include "desktop.h" @@ -66,7 +68,6 @@ static unsigned trace_visionkey; static gdouble trace_zoom; static SPDocument *trace_doc = NULL; - CloneTiler::CloneTiler () : UI::Widget::Panel ("", "/dialogs/clonetiler/", SP_VERB_DIALOG_CLONETILER), desktop(NULL), @@ -100,7 +101,7 @@ CloneTiler::CloneTiler () : */ struct SymGroups { gint group; - gchar const *label; + Glib::ustring label; } const sym_groups[] = { // TRANSLATORS: "translation" means "shift" / "displacement" here. {TILE_P1, _("P1: simple translation")}, @@ -126,33 +127,27 @@ CloneTiler::CloneTiler () : gint current = prefs->getInt(prefs_path + "symmetrygroup", 0); - // Create a list structure containing all the data to be displayed in - // the symmetry group combo box. - GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING); - GtkTreeIter iter; - - for (unsigned j = 0; j < G_N_ELEMENTS(sym_groups); ++j) { - SymGroups const &sg = sym_groups[j]; + // Add a new combo box widget with the list of symmetry groups to the vbox + auto combo = Gtk::manage(new Gtk::ComboBoxText()); + combo->set_tooltip_text(_("Select one of the 17 symmetry groups for the tiling")); - // Add the description of the symgroup to a new row - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, sg.label, -1); - } + // Hack to add markup support + auto cell_list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(combo->gobj())); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo->gobj()), + GTK_CELL_RENDERER(cell_list->data), + "markup", 0, NULL); - // Add a new combo box widget with the list of symmetry groups to the vbox - GtkWidget *combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); - gtk_widget_set_tooltip_text (combo, _("Select one of the 17 symmetry groups for the tiling")); - gtk_box_pack_start (GTK_BOX (vb), combo, FALSE, FALSE, SB_MARGIN); + for (unsigned j = 0; j < G_N_ELEMENTS(sym_groups); ++j) { + SymGroups const &sg = sym_groups[j]; - // Specify the rendering of data from the list in a combo box cell - GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE); - gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, "markup", 0, NULL); + // Add the description of the symgroup to a new row + combo->append(sg.label); + } - gtk_combo_box_set_active (GTK_COMBO_BOX (combo), current); + gtk_box_pack_start (GTK_BOX (vb), GTK_WIDGET(combo->gobj()), FALSE, FALSE, SB_MARGIN); - g_signal_connect(G_OBJECT(combo), "changed", - G_CALLBACK(symgroup_changed), NULL); + combo->set_active(current); + combo->signal_changed().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::symgroup_changed), combo)); } table_row_labels = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); @@ -175,7 +170,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox ( + auto l = spinbox ( // xgettext:no-c-format _("Horizontal shift per row (in % of tile width)"), "shiftx_per_j", -10000, 10000, "%"); @@ -183,7 +178,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox ( + auto l = spinbox ( // xgettext:no-c-format _("Horizontal shift per column (in % of tile width)"), "shiftx_per_i", -10000, 10000, "%"); @@ -191,7 +186,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox (_("Randomize the horizontal shift by this percentage"), "shiftx_rand", + auto l = spinbox (_("Randomize the horizontal shift by this percentage"), "shiftx_rand", 0, 1000, "%"); table_attach (table, l, 0, 2, 4); } @@ -207,7 +202,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox ( + auto l = spinbox ( // xgettext:no-c-format _("Vertical shift per row (in % of tile height)"), "shifty_per_j", -10000, 10000, "%"); @@ -215,7 +210,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox ( + auto l = spinbox ( // xgettext:no-c-format _("Vertical shift per column (in % of tile height)"), "shifty_per_i", -10000, 10000, "%"); @@ -223,7 +218,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox ( + auto l = spinbox ( _("Randomize the vertical shift by this percentage"), "shifty_rand", 0, 1000, "%"); table_attach (table, l, 0, 3, 4); @@ -238,14 +233,14 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox ( + auto l = spinbox ( _("Whether rows are spaced evenly (1), converge (<1) or diverge (>1)"), "shifty_exp", 0, 10, "", true); table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = spinbox ( + auto l = spinbox ( _("Whether columns are spaced evenly (1), converge (<1) or diverge (>1)"), "shiftx_exp", 0, 10, "", true); table_attach (table, l, 0, 4, 3); @@ -260,12 +255,12 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = checkbox (_("Alternate the sign of shifts for each row"), "shifty_alternate"); + auto l = checkbox (_("Alternate the sign of shifts for each row"), "shifty_alternate"); table_attach (table, l, 0, 5, 2); } { - GtkWidget *l = checkbox (_("Alternate the sign of shifts for each column"), "shiftx_alternate"); + auto l = checkbox (_("Alternate the sign of shifts for each column"), "shiftx_alternate"); table_attach (table, l, 0, 5, 3); } @@ -278,12 +273,12 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = checkbox (_("Cumulate the shifts for each row"), "shifty_cumulate"); + auto l = checkbox (_("Cumulate the shifts for each row"), "shifty_cumulate"); table_attach (table, l, 0, 6, 2); } { - GtkWidget *l = checkbox (_("Cumulate the shifts for each column"), "shiftx_cumulate"); + auto l = checkbox (_("Cumulate the shifts for each column"), "shiftx_cumulate"); table_attach (table, l, 0, 6, 3); } @@ -296,12 +291,12 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = checkbox (_("Exclude tile height in shift"), "shifty_excludeh"); + auto l = checkbox (_("Exclude tile height in shift"), "shifty_excludeh"); table_attach (table, l, 0, 7, 2); } { - GtkWidget *l = checkbox (_("Exclude tile width in shift"), "shiftx_excludew"); + auto l = checkbox (_("Exclude tile width in shift"), "shiftx_excludew"); table_attach (table, l, 0, 7, 3); } @@ -324,7 +319,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox ( + auto l = spinbox ( // xgettext:no-c-format _("Horizontal scale per row (in % of tile width)"), "scalex_per_j", -100, 1000, "%"); @@ -332,7 +327,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox ( + auto l = spinbox ( // xgettext:no-c-format _("Horizontal scale per column (in % of tile width)"), "scalex_per_i", -100, 1000, "%"); @@ -340,7 +335,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox (_("Randomize the horizontal scale by this percentage"), "scalex_rand", + auto l = spinbox (_("Randomize the horizontal scale by this percentage"), "scalex_rand", 0, 1000, "%"); table_attach (table, l, 0, 2, 4); } @@ -354,7 +349,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox ( + auto l = spinbox ( // xgettext:no-c-format _("Vertical scale per row (in % of tile height)"), "scaley_per_j", -100, 1000, "%"); @@ -362,7 +357,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox ( + auto l = spinbox ( // xgettext:no-c-format _("Vertical scale per column (in % of tile height)"), "scaley_per_i", -100, 1000, "%"); @@ -370,7 +365,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox (_("Randomize the vertical scale by this percentage"), "scaley_rand", + auto l = spinbox (_("Randomize the vertical scale by this percentage"), "scaley_rand", 0, 1000, "%"); table_attach (table, l, 0, 3, 4); } @@ -384,13 +379,13 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox (_("Whether row scaling is uniform (1), converge (<1) or diverge (>1)"), "scaley_exp", + auto l = spinbox (_("Whether row scaling is uniform (1), converge (<1) or diverge (>1)"), "scaley_exp", 0, 10, "", true); table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = spinbox (_("Whether column scaling is uniform (1), converge (<1) or diverge (>1)"), "scalex_exp", + auto l = spinbox (_("Whether column scaling is uniform (1), converge (<1) or diverge (>1)"), "scalex_exp", 0, 10, "", true); table_attach (table, l, 0, 4, 3); } @@ -404,13 +399,13 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scaley_log", + auto l = spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scaley_log", 0, 10, "", false); table_attach (table, l, 0, 5, 2); } { - GtkWidget *l = spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scalex_log", + auto l = spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scalex_log", 0, 10, "", false); table_attach (table, l, 0, 5, 3); } @@ -424,12 +419,12 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = checkbox (_("Alternate the sign of scales for each row"), "scaley_alternate"); + auto l = checkbox (_("Alternate the sign of scales for each row"), "scaley_alternate"); table_attach (table, l, 0, 6, 2); } { - GtkWidget *l = checkbox (_("Alternate the sign of scales for each column"), "scalex_alternate"); + auto l = checkbox (_("Alternate the sign of scales for each column"), "scalex_alternate"); table_attach (table, l, 0, 6, 3); } @@ -442,12 +437,12 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = checkbox (_("Cumulate the scales for each row"), "scaley_cumulate"); + auto l = checkbox (_("Cumulate the scales for each row"), "scaley_cumulate"); table_attach (table, l, 0, 7, 2); } { - GtkWidget *l = checkbox (_("Cumulate the scales for each column"), "scalex_cumulate"); + auto l = checkbox (_("Cumulate the scales for each column"), "scalex_cumulate"); table_attach (table, l, 0, 7, 3); } @@ -470,7 +465,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox ( + auto l = spinbox ( // xgettext:no-c-format _("Rotate tiles by this angle for each row"), "rotate_per_j", -180, 180, "°"); @@ -478,7 +473,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox ( + auto l = spinbox ( // xgettext:no-c-format _("Rotate tiles by this angle for each column"), "rotate_per_i", -180, 180, "°"); @@ -486,7 +481,7 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox (_("Randomize the rotation angle by this percentage"), "rotate_rand", + auto l = spinbox (_("Randomize the rotation angle by this percentage"), "rotate_rand", 0, 100, "%"); table_attach (table, l, 0, 2, 4); } @@ -500,12 +495,12 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = checkbox (_("Alternate the rotation direction for each row"), "rotate_alternatej"); + auto l = checkbox (_("Alternate the rotation direction for each row"), "rotate_alternatej"); table_attach (table, l, 0, 3, 2); } { - GtkWidget *l = checkbox (_("Alternate the rotation direction for each column"), "rotate_alternatei"); + auto l = checkbox (_("Alternate the rotation direction for each column"), "rotate_alternatei"); table_attach (table, l, 0, 3, 3); } @@ -518,12 +513,12 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = checkbox (_("Cumulate the rotation for each row"), "rotate_cumulatej"); + auto l = checkbox (_("Cumulate the rotation for each row"), "rotate_cumulatej"); table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = checkbox (_("Cumulate the rotation for each column"), "rotate_cumulatei"); + auto l = checkbox (_("Cumulate the rotation for each column"), "rotate_cumulatei"); table_attach (table, l, 0, 4, 3); } @@ -547,19 +542,19 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox (_("Blur tiles by this percentage for each row"), "blur_per_j", + auto l = spinbox (_("Blur tiles by this percentage for each row"), "blur_per_j", 0, 100, "%"); table_attach (table, l, 0, 2, 2); } { - GtkWidget *l = spinbox (_("Blur tiles by this percentage for each column"), "blur_per_i", + auto l = spinbox (_("Blur tiles by this percentage for each column"), "blur_per_i", 0, 100, "%"); table_attach (table, l, 0, 2, 3); } { - GtkWidget *l = spinbox (_("Randomize the tile blur by this percentage"), "blur_rand", + auto l = spinbox (_("Randomize the tile blur by this percentage"), "blur_rand", 0, 100, "%"); table_attach (table, l, 0, 2, 4); } @@ -573,12 +568,12 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = checkbox (_("Alternate the sign of blur change for each row"), "blur_alternatej"); + auto l = checkbox (_("Alternate the sign of blur change for each row"), "blur_alternatej"); table_attach (table, l, 0, 3, 2); } { - GtkWidget *l = checkbox (_("Alternate the sign of blur change for each column"), "blur_alternatei"); + auto l = checkbox (_("Alternate the sign of blur change for each column"), "blur_alternatei"); table_attach (table, l, 0, 3, 3); } @@ -593,19 +588,19 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox (_("Decrease tile opacity by this percentage for each row"), "opacity_per_j", + auto l = spinbox (_("Decrease tile opacity by this percentage for each row"), "opacity_per_j", 0, 100, "%"); table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = spinbox (_("Decrease tile opacity by this percentage for each column"), "opacity_per_i", + auto l = spinbox (_("Decrease tile opacity by this percentage for each column"), "opacity_per_i", 0, 100, "%"); table_attach (table, l, 0, 4, 3); } { - GtkWidget *l = spinbox (_("Randomize the tile opacity by this percentage"), "opacity_rand", + auto l = spinbox (_("Randomize the tile opacity by this percentage"), "opacity_rand", 0, 100, "%"); table_attach (table, l, 0, 4, 4); } @@ -619,12 +614,12 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = checkbox (_("Alternate the sign of opacity change for each row"), "opacity_alternatej"); + auto l = checkbox (_("Alternate the sign of opacity change for each row"), "opacity_alternatej"); table_attach (table, l, 0, 5, 2); } { - GtkWidget *l = checkbox (_("Alternate the sign of opacity change for each column"), "opacity_alternatei"); + auto l = checkbox (_("Alternate the sign of opacity change for each column"), "opacity_alternatei"); table_attach (table, l, 0, 5, 3); } } @@ -643,7 +638,7 @@ CloneTiler::CloneTiler () : guint32 rgba = 0x000000ff | sp_svg_read_color (prefs->getString(prefs_path + "initial_color").data(), 0x000000ff); color_picker = new Inkscape::UI::Widget::ColorPicker (*new Glib::ustring(_("Initial color of tiled clones")), *new Glib::ustring(_("Initial color for clones (works only if the original has unset fill or stroke or on spray tool in copy mode)")), rgba, false); - color_changed_connection = color_picker->connectChanged (sigc::ptr_fun(on_picker_color_changed)); + color_changed_connection = color_picker->connectChanged(sigc::mem_fun(*this, &CloneTiler::on_picker_color_changed)); gtk_box_pack_start (GTK_BOX (hb), reinterpret_cast(color_picker->gobj()), FALSE, FALSE, 0); @@ -663,19 +658,19 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox (_("Change the tile hue by this percentage for each row"), "hue_per_j", + auto l = spinbox (_("Change the tile hue by this percentage for each row"), "hue_per_j", -100, 100, "%"); table_attach (table, l, 0, 2, 2); } { - GtkWidget *l = spinbox (_("Change the tile hue by this percentage for each column"), "hue_per_i", + auto l = spinbox (_("Change the tile hue by this percentage for each column"), "hue_per_i", -100, 100, "%"); table_attach (table, l, 0, 2, 3); } { - GtkWidget *l = spinbox (_("Randomize the tile hue by this percentage"), "hue_rand", + auto l = spinbox (_("Randomize the tile hue by this percentage"), "hue_rand", 0, 100, "%"); table_attach (table, l, 0, 2, 4); } @@ -690,19 +685,19 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox (_("Change the color saturation by this percentage for each row"), "saturation_per_j", + auto l = spinbox (_("Change the color saturation by this percentage for each row"), "saturation_per_j", -100, 100, "%"); table_attach (table, l, 0, 3, 2); } { - GtkWidget *l = spinbox (_("Change the color saturation by this percentage for each column"), "saturation_per_i", + auto l = spinbox (_("Change the color saturation by this percentage for each column"), "saturation_per_i", -100, 100, "%"); table_attach (table, l, 0, 3, 3); } { - GtkWidget *l = spinbox (_("Randomize the color saturation by this percentage"), "saturation_rand", + auto l = spinbox (_("Randomize the color saturation by this percentage"), "saturation_rand", 0, 100, "%"); table_attach (table, l, 0, 3, 4); } @@ -716,19 +711,19 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = spinbox (_("Change the color lightness by this percentage for each row"), "lightness_per_j", + auto l = spinbox (_("Change the color lightness by this percentage for each row"), "lightness_per_j", -100, 100, "%"); table_attach (table, l, 0, 4, 2); } { - GtkWidget *l = spinbox (_("Change the color lightness by this percentage for each column"), "lightness_per_i", + auto l = spinbox (_("Change the color lightness by this percentage for each column"), "lightness_per_i", -100, 100, "%"); table_attach (table, l, 0, 4, 3); } { - GtkWidget *l = spinbox (_("Randomize the color lightness by this percentage"), "lightness_rand", + auto l = spinbox (_("Randomize the color lightness by this percentage"), "lightness_rand", 0, 100, "%"); table_attach (table, l, 0, 4, 4); } @@ -742,12 +737,12 @@ CloneTiler::CloneTiler () : } { - GtkWidget *l = checkbox (_("Alternate the sign of color changes for each row"), "color_alternatej"); + auto l = checkbox (_("Alternate the sign of color changes for each row"), "color_alternatej"); table_attach (table, l, 0, 5, 2); } { - GtkWidget *l = checkbox (_("Alternate the sign of color changes for each column"), "color_alternatei"); + auto l = checkbox (_("Alternate the sign of color changes for each column"), "color_alternatei"); table_attach (table, l, 0, 5, 3); } @@ -785,71 +780,62 @@ CloneTiler::CloneTiler () : gtk_grid_set_column_spacing(GTK_GRID(table), 6); gtk_container_add(GTK_CONTAINER(frame), table); - - GtkWidget* radio; + Gtk::RadioButtonGroup rb_group; { - radio = gtk_radio_button_new_with_label (NULL, _("Color")); - gtk_widget_set_tooltip_text (radio, _("Pick the visible color and opacity")); - table_attach (table, radio, 0.0, 1, 1); - g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_COLOR)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_COLOR); + auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, _("Color"))); + radio->set_tooltip_text(_("Pick the visible color and opacity")); + table_attach(table, radio, 0.0, 1, 1); + radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_COLOR)); + radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_COLOR); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("Opacity")); - gtk_widget_set_tooltip_text (radio, _("Pick the total accumulated opacity")); + auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, _("Opacity"))); + radio->set_tooltip_text(_("Pick the total accumulated opacity")); table_attach (table, radio, 0.0, 2, 1); - g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_OPACITY)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_OPACITY); + radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_OPACITY)); + radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_OPACITY); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("R")); - gtk_widget_set_tooltip_text (radio, _("Pick the Red component of the color")); + auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, _("R"))); + radio->set_tooltip_text(_("Pick the Red component of the color")); table_attach (table, radio, 0.0, 1, 2); - g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_R)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_R); + radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_R)); + radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_R); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("G")); - gtk_widget_set_tooltip_text (radio, _("Pick the Green component of the color")); + auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, _("G"))); + radio->set_tooltip_text(_("Pick the Green component of the color")); table_attach (table, radio, 0.0, 2, 2); - g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_G)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_G); + radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_G)); + radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_G); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("B")); - gtk_widget_set_tooltip_text (radio, _("Pick the Blue component of the color")); + auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, _("B"))); + radio->set_tooltip_text(_("Pick the Blue component of the color")); table_attach (table, radio, 0.0, 3, 2); - g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_B)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_B); + radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_B)); + radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_B); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color hue", "H")); - gtk_widget_set_tooltip_text (radio, _("Pick the hue of the color")); + auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, C_("Clonetiler color hue", "H"))); + radio->set_tooltip_text(_("Pick the hue of the color")); table_attach (table, radio, 0.0, 1, 3); - g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_H)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_H); + radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_H)); + radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_H); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color saturation", "S")); - gtk_widget_set_tooltip_text (radio, _("Pick the saturation of the color")); + auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, C_("Clonetiler color saturation", "S"))); + radio->set_tooltip_text(_("Pick the saturation of the color")); table_attach (table, radio, 0.0, 2, 3); - g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_S)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_S); + radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_S)); + radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_S); } { - radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color lightness", "L")); - gtk_widget_set_tooltip_text (radio, _("Pick the lightness of the color")); + auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, C_("Clonetiler color lightness", "L"))); + radio->set_tooltip_text(_("Pick the lightness of the color")); table_attach (table, radio, 0.0, 3, 3); - g_signal_connect (G_OBJECT (radio), "toggled", - G_CALLBACK (pick_switched), GINT_TO_POINTER(PICK_L)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_L); + radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_L)); + radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_L); } } @@ -870,7 +856,7 @@ CloneTiler::CloneTiler () : table_attach (table, l, 1.0, 1, 1); } { - GtkWidget *l = spinbox (_("Shift the mid-range of the picked value upwards (>0) or downwards (<0)"), "gamma_picked", + auto l = spinbox (_("Shift the mid-range of the picked value upwards (>0) or downwards (<0)"), "gamma_picked", -10, 10, ""); table_attach (table, l, 0.0, 1, 2); } @@ -881,7 +867,7 @@ CloneTiler::CloneTiler () : table_attach (table, l, 1.0, 1, 3); } { - GtkWidget *l = spinbox (_("Randomize the picked value by this percentage"), "rand_picked", + auto l = spinbox (_("Randomize the picked value by this percentage"), "rand_picked", 0, 100, "%"); table_attach (table, l, 0.0, 1, 4); } @@ -892,7 +878,7 @@ CloneTiler::CloneTiler () : table_attach (table, l, 1.0, 2, 1); } { - GtkWidget *l = checkbox (_("Invert the picked value"), "invert_picked"); + auto l = checkbox (_("Invert the picked value"), "invert_picked"); table_attach (table, l, 0.0, 2, 2); } } @@ -907,43 +893,39 @@ CloneTiler::CloneTiler () : gtk_container_add(GTK_CONTAINER(frame), table); { - GtkWidget *b = gtk_check_button_new_with_label (_("Presence")); + auto b = Gtk::manage(new Gtk::CheckButton(_("Presence"))); bool old = prefs->getBool(prefs_path + "pick_to_presence", true); - gtk_toggle_button_set_active ((GtkToggleButton *) b, old); - gtk_widget_set_tooltip_text (b, _("Each clone is created with the probability determined by the picked value in that point")); + b->set_active(old); + b->set_tooltip_text(_("Each clone is created with the probability determined by the picked value in that point")); table_attach (table, b, 0.0, 1, 1); - g_signal_connect(G_OBJECT(b), "toggled", - G_CALLBACK(pick_to), (gpointer) "pick_to_presence"); + b->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_to), b, "pick_to_presence")); } { - GtkWidget *b = gtk_check_button_new_with_label (_("Size")); + auto b = Gtk::manage(new Gtk::CheckButton(_("Size"))); bool old = prefs->getBool(prefs_path + "pick_to_size"); - gtk_toggle_button_set_active ((GtkToggleButton *) b, old); - gtk_widget_set_tooltip_text (b, _("Each clone's size is determined by the picked value in that point")); + b->set_active(old); + b->set_tooltip_text(_("Each clone's size is determined by the picked value in that point")); table_attach (table, b, 0.0, 2, 1); - g_signal_connect(G_OBJECT(b), "toggled", - G_CALLBACK(pick_to), (gpointer) "pick_to_size"); + b->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_to), b, "pick_to_size")); } { - GtkWidget *b = gtk_check_button_new_with_label (_("Color")); + auto b = Gtk::manage(new Gtk::CheckButton(_("Color"))); bool old = prefs->getBool(prefs_path + "pick_to_color", 0); - gtk_toggle_button_set_active ((GtkToggleButton *) b, old); - gtk_widget_set_tooltip_text (b, _("Each clone is painted by the picked color (the original must have unset fill or stroke)")); + b->set_active(old); + b->set_tooltip_text(_("Each clone is painted by the picked color (the original must have unset fill or stroke)")); table_attach (table, b, 0.0, 1, 2); - g_signal_connect(G_OBJECT(b), "toggled", - G_CALLBACK(pick_to), (gpointer) "pick_to_color"); + b->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_to), b, "pick_to_color")); } { - GtkWidget *b = gtk_check_button_new_with_label (_("Opacity")); + auto b = Gtk::manage(new Gtk::CheckButton(_("Opacity"))); bool old = prefs->getBool(prefs_path + "pick_to_opacity", 0); - gtk_toggle_button_set_active ((GtkToggleButton *) b, old); - gtk_widget_set_tooltip_text (b, _("Each clone's opacity is determined by the picked value in that point")); + b->set_active(old); + b->set_tooltip_text(_("Each clone's opacity is determined by the picked value in that point")); table_attach (table, b, 0.0, 2, 2); - g_signal_connect(G_OBJECT(b), "toggled", - G_CALLBACK(pick_to), (gpointer) "pick_to_opacity"); + b->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_to), b, "pick_to_opacity")); } } gtk_widget_set_sensitive (vvb, prefs->getBool(prefs_path + "dotrace")); @@ -980,9 +962,7 @@ CloneTiler::CloneTiler () : sb->set_width_chars (7); _rowscols->pack_start(*sb, true, true, 0); - // TODO: C++ification - g_signal_connect(G_OBJECT(a->gobj()), "value_changed", - G_CALLBACK(xy_changed), (gpointer) "jmax"); + a->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::xy_changed), a, "jmax")); } { @@ -1002,9 +982,7 @@ CloneTiler::CloneTiler () : sb->set_width_chars (7); _rowscols->pack_start(*sb, true, true, 0); - // TODO: C++ification - g_signal_connect(G_OBJECT(a->gobj()), "value_changed", - G_CALLBACK(xy_changed), (gpointer) "imax"); + a->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::xy_changed), a, "imax")); } table_attach (table, GTK_WIDGET(_rowscols->gobj()), 0.0, 1, 2); @@ -1164,11 +1142,11 @@ CloneTiler::CloneTiler () : } { - GtkWidget *b = gtk_button_new_with_mnemonic (_(" R_eset ")); + auto b = Gtk::manage(new Gtk::Button(_(" R_eset "), true)); // TRANSLATORS: "change" is a noun here - gtk_widget_set_tooltip_text (b, _("Reset all shifts, scales, rotates, opacity and color changes in the dialog to zero")); - g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (reset), this); - gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0); + b->set_tooltip_text(_("Reset all shifts, scales, rotates, opacity and color changes in the dialog to zero")); + b->signal_clicked().connect(sigc::mem_fun(*this, &CloneTiler::reset)); + gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(b->gobj()), FALSE, FALSE, 0); } } @@ -2197,7 +2175,7 @@ void CloneTiler::apply() SPItem *item = dynamic_cast(obj); if (dotrace) { - trace_setup (desktop->getDocument(), 1.0, item); + trace_setup(desktop->getDocument(), 1.0, item); } Geom::Point center; @@ -2524,72 +2502,74 @@ GtkWidget * CloneTiler::new_tab(GtkWidget *nb, const gchar *label) return vb; } -void CloneTiler::checkbox_toggled(GtkToggleButton *tb, gpointer *data) +void CloneTiler::checkbox_toggled(Gtk::ToggleButton *tb, + const Glib::ustring &attr) { - const gchar *attr = (const gchar *) data; - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool(prefs_path + attr, gtk_toggle_button_get_active(tb)); + auto prefs = Inkscape::Preferences::get(); + prefs->setBool(prefs_path + attr, tb->get_active()); } -GtkWidget * CloneTiler::checkbox(const char *tip, const char *attr) +Gtk::Widget * CloneTiler::checkbox(const char *tip, + const Glib::ustring &attr) { - auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); - gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); - - GtkWidget *b = gtk_check_button_new (); - gtk_widget_set_tooltip_text (b, tip); + auto hb = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, VB_MARGIN)); + auto b = Gtk::manage(new Gtk::CheckButton()); + b->set_tooltip_text(tip); - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - bool value = prefs->getBool(prefs_path + attr); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(b), value); + auto const prefs = Inkscape::Preferences::get(); + auto const value = prefs->getBool(prefs_path + attr); + b->set_active(value); - gtk_box_pack_end (GTK_BOX (hb), b, FALSE, TRUE, 0); - g_signal_connect ( G_OBJECT (b), "clicked", - G_CALLBACK (checkbox_toggled), (gpointer) attr); + hb->pack_end(*b, false, true); + b->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::checkbox_toggled), b, attr)); - g_object_set_data (G_OBJECT(b), "uncheckable", GINT_TO_POINTER(TRUE)); + b->set_data("uncheckable", GINT_TO_POINTER(true)); return hb; } -void CloneTiler::value_changed(GtkAdjustment *adj, gpointer data) +void CloneTiler::value_changed(Glib::RefPtr &adj, + Glib::ustring const &pref) { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - const gchar *pref = (const gchar *) data; - prefs->setDouble(prefs_path + pref, gtk_adjustment_get_value (adj)); + auto prefs = Inkscape::Preferences::get(); + prefs->setDouble(prefs_path + pref, adj->get_value()); } -GtkWidget * CloneTiler::spinbox(const char *tip, const char *attr, double lower, double upper, const gchar *suffix, bool exponent/* = false*/) +Gtk::Widget * CloneTiler::spinbox(const char *tip, + const Glib::ustring &attr, + double lower, + double upper, + const gchar *suffix, + bool exponent/* = false*/) { - auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); + auto hb = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0)); { - Glib::RefPtr a; - if (exponent) { - a = Gtk::Adjustment::create(1.0, lower, upper, 0.01, 0.05, 0); - } else { - a = Gtk::Adjustment::create(0.0, lower, upper, 0.1, 0.5, 0); - } + // Parameters for adjustment + auto const initial_value = (exponent ? 1.0 : 0.0); + auto const step_increment = (exponent ? 0.01 : 0.1); + auto const page_increment = (exponent ? 0.05 : 0.4); - Inkscape::UI::Widget::SpinButton *sb; - if (exponent) { - sb = new Inkscape::UI::Widget::SpinButton(a, 0.01, 2); - } else { - sb = new Inkscape::UI::Widget::SpinButton(a, 0.1, 1); - } + auto a = Gtk::Adjustment::create(initial_value, + lower, + upper, + step_increment, + page_increment); + + auto const climb_rate = (exponent ? 0.01 : 0.1); + auto const digits = (exponent ? 2 : 1); + + auto sb = new Inkscape::UI::Widget::SpinButton(a, climb_rate, digits); sb->set_tooltip_text (tip); sb->set_width_chars (5); sb->set_digits(3); - gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(sb->gobj()), FALSE, FALSE, SB_MARGIN); + hb->pack_start(*sb, false, false, SB_MARGIN); - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - double value = prefs->getDoubleLimited(prefs_path + attr, exponent? 1.0 : 0.0, lower, upper); + auto prefs = Inkscape::Preferences::get(); + auto value = prefs->getDoubleLimited(prefs_path + attr, exponent? 1.0 : 0.0, lower, upper); a->set_value (value); - // TODO: C++ification - g_signal_connect(G_OBJECT(a->gobj()), "value_changed", - G_CALLBACK(value_changed), (gpointer) attr); + a->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::value_changed), a, attr)); if (exponent) { sb->set_data ("oneable", GINT_TO_POINTER(TRUE)); @@ -2599,28 +2579,27 @@ GtkWidget * CloneTiler::spinbox(const char *tip, const char *attr, double lower, } { - GtkWidget *l = gtk_label_new (""); - gtk_label_set_markup (GTK_LABEL(l), suffix); - gtk_widget_set_halign(l, GTK_ALIGN_END); - gtk_widget_set_valign(l, GTK_ALIGN_START); - gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0); + auto l = Gtk::manage(new Gtk::Label("")); + l->set_markup(suffix); + l->set_halign(Gtk::ALIGN_END); + l->set_valign(Gtk::ALIGN_START); + hb->pack_start(*l); } return hb; } -void CloneTiler::symgroup_changed(GtkComboBox *cb, gpointer /*data*/) +void CloneTiler::symgroup_changed(Gtk::ComboBox *cb) { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - gint group_new = gtk_combo_box_get_active (cb); + auto prefs = Inkscape::Preferences::get(); + auto group_new = cb->get_active_row_number(); prefs->setInt(prefs_path + "symmetrygroup", group_new); } -void CloneTiler::xy_changed(GtkAdjustment *adj, gpointer data) +void CloneTiler::xy_changed(Glib::RefPtr &adj, Glib::ustring const &pref) { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - const gchar *pref = (const gchar *) data; - prefs->setInt(prefs_path + pref, (int) floor(gtk_adjustment_get_value (adj) + 0.5)); + auto prefs = Inkscape::Preferences::get(); + prefs->setInt(prefs_path + pref, (int) floor(adj->get_value() + 0.5)); } void CloneTiler::keep_bbox_toggled() @@ -2629,11 +2608,10 @@ void CloneTiler::keep_bbox_toggled() prefs->setBool(prefs_path + "keepbbox", _cb_keep_bbox->get_active()); } -void CloneTiler::pick_to(GtkToggleButton *tb, gpointer data) +void CloneTiler::pick_to(Gtk::ToggleButton *tb, Glib::ustring const &pref) { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - const gchar *pref = (const gchar *) data; - prefs->setBool(prefs_path + pref, gtk_toggle_button_get_active(tb)); + auto prefs = Inkscape::Preferences::get(); + prefs->setBool(prefs_path + pref, tb->get_active()); } @@ -2671,9 +2649,14 @@ void CloneTiler::reset_recursive(GtkWidget *w) } } -void CloneTiler::reset(GtkWidget */*widget*/, GtkWidget *dlg) +void CloneTiler::reset() +{ + reset_recursive(GTK_WIDGET(this->gobj())); +} + +void CloneTiler::table_attach(GtkWidget *table, Gtk::Widget *widget, float align, int row, int col) { - reset_recursive (dlg); + table_attach(table, GTK_WIDGET(widget->gobj()), align, row, col); } void CloneTiler::table_attach(GtkWidget *table, GtkWidget *widget, float align, int row, int col) @@ -2728,14 +2711,12 @@ GtkWidget * CloneTiler::table_x_y_rand(int values) return table; } -void CloneTiler::pick_switched(GtkToggleButton */*tb*/, gpointer data) +void CloneTiler::pick_switched(PickType v) { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - guint v = GPOINTER_TO_INT (data); + auto prefs = Inkscape::Preferences::get(); prefs->setInt(prefs_path + "pick", v); } - void CloneTiler::switch_to_create() { if (_rowscols) { diff --git a/src/ui/dialog/clonetiler.h b/src/ui/dialog/clonetiler.h index 04f676800..db3049ef1 100644 --- a/src/ui/dialog/clonetiler.h +++ b/src/ui/dialog/clonetiler.h @@ -18,6 +18,7 @@ namespace Gtk { class CheckButton; + class ComboBox; class ToggleButton; } @@ -38,48 +39,66 @@ public: static CloneTiler &getInstance() { return *new CloneTiler(); } void show_page_trace(); protected: + enum PickType { + PICK_COLOR, + PICK_OPACITY, + PICK_R, + PICK_G, + PICK_B, + PICK_H, + PICK_S, + PICK_L + }; GtkWidget * new_tab(GtkWidget *nb, const gchar *label); GtkWidget * table_x_y_rand(int values); - GtkWidget * spinbox(const char *tip, const char *attr, double lower, double upper, const gchar *suffix, bool exponent = false); - GtkWidget * checkbox(const char *tip, const char *attr); + Gtk::Widget * spinbox(const char *tip, + const Glib::ustring &attr, + double lower, + double upper, + const gchar *suffix, + bool exponent = false); + Gtk::Widget * checkbox(const char *tip, + const Glib::ustring &attr); void table_attach(GtkWidget *table, GtkWidget *widget, float align, int row, int col); - - // TODO: Improve encapsulation by using SigC++ signal handling, and convert all of these into - // non-static member functions - static void symgroup_changed(GtkComboBox *cb, gpointer /*data*/); - static void on_picker_color_changed(guint rgba); - static void trace_hide_tiled_clones_recursively(SPObject *from); - static void checkbox_toggled(GtkToggleButton *tb, gpointer *data); - static void pick_switched(GtkToggleButton */*tb*/, gpointer data); - static void pick_to(GtkToggleButton *tb, gpointer data); - static void xy_changed(GtkAdjustment *adj, gpointer data); - void switch_to_create(); - void switch_to_fill(); - void keep_bbox_toggled(); - void unclump(); - static void reset(GtkWidget */*widget*/, GtkWidget *dlg); - static guint number_of_clones(SPObject *obj); - static void trace_setup(SPDocument *doc, gdouble zoom, SPItem *original); - static guint32 trace_pick(Geom::Rect box); - static void trace_finish(); - static bool is_a_clone_of(SPObject *tile, SPObject *obj); - static Geom::Rect transform_rect(Geom::Rect const &r, Geom::Affine const &m); - static double randomize01(double val, double rand); - static void value_changed(GtkAdjustment *adj, gpointer data); - static void reset_recursive(GtkWidget *w); + void table_attach(GtkWidget *table, Gtk::Widget *widget, float align, int row, int col); + + void symgroup_changed(Gtk::ComboBox *cb); + void on_picker_color_changed(guint rgba); + void trace_hide_tiled_clones_recursively(SPObject *from); + guint number_of_clones(SPObject *obj); + void trace_setup(SPDocument *doc, gdouble zoom, SPItem *original); + guint32 trace_pick(Geom::Rect box); + void trace_finish(); + bool is_a_clone_of(SPObject *tile, SPObject *obj); + Geom::Rect transform_rect(Geom::Rect const &r, Geom::Affine const &m); + double randomize01(double val, double rand); void apply(); void change_selection(Inkscape::Selection *selection); + void checkbox_toggled(Gtk::ToggleButton *tb, + Glib::ustring const &attr); void do_pick_toggled(); void external_change(); void fill_width_changed(); void fill_height_changed(); - void remove(bool do_undo = true); + void keep_bbox_toggled(); void on_remove_button_clicked() {remove();} + void pick_switched(PickType); + void pick_to(Gtk::ToggleButton *tb, + Glib::ustring const &pref); + void remove(bool do_undo = true); + void reset(); + void reset_recursive(GtkWidget *w); + void switch_to_create(); + void switch_to_fill(); + void unclump(); void unit_changed(); + void value_changed(Glib::RefPtr &adj, Glib::ustring const &pref); + void xy_changed(Glib::RefPtr &adj, Glib::ustring const &pref); - static Geom::Affine get_transform( // symmetry group + Geom::Affine get_transform( + // symmetry group int type, // row, column @@ -156,20 +175,10 @@ private: GtkWidget *_status; Gtk::Box *_rowscols; Gtk::Box *_widthheight; + }; -enum { - PICK_COLOR, - PICK_OPACITY, - PICK_R, - PICK_G, - PICK_B, - PICK_H, - PICK_S, - PICK_L -}; - enum { TILE_P1, TILE_P2, -- cgit v1.2.3 From 11e0546b1c039fc84c1a0f86a4681df34642916b Mon Sep 17 00:00:00 2001 From: Tavmjong Bah & Kamalpreet Grewal <> Date: Mon, 15 Aug 2016 10:45:09 +0530 Subject: Add changes for compilation with trunk (bzr r14949.1.65) --- src/ui/dialog/styledialog.cpp | 120 ++++++++++++++++++++++-------------------- 1 file changed, 63 insertions(+), 57 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 370b0ab47..e43934c57 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -16,7 +16,8 @@ #include "sp-object.h" #include "selection.h" #include "xml/attribute-record.h" - +#include + using Inkscape::Util::List; using Inkscape::XML::AttributeRecord; @@ -135,8 +136,8 @@ void StyleDialog::setDesktop( SPDesktop* desktop ) { Panel::setDesktop(desktop); _desktop = Panel::getDesktop(); - _desktop->selection->connectChanged(sigc::mem_fun(*this, &StyleDialog:: - _selectRow)); + _desktop->getSelection()->connectChanged(sigc::mem_fun(*this, &StyleDialog:: + _selectRow)); } /** @@ -163,11 +164,15 @@ void StyleDialog::_addSelector() * is(are) selected and user clicks '+' at the bottom of dialog, the * entrybox will have the id(s) of the selected objects as text. */ - if (_desktop->selection->isEmpty()) { + if (_desktop->getSelection()->isEmpty()) { textEditPtr->set_text("Class1"); } else { - std::vector selected = _desktop->getSelection()->list(); + Inkscape::Selection* selection = _desktop->getSelection(); + std::vector selected = std::vector(selection + ->objects().begin(), + selection-> + objects().end()); textEditPtr->set_text(_setClassAttribute(selected)); } @@ -199,14 +204,11 @@ void StyleDialog::_addSelector() * created with an empty value. Also if a class selector is added, then * class attribute for the selected object is set too. */ - SPObject *obj; std::vector objVec; bool objExists = false; - if (!_desktop->getSelection()->list().empty()) { - std::vector selected = _desktop->getSelection()->list(); - for (unsigned i = 0; i < selected.size(); ++i) { - obj = selected.at(i); + if (!_desktop->getSelection()->isEmpty()) { + for (auto& obj: _desktop->getSelection()->objects()) { objExists = true; if (!obj->getRepr()->attribute("style")) { obj->getRepr()->setAttribute("style", NULL); @@ -246,7 +248,10 @@ void StyleDialog::_addSelector() _row[_mColumns._selectorLabel] = _selectorName; _row[_mColumns._colAddRemove] = true; if (objExists) { - _row[_mColumns._colObj] = _desktop->selection->list(); + Inkscape::Selection* selection = _desktop->getSelection(); + _row[_mColumns._colObj] = std::vector(selection->objects() + .begin(), selection + ->objects().end()); objVec = _row[_mColumns._colObj]; } break; @@ -579,56 +584,55 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) * by removing the parent row's class selector name. */ if (!row.parent()) { - if (_desktop->selection) { - std::vectorsel = _desktop->selection->list(); - for (unsigned i = 0; i < sel.size(); ++i) { - SPObject *obj = sel[i]; - std::string childStyle; - if (iter) { - path = _treeView.get_model()->get_path(iter); - if (_selectorVec.size() != 0) { - Gtk::TreeModel::Row childrow; - childrow = *(_store->append(row->children())); - childrow[_mColumns._selectorLabel] = "#" + - std::string(obj->getId()); - childrow[_mColumns._colAddRemove] = false; - childrow[_mColumns._colObj] = _desktop->selection->list(); - if (obj->getAttribute("style") != NULL) { - childStyle = "#" + std::string(obj->getId()) + "{" + - std::string(obj->getAttribute("style")) + "}\n"; + Inkscape::Selection* selection = _desktop->getSelection(); + std::vector sel = std::vector + (selection->objects().begin(), selection->objects().end()); + for (auto& obj: selection->objects()) { + std::string childStyle; + if (iter) { + path = _treeView.get_model()->get_path(iter); + if (_selectorVec.size() != 0) { + Gtk::TreeModel::Row childrow; + childrow = *(_store->append(row->children())); + childrow[_mColumns._selectorLabel] = "#" + + std::string(obj->getId()); + childrow[_mColumns._colAddRemove] = false; + childrow[_mColumns._colObj] = sel; + if (obj->getAttribute("style") != NULL) { + childStyle = "#" + std::string(obj->getId()) + "{" + + std::string(obj->getAttribute("style")) + "}\n"; + } + else { + childStyle = "#" + std::string(obj->getId()) + + "{" + "}\n"; + } + Glib::ustring key = row[_mColumns._selectorLabel]; + if (key[0] == '.') { + if (!obj->getRepr()->attribute("class")) { + obj->setAttribute("class", key.erase(0,1)); } else { - childStyle = "#" + std::string(obj->getId()) - + "{" + "}\n"; - } - Glib::ustring key = row[_mColumns._selectorLabel]; - if (key[0] == '.') { - if (!obj->getRepr()->attribute("class")) { - obj->setAttribute("class", key.erase(0,1)); - } - else { - obj->setAttribute("class", std::string - (obj->getRepr()-> - attribute("class")) - + " " + key - .erase(0,1)); - } + obj->setAttribute("class", std::string + (obj->getRepr()-> + attribute("class")) + + " " + key + .erase(0,1)); } } } - - inkSelector._selector = obj->getId(); - inkSelector._matchingObjs = sel; - inkSelector._xmlContent = childStyle; - _selectorVec.push_back(inkSelector); - } - if (_styleElementNode()) { - _styleChild = _styleElementNode(); - _updateStyleContent(); - } - else if (_styleExists && !_newDrawing) { - _updateStyleContent(); } + + inkSelector._selector = obj->getId(); + inkSelector._matchingObjs = sel; + inkSelector._xmlContent = childStyle; + _selectorVec.push_back(inkSelector); + } + if (_styleElementNode()) { + _styleChild = _styleElementNode(); + _updateStyleContent(); + } + else if (_styleExists && !_newDrawing) { + _updateStyleContent(); } } @@ -989,8 +993,10 @@ void StyleDialog::_checkAllChildren(Gtk::TreeModel::Children& children) void StyleDialog::_selectRow(Selection */*sel*/) { SPObject *obj = NULL; - if (!_desktop->selection->list().empty()) { - std::vector selected = _desktop->getSelection()->list(); + if (!_desktop->selection->isEmpty()) { + Inkscape::Selection* selection = _desktop->getSelection(); + std::vector selected = std::vector + (selection->objects().begin(), selection->objects().end()); obj = selected.back(); } -- cgit v1.2.3 From 7f779f28e67eac1653e0f7751bb3f224b67894c7 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 15 Aug 2016 22:55:21 +0200 Subject: Fix a bunch of errors as reported at http://www.viva64.com/en/b/0419/ (bzr r15059) --- src/ui/dialog/inkscape-preferences.cpp | 2 +- src/ui/dialog/svg-fonts-dialog.cpp | 4 +--- src/ui/widget/font-variants.cpp | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 4574e93fe..9a95c3d8c 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1307,7 +1307,7 @@ void InkscapePreferences::initPageBehavior() _steps_rot_relative.init ( _("Relative snapping of guideline angles"), "/options/relativeguiderotationsnap/value", false); _page_steps.add_line( false, "", _steps_rot_relative, "", _("When on, the snap angles when rotating a guideline will be relative to the original angle")); - _steps_zoom.init ( "/options/zoomincrement/value", 101.0, 500.0, 1.0, 1.0, 1.414213562, true, true); + _steps_zoom.init ( "/options/zoomincrement/value", 101.0, 500.0, 1.0, 1.0, M_SQRT2, true, true); _page_steps.add_line( false, _("_Zoom in/out by:"), _steps_zoom, _("%"), _("Zoom tool click, +/- keys, and middle click zoom in and out by this multiplier"), false); this->AddPage(_page_steps, _("Steps"), iter_behavior, PREFS_PAGE_BEHAVIOR_STEPS); diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 6a87f3714..0203d9778 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -162,10 +162,8 @@ GlyphComboBox::GlyphComboBox(){ } void GlyphComboBox::update(SPFont* spfont){ - if (!spfont) return -//TODO: figure out why do we need to append("") before clearing items properly... + if (!spfont) return; - this->append(""); //Gtk is refusing to clear the combobox when I comment out this line this->remove_all(); for (auto& node: spfont->children) { diff --git a/src/ui/widget/font-variants.cpp b/src/ui/widget/font-variants.cpp index aca85f246..b386051a6 100644 --- a/src/ui/widget/font-variants.cpp +++ b/src/ui/widget/font-variants.cpp @@ -629,7 +629,7 @@ namespace Widget { } else if( _caps_all_small.get_active() ) { css_string = "all-small-caps"; caps_new = SP_CSS_FONT_VARIANT_CAPS_ALL_SMALL; - } else if( _caps_all_petite.get_active() ) { + } else if( _caps_petite.get_active() ) { css_string = "petite"; caps_new = SP_CSS_FONT_VARIANT_CAPS_PETITE; } else if( _caps_all_petite.get_active() ) { -- cgit v1.2.3 From d096134d56f86f585ff0c8880320f147fb22092b Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Mon, 15 Aug 2016 21:17:26 -0400 Subject: Adjust label for resize in page sizer tab (bzr r15060) --- src/ui/widget/page-sizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 578b6855a..081300b9e 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -406,7 +406,7 @@ PageSizer::PageSizer(Registry & _wr) _fitPageButtonAlign.set(0.5, 0.5, 0.0, 1.0); _fitPageButtonAlign.add(_fitPageButton); _fitPageButton.set_use_underline(); - _fitPageButton.set_label(_("_Resize page to drawing or selection")); + _fitPageButton.set_label(_("_Resize page to drawing or selection (Ctrl+Shift+R)")); _fitPageButton.set_tooltip_text(_("Resize the page to fit the current selection, or the entire drawing if there is no selection")); _scaleFrame.set_label(_("Scale")); -- cgit v1.2.3 From 80cd661e8fc8ee72c5e77608961fd392c5b11d4a Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Mon, 15 Aug 2016 23:52:21 -0400 Subject: Add Shift+drag to arc start and end knots, holding shift will now move both knots together, maintaining the arc's size. Adjusted buffer for closed/open auto flipping. (bzr r15061) --- src/ui/object-edit.cpp | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'src/ui') diff --git a/src/ui/object-edit.cpp b/src/ui/object-edit.cpp index ddf770f59..2763e6c4b 100644 --- a/src/ui/object-edit.cpp +++ b/src/ui/object-edit.cpp @@ -795,8 +795,11 @@ sp_genericellipse_side(SPGenericEllipse *ellipse, Geom::Point const &p) gdouble dy = (p[Geom::Y] - ellipse->cy.computed) / ellipse->ry.computed; gdouble s = dx * dx + dy * dy; - if (s < 1.0) return 1; - if (s > 1.0) return -1; + // We add a bit of a buffer, so there's a decent chance the user will + // be able to adjust the arc without the closed status flipping between + // open and closed during micro mouse movements. + if (s < 0.75) return 1; + if (s > 1.25) return -1; return 0; } @@ -808,16 +811,21 @@ ArcKnotHolderEntityStart::knot_set(Geom::Point const &p, Geom::Point const &/*or SPGenericEllipse *arc = dynamic_cast(item); g_assert(arc != NULL); - arc->setClosed(sp_genericellipse_side(arc, p) == -1); + gint side = sp_genericellipse_side(arc, p); + if(side != 0) { arc->setClosed(side == -1); } Geom::Point delta = p - Geom::Point(arc->cx.computed, arc->cy.computed); Geom::Scale sc(arc->rx.computed, arc->ry.computed); - arc->start = atan2(delta * sc.inverse()); + double offset = arc->start - atan2(delta * sc.inverse()); + arc->start -= offset; if ((state & GDK_CONTROL_MASK) && snaps) { arc->start = sp_round(arc->start, M_PI / snaps); } + if (state & GDK_SHIFT_MASK) { + arc->end -= offset; + } arc->normalize(); arc->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); @@ -852,16 +860,21 @@ ArcKnotHolderEntityEnd::knot_set(Geom::Point const &p, Geom::Point const &/*orig SPGenericEllipse *arc = dynamic_cast(item); g_assert(arc != NULL); - arc->setClosed(sp_genericellipse_side(arc, p) == -1); + gint side = sp_genericellipse_side(arc, p); + if(side != 0) { arc->setClosed(side == -1); } Geom::Point delta = p - Geom::Point(arc->cx.computed, arc->cy.computed); Geom::Scale sc(arc->rx.computed, arc->ry.computed); - arc->end = atan2(delta * sc.inverse()); + double offset = arc->end - atan2(delta * sc.inverse()); + arc->end -= offset; if ((state & GDK_CONTROL_MASK) && snaps) { arc->end = sp_round(arc->end, M_PI/snaps); } + if (state & GDK_SHIFT_MASK) { + arc->start -= offset; + } arc->normalize(); arc->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); @@ -983,13 +996,15 @@ ArcKnotHolder::ArcKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRelea SP_KNOT_SHAPE_SQUARE, SP_KNOT_MODE_XOR); entity_start->create(desktop, item, this, Inkscape::CTRL_TYPE_ROTATE, - _("Position the start point of the arc or segment; with Ctrl " - "to snap angle; drag inside the ellipse for arc, outside for segment"), + _("Position the start point of the arc or segment; with Shift to move " + "with end point; with Ctrl to snap angle; drag inside the " + "ellipse for arc, outside for segment"), SP_KNOT_SHAPE_CIRCLE, SP_KNOT_MODE_XOR); entity_end->create(desktop, item, this, Inkscape::CTRL_TYPE_ROTATE, - _("Position the end point of the arc or segment; with Ctrl to snap angle; " - "drag inside the ellipse for arc, outside for segment"), + _("Position the end point of the arc or segment; with Shift to move " + "with start point; with Ctrl to snap angle; drag inside the " + "ellipse for arc, outside for segment"), SP_KNOT_SHAPE_CIRCLE, SP_KNOT_MODE_XOR); entity.push_back(entity_rx); -- cgit v1.2.3 From be9439742ea5d6924d290fd56849b29cd264b331 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Tue, 16 Aug 2016 21:01:49 +0530 Subject: Solve issue with addition of missing CSS properties (bzr r14949.1.67) --- src/ui/dialog/styledialog.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index e43934c57..bf3562ad3 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -827,12 +827,14 @@ void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& * property, else replacements in value are done in the 'else' block. */ if (_cssPane->_newProperty) { - value.append((new_text + ";").c_str()); - _cssPane->_propCol->add_attribute(_cssPane->_textRenderer - ->property_text(), - _cssPane->_cssColumns - ._propertyLabel); - _cssPane->_newProperty = false; + if (!new_text.empty()) { + value.append((new_text + ";").c_str()); + _cssPane->_propCol->add_attribute(_cssPane->_textRenderer + ->property_text(), + _cssPane->_cssColumns + ._propertyLabel); + _cssPane->_newProperty = false; + } } else { std::stringstream ss(value); -- cgit v1.2.3 From 8cb11cfc6b279853dc8cb092bff5595c64f32655 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Wed, 17 Aug 2016 00:21:41 +0530 Subject: Pass tests while adding & removing objects from class selectors (bzr r14949.1.68) --- src/ui/dialog/styledialog.cpp | 49 +++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 16 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index bf3562ad3..cec5d26ca 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -574,6 +574,7 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) Gtk::TreeModel::iterator iter = refTreeSelection-> get_selected(); Gtk::TreeModel::Row row = *iter; + Glib::ustring selectorName; /** * This adds child rows to selected rows. If the parent row is @@ -607,6 +608,7 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) + "{" + "}\n"; } Glib::ustring key = row[_mColumns._selectorLabel]; + selectorName = row[_mColumns._selectorLabel]; if (key[0] == '.') { if (!obj->getRepr()->attribute("class")) { obj->setAttribute("class", key.erase(0,1)); @@ -624,7 +626,19 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) inkSelector._selector = obj->getId(); inkSelector._matchingObjs = sel; - inkSelector._xmlContent = childStyle; + + /** + * If the object's parent row is a class selector, then + * there are no changes in style element except the class + * attribute is updated. For the id selector cases, XML + * content's style element is updated. + */ + if (selectorName[0] == '.') { + inkSelector._xmlContent = ""; + } + else { + inkSelector._xmlContent = childStyle; + } _selectorVec.push_back(inkSelector); } if (_styleElementNode()) { @@ -651,23 +665,26 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) } } } - if (key == row[_mColumns._selectorLabel]) { - Gtk::TreeModel::Row parentRow = *(row.parent()); - Glib::ustring parentKey = parentRow[_mColumns._selectorLabel]; - if (parentKey[0] == '.') { - std::vector objVec = row[_mColumns._colObj]; - for (unsigned i = 0; i < objVec.size(); ++i) { - SPObject *obj = objVec[i]; - std::string classAttr = std::string(obj->getRepr() - ->attribute("class")); - std::size_t found = classAttr.find(parentKey.erase(0,1)); - if (found != std::string::npos) { - classAttr.erase(found, parentKey.length()+1); - obj->getRepr()->setAttribute("class", classAttr); - } + + Gtk::TreeModel::Row parentRow = *(row.parent()); + Glib::ustring parentKey = parentRow[_mColumns._selectorLabel]; + + if (key == row[_mColumns._selectorLabel]) { + _selectorVec.erase(it); + } + + if (parentKey[0] == '.') { + std::vector objVec = row[_mColumns._colObj]; + for (unsigned i = 0; i < objVec.size(); ++i) { + SPObject *obj = objVec[i]; + std::string classAttr = std::string(obj->getRepr() + ->attribute("class")); + std::size_t found = classAttr.find(parentKey.erase(0,1)); + if (found != std::string::npos) { + classAttr.erase(found, parentKey.length()+1); + obj->getRepr()->setAttribute("class", classAttr); } } - _selectorVec.erase(it); } if (_styleChild) { -- cgit v1.2.3 From 303781617a238c95fe345b22d2a53afb7e8e3cca Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Fri, 19 Aug 2016 01:49:57 +0530 Subject: Passing test when adding id selectors (bzr r14949.1.70) --- src/ui/dialog/styledialog.cpp | 289 ++++++++++++++++++++++++------------------ src/ui/dialog/styledialog.h | 2 +- 2 files changed, 164 insertions(+), 127 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index cec5d26ca..e0aeaf09d 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -147,7 +147,7 @@ void StyleDialog::setDesktop( SPDesktop* desktop ) */ void StyleDialog::_addSelector() { - _row = *(_store->append()); + Gtk::TreeModel::Row row = *(_store->append()); /** * On clicking '+' button, an entrybox with default text opens up. If an @@ -245,14 +245,14 @@ void StyleDialog::_addSelector() switch (result) { case Gtk::RESPONSE_OK: textDialogPtr->hide(); - _row[_mColumns._selectorLabel] = _selectorName; - _row[_mColumns._colAddRemove] = true; + row[_mColumns._selectorLabel] = _selectorName; + row[_mColumns._colAddRemove] = true; if (objExists) { Inkscape::Selection* selection = _desktop->getSelection(); - _row[_mColumns._colObj] = std::vector(selection->objects() + row[_mColumns._colObj] = std::vector(selection->objects() .begin(), selection ->objects().end()); - objVec = _row[_mColumns._colObj]; + objVec = row[_mColumns._colObj]; } break; default: @@ -290,6 +290,8 @@ void StyleDialog::_addSelector() Inkscape::GC::release(newChild); _styleChild = newChild; } + +// _selAdd(row); } /** @@ -574,7 +576,6 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) Gtk::TreeModel::iterator iter = refTreeSelection-> get_selected(); Gtk::TreeModel::Row row = *iter; - Glib::ustring selectorName; /** * This adds child rows to selected rows. If the parent row is @@ -585,69 +586,7 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) * by removing the parent row's class selector name. */ if (!row.parent()) { - Inkscape::Selection* selection = _desktop->getSelection(); - std::vector sel = std::vector - (selection->objects().begin(), selection->objects().end()); - for (auto& obj: selection->objects()) { - std::string childStyle; - if (iter) { - path = _treeView.get_model()->get_path(iter); - if (_selectorVec.size() != 0) { - Gtk::TreeModel::Row childrow; - childrow = *(_store->append(row->children())); - childrow[_mColumns._selectorLabel] = "#" + - std::string(obj->getId()); - childrow[_mColumns._colAddRemove] = false; - childrow[_mColumns._colObj] = sel; - if (obj->getAttribute("style") != NULL) { - childStyle = "#" + std::string(obj->getId()) + "{" + - std::string(obj->getAttribute("style")) + "}\n"; - } - else { - childStyle = "#" + std::string(obj->getId()) - + "{" + "}\n"; - } - Glib::ustring key = row[_mColumns._selectorLabel]; - selectorName = row[_mColumns._selectorLabel]; - if (key[0] == '.') { - if (!obj->getRepr()->attribute("class")) { - obj->setAttribute("class", key.erase(0,1)); - } - else { - obj->setAttribute("class", std::string - (obj->getRepr()-> - attribute("class")) - + " " + key - .erase(0,1)); - } - } - } - } - - inkSelector._selector = obj->getId(); - inkSelector._matchingObjs = sel; - - /** - * If the object's parent row is a class selector, then - * there are no changes in style element except the class - * attribute is updated. For the id selector cases, XML - * content's style element is updated. - */ - if (selectorName[0] == '.') { - inkSelector._xmlContent = ""; - } - else { - inkSelector._xmlContent = childStyle; - } - _selectorVec.push_back(inkSelector); - } - if (_styleElementNode()) { - _styleChild = _styleElementNode(); - _updateStyleContent(); - } - else if (_styleExists && !_newDrawing) { - _updateStyleContent(); - } + _selAdd(row); } else { @@ -664,25 +603,42 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) value = strtok(temp, "}"); } } - } - Gtk::TreeModel::Row parentRow = *(row.parent()); - Glib::ustring parentKey = parentRow[_mColumns._selectorLabel]; - - if (key == row[_mColumns._selectorLabel]) { - _selectorVec.erase(it); - } + Gtk::TreeModel::Row parentRow = *(row.parent()); + Glib::ustring parentKey = parentRow[_mColumns._selectorLabel]; + + if (key[0] == '#') { + std::string s = parentKey; + Glib::ustring toDelRow = row[_mColumns._selectorLabel]; + std::string toDelKey = toDelRow; + std::size_t idFound = s.find(toDelKey); + if (idFound != std::string::npos) { + if (idFound == 0) { + s.erase(idFound, toDelKey.length()+1); + parentKey = s; + parentRow[_mColumns._selectorLabel] = parentKey; + (*it)._xmlContent.erase(idFound, toDelKey.length()); + } + else { + s.erase(idFound-2, toDelKey.length()+2); + parentKey = s; + parentRow[_mColumns._selectorLabel] = parentKey; + (*it)._xmlContent.erase(idFound-2, toDelKey.length()+2); + } + } + } - if (parentKey[0] == '.') { - std::vector objVec = row[_mColumns._colObj]; - for (unsigned i = 0; i < objVec.size(); ++i) { - SPObject *obj = objVec[i]; - std::string classAttr = std::string(obj->getRepr() - ->attribute("class")); - std::size_t found = classAttr.find(parentKey.erase(0,1)); - if (found != std::string::npos) { - classAttr.erase(found, parentKey.length()+1); - obj->getRepr()->setAttribute("class", classAttr); + if (parentKey[0] == '.') { + std::vector objVec = row[_mColumns._colObj]; + for (unsigned i = 0; i < objVec.size(); ++i) { + SPObject *obj = objVec[i]; + std::string classAttr = std::string(obj->getRepr() + ->attribute("class")); + std::size_t found = classAttr.find(parentKey.erase(0,1)); + if (found != std::string::npos) { + classAttr.erase(found, parentKey.length()+1); + obj->getRepr()->setAttribute("class", classAttr); + } } } } @@ -702,6 +658,87 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) return false; } +void StyleDialog::_selAdd(Gtk::TreeModel::Row row) +{ + Glib::ustring selectorName; + Gtk::TreeModel::Row childrow; + Inkscape::Selection* selection = _desktop->getSelection(); + std::vector sel = std::vector + (selection->objects().begin(), selection->objects().end()); + for (auto& obj: selection->objects()) { + if (*row) { + if (_selectorVec.size() != 0) { + childrow = *(_store->append(row->children())); + childrow[_mColumns._selectorLabel] = "#" + + std::string(obj->getId()); + childrow[_mColumns._colAddRemove] = false; + childrow[_mColumns._colObj] = sel; + Glib::ustring key = row[_mColumns._selectorLabel]; + if (key[0] == '.') { + if (!obj->getRepr()->attribute("class")) { + obj->setAttribute("class", key.erase(0,1)); + } + else { + obj->setAttribute("class", std::string + (obj->getRepr()-> + attribute("class")) + + " " + key + .erase(0,1)); + } + } + } + selectorName = row[_mColumns._selectorLabel]; + } + + /** + * If the object's parent row is a class selector, then + * there are no changes in style element except the class + * attribute is updated. For the id selector cases, XML + * content's style element is updated. + */ + REMOVE_SPACES(selectorName); + std::vector::iterator it; + for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it) { + std::string sel, key, value; + sel = (*it)._xmlContent; + REMOVE_SPACES(sel); + if (!sel.empty()) { + key = strtok((char*)sel.c_str(), "{"); + REMOVE_SPACES(key); + char *temp = strtok(NULL, "}"); + if (strtok(temp, "}") != NULL) { + value = strtok(temp, "}"); + } + } + + REMOVE_SPACES((*it)._selector); + if ("#" + std::string(obj->getId()) != selectorName) { + inkSelector._selector = (*it)._selector; + inkSelector._selector.append(", #" + std::string(obj->getId())); + } + + inkSelector._xmlContent = inkSelector._selector + "{" + value + "}"; + if (selectorName != childrow[_mColumns._selectorLabel]) { + row[_mColumns._selectorLabel] = selectorName + ", " + + childrow[_mColumns._selectorLabel]; + } + it = _selectorVec.erase(it); + it = _selectorVec.insert(it, inkSelector); + } + +// if (selectorName[0] == '.') { +// inkSelector._xmlContent = ""; +// } + } + if (_styleElementNode()) { + _styleChild = _styleElementNode(); + _updateStyleContent(); + } + else if (_styleExists && !_newDrawing) { + _updateStyleContent(); + } +} + /** * @brief StyleDialog::_selectObjects * @param event @@ -839,43 +876,43 @@ void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& std::string matchSelector = selectedRowLabel; REMOVE_SPACES(matchSelector); - if (key == matchSelector) { +// if (key == matchSelector) { /** If a new property is added, existing value is appended with new * property, else replacements in value are done in the 'else' block. */ - if (_cssPane->_newProperty) { - if (!new_text.empty()) { - value.append((new_text + ";").c_str()); - _cssPane->_propCol->add_attribute(_cssPane->_textRenderer - ->property_text(), - _cssPane->_cssColumns - ._propertyLabel); - _cssPane->_newProperty = false; - } + if (_cssPane->_newProperty) { + if (!new_text.empty()) { + value.append((new_text + ";").c_str()); + _cssPane->_propCol->add_attribute(_cssPane->_textRenderer + ->property_text(), + _cssPane->_cssColumns + ._propertyLabel); + _cssPane->_newProperty = false; } - else { - std::stringstream ss(value); - std::string token, editedToken; - std::size_t found = value.find(";"); - if (found!=std::string::npos) { - while(std::getline(ss, token, ';')) { - REMOVE_SPACES(token); - if (!token.empty()) { - if (token.substr(0, token.find(":")) == _cssPane - ->_editedProp.substr(0, _cssPane->_editedProp - .find(":"))) { - editedToken = _cssPane->_editedProp; - size_t startPos = value.find(token); - value.replace(startPos, token.length(), editedToken); - } + } + else { + std::stringstream ss(value); + std::string token, editedToken; + std::size_t found = value.find(";"); + if (found!=std::string::npos) { + while(std::getline(ss, token, ';')) { + REMOVE_SPACES(token); + if (!token.empty()) { + if (token.substr(0, token.find(":")) == _cssPane + ->_editedProp.substr(0, _cssPane->_editedProp + .find(":"))) { + editedToken = _cssPane->_editedProp; + size_t startPos = value.find(token); + value.replace(startPos, token.length(), editedToken); } } } } - value.erase(std::remove(value.begin(), value.end(), '\n'), value.end()); - (*it)._xmlContent = key + "{" + value + "}\n"; - _updateStyleContent(); } + value.erase(std::remove(value.begin(), value.end(), '\n'), value.end()); + (*it)._xmlContent = key + "{" + value + "}\n"; + _updateStyleContent(); +// } } } } @@ -1040,18 +1077,18 @@ void StyleDialog::_selectRow(Selection */*sel*/) } } - if (row.children()) { - for(Gtk::TreeModel::Children::iterator it = row.children().begin(); - it != row.children().end(); ++it) { - childRow = *it; - childObjVec = childRow[_mColumns._colObj]; - } - for (unsigned j = 0; j < childObjVec.size(); ++j) { - if (obj->getId() == childObjVec[j]->getId()) { - _treeView.get_selection()->select(childRow); - } - } - } +// if (row.children()) { +// for(Gtk::TreeModel::Children::iterator it = row.children().begin(); +// it != row.children().end(); ++it) { +// childRow = *it; +// childObjVec = childRow[_mColumns._colObj]; +// } +// for (unsigned j = 0; j < childObjVec.size(); ++j) { +// if (obj->getId() == childObjVec[j]->getId()) { +// _treeView.get_selection()->select(childRow); +// } +// } +// } } } else { diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index a1048a97d..af3014f88 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -93,9 +93,9 @@ private: Inkscape::XML::Node *_styleChild; std::string _selectorName; std::string _selectorValue; - Gtk::TreeModel::Row _row; bool _newDrawing; CssDialog *_cssPane; + void _selAdd(Gtk::TreeModel::Row row); // Signal handlers void _addSelector(); -- cgit v1.2.3 From 8c41342f5523120bd50ba3c39e11a67e31e90835 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Fri, 19 Aug 2016 01:55:57 +0530 Subject: Uncommenting for editing CSS properties (bzr r14949.1.71) --- src/ui/dialog/styledialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index e0aeaf09d..fa092a602 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -876,7 +876,7 @@ void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& std::string matchSelector = selectedRowLabel; REMOVE_SPACES(matchSelector); -// if (key == matchSelector) { + if (key == matchSelector) { /** If a new property is added, existing value is appended with new * property, else replacements in value are done in the 'else' block. */ @@ -912,7 +912,7 @@ void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& value.erase(std::remove(value.begin(), value.end(), '\n'), value.end()); (*it)._xmlContent = key + "{" + value + "}\n"; _updateStyleContent(); -// } + } } } } -- cgit v1.2.3 From 43d547744d82337cb375c789083333a18cb74c86 Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Fri, 19 Aug 2016 13:07:39 +0530 Subject: Complete passing of test to add ID selectors (bzr r14949.1.73) --- src/ui/dialog/styledialog.cpp | 116 ++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 61 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index fa092a602..e9b00bf1c 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -291,7 +291,7 @@ void StyleDialog::_addSelector() _styleChild = newChild; } -// _selAdd(row); + _selAdd(row); } /** @@ -340,32 +340,6 @@ void StyleDialog::_delSelector() std::string matchSelector = selectedRowLabel; REMOVE_SPACES(matchSelector); if (key == matchSelector) { - if (!row.children().empty()) { - for (Gtk::TreeModel::Children::iterator child = row.children().begin(); - child != row.children().end(); ++child) { - Gtk::TreeModel::Row childrow = *child; - std::string childSel, childKey; - std::vector::iterator i; - for (i = _selectorVec.begin(); i != _selectorVec.end();) { - childSel = (*i)._xmlContent; - REMOVE_SPACES(childSel); - if (!childSel.empty()) { - childKey = strtok((char*)childSel.c_str(), "{"); - REMOVE_SPACES(childKey); - } - Glib::ustring selectedChildRowLabel = - childrow[_mColumns._selectorLabel]; - std::string matchChildSelector = selectedChildRowLabel; - REMOVE_SPACES(matchChildSelector); - if (childKey == matchChildSelector) { - i = _selectorVec.erase(i); - } - else { - ++i; - } - } - } - } it = _selectorVec.erase(it); _store->erase(row); } @@ -380,7 +354,7 @@ void StyleDialog::_delSelector() * the content is updated simply using _updateStyleContent(). */ _styleChild = _styleElementNode(); - if (_selectorVec.size() == 0) { + if (_store->children().empty()) { _document->getReprRoot()->removeChild(_styleChild); _styleExists = false; } @@ -592,7 +566,10 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) else { std::string sel, key, value; std::vector::iterator it; - for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it ) { + Gtk::TreeModel::Row parentRow = *(row).parent(); + Glib::ustring parentKey = parentRow[_mColumns._selectorLabel]; + + for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it) { sel = (*it)._xmlContent; REMOVE_SPACES(sel); if (!sel.empty()) { @@ -604,26 +581,28 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) } } - Gtk::TreeModel::Row parentRow = *(row.parent()); - Glib::ustring parentKey = parentRow[_mColumns._selectorLabel]; - - if (key[0] == '#') { - std::string s = parentKey; - Glib::ustring toDelRow = row[_mColumns._selectorLabel]; - std::string toDelKey = toDelRow; - std::size_t idFound = s.find(toDelKey); - if (idFound != std::string::npos) { - if (idFound == 0) { - s.erase(idFound, toDelKey.length()+1); - parentKey = s; - parentRow[_mColumns._selectorLabel] = parentKey; - (*it)._xmlContent.erase(idFound, toDelKey.length()); - } - else { - s.erase(idFound-2, toDelKey.length()+2); - parentKey = s; - parentRow[_mColumns._selectorLabel] = parentKey; - (*it)._xmlContent.erase(idFound-2, toDelKey.length()+2); + std::string matchSelector = parentKey; + REMOVE_SPACES(matchSelector); + if (key == matchSelector) { + if (key[0] == '#') { + std::string s = parentKey; + Glib::ustring toDelRow = row[_mColumns._selectorLabel]; + std::string toDelKey = toDelRow; + std::size_t idFound = s.find(toDelKey); + if (idFound != std::string::npos) { + if (idFound == 0) { + s.erase(idFound, toDelKey.length()+1); + parentKey = s; + parentRow[_mColumns._selectorLabel] = parentKey; + (*it)._xmlContent.erase(idFound, toDelKey.length()); + } + else { + s.erase(idFound-2, toDelKey.length()+2); + parentKey = s; + parentRow[_mColumns._selectorLabel] = parentKey; + (*it)._xmlContent.erase(idFound-2, toDelKey. + length()+2); + } } } } @@ -641,6 +620,10 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) } } } + + if (parentKey.empty()) { + (*it)._xmlContent = ""; + } } if (_styleChild) { @@ -650,7 +633,16 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) _styleChild = _styleElementNode(); _updateStyleContent(); } + _store->erase(row); + if (parentKey.empty()) { + _store->erase(parentRow); + } + + if (parentKey.empty() && _store->children().empty()) { + _document->getReprRoot()->removeChild(_styleChild); + _styleExists = false; + } } } } @@ -711,19 +703,21 @@ void StyleDialog::_selAdd(Gtk::TreeModel::Row row) } } - REMOVE_SPACES((*it)._selector); - if ("#" + std::string(obj->getId()) != selectorName) { - inkSelector._selector = (*it)._selector; - inkSelector._selector.append(", #" + std::string(obj->getId())); - } - - inkSelector._xmlContent = inkSelector._selector + "{" + value + "}"; - if (selectorName != childrow[_mColumns._selectorLabel]) { - row[_mColumns._selectorLabel] = selectorName + ", " + - childrow[_mColumns._selectorLabel]; + Glib::ustring selectedRowLabel = row[_mColumns._selectorLabel]; + std::string matchSelector = selectedRowLabel; + REMOVE_SPACES(matchSelector); + if (key == matchSelector) { + REMOVE_SPACES((*it)._selector); + if ("#" + std::string(obj->getId()) != selectorName) { + inkSelector._selector = (*it)._selector; + inkSelector._selector.append(", #" + std::string(obj->getId())); + inkSelector._xmlContent = inkSelector._selector + "{" + value + "}\n"; + row[_mColumns._selectorLabel] = selectorName + ", " + + childrow[_mColumns._selectorLabel]; + } + it = _selectorVec.erase(it); + it = _selectorVec.insert(it, inkSelector); } - it = _selectorVec.erase(it); - it = _selectorVec.insert(it, inkSelector); } // if (selectorName[0] == '.') { -- cgit v1.2.3 From 0cb42f2ea44a9d5da0c3a3ff5cca6fa82511d81b Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Fri, 19 Aug 2016 13:23:45 +0530 Subject: Pass remaining simple class selector tests (bzr r14949.1.74) --- src/ui/dialog/styledialog.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index e9b00bf1c..878ab1926 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -671,11 +671,14 @@ void StyleDialog::_selAdd(Gtk::TreeModel::Row row) obj->setAttribute("class", key.erase(0,1)); } else { - obj->setAttribute("class", std::string - (obj->getRepr()-> - attribute("class")) - + " " + key - .erase(0,1)); + if (obj->getRepr()->attribute("class") != key + .erase(0,1)) { + obj->setAttribute("class", std::string + (obj->getRepr()-> + attribute("class")) + + " " + key + .erase(0,1)); + } } } } @@ -708,21 +711,23 @@ void StyleDialog::_selAdd(Gtk::TreeModel::Row row) REMOVE_SPACES(matchSelector); if (key == matchSelector) { REMOVE_SPACES((*it)._selector); - if ("#" + std::string(obj->getId()) != selectorName) { - inkSelector._selector = (*it)._selector; - inkSelector._selector.append(", #" + std::string(obj->getId())); - inkSelector._xmlContent = inkSelector._selector + "{" + value + "}\n"; - row[_mColumns._selectorLabel] = selectorName + ", " + - childrow[_mColumns._selectorLabel]; + if (selectorName[0] == '#') { + if ("#" + std::string(obj->getId()) != selectorName) { + inkSelector._selector = (*it)._selector; + inkSelector._selector.append(", #" + std::string(obj->getId())); + inkSelector._xmlContent = inkSelector._selector + "{" + value + "}\n"; + row[_mColumns._selectorLabel] = selectorName + ", " + + childrow[_mColumns._selectorLabel]; + } + } + else if (selectorName[0] == '.') { + inkSelector._xmlContent = (*it)._selector + "{" + value + "}\n"; } + it = _selectorVec.erase(it); it = _selectorVec.insert(it, inkSelector); } } - -// if (selectorName[0] == '.') { -// inkSelector._xmlContent = ""; -// } } if (_styleElementNode()) { _styleChild = _styleElementNode(); -- cgit v1.2.3 From bb2023c0d4971e15f12394b85dc52b8ae49225eb Mon Sep 17 00:00:00 2001 From: kamalpreetgrewal Date: Sat, 20 Aug 2016 12:39:45 +0530 Subject: Add some more comments to improve code understanding (bzr r14949.1.75) --- src/ui/dialog/cssdialog.cpp | 29 ++++++++--- src/ui/dialog/cssdialog.h | 10 ++-- src/ui/dialog/styledialog.cpp | 116 ++++++++++++++++++++++++------------------ src/ui/dialog/styledialog.h | 11 ++-- 4 files changed, 100 insertions(+), 66 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/cssdialog.cpp b/src/ui/dialog/cssdialog.cpp index cd2f74d15..fa266b012 100644 --- a/src/ui/dialog/cssdialog.cpp +++ b/src/ui/dialog/cssdialog.cpp @@ -35,13 +35,17 @@ void CssDialog::_styleButton(Gtk::Button& btn, char const* iconName, gtk_widget_show(child); btn.add(*manage(Glib::wrap(child))); btn.set_relief(Gtk::RELIEF_NONE); - btn.set_tooltip_text (tooltip); + btn.set_tooltip_text(tooltip); } /** * Constructor * A treeview whose each row corresponds to a CSS property of selector selected. - * TODO: Further, buttons to add and delete properties will be added. + * New CSS property can be added by clicking '+' at bottom of the CSS pane. '-' + * in front of the CSS property row can be clicked to delete the CSS property. + * Besides clicking on an already selected property row makes the property editable + * and clicking 'Enter' updates the property with changes reflected in the + * drawing. */ CssDialog::CssDialog(): UI::Widget::Panel("", "/dialogs/css", SP_VERB_DIALOG_CSS), @@ -56,14 +60,14 @@ CssDialog::CssDialog(): _store = Gtk::ListStore::create(_cssColumns); _treeView.set_model(_store); - Inkscape::UI::Widget::AddToIcon * addRenderer = manage( - new Inkscape::UI::Widget::AddToIcon() ); + Inkscape::UI::Widget::AddToIcon * addRenderer = manage(new Inkscape::UI:: + Widget::AddToIcon()); addRenderer->property_active() = false; int addCol = _treeView.append_column("Unset Property", *addRenderer) - 1; Gtk::TreeViewColumn *col = _treeView.get_column(addCol); - if ( col ) { - col->add_attribute( addRenderer->property_active(), _cssColumns._colUnsetProp); + if (col) { + col->add_attribute(addRenderer->property_active(), _cssColumns._colUnsetProp); } _textRenderer = Gtk::manage(new Gtk::CellRendererText()); _textRenderer->property_editable() = true; @@ -71,7 +75,7 @@ CssDialog::CssDialog(): int nameColNum = _treeView.append_column("Property", *_textRenderer) - 1; _propCol = _treeView.get_column(nameColNum); - create = manage(new Gtk::Button()); + Gtk::Button* create = manage(new Gtk::Button()); _styleButton(*create, "list-add", "Add a new property"); _mainBox.pack_end(_buttonBox, Gtk::PACK_SHRINK); @@ -85,12 +89,21 @@ CssDialog::CssDialog(): create->signal_clicked().connect(sigc::mem_fun(*this, &CssDialog::_addProperty)); } +/** + * @brief CssDialog::~CssDialog + * Class destructor + */ CssDialog::~CssDialog() { setDesktop(NULL); } -void CssDialog::setDesktop( SPDesktop* desktop ) +/** + * @brief CssDialog::setDesktop + * @param desktop + * This function sets the 'desktop' for the CSS pane. + */ +void CssDialog::setDesktop(SPDesktop* desktop) { _desktop = desktop; } diff --git a/src/ui/dialog/cssdialog.h b/src/ui/dialog/cssdialog.h index ef48686cc..3bbab5031 100644 --- a/src/ui/dialog/cssdialog.h +++ b/src/ui/dialog/cssdialog.h @@ -26,7 +26,10 @@ namespace Dialog { /** * @brief The CssDialog class - * A list of CSS properties will show up in this dialog. + * This dialog allows to add, delete and modify CSS properties for selectors + * created in Style Dialog. Double clicking any selector in Style dialog, a list + * of CSS properties will show up in this dialog (if any exist), else new properties + * can be added and each new property forms a new row in this pane. */ class CssDialog : public UI::Widget::Panel { @@ -35,7 +38,7 @@ public: ~CssDialog(); static CssDialog &getInstance() { return *new CssDialog(); } - void setDesktop( SPDesktop* desktop); + void setDesktop(SPDesktop* desktop); class CssColumns : public Gtk::TreeModel::ColumnRecord { @@ -58,10 +61,9 @@ public: Gtk::CellRendererText *_textRenderer; Gtk::TreeViewColumn *_propCol; Glib::ustring _editedProp; - Gtk::Button* create; bool _newProperty; - void _styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip); + void _styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip); void _addProperty(); }; diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 878ab1926..5246290b4 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -21,6 +21,10 @@ using Inkscape::Util::List; using Inkscape::XML::AttributeRecord; +/** + * This macro is used to remove spaces around selectors or any strings when + * parsing is done to update XML style element or row labels in this dialog. + */ #define REMOVE_SPACES(x) x.erase(0, x.find_first_not_of(' ')); \ x.erase(x.find_last_not_of(' ') + 1); @@ -48,7 +52,8 @@ void StyleDialog::_styleButton(Gtk::Button& btn, char const* iconName, /** * Constructor * A treeview and a set of two buttons are added to the dialog. _addSelector - * adds selectors to treeview. Currently, delete button is disabled. + * adds selectors to treeview. _delSelector deletes the selector from the dialog. + * Any addition/deletion of the selectors updates XML style element accordingly. */ StyleDialog::StyleDialog() : UI::Widget::Panel("", "/dialogs/style", SP_VERB_DIALOG_STYLE), @@ -127,11 +132,20 @@ StyleDialog::StyleDialog() : _selChanged)); } +/** + * @brief StyleDialog::~StyleDialog + * Class destructor + */ StyleDialog::~StyleDialog() { setDesktop(NULL); } +/** + * @brief StyleDialog::setDesktop + * @param desktop + * This function sets the 'desktop' for the Style Dialog. + */ void StyleDialog::setDesktop( SPDesktop* desktop ) { Panel::setDesktop(desktop); @@ -182,10 +196,9 @@ void StyleDialog::_addSelector() /** * @brief selectorName - * This string stores selector name. If '#' or a '.' is present in the - * beginning of string, text from entrybox is saved directly as name for - * selector. If text like 'red' is written in entrybox, it is prefixed - * with a dot. + * This string stores selector name. The text from entrybox is saved as name + * for selector. If the entrybox is empty, the text (thus selectorName) is + * set to ".Class1" */ if (!textEditPtr->get_text().empty()) { _selectorName = textEditPtr->get_text(); @@ -290,7 +303,6 @@ void StyleDialog::_addSelector() Inkscape::GC::release(newChild); _styleChild = newChild; } - _selAdd(row); } @@ -581,6 +593,12 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) } } + /** + * @brief matchSelector + * For id selectors, whenever any child row is deleted, + * the row label is updated and so is the entry for the + * selector in style element. + */ std::string matchSelector = parentKey; REMOVE_SPACES(matchSelector); if (key == matchSelector) { @@ -635,6 +653,15 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) } _store->erase(row); + + /** + * On continuous deletion of objects (child rows) from the + * selector (parent row), if the parent row has no child, then + * the row is erased from the _store. Further if there is no + * row left in _store, which implies there is no content in + * XML style element, then the 'svg:style' element is also + * removed. + */ if (parentKey.empty()) { _store->erase(parentRow); } @@ -650,6 +677,12 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) return false; } +/** + * @brief StyleDialog::_selAdd + * @param row + * This routine is called when an object is added to a selector by clicking on + * '+' in front of the row with selector's label. + */ void StyleDialog::_selAdd(Gtk::TreeModel::Row row) { Glib::ustring selectorName; @@ -879,44 +912,43 @@ void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& /** If a new property is added, existing value is appended with new * property, else replacements in value are done in the 'else' block. */ - if (_cssPane->_newProperty) { - if (!new_text.empty()) { - value.append((new_text + ";").c_str()); - _cssPane->_propCol->add_attribute(_cssPane->_textRenderer - ->property_text(), - _cssPane->_cssColumns - ._propertyLabel); - _cssPane->_newProperty = false; + if (_cssPane->_newProperty) { + if (!new_text.empty()) { + value.append((new_text + ";").c_str()); + _cssPane->_propCol->add_attribute(_cssPane->_textRenderer + ->property_text(), + _cssPane->_cssColumns + ._propertyLabel); + _cssPane->_newProperty = false; + } } - } - else { - std::stringstream ss(value); - std::string token, editedToken; - std::size_t found = value.find(";"); - if (found!=std::string::npos) { - while(std::getline(ss, token, ';')) { - REMOVE_SPACES(token); - if (!token.empty()) { - if (token.substr(0, token.find(":")) == _cssPane - ->_editedProp.substr(0, _cssPane->_editedProp - .find(":"))) { - editedToken = _cssPane->_editedProp; - size_t startPos = value.find(token); - value.replace(startPos, token.length(), editedToken); + else { + std::stringstream ss(value); + std::string token, editedToken; + std::size_t found = value.find(";"); + if (found!=std::string::npos) { + while(std::getline(ss, token, ';')) { + REMOVE_SPACES(token); + if (!token.empty()) { + if (token.substr(0, token.find(":")) == _cssPane + ->_editedProp.substr(0, _cssPane->_editedProp + .find(":"))) { + editedToken = _cssPane->_editedProp; + size_t startPos = value.find(token); + value.replace(startPos, token.length(), editedToken); + } } } } } - } - value.erase(std::remove(value.begin(), value.end(), '\n'), value.end()); - (*it)._xmlContent = key + "{" + value + "}\n"; - _updateStyleContent(); + value.erase(std::remove(value.begin(), value.end(), '\n'), value.end()); + (*it)._xmlContent = key + "{" + value + "}\n"; + _updateStyleContent(); } } } } - /** * @brief StyleDialog::_delProperty * @param event @@ -1067,27 +1099,11 @@ void StyleDialog::_selectRow(Selection */*sel*/) iter != children.end(); ++iter) { Gtk::TreeModel::Row row = *iter; std::vector objVec = row[_mColumns._colObj]; - std::vector childObjVec; - Gtk::TreeModel::Row childRow; - for (unsigned i = 0; i < objVec.size(); ++i) { if (obj->getId() == objVec[i]->getId()) { _treeView.get_selection()->select(row); } } - -// if (row.children()) { -// for(Gtk::TreeModel::Children::iterator it = row.children().begin(); -// it != row.children().end(); ++it) { -// childRow = *it; -// childObjVec = childRow[_mColumns._colObj]; -// } -// for (unsigned j = 0; j < childObjVec.size(); ++j) { -// if (obj->getId() == childObjVec[j]->getId()) { -// _treeView.get_selection()->select(childRow); -// } -// } -// } } } else { diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index af3014f88..b03a1d2e1 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -30,7 +30,10 @@ namespace Dialog { /** * @brief The StyleDialog class - * A list of CSS selectors will show up in this dialog. + * A list of CSS selectors will show up in this dialog. This dialog allows to + * add and delete selectors. Objects can be added to and removed from the selectors + * in the dialog. Besides, selection of any selector row selects the matching + * objects in the drawing and vice-versa. */ typedef std::pair >, std::string> _selectorVecType; @@ -42,11 +45,11 @@ public: ~StyleDialog(); static StyleDialog &getInstance() { return *new StyleDialog(); } - void setDesktop( SPDesktop* desktop); + void setDesktop(SPDesktop* desktop); private: - void _styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip); - std::string _setClassAttribute(std::vector); + void _styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip); + std::string _setClassAttribute(std::vector); class InkSelector { public: -- cgit v1.2.3 From 4f0e9e1e2b91c661060f1dcd45deb3dc53c72093 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 29 Aug 2016 14:30:41 +0200 Subject: Don't write out sodipodi:line-spacing. Don't read if 'line-height' already set. Partial fix for #1590141. (bzr r15085) --- src/ui/dialog/text-edit.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 50c6c1553..9efbcf6a8 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -505,9 +505,7 @@ SPCSSAttr *TextEdit::fillTextStyle () sp_repr_css_set_property (css, "writing-mode", "tb"); } - // Note that SVG 1.1 does not support line-height; we set it for consistency, but also set - // sodipodi:linespacing for backwards compatibility; in 1.2 we use line-height for flowtext - + // Note that SVG 1.1 does not support line-height but we use it. const gchar *sstr = gtk_combo_box_text_get_active_text ((GtkComboBoxText *) spacing_combo); sp_repr_css_set_property (css, "line-height", sstr); @@ -542,18 +540,11 @@ void TextEdit::onApply() SPCSSAttr *css = fillTextStyle (); sp_desktop_set_style(desktop, css, true); - for(auto i=item_list.begin();i!=item_list.end();++i){ + for(auto i=item_list.begin();i!=item_list.end();++i){ // apply style to the reprs of all text objects in the selection - if (SP_IS_TEXT (*i)) { - - // backwards compatibility: - (*i)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL)); - + if (SP_IS_TEXT (*i) || (SP_IS_FLOWTEXT (*i)) ) { ++items; } - else if (SP_IS_FLOWTEXT (*i)) - // no need to set sodipodi:linespacing, because Inkscape never supported it on flowtext - ++items; } if (items == 0) { -- cgit v1.2.3 From e1a84ff6c44588f7847258b5eb5266365e0738e1 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Aug 2016 15:27:55 +0200 Subject: Fixes to helper paths. evaluate backport to 0.92.x (bzr r15086) --- src/ui/tools/node-tool.cpp | 20 ++++++++++++++------ src/ui/tools/node-tool.h | 1 + 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index f7f09610c..99c98476f 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -158,6 +158,9 @@ NodeTool::~NodeTool() { if (this->helperpath_tmpitem) { this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); } + if (this->helperpath_tmpitem_highlight) { + this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem_highlight); + } this->_selection_changed_connection.disconnect(); //this->_selection_modified_connection.disconnect(); this->_mouseover_changed_connection.disconnect(); @@ -238,13 +241,13 @@ void NodeTool::setup() { ); this->helperpath_tmpitem = NULL; + this->helperpath_tmpitem_highlight = NULL; this->cursor_drag = false; this->show_transform_handles = true; this->single_node_transform_handles = false; this->flash_tempitem = NULL; this->flashed_item = NULL; this->_last_over = NULL; - this->helperpath_tmpitem = NULL; // read prefs before adding items to selection to prevent momentarily showing the outline sp_event_context_read(this, "show_handles"); @@ -271,7 +274,7 @@ void NodeTool::setup() { } this->desktop->emitToolSubselectionChanged(NULL); // sets the coord entry fields to inactive - this->update_helperpath(); + update_helperpath(); } // show helper paths of the applied LPE, if any @@ -282,6 +285,10 @@ void NodeTool::update_helperpath () { this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); this->helperpath_tmpitem = NULL; } + if (this->helperpath_tmpitem_highlight) { + this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem_highlight); + this->helperpath_tmpitem_highlight = NULL; + } if (SP_IS_LPE_ITEM(selection->singleItem())) { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); @@ -305,6 +312,11 @@ void NodeTool::update_helperpath () { cc->reset(); } if (!c->is_empty()) { + SPCanvasItem *helperpath_highlight = sp_canvas_bpath_new(this->desktop->getTempGroup(), c); + sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath_highlight), 0xffffff9A, 2.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); + sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath_highlight), 0, SP_WIND_RULE_NONZERO); + sp_canvas_item_affine_absolute(helperpath_highlight, selection->singleItem()->i2dt_affine()); + this->helperpath_tmpitem_highlight = this->desktop->add_temporary_canvasitem(helperpath_highlight, 0); SPCanvasItem *helperpath = sp_canvas_bpath_new(this->desktop->getTempGroup(), c); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath), 0x0000ff9A, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath), 0, SP_WIND_RULE_NONZERO); @@ -468,13 +480,10 @@ bool NodeTool::root_handler(GdkEvent* event) { if (this->_selected_nodes->event(this, event)) { return true; } - switch (event->type) { case GDK_MOTION_NOTIFY: { - this->update_helperpath(); combine_motion_events(desktop->canvas, event->motion, 0); - this->update_helperpath(); SPItem *over_item = sp_event_context_find_item (desktop, event_point(event->button), FALSE, TRUE); @@ -629,7 +638,6 @@ bool NodeTool::root_handler(GdkEvent* event) { void NodeTool::update_tip(GdkEvent *event) { using namespace Inkscape::UI; - if (event && (event->type == GDK_KEY_PRESS || event->type == GDK_KEY_RELEASE)) { unsigned new_state = state_after_event(event); diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h index 8342d66a6..bebb26dfc 100644 --- a/src/ui/tools/node-tool.h +++ b/src/ui/tools/node-tool.h @@ -69,6 +69,7 @@ private: SPItem *flashed_item; Inkscape::Display::TemporaryItem *helperpath_tmpitem; + Inkscape::Display::TemporaryItem *helperpath_tmpitem_highlight; Inkscape::Display::TemporaryItem *flash_tempitem; Inkscape::UI::Selector* _selector; Inkscape::UI::PathSharedData* _path_data; -- cgit v1.2.3 From 3a70c702b97414c4508c6871462d1fa4f1433ad7 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Aug 2016 18:15:30 +0200 Subject: Add comment and fix in helper paths (bzr r15087) --- src/ui/tools/node-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 99c98476f..c266db05c 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -274,7 +274,7 @@ void NodeTool::setup() { } this->desktop->emitToolSubselectionChanged(NULL); // sets the coord entry fields to inactive - update_helperpath(); + this->update_helperpath(); } // show helper paths of the applied LPE, if any -- cgit v1.2.3 From 0e90df42ad8299b0a42435fb4445f83bc4ddbbfd Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Aug 2016 19:35:32 +0200 Subject: Fix a bug in pattern along path at first edit node after applied. Backport it to 0.92 (bzr r15089) --- src/ui/tools/freehand-base.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/ui') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index eb29ed88d..7382c37ea 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -212,6 +212,19 @@ static void spdc_paste_curve_as_freehand_shape(Geom::PathVector const &newpath, Effect::createAndApply(PATTERN_ALONG_PATH, dc->desktop->doc(), item); Effect* lpe = SP_LPE_ITEM(item)->getCurrentLPE(); static_cast(lpe)->pattern.set_new_value(newpath,true); + + // write pattern along path parameters: + lpe->getRepr()->setAttribute("copytype", "single_stretched"); + lpe->getRepr()->setAttribute("fuse_tolerance", "0"); + lpe->getRepr()->setAttribute("is_visible", "true"); + lpe->getRepr()->setAttribute("normal_offset", "0"); + lpe->getRepr()->setAttribute("prop_scale", "1"); + lpe->getRepr()->setAttribute("prop_units", "false"); + lpe->getRepr()->setAttribute("scale_y_rel", "false"); + lpe->getRepr()->setAttribute("spacing", "0"); + lpe->getRepr()->setAttribute("tang_offset", "0"); + lpe->getRepr()->setAttribute("vertical_pattern", "false"); + } static void spdc_apply_powerstroke_shape(const std::vector & points, FreehandBase *dc, SPItem *item) -- cgit v1.2.3 From 1b8b972f1e0d6ee32c1f85514ec334c654d1e29c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Aug 2016 22:39:07 +0200 Subject: Partial fix for bug 172063 while we find a better solution for XOR in helper lines (bzr r15090) --- src/ui/control-manager.cpp | 8 ++++---- src/ui/tools/calligraphic-tool.cpp | 8 ++++---- src/ui/tools/connector-tool.cpp | 6 +++--- src/ui/tools/eraser-tool.cpp | 6 +++--- src/ui/tools/node-tool.cpp | 15 +-------------- src/ui/tools/node-tool.h | 1 - src/ui/tools/pen-tool.cpp | 22 +++++++++++----------- src/ui/tools/pencil-tool.cpp | 2 +- 8 files changed, 27 insertions(+), 41 deletions(-) (limited to 'src/ui') diff --git a/src/ui/control-manager.cpp b/src/ui/control-manager.cpp index 973625574..d0285e467 100644 --- a/src/ui/control-manager.cpp +++ b/src/ui/control-manager.cpp @@ -148,7 +148,7 @@ ControlManagerImpl::ControlManagerImpl(ControlManager &manager) : _ctrlToShape[CTRL_TYPE_NODE_AUTO] = SP_CTRL_SHAPE_CIRCLE; _ctrlToShape[CTRL_TYPE_NODE_SYMETRICAL] = SP_CTRL_SHAPE_SQUARE; - _ctrlToShape[CTRL_TYPE_ADJ_HANDLE] = SP_CTRL_SHAPE_CIRCLE; + _ctrlToShape[CTRL_TYPE_ADJ_HANDLE] =SP_CTRL_SHAPE_CIRCLE; _ctrlToShape[CTRL_TYPE_INVISIPOINT] = SP_CTRL_SHAPE_SQUARE; // ------- @@ -222,10 +222,10 @@ SPCanvasItem *ControlManagerImpl::createControl(SPCanvasGroup *parent, ControlTy { case CTRL_TYPE_ADJ_HANDLE: item = sp_canvas_item_new(parent, SP_TYPE_CTRL, - "shape", SP_CTRL_SHAPE_CIRCLE, + "shape",SP_CTRL_SHAPE_CIRCLE, "size", targetSize, - "filled", 0, - "fill_color", 0xff00007f, + "filled", 1, + "fill_color", 0xffffff7f, "stroked", 1, "stroke_color", 0x0000ff7f, NULL); diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp index d623035d9..9b4dbb1a2 100644 --- a/src/ui/tools/calligraphic-tool.cpp +++ b/src/ui/tools/calligraphic-tool.cpp @@ -135,7 +135,7 @@ void CalligraphicTool::setup() { SPCurve *c = new SPCurve(path); - this->hatch_area = sp_canvas_bpath_new(this->desktop->getControls(), c); + this->hatch_area = sp_canvas_bpath_new(this->desktop->getControls(), c, true); c->unref(); @@ -1090,7 +1090,7 @@ void CalligraphicTool::fit_and_split(bool release) { add_cap(this->currentcurve, b2[0], b1[0], this->cap_rounding); } this->currentcurve->closepath(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->currentshape), this->currentcurve); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->currentshape), this->currentcurve, true); } /* Current calligraphic */ @@ -1126,7 +1126,7 @@ void CalligraphicTool::fit_and_split(bool release) { SP_TYPE_CANVAS_BPATH, NULL); SPCurve *curve = this->currentcurve->copy(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH (cbp), curve); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH (cbp), curve, true); curve->unref(); guint32 fillColor = sp_desktop_get_color_tool (desktop, "/tools/calligraphic", true); @@ -1170,7 +1170,7 @@ void CalligraphicTool::draw_temporary_box() { } this->currentcurve->closepath(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->currentshape), this->currentcurve); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->currentshape), this->currentcurve, true); } } diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp index 84f7f318c..7e6fb4b72 100644 --- a/src/ui/tools/connector-tool.cpp +++ b/src/ui/tools/connector-tool.cpp @@ -620,7 +620,7 @@ bool ConnectorTool::_handleMotionNotify(GdkEventMotion const &mevent) { this->red_curve = path->get_curve_for_edit(); this->red_curve->transform(i2d); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve, true); ret = true; break; } @@ -811,7 +811,7 @@ void ConnectorTool::_setSubsequentPoint(Geom::Point const p) { // Recreate curve from libavoid route. recreateCurve( this->red_curve, this->newConnRef, this->curvature ); this->red_curve->transform(desktop->doc2dt()); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve, true); } @@ -1035,7 +1035,7 @@ endpt_handler(SPKnot */*knot*/, GdkEvent *event, ConnectorTool *cc) cc->red_curve = SP_PATH(cc->clickeditem)->get_curve_for_edit(); Geom::Affine i2d = (cc->clickeditem)->i2dt_affine(); cc->red_curve->transform(i2d); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), cc->red_curve); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), cc->red_curve, true); cc->clickeditem->setHidden(true); diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index d18db8266..4b40262cd 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -943,7 +943,7 @@ void EraserTool::fit_and_split(bool release) { } this->currentcurve->closepath(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->currentshape), this->currentcurve); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->currentshape), this->currentcurve, true); } /* Current eraser */ @@ -980,7 +980,7 @@ void EraserTool::fit_and_split(bool release) { SPCanvasItem *cbp = sp_canvas_item_new(desktop->getSketch(), SP_TYPE_CANVAS_BPATH, NULL); SPCurve *curve = this->currentcurve->copy(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH (cbp), curve); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH (cbp), curve, true); curve->unref(); guint32 fillColor = sp_desktop_get_color_tool (desktop, "/tools/eraser", true); @@ -1029,7 +1029,7 @@ void EraserTool::draw_temporary_box() { } this->currentcurve->closepath(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->currentshape), this->currentcurve); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->currentshape), this->currentcurve, true); } } diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index c266db05c..b4fc569bb 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -158,9 +158,6 @@ NodeTool::~NodeTool() { if (this->helperpath_tmpitem) { this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); } - if (this->helperpath_tmpitem_highlight) { - this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem_highlight); - } this->_selection_changed_connection.disconnect(); //this->_selection_modified_connection.disconnect(); this->_mouseover_changed_connection.disconnect(); @@ -241,7 +238,6 @@ void NodeTool::setup() { ); this->helperpath_tmpitem = NULL; - this->helperpath_tmpitem_highlight = NULL; this->cursor_drag = false; this->show_transform_handles = true; this->single_node_transform_handles = false; @@ -285,10 +281,6 @@ void NodeTool::update_helperpath () { this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); this->helperpath_tmpitem = NULL; } - if (this->helperpath_tmpitem_highlight) { - this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem_highlight); - this->helperpath_tmpitem_highlight = NULL; - } if (SP_IS_LPE_ITEM(selection->singleItem())) { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); @@ -312,12 +304,7 @@ void NodeTool::update_helperpath () { cc->reset(); } if (!c->is_empty()) { - SPCanvasItem *helperpath_highlight = sp_canvas_bpath_new(this->desktop->getTempGroup(), c); - sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath_highlight), 0xffffff9A, 2.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); - sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath_highlight), 0, SP_WIND_RULE_NONZERO); - sp_canvas_item_affine_absolute(helperpath_highlight, selection->singleItem()->i2dt_affine()); - this->helperpath_tmpitem_highlight = this->desktop->add_temporary_canvasitem(helperpath_highlight, 0); - SPCanvasItem *helperpath = sp_canvas_bpath_new(this->desktop->getTempGroup(), c); + SPCanvasItem *helperpath = sp_canvas_bpath_new(this->desktop->getTempGroup(), c, true); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath), 0x0000ff9A, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath), 0, SP_WIND_RULE_NONZERO); sp_canvas_item_affine_absolute(helperpath, selection->singleItem()->i2dt_affine()); diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h index bebb26dfc..8342d66a6 100644 --- a/src/ui/tools/node-tool.h +++ b/src/ui/tools/node-tool.h @@ -69,7 +69,6 @@ private: SPItem *flashed_item; Inkscape::Display::TemporaryItem *helperpath_tmpitem; - Inkscape::Display::TemporaryItem *helperpath_tmpitem_highlight; Inkscape::Display::TemporaryItem *flash_tempitem; Inkscape::UI::Selector* _selector; Inkscape::UI::PathSharedData* _path_data; diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 49f28ad2c..b7579b1fb 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -865,7 +865,7 @@ void PenTool::_redrawAll() { this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data); } // one canvas bpath for all of green_curve - SPCanvasItem *canvas_shape = sp_canvas_bpath_new(this->desktop->getSketch(), this->green_curve); + SPCanvasItem *canvas_shape = sp_canvas_bpath_new(this->desktop->getSketch(), this->green_curve, true); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(canvas_shape), this->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(canvas_shape), 0, SP_WIND_RULE_NONZERO); @@ -877,7 +877,7 @@ void PenTool::_redrawAll() { this->red_curve->reset(); this->red_curve->moveto(this->p[0]); this->red_curve->curveto(this->p[1], this->p[2], this->p[3]); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve, true); // handles // hide the handlers in bspline and spiro modes @@ -1251,10 +1251,10 @@ bool PenTool::_handleKeyPress(GdkEvent *event) { void PenTool::_resetColors() { // Red this->red_curve->reset(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL, true); // Blue this->blue_curve->reset(); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->blue_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->blue_bpath), NULL, true); // Green while (this->green_bpaths) { sp_canvas_item_destroy(SP_CANVAS_ITEM(this->green_bpaths->data)); @@ -1277,7 +1277,7 @@ void PenTool::_setInitialPoint(Geom::Point const p) { this->p[0] = p; this->p[1] = p; this->npoints = 2; - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL, true); this->desktop->canvas->forceFullRedrawAfterInterruptions(5); } @@ -1343,7 +1343,7 @@ void PenTool::_bsplineSpiroColor() this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data); } // one canvas bpath for all of green_curve - SPCanvasItem *canvas_shape = sp_canvas_bpath_new(this->desktop->getSketch(), this->green_curve); + SPCanvasItem *canvas_shape = sp_canvas_bpath_new(this->desktop->getSketch(), this->green_curve, true); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(canvas_shape), this->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(canvas_shape), 0, SP_WIND_RULE_NONZERO); this->green_bpaths = g_slist_prepend(this->green_bpaths, canvas_shape); @@ -1701,7 +1701,7 @@ void PenTool::_bsplineSpiroBuild() }else{ this->red_curve->curveto(this->p[1],this->p[2],this->p[3]); } - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve, true); curve->append_continuous(this->red_curve, 0.0625); } @@ -1722,7 +1722,7 @@ void PenTool::_bsplineSpiroBuild() LivePathEffect::sp_spiro_do_effect(curve); } - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->blue_bpath), curve); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->blue_bpath), curve, true); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(this->blue_bpath), this->blue_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_item_show(this->blue_bpath); curve->unref(); @@ -1778,7 +1778,7 @@ void PenTool::_setSubsequentPoint(Geom::Point const p, bool statusbar, guint sta } } - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve, true); if (statusbar) { gchar *message = is_curve ? @@ -1818,7 +1818,7 @@ void PenTool::_setCtrl(Geom::Point const p, guint const state) { this->red_curve->reset(); this->red_curve->moveto(this->p[0]); this->red_curve->curveto(this->p[1], this->p[2], this->p[3]); - sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), this->red_curve, true); } SP_CTRL(this->c0)->moveto(this->p[2]); this->cl0 ->setCoords(this->p[3], this->p[2]); @@ -1850,7 +1850,7 @@ void PenTool::_finishSegment(Geom::Point const p, guint const state) { SPCurve *curve = this->red_curve->copy(); /// \todo fixme: - SPCanvasItem *canvas_shape = sp_canvas_bpath_new(this->desktop->getSketch(), curve); + SPCanvasItem *canvas_shape = sp_canvas_bpath_new(this->desktop->getSketch(), curve, true); curve->unref(); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(canvas_shape), this->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index 7cc695040..9e8005be8 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -847,7 +847,7 @@ void PencilTool::_fitAndSplit() { SPCurve *curve = this->red_curve->copy(); /// \todo fixme: - SPCanvasItem *cshape = sp_canvas_bpath_new(this->desktop->getSketch(), curve); + SPCanvasItem *cshape = sp_canvas_bpath_new(this->desktop->getSketch(), curve, true); curve->unref(); this->highlight_color = SP_ITEM(this->desktop->currentLayer())->highlight_color(); -- cgit v1.2.3 From 5cb8c080df223593fbae945178da3e500fe762c6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Aug 2016 23:13:26 +0200 Subject: Add phantom bpath to helper (bzr r15092) --- src/ui/tools/node-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index b4fc569bb..2bd4fdea3 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -523,7 +523,7 @@ bool NodeTool::root_handler(GdkEvent* event) { } c->transform(over_item->i2dt_affine()); - SPCanvasItem *flash = sp_canvas_bpath_new(desktop->getTempGroup(), c); + SPCanvasItem *flash = sp_canvas_bpath_new(desktop->getTempGroup(), c, true); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(flash), //prefs->getInt("/tools/nodes/highlight_color", 0xff0000ff), 1.0, -- cgit v1.2.3 From 42914d527d007236fba7f2a27997d1c7c9dae432 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Tue, 30 Aug 2016 08:27:13 +0200 Subject: [Bug #1447971] User palettes not available if all shared system palettes are deleted from installation. Fixed bugs: - https://launchpad.net/bugs/1447971 (bzr r15093) --- src/ui/dialog/swatches.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 3012c5c26..87bfa9252 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -598,7 +598,7 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : } loadEmUp(); - if ( !systemSwatchPages.empty() ) { + if ( !systemSwatchPages.empty() || !userSwatchPages.empty()) { SwatchPage* first = 0; int index = 0; Glib::ustring targetName; -- cgit v1.2.3 From 161c3be0a1bb7f1cda9116152dea7e3819617fa7 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 1 Sep 2016 14:14:19 +0200 Subject: Comment out line-height setting code in Text and Font dialog as it does not yet handle absolute units. (bzr r15098) --- src/ui/dialog/text-edit.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 9efbcf6a8..a38085c85 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -105,6 +105,7 @@ TextEdit::TextEdit() layout_hbox.pack_start(text_sep, false, false, 10); /* Line Spacing */ + /* Commented out as this does not handle non-percentage values GtkWidget *px = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("text_line_spacing") ); layout_hbox.pack_start(*Gtk::manage(Glib::wrap(px)), false, false); @@ -121,6 +122,7 @@ TextEdit::TextEdit() layout_hbox.pack_start(*Gtk::manage(Glib::wrap(spacing_combo)), false, false); layout_frame.set_padding(4,4,4,4); layout_frame.add(layout_hbox); + */ // Text start Offset { @@ -196,7 +198,7 @@ TextEdit::TextEdit() /* Signal handlers */ g_signal_connect ( G_OBJECT (fontsel), "font_set", G_CALLBACK (onFontChange), this ); - g_signal_connect ( G_OBJECT (spacing_combo), "changed", G_CALLBACK (onLineSpacingChange), this ); + // g_signal_connect ( G_OBJECT (spacing_combo), "changed", G_CALLBACK (onLineSpacingChange), this ); g_signal_connect ( G_OBJECT (text_buffer), "changed", G_CALLBACK (onTextChange), this ); g_signal_connect(startOffset, "changed", G_CALLBACK(onStartOffsetChange), this); setasdefault_button.signal_clicked().connect(sigc::mem_fun(*this, &TextEdit::onSetDefault)); @@ -362,6 +364,7 @@ void TextEdit::onReadSelection ( gboolean dostyle, gboolean /*docontent*/ ) text_vertical.set_active(); } + /* double height; if (query.line_height.normal) height = Inkscape::Text::Layout::LINE_HEIGHT_NORMAL; else if (query.line_height.unit == SP_CSS_UNIT_PERCENT) @@ -371,6 +374,7 @@ void TextEdit::onReadSelection ( gboolean dostyle, gboolean /*docontent*/ ) gtk_entry_set_text ((GtkEntry *) gtk_bin_get_child ((GtkBin *) spacing_combo), sstr); g_free(sstr); + */ // Update font variant widget //int result_variants = @@ -506,8 +510,8 @@ SPCSSAttr *TextEdit::fillTextStyle () } // Note that SVG 1.1 does not support line-height but we use it. - const gchar *sstr = gtk_combo_box_text_get_active_text ((GtkComboBoxText *) spacing_combo); - sp_repr_css_set_property (css, "line-height", sstr); + // const gchar *sstr = gtk_combo_box_text_get_active_text ((GtkComboBoxText *) spacing_combo); + // sp_repr_css_set_property (css, "line-height", sstr); // Font variants vari_vbox.fill_css( css ); -- cgit v1.2.3 From 15986c2286dbc36f42de43e3cb98aad9fc0f16c7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 3 Sep 2016 13:24:49 +1000 Subject: CMake: add missing headers (bzr r15102) --- src/ui/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index edcc41cd2..9e641edc3 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -246,6 +246,7 @@ set(ui_SRC dialog/template-widget.h dialog/text-edit.h dialog/tile.h + dialog/tracedialog.h dialog/transformation.h dialog/undo-history.h dialog/xml-tree.h @@ -273,14 +274,15 @@ set(ui_SRC tools/dropper-tool.h tools/dynamic-base.h tools/eraser-tool.h + tools/flood-tool.h tools/freehand-base.h tools/gradient-tool.h tools/lpe-tool.h tools/measure-tool.h tools/mesh-tool.h tools/node-tool.h - tools/pencil-tool.h tools/pen-tool.h + tools/pencil-tool.h tools/rect-tool.h tools/select-tool.h tools/spiral-tool.h -- cgit v1.2.3 From d16ce258120800e84bfca5c3c687c25177a3137c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 11 Sep 2016 12:10:44 +0200 Subject: Fix bugs: #1621234 and #172137 Fixed bugs: - https://launchpad.net/bugs/172137 - https://launchpad.net/bugs/1621234 (bzr r15111) --- src/ui/tools/freehand-base.cpp | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 7382c37ea..e42336113 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -212,19 +212,10 @@ static void spdc_paste_curve_as_freehand_shape(Geom::PathVector const &newpath, Effect::createAndApply(PATTERN_ALONG_PATH, dc->desktop->doc(), item); Effect* lpe = SP_LPE_ITEM(item)->getCurrentLPE(); static_cast(lpe)->pattern.set_new_value(newpath,true); - - // write pattern along path parameters: - lpe->getRepr()->setAttribute("copytype", "single_stretched"); - lpe->getRepr()->setAttribute("fuse_tolerance", "0"); - lpe->getRepr()->setAttribute("is_visible", "true"); - lpe->getRepr()->setAttribute("normal_offset", "0"); - lpe->getRepr()->setAttribute("prop_scale", "1"); - lpe->getRepr()->setAttribute("prop_units", "false"); - lpe->getRepr()->setAttribute("scale_y_rel", "false"); - lpe->getRepr()->setAttribute("spacing", "0"); - lpe->getRepr()->setAttribute("tang_offset", "0"); - lpe->getRepr()->setAttribute("vertical_pattern", "false"); - + double scale_doc = 1 / dc->desktop->doc()->getDocumentScale()[0]; + Inkscape::SVGOStringStream os; + os << scale_doc; + lpe->getRepr()->setAttribute("prop_scale", os.str().c_str()); } static void spdc_apply_powerstroke_shape(const std::vector & points, FreehandBase *dc, SPItem *item) @@ -341,7 +332,7 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, // "triangle in" std::vector points(1); points[0] = Geom::Point(0., swidth/2); - points[0] *= i2anc_affine(static_cast(item->parent), NULL).inverse(); + //points[0] *= i2anc_affine(static_cast(item->parent), NULL).inverse(); spdc_apply_powerstroke_shape(points, dc, item); shape_applied = true; @@ -353,7 +344,7 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, guint curve_length = curve->get_segment_count(); std::vector points(1); points[0] = Geom::Point(0, swidth/2); - points[0] *= i2anc_affine(static_cast(item->parent), NULL).inverse(); + //points[0] *= i2anc_affine(static_cast(item->parent), NULL).inverse(); points[0][Geom::X] = (double)curve_length; spdc_apply_powerstroke_shape(points, dc, item); @@ -791,16 +782,26 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) if (!dc->white_item) { // Attach repr + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + shapeType shape_selected = (shapeType)prefs->getInt(tool_name(dc) + "/shape", 0); SPItem *item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr)); - - spdc_check_for_and_apply_waiting_LPE(dc, item, c); - if(previous_shape_type != BEND_CLIPBOARD){ - dc->selection->set(repr); + //Bend needs the transforms applied after, Other effects best before + if((previous_shape_type == BEND_CLIPBOARD && shape_selected == LAST_APPLIED) || + shape_selected == BEND_CLIPBOARD) + { + spdc_check_for_and_apply_waiting_LPE(dc, item, c); + previous_shape_type == BEND_CLIPBOARD; } Inkscape::GC::release(repr); item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse(); item->updateRepr(); item->doWriteTransform(item->getRepr(), item->transform, NULL, true); + if((previous_shape_type != BEND_CLIPBOARD || shape_selected != LAST_APPLIED) && + shape_selected != BEND_CLIPBOARD) + { + spdc_check_for_and_apply_waiting_LPE(dc, item, c); + dc->selection->set(repr); + } if(previous_shape_type == BEND_CLIPBOARD){ repr->parent()->removeChild(repr); } -- cgit v1.2.3 From c4bd2a99c8d32c8051a2a36aa5ff4594cacdc195 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 11 Sep 2016 12:57:01 +0200 Subject: Fix compiler warning (bzr r15112) --- src/ui/tools/freehand-base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index e42336113..067035b97 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -790,7 +790,7 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) shape_selected == BEND_CLIPBOARD) { spdc_check_for_and_apply_waiting_LPE(dc, item, c); - previous_shape_type == BEND_CLIPBOARD; + previous_shape_type = BEND_CLIPBOARD; } Inkscape::GC::release(repr); item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse(); -- cgit v1.2.3 From 4988026d95aab5928246ebae4d04f41ae72bc2cf Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Thu, 15 Sep 2016 20:20:36 +0300 Subject: Remove "== true"s (bzr r15100.1.19) --- src/ui/tools/freehand-base.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 067035b97..a7cd39a89 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -372,7 +372,7 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, { // take shape from clipboard; Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); - if(cm->paste(SP_ACTIVE_DESKTOP,true) == true){ + if(cm->paste(SP_ACTIVE_DESKTOP,true)){ SPItem * pasted_clipboard = dc->selection->singleItem(); if(pasted_clipboard){ Inkscape::XML::Node *pasted_clipboard_root = pasted_clipboard->getRepr(); @@ -401,7 +401,7 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, case BEND_CLIPBOARD: { Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); - if(cm->paste(SP_ACTIVE_DESKTOP,true) == true){ + if(cm->paste(SP_ACTIVE_DESKTOP,true)){ gchar const *svgd = item->getRepr()->attribute("d"); bend_item = dc->selection->singleItem(); if(bend_item && (SP_IS_SHAPE(bend_item) || SP_IS_GROUP(bend_item))){ -- cgit v1.2.3 From 0033661a27b63f5438c008ec91232cf8ba45567c Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 24 Sep 2016 13:10:59 +0200 Subject: Get rid of Gtk-CRITICAL **: gtk_text_buffer_emit_insert: assertion 'g_utf8_validate (text, len, NULL)' failed error. (bzr r15128) --- src/ui/dialog/xml-tree.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index eae33ff83..d05c52531 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -790,7 +790,8 @@ void XmlTree::on_attr_row_changed(SPXMLViewAttrList *attributes, const gchar * n void XmlTree::on_attr_unselect_row_clear_text() { attr_name.set_text(""); - attr_value.get_buffer()->set_text("", 0); + // Set text with empty Glib::ustring + attr_value.get_buffer()->set_text( Glib::ustring() ); } void XmlTree::onNameChanged() -- cgit v1.2.3 From 254ebce199dee2763f0afbb115b014691d49a5ae Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Sun, 25 Sep 2016 17:27:11 +0200 Subject: Changed order of selection items Fixed bugs: - https://launchpad.net/bugs/1627250 (bzr r15130) --- src/ui/dialog/align-and-distribute.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index ed9ec3b0a..7ba6df978 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -134,10 +134,10 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) switch (AlignTarget(prefs->getInt("/dialogs/align/align-to", 6))) { case LAST: - focus = SP_ITEM(*selected.begin()); + focus = SP_ITEM(*--(selected.end())); break; case FIRST: - focus = SP_ITEM(*--(selected.end())); + focus = SP_ITEM(*selected.begin()); break; case BIGGEST: focus = selection->largestItem(horiz); -- cgit v1.2.3 From ee2e7c9c9907008de656773b98e1239a7f1af2a9 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sun, 25 Sep 2016 23:59:45 +0200 Subject: Exposes to the user additional PNG settings: Interlacing, grayscale, bit depth, alpha, compression level, PNG pHYs dpi. Fixed bugs: - https://launchpad.net/bugs/170650 (bzr r15131) --- src/ui/dialog/export.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++++---- src/ui/dialog/export.h | 14 +++++++++++ 2 files changed, 70 insertions(+), 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 670e4c8b5..248714a1b 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -145,6 +145,12 @@ Export::Export (void) : browse_image(Gtk::StockID(Gtk::Stock::INDEX), Gtk::ICON_SIZE_BUTTON), batch_box(false, 5), batch_export(_("B_atch export all selected objects"), _("Export each selected object into its own PNG file, using export hints if any (caution, overwrites without asking!)")), + interlacing(_("Use interlacing"),_("Enables ADAM7 interlacing for PNG output. This results in slightly heavier images, but big images will look better sooner when loading the file")), + bitdepth_label(_("Bit depth")), + bitdepth_cb(), + zlib_label(_("Compression")), + zlib_compression(), + phys_label(_("pHYs dpi")), hide_box(false, 5), hide_export(_("Hide a_ll except selected"), _("In the exported image, hide all objects except those that are selected")), closeWhenDone(_("Close when complete"), _("Once the export completes, close this dialog")), @@ -321,6 +327,34 @@ Export::Export (void) : button_box.pack_start(closeWhenDone, true, true, 0 ); button_box.pack_end(export_button, false, false, 0); + /*Advanced*/ + Gtk::Label *label_advanced = Gtk::manage(new Gtk::Label(_("Advanced"),1)); + expander.set_label_widget(*label_advanced); + const char* const modes_list[]={"Gray_1", "Gray_2","Gray_4","Gray_8","Gray_16","RGB_8","RGB_16","GrayAlpha_8","GrayAlpha_16","RGBA_8","RGBA_16"}; + for(int i=0; i<11; ++i) + bitdepth_cb.append(modes_list[i]); + bitdepth_cb.set_active_text("RGBA_8"); + bitdepth_cb.set_hexpand(); + const char* const zlist[]={"Z_NO_COMPRESSION","Z_BEST_SPEED","2","3","4","5","Z_DEFAULT_COMPRESSION","7","8","Z_BEST_COMPRESSION"}; + for(int i=0; i<10; ++i) + zlib_compression.append(zlist[i]); + zlib_compression.set_active_text("Z_DEFAULT_COMPRESSION"); + pHYs_adj = Gtk::Adjustment::create(0, 0, 100000, 0.1, 1.0, 0); + pHYs_sb = Gtk::SpinButton(pHYs_adj, 1.0, 2); + pHYs_sb.set_width_chars(7); + pHYs_sb.set_tooltip_text( _("Will force-set the physical dpi for the png file. Set this to 72 if you're planning to work on your png with Photoshop") ); + zlib_compression.set_hexpand(); + auto table = new Gtk::Grid(); + gtk_container_add(GTK_CONTAINER(expander.gobj()), (GtkWidget*)(table->gobj())); + table->attach(interlacing,0,0,1,1); + table->attach(bitdepth_label,0,1,1,1); + table->attach(bitdepth_cb,1,1,1,1); + table->attach(zlib_label,0,2,1,1); + table->attach(zlib_compression,1,2,1,1); + table->attach(phys_label,0,3,1,1); + table->attach(pHYs_sb,1,3,1,1); + table->show(); + /* Main dialog */ Gtk::Box *contents = _getContents(); contents->set_spacing(0); @@ -329,6 +363,7 @@ Export::Export (void) : contents->pack_start(hide_box); contents->pack_end(button_box, false, 0); contents->pack_end(_prog, Gtk::PACK_EXPAND_WIDGET); + contents->pack_end(expander, FALSE, FALSE,0); /* Signal handlers */ filename_entry.signal_changed().connect( sigc::mem_fun(*this, &Export::onFilenameModified) ); @@ -943,6 +978,18 @@ void Export::onExport () bool exportSuccessful = false; bool hide = hide_export.get_active (); + + // Advanced parameters + bool do_interlace = (interlacing.get_active()); + float pHYs = 0; + int zlib = zlib_compression.get_active_row_number() ; + const char* const modes_list[]={"Gray_1", "Gray_2","Gray_4","Gray_8","Gray_16","RGB_8","RGB_16","GrayAlpha_8","GrayAlpha_16","RGBA_8","RGBA_16"}; + int colortypes[] = {0,0,0,0,0,2,2,4,4,6,6}; //keep in sync with modes_list in Export constructor. values are from libpng doc. + int bitdepths[] = {1,2,4,8,16,8,16,8,16,8,16}; + int color_type = colortypes[bitdepth_cb.get_active_row_number()] ; + int bit_depth = bitdepths[bitdepth_cb.get_active_row_number()] ; + + if (batch_export.get_active ()) { // Batch export of selected objects @@ -987,6 +1034,7 @@ void Export::onExport () if (dpi == 0.0) { dpi = getValue(xdpi_adj); } + pHYs = (pHYs_adj->get_value() > 0.01) ? pHYs_adj->get_value() : dpi; Geom::OptRect area = item->desktopVisualBounds(); if (area) { @@ -1003,11 +1051,12 @@ void Export::onExport () std::vector x; std::vector selected(desktop->getSelection()->items().begin(), desktop->getSelection()->items().end()); if (!sp_export_png_file (doc, path.c_str(), - *area, width, height, dpi, dpi, + *area, width, height, pHYs, pHYs, nv->pagecolor, onProgressCallback, (void*)prog_dlg, TRUE, // overwrite without asking - hide ? selected : x + hide ? selected : x, + do_interlace, color_type, bit_depth, zlib )) { gchar * error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile); @@ -1049,6 +1098,7 @@ void Export::onExport () float const y1 = getValuePx(y1_adj); float const xdpi = getValue(xdpi_adj); float const ydpi = getValue(ydpi_adj); + pHYs = (pHYs_adj->get_value() > 0.01) ? pHYs_adj->get_value() : xdpi; unsigned long int const width = int(getValue(bmwidth_adj) + 0.5); unsigned long int const height = int(getValue(bmheight_adj) + 0.5); @@ -1094,12 +1144,13 @@ void Export::onExport () std::vector x; std::vector selected(desktop->getSelection()->items().begin(), desktop->getSelection()->items().end()); ExportResult status = sp_export_png_file(desktop->getDocument(), path.c_str(), - Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1)), width, height, xdpi, ydpi, + Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1)), width, height, pHYs, pHYs, //previously xdpi, ydpi. nv->pagecolor, onProgressCallback, (void*)prog_dlg, FALSE, - hide ? selected : x - ); + hide ? selected : x, + do_interlace, color_type, bit_depth, zlib + ); if (status == EXPORT_ERROR) { gchar * safeFile = Inkscape::IO::sanitizeString(path.c_str()); gchar * error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile); diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h index a1c44714b..84e1c2362 100644 --- a/src/ui/dialog/export.h +++ b/src/ui/dialog/export.h @@ -13,6 +13,9 @@ #define SP_EXPORT_H #include +#include +#include +#include #include "ui/dialog/desktop-tracker.h" #include "ui/widget/panel.h" @@ -314,6 +317,17 @@ private: Inkscape::UI::Widget::CheckButton closeWhenDone; + /* Advanced */ + Gtk::Expander expander; + Inkscape::UI::Widget::CheckButton interlacing; + Gtk::Label bitdepth_label; + Gtk::ComboBoxText bitdepth_cb; + Gtk::Label zlib_label; + Gtk::ComboBoxText zlib_compression; + Gtk::Label phys_label; + Glib::RefPtr pHYs_adj; + Gtk::SpinButton pHYs_sb; + /* Export Button widgets */ Gtk::HBox button_box; Gtk::Button export_button; -- cgit v1.2.3 From efc66f4403df7128ef6ca2ac98893b477abff9bf Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Mon, 26 Sep 2016 00:50:43 +0200 Subject: minor fix (+ satisfy build bots (?)) (bzr r15132) --- src/ui/dialog/export.cpp | 7 ++++--- src/ui/dialog/export.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 248714a1b..64a5d9866 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -150,7 +150,8 @@ Export::Export (void) : bitdepth_cb(), zlib_label(_("Compression")), zlib_compression(), - phys_label(_("pHYs dpi")), + pHYs_label(_("pHYs dpi")), + pHYs_sb(pHYs_adj, 1.0, 2), hide_box(false, 5), hide_export(_("Hide a_ll except selected"), _("In the exported image, hide all objects except those that are selected")), closeWhenDone(_("Close when complete"), _("Once the export completes, close this dialog")), @@ -340,7 +341,7 @@ Export::Export (void) : zlib_compression.append(zlist[i]); zlib_compression.set_active_text("Z_DEFAULT_COMPRESSION"); pHYs_adj = Gtk::Adjustment::create(0, 0, 100000, 0.1, 1.0, 0); - pHYs_sb = Gtk::SpinButton(pHYs_adj, 1.0, 2); + pHYs_sb.set_adjustment(pHYs_adj); pHYs_sb.set_width_chars(7); pHYs_sb.set_tooltip_text( _("Will force-set the physical dpi for the png file. Set this to 72 if you're planning to work on your png with Photoshop") ); zlib_compression.set_hexpand(); @@ -351,7 +352,7 @@ Export::Export (void) : table->attach(bitdepth_cb,1,1,1,1); table->attach(zlib_label,0,2,1,1); table->attach(zlib_compression,1,2,1,1); - table->attach(phys_label,0,3,1,1); + table->attach(pHYs_label,0,3,1,1); table->attach(pHYs_sb,1,3,1,1); table->show(); diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h index 84e1c2362..112f42312 100644 --- a/src/ui/dialog/export.h +++ b/src/ui/dialog/export.h @@ -324,7 +324,7 @@ private: Gtk::ComboBoxText bitdepth_cb; Gtk::Label zlib_label; Gtk::ComboBoxText zlib_compression; - Gtk::Label phys_label; + Gtk::Label pHYs_label; Glib::RefPtr pHYs_adj; Gtk::SpinButton pHYs_sb; -- cgit v1.2.3 From 7d4ed3c86099e3326c33f6202efec74b3e109756 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 26 Sep 2016 12:18:39 +0200 Subject: Fix Gtk type error, code cleanup, and documentation. (bzr r15133) --- src/ui/tools/gradient-tool.cpp | 1 + src/ui/tools/mesh-tool.cpp | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp index a084a8fd9..16df225e0 100644 --- a/src/ui/tools/gradient-tool.cpp +++ b/src/ui/tools/gradient-tool.cpp @@ -871,6 +871,7 @@ bool GradientTool::root_handler(GdkEvent* event) { return ret; } +// Creates a new linear or radial gradient. static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint /*state*/, guint32 etime) { SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop; diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index f2cf8c4a2..168e26b4c 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -265,14 +265,18 @@ sp_mesh_context_select_prev (ToolBase *event_context) Returns true if mouse cursor over mesh edge. */ static bool -sp_mesh_context_is_over_line (MeshTool *rc, SPItem *item, Geom::Point event_p) +sp_mesh_context_is_over_line (MeshTool *rc, SPCtrlLine *line, Geom::Point event_p) { + if (!SP_IS_CTRLCURVE(line) ) { + return false; + } + SPDesktop *desktop = SP_EVENT_CONTEXT (rc)->desktop; //Translate mouse point into proper coord system rc->mousepoint_doc = desktop->w2d(event_p); - SPCtrlCurve *curve = SP_CTRLCURVE(item); + SPCtrlCurve *curve = SP_CTRLCURVE(line); Geom::BezierCurveN<3> b( curve->p0, curve->p1, curve->p2, curve->p3 ); Geom::Coord coord = b.nearestTime( rc->mousepoint_doc ); // Coord == double Geom::Point nearest = b( coord ); @@ -425,6 +429,7 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) /** Handles all keyboard and mouse input for meshs. +Note: node/handle events are take care of elsewhere. */ bool MeshTool::root_handler(GdkEvent* event) { static bool dragging; @@ -458,8 +463,7 @@ bool MeshTool::root_handler(GdkEvent* event) { if (! drag->lines.empty()) { for (std::vector::const_iterator l = drag->lines.begin(); l != drag->lines.end() && (!over_line); ++l) { - line = (SPCtrlCurve*) (*l); - over_line |= sp_mesh_context_is_over_line (this, (SPItem*) line, Geom::Point(event->motion.x, event->motion.y)); + over_line |= sp_mesh_context_is_over_line (this, *l, Geom::Point(event->motion.x, event->motion.y)); } } @@ -594,7 +598,7 @@ bool MeshTool::root_handler(GdkEvent* event) { if (!drag->lines.empty()) { for (std::vector::const_iterator l = drag->lines.begin(); l != drag->lines.end() ; ++l) { - over_line |= sp_mesh_context_is_over_line (this, (SPItem*)(*l), Geom::Point(event->motion.x, event->motion.y)); + over_line |= sp_mesh_context_is_over_line (this, *l, Geom::Point(event->motion.x, event->motion.y)); } } @@ -625,8 +629,7 @@ bool MeshTool::root_handler(GdkEvent* event) { if (!drag->lines.empty()) { for (std::vector::const_iterator l = drag->lines.begin(); l != drag->lines.end() && (!over_line); ++l) { - line = (SPCtrlLine*)(*l); - over_line = sp_mesh_context_is_over_line (this, (SPItem*) line, Geom::Point(event->motion.x, event->motion.y)); + over_line = sp_mesh_context_is_over_line (this, *l, Geom::Point(event->motion.x, event->motion.y)); if (over_line) { break; @@ -925,6 +928,7 @@ bool MeshTool::root_handler(GdkEvent* event) { return ret; } +// Creates a new mesh gradient. static void sp_mesh_end_drag(MeshTool &rc) { SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop; Inkscape::Selection *selection = desktop->getSelection(); -- cgit v1.2.3 From f2dd0550fc1a2d4deac985d28055f305b3ad7f64 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 26 Sep 2016 14:21:26 +0200 Subject: Remove unused variable. (bzr r15136) --- src/ui/tools/mesh-tool.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 168e26b4c..763685a0c 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -459,7 +459,6 @@ bool MeshTool::root_handler(GdkEvent* event) { if ( event->button.button == 1 ) { // Are we over a mesh line? bool over_line = false; - SPCtrlCurve *line = NULL; if (! drag->lines.empty()) { for (std::vector::const_iterator l = drag->lines.begin(); l != drag->lines.end() && (!over_line); ++l) { -- cgit v1.2.3 From f9ec83dbb254701f39d3b7a30c0bacb5eaae9ee9 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 27 Sep 2016 10:51:26 +0200 Subject: Rename to per SVG 2 CR specificiation. Note: has been repurposed to be a special shape that tightly wraps a mesh gradient. (bzr r15137) --- src/ui/tools/mesh-tool.cpp | 16 ++++++++-------- src/ui/widget/selected-style.cpp | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 763685a0c..aac8239f3 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -47,7 +47,7 @@ // Mesh specific #include "ui/tools/mesh-tool.h" -#include "sp-mesh.h" +#include "sp-mesh-gradient.h" #include "display/sp-ctrlcurve.h" using Inkscape::DocumentUndo; @@ -161,9 +161,9 @@ void MeshTool::selection_changed(Inkscape::Selection* /*sel*/) { // if (style && (style->fill.isPaintserver())) { // SPPaintServer *server = item->style->getFillPaintServer(); - // if ( SP_IS_MESH(server) ) { + // if ( SP_IS_MESHGRADIENT(server) ) { - // SPMesh *mg = SP_MESH(server); + // SPMeshGradient *mg = SP_MESHGRADIENT(server); // guint rows = 0;//mg->array.patches.size(); // for ( guint i = 0; i < rows; ++i ) { @@ -330,8 +330,8 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) SPDocument *doc = NULL; GrDrag *drag = rc->_grdrag; - std::map > points; - std::map items; + std::map > points; + std::map items; // Get list of selected draggers for each mesh. // For all selected draggers @@ -345,7 +345,7 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) if( d->point_type != POINT_MG_CORNER ) continue; // Find the gradient - SPMesh *gradient = SP_MESH( getGradient (d->item, d->fill_or_stroke) ); + SPMeshGradient *gradient = SP_MESHGRADIENT( getGradient (d->item, d->fill_or_stroke) ); // Collect points together for same gradient points[gradient].push_back( d->point_i ); @@ -354,8 +354,8 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) } // Loop over meshes. - for( std::map >::const_iterator iter = points.begin(); iter != points.end(); ++iter) { - SPMesh *mg = SP_MESH( iter->first ); + for( std::map >::const_iterator iter = points.begin(); iter != points.end(); ++iter) { + SPMeshGradient *mg = SP_MESHGRADIENT( iter->first ); if( iter->second.size() > 0 ) { guint noperation = 0; switch (operation) { diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index fd83a62c9..301a3b2e0 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -25,7 +25,7 @@ #include "sp-namedview.h" #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" -#include "sp-mesh.h" +#include "sp-mesh-gradient.h" #include "sp-pattern.h" #include "ui/dialog/dialog-manager.h" #include "ui/dialog/fill-and-stroke.h" @@ -1010,7 +1010,7 @@ SelectedStyle::update() place->set_tooltip_text(__rgradient[i]); _mode[i] = SS_RGRADIENT; #ifdef WITH_MESH - } else if (SP_IS_MESH(server)) { + } else if (SP_IS_MESHGRADIENT(server)) { SPGradient *vector = SP_GRADIENT(server)->getVector(); sp_gradient_image_set_gradient(SP_GRADIENT_IMAGE(_gradient_preview_m[i]), vector); place->add(_gradient_box_m[i]); -- cgit v1.2.3 From b1fd9e5520ba0578f3b1dbfa53a806bfdb74f3a3 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 3 Oct 2016 00:48:49 +0200 Subject: Doc rotate start (bzr r15142.1.1) --- src/ui/dialog/export.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 64a5d9866..f0d54d784 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -975,7 +975,12 @@ void Export::onExport () SPNamedView *nv = desktop->getNamedView(); SPDocument *doc = desktop->getDocument(); - + Geom::Affine rot = doc->getRoot()->c2p; + doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; + //double rotate_angle = doc->getRoot()->get_rotation(); + //Inkscape::XML::Node *nv_repr = sp_item_group_get_child_by_name(doc->getRoot(), NULL, "sodipodi:namedview")->getRepr(); + //sp_repr_set_svg_double(nv_repr, "inkscape:document-rotation", 0.); + doc->ensureUpToDate(); bool exportSuccessful = false; bool hide = hide_export.get_active (); @@ -999,6 +1004,7 @@ void Export::onExport () if (num < 1) { desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No items selected.")); + doc->getRoot()->c2p *= doc->getRoot()->rotation; return; } @@ -1090,6 +1096,7 @@ void Export::onExport () if (filename.empty()) { desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("You have to enter a filename.")); sp_ui_error_dialog(_("You have to enter a filename")); + doc->getRoot()->c2p *= doc->getRoot()->rotation; return; } @@ -1106,6 +1113,7 @@ void Export::onExport () if (!((x1 > x0) && (y1 > y0) && (width > 0) && (height > 0))) { desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("The chosen area to be exported is invalid.")); sp_ui_error_dialog(_("The chosen area to be exported is invalid")); + doc->getRoot()->c2p *= doc->getRoot()->rotation; return; } @@ -1128,6 +1136,7 @@ void Export::onExport () g_free(safeDir); g_free(error); + doc->getRoot()->c2p *= doc->getRoot()->rotation; return; } @@ -1277,6 +1286,7 @@ void Export::onExport () } } } + doc->getRoot()->c2p *= doc->getRoot()->rotation; } // end of sp_export_export_clicked() /// Called when Browse button is clicked -- cgit v1.2.3 From e1d0c1cb00f84b66b38af6eec563cf60df7ba726 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 3 Oct 2016 18:08:29 +0200 Subject: Fix a bug on eraser mode when previous clip are shapes not paths (bzr r15145) --- src/ui/tools/eraser-tool.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 38c72cac0..12686160b 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -766,9 +766,17 @@ void EraserTool::set_to_accumulated() { if (bbox && bbox->intersects(*eraserBbox)) { SPClipPath *clip_path = item->clip_ref->getObject(); if (clip_path) { - SPPath *clip_data = SP_PATH(clip_path->firstChild()); + std::vector selected; + selected.push_back(SP_ITEM(clip_path->firstChild())); + std::vector to_select; + std::vector items(selected); + sp_item_list_to_curves(items, selected, to_select); + Inkscape::XML::Node * clip_data = SP_ITEM(clip_path->firstChild())->getRepr(); + if (!clip_data && !to_select.empty()) { + clip_data = *(to_select.begin()); + } if (clip_data) { - Inkscape::XML::Node *dup_clip = SP_OBJECT(clip_data)->getRepr()->duplicate(xml_doc); + Inkscape::XML::Node *dup_clip = clip_data->duplicate(xml_doc); if (dup_clip) { SPItem * dup_clip_obj = SP_ITEM(item_repr->parent->appendChildRepr(dup_clip)); if (dup_clip_obj) { -- cgit v1.2.3 From eb4b3b8d4823f7a9cef4e623080e3d1e4b7426eb Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 7 Oct 2016 20:03:23 +0200 Subject: Fix bug:1630821 on LPE selected nodes Fixed bugs: - https://launchpad.net/bugs/1630821 (bzr r15149) --- src/ui/tools/node-tool.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 2bd4fdea3..f3679b40f 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -285,13 +285,11 @@ void NodeTool::update_helperpath () { if (SP_IS_LPE_ITEM(selection->singleItem())) { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) { - Inkscape::UI::ControlPointSelection::Set &selectionNodes = _selected_nodes->allPoints(); + Inkscape::UI::ControlPointSelection *selectionNodes = _selected_nodes; std::vector selectedNodesPositions; - for (Inkscape::UI::ControlPointSelection::Set::iterator i = selectionNodes.begin(); i != selectionNodes.end(); ++i) { - if ((*i)->selected()) { - Inkscape::UI::Node *n = dynamic_cast(*i); - selectedNodesPositions.push_back(n->position()); - } + for (Inkscape::UI::ControlPointSelection::iterator i = selectionNodes->begin(); i != selectionNodes->end(); ++i) { + Inkscape::UI::Node *n = dynamic_cast(*i); + selectedNodesPositions.push_back(n->position()); } lpe->setSelectedNodePoints(selectedNodesPositions); lpe->setCurrentZoom(this->desktop->current_zoom()); @@ -470,6 +468,7 @@ bool NodeTool::root_handler(GdkEvent* event) { switch (event->type) { case GDK_MOTION_NOTIFY: { + update_helperpath(); combine_motion_events(desktop->canvas, event->motion, 0); SPItem *over_item = sp_event_context_find_item (desktop, event_point(event->button), FALSE, TRUE); -- cgit v1.2.3 From 60688fe72a9a75ac54d895a7aa61d3a0518ca8ab Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 7 Oct 2016 20:48:31 +0200 Subject: Fix bug:1630796 on flatten button Fixed bugs: - https://launchpad.net/bugs/1630796 (bzr r15150) --- src/ui/dialog/livepatheffect-editor.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index 489e9564d..8e9e66435 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -49,6 +49,8 @@ public: void onSelectionModified(Inkscape::Selection *sel); virtual void on_effect_selection_changed(); void setDesktop(SPDesktop *desktop); + // void add_entry(const char* name ); + void effect_list_reload(SPLPEItem *lpeitem); private: @@ -70,9 +72,6 @@ private: void showText(Glib::ustring const &str); void selectInList(LivePathEffect::Effect* effect); - // void add_entry(const char* name ); - void effect_list_reload(SPLPEItem *lpeitem); - // callback methods for buttons on grids page. void onAdd(); void onRemove(); -- cgit v1.2.3 From 4265fc5086c2a7467de2b8d1c26efac1412a5089 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 7 Oct 2016 22:58:19 +0200 Subject: Fix bug:1605334 FeImage X and Y position Fixed bugs: - https://launchpad.net/bugs/1605334 (bzr r15151) --- src/ui/dialog/filter-effects-dialog.cpp | 46 ++++++++++++++++++++++++++++++++- src/ui/dialog/filter-effects-dialog.h | 8 ++++++ 2 files changed, 53 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index a0cd786dc..f657e1b76 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -860,6 +860,17 @@ public: return dss; } + // SpinButton + SpinButtonAttr* add_spinbutton(double defalt_value, const SPAttributeEnum attr, const Glib::ustring& label, + const double lo, const double hi, const double step_inc, + const double climb, const int digits, char* tip = NULL) + { + SpinButtonAttr* sb = new SpinButtonAttr(lo, hi, step_inc, climb, digits, attr, defalt_value, tip); + add_widget(sb, label); + add_attr_widget(sb); + return sb; + } + // DualSpinButton DualSpinButton* add_dualspinbutton(char* defalt_value, const SPAttributeEnum attr, const Glib::ustring& label, const double lo, const double hi, const double step_inc, @@ -2785,8 +2796,14 @@ void FilterEffectsDialog::init_settings_widgets() _settings->type(NR_FILTER_IMAGE); _settings->add_fileorelement(SP_ATTR_XLINK_HREF, _("Source of Image:")); - + _image_x = _settings->add_entry(SP_ATTR_X,_("X"),_("X")); + _image_x->signal_attr_changed().connect(sigc::mem_fun(*this, &FilterEffectsDialog::image_x_changed)); + //This commented because we want the default empty value of X or Y and couldent get it from SpinButton + //_image_y = _settings->add_spinbutton(0, SP_ATTR_Y, _("Y:"), -DBL_MAX, DBL_MAX, 1, 1, 5, _("Y")); + _image_y = _settings->add_entry(SP_ATTR_Y,_("Y"),_("Y")); + _image_y->signal_attr_changed().connect(sigc::mem_fun(*this, &FilterEffectsDialog::image_y_changed)); _settings->type(NR_FILTER_OFFSET); + _settings->add_checkbutton(false, SP_ATTR_PRESERVEALPHA, _("Preserve Alpha"), "true", "false", _("If set, the alpha channel won't be altered by this filter primitive.")); _settings->add_spinscale(0, SP_ATTR_DX, _("Delta X:"), -100, 100, 1, 0.01, 1, _("This is how far the input image gets shifted to the right")); _settings->add_spinscale(0, SP_ATTR_DY, _("Delta Y:"), -100, 100, 1, 0.01, 1, _("This is how far the input image gets shifted downwards")); @@ -2926,6 +2943,33 @@ void FilterEffectsDialog::convolve_order_changed() _convolve_target->get_spinbuttons()[1]->get_adjustment()->set_upper(_convolve_order->get_spinbutton2().get_value() - 1); } +bool number_or_empy(const Glib::ustring& text) { + if (text.empty()) { + return true; + } + double n = atof( text.c_str() ); + if (n == 0.0 && strcmp(text.c_str(), "0") != 0 && strcmp(text.c_str(), "0.0") != 0) { + return false; + } + else { + return true; + } +} + +void FilterEffectsDialog::image_x_changed() +{ + if (number_or_empy(_image_x->get_text())) { + _image_x->set_from_attribute(_primitive_list.get_selected()); + } +} + +void FilterEffectsDialog::image_y_changed() +{ + if (number_or_empy(_image_y->get_text())) { + _image_y->set_from_attribute(_primitive_list.get_selected()); + } +} + void FilterEffectsDialog::set_attr_direct(const AttrWidget* input) { set_attr(_primitive_list.get_selected(), input->get_attribute(), input->get_as_attribute().c_str()); diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index eae0fc317..32fabb741 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -35,6 +35,8 @@ namespace Inkscape { namespace UI { namespace Dialog { +class EntryAttr; +//class SpinButtonAttr; class DualSpinButton; class MultiSpinButton; class FilterEffectsDialog : public UI::Widget::Panel { @@ -258,6 +260,8 @@ private: void remove_primitive(); void duplicate_primitive(); void convolve_order_changed(); + void image_x_changed(); + void image_y_changed(); void set_attr_direct(const UI::Widget::AttrWidget*); void set_child_attr_direct(const UI::Widget::AttrWidget*); @@ -308,6 +312,10 @@ private: DualSpinButton* _convolve_order; MultiSpinButton* _convolve_target; + // Image + EntryAttr* _image_x; + EntryAttr* _image_y; + // For controlling setting sensitivity Gtk::Widget* _k1, *_k2, *_k3, *_k4; -- cgit v1.2.3 From 3fb11a7eb8d066e2b16bddb98de9b4c03e28ba56 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 8 Oct 2016 01:46:38 +0200 Subject: Fix bug:1630796 on flatten button. Attemp 2 Fixed bugs: - https://launchpad.net/bugs/1630796 (bzr r15152) --- src/ui/dialog/livepatheffect-editor.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index 8e9e66435..a7c749ef3 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -49,8 +49,6 @@ public: void onSelectionModified(Inkscape::Selection *sel); virtual void on_effect_selection_changed(); void setDesktop(SPDesktop *desktop); - // void add_entry(const char* name ); - void effect_list_reload(SPLPEItem *lpeitem); private: @@ -66,6 +64,9 @@ private: sigc::connection selection_changed_connection; sigc::connection selection_modified_connection; + // void add_entry(const char* name ); + void effect_list_reload(SPLPEItem *lpeitem); + void set_sensitize_all(bool sensitive); void showParams(LivePathEffect::Effect& effect); -- cgit v1.2.3 From 7be3086bf70ba9bf28c5cfe06fd7a8e28e719bcc Mon Sep 17 00:00:00 2001 From: sandra-snan Date: Sat, 8 Oct 2016 08:16:53 +0200 Subject: [Bug #770681] KEY MAPPING: Comma and period hijacked by scaling. Fixed bugs: - https://launchpad.net/bugs/770681 (bzr r15155) --- src/ui/tools/select-tool.cpp | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 86a2dbed3..0cdeda0b6 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -1045,37 +1045,7 @@ bool SelectTool::root_handler(GdkEvent* event) { ret = TRUE; break; - - case GDK_KEY_less: - case GDK_KEY_comma: - if (MOD__ALT(event)) { - gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask - sp_selection_scale_screen(selection, -2*mul); - } else if (MOD__CTRL(event)) { - sp_selection_scale_times(selection, 0.5); - } else { - gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask - sp_selection_scale(selection, -offset*mul); - } - - ret = TRUE; - break; - - case GDK_KEY_greater: - case GDK_KEY_period: - if (MOD__ALT(event)) { - gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask - sp_selection_scale_screen(selection, 2*mul); - } else if (MOD__CTRL(event)) { - sp_selection_scale_times(selection, 2); - } else { - gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask - sp_selection_scale(selection, offset*mul); - } - - ret = TRUE; - break; - + case GDK_KEY_Return: if (MOD__CTRL_ONLY(event)) { if (selection->singleItem()) { -- cgit v1.2.3 From 1b7079f62b7c2bfe454e20bae3776a7e36e7e684 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 9 Oct 2016 20:37:54 +0200 Subject: Provide simple "preview" for mesh gradients. (bzr r15157) --- src/ui/widget/selected-style.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index 301a3b2e0..ebc6fe919 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -1011,8 +1011,8 @@ SelectedStyle::update() _mode[i] = SS_RGRADIENT; #ifdef WITH_MESH } else if (SP_IS_MESHGRADIENT(server)) { - SPGradient *vector = SP_GRADIENT(server)->getVector(); - sp_gradient_image_set_gradient(SP_GRADIENT_IMAGE(_gradient_preview_m[i]), vector); + SPGradient *array = SP_GRADIENT(server)->getArray(); + sp_gradient_image_set_gradient(SP_GRADIENT_IMAGE(_gradient_preview_m[i]), array); place->add(_gradient_box_m[i]); place->set_tooltip_text(__mgradient[i]); _mode[i] = SS_MGRADIENT; -- cgit v1.2.3 From 21a70ba7b07c29ca0c729f7ab3ac33431c417b21 Mon Sep 17 00:00:00 2001 From: liampwhite Date: Sun, 9 Oct 2016 21:44:23 +0200 Subject: Fix palette flickering, probably. Fixed bugs: - https://launchpad.net/bugs/1201545 (bzr r15158) --- src/ui/previewholder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index ef11daa3b..6fec65124 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -256,7 +256,7 @@ void PreviewHolder::on_size_allocate( Gtk::Allocation& allocation ) // g_message(" anchor:%d", _anchor); Gtk::VBox::on_size_allocate( allocation ); - if ( _insides && !_wrap && (_view != VIEW_TYPE_LIST) && (_anchor == SP_ANCHOR_NORTH || _anchor == SP_ANCHOR_SOUTH) ) { +/* if ( _insides && !_wrap && (_view != VIEW_TYPE_LIST) && (_anchor == SP_ANCHOR_NORTH || _anchor == SP_ANCHOR_SOUTH) ) { Gtk::Requisition req; Gtk::Requisition req_natural; _insides->get_preferred_size(req, req_natural); @@ -267,7 +267,7 @@ void PreviewHolder::on_size_allocate( Gtk::Allocation& allocation ) } else { dynamic_cast(_scroller)->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER ); } - } + }*/ } //void PreviewHolder::on_size_request( Gtk::Requisition* requisition ) -- cgit v1.2.3 From 2715ea15f1574bf2efc00610ac3c930dcfb30621 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 14 Oct 2016 10:39:17 +0200 Subject: Do not create unused "vector" gradient when creating mesh gradient. (bzr r15168) --- src/ui/tools/mesh-tool.cpp | 48 +++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index aac8239f3..5e88e26b3 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -38,6 +38,9 @@ #include "snap.h" #include "sp-namedview.h" #include "verbs.h" +#include "sp-text.h" +#include "sp-defs.h" +#include "style.h" // Gradient specific #include "gradient-drag.h" @@ -937,37 +940,42 @@ static void sp_mesh_end_drag(MeshTool &rc) { if (!selection->isEmpty()) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - int type = SP_GRADIENT_TYPE_MESH; - Inkscape::PaintTarget fill_or_stroke = (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE; + Inkscape::PaintTarget fill_or_stroke = + (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? + Inkscape::FOR_FILL : Inkscape::FOR_STROKE; - SPGradient *vector; - if (ec->item_to_select) { - // pick color from the object where drag started - vector = sp_gradient_vector_for_object(document, desktop, ec->item_to_select, fill_or_stroke); - } else { - // Starting from empty space: - // Sort items so that the topmost comes last - std::vector items(selection->items().begin(), selection->items().end()); - sort(items.begin(),items.end(),sp_item_repr_compare_position); - // take topmost - vector = sp_gradient_vector_for_object(document, desktop, SP_ITEM(items.back()), fill_or_stroke); - } - - // HACK: reset fill-opacity - that 0.75 is annoying; BUT remove this when we have an opacity slider for all tabs +// HACK: reset fill-opacity - that 0.75 is annoying; BUT remove this when we have an opacity slider for all tabs SPCSSAttr *css = sp_repr_css_attr_new(); sp_repr_css_set_property(css, "fill-opacity", "1.0"); + Inkscape::XML::Document *xml_doc = document->getReprDoc(); + SPDefs *defs = document->getDefs(); + auto items= selection->items(); for(auto i=items.begin();i!=items.end();++i){ //FIXME: see above sp_repr_css_change_recursive((*i)->getRepr(), css, "style"); - sp_item_set_gradient(*i, vector, (SPGradientType) type, fill_or_stroke); + // Create mesh element + Inkscape::XML::Node *repr = xml_doc->createElement("svg:meshgradient"); - // We don't need to do anything. Mesh is already sized appropriately. - - (*i)->requestModified(SP_OBJECT_MODIFIED_FLAG); + // privates are garbage-collectable + repr->setAttribute("inkscape:collect", "always"); + + // Attach to document + defs->getRepr()->appendChild(repr); + Inkscape::GC::release(repr); + + // Get corresponding object + SPMeshGradient *mg = static_cast(document->getObjectByRepr(repr)); + mg->array.create(mg, *i, (*i)->visualBounds()); + + bool isText = SP_IS_TEXT(*i); + sp_style_set_property_url (*i, ((fill_or_stroke == Inkscape::FOR_FILL) ? "fill":"stroke"), + mg, isText); + + (*i)->requestModified(SP_OBJECT_MODIFIED_FLAG|SP_OBJECT_STYLE_MODIFIED_FLAG); } DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH, _("Create mesh")); -- cgit v1.2.3 From 32442aec84cc13f0a22fa1f07f3de701c6938e5d Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 14 Oct 2016 22:01:57 +0200 Subject: Implement copying of objects with mesh gradients. (bzr r15171) --- src/ui/tools/mesh-tool.cpp | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 5e88e26b3..33cdc3bda 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -59,7 +59,7 @@ namespace Inkscape { namespace UI { namespace Tools { -static void sp_mesh_end_drag(MeshTool &rc); +static void sp_mesh_new_default(MeshTool &rc); const std::string& MeshTool::getPrefsPath() { return MeshTool::prefsPath; @@ -474,24 +474,25 @@ bool MeshTool::root_handler(GdkEvent* event) { // always resets selection to the single object under cursor sp_mesh_context_split_near_point(this, selection->items().front(), this->mousepoint_doc, event->button.time); } else { + sp_mesh_new_default(*this); // Create a new gradient with default coordinates. - auto items= selection->items(); - for(auto i=items.begin();i!=items.end();++i){ - SPItem *item = *i; - SPGradientType new_type = SP_GRADIENT_TYPE_MESH; - Inkscape::PaintTarget fsmode = (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE; - -#ifdef DEBUG_MESH - std::cout << "sp_mesh_context_root_handler: creating new mesh on: " << (fsmode == Inkscape::FOR_FILL ? "Fill" : "Stroke") << std::endl; -#endif - SPGradient *vector = sp_gradient_vector_for_object(desktop->getDocument(), desktop, item, fsmode); - - SPGradient *priv = sp_item_set_gradient(item, vector, new_type, fsmode); - sp_gradient_reset_to_userspace(priv, item); - } - - DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH, - _("Create default mesh")); +// auto items= selection->items(); +// for(auto i=items.begin();i!=items.end();++i){ +// SPItem *item = *i; +// SPGradientType new_type = SP_GRADIENT_TYPE_MESH; +// Inkscape::PaintTarget fsmode = (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE; + +// #ifdef DEBUG_MESH +// std::cout << "sp_mesh_context_root_handler: creating new mesh on: " << (fsmode == Inkscape::FOR_FILL ? "Fill" : "Stroke") << std::endl; +// #endif +// SPGradient *vector = sp_gradient_vector_for_object(desktop->getDocument(), desktop, item, fsmode); + +// SPGradient *priv = sp_item_set_gradient(item, vector, new_type, fsmode); +// sp_gradient_reset_to_userspace(priv, item); +// } + +// DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH, +// _("Create default mesh")); } ret = TRUE; @@ -666,7 +667,7 @@ bool MeshTool::root_handler(GdkEvent* event) { } } else { // Create a new mesh gradient - sp_mesh_end_drag(*this); + sp_mesh_new_default(*this); } } else if (this->item_to_select) { if (over_line && line) { @@ -931,7 +932,7 @@ bool MeshTool::root_handler(GdkEvent* event) { } // Creates a new mesh gradient. -static void sp_mesh_end_drag(MeshTool &rc) { +static void sp_mesh_new_default(MeshTool &rc) { SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop; Inkscape::Selection *selection = desktop->getSelection(); SPDocument *document = desktop->getDocument(); -- cgit v1.2.3 From 619f8b5d9173f2bcc9d9aefccee832d686724e79 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 17 Oct 2016 15:04:09 +0200 Subject: Add option to scale mesh to fit in bounding box. (bzr r15173) --- src/ui/tools/mesh-tool.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++++++ src/ui/tools/mesh-tool.h | 1 + 2 files changed, 67 insertions(+) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 33cdc3bda..cea508782 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -52,6 +52,7 @@ #include "ui/tools/mesh-tool.h" #include "sp-mesh-gradient.h" #include "display/sp-ctrlcurve.h" +#include "display/curve.h" using Inkscape::DocumentUndo; @@ -430,6 +431,71 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) } +/** + * Scale mesh to just fit into bbox of selected items. + */ +void +sp_mesh_context_fit_mesh_in_bbox (MeshTool *rc) +{ + +#ifdef DEBUG_MESH + std::cout << "sp_mesh_context_fit_mesh_in_bbox: entrance: Entrance"<< std::endl; +#endif + + SPDesktop *desktop = SP_EVENT_CONTEXT (rc)->desktop; + + Inkscape::Selection *selection = desktop->getSelection(); + if (selection == NULL) { + return; + } + + bool changed = false; + auto itemlist = selection->items(); + for (auto i=itemlist.begin(); i!=itemlist.end(); ++i) { + + SPItem *item = *i; + SPStyle *style = item->style; + + if (style && (style->fill.isPaintserver())) { + SPPaintServer *server = item->style->getFillPaintServer(); + if ( SP_IS_MESHGRADIENT(server) ) { + + SPMeshGradient *gradient = SP_MESHGRADIENT(server); + SPCurve * outline = gradient->array.outline_path(); + Geom::OptRect mesh_bbox = outline->get_pathvector().boundsExact(); + outline->unref(); + Geom::OptRect item_bbox = item->geometricBounds(); + + if ((*mesh_bbox).width() == 0) { + continue; + } + if ((*mesh_bbox).height() == 0) { + continue; + } + double scale_x = (*item_bbox).width() /(*mesh_bbox).width() ; + double scale_y = (*item_bbox).height()/(*mesh_bbox).height(); + + Geom::Translate t1(-(*mesh_bbox).min()); + Geom::Scale scale(scale_x,scale_y); + Geom::Translate t2((*item_bbox).min()); + Geom::Affine transform = t1 * scale * t2; + if (!transform.isIdentity() ) { + gradient->array.transform(transform); + gradient->array.write( gradient ); + gradient->requestModified(SP_OBJECT_MODIFIED_FLAG); + changed = true; + } + } + } + + } + if (changed) { + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH, + _("Fit mesh inside bounding box.")); + } +} + + /** Handles all keyboard and mouse input for meshs. Note: node/handle events are take care of elsewhere. diff --git a/src/ui/tools/mesh-tool.h b/src/ui/tools/mesh-tool.h index 91b35b3af..f142bfd9c 100644 --- a/src/ui/tools/mesh-tool.h +++ b/src/ui/tools/mesh-tool.h @@ -59,6 +59,7 @@ private: void sp_mesh_context_select_next(ToolBase *event_context); void sp_mesh_context_select_prev(ToolBase *event_context); void sp_mesh_context_corner_operation(MeshTool *event_context, MeshCornerOperation operation ); +void sp_mesh_context_fit_mesh_in_bbox(MeshTool *event_context); } } -- cgit v1.2.3 From 5a528acc28fee968aee4d79373625ed7d0fa553d Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 18 Oct 2016 19:07:20 +0200 Subject: Use geometric bounding box for fill, visual for stroke in creating mesh. (bzr r15175) --- src/ui/tools/mesh-tool.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index cea508782..c6983b94a 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -1036,7 +1036,8 @@ static void sp_mesh_new_default(MeshTool &rc) { // Get corresponding object SPMeshGradient *mg = static_cast(document->getObjectByRepr(repr)); - mg->array.create(mg, *i, (*i)->visualBounds()); + mg->array.create(mg, *i, (fill_or_stroke == Inkscape::FOR_FILL) ? + (*i)->geometricBounds() : (*i)->visualBounds()); bool isText = SP_IS_TEXT(*i); sp_style_set_property_url (*i, ((fill_or_stroke == Inkscape::FOR_FILL) ? "fill":"stroke"), @@ -1045,6 +1046,11 @@ static void sp_mesh_new_default(MeshTool &rc) { (*i)->requestModified(SP_OBJECT_MODIFIED_FLAG|SP_OBJECT_STYLE_MODIFIED_FLAG); } + if (css) { + sp_repr_css_attr_unref(css); + css = 0; + } + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH, _("Create mesh")); // status text; we do not track coords because this branch is run once, not all the time -- cgit v1.2.3 From 1277a92d4c1cd93e9a172718f557a8cd1a855625 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Wed, 19 Oct 2016 00:24:26 +0200 Subject: update author list in about dialog from AUTHORS file (bzr r15176) --- src/ui/dialog/aboutbox.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index 04cf9d02a..846f00d8a 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -256,6 +256,7 @@ void AboutBox::initStrings() { "Joshua L. Blocher\n" "Hanno Böck\n" "Tomasz Boczkowski\n" +"Adrian Boguszewski\n" "Henrik Bohre\n" "Boldewyn\n" "Daniel Borgmann\n" @@ -265,6 +266,7 @@ void AboutBox::initStrings() { "Christopher Brown\n" "Marcus Brubaker\n" "Luca Bruno\n" +"Brynn (brynn@inkscapecommunity.com)\n" "Nicu Buculei\n" "Bulia Byak\n" "Pierre Caclin\n" @@ -289,10 +291,12 @@ void AboutBox::initStrings() { "Nicolas Dufour\n" "Tim Dwyer\n" "Maxim V. Dziumanenko\n" +"Moritz Eberl\n" "Johan Engelen\n" "Miklos Erdelyi\n" "Ulf Erikson\n" "Noé Falzon\n" +"Sebastian Faubel\n" "Frank Felfe\n" "Andrew Fitzsimon\n" "Edward Flick\n" @@ -324,6 +328,7 @@ void AboutBox::initStrings() { "Jean-Olivier Irisson\n" "Bob Jamison\n" "Ted Janeczko\n" +"Marc Jeanmougin\n" "jEsuSdA\n" "Fernando Lucchesi Bastos Jurema\n" "Lauris Kaplinski\n" @@ -389,6 +394,7 @@ void AboutBox::initStrings() { "Shivaken\n" "Michael Sloan\n" "John Smith\n" +"Sandra Snan\n" "Boštjan Špetič\n" "Aaron Spike\n" "Kaushik Sridharan\n" @@ -413,7 +419,8 @@ void AboutBox::initStrings() { "Gellule Xg\n" "Daniel Yacob\n" "Masatake Yamato\n" -"David Yip"; +"David Yip" +; //############################## //# T R A N S L A T O R S -- cgit v1.2.3 From 430533b9a259eb3dac44755306dfb0fddb34951d Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 8 Nov 2016 15:05:30 +0100 Subject: Improve mesh handling in Fill and Stroke dialog. Create new meshes with alternating color/white pattern (makes it more obvious a mesh has been created). (bzr r15229) --- src/ui/tools/mesh-tool.cpp | 70 ++++++++++++++++------------------------------ 1 file changed, 24 insertions(+), 46 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index c6983b94a..87cbeef16 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -456,38 +456,33 @@ sp_mesh_context_fit_mesh_in_bbox (MeshTool *rc) SPItem *item = *i; SPStyle *style = item->style; - if (style && (style->fill.isPaintserver())) { - SPPaintServer *server = item->style->getFillPaintServer(); - if ( SP_IS_MESHGRADIENT(server) ) { - - SPMeshGradient *gradient = SP_MESHGRADIENT(server); - SPCurve * outline = gradient->array.outline_path(); - Geom::OptRect mesh_bbox = outline->get_pathvector().boundsExact(); - outline->unref(); - Geom::OptRect item_bbox = item->geometricBounds(); - - if ((*mesh_bbox).width() == 0) { - continue; - } - if ((*mesh_bbox).height() == 0) { - continue; + if (style) { + + if (style->fill.isPaintserver()) { + SPPaintServer *server = item->style->getFillPaintServer(); + if ( SP_IS_MESHGRADIENT(server) ) { + + Geom::OptRect item_bbox = item->geometricBounds(); + SPMeshGradient *gradient = SP_MESHGRADIENT(server); + if (gradient->array.fill_box( item_bbox )) { + changed = true; + } } - double scale_x = (*item_bbox).width() /(*mesh_bbox).width() ; - double scale_y = (*item_bbox).height()/(*mesh_bbox).height(); - - Geom::Translate t1(-(*mesh_bbox).min()); - Geom::Scale scale(scale_x,scale_y); - Geom::Translate t2((*item_bbox).min()); - Geom::Affine transform = t1 * scale * t2; - if (!transform.isIdentity() ) { - gradient->array.transform(transform); - gradient->array.write( gradient ); - gradient->requestModified(SP_OBJECT_MODIFIED_FLAG); - changed = true; + } + + if (style->stroke.isPaintserver()) { + SPPaintServer *server = item->style->getStrokePaintServer(); + if ( SP_IS_MESHGRADIENT(server) ) { + + Geom::OptRect item_bbox = item->visualBounds(); + SPMeshGradient *gradient = SP_MESHGRADIENT(server); + if (gradient->array.fill_box( item_bbox )) { + changed = true; + } } } + } - } if (changed) { DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH, @@ -540,25 +535,8 @@ bool MeshTool::root_handler(GdkEvent* event) { // always resets selection to the single object under cursor sp_mesh_context_split_near_point(this, selection->items().front(), this->mousepoint_doc, event->button.time); } else { - sp_mesh_new_default(*this); // Create a new gradient with default coordinates. -// auto items= selection->items(); -// for(auto i=items.begin();i!=items.end();++i){ -// SPItem *item = *i; -// SPGradientType new_type = SP_GRADIENT_TYPE_MESH; -// Inkscape::PaintTarget fsmode = (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE; - -// #ifdef DEBUG_MESH -// std::cout << "sp_mesh_context_root_handler: creating new mesh on: " << (fsmode == Inkscape::FOR_FILL ? "Fill" : "Stroke") << std::endl; -// #endif -// SPGradient *vector = sp_gradient_vector_for_object(desktop->getDocument(), desktop, item, fsmode); - -// SPGradient *priv = sp_item_set_gradient(item, vector, new_type, fsmode); -// sp_gradient_reset_to_userspace(priv, item); -// } - -// DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MESH, -// _("Create default mesh")); + sp_mesh_new_default(*this); } ret = TRUE; -- cgit v1.2.3 From 07a86951a15301ccb7eb1446cc1e6d3ca7a68f9b Mon Sep 17 00:00:00 2001 From: Alexander Brock Date: Wed, 9 Nov 2016 01:23:41 +0100 Subject: Move boolop functions from sp_selected_path_ to ObjectSet::path (bzr r15223.1.1) --- src/ui/tools/calligraphic-tool.cpp | 4 ++-- src/ui/tools/eraser-tool.cpp | 12 ++++++------ src/ui/tools/flood-tool.cpp | 2 +- src/ui/tools/spray-tool.cpp | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp index 9b4dbb1a2..c2b86b538 100644 --- a/src/ui/tools/calligraphic-tool.cpp +++ b/src/ui/tools/calligraphic-tool.cpp @@ -921,10 +921,10 @@ void CalligraphicTool::set_to_accumulated(bool unionize, bool subtract) { if (unionize) { desktop->getSelection()->add(this->repr); - sp_selected_path_union_skip_undo(desktop->getSelection()); + desktop->getSelection()->pathUnion(true); } else if (subtract) { desktop->getSelection()->add(this->repr); - sp_selected_path_diff_skip_undo(desktop->getSelection()); + desktop->getSelection()->pathDiff(true); } else { if (this->keep_selected) { desktop->getSelection()->set(this->repr); diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 4f941e534..ae312e054 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -714,7 +714,7 @@ void EraserTool::set_to_accumulated() { Inkscape::GC::release(dup); // parent takes over selection->set(dup); if (!this->nowidth) { - sp_selected_path_union_skip_undo(selection); + selection->pathUnion(true); } selection->add(item); if(item->style->fill_rule.value == SP_WIND_RULE_EVENODD){ @@ -725,9 +725,9 @@ void EraserTool::set_to_accumulated() { css = 0; } if (this->nowidth) { - sp_selected_path_cut_skip_undo(selection); + selection->pathCut(true); } else { - sp_selected_path_diff_skip_undo(selection); + selection->pathDiff(true); } workDone = true; // TODO set this only if something was cut. bool break_apart = prefs->getBool("/tools/eraser/break_apart", false); @@ -762,7 +762,7 @@ void EraserTool::set_to_accumulated() { this->repr->parent()->appendChild(dup); Inkscape::GC::release(dup); // parent takes over selection->set(dup); - sp_selected_path_union_skip_undo(selection); + selection->pathUnion(true); if (bbox && bbox->intersects(*eraserBbox)) { SPClipPath *clip_path = item->clip_ref->getObject(); if (clip_path) { @@ -786,7 +786,7 @@ void EraserTool::set_to_accumulated() { sp_object_unref(clip_path); selection->raiseToTop(true); selection->add(dup_clip); - sp_selected_path_diff_skip_undo(selection); + selection->pathDiff(true); SPItem * clip = SP_ITEM(*(selection->items().begin())); } } @@ -802,7 +802,7 @@ void EraserTool::set_to_accumulated() { rect->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); selection->raiseToTop(true); selection->add(rect); - sp_selected_path_diff_skip_undo(selection); + selection->pathDiff(true); } selection->raiseToTop(true); selection->add(item); diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index 0b893a7ba..b01b8ad52 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -446,7 +446,7 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto ngettext("Area filled, path with %d node created and unioned with selection.","Area filled, path with %d nodes created and unioned with selection.", SP_PATH(reprobj)->nodesInPath()), SP_PATH(reprobj)->nodesInPath() ); selection->add(reprobj); - sp_selected_path_union_skip_undo(desktop->getSelection()); + selection->pathUnion(true); } else { desktop->messageStack()->flashF( Inkscape::WARNING_MESSAGE, ngettext("Area filled, path with %d node created.","Area filled, path with %d nodes created.", diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 3649008ff..ad006627c 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -1026,7 +1026,7 @@ static bool sp_spray_recursive(SPDesktop *desktop, if (unionResult) { // No need to add the very first item (initialized with NULL). set->add(unionResult); } - sp_selected_path_union_skip_undo(set); + set->pathUnion(true); set->add(parent_item); Inkscape::GC::release(copy); did = true; @@ -1364,7 +1364,7 @@ bool SprayTool::root_handler(GdkEvent* event) { SP_VERB_CONTEXT_SPRAY, _("Spray with clones")); break; case SPRAY_MODE_SINGLE_PATH: - sp_selected_path_union_skip_undo(objectSet()); + objectSet()->pathUnion(true); desktop->getSelection()->add(object_set.objects().begin(), object_set.objects().end()); DocumentUndo::done(this->desktop->getDocument(), SP_VERB_CONTEXT_SPRAY, _("Spray in single path")); -- cgit v1.2.3 From b82a7738f807351244b03be2723af0220af46c34 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 9 Nov 2016 09:10:41 +0100 Subject: Enable swapping of fill and stroke when one is a mesh. (bzr r15230) --- src/ui/widget/selected-style.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/ui') diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index ebc6fe919..fa7a83732 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -800,6 +800,9 @@ void SelectedStyle::on_fillstroke_swap() { break; case SS_LGRADIENT: case SS_RGRADIENT: +#ifdef WITH_MESH + case SS_MGRADIENT: +#endif case SS_PATTERN: sp_repr_css_set_property (css, "stroke", _paintserver_id[SS_FILL].c_str()); break; @@ -822,6 +825,9 @@ void SelectedStyle::on_fillstroke_swap() { break; case SS_LGRADIENT: case SS_RGRADIENT: +#ifdef WITH_MESH + case SS_MGRADIENT: +#endif case SS_PATTERN: sp_repr_css_set_property (css, "fill", _paintserver_id[SS_STROKE].c_str()); break; -- cgit v1.2.3 From 40c68a138368ffa620e91d7b3908e2593e424a8f Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 9 Nov 2016 10:17:03 +0100 Subject: Click-drag selects nodes rather than creates new mesh if mesh already exists. (bzr r15231) --- src/ui/tools/mesh-tool.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 87cbeef16..61793b8b3 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -561,8 +561,25 @@ bool MeshTool::root_handler(GdkEvent* event) { dragging = true; + // Check if object already has mesh... if it does, don't create new mesh with click-drag. + bool has_mesh = false; + if (!selection->isEmpty()) { + SPStyle *style = selection->items().front()->style; + if (style) { + Inkscape::PaintTarget fill_or_stroke = + (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? + Inkscape::FOR_FILL : Inkscape::FOR_STROKE; + SPPaintServer *server = + (fill_or_stroke == Inkscape::FOR_FILL) ? + style->getFillPaintServer(): + style->getStrokePaintServer(); + if (server && SP_IS_MESHGRADIENT(server)) + has_mesh = true; + } + } + Geom::Point button_dt = desktop->w2d(button_w); - if (event->button.state & GDK_SHIFT_MASK) { + if (event->button.state & GDK_SHIFT_MASK || has_mesh) { Inkscape::Rubberband::get(desktop)->start(desktop, button_dt); } else { // remember clicked item, disregarding groups, honoring Alt; do nothing with Crtl to -- cgit v1.2.3 From 148614d638b14b5a4b7b3ceb8e0b0fc341ba6e05 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Wed, 9 Nov 2016 22:08:25 +0100 Subject: resizable undocked dialogs (bzr r15233) --- src/ui/widget/dock-item.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui') diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 979c09d2f..2860df12e 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -423,6 +423,8 @@ void DockItem::_onStateChanged(State /*prev_state*/, State new_state) { _window = getWindow(); + if(_window) + _window->set_type_hint(Gdk::WINDOW_TYPE_HINT_NORMAL); if (new_state == FLOATING_STATE && _window) { _window->signal_hide().connect(sigc::mem_fun(*this, &Inkscape::UI::Widget::DockItem::_onHideWindow)); -- cgit v1.2.3 From efce58b64a544a07e942d63bdb7f04929c6fa9c4 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 11 Nov 2016 21:04:49 +0100 Subject: fix automatic dockbar resizing (bzr r15237) --- src/ui/widget/dock.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp index 7744cb695..b2dec401f 100644 --- a/src/ui/widget/dock.cpp +++ b/src/ui/widget/dock.cpp @@ -256,7 +256,7 @@ void Dock::_onLayoutChanged() _paned->get_child1()->set_size_request(-1, -1); _scrolled_window->set_size_request(_default_empty_width); } - getParentPaned()->set_position(INT_MAX); + getParentPaned()->set_position(10000); } else { // unset any forced size requests -- cgit v1.2.3 From 3b4d977a93e600af8ab14c7078878907dc839f3b Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 11 Nov 2016 22:49:01 +0100 Subject: Add a make inkscape_pot to regen potfile (bzr r15239) --- src/ui/dialog/clonetiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index 8e9d3dbbf..3cdcf594a 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -936,7 +936,7 @@ CloneTiler::CloneTiler () : auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); gtk_box_pack_start (GTK_BOX (mainbox), hb, FALSE, FALSE, 0); - GtkWidget *l = gtk_label_new(_("")); + GtkWidget *l = gtk_label_new(""); gtk_label_set_markup (GTK_LABEL(l), _("Apply to tiled clones:")); gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0); } -- cgit v1.2.3 From f2d2c7740567dcf2452c41d8332380708f557157 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 19 Oct 2016 12:50:29 +0200 Subject: Working with rotate preview (bzr r15142.1.15) --- src/ui/tools/tool-base.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 8a35882b9..128a09878 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -345,7 +345,6 @@ bool ToolBase::root_handler(GdkEvent* event) { /* sp_desktop_dialog(); */ } break; - case GDK_BUTTON_PRESS: // save drag origin xp = (gint) event->button.x; @@ -446,7 +445,6 @@ bool ToolBase::root_handler(GdkEvent* event) { // do not drag if we're within tolerance from origin break; } - // Once the user has moved farther than tolerance from // the original location (indicating they intend to move // the object, not click), then always process the motion -- cgit v1.2.3 From c65eeb6abd1a51c075c30fdf95e296fd7640bf25 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 21 Oct 2016 00:02:48 +0200 Subject: update translators (bzr r15184) --- src/ui/dialog/aboutbox.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui') diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index 846f00d8a..552500fe8 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -549,6 +549,8 @@ void AboutBox::initStrings() { "Luca Bruno , 2005.\n" "Lucas Vieites Fariña, 2003-2013.\n" "Mahesh subedi , 2006.\n" +"Marcin Floryan , 2016.\n" +"Maren Hachmann , 2015-2016.\n" "Martin Srebotnjak, , 2005, 2010.\n" "Masatake YAMATO , 2002.\n" "Masato Hashimoto , 2009-2014.\n" -- cgit v1.2.3 From 50c101849a9f591972b5478a7a83407558e7bff7 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 23 Oct 2016 11:03:35 +0200 Subject: Add right click attempt (bzr r15142.1.20) --- src/ui/tools/tool-base.cpp | 216 ++++++++++++++++++++++++++------------------- 1 file changed, 126 insertions(+), 90 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 128a09878..d8800284b 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -327,6 +327,7 @@ bool ToolBase::root_handler(GdkEvent* event) { static unsigned int panning = 0; static unsigned int panning_cursor = 0; static unsigned int zoom_rb = 0; + static double angle = 0; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -345,6 +346,7 @@ bool ToolBase::root_handler(GdkEvent* event) { /* sp_desktop_dialog(); */ } break; + case GDK_BUTTON_PRESS: // save drag origin xp = (gint) event->button.x; @@ -393,21 +395,25 @@ bool ToolBase::root_handler(GdkEvent* event) { break; case 3: - if ((event->button.state & GDK_SHIFT_MASK) || (event->button.state & GDK_CONTROL_MASK)) { - // When starting panning, make sure there are no snap events pending because these might disable the panning again - if (_uses_snap) { - sp_event_context_discard_delayed_snap_event(this); - } - panning = 3; - - sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK - | GDK_POINTER_MOTION_HINT_MASK, NULL, - event->button.time); - - ret = TRUE; - } else { +// if ((event->button.state & GDK_SHIFT_MASK) || (event->button.state & GDK_CONTROL_MASK)) { +// // When starting panning, make sure there are no snap events pending because these might disable the panning again +// if (_uses_snap) { +// sp_event_context_discard_delayed_snap_event(this); +// } +// panning = 3; + +// sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), +// GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK +// | GDK_POINTER_MOTION_HINT_MASK, NULL, +// event->button.time); + +// ret = TRUE; +// } else + if( !this->space_panning ) { sp_event_root_menu_popup(desktop, NULL, event); + } else { + panning = 5; + desktop->canvas->startRotateTo(desktop->namedview->document_rotation); } break; @@ -418,7 +424,27 @@ bool ToolBase::root_handler(GdkEvent* event) { case GDK_MOTION_NOTIFY: if (panning) { - if (panning == 4 && !xp && !yp ) { + if (panning == 5) { + button_w = Geom::Point(event->motion.x, event->motion.y); + Geom::Point const motion_dt(desktop->w2d(button_w)); + Geom::Rect view = desktop->get_display_area(); + Geom::Point view_center = desktop->doc2dt(view.midpoint()); + Geom::Ray center_ray(motion_dt,view_center); + if (event->motion.state & GDK_BUTTON3_MASK) { + desktop->canvas->startRotateTo(desktop->namedview->document_rotation); + if (event->motion.state & GDK_SHIFT_MASK) { + angle = floor(center_ray.angle()/5) * 5; + } else if (event->motion.state & GDK_CONTROL_MASK) { + angle = center_ray.angle(); + } else if (event->motion.state & GDK_KEY_Alt_L || + event->motion.state & GDK_KEY_Alt_R){ + angle = desktop->namedview->document_rotation; + } else { + angle = floor(center_ray.angle()); + } + desktop->canvas->rotateTo(desktop->getDrawing(), angle); + } + } else if (panning == 4 && !xp && !yp ) { // + mouse panning started, save location and grab canvas xp = event->motion.x; yp = event->motion.y; @@ -430,41 +456,43 @@ bool ToolBase::root_handler(GdkEvent* event) { | GDK_POINTER_MOTION_HINT_MASK, NULL, event->motion.time - 1); } + if (panning != 5) { + if ((panning == 2 && !(event->motion.state & GDK_BUTTON2_MASK)) + || (panning == 1 && !(event->motion.state & GDK_BUTTON1_MASK)) + || (panning == 3 && !(event->motion.state & GDK_BUTTON3_MASK))) { + /* Gdk seems to lose button release for us sometimes :-( */ + panning = 0; + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); + ret = TRUE; + } else { + if (within_tolerance && (abs((gint) event->motion.x - xp) + < tolerance) && (abs((gint) event->motion.y - yp) + < tolerance)) { + // do not drag if we're within tolerance from origin + break; + } - if ((panning == 2 && !(event->motion.state & GDK_BUTTON2_MASK)) - || (panning == 1 && !(event->motion.state & GDK_BUTTON1_MASK)) - || (panning == 3 && !(event->motion.state & GDK_BUTTON3_MASK))) { - /* Gdk seems to lose button release for us sometimes :-( */ - panning = 0; - sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); - ret = TRUE; - } else { - if (within_tolerance && (abs((gint) event->motion.x - xp) - < tolerance) && (abs((gint) event->motion.y - yp) - < tolerance)) { - // do not drag if we're within tolerance from origin - break; - } - // Once the user has moved farther than tolerance from - // the original location (indicating they intend to move - // the object, not click), then always process the motion - // notify coordinates as given (no snapping back to origin) - within_tolerance = false; - - // gobble subsequent motion events to prevent "sticking" - // when scrolling is slow - gobble_motion_events(panning == 2 ? GDK_BUTTON2_MASK : (panning - == 1 ? GDK_BUTTON1_MASK : GDK_BUTTON3_MASK)); - - if (panning_cursor == 0) { - panning_cursor = 1; - this->sp_event_context_set_cursor(GDK_FLEUR); - } + // Once the user has moved farther than tolerance from + // the original location (indicating they intend to move + // the object, not click), then always process the motion + // notify coordinates as given (no snapping back to origin) + within_tolerance = false; - Geom::Point const motion_w(event->motion.x, event->motion.y); - Geom::Point const moved_w(motion_w - button_w); - this->desktop->scroll_world(moved_w, true); // we're still scrolling, do not redraw - ret = TRUE; + // gobble subsequent motion events to prevent "sticking" + // when scrolling is slow + gobble_motion_events(panning == 2 ? GDK_BUTTON2_MASK : (panning + == 1 ? GDK_BUTTON1_MASK : GDK_BUTTON3_MASK)); + + if (panning_cursor == 0) { + panning_cursor = 1; + this->sp_event_context_set_cursor(GDK_FLEUR); + } + + Geom::Point const motion_w(event->motion.x, event->motion.y); + Geom::Point const moved_w(motion_w - button_w); + this->desktop->scroll_world(moved_w, true); // we're still scrolling, do not redraw + ret = TRUE; + } } } else if (zoom_rb) { Geom::Point const motion_w(event->motion.x, event->motion.y); @@ -494,60 +522,68 @@ bool ToolBase::root_handler(GdkEvent* event) { break; case GDK_BUTTON_RELEASE: - xp = yp = 0; + if (panning == 5) { + desktop->canvas->endRotateTo(); + sp_repr_set_svg_double(desktop->namedview->getRepr(), "inkscape:document-rotation", angle); + SPObject *updated = SP_OBJECT(desktop->namedview); + if (updated) { + updated->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + } + } else { + xp = yp = 0; + if (panning_cursor == 1) { + panning_cursor = 0; + GtkWidget *w = GTK_WIDGET(this->desktop->getCanvas()); + gdk_window_set_cursor(gtk_widget_get_window (w), this->cursor); + } - if (panning_cursor == 1) { - panning_cursor = 0; - GtkWidget *w = GTK_WIDGET(this->desktop->getCanvas()); - gdk_window_set_cursor(gtk_widget_get_window (w), this->cursor); - } + if (within_tolerance && (panning || zoom_rb)) { + zoom_rb = 0; - if (within_tolerance && (panning || zoom_rb)) { - zoom_rb = 0; + if (panning) { + panning = 0; + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), + event->button.time); + } - if (panning) { - panning = 0; - sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), - event->button.time); - } + Geom::Point const event_w(event->button.x, event->button.y); + Geom::Point const event_dt(desktop->w2d(event_w)); - Geom::Point const event_w(event->button.x, event->button.y); - Geom::Point const event_dt(desktop->w2d(event_w)); + double const zoom_inc = prefs->getDoubleLimited( + "/options/zoomincrement/value", M_SQRT2, 1.01, 10); - double const zoom_inc = prefs->getDoubleLimited( - "/options/zoomincrement/value", M_SQRT2, 1.01, 10); + desktop->zoom_relative_keep_point(event_dt, (event->button.state + & GDK_SHIFT_MASK) ? 1 / zoom_inc : zoom_inc); - desktop->zoom_relative_keep_point(event_dt, (event->button.state - & GDK_SHIFT_MASK) ? 1 / zoom_inc : zoom_inc); + desktop->updateNow(); + ret = TRUE; + } else if (panning == event->button.button) { + panning = 0; + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), + event->button.time); - desktop->updateNow(); - ret = TRUE; - } else if (panning == event->button.button) { - panning = 0; - sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), - event->button.time); + // in slow complex drawings, some of the motion events are lost; + // to make up for this, we scroll it once again to the button-up event coordinates + // (i.e. canvas will always get scrolled all the way to the mouse release point, + // even if few intermediate steps were visible) + Geom::Point const motion_w(event->button.x, event->button.y); + Geom::Point const moved_w(motion_w - button_w); - // in slow complex drawings, some of the motion events are lost; - // to make up for this, we scroll it once again to the button-up event coordinates - // (i.e. canvas will always get scrolled all the way to the mouse release point, - // even if few intermediate steps were visible) - Geom::Point const motion_w(event->button.x, event->button.y); - Geom::Point const moved_w(motion_w - button_w); + this->desktop->scroll_world(moved_w); + desktop->updateNow(); + ret = TRUE; + } else if (zoom_rb == event->button.button) { + zoom_rb = 0; - this->desktop->scroll_world(moved_w); - desktop->updateNow(); - ret = TRUE; - } else if (zoom_rb == event->button.button) { - zoom_rb = 0; + Geom::OptRect const b = Inkscape::Rubberband::get(desktop)->getRectangle(); + Inkscape::Rubberband::get(desktop)->stop(); - Geom::OptRect const b = Inkscape::Rubberband::get(desktop)->getRectangle(); - Inkscape::Rubberband::get(desktop)->stop(); + if (b && !within_tolerance) { + desktop->set_display_area(*b, 10); + } - if (b && !within_tolerance) { - desktop->set_display_area(*b, 10); + ret = TRUE; } - - ret = TRUE; } break; -- cgit v1.2.3 From 74edf9fcbc3106cccddb2a293275748fefa08f0b Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 23 Oct 2016 20:04:23 +0200 Subject: Add right click rotation panning (bzr r15142.1.22) --- src/ui/tools/tool-base.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 87f808039..33c0492d7 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -334,7 +334,6 @@ bool ToolBase::root_handler(GdkEvent* event) { /// @todo REmove redundant /value in preference keys tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); bool allow_panning = prefs->getBool("/options/spacebarpans/value"); - bool clear = true; gint ret = FALSE; switch (event->type) { @@ -346,7 +345,6 @@ bool ToolBase::root_handler(GdkEvent* event) { } else { /* sp_desktop_dialog(); */ } - desktop->canvas->clearRotateTo(); break; case GDK_BUTTON_PRESS: @@ -434,14 +432,13 @@ bool ToolBase::root_handler(GdkEvent* event) { | GDK_POINTER_MOTION_HINT_MASK, NULL, event->motion.time - 1); } else if (this->space_panning && event->motion.state & GDK_BUTTON3_MASK) { - clear = false; sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); desktop->canvas->startRotateTo(desktop->namedview->document_rotation); button_w = Geom::Point(event->motion.x, event->motion.y); - Geom::Point const motion_dt(desktop->w2d(button_w)); + Geom::Point const motion_dt(desktop->doc2dt(desktop->w2d(button_w))); Geom::Rect view = desktop->get_display_area(); Geom::Point view_center = desktop->doc2dt(view.midpoint()); - Geom::Ray center_ray(view_center, motion_dt); + Geom::Ray center_ray(motion_dt, view_center); desktop->canvas->startRotateTo(desktop->namedview->document_rotation); angle = Geom::deg_from_rad(center_ray.angle()) - 90; if (event->motion.state & GDK_SHIFT_MASK && event->motion.state & GDK_CONTROL_MASK) { @@ -583,6 +580,7 @@ bool ToolBase::root_handler(GdkEvent* event) { ret = TRUE; } } + desktop->canvas->clearRotateTo(); break; case GDK_KEY_PRESS: { @@ -752,6 +750,7 @@ bool ToolBase::root_handler(GdkEvent* event) { switch (get_group0_keyval(&event->key)) { case GDK_KEY_space: + desktop->canvas->clearRotateTo(); if (within_tolerance) { // Space was pressed, but not panned sp_toggle_selector(desktop); @@ -773,6 +772,7 @@ bool ToolBase::root_handler(GdkEvent* event) { default: break; } + desktop->canvas->clearRotateTo(); break; case GDK_SCROLL: { @@ -856,7 +856,6 @@ bool ToolBase::root_handler(GdkEvent* event) { default: break; } - desktop->canvas->clearRotateTo(clear); return ret; } -- cgit v1.2.3 From b65d3fdc9c15af81c5e433d8f1b714ef4ab61487 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 23 Oct 2016 21:18:11 +0200 Subject: Add right click rotation panning, some fixes (bzr r15142.1.23) --- src/ui/tools/tool-base.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 33c0492d7..f7315c648 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -516,7 +516,21 @@ bool ToolBase::root_handler(GdkEvent* event) { break; case GDK_BUTTON_RELEASE: + desktop->canvas->clearRotateTo(); if (this->space_panning && event->button.button == 3) { + xp = yp = 0; + if (panning_cursor == 1) { + panning_cursor = 0; + GtkWidget *w = GTK_WIDGET(this->desktop->getCanvas()); + gdk_window_set_cursor(gtk_widget_get_window (w), this->cursor); + } + zoom_rb = 0; + if (panning) { + panning = 0; + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), + event->button.time); + } + ret = TRUE; if (desktop->canvas->endRotateTo()) { sp_repr_set_svg_double(desktop->namedview->getRepr(), "inkscape:document-rotation", angle); SPObject *updated = SP_OBJECT(desktop->namedview); @@ -580,7 +594,6 @@ bool ToolBase::root_handler(GdkEvent* event) { ret = TRUE; } } - desktop->canvas->clearRotateTo(); break; case GDK_KEY_PRESS: { -- cgit v1.2.3 From 532f77b14a76fc04e6bdeca3625f9a55b5f11bdf Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 25 Oct 2016 00:58:43 +0200 Subject: CPPification: almost all sp_object_set_whatever and sp_selection_whatever global functions are now methods of ObjectSet*, with these additional benefits: - They can now act on any SelectionSet, not just the current selection; - Whenever possible, they don't need a desktop anymore and can run if called from GUI. I hope I did not break too many things in the process. *: So instead of callink sp_selection_move(desktop,x,y), you call myobjectset->move(x,y) (bzr r15189) --- src/ui/clipboard.cpp | 187 ++++++++++++++++---------------- src/ui/clipboard.h | 10 +- src/ui/dialog/export.cpp | 2 +- src/ui/dialog/layer-properties.cpp | 2 +- src/ui/dialog/livepatheffect-editor.cpp | 4 +- src/ui/dialog/transformation.cpp | 20 ++-- src/ui/interface.cpp | 16 +-- src/ui/tools/box3d-tool.cpp | 2 +- src/ui/tools/eraser-tool.cpp | 14 +-- src/ui/tools/freehand-base.cpp | 2 +- src/ui/tools/pen-tool.cpp | 2 +- src/ui/tools/pencil-tool.cpp | 2 +- src/ui/tools/rect-tool.cpp | 2 +- src/ui/tools/select-tool.cpp | 46 ++++---- 14 files changed, 155 insertions(+), 156 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 66b13ed9d..0a671cc8a 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -74,6 +74,7 @@ #include "svg/svg-color.h" #include "sp-namedview.h" #include "persp3d.h" +#include "object-set.h" /// Made up mimetype to represent Gdk::Pixbuf clipboard contents. #define CLIPBOARD_GDK_PIXBUF_TARGET "image/x-gdk-pixbuf" @@ -93,13 +94,13 @@ namespace UI { */ class ClipboardManagerImpl : public ClipboardManager { public: - virtual void copy(SPDesktop *desktop); + virtual void copy(ObjectSet *set); virtual void copyPathParameter(Inkscape::LivePathEffect::PathParam *); virtual void copySymbol(Inkscape::XML::Node* symbol, gchar const* style, bool user_symbol); virtual bool paste(SPDesktop *desktop, bool in_place); - virtual bool pasteStyle(SPDesktop *desktop); - virtual bool pasteSize(SPDesktop *desktop, bool separately, bool apply_x, bool apply_y); - virtual bool pastePathEffect(SPDesktop *desktop); + virtual bool pasteStyle(ObjectSet *set); + virtual bool pasteSize(ObjectSet *set, bool separately, bool apply_x, bool apply_y); + virtual bool pastePathEffect(ObjectSet *set); virtual Glib::ustring getPathParameter(SPDesktop* desktop); virtual Glib::ustring getShapeOrTextObjectId(SPDesktop *desktop); virtual const gchar *getFirstObjectID(); @@ -108,7 +109,7 @@ public: ~ClipboardManagerImpl(); private: - void _copySelection(Inkscape::Selection *); + void _copySelection(ObjectSet *); void _copyUsedDefs(SPItem *); void _copyGradient(SPGradient *); void _copyPattern(SPPattern *); @@ -183,76 +184,74 @@ ClipboardManagerImpl::~ClipboardManagerImpl() {} /** * Copy selection contents to the clipboard. */ -void ClipboardManagerImpl::copy(SPDesktop *desktop) +void ClipboardManagerImpl::copy(ObjectSet *set) { - if ( desktop == NULL ) { - return; - } - Inkscape::Selection *selection = desktop->getSelection(); + if ( set->desktop() ) { + SPDesktop *desktop = set->desktop(); + + // Special case for when the gradient dragger is active - copies gradient color + if (desktop->event_context->get_drag()) { + GrDrag *drag = desktop->event_context->get_drag(); + if (drag->hasSelection()) { + guint32 col = drag->getColor(); + + // set the color as clipboard content (text in RRGGBBAA format) + _setClipboardColor(col); + + // create a style with this color on fill and opacity in master opacity, so it can be + // pasted on other stops or objects + if (_text_style) { + sp_repr_css_attr_unref(_text_style); + _text_style = NULL; + } + _text_style = sp_repr_css_attr_new(); + // print and set properties + gchar color_str[16]; + g_snprintf(color_str, 16, "#%06x", col >> 8); + sp_repr_css_set_property(_text_style, "fill", color_str); + float opacity = SP_RGBA32_A_F(col); + if (opacity > 1.0) { + opacity = 1.0; // safeguard + } + Inkscape::CSSOStringStream opcss; + opcss << opacity; + sp_repr_css_set_property(_text_style, "opacity", opcss.str().data()); - // Special case for when the gradient dragger is active - copies gradient color - if (desktop->event_context->get_drag()) { - GrDrag *drag = desktop->event_context->get_drag(); - if (drag->hasSelection()) { - guint32 col = drag->getColor(); + _discardInternalClipboard(); + return; + } + } - // set the color as clipboard content (text in RRGGBBAA format) - _setClipboardColor(col); + // Special case for when the color picker ("dropper") is active - copies color under cursor + if (tools_isactive(desktop, TOOLS_DROPPER)) { + //_setClipboardColor(sp_dropper_context_get_color(desktop->event_context)); + _setClipboardColor(SP_DROPPER_CONTEXT(desktop->event_context)->get_color()); + _discardInternalClipboard(); + return; + } - // create a style with this color on fill and opacity in master opacity, so it can be - // pasted on other stops or objects + // Special case for when the text tool is active - if some text is selected, copy plain text, + // not the object that holds it; also copy the style at cursor into + if (tools_isactive(desktop, TOOLS_TEXT)) { + _discardInternalClipboard(); + Glib::ustring selected_text = Inkscape::UI::Tools::sp_text_get_selected_text(desktop->event_context); + _clipboard->set_text(selected_text); if (_text_style) { sp_repr_css_attr_unref(_text_style); _text_style = NULL; } - _text_style = sp_repr_css_attr_new(); - // print and set properties - gchar color_str[16]; - g_snprintf(color_str, 16, "#%06x", col >> 8); - sp_repr_css_set_property(_text_style, "fill", color_str); - float opacity = SP_RGBA32_A_F(col); - if (opacity > 1.0) { - opacity = 1.0; // safeguard - } - Inkscape::CSSOStringStream opcss; - opcss << opacity; - sp_repr_css_set_property(_text_style, "opacity", opcss.str().data()); - - _discardInternalClipboard(); + _text_style = Inkscape::UI::Tools::sp_text_get_style_at_cursor(desktop->event_context); return; } } - - // Special case for when the color picker ("dropper") is active - copies color under cursor - if (tools_isactive(desktop, TOOLS_DROPPER)) { - //_setClipboardColor(sp_dropper_context_get_color(desktop->event_context)); - _setClipboardColor(SP_DROPPER_CONTEXT(desktop->event_context)->get_color()); - _discardInternalClipboard(); - return; - } - - // Special case for when the text tool is active - if some text is selected, copy plain text, - // not the object that holds it; also copy the style at cursor into - if (tools_isactive(desktop, TOOLS_TEXT)) { - _discardInternalClipboard(); - Glib::ustring selected_text = Inkscape::UI::Tools::sp_text_get_selected_text(desktop->event_context); - _clipboard->set_text(selected_text); - if (_text_style) { - sp_repr_css_attr_unref(_text_style); - _text_style = NULL; - } - _text_style = Inkscape::UI::Tools::sp_text_get_style_at_cursor(desktop->event_context); - return; - } - - if (selection->isEmpty()) { // check whether something is selected - _userWarn(desktop, _("Nothing was copied.")); + if (set->isEmpty()) { // check whether something is selected + _userWarn(set->desktop(), _("Nothing was copied.")); return; } _discardInternalClipboard(); _createInternalClipboard(); // construct a new clipboard document - _copySelection(selection); // copy all items in the selection to the internal clipboard + _copySelection(set); // copy all items in the selection to the internal clipboard fit_canvas_to_drawing(_clipboardSPDoc); _setClipboardTargets(); @@ -426,16 +425,15 @@ const gchar *ClipboardManagerImpl::getFirstObjectID() /** * Implements the Paste Style action. */ -bool ClipboardManagerImpl::pasteStyle(SPDesktop *desktop) +bool ClipboardManagerImpl::pasteStyle(ObjectSet *set) { - if (desktop == NULL) { + if (set->desktop() == NULL) { return false; } // check whether something is selected - Inkscape::Selection *selection = desktop->getSelection(); - if (selection->isEmpty()) { - _userWarn(desktop, _("Select object(s) to paste style to.")); + if (set->isEmpty()) { + _userWarn(set->desktop(), _("Select object(s) to paste style to.")); return false; } @@ -443,10 +441,10 @@ bool ClipboardManagerImpl::pasteStyle(SPDesktop *desktop) if ( tempdoc == NULL ) { // no document, but we can try _text_style if (_text_style) { - sp_desktop_set_style(desktop, _text_style); + sp_desktop_set_style(set, set->desktop(), _text_style); return true; } else { - _userWarn(desktop, _("No style on the clipboard.")); + _userWarn(set->desktop(), _("No style on the clipboard.")); return false; } } @@ -457,13 +455,13 @@ bool ClipboardManagerImpl::pasteStyle(SPDesktop *desktop) bool pasted = false; if (clipnode) { - desktop->doc()->importDefs(tempdoc); + set->document()->importDefs(tempdoc); SPCSSAttr *style = sp_repr_css_attr(clipnode, "style"); - sp_desktop_set_style(desktop, style); + sp_desktop_set_style(set, set->desktop(), style); pasted = true; } else { - _userWarn(desktop, _("No style on the clipboard.")); + _userWarn(set->desktop(), _("No style on the clipboard.")); } tempdoc->doUnref(); @@ -477,29 +475,31 @@ bool ClipboardManagerImpl::pasteStyle(SPDesktop *desktop) * @param apply_x Whether to scale the width of objects / selection * @param apply_y Whether to scale the height of objects / selection */ -bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool apply_x, bool apply_y) +bool ClipboardManagerImpl::pasteSize(ObjectSet *set, bool separately, bool apply_x, bool apply_y) { if (!apply_x && !apply_y) { return false; // pointless parameters } - if ( desktop == NULL ) { +/* if ( desktop == NULL ) { return false; } - Inkscape::Selection *selection = desktop->getSelection(); - if (selection->isEmpty()) { - _userWarn(desktop, _("Select object(s) to paste size to.")); + Inkscape::Selection *selection = desktop->getSelection();*/ + if (set->isEmpty()) { + if(set->desktop()) + _userWarn(set->desktop(), _("Select object(s) to paste size to.")); return false; } // FIXME: actually, this should accept arbitrary documents SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); if ( tempdoc == NULL ) { - _userWarn(desktop, _("No size on the clipboard.")); + if(set->desktop()) + _userWarn(set->desktop(), _("No size on the clipboard.")); return false; } - // retrieve size ifomration from the clipboard + // retrieve size information from the clipboard Inkscape::XML::Node *root = tempdoc->getReprRoot(); Inkscape::XML::Node *clipnode = sp_repr_lookup_name(root, "inkscape:clipboard", 1); bool pasted = false; @@ -510,13 +510,13 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a // resize each object in the selection if (separately) { - auto itemlist= selection->items(); + auto itemlist= set->items(); for(auto i=itemlist.begin();i!=itemlist.end();++i){ SPItem *item = *i; if (item) { Geom::OptRect obj_size = item->desktopVisualBounds(); if ( obj_size ) { - sp_item_scale_rel(item, _getScale(desktop, min, max, *obj_size, apply_x, apply_y)); + sp_item_scale_rel(item, _getScale(set->desktop(), min, max, *obj_size, apply_x, apply_y)); } } else { g_assert_not_reached(); @@ -525,10 +525,10 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a } // resize the selection as a whole else { - Geom::OptRect sel_size = selection->visualBounds(); + Geom::OptRect sel_size = set->visualBounds(); if ( sel_size ) { - sp_object_set_scale_relative(selection, sel_size->midpoint(), - _getScale(desktop, min, max, *sel_size, apply_x, apply_y)); + set->setScaleRelative(sel_size->midpoint(), + _getScale(set->desktop(), min, max, *sel_size, apply_x, apply_y)); } } pasted = true; @@ -541,18 +541,18 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a /** * Applies a path effect from the clipboard to the selected path. */ -bool ClipboardManagerImpl::pastePathEffect(SPDesktop *desktop) +bool ClipboardManagerImpl::pastePathEffect(ObjectSet *set) { /** @todo FIXME: pastePathEffect crashes when moving the path with the applied effect, segfaulting in fork_private_if_necessary(). */ - if ( desktop == NULL ) { + if ( set->desktop() == NULL ) { return false; } - Inkscape::Selection *selection = desktop->getSelection(); - if (!selection || selection->isEmpty()) { - _userWarn(desktop, _("Select object(s) to paste live path effect to.")); + //Inkscape::Selection *selection = desktop->getSelection(); + if (!set || set->isEmpty()) { + _userWarn(set->desktop(), _("Select object(s) to paste live path effect to.")); return false; } @@ -563,10 +563,10 @@ bool ClipboardManagerImpl::pastePathEffect(SPDesktop *desktop) if ( clipnode ) { gchar const *effectstack = clipnode->attribute("inkscape:path-effect"); if ( effectstack ) { - desktop->doc()->importDefs(tempdoc); + set->document()->importDefs(tempdoc); // make sure all selected items are converted to paths first (i.e. rectangles) - sp_selected_to_lpeitems(desktop); - auto itemlist= selection->items(); + set->toLPEItems(); + auto itemlist= set->items(); for(auto i=itemlist.begin();i!=itemlist.end();++i){ SPItem *item = *i; _applyPathEffect(item, effectstack); @@ -578,7 +578,7 @@ bool ClipboardManagerImpl::pastePathEffect(SPDesktop *desktop) } // no_effect: - _userWarn(desktop, _("No effect on the clipboard.")); + _userWarn(set->desktop(), _("No effect on the clipboard.")); return false; } @@ -646,7 +646,7 @@ Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId(SPDesktop *desktop) /** * Iterate over a list of items and copy them to the clipboard. */ -void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) +void ClipboardManagerImpl::_copySelection(ObjectSet *selection) { // copy the defs used by all items auto itemlist= selection->items(); @@ -1270,7 +1270,7 @@ Geom::Scale ClipboardManagerImpl::_getScale(SPDesktop *desktop, Geom::Point cons } // If the "lock aspect ratio" button is pressed and we paste only a single coordinate, // resize the second one by the same ratio too - if (desktop->isToolboxButtonActive("lock")) { + if (desktop && desktop->isToolboxButtonActive("lock")) { if (apply_x && !apply_y) { scale_y = scale_x; } @@ -1432,7 +1432,8 @@ void ClipboardManagerImpl::_setClipboardColor(guint32 color) */ void ClipboardManagerImpl::_userWarn(SPDesktop *desktop, char const *msg) { - desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, msg); + if(desktop) + desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, msg); } /* ####################################### diff --git a/src/ui/clipboard.h b/src/ui/clipboard.h index 9f3b6cbdb..32a49867c 100644 --- a/src/ui/clipboard.h +++ b/src/ui/clipboard.h @@ -24,7 +24,7 @@ // forward declarations class SPDesktop; namespace Inkscape { -class Selection; +class ObjectSet; namespace XML { class Node; } namespace LivePathEffect { class PathParam; } @@ -42,13 +42,13 @@ namespace UI { class ClipboardManager { public: - virtual void copy(SPDesktop *desktop) = 0; + virtual void copy(ObjectSet *set) = 0; virtual void copyPathParameter(Inkscape::LivePathEffect::PathParam *) = 0; virtual void copySymbol(Inkscape::XML::Node* symbol, gchar const* style, bool user_symbol = true) = 0; virtual bool paste(SPDesktop *desktop, bool in_place = false) = 0; - virtual bool pasteStyle(SPDesktop *desktop) = 0; - virtual bool pasteSize(SPDesktop *desktop, bool separately, bool apply_x, bool apply_y) = 0; - virtual bool pastePathEffect(SPDesktop *desktop) = 0; + virtual bool pasteStyle(ObjectSet *set) = 0; + virtual bool pasteSize(ObjectSet *set, bool separately, bool apply_x, bool apply_y) = 0; + virtual bool pastePathEffect(ObjectSet *set) = 0; virtual Glib::ustring getPathParameter(SPDesktop* desktop) = 0; virtual Glib::ustring getShapeOrTextObjectId(SPDesktop *desktop) = 0; virtual const gchar *getFirstObjectID() = 0; diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 64a5d9866..98ecf6db7 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -785,7 +785,7 @@ void Export::onAreaToggled () case SELECTION_SELECTION: if ((SP_ACTIVE_DESKTOP->getSelection())->isEmpty() == false) { - sp_object_set_get_export_hints(SP_ACTIVE_DESKTOP->getSelection(), filename, &xdpi, &ydpi); + SP_ACTIVE_DESKTOP->getSelection()->getExportHints(filename, &xdpi, &ydpi); /* If we still don't have a filename -- let's build one that's nice */ diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index 4aa86cc48..f28f8336a 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -384,7 +384,7 @@ void LayerPropertiesDialog::Move::setup(LayerPropertiesDialog &dialog) { void LayerPropertiesDialog::Move::perform(LayerPropertiesDialog &dialog) { SPObject *moveto = dialog._selectedLayer(); - sp_selection_to_layer(dialog._desktop, moveto, false); + dialog._desktop->selection->toLayer(moveto); } void LayerPropertiesDialog::_setDesktop(SPDesktop *desktop) { diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 73f8debd6..b97b0e63a 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -419,7 +419,7 @@ LivePathEffectEditor::onAdd() // If item is a SPRect, convert it to path first: if ( dynamic_cast(item) ) { - sp_selected_path_to_curves(sel, current_desktop, false); + sel->toCurves(); item = sel->singleItem(); // get new item } @@ -451,7 +451,7 @@ LivePathEffectEditor::onAdd() item = NULL; // run sp_selection_clone_original_path_lpe - sp_selection_clone_original_path_lpe(current_desktop); + sel->cloneOriginalPathLPE(); SPItem *new_item = sel->singleItem(); // Check that the cloning was successful. We don't want to change the ID of the original referenced path! diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 7f1492cd7..5ec47b0dc 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -617,12 +617,11 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) if (!prefs->getBool("/dialogs/transformation/applyseparately")) { // move selection as a whole if (_check_move_relative.get_active()) { - sp_object_set_move_relative(selection, x, y); + selection->moveRelative(x, y); } else { Geom::OptRect bbox = selection->preferredBounds(); if (bbox) { - sp_object_set_move_relative(selection, - x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); + selection->moveRelative(x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); } } } else { @@ -685,8 +684,7 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) } else { Geom::OptRect bbox = selection->preferredBounds(); if (bbox) { - sp_object_set_move_relative(selection, - x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); + selection->moveRelative(x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); } } } @@ -750,7 +748,7 @@ void Transformation::applyPageScale(Inkscape::Selection *selection) double y1 = bbox_pref->midpoint()[Geom::Y] + new_height/2; Geom::Affine scaler = get_scale_transform_for_variable_stroke (*bbox_pref, *bbox_geom, transform_stroke, preserve, x0, y0, x1, y1); - sp_object_set_apply_affine(selection, scaler); + selection->applyAffine(scaler); } } @@ -776,7 +774,7 @@ void Transformation::applyPageRotate(Inkscape::Selection *selection) } else { boost::optional center = selection->center(); if (center) { - sp_object_set_rotate_relative(selection, *center, angle); + selection->rotateRelative(*center, angle); } } @@ -843,7 +841,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); return; } - sp_object_set_skew_relative(selection, *center, 0.01 * skewX, 0.01 * skewY); + selection->skewRelative(*center, 0.01 * skewX, 0.01 * skewY); } else if (_units_skew.isRadial()) { //deg or rad double angleX = _scalar_skew_horizontal.getValue("rad"); double angleY = _scalar_skew_vertical.getValue("rad"); @@ -856,7 +854,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) } double skewX = tan(-angleX); double skewY = tan(angleY); - sp_object_set_skew_relative(selection, *center, skewX, skewY); + selection->skewRelative(*center, skewX, skewY); } else { // absolute displacement double skewX = _scalar_skew_horizontal.getValue("px"); double skewY = _scalar_skew_vertical.getValue("px"); @@ -864,7 +862,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, not used.")); return; } - sp_object_set_skew_relative(selection, *center, skewX / height, skewY / width); + selection->skewRelative(*center, skewX / height, skewY / width); } } } @@ -897,7 +895,7 @@ void Transformation::applyPageTransform(Inkscape::Selection *selection) item->updateRepr(); } } else { - sp_object_set_apply_affine(selection, displayed); // post-multiply each object's transform + selection->applyAffine(displayed); // post-multiply each object's transform } DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_DIALOG_TRANSFORM, diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index b47e66451..e0c767509 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -1210,7 +1210,7 @@ sp_ui_drag_data_received(GtkWidget *widget, Geom::OptRect sel_bbox = selection->visualBounds(); if (sel_bbox) { Geom::Point m( desktop->point() - sel_bbox->midpoint() ); - sp_object_set_move_relative(selection, m, false); + selection->moveRelative(m, false); } } @@ -1841,28 +1841,28 @@ void ContextMenu::ItemCreateLink(void) void ContextMenu::SetMask(void) { - sp_selection_set_mask(_desktop, false, false); + _desktop->selection->setMask(false, false); } void ContextMenu::ReleaseMask(void) { - sp_selection_unset_mask(_desktop, false); + _desktop->selection->unsetMask(false); } void ContextMenu::CreateGroupClip(void) { - sp_selection_set_clipgroup(_desktop); + _desktop->selection->setClipGroup(); } void ContextMenu::SetClip(void) { - sp_selection_set_mask(_desktop, true, false); + _desktop->selection->setMask(true, false); } void ContextMenu::ReleaseClip(void) { - sp_selection_unset_mask(_desktop, true); + _desktop->selection->unsetMask(true); } void ContextMenu::MakeGroupMenu(void) @@ -1876,7 +1876,7 @@ void ContextMenu::MakeGroupMenu(void) void ContextMenu::ActivateGroup(void) { - sp_selection_group(_desktop->selection, _desktop); + _desktop->selection->group(); } void ContextMenu::ActivateUngroup(void) @@ -1889,7 +1889,7 @@ void ContextMenu::ActivateUngroup(void) void ContextMenu::ActivateUngroupPopSelection(void) { - sp_selection_ungroup_pop_selection(_desktop->selection, _desktop); + _desktop->selection->popFromGroup(); } diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp index 94488a700..425695a2c 100644 --- a/src/ui/tools/box3d-tool.cpp +++ b/src/ui/tools/box3d-tool.cpp @@ -400,7 +400,7 @@ bool Box3dTool::root_handler(GdkEvent* event) { case GDK_KEY_g: case GDK_KEY_G: if (MOD__SHIFT_ONLY(event)) { - sp_selection_to_guides(desktop); + desktop->selection->toGuides(); ret = true; } break; diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp index 12686160b..4f941e534 100644 --- a/src/ui/tools/eraser-tool.cpp +++ b/src/ui/tools/eraser-tool.cpp @@ -732,10 +732,10 @@ void EraserTool::set_to_accumulated() { workDone = true; // TODO set this only if something was cut. bool break_apart = prefs->getBool("/tools/eraser/break_apart", false); if(!break_apart){ - sp_selected_path_combine(this->desktop, true); + selection->combine(true); } else { if(!this->nowidth){ - sp_selected_path_break_apart(this->desktop, true); + selection->breakApart(true); } } if ( !selection->isEmpty() ) { @@ -784,7 +784,7 @@ void EraserTool::set_to_accumulated() { sp_object_ref(clip_path, 0); clip_path->deleteObject(true); sp_object_unref(clip_path); - sp_selection_raise_to_top(selection, this->desktop, true); + selection->raiseToTop(true); selection->add(dup_clip); sp_selected_path_diff_skip_undo(selection); SPItem * clip = SP_ITEM(*(selection->items().begin())); @@ -800,13 +800,13 @@ void EraserTool::set_to_accumulated() { rect->transform = SP_ITEM(rect->parent)->i2dt_affine().inverse(); rect->updateRepr(); rect->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - sp_selection_raise_to_top(selection, this->desktop, true); + selection->raiseToTop(true); selection->add(rect); sp_selected_path_diff_skip_undo(selection); } - sp_selection_raise_to_top(selection, this->desktop, true); + selection->raiseToTop(true); selection->add(item); - sp_selection_set_mask(this->desktop, true, false, true); + selection->setMask(true, false, true); } else { SPItem *erase_clip = selection->singleItem(); if (erase_clip) { @@ -836,7 +836,7 @@ void EraserTool::set_to_accumulated() { } if (eraser_mode == ERASER_MODE_DELETE) { - sp_selection_delete(this->desktop); + selection->deleteItems(); remainingItems.clear(); } diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index a7cd39a89..300324467 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -435,7 +435,7 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, if(bend_item != NULL && bend_item->getRepr() != NULL){ gchar const *svgd = item->getRepr()->attribute("d"); dc->selection->add(SP_OBJECT(bend_item)); - sp_selection_duplicate(dc->desktop); + dc->selection->duplicate(); dc->selection->remove(SP_OBJECT(bend_item)); bend_item = dc->selection->singleItem(); if(bend_item){ diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index b7579b1fb..312338882 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -1233,7 +1233,7 @@ bool PenTool::_handleKeyPress(GdkEvent *event) { case GDK_KEY_g: case GDK_KEY_G: if (MOD__SHIFT_ONLY(event)) { - sp_selection_to_guides(this->desktop); + this->desktop->selection->toGuides(); ret = true; } break; diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index 9e8005be8..54106437c 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -487,7 +487,7 @@ bool PencilTool::_handleKeyPress(GdkEventKey const &event) { case GDK_KEY_g: case GDK_KEY_G: if (Inkscape::UI::held_only_shift(event)) { - sp_selection_to_guides(this->desktop); + this->desktop->selection->toGuides(); ret = true; } break; diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp index 00330ef57..272531945 100644 --- a/src/ui/tools/rect-tool.cpp +++ b/src/ui/tools/rect-tool.cpp @@ -294,7 +294,7 @@ bool RectTool::root_handler(GdkEvent* event) { case GDK_KEY_g: case GDK_KEY_G: if (MOD__SHIFT_ONLY(event)) { - sp_selection_to_guides(desktop); + desktop->selection->toGuides(); ret = true; } break; diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 0cdeda0b6..6c450b3dc 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -902,15 +902,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), mul*-10, 0); // shift + desktop->getSelection()->moveScreen(mul*-10, 0); // shift } else { - sp_selection_move_screen(desktop->getSelection(), mul*-1, 0); // no shift + desktop->getSelection()->moveScreen(mul*-1, 0); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), mul*-10*nudge, 0); // shift + desktop->getSelection()->move(mul*-10*nudge, 0); // shift } else { - sp_selection_move(desktop->getSelection(), mul*-nudge, 0); // no shift + desktop->getSelection()->move(mul*-nudge, 0); // no shift } } @@ -925,15 +925,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), 0, mul*10); // shift + desktop->getSelection()->moveScreen(0, mul*10); // shift } else { - sp_selection_move_screen(desktop->getSelection(), 0, mul*1); // no shift + desktop->getSelection()->moveScreen(0, mul*1); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), 0, mul*10*nudge); // shift + desktop->getSelection()->move(0, mul*10*nudge); // shift } else { - sp_selection_move(desktop->getSelection(), 0, mul*nudge); // no shift + desktop->getSelection()->move(0, mul*nudge); // no shift } } @@ -948,15 +948,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), mul*10, 0); // shift + desktop->getSelection()->moveScreen(mul*10, 0); // shift } else { - sp_selection_move_screen(desktop->getSelection(), mul*1, 0); // no shift + desktop->getSelection()->moveScreen(mul*1, 0); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), mul*10*nudge, 0); // shift + desktop->getSelection()->move(mul*10*nudge, 0); // shift } else { - sp_selection_move(desktop->getSelection(), mul*nudge, 0); // no shift + desktop->getSelection()->move(mul*nudge, 0); // no shift } } @@ -971,15 +971,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), 0, mul*-10); // shift + desktop->getSelection()->moveScreen(0, mul*-10); // shift } else { - sp_selection_move_screen(desktop->getSelection(), 0, mul*-1); // no shift + desktop->getSelection()->moveScreen(0, mul*-1); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), 0, mul*-10*nudge); // shift + desktop->getSelection()->move(0, mul*-10*nudge); // shift } else { - sp_selection_move(desktop->getSelection(), 0, mul*-nudge); // no shift + desktop->getSelection()->move(0, mul*-nudge); // no shift } } @@ -1023,11 +1023,11 @@ bool SelectTool::root_handler(GdkEvent* event) { case GDK_KEY_bracketleft: if (MOD__ALT(event)) { gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask - sp_selection_rotate_screen(selection, mul*1); + selection->rotateScreen(mul*1); } else if (MOD__CTRL(event)) { - sp_selection_rotate(selection, 90); + selection->rotate(90); } else if (snaps) { - sp_selection_rotate(selection, 180.0/snaps); + selection->rotate(180.0/snaps); } ret = TRUE; @@ -1036,11 +1036,11 @@ bool SelectTool::root_handler(GdkEvent* event) { case GDK_KEY_bracketright: if (MOD__ALT(event)) { gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask - sp_selection_rotate_screen(selection, -1*mul); + selection->rotateScreen(-1*mul); } else if (MOD__CTRL(event)) { - sp_selection_rotate(selection, -90); + selection->rotate(-90); } else if (snaps) { - sp_selection_rotate(selection, -180.0/snaps); + selection->rotate(-180.0/snaps); } ret = TRUE; @@ -1084,7 +1084,7 @@ bool SelectTool::root_handler(GdkEvent* event) { case GDK_KEY_g: case GDK_KEY_G: if (MOD__SHIFT_ONLY(event)) { - sp_selection_to_guides(desktop); + desktop->selection->toGuides(); ret = true; } break; -- cgit v1.2.3 From 043578ee79ae7dccc1967a9e380d276c9f73ed46 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 25 Oct 2016 23:30:06 +0200 Subject: Some bug fixes and improvements (bzr r15142.1.25) --- src/ui/tools/tool-base.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index f7315c648..8d1034161 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -533,10 +533,6 @@ bool ToolBase::root_handler(GdkEvent* event) { ret = TRUE; if (desktop->canvas->endRotateTo()) { sp_repr_set_svg_double(desktop->namedview->getRepr(), "inkscape:document-rotation", angle); - SPObject *updated = SP_OBJECT(desktop->namedview); - if (updated) { - updated->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - } } } else { xp = yp = 0; -- cgit v1.2.3 From def40c6005ff987960d12403df2d8af259a06b33 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sat, 29 Oct 2016 00:27:25 +0200 Subject: allows for denser screens in zoom correction factors (bzr r15195) --- src/ui/dialog/inkscape-preferences.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 9a95c3d8c..f9540c989 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -631,7 +631,7 @@ void InkscapePreferences::initPageUI() _page_ui.add_line( false, _("Maximum documents in Open _Recent:"), _misc_recent, "", _("Set the maximum length of the Open Recent list in the File menu, or clear the list"), false, reset_recent); - _ui_zoom_correction.init(300, 30, 1.00, 200.0, 1.0, 10.0, 1.0); + _ui_zoom_correction.init(300, 30, 1.00, 500.0, 1.0, 10.0, 1.0); _page_ui.add_line( false, _("_Zoom correction factor (in %):"), _ui_zoom_correction, "", _("Adjust the slider until the length of the ruler on your screen matches its real length. This information is used when zooming to 1:1, 1:2, etc., to display objects in their true sizes"), true); -- cgit v1.2.3 From 126cabd5f87ca04262879584dd4ec1ac923edacd Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 1 Nov 2016 18:01:07 +0100 Subject: Fix angle constrain, thanks to vlada, Mc and LiamW (bzr r15142.1.29) --- src/ui/tools/tool-base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index e1b2f97af..999e2d0b2 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -335,7 +335,7 @@ bool ToolBase::root_handler(GdkEvent* event) { /// @todo REmove redundant /value in preference keys tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); bool allow_panning = prefs->getBool("/options/spacebarpans/value"); - int rotation_snap = prefs->getInt("/options/rotationsnapsperpi/value", 15); + int rotation_snap = 180.0/prefs->getInt("/options/rotationsnapsperpi/value", 12); gint ret = FALSE; switch (event->type) { -- cgit v1.2.3 From 1745fbc8feec44b064ef92cb0f1f78789342e311 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 2 Nov 2016 20:53:08 +0100 Subject: Fix bug:1013141 crash deleting LPE Fixed bugs: - https://launchpad.net/bugs/1013141 (bzr r15200) --- src/ui/dialog/livepatheffect-editor.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index b97b0e63a..4d60d610e 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -547,7 +547,17 @@ void LivePathEffectEditor::on_effect_selection_changed() if (lperef && current_lpeitem && current_lperef != lperef) { //The last condition ignore Gtk::TreeModel may occasionally be changed emitted when nothing has happened - if (lperef->lpeobject->get_lpe()) { + Glib::RefPtr model = effectlist_view.get_model(); + Gtk::TreeNodeChildren childs = model->children(); + Gtk::TreeNodeChildren::iterator row; + bool removed = true; + for( row = childs.begin() ; row!=childs.end(); ++row) + { + if ( (*row)[columns.lperef] == current_lperef ) { + removed = false; + } + } + if (!removed && lperef->lpeobject->get_lpe()) { lpe_list_locked = true; // prevent reload of the list which would lose selection current_lpeitem->setCurrentPathEffect(lperef); current_lperef = lperef; -- cgit v1.2.3 From 6162cf1a9f6953319e0e3d6b56354c5cb0f26352 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 3 Nov 2016 00:08:41 +0100 Subject: Add some unit tests for object-set cppification (bzr r15203) --- src/ui/dialog/align-and-distribute.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 7ba6df978..236832beb 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -129,7 +129,7 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) SPItem *focus = NULL; Geom::OptRect b = Geom::OptRect(); Selection::CompareSize horiz = (a.mx0 != 0.0) || (a.mx1 != 0.0) - ? Selection::HORIZONTAL : Selection::VERTICAL; + ? Selection::VERTICAL : Selection::HORIZONTAL; switch (AlignTarget(prefs->getInt("/dialogs/align/align-to", 6))) { -- cgit v1.2.3 From 05d344828f919fad7846d2d76534eb02b554dc00 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 03:32:30 +0100 Subject: Fix bug:1639083 crach closing segment with shortcut LPE Fixed bugs: - https://launchpad.net/bugs/1639083 (bzr r15210) --- src/ui/tools/pen-tool.cpp | 48 ++++++++++++++++++++++---------------------- src/ui/tools/pencil-tool.cpp | 4 ++-- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 312338882..caf6faec2 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -367,7 +367,7 @@ bool PenTool::_handleButtonPress(GdkEventButton const &bevent) { //with this we avoid creating a new point over the existing one if(bevent.button != 3 && (this->spiro || this->bspline) && this->npoints > 0 && this->p[0] == this->p[3]){ - if( anchor && anchor == this->sa && this->green_curve->is_empty()){ + if( anchor && anchor == this->sa && this->green_curve->is_unset()){ //remove the following line to avoid having one node on top of another _finishSegment(event_dt, bevent.state); _finish(true); @@ -919,7 +919,7 @@ void PenTool::_lastpointMove(gdouble x, gdouble y) { return; // green - if (!this->green_curve->is_empty()) { + if (!this->green_curve->is_unset()) { this->green_curve->last_point_additive_move( Geom::Point(x,y) ); } else { // start anchor too @@ -947,7 +947,7 @@ void PenTool::_lastpointToCurve() { this->p[1] = this->red_curve->last_segment()->initialPoint() + (1./3.)*(this->red_curve->last_segment()->finalPoint() - this->red_curve->last_segment()->initialPoint()); //modificate the last segment of the green curve so it creates the type of node we need if (this->spiro||this->bspline) { - if (!this->green_curve->is_empty()) { + if (!this->green_curve->is_unset()) { Geom::Point A(0,0); Geom::Point B(0,0); Geom::Point C(0,0); @@ -986,7 +986,7 @@ void PenTool::_lastpointToCurve() { } } //if the last node is an union with another curve - if (this->green_curve->is_empty() && this->sa && !this->sa->curve->is_empty()) { + if (this->green_curve->is_unset() && this->sa && !this->sa->curve->is_unset()) { this->_bsplineSpiroStartAnchor(false); } } @@ -1002,7 +1002,7 @@ void PenTool::_lastpointToLine() { // modify the last segment of the green curve so the type of node we want is created. if(this->spiro || this->bspline){ - if(!this->green_curve->is_empty()){ + if(!this->green_curve->is_unset()){ Geom::Point A(0,0); Geom::Point B(0,0); Geom::Point C(0,0); @@ -1033,7 +1033,7 @@ void PenTool::_lastpointToLine() { } } // if the last node is an union with another curve - if(this->green_curve->is_empty() && this->sa && !this->sa->curve->is_empty()){ + if(this->green_curve->is_unset() && this->sa && !this->sa->curve->is_unset()){ this->_bsplineSpiroStartAnchor(true); } } @@ -1212,7 +1212,7 @@ bool PenTool::_handleKeyPress(GdkEvent *event) { // All this is needed to stop the last control // point dispeating and stop making an n-1 shape. Geom::Point const p(0, 0); - if(this->red_curve->is_empty()) { + if(this->red_curve->is_unset()) { this->red_curve->moveto(p); } this->_finishSegment(p, 0); @@ -1364,7 +1364,7 @@ void PenTool::_bsplineSpiro(bool shift) void PenTool::_bsplineSpiroOn() { - if(!this->red_curve->is_empty()){ + if(!this->red_curve->is_unset()){ using Geom::X; using Geom::Y; this->npoints = 5; @@ -1377,7 +1377,7 @@ void PenTool::_bsplineSpiroOn() void PenTool::_bsplineSpiroOff() { - if(!this->red_curve->is_empty()){ + if(!this->red_curve->is_unset()){ this->npoints = 5; this->p[0] = this->red_curve->first_segment()->initialPoint(); this->p[3] = this->red_curve->first_segment()->finalPoint(); @@ -1387,7 +1387,7 @@ void PenTool::_bsplineSpiroOff() void PenTool::_bsplineSpiroStartAnchor(bool shift) { - if(this->sa->curve->is_empty()){ + if(this->sa->curve->is_unset()){ return; } @@ -1497,18 +1497,18 @@ void PenTool::_bsplineSpiroMotion(bool shift){ } using Geom::X; using Geom::Y; - if(this->red_curve->is_empty()) return; + if(this->red_curve->is_unset()) return; this->npoints = 5; SPCurve *tmp_curve = new SPCurve(); this->p[2] = this->p[3] + (1./3)*(this->p[0] - this->p[3]); this->p[2] = Geom::Point(this->p[2][X] + HANDLE_CUBIC_GAP,this->p[2][Y] + HANDLE_CUBIC_GAP); - if(this->green_curve->is_empty() && !this->sa){ + if(this->green_curve->is_unset() && !this->sa){ this->p[1] = this->p[0] + (1./3)*(this->p[3] - this->p[0]); this->p[1] = Geom::Point(this->p[1][X] + HANDLE_CUBIC_GAP,this->p[1][Y] + HANDLE_CUBIC_GAP); if(shift){ this->p[2] = this->p[3]; } - }else if(!this->green_curve->is_empty()){ + }else if(!this->green_curve->is_unset()){ tmp_curve = this->green_curve->copy(); }else{ tmp_curve = this->overwrite_curve->copy(); @@ -1516,7 +1516,7 @@ void PenTool::_bsplineSpiroMotion(bool shift){ tmp_curve = tmp_curve ->create_reverse(); } - if(!tmp_curve ->is_empty()){ + if(!tmp_curve ->is_unset()){ Geom::CubicBezier const * cubic = dynamic_cast(&*tmp_curve ->last_segment()); if(cubic){ if(this->bspline){ @@ -1548,7 +1548,7 @@ void PenTool::_bsplineSpiroMotion(bool shift){ } } - if(this->anchor_statusbar && !this->red_curve->is_empty()){ + if(this->anchor_statusbar && !this->red_curve->is_unset()){ if(shift){ this->_bsplineSpiroEndAnchorOff(); }else{ @@ -1681,19 +1681,19 @@ void PenTool::_bsplineSpiroBuild() //We create the base curve SPCurve *curve = new SPCurve(); //If we continuate the existing curve we add it at the start - if(this->sa && !this->sa->curve->is_empty()){ + if(this->sa && !this->sa->curve->is_unset()){ curve = this->overwrite_curve->copy(); if (this->sa->start) { curve = curve->create_reverse(); } } - if (!this->green_curve->is_empty()){ + if (!this->green_curve->is_unset()){ curve->append_continuous(this->green_curve, 0.0625); } //and the red one - if (!this->red_curve->is_empty()){ + if (!this->red_curve->is_unset()){ this->red_curve->reset(); this->red_curve->moveto(this->p[0]); if(this->anchor_statusbar && !this->sa && !(this->green_anchor && this->green_anchor->active)){ @@ -1705,7 +1705,7 @@ void PenTool::_bsplineSpiroBuild() curve->append_continuous(this->red_curve, 0.0625); } - if(!curve->is_empty()){ + if(!curve->is_unset()){ // close the curve if the final points of the curve are close enough if(Geom::are_near(curve->first_path()->initialPoint(), curve->last_path()->finalPoint())){ curve->closepath_current(); @@ -1844,7 +1844,7 @@ void PenTool::_finishSegment(Geom::Point const p, guint const state) { ++num_clicks; - if (!this->red_curve->is_empty()) { + if (!this->red_curve->is_unset()) { this->_bsplineSpiro(state & GDK_SHIFT_MASK); this->green_curve->append_continuous(this->red_curve, 0.0625); SPCurve *curve = this->red_curve->copy(); @@ -1869,8 +1869,8 @@ void PenTool::_finishSegment(Geom::Point const p, guint const state) { bool PenTool::_undoLastPoint() { bool ret = false; - if ( this->green_curve->is_empty() || (this->green_curve->last_segment() == NULL) ) { - if (!this->red_curve->is_empty()) { + if ( this->green_curve->is_unset() || (this->green_curve->last_segment() == NULL) ) { + if (!this->red_curve->is_unset()) { this->_cancel (); ret = true; } else { @@ -1887,7 +1887,7 @@ bool PenTool::_undoLastPoint() { this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data); } // Get last segment - if ( this->green_curve->is_empty() ) { + if ( this->green_curve->is_unset() ) { g_warning("pen_handle_key_press, case GDK_KP_Delete: Green curve is empty"); return false; } @@ -2019,7 +2019,7 @@ int PenTool::nextParaxialDirection(Geom::Point const &pt, Geom::Point const &ori // (on first mouse release), in which case num_clicks immediately becomes 1. // if (this->num_clicks == 0) { - if (this->green_curve->is_empty()) { + if (this->green_curve->is_unset()) { // first mouse click double dist_h = fabs(pt[Geom::X] - origin[Geom::X]); double dist_v = fabs(pt[Geom::Y] - origin[Geom::Y]); diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index 54106437c..ec2874823 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -588,8 +588,8 @@ void PencilTool::_setEndpoint(Geom::Point const &p) { * Still not sure, how it will make most sense. */ void PencilTool::_finishEndpoint() { - if ( ( this->red_curve->is_empty() ) - || ( *(this->red_curve->first_point()) == *(this->red_curve->second_point()) ) ) + if (this->red_curve->is_unset() || + this->red_curve->first_point() == this->red_curve->second_point()) { this->red_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL); -- cgit v1.2.3 From dd38575e29e544156915a4400ad9cb4a412c9fe6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 03:38:01 +0100 Subject: Fix bug:1639098 Fixed bugs: - https://launchpad.net/bugs/1639098 (bzr r15211) --- src/ui/tools/freehand-base.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 300324467..deb89b874 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -642,7 +642,10 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) } // Step A - test, whether we ended on green anchor - if ( forceclosed || ( dc->green_anchor && dc->green_anchor->active ) ) { + if ( (forceclosed && + (!dc->sa || (dc->sa && dc->sa->curve->is_empty()))) || + ( dc->green_anchor && dc->green_anchor->active)) + { // We hit green anchor, closing Green-Blue-Red dc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Path is closed.")); c->closepath_current(); @@ -724,7 +727,11 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) e->unref(); } - + if (forceclosed) + { + dc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Path is closed.")); + c->closepath_current(); + } spdc_flush_white(dc, c); c->unref(); -- cgit v1.2.3 From 361c74fe71cc69df8feba546204c93099e6b22b8 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 14:00:28 +0100 Subject: Fix change between multiples LPE in the same item (bzr r15212) --- src/ui/dialog/livepatheffect-editor.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 4d60d610e..9bd4c093e 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -546,18 +546,8 @@ void LivePathEffectEditor::on_effect_selection_changed() LivePathEffect::LPEObjectReference * lperef = (*it)[columns.lperef]; if (lperef && current_lpeitem && current_lperef != lperef) { - //The last condition ignore Gtk::TreeModel may occasionally be changed emitted when nothing has happened - Glib::RefPtr model = effectlist_view.get_model(); - Gtk::TreeNodeChildren childs = model->children(); - Gtk::TreeNodeChildren::iterator row; - bool removed = true; - for( row = childs.begin() ; row!=childs.end(); ++row) - { - if ( (*row)[columns.lperef] == current_lperef ) { - removed = false; - } - } - if (!removed && lperef->lpeobject->get_lpe()) { + //The last condition ignore Gtk::TreeModel may occasionally be changed emitted when nothing has happened + if (lperef->getObject()) { lpe_list_locked = true; // prevent reload of the list which would lose selection current_lpeitem->setCurrentPathEffect(lperef); current_lperef = lperef; -- cgit v1.2.3 From e7eeaf23639692c87f9cd772b8cdbfb7e54ceea6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 14:49:05 +0100 Subject: Fix a bug on duplicate item with multiples LPE on it. previously the LPE become "clones" if more than 1 LPE on the item. Also wee need to discuss what happends on LPE copied what are inside a group, fork them or clone, currently are cloned This can be a feature or a bug in the same user with diferent works. My proposal is fork it and add a item in paste LPEs to allow cloned LPE on paste (bzr r15213) --- src/ui/clipboard.cpp | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 0a671cc8a..ef00e11b3 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -688,7 +688,23 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection) else obj_copy = _copyNode(obj, _doc, _clipnode); - + // For lpe items, copy lpe stack if applicable + SPLPEItem *lpeitem = dynamic_cast(item); + if (lpeitem) { + Inkscape::SVGOStringStream os; + if (lpeitem->hasPathEffect()) { + for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it) + { + LivePathEffectObject *lpeobj = (*it)->lpeobject; + if (lpeobj) { + Inkscape::XML::Node * lpeobjcopy = _copyNode(lpeobj->getRepr(), _doc, _defs); + lpeobjcopy->setAttribute("id",lpeobj->getRepr()->attribute("id")); + os << "#" << lpeobj->getRepr()->attribute("id") << ";"; + } + } + } + obj_copy->setAttribute("inkscape:path-effect", os.str().c_str()); + } // copy complete inherited style SPCSSAttr *css = sp_repr_css_attr_inherited(obj, "style"); sp_repr_css_set(obj_copy, css, "style"); @@ -720,14 +736,6 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection) sp_repr_css_set(_clipnode, style, "style"); sp_repr_css_attr_unref(style); } - - // copy path effect from the first path - if (object) { - gchar const *effect =object->getRepr()->attribute("inkscape:path-effect"); - if (effect) { - _clipnode->setAttribute("inkscape:path-effect", effect); - } - } } Geom::OptRect size = selection->visualBounds(); @@ -784,20 +792,6 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) } } - // For lpe items, copy lpe stack if applicable - SPLPEItem *lpeitem = dynamic_cast(item); - if (lpeitem) { - if (lpeitem->hasPathEffect()) { - for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it) - { - LivePathEffectObject *lpeobj = (*it)->lpeobject; - if (lpeobj) { - _copyNode(lpeobj->getRepr(), _doc, _defs); - } - } - } - } - // For 3D boxes, copy perspectives { SPBox3D *box = dynamic_cast(item); -- cgit v1.2.3 From 046b9d9b4d20894231127a6d00d327302ffd0474 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 17:45:28 +0100 Subject: Fix last commit not working, LPE are cloned on copies (bzr r15214) --- src/ui/clipboard.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index ef00e11b3..a8e708597 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -60,6 +60,7 @@ #include "sp-mask.h" #include "sp-textpath.h" #include "sp-rect.h" +#include "sp-object.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" @@ -698,8 +699,10 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection) LivePathEffectObject *lpeobj = (*it)->lpeobject; if (lpeobj) { Inkscape::XML::Node * lpeobjcopy = _copyNode(lpeobj->getRepr(), _doc, _defs); - lpeobjcopy->setAttribute("id",lpeobj->getRepr()->attribute("id")); - os << "#" << lpeobj->getRepr()->attribute("id") << ";"; + gchar *new_conflict_id = sp_object_get_unique_id(lpeobj, lpeobj->getAttribute("id")); + lpeobjcopy->setAttribute("id", new_conflict_id); + g_free(new_conflict_id); + os << "#" << lpeobjcopy->attribute("id") << ";"; } } } -- cgit v1.2.3 From bf313d184ec2c93b4605b7c88ed9fcf341510d35 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 18:52:21 +0100 Subject: Change modifier to enter rotate mode from SHIFT to CONTROL (bzr r15142.1.31) --- src/ui/tools/tool-base.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 999e2d0b2..6acbe9f9f 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -376,7 +376,7 @@ bool ToolBase::root_handler(GdkEvent* event) { break; case 2: - if (event->button.state & GDK_MOD1_MASK) { + if (event->button.state & GDK_CONTROL_MASK) { sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); desktop->canvas->startRotateTo(desktop->namedview->document_rotation); this->rotating_mode = true; @@ -406,7 +406,7 @@ bool ToolBase::root_handler(GdkEvent* event) { break; case 3: - if (event->button.state & GDK_MOD1_MASK) { + if (event->button.state & GDK_CONTROL_MASK) { sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); desktop->canvas->startRotateTo(desktop->namedview->document_rotation); this->rotating_mode = true; @@ -742,7 +742,7 @@ bool ToolBase::root_handler(GdkEvent* event) { break; case GDK_KEY_space: - if (event->key.state & GDK_MOD1_MASK) { + if (event->key.state & GDK_CONTROL_MASK) { sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); desktop->canvas->startRotateTo(desktop->namedview->document_rotation); this->rotating_mode = true; -- cgit v1.2.3 From 647b3ccad1fd3b178e92341fdc92fd276a234dff Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 22:29:03 +0100 Subject: Add exporters (bzr r15142.1.32) --- src/ui/dialog/export.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 95c97390d..c38e798ec 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -977,9 +977,6 @@ void Export::onExport () SPDocument *doc = desktop->getDocument(); Geom::Affine rot = doc->getRoot()->c2p; doc->getRoot()->c2p = doc->getRoot()->rotation.inverse() * doc->getRoot()->c2p; - //double rotate_angle = doc->getRoot()->get_rotation(); - //Inkscape::XML::Node *nv_repr = sp_item_group_get_child_by_name(doc->getRoot(), NULL, "sodipodi:namedview")->getRepr(); - //sp_repr_set_svg_double(nv_repr, "inkscape:document-rotation", 0.); doc->ensureUpToDate(); bool exportSuccessful = false; -- cgit v1.2.3 From bd0e1bc73283c9e0488b9f71d7ff7da43db57baa Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 6 Nov 2016 02:12:00 +0100 Subject: Fix bug on apply bend LPE from pen/cil without cliboard, nothin happends previously (bzr r15216) --- src/ui/tools/freehand-base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index deb89b874..36962fe9a 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -794,7 +794,7 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) SPItem *item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr)); //Bend needs the transforms applied after, Other effects best before if((previous_shape_type == BEND_CLIPBOARD && shape_selected == LAST_APPLIED) || - shape_selected == BEND_CLIPBOARD) + shape_selected == BEND_CLIPBOARD && previous_shape_type != NONE) { spdc_check_for_and_apply_waiting_LPE(dc, item, c); previous_shape_type = BEND_CLIPBOARD; -- cgit v1.2.3 From 64eaf40029c6c0e530fdbe3d80335fc97ae93507 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 6 Nov 2016 02:15:41 +0100 Subject: Minor tweak (bzr r15217) --- src/ui/tools/freehand-base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 36962fe9a..46c3255ca 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -794,7 +794,7 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) SPItem *item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr)); //Bend needs the transforms applied after, Other effects best before if((previous_shape_type == BEND_CLIPBOARD && shape_selected == LAST_APPLIED) || - shape_selected == BEND_CLIPBOARD && previous_shape_type != NONE) + (shape_selected == BEND_CLIPBOARD && previous_shape_type != NONE)) { spdc_check_for_and_apply_waiting_LPE(dc, item, c); previous_shape_type = BEND_CLIPBOARD; -- cgit v1.2.3 From 08475cfe743c5996bd21e34d373921a760f26f6d Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 6 Nov 2016 17:39:10 +0100 Subject: Fix some bugs on pen/cil dropdown shapes (bzr r15219) --- src/ui/tools/freehand-base.cpp | 84 +++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 46c3255ca..056c723ee 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -273,12 +273,42 @@ static void spdc_apply_simplify(std::string threshold, FreehandBase *dc, SPItem enum shapeType { NONE, TRIANGLE_IN, TRIANGLE_OUT, ELLIPSE, CLIPBOARD, BEND_CLIPBOARD, LAST_APPLIED }; static shapeType previous_shape_type = NONE; -static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, SPCurve *curve) +static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, SPCurve *curve, bool is_bend) { using namespace Inkscape::LivePathEffect; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (item && SP_IS_LPE_ITEM(item)) { + //Store the clipboard path to apply in the future without the use of clipboard + static Geom::PathVector previous_shape_pathv; + static SPItem *bend_item; + shapeType shape = (shapeType)prefs->getInt(tool_name(dc) + "/shape", 0); + if (previous_shape_type == NONE) { + previous_shape_type = shape; + } + if(shape == LAST_APPLIED){ + + shape = previous_shape_type; + if(shape == CLIPBOARD || shape == BEND_CLIPBOARD){ + shape = LAST_APPLIED; + } + } + Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); + if (is_bend && + (shape == BEND_CLIPBOARD || (shape == LAST_APPLIED && previous_shape_type != CLIPBOARD)) && + cm->paste(SP_ACTIVE_DESKTOP,true)) + { + bend_item = dc->selection->singleItem(); + if(!bend_item || (!SP_IS_SHAPE(bend_item) && !SP_IS_GROUP(bend_item))){ + previous_shape_type = NONE; + return; + } + } else if(is_bend) { + return; + } + if (!is_bend && previous_shape_type == BEND_CLIPBOARD && shape == BEND_CLIPBOARD) { + return; + } bool simplify = prefs->getInt(tool_name(dc) + "/simplify", 0); if(simplify){ double tol = prefs->getDoubleLimited("/tools/freehand/pencil/tolerance", 10.0, 1.0, 100.0); @@ -300,29 +330,16 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, curve = sp_shape->getCurve(); } - //Store the clipboard path to apply in the future without the use of clipboard - static Geom::PathVector previous_shape_pathv; - - shapeType shape = (shapeType)prefs->getInt(tool_name(dc) + "/shape", 0); bool shape_applied = false; SPCSSAttr *css_item = sp_css_attr_from_object(item, SP_STYLE_FLAG_ALWAYS); const char *cstroke = sp_repr_css_property(css_item, "stroke", "none"); const char *stroke_width = sp_repr_css_property(css_item, "stroke-width", "0"); double swidth; sp_svg_number_read_d(stroke_width, &swidth); - static SPItem *bend_item; #define SHAPE_LENGTH 10 #define SHAPE_HEIGHT 10 - if(shape == LAST_APPLIED){ - - shape = previous_shape_type; - if(shape == CLIPBOARD || shape == BEND_CLIPBOARD){ - shape = LAST_APPLIED; - } - } - switch (shape) { case NONE: // don't apply any shape @@ -400,21 +417,14 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, } case BEND_CLIPBOARD: { - Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); - if(cm->paste(SP_ACTIVE_DESKTOP,true)){ - gchar const *svgd = item->getRepr()->attribute("d"); - bend_item = dc->selection->singleItem(); - if(bend_item && (SP_IS_SHAPE(bend_item) || SP_IS_GROUP(bend_item))){ - bend_item->moveTo(item,false); - bend_item->transform.setTranslation(Geom::Point()); - spdc_apply_bend_shape(svgd, dc, bend_item); - dc->selection->add(SP_OBJECT(bend_item)); - - shape = BEND_CLIPBOARD; - } else { - bend_item = NULL; - shape = NONE; - } + gchar const *svgd = item->getRepr()->attribute("d"); + if(bend_item && (SP_IS_SHAPE(bend_item) || SP_IS_GROUP(bend_item))){ + bend_item->moveTo(item,false); + bend_item->transform.setTranslation(Geom::Point()); + spdc_apply_bend_shape(svgd, dc, bend_item); + dc->selection->add(SP_OBJECT(bend_item)); + + shape = BEND_CLIPBOARD; } else { bend_item = NULL; shape = NONE; @@ -790,25 +800,15 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) if (!dc->white_item) { // Attach repr Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - shapeType shape_selected = (shapeType)prefs->getInt(tool_name(dc) + "/shape", 0); SPItem *item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr)); //Bend needs the transforms applied after, Other effects best before - if((previous_shape_type == BEND_CLIPBOARD && shape_selected == LAST_APPLIED) || - (shape_selected == BEND_CLIPBOARD && previous_shape_type != NONE)) - { - spdc_check_for_and_apply_waiting_LPE(dc, item, c); - previous_shape_type = BEND_CLIPBOARD; - } + spdc_check_for_and_apply_waiting_LPE(dc, item, c, true); Inkscape::GC::release(repr); item->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse(); item->updateRepr(); item->doWriteTransform(item->getRepr(), item->transform, NULL, true); - if((previous_shape_type != BEND_CLIPBOARD || shape_selected != LAST_APPLIED) && - shape_selected != BEND_CLIPBOARD) - { - spdc_check_for_and_apply_waiting_LPE(dc, item, c); - dc->selection->set(repr); - } + spdc_check_for_and_apply_waiting_LPE(dc, item, c, false); + dc->selection->set(repr); if(previous_shape_type == BEND_CLIPBOARD){ repr->parent()->removeChild(repr); } -- cgit v1.2.3 From f18cdd20ca7d36fb3b67b4c4b1ae9b315791e02e Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 6 Nov 2016 21:10:58 +0100 Subject: Fix a bug that allow to enter rotate mode with right click (bzr r15142.1.33) --- src/ui/tools/tool-base.cpp | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 6acbe9f9f..fba9ae94f 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -406,34 +406,25 @@ bool ToolBase::root_handler(GdkEvent* event) { break; case 3: - if (event->button.state & GDK_CONTROL_MASK) { - sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); - desktop->canvas->startRotateTo(desktop->namedview->document_rotation); - this->rotating_mode = true; - this->message_context->set(Inkscape::INFORMATION_MESSAGE, - _("Space+ALT+mouse move to rotate canvas")); - } else { - if ((event->button.state & GDK_SHIFT_MASK) || (event->button.state & GDK_CONTROL_MASK)) { - // When starting panning, make sure there are no snap events pending because these might disable the panning again - if (_uses_snap) { - sp_event_context_discard_delayed_snap_event(this); - } - panning = 3; + if ((event->button.state & GDK_SHIFT_MASK) || (event->button.state & GDK_CONTROL_MASK)) { + // When starting panning, make sure there are no snap events pending because these might disable the panning again + if (_uses_snap) { + sp_event_context_discard_delayed_snap_event(this); + } + panning = 3; - sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK - | GDK_POINTER_MOTION_HINT_MASK, NULL, - event->button.time); + sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), + GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK + | GDK_POINTER_MOTION_HINT_MASK, NULL, + event->button.time); - ret = TRUE; - } else if( !this->space_panning) { - sp_event_root_menu_popup(desktop, NULL, event); - } - desktop->canvas->clearRotateTo(); - this->rotating_mode = false; ret = TRUE; - desktop->canvas->endRotateTo(); + } else if( !this->space_panning) { + sp_event_root_menu_popup(desktop, NULL, event); } + desktop->canvas->clearRotateTo(); + this->rotating_mode = false; + ret = TRUE; break; default: -- cgit v1.2.3 From 8c2f0a0a6368e3df0cdeaa1cac732e7193d88b62 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Nov 2016 17:24:42 +0100 Subject: 1639832 Blend and blur unspected results Fixed bugs: - https://launchpad.net/bugs/1639832 (bzr r15222) --- src/ui/dialog/objects.cpp | 9 ++++++++- src/ui/widget/filter-effect-chooser.cpp | 4 ---- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 09ffc9c4c..446af4ccb 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -1512,11 +1512,18 @@ void ObjectsPanel::_blendChangedIter(const Gtk::TreeIter& iter, Glib::ustring bl if (SP_IS_GAUSSIANBLUR(&primitive)) { Geom::OptRect bbox = item->bounds(SPItem::GEOMETRIC_BBOX); if (bbox) { - radius = SP_GAUSSIANBLUR(&primitive)->stdDeviation.getNumber(); + double perimeter = bbox->dimensions()[Geom::X] + bbox->dimensions()[Geom::Y]; // fixme: this is only half the perimeter, is that correct? + radius = _fe_blur.get_blur_value() * perimeter / 400; } } } } + if (radius != 0) { + // The modify function expects radius to be in display pixels. + Geom::Affine i2d (item->i2dt_affine()); + double expansion = i2d.descrim(); + radius *= expansion; + } SPFilter *filter = new_filter_simple_from_item(_document, item, blendmode.c_str(), radius); sp_style_set_property_url(item, "filter", filter, false); } else { diff --git a/src/ui/widget/filter-effect-chooser.cpp b/src/ui/widget/filter-effect-chooser.cpp index ae2f3e7c2..eace494ed 100644 --- a/src/ui/widget/filter-effect-chooser.cpp +++ b/src/ui/widget/filter-effect-chooser.cpp @@ -51,10 +51,6 @@ sigc::signal& SimpleFilterModifier::signal_blend_blur_changed() const Glib::ustring SimpleFilterModifier::get_blend_mode() { - if (!(_flags & BLEND)) { - return "normal"; - } - const Util::EnumData *d = _blend.get_active_data(); if (d) { return _blend.get_active_data()->key; -- cgit v1.2.3 From 46d3c703414abe90dfbe79befbd0b4c80a86ea36 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Nov 2016 19:33:24 +0100 Subject: Fix some bugs pointed by vlada (bzr r15142.1.35) --- src/ui/tools/tool-base.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index fba9ae94f..c789b44bb 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -381,7 +381,7 @@ bool ToolBase::root_handler(GdkEvent* event) { desktop->canvas->startRotateTo(desktop->namedview->document_rotation); this->rotating_mode = true; this->message_context->set(Inkscape::INFORMATION_MESSAGE, - _("Space+ALT+mouse move to rotate canvas")); + _("MMB + mouse move to rotate canvas, use modifiers on screen to change snaps")); } else { if (event->button.state & GDK_SHIFT_MASK) { zoom_rb = 2; @@ -397,10 +397,7 @@ bool ToolBase::root_handler(GdkEvent* event) { | GDK_POINTER_MOTION_HINT_MASK, NULL, event->button.time - 1); } - desktop->canvas->clearRotateTo(); - this->rotating_mode = false; ret = TRUE; - desktop->canvas->endRotateTo(); } ret = TRUE; break; @@ -422,8 +419,6 @@ bool ToolBase::root_handler(GdkEvent* event) { } else if( !this->space_panning) { sp_event_root_menu_popup(desktop, NULL, event); } - desktop->canvas->clearRotateTo(); - this->rotating_mode = false; ret = TRUE; break; @@ -464,7 +459,7 @@ bool ToolBase::root_handler(GdkEvent* event) { | GDK_POINTER_MOTION_HINT_MASK, NULL, event->motion.time - 1); } - if (panning) { + if (panning && !this->rotating_mode) { if ((panning == 2 && !(event->motion.state & GDK_BUTTON2_MASK)) || (panning == 1 && !(event->motion.state & GDK_BUTTON1_MASK)) || (panning == 3 && !(event->motion.state & GDK_BUTTON3_MASK))) { @@ -738,7 +733,7 @@ bool ToolBase::root_handler(GdkEvent* event) { desktop->canvas->startRotateTo(desktop->namedview->document_rotation); this->rotating_mode = true; this->message_context->set(Inkscape::INFORMATION_MESSAGE, - _("Space+ALT+mouse move to rotate canvas")); + _("Space+mouse move to rotate canvas, use modifiers on screen to change snaps")); } else { within_tolerance = true; xp = yp = 0; -- cgit v1.2.3 From 7f2d487d23d4b0e95ceb8d1cc4ad6ffb18a32f90 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Nov 2016 19:53:29 +0100 Subject: Fix some bugs (bzr r15142.1.37) --- src/ui/tools/tool-base.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index c789b44bb..ca700f652 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -373,6 +373,8 @@ bool ToolBase::root_handler(GdkEvent* event) { ret = TRUE; } + desktop->canvas->clearRotateTo(); + this->rotating_mode = false; break; case 2: @@ -420,6 +422,8 @@ bool ToolBase::root_handler(GdkEvent* event) { sp_event_root_menu_popup(desktop, NULL, event); } ret = TRUE; + desktop->canvas->clearRotateTo(); + this->rotating_mode = false; break; default: @@ -836,9 +840,7 @@ bool ToolBase::root_handler(GdkEvent* event) { if (this->rotating_mode) { desktop->canvas->clearRotateTo(); this->rotating_mode = false; - ret = TRUE; desktop->canvas->endRotateTo(); - break; } bool ctrl = (event->scroll.state & GDK_CONTROL_MASK); bool wheelzooms = prefs->getBool("/options/wheelzooms/value"); -- cgit v1.2.3 From 07af9d2a20fd6455a0965e3840b50ffd8f0a09ee Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 14 Nov 2016 15:00:26 +0100 Subject: Implement tweaking of mesh handle colors. (bzr r15250) --- src/ui/tools/tweak-tool.cpp | 182 +++++++++++++++++++++++++------------------- 1 file changed, 102 insertions(+), 80 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index a0394ecd4..56939cc30 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -56,6 +56,8 @@ #include "sp-gradient-reference.h" #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" +#include "sp-mesh-gradient.h" +#include "sp-mesh-array.h" #include "gradient-chemistry.h" #include "sp-text.h" #include "sp-flowtext.h" @@ -761,112 +763,132 @@ static void tweak_colors_in_gradient(SPItem *item, Inkscape::PaintTarget fill_or p *= (gradient->gradientTransform).inverse(); // now p is in gradient's original coordinates - double pos = 0; - double r = 0; - SPLinearGradient *lg = dynamic_cast(gradient); - if (lg) { - Geom::Point p1(lg->x1.computed, lg->y1.computed); - Geom::Point p2(lg->x2.computed, lg->y2.computed); - Geom::Point pdiff(p2 - p1); - double vl = Geom::L2(pdiff); + SPRadialGradient *rg = dynamic_cast(gradient); + if (lg || rg) { - // This is the matrix which moves and rotates the gradient line - // so it's oriented along the X axis: - Geom::Affine norm = Geom::Affine(Geom::Translate(-p1)) * Geom::Affine(Geom::Rotate(-atan2(pdiff[Geom::Y], pdiff[Geom::X]))); + double pos = 0; + double r = 0; - // Transform the mouse point by it to find out its projection onto the gradient line: - Geom::Point pnorm = p * norm; + if (lg) { + Geom::Point p1(lg->x1.computed, lg->y1.computed); + Geom::Point p2(lg->x2.computed, lg->y2.computed); + Geom::Point pdiff(p2 - p1); + double vl = Geom::L2(pdiff); - // Scale its X coordinate to match the length of the gradient line: - pos = pnorm[Geom::X] / vl; - // Calculate radius in lenfth-of-gradient-line units - r = radius / vl; + // This is the matrix which moves and rotates the gradient line + // so it's oriented along the X axis: + Geom::Affine norm = Geom::Affine(Geom::Translate(-p1)) * + Geom::Affine(Geom::Rotate(-atan2(pdiff[Geom::Y], pdiff[Geom::X]))); - } else { - SPRadialGradient *rg = dynamic_cast(gradient); + // Transform the mouse point by it to find out its projection onto the gradient line: + Geom::Point pnorm = p * norm; + + // Scale its X coordinate to match the length of the gradient line: + pos = pnorm[Geom::X] / vl; + // Calculate radius in lenfth-of-gradient-line units + r = radius / vl; + + } if (rg) { Geom::Point c (rg->cx.computed, rg->cy.computed); pos = Geom::L2(p - c) / rg->r.computed; r = radius / rg->r.computed; } - } - // Normalize pos to 0..1, taking into accound gradient spread: - double pos_e = pos; - if (gradient->getSpread() == SP_GRADIENT_SPREAD_PAD) { - if (pos > 1) { - pos_e = 1; - } - if (pos < 0) { - pos_e = 0; - } - } else if (gradient->getSpread() == SP_GRADIENT_SPREAD_REPEAT) { - if (pos > 1 || pos < 0) { - pos_e = pos - floor(pos); - } - } else if (gradient->getSpread() == SP_GRADIENT_SPREAD_REFLECT) { - if (pos > 1 || pos < 0) { - bool odd = ((int)(floor(pos)) % 2 == 1); - pos_e = pos - floor(pos); - if (odd) { - pos_e = 1 - pos_e; + // Normalize pos to 0..1, taking into accound gradient spread: + double pos_e = pos; + if (gradient->getSpread() == SP_GRADIENT_SPREAD_PAD) { + if (pos > 1) { + pos_e = 1; + } + if (pos < 0) { + pos_e = 0; + } + } else if (gradient->getSpread() == SP_GRADIENT_SPREAD_REPEAT) { + if (pos > 1 || pos < 0) { + pos_e = pos - floor(pos); + } + } else if (gradient->getSpread() == SP_GRADIENT_SPREAD_REFLECT) { + if (pos > 1 || pos < 0) { + bool odd = ((int)(floor(pos)) % 2 == 1); + pos_e = pos - floor(pos); + if (odd) { + pos_e = 1 - pos_e; + } } } - } - SPGradient *vector = sp_gradient_get_forked_vector_if_necessary(gradient, false); + SPGradient *vector = sp_gradient_get_forked_vector_if_necessary(gradient, false); - double offset_l = 0; - double offset_h = 0; - SPObject *child_prev = NULL; - for (auto& child: vector->children) { - SPStop *stop = dynamic_cast(&child); - if (!stop) { - continue; - } + double offset_l = 0; + double offset_h = 0; + SPObject *child_prev = NULL; + for (auto& child: vector->children) { + SPStop *stop = dynamic_cast(&child); + if (!stop) { + continue; + } - offset_h = stop->offset; - - if (child_prev) { - SPStop *prevStop = dynamic_cast(child_prev); - g_assert(prevStop != NULL); - - if (offset_h - offset_l > r && pos_e >= offset_l && pos_e <= offset_h) { - // the summit falls in this interstop, and the radius is small, - // so it only affects the ends of this interstop; - // distribute the force between the two endstops so that they - // get all the painting even if they are not touched by the brush - tweak_color (mode, stop->specified_color.v.c, rgb_goal, - force * (pos_e - offset_l) / (offset_h - offset_l), - do_h, do_s, do_l); - tweak_color(mode, prevStop->specified_color.v.c, rgb_goal, - force * (offset_h - pos_e) / (offset_h - offset_l), - do_h, do_s, do_l); - stop->updateRepr(); - child_prev->updateRepr(); - break; - } else { - // wide brush, may affect more than 2 stops, - // paint each stop by the force from the profile curve - if (offset_l <= pos_e && offset_l > pos_e - r) { + offset_h = stop->offset; + + if (child_prev) { + SPStop *prevStop = dynamic_cast(child_prev); + g_assert(prevStop != NULL); + + if (offset_h - offset_l > r && pos_e >= offset_l && pos_e <= offset_h) { + // the summit falls in this interstop, and the radius is small, + // so it only affects the ends of this interstop; + // distribute the force between the two endstops so that they + // get all the painting even if they are not touched by the brush + tweak_color (mode, stop->specified_color.v.c, rgb_goal, + force * (pos_e - offset_l) / (offset_h - offset_l), + do_h, do_s, do_l); tweak_color(mode, prevStop->specified_color.v.c, rgb_goal, - force * tweak_profile (fabs (pos_e - offset_l), r), + force * (offset_h - pos_e) / (offset_h - offset_l), do_h, do_s, do_l); + stop->updateRepr(); child_prev->updateRepr(); + break; + } else { + // wide brush, may affect more than 2 stops, + // paint each stop by the force from the profile curve + if (offset_l <= pos_e && offset_l > pos_e - r) { + tweak_color(mode, prevStop->specified_color.v.c, rgb_goal, + force * tweak_profile (fabs (pos_e - offset_l), r), + do_h, do_s, do_l); + child_prev->updateRepr(); + } + + if (offset_h >= pos_e && offset_h < pos_e + r) { + tweak_color (mode, stop->specified_color.v.c, rgb_goal, + force * tweak_profile (fabs (pos_e - offset_h), r), + do_h, do_s, do_l); + stop->updateRepr(); + } } + } - if (offset_h >= pos_e && offset_h < pos_e + r) { + offset_l = offset_h; + child_prev = &child; + } + } else { + // Mesh + SPMeshGradient *mg = dynamic_cast(gradient); + if (mg) { + SPMeshGradient *mg_array = dynamic_cast(mg->getArray()); + SPMeshNodeArray *array = &(mg_array->array); + // Every third node is a corner node + for( unsigned i=0; i < array->nodes.size(); i+=3 ) { + for( unsigned j=0; j < array->nodes[i].size(); j+=3 ) { + SPStop *stop = array->nodes[i][j]->stop; + double distance = Geom::L2(Geom::Point(p - array->nodes[i][j]->p)); tweak_color (mode, stop->specified_color.v.c, rgb_goal, - force * tweak_profile (fabs (pos_e - offset_h), r), - do_h, do_s, do_l); + force * tweak_profile (distance, radius), do_h, do_s, do_l); stop->updateRepr(); } } } - - offset_l = offset_h; - child_prev = &child; } } -- cgit v1.2.3 From 09d3ef953448a73c20dc1a70c2f96e0ac5019f45 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 16 Nov 2016 16:22:39 +0100 Subject: Split selected rows/columns in half using Insert key. (bzr r15251) --- src/ui/tools/mesh-tool.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 61793b8b3..1f6e6ed87 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -389,6 +389,11 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) noperation += mg->array.color_pick( iter->second, items[iter->first] ); break; + case MG_CORNER_INSERT: + // std::cout << "INSERT" << std::endl; + noperation += mg->array.insert( iter->second ); + break; + default: std::cout << "sp_mesh_corner_operation: unknown operation" << std::endl; } @@ -420,6 +425,10 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Picked mesh corner color.")); break; + case MG_CORNER_INSERT: + DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Inserted new row or column.")); + break; + default: std::cout << "sp_mesh_corner_operation: unknown operation" << std::endl; } @@ -896,11 +905,12 @@ bool MeshTool::root_handler(GdkEvent* event) { } break; + // Mesh Operations -------------------------------------------- + case GDK_KEY_Insert: case GDK_KEY_KP_Insert: // with any modifiers: - //sp_gradient_context_add_stops_between_selected_stops (rc); - std::cout << "Inserting stops between selected stops not implemented yet" << std::endl; + sp_mesh_context_corner_operation ( this, MG_CORNER_INSERT ); ret = TRUE; break; @@ -913,8 +923,6 @@ bool MeshTool::root_handler(GdkEvent* event) { } break; - // Mesh Operations -------------------------------------------- - case GDK_KEY_b: // Toggle mesh side between lineto and curveto. case GDK_KEY_B: if (MOD__ALT(event) && drag->isNonEmpty() && drag->hasSelection()) { -- cgit v1.2.3 From 776e4475404033912ed3b9d93d4ce2aeda62336c Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 17 Nov 2016 15:30:21 +0100 Subject: Fix status bar messages for meshes and gradients. (bzr r15256) --- src/ui/tools/gradient-tool.cpp | 8 +++++++- src/ui/tools/mesh-tool.cpp | 22 ++++++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp index 16df225e0..2a728b085 100644 --- a/src/ui/tools/gradient-tool.cpp +++ b/src/ui/tools/gradient-tool.cpp @@ -79,6 +79,9 @@ GradientTool::~GradientTool() { delete this->subselcon; } +// This must match GrPointType enum sp-gradient.h +// We should move this to a shared header (can't simply move to gradient.h since that would require +// including which messes up "N_" in extensions... argh!). const gchar *gr_handle_descr [] = { N_("Linear gradient start"), //POINT_LG_BEGIN N_("Linear gradient end"), @@ -88,7 +91,10 @@ const gchar *gr_handle_descr [] = { N_("Radial gradient radius"), N_("Radial gradient focus"), // POINT_RG_FOCUS N_("Radial gradient mid stop"), - N_("Radial gradient mid stop") + N_("Radial gradient mid stop"), + N_("Mesh gradient corner"), + N_("Mesh gradient handle"), + N_("Mesh gradient tensor") }; void GradientTool::selection_changed(Inkscape::Selection*) { diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 1f6e6ed87..6b1bfb88f 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -92,7 +92,19 @@ MeshTool::~MeshTool() { delete this->subselcon; } +// This must match GrPointType enum sp-gradient.h +// We should move this to a shared header (can't simply move to gradient.h since that would require +// including which messes up "N_" in extensions... argh!). const gchar *ms_handle_descr [] = { + N_("Linear gradient start"), //POINT_LG_BEGIN + N_("Linear gradient end"), + N_("Linear gradient mid stop"), + N_("Radial gradient center"), + N_("Radial gradient radius"), + N_("Radial gradient radius"), + N_("Radial gradient focus"), // POINT_RG_FOCUS + N_("Radial gradient mid stop"), + N_("Radial gradient mid stop"), N_("Mesh gradient corner"), N_("Mesh gradient handle"), N_("Mesh gradient tensor") @@ -124,6 +136,7 @@ void MeshTool::selection_changed(Inkscape::Selection* /*sel*/) { //TRANSLATORS: Mind the space in front. This is part of a compound message ngettext(" out of %d mesh handle"," out of %d mesh handles",n_tot), ngettext(" on %d selected object"," on %d selected objects",n_obj),NULL); + std::cout << " type: " << drag->singleSelectedDraggerSingleDraggableType() << std::endl; this->message_context->setF(Inkscape::NORMAL_MESSAGE, message,_(ms_handle_descr[drag->singleSelectedDraggerSingleDraggableType()]), n_tot, n_obj); } else { @@ -784,10 +797,11 @@ bool MeshTool::root_handler(GdkEvent* event) { case GDK_KEY_Shift_R: case GDK_KEY_Meta_L: // Meta is when you press Shift+Alt (at least on my machine) case GDK_KEY_Meta_R: - sp_event_show_modifier_tip (this->defaultMessageContext(), event, - _("FIXMECtrl: snap mesh angle"), - _("FIXMEShift: draw mesh around the starting point"), - NULL); + + // sp_event_show_modifier_tip (this->defaultMessageContext(), event, + // _("FIXMECtrl: snap mesh angle"), + // _("FIXMEShift: draw mesh around the starting point"), + // NULL); break; case GDK_KEY_A: -- cgit v1.2.3 From b6b5dbc76fe07238f1bbd259a8d8934c3c757eb7 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 17 Nov 2016 15:33:25 +0100 Subject: Remove debug line from last commit. (bzr r15257) --- src/ui/tools/mesh-tool.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 6b1bfb88f..0d2aafafc 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -136,7 +136,6 @@ void MeshTool::selection_changed(Inkscape::Selection* /*sel*/) { //TRANSLATORS: Mind the space in front. This is part of a compound message ngettext(" out of %d mesh handle"," out of %d mesh handles",n_tot), ngettext(" on %d selected object"," on %d selected objects",n_obj),NULL); - std::cout << " type: " << drag->singleSelectedDraggerSingleDraggableType() << std::endl; this->message_context->setF(Inkscape::NORMAL_MESSAGE, message,_(ms_handle_descr[drag->singleSelectedDraggerSingleDraggableType()]), n_tot, n_obj); } else { -- cgit v1.2.3 From 7aa5bd6f04cbc26d79239b07c6a91fbabf3015d1 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 18 Nov 2016 20:29:57 +0100 Subject: Improve mouse handling for mesh: * Double clicking an object will create a new mesh if one does not exist, otherwise clicking a line should now reliably divide the row/column. * Click-dragging will create a new mesh if one does not exist, otherwise it will do a rubberband selection of corner nodes. With Shift will add nodes, without will replace selected nodes. (bzr r15260) --- src/ui/tools/mesh-tool.cpp | 196 +++++++++++++++++++++++++++------------------ 1 file changed, 117 insertions(+), 79 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 0d2aafafc..fbde37856 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -278,32 +278,39 @@ sp_mesh_context_select_prev (ToolBase *event_context) } /** -Returns true if mouse cursor over mesh edge. +Returns vector of control lines mouse is over. Returns only first if 'first' is true. */ -static bool -sp_mesh_context_is_over_line (MeshTool *rc, SPCtrlLine *line, Geom::Point event_p) +static std::vector +sp_mesh_context_over_line (MeshTool *rc, Geom::Point event_p, bool first = true) { - if (!SP_IS_CTRLCURVE(line) ) { - return false; - } - SPDesktop *desktop = SP_EVENT_CONTEXT (rc)->desktop; //Translate mouse point into proper coord system rc->mousepoint_doc = desktop->w2d(event_p); - SPCtrlCurve *curve = SP_CTRLCURVE(line); - Geom::BezierCurveN<3> b( curve->p0, curve->p1, curve->p2, curve->p3 ); - Geom::Coord coord = b.nearestTime( rc->mousepoint_doc ); // Coord == double - Geom::Point nearest = b( coord ); + double tolerance = (double) SP_EVENT_CONTEXT(rc)->tolerance; - double dist_screen = Geom::L2 (rc->mousepoint_doc - nearest) * desktop->current_zoom(); + GrDrag *drag = rc->_grdrag; - double tolerance = (double) SP_EVENT_CONTEXT(rc)->tolerance; + std::vector selected; + + for (std::vector::const_iterator l = drag->lines.begin(); l != drag->lines.end(); ++l) { + if (!SP_IS_CTRLCURVE(*l)) continue; - bool close = (dist_screen < tolerance); + SPCtrlCurve *curve = SP_CTRLCURVE(*l); + Geom::BezierCurveN<3> b( curve->p0, curve->p1, curve->p2, curve->p3 ); + Geom::Coord coord = b.nearestTime( rc->mousepoint_doc ); // Coord == double + Geom::Point nearest = b( coord ); - return close; + double dist_screen = Geom::L2 (rc->mousepoint_doc - nearest) * desktop->current_zoom(); + if (dist_screen < tolerance) { + selected.push_back(*l); + if (first) { + break; + } + } + } + return selected; } @@ -539,25 +546,42 @@ bool MeshTool::root_handler(GdkEvent* event) { // Double click: // If over a mesh line, divide mesh row/column - // If not over a line, create new gradients for selected objects. + // If not over a line and no mesh, create new mesh for top selected object. if ( event->button.button == 1 ) { - // Are we over a mesh line? - bool over_line = false; - if (! drag->lines.empty()) { - for (std::vector::const_iterator l = drag->lines.begin(); l != drag->lines.end() && (!over_line); ++l) { - over_line |= sp_mesh_context_is_over_line (this, *l, Geom::Point(event->motion.x, event->motion.y)); - } - } + // Are we over a mesh line? + std::vector over_line = + sp_mesh_context_over_line(this, Geom::Point(event->motion.x, event->motion.y)); - if (over_line) { + if (!over_line.empty()) { // We take the first item in selection, because with doubleclick, the first click // always resets selection to the single object under cursor sp_mesh_context_split_near_point(this, selection->items().front(), this->mousepoint_doc, event->button.time); } else { // Create a new gradient with default coordinates. - sp_mesh_new_default(*this); + + // Check if object already has mesh... if it does, + // don't create new mesh with click-drag. + bool has_mesh = false; + if (!selection->isEmpty()) { + SPStyle *style = selection->items().front()->style; + if (style) { + Inkscape::PaintTarget fill_or_stroke = + (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? + Inkscape::FOR_FILL : Inkscape::FOR_STROKE; + SPPaintServer *server = + (fill_or_stroke == Inkscape::FOR_FILL) ? + style->getFillPaintServer(): + style->getStrokePaintServer(); + if (server && SP_IS_MESHGRADIENT(server)) + has_mesh = true; + } + } + + if (!has_mesh) { + sp_mesh_new_default(*this); + } } ret = TRUE; @@ -569,9 +593,10 @@ bool MeshTool::root_handler(GdkEvent* event) { #ifdef DEBUG_MESH std::cout << "sp_mesh_context_root_handler: GDK_BUTTON_PRESS" << std::endl; #endif + // Button down - // If Shift key down: do rubber band selection - // Else set origin for drag. A drag creates a new gradient if one does not exist + // If mesh already exists, do rubber band selection. + // Else set origin for drag which will create a new gradient. if ( event->button.button == 1 && !this->space_panning ) { Geom::Point button_w(event->button.x, event->button.y); @@ -582,7 +607,9 @@ bool MeshTool::root_handler(GdkEvent* event) { dragging = true; - // Check if object already has mesh... if it does, don't create new mesh with click-drag. + Geom::Point button_dt = desktop->w2d(button_w); + // Check if object already has mesh... if it does, + // don't create new mesh with click-drag. bool has_mesh = false; if (!selection->isEmpty()) { SPStyle *style = selection->items().front()->style; @@ -599,26 +626,25 @@ bool MeshTool::root_handler(GdkEvent* event) { } } - Geom::Point button_dt = desktop->w2d(button_w); - if (event->button.state & GDK_SHIFT_MASK || has_mesh) { + if (has_mesh) { Inkscape::Rubberband::get(desktop)->start(desktop, button_dt); - } else { - // remember clicked item, disregarding groups, honoring Alt; do nothing with Crtl to - // enable Ctrl+doubleclick of exactly the selected item(s) - if (!(event->button.state & GDK_CONTROL_MASK)) { - this->item_to_select = sp_event_context_find_item (desktop, button_w, event->button.state & GDK_MOD1_MASK, TRUE); - } + } - if (!selection->isEmpty()) { - SnapManager &m = desktop->namedview->snap_manager; - m.setup(desktop); - m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE); - m.unSetup(); - } + // remember clicked item, disregarding groups, honoring Alt; do nothing with Crtl to + // enable Ctrl+doubleclick of exactly the selected item(s) + if (!(event->button.state & GDK_CONTROL_MASK)) { + this->item_to_select = sp_event_context_find_item (desktop, button_w, event->button.state & GDK_MOD1_MASK, TRUE); + } - this->origin = button_dt; + if (!selection->isEmpty()) { + SnapManager &m = desktop->namedview->snap_manager; + m.setup(desktop); + m.freeSnapReturnByRef(button_dt, Inkscape::SNAPSOURCE_NODE_HANDLE); + m.unSetup(); } + this->origin = button_dt; + ret = TRUE; } break; @@ -679,19 +705,14 @@ bool MeshTool::root_handler(GdkEvent* event) { } // Change cursor shape if over line - bool over_line = false; + std::vector over_line = + sp_mesh_context_over_line(this, Geom::Point(event->motion.x, event->motion.y)); - if (!drag->lines.empty()) { - for (std::vector::const_iterator l = drag->lines.begin(); l != drag->lines.end() ; ++l) { - over_line |= sp_mesh_context_is_over_line (this, *l, Geom::Point(event->motion.x, event->motion.y)); - } - } - - if (this->cursor_addnode && !over_line) { + if (this->cursor_addnode && over_line.empty()) { this->cursor_shape = cursor_gradient_xpm; this->sp_event_context_update_cursor(); this->cursor_addnode = false; - } else if (!this->cursor_addnode && over_line) { + } else if (!this->cursor_addnode && !over_line.empty()) { this->cursor_shape = cursor_gradient_add_xpm; this->sp_event_context_update_cursor(); this->cursor_addnode = true; @@ -708,23 +729,15 @@ bool MeshTool::root_handler(GdkEvent* event) { this->xp = this->yp = 0; if ( event->button.button == 1 && !this->space_panning ) { - // Check if over line - bool over_line = false; - SPCtrlLine *line = NULL; - - if (!drag->lines.empty()) { - for (std::vector::const_iterator l = drag->lines.begin(); l != drag->lines.end() && (!over_line); ++l) { - over_line = sp_mesh_context_is_over_line (this, *l, Geom::Point(event->motion.x, event->motion.y)); - if (over_line) { - break; - } - } - } + // Check if over line + std::vector over_line = + sp_mesh_context_over_line(this, Geom::Point(event->motion.x, event->motion.y)); if ( (event->button.state & GDK_CONTROL_MASK) && (event->button.state & GDK_MOD1_MASK ) ) { - if (over_line && line) { - sp_mesh_context_split_near_point(this, line->item, this->mousepoint_doc, 0); + if (!over_line.empty()) { + sp_mesh_context_split_near_point(this, over_line[0]->item, + this->mousepoint_doc, 0); ret = TRUE; } } else { @@ -737,22 +750,47 @@ bool MeshTool::root_handler(GdkEvent* event) { } if (!this->within_tolerance) { - // we've been dragging, either create a new gradient - // or rubberband-select if we have rubberband - Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); - - if (r->is_started() && !this->within_tolerance) { - // this was a rubberband drag - if (r->getMode() == RUBBERBAND_MODE_RECT) { - Geom::OptRect const b = r->getRectangle(); - drag->selectRect(*b); + + // Check if object already has mesh... if it does, + // don't create new mesh with click-drag. + bool has_mesh = false; + if (!selection->isEmpty()) { + SPStyle *style = selection->items().front()->style; + if (style) { + Inkscape::PaintTarget fill_or_stroke = + (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? + Inkscape::FOR_FILL : Inkscape::FOR_STROKE; + SPPaintServer *server = + (fill_or_stroke == Inkscape::FOR_FILL) ? + style->getFillPaintServer(): + style->getStrokePaintServer(); + if (server && SP_IS_MESHGRADIENT(server)) + has_mesh = true; } - } else { - // Create a new mesh gradient + } + + if (!has_mesh) { sp_mesh_new_default(*this); + } else { + + // we've been dragging, either create a new gradient + // or rubberband-select if we have rubberband + Inkscape::Rubberband *r = Inkscape::Rubberband::get(desktop); + + if (r->is_started() && !this->within_tolerance) { + // this was a rubberband drag + if (r->getMode() == RUBBERBAND_MODE_RECT) { + Geom::OptRect const b = r->getRectangle(); + if (!(event->button.state & GDK_SHIFT_MASK)) { + drag->deselectAll(); + } + drag->selectRect(*b); + } + } } + } else if (this->item_to_select) { - if (over_line && line) { + if (!over_line.empty()) { // Clicked on an existing mesh line, don't change selection. This stops // possible change in selection during a double click with overlapping objects } else { @@ -760,6 +798,7 @@ bool MeshTool::root_handler(GdkEvent* event) { if (event->button.state & GDK_SHIFT_MASK) { selection->toggle(this->item_to_select); } else { + drag->deselectAll(); selection->set(this->item_to_select); } } @@ -1081,7 +1120,6 @@ static void sp_mesh_new_default(MeshTool &rc) { } } - } } } -- cgit v1.2.3 From e0e832245260d040f12bcebdf5b5e58763448e73 Mon Sep 17 00:00:00 2001 From: su_v <> Date: Sat, 19 Nov 2016 11:47:09 +0100 Subject: Add Shift-I shortcut for insert node. (bzr r15261) --- src/ui/tools/gradient-tool.cpp | 10 ++++++++++ src/ui/tools/mesh-tool.cpp | 10 ++++++++++ 2 files changed, 20 insertions(+) (limited to 'src/ui') diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp index 2a728b085..750596808 100644 --- a/src/ui/tools/gradient-tool.cpp +++ b/src/ui/tools/gradient-tool.cpp @@ -837,6 +837,16 @@ bool GradientTool::root_handler(GdkEvent* event) { ret = TRUE; break; + case GDK_KEY_i: + case GDK_KEY_I: + if (MOD__SHIFT_ONLY(event)) { + // Shift+I - insert stops (alternate keybinding for keyboards + // that don't have the Insert key) + sp_gradient_context_add_stops_between_selected_stops (this); + ret = TRUE; + } + break; + case GDK_KEY_Delete: case GDK_KEY_KP_Delete: case GDK_KEY_BackSpace: diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index fbde37856..0bcbd8572 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -966,6 +966,16 @@ bool MeshTool::root_handler(GdkEvent* event) { ret = TRUE; break; + case GDK_KEY_i: + case GDK_KEY_I: + if (MOD__SHIFT_ONLY(event)) { + // Shift+I - insert corners (alternate keybinding for keyboards + // that don't have the Insert key) + sp_mesh_context_corner_operation ( this, MG_CORNER_INSERT ); + ret = TRUE; + } + break; + case GDK_KEY_Delete: case GDK_KEY_KP_Delete: case GDK_KEY_BackSpace: -- cgit v1.2.3 From 03eabec553f7938b674a28ef8abe9b39e149fdb9 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 20 Nov 2016 11:36:40 +0100 Subject: Preserve selection of corner nodes for some corner operations. (bzr r15262) --- src/ui/tools/mesh-tool.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 0bcbd8572..d01837c49 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -430,6 +430,7 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) case MG_CORNER_SIDE_ARC: DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Approximated arc for mesh side.")); + drag->local_change = true; // Don't create new draggers. break; case MG_CORNER_TENSOR_TOGGLE: @@ -438,10 +439,12 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) case MG_CORNER_COLOR_SMOOTH: DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Smoothed mesh corner color.")); + drag->local_change = true; break; case MG_CORNER_COLOR_PICK: DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Picked mesh corner color.")); + drag->local_change = true; break; case MG_CORNER_INSERT: @@ -454,7 +457,9 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) } } } - drag->updateDraggers(); + + // Not needed. Update is done via gr_drag_sel_modified(). + // drag->updateDraggers(); } -- cgit v1.2.3 From b045203981fee53df04a760039ed2730d854f8fd Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 21 Nov 2016 12:34:27 +0100 Subject: Keep corner nodes selected when possible for corner operations. (bzr r15264) --- src/ui/tools/mesh-tool.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index d01837c49..7f05906f4 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -355,12 +355,13 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) std::map > points; std::map items; - + std::map fill_or_stroke; + // Get list of selected draggers for each mesh. - // For all selected draggers + // For all selected draggers (a dragger may include draggerables from different meshes). for (std::set::const_iterator i = drag->selected.begin(); i != drag->selected.end(); ++i) { GrDragger *dragger = *i; - // For all draggables of dragger + // For all draggables of dragger (a draggable corresponds to a unique mesh). for (std::vector::const_iterator j = dragger->draggables.begin(); j != dragger->draggables.end() ; ++j) { GrDraggable *d = *j; @@ -373,6 +374,7 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) // Collect points together for same gradient points[gradient].push_back( d->point_i ); items[gradient] = d->item; + fill_or_stroke[gradient] = d->fill_or_stroke ? Inkscape::FOR_FILL: Inkscape::FOR_STROKE; } } @@ -426,6 +428,7 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) case MG_CORNER_SIDE_TOGGLE: DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Toggled mesh path type.")); + drag->local_change = true; // Don't create new draggers. break; case MG_CORNER_SIDE_ARC: @@ -435,16 +438,17 @@ sp_mesh_context_corner_operation (MeshTool *rc, MeshCornerOperation operation ) case MG_CORNER_TENSOR_TOGGLE: DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Toggled mesh tensors.")); + drag->local_change = true; // Don't create new draggers. break; case MG_CORNER_COLOR_SMOOTH: DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Smoothed mesh corner color.")); - drag->local_change = true; + drag->local_change = true; // Don't create new draggers. break; case MG_CORNER_COLOR_PICK: DocumentUndo::done(doc, SP_VERB_CONTEXT_MESH, _("Picked mesh corner color.")); - drag->local_change = true; + drag->local_change = true; // Don't create new draggers. break; case MG_CORNER_INSERT: -- cgit v1.2.3 From 30fcf9ba0f0fd288a9a83371f50e4e462e7c648d Mon Sep 17 00:00:00 2001 From: Ivan Mas??r Date: Tue, 22 Nov 2016 10:31:46 +0100 Subject: Fix a typo in inkscape-preferences.cpp. (bzr r15266) --- src/ui/dialog/inkscape-preferences.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index f9540c989..c5e8a6de6 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -534,7 +534,7 @@ void InkscapePreferences::initPageUI() _("Hebrew (he)"), _("Hindi (hi)"), _("Hungarian (hu)"), _("Icelandic (is)"), _("Indonesian (id)"), _("Irish (ga)"), _("Italian (it)"), _("Japanese (ja)"), - _("Kannada (kn)"), _("Kashmiri in Peso-Arabic script (ks@aran)"), _("Kashmiri in Devanagari script (ks@deva)"), _("Khmer (km)"), _("Kinyarwanda (rw)"), _("Konkani (kok)"), _("Konkani in Latin script (kok@latin)"), _("Korean (ko)"), + _("Kannada (kn)"), _("Kashmiri in Perso-Arabic script (ks@aran)"), _("Kashmiri in Devanagari script (ks@deva)"), _("Khmer (km)"), _("Kinyarwanda (rw)"), _("Konkani (kok)"), _("Konkani in Latin script (kok@latin)"), _("Korean (ko)"), _("Latvian (lv)"), _("Lithuanian (lt)"), _("Macedonian (mk)"), _("Maithili (mai)"), _("Malayalam (ml)"), _("Manipuri (mni)"), _("Manipuri in Bengali script (mni@beng)"), _("Marathi (mr)"), _("Mongolian (mn)"), _("Nepali (ne)"), _("Norwegian Bokmål (nb)"), _("Norwegian Nynorsk (nn)"), -- cgit v1.2.3 From c4922f5c1b54802623bc43f04191495e2338fc24 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 23 Nov 2016 10:23:22 +0100 Subject: Select mesh nodes by clicking on control lines. (bzr r15267) --- src/ui/tools/mesh-tool.cpp | 52 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 11 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 7f05906f4..61232fb2c 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -41,6 +41,7 @@ #include "sp-text.h" #include "sp-defs.h" #include "style.h" +#include "ui/control-manager.h" // Gradient specific #include "gradient-drag.h" @@ -280,7 +281,7 @@ sp_mesh_context_select_prev (ToolBase *event_context) /** Returns vector of control lines mouse is over. Returns only first if 'first' is true. */ -static std::vector +static std::vector sp_mesh_context_over_line (MeshTool *rc, Geom::Point event_p, bool first = true) { SPDesktop *desktop = SP_EVENT_CONTEXT (rc)->desktop; @@ -292,7 +293,7 @@ sp_mesh_context_over_line (MeshTool *rc, Geom::Point event_p, bool first = true) GrDrag *drag = rc->_grdrag; - std::vector selected; + std::vector selected; for (std::vector::const_iterator l = drag->lines.begin(); l != drag->lines.end(); ++l) { if (!SP_IS_CTRLCURVE(*l)) continue; @@ -304,7 +305,7 @@ sp_mesh_context_over_line (MeshTool *rc, Geom::Point event_p, bool first = true) double dist_screen = Geom::L2 (rc->mousepoint_doc - nearest) * desktop->current_zoom(); if (dist_screen < tolerance) { - selected.push_back(*l); + selected.push_back(curve); if (first) { break; } @@ -560,7 +561,7 @@ bool MeshTool::root_handler(GdkEvent* event) { if ( event->button.button == 1 ) { // Are we over a mesh line? - std::vector over_line = + std::vector over_line = sp_mesh_context_over_line(this, Geom::Point(event->motion.x, event->motion.y)); if (!over_line.empty()) { @@ -607,6 +608,31 @@ bool MeshTool::root_handler(GdkEvent* event) { // If mesh already exists, do rubber band selection. // Else set origin for drag which will create a new gradient. if ( event->button.button == 1 && !this->space_panning ) { + + // Are we over a mesh line? + std::vector over_line = + sp_mesh_context_over_line(this, Geom::Point(event->motion.x, event->motion.y), false); + + if (!over_line.empty()) { + for (std::vector::const_iterator it = over_line.begin(); + it != over_line.end(); ++it ) { + SPItem *item = (*it)->item; + Inkscape::PaintTarget fill_or_stroke = + (*it)->is_fill ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE; + GrDragger* dragger0 = drag->getDraggerFor(item, POINT_MG_CORNER, (*it)->corner0, fill_or_stroke); + GrDragger* dragger1 = drag->getDraggerFor(item, POINT_MG_CORNER, (*it)->corner1, fill_or_stroke); + bool add = (event->button.state & GDK_SHIFT_MASK); + bool toggle = (event->button.state & GDK_CONTROL_MASK); + if ( !add && !toggle ) { + drag->deselectAll(); + } + drag->setSelected( dragger0, true, !toggle ); + drag->setSelected( dragger1, true, !toggle ); + } + ret = true; + break; // To avoid putting the following code in an else block. + } + Geom::Point button_w(event->button.x, event->button.y); // save drag origin @@ -714,7 +740,7 @@ bool MeshTool::root_handler(GdkEvent* event) { } // Change cursor shape if over line - std::vector over_line = + std::vector over_line = sp_mesh_context_over_line(this, Geom::Point(event->motion.x, event->motion.y)); if (this->cursor_addnode && over_line.empty()) { @@ -740,7 +766,7 @@ bool MeshTool::root_handler(GdkEvent* event) { if ( event->button.button == 1 && !this->space_panning ) { // Check if over line - std::vector over_line = + std::vector over_line = sp_mesh_context_over_line(this, Geom::Point(event->motion.x, event->motion.y)); if ( (event->button.state & GDK_CONTROL_MASK) && (event->button.state & GDK_MOD1_MASK ) ) { @@ -812,11 +838,16 @@ bool MeshTool::root_handler(GdkEvent* event) { } } } else { - // click in an empty space; do the same as Esc - if (!drag->selected.empty()) { - drag->deselectAll(); + if (!over_line.empty()) { + // Clicked on an existing mesh line, don't change selection. This stops + // possible change in selection during a double click with overlapping objects } else { - selection->clear(); + // click in an empty space; do the same as Esc + if (!drag->selected.empty()) { + drag->deselectAll(); + } else { + selection->clear(); + } } } @@ -989,7 +1020,6 @@ bool MeshTool::root_handler(GdkEvent* event) { case GDK_KEY_KP_Delete: case GDK_KEY_BackSpace: if ( !drag->selected.empty() ) { - std::cout << "Deleting mesh stops not implemented yet" << std::endl; ret = TRUE; } break; -- cgit v1.2.3 From d87cfa4971963dfb8118ce31e169854fce85bccd Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 1 Dec 2016 14:05:02 +0100 Subject: Add toggles for handle visibility, editing fill, and editing stroke. (bzr r15289) --- src/ui/tools/mesh-tool.cpp | 21 +++++++++++++++++++++ src/ui/tools/mesh-tool.h | 27 ++++++++++++++++----------- 2 files changed, 37 insertions(+), 11 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index 61232fb2c..b05caf43a 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -75,6 +75,9 @@ MeshTool::MeshTool() : ToolBase(cursor_gradient_xpm, 4, 4) , cursor_addnode(false) , node_added(false) + , show_handles(true) + , edit_fill(true) + , edit_stroke(true) // TODO: Why are these connections stored as pointers? , selcon(NULL) , subselcon(NULL) @@ -253,7 +256,25 @@ void MeshTool::setup() { ) )); + sp_event_context_read(this, "show_handles"); + sp_event_context_read(this, "edit_fill"); + sp_event_context_read(this, "edit_stroke"); + this->selection_changed(selection); + +} + +void MeshTool::set(const Inkscape::Preferences::Entry& value) { + Glib::ustring entry_name = value.getEntryName(); + if (entry_name == "show_handles") { + this->show_handles = value.getBool(true); + } else if (entry_name == "edit_fill") { + this->edit_fill = value.getBool(true); + } else if (entry_name == "edit_stroke") { + this->edit_stroke = value.getBool(true); + } else { + ToolBase::set(value); + } } void diff --git a/src/ui/tools/mesh-tool.h b/src/ui/tools/mesh-tool.h index f142bfd9c..1f012dc53 100644 --- a/src/ui/tools/mesh-tool.h +++ b/src/ui/tools/mesh-tool.h @@ -31,29 +31,34 @@ namespace Tools { class MeshTool : public ToolBase { public: - MeshTool(); - virtual ~MeshTool(); + MeshTool(); + virtual ~MeshTool(); Geom::Point origin; - bool cursor_addnode; - - bool node_added; - Geom::Point mousepoint_doc; // stores mousepoint when over_line in doc coords sigc::connection *selcon; sigc::connection *subselcon; - static const std::string prefsPath; + static const std::string prefsPath; - virtual void setup(); - virtual bool root_handler(GdkEvent* event); + virtual void setup(); + virtual void set(const Inkscape::Preferences::Entry& val); + virtual bool root_handler(GdkEvent* event); - virtual const std::string& getPrefsPath(); + virtual const std::string& getPrefsPath(); private: - void selection_changed(Inkscape::Selection* sel); + void selection_changed(Inkscape::Selection* sel); + + bool cursor_addnode; + bool node_added; + bool show_handles; + bool edit_fill; + bool edit_stroke; + + }; void sp_mesh_context_select_next(ToolBase *event_context); -- cgit v1.2.3 From c0895d809dfa89df7242e9bdc838755ed63c9218 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 2 Dec 2016 10:15:24 +0100 Subject: Ensure new mesh is immediately editable. (bzr r15290) --- src/ui/tools/mesh-tool.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index b05caf43a..e628094d9 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -1136,6 +1136,16 @@ static void sp_mesh_new_default(MeshTool &rc) { (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE; + // Ensure mesh is immediately editable. + // Editting both fill and stroke at same time doesn't work well so avoid. + if (fill_or_stroke == Inkscape::FOR_FILL) { + prefs->setBool("/tools/mesh/edit_fill", true ); + prefs->setBool("/tools/mesh/edit_stroke", false); + } else { + prefs->setBool("/tools/mesh/edit_fill", false); + prefs->setBool("/tools/mesh/edit_stroke", true ); + } + // HACK: reset fill-opacity - that 0.75 is annoying; BUT remove this when we have an opacity slider for all tabs SPCSSAttr *css = sp_repr_css_attr_new(); sp_repr_css_set_property(css, "fill-opacity", "1.0"); -- cgit v1.2.3 From 69ba226147751a529c9561925b2737fa3071ecd2 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sat, 3 Dec 2016 20:05:32 +0100 Subject: Improvements and fixes for buds pointed by suv on measure line LPE (bzr r15294) --- src/ui/dialog/livepatheffect-editor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 9bd4c093e..8910005aa 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -539,9 +539,11 @@ void LivePathEffectEditor::onDown() void LivePathEffectEditor::on_effect_selection_changed() { Glib::RefPtr sel = effectlist_view.get_selection(); - if (sel->count_selected_rows () == 0) + if (sel->count_selected_rows () == 0) { + button_remove.set_sensitive(false); return; - + } + button_remove.set_sensitive(true); Gtk::TreeModel::iterator it = sel->get_selected(); LivePathEffect::LPEObjectReference * lperef = (*it)[columns.lperef]; -- cgit v1.2.3 From f799b5d6e8278c76326a6fec8da0e017eac342ec Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Tue, 6 Dec 2016 21:41:55 +0100 Subject: Fixes for measure LPE and speed path based LPE operations (bzr r15302) --- src/ui/tool/path-manipulator.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index f316bea38..75b507a57 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1493,10 +1493,14 @@ void PathManipulator::_setGeometry() } else { if (empty()) return; //XML Tree being used here directly while it shouldn't be. - if (_path->getRepr()->attribute("inkscape:original-d")) - _path->set_original_curve(_spcurve, false, false); - else + if (SPCurve * original = _path->get_original_curve()){ + if(!_spcurve->is_equal(original)) { + _path->set_original_curve(_spcurve, false, false); + delete original; + } + } else if(!_spcurve->is_equal(_path->get_curve())) { _path->setCurve(_spcurve, false); + } } } -- cgit v1.2.3 From 3b154fb4c6d16369222c0755c3c2048a186d043a Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Tue, 6 Dec 2016 22:22:02 +0100 Subject: Remove obsolete comment (bzr r15303) --- src/ui/tool/path-manipulator.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 75b507a57..5746a8f86 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1492,7 +1492,6 @@ void PathManipulator::_setGeometry() } } else { if (empty()) return; - //XML Tree being used here directly while it shouldn't be. if (SPCurve * original = _path->get_original_curve()){ if(!_spcurve->is_equal(original)) { _path->set_original_curve(_spcurve, false, false); -- cgit v1.2.3 From 5a8c4695e3c2d3916d88bc77d80d427aad622fdd Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 15 Dec 2016 19:18:43 +0100 Subject: Prevent crash when iterator invalidated after converting shape to path. (bzr r15328) --- src/ui/tools/tweak-tool.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index 56939cc30..ff5d623c2 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -1084,7 +1084,8 @@ sp_tweak_dilate (TweakTool *tc, Geom::Point event_p, Geom::Point p, Geom::Point double move_force = get_move_force(tc); double color_force = MIN(sqrt(path_force)/20.0, 1); - auto items= selection->items(); +// auto items= selection->items(); + std::vector items(selection->items().begin(), selection->items().end()); for(auto i=items.begin();i!=items.end(); ++i){ SPItem *item = *i; -- cgit v1.2.3 From 5ba49eaa5621b2e232f8df179798a1b2b282890c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 19 Dec 2016 19:00:54 +0100 Subject: Add update_helperpaths not member of nodetool class to easy call from outside (bzr r15335) --- src/ui/tool/node.cpp | 10 ++-------- src/ui/tools/node-tool.cpp | 40 +++++++++++++++++++++++----------------- src/ui/tools/node-tool.h | 4 ++-- 3 files changed, 27 insertions(+), 27 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 0e5a9279d..d6e491ac3 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -326,10 +326,7 @@ bool Handle::grabbed(GdkEventMotion *) void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) { - if (tools_isactive(_desktop, TOOLS_NODES)) { - Inkscape::UI::Tools::NodeTool *nt = static_cast(_desktop->event_context); - nt->update_helperpath(); - } + Inkscape::UI::Tools::sp_update_helperpath(); Geom::Point parent_pos = _parent->position(); Geom::Point origin = _last_drag_origin(); SnapManager &sm = _desktop->namedview->snap_manager; @@ -1199,10 +1196,7 @@ bool Node::grabbed(GdkEventMotion *event) void Node::dragged(Geom::Point &new_pos, GdkEventMotion *event) { - if (tools_isactive(_desktop, TOOLS_NODES)) { - Inkscape::UI::Tools::NodeTool *nt = static_cast(_desktop->event_context); - nt->update_helperpath(); - } + Inkscape::UI::Tools::sp_update_helperpath(); // For a note on how snapping is implemented in Inkscape, see snap.h. SnapManager &sm = _desktop->namedview->snap_manager; // even if we won't really snap, we might still call the one of the diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index f3679b40f..668ebda27 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -32,6 +32,8 @@ #include "sp-text.h" #include "ui/control-manager.h" #include "ui/tools/node-tool.h" +#include "ui/tools-switch.h" +#include "ui/tools/tool-base.h" #include "ui/tool/control-point-selection.h" #include "ui/tool/event-utils.h" #include "ui/tool/multi-path-manipulator.h" @@ -155,9 +157,7 @@ NodeTool::~NodeTool() { if (this->flash_tempitem) { this->desktop->remove_temporary_canvasitem(this->flash_tempitem); } - if (this->helperpath_tmpitem) { - this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); - } + sp_update_helperpath(true); this->_selection_changed_connection.disconnect(); //this->_selection_modified_connection.disconnect(); this->_mouseover_changed_connection.disconnect(); @@ -237,7 +237,6 @@ void NodeTool::setup() { ))) ); - this->helperpath_tmpitem = NULL; this->cursor_drag = false; this->show_transform_handles = true; this->single_node_transform_handles = false; @@ -270,29 +269,36 @@ void NodeTool::setup() { } this->desktop->emitToolSubselectionChanged(NULL); // sets the coord entry fields to inactive - this->update_helperpath(); + sp_update_helperpath(); } // show helper paths of the applied LPE, if any -void NodeTool::update_helperpath () { - Inkscape::Selection *selection = this->desktop->getSelection(); - - if (this->helperpath_tmpitem) { - this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); - this->helperpath_tmpitem = NULL; +void sp_update_helperpath(bool remove) { + SPDesktop * desktop = SP_ACTIVE_DESKTOP; + if (!desktop || !tools_isactive(desktop, TOOLS_NODES)) { + return; + } + Inkscape::Selection *selection = desktop->getSelection(); + static Inkscape::Display::TemporaryItem * helperpath_tmpitem; + if (helperpath_tmpitem) { + desktop->remove_temporary_canvasitem(helperpath_tmpitem); + helperpath_tmpitem = NULL; + } + if (remove) { + return; } - if (SP_IS_LPE_ITEM(selection->singleItem())) { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) { - Inkscape::UI::ControlPointSelection *selectionNodes = _selected_nodes; + Inkscape::UI::Tools::NodeTool *nt = static_cast(desktop->event_context); + Inkscape::UI::ControlPointSelection *selectionNodes = nt->_selected_nodes; std::vector selectedNodesPositions; for (Inkscape::UI::ControlPointSelection::iterator i = selectionNodes->begin(); i != selectionNodes->end(); ++i) { Inkscape::UI::Node *n = dynamic_cast(*i); selectedNodesPositions.push_back(n->position()); } lpe->setSelectedNodePoints(selectedNodesPositions); - lpe->setCurrentZoom(this->desktop->current_zoom()); + lpe->setCurrentZoom(desktop->current_zoom()); SPCurve *c = new SPCurve(); SPCurve *cc = new SPCurve(); std::vector cs = lpe->getCanvasIndicators(SP_LPE_ITEM(selection->singleItem())); @@ -302,11 +308,11 @@ void NodeTool::update_helperpath () { cc->reset(); } if (!c->is_empty()) { - SPCanvasItem *helperpath = sp_canvas_bpath_new(this->desktop->getTempGroup(), c, true); + SPCanvasItem *helperpath = sp_canvas_bpath_new(desktop->getTempGroup(), c, true); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath), 0x0000ff9A, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath), 0, SP_WIND_RULE_NONZERO); sp_canvas_item_affine_absolute(helperpath, selection->singleItem()->i2dt_affine()); - this->helperpath_tmpitem = this->desktop->add_temporary_canvasitem(helperpath, 0); + helperpath_tmpitem = desktop->add_temporary_canvasitem(helperpath, 0); } c->unref(); cc->unref(); @@ -468,7 +474,7 @@ bool NodeTool::root_handler(GdkEvent* event) { switch (event->type) { case GDK_MOTION_NOTIFY: { - update_helperpath(); + sp_update_helperpath(); combine_motion_events(desktop->canvas, event->motion, 0); SPItem *over_item = sp_event_context_find_item (desktop, event_point(event->button), FALSE, TRUE); diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h index 8342d66a6..8517c54fe 100644 --- a/src/ui/tools/node-tool.h +++ b/src/ui/tools/node-tool.h @@ -56,7 +56,6 @@ public: static const std::string prefsPath; virtual void setup(); - virtual void update_helperpath(); virtual void set(const Inkscape::Preferences::Entry& val); virtual bool root_handler(GdkEvent* event); @@ -68,7 +67,6 @@ private: sigc::connection _sizeUpdatedConn; SPItem *flashed_item; - Inkscape::Display::TemporaryItem *helperpath_tmpitem; Inkscape::Display::TemporaryItem *flash_tempitem; Inkscape::UI::Selector* _selector; Inkscape::UI::PathSharedData* _path_data; @@ -97,7 +95,9 @@ private: void handleControlUiStyleChange(); }; +void sp_update_helperpath(bool remove = false); } + } } -- cgit v1.2.3 From c5b33e5041c6bd1f62ef550ac2b8e1bc739a40e2 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 19 Dec 2016 19:14:56 +0100 Subject: Remove unneeded static var from previous commit (bzr r15336) --- src/ui/tools/node-tool.cpp | 24 ++++++++++++------------ src/ui/tools/node-tool.h | 7 ++++--- 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 668ebda27..0c948c91c 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -157,7 +157,9 @@ NodeTool::~NodeTool() { if (this->flash_tempitem) { this->desktop->remove_temporary_canvasitem(this->flash_tempitem); } - sp_update_helperpath(true); + if (this->helperpath_tmpitem) { + this->desktop->remove_temporary_canvasitem(this->helperpath_tmpitem); + } this->_selection_changed_connection.disconnect(); //this->_selection_modified_connection.disconnect(); this->_mouseover_changed_connection.disconnect(); @@ -209,7 +211,7 @@ void NodeTool::setup() { this->_sizeUpdatedConn = ControlManager::getManager().connectCtrlSizeChanged( sigc::mem_fun(this, &NodeTool::handleControlUiStyleChange) ); - + this->helperpath_tmpitem = NULL; this->_selected_nodes = new Inkscape::UI::ControlPointSelection(this->desktop, this->_transform_handle_group); data.node_data.selection = this->_selected_nodes; @@ -273,24 +275,22 @@ void NodeTool::setup() { } // show helper paths of the applied LPE, if any -void sp_update_helperpath(bool remove) { +void sp_update_helperpath() { SPDesktop * desktop = SP_ACTIVE_DESKTOP; if (!desktop || !tools_isactive(desktop, TOOLS_NODES)) { return; } + Inkscape::UI::Tools::NodeTool *nt = static_cast(desktop->event_context); Inkscape::Selection *selection = desktop->getSelection(); - static Inkscape::Display::TemporaryItem * helperpath_tmpitem; - if (helperpath_tmpitem) { - desktop->remove_temporary_canvasitem(helperpath_tmpitem); - helperpath_tmpitem = NULL; - } - if (remove) { - return; + if (nt->helperpath_tmpitem) { + desktop->remove_temporary_canvasitem(nt->helperpath_tmpitem); + nt->helperpath_tmpitem = NULL; } + if (SP_IS_LPE_ITEM(selection->singleItem())) { Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(selection->singleItem())->getCurrentLPE(); if (lpe && lpe->isVisible()/* && lpe->showOrigPath()*/) { - Inkscape::UI::Tools::NodeTool *nt = static_cast(desktop->event_context); + Inkscape::UI::ControlPointSelection *selectionNodes = nt->_selected_nodes; std::vector selectedNodesPositions; for (Inkscape::UI::ControlPointSelection::iterator i = selectionNodes->begin(); i != selectionNodes->end(); ++i) { @@ -312,7 +312,7 @@ void sp_update_helperpath(bool remove) { sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helperpath), 0x0000ff9A, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helperpath), 0, SP_WIND_RULE_NONZERO); sp_canvas_item_affine_absolute(helperpath, selection->singleItem()->i2dt_affine()); - helperpath_tmpitem = desktop->add_temporary_canvasitem(helperpath, 0); + nt->helperpath_tmpitem = desktop->add_temporary_canvasitem(helperpath, 0); } c->unref(); cc->unref(); diff --git a/src/ui/tools/node-tool.h b/src/ui/tools/node-tool.h index 8517c54fe..983ba6cee 100644 --- a/src/ui/tools/node-tool.h +++ b/src/ui/tools/node-tool.h @@ -49,7 +49,8 @@ public: Inkscape::UI::ControlPointSelection* _selected_nodes; Inkscape::UI::MultiPathManipulator* _multipath; - + Inkscape::Display::TemporaryItem *helperpath_tmpitem; + bool edit_clipping_paths; bool edit_masks; @@ -67,6 +68,7 @@ private: sigc::connection _sizeUpdatedConn; SPItem *flashed_item; + Inkscape::Display::TemporaryItem *flash_tempitem; Inkscape::UI::Selector* _selector; Inkscape::UI::PathSharedData* _path_data; @@ -94,8 +96,7 @@ private: void update_tip(GdkEvent *event); void handleControlUiStyleChange(); }; - -void sp_update_helperpath(bool remove = false); + void sp_update_helperpath(); } } -- cgit v1.2.3 From 952eb10b1e00f0e4abfbf8dd23fcb3935019f098 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Mon, 19 Dec 2016 21:54:42 +0100 Subject: Remove some ocurrences of desktop in knot functions (bzr r15337) --- src/ui/object-edit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/object-edit.cpp b/src/ui/object-edit.cpp index 2763e6c4b..cf2c03396 100644 --- a/src/ui/object-edit.cpp +++ b/src/ui/object-edit.cpp @@ -43,7 +43,7 @@ static KnotHolder *sp_lpe_knot_holder(SPLPEItem *item, SPDesktop *desktop) KnotHolder *knot_holder = new KnotHolder(desktop, item, NULL); Inkscape::LivePathEffect::Effect *effect = item->getCurrentLPE(); - effect->addHandles(knot_holder, desktop, item); + effect->addHandles(knot_holder, item); return knot_holder; } -- cgit v1.2.3 From 7d524286a0b613a5a5126884f3fb4f674446096e Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Sat, 24 Dec 2016 07:59:17 +0100 Subject: i18n. Flood autogap list not correctly translated at runtime. (bzr r15351) --- src/ui/tools/flood-tool.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index b01b8ad52..1801a0ea0 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -89,10 +89,10 @@ Glib::ustring ch_init[8] = { const std::vector FloodTool::channel_list( ch_init, ch_init+8 ); Glib::ustring gap_init[4] = { - C_("Flood autogap", "None"), - C_("Flood autogap", "Small"), - C_("Flood autogap", "Medium"), - C_("Flood autogap", "Large") + NC_("Flood autogap", "None"), + NC_("Flood autogap", "Small"), + NC_("Flood autogap", "Medium"), + NC_("Flood autogap", "Large") }; const std::vector FloodTool::gap_list( gap_init, gap_init+4 ); -- cgit v1.2.3 From 3182218af4961cfc0a92b2f1eae4cfab74e64eff Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 26 Dec 2016 12:07:14 +0000 Subject: Fix a few Gtkmm deprecations (bzr r15357) --- src/ui/widget/panel.cpp | 10 ++++------ src/ui/widget/panel.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/ui') diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 6e6e6c527..d2ec340c8 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -66,7 +66,7 @@ Panel::Panel(Glib::ustring const &label, gchar const *prefs_path, _label(label), _apply_label(apply_label), _verb_num(verb_num), - _temp_arrow(Gtk::ARROW_LEFT, Gtk::SHADOW_ETCHED_OUT), + _temp_arrow(), _menu(0), _action_area(0), _fillable(0) @@ -269,11 +269,9 @@ void Panel::_init() _top_bar.pack_end(_menu_popper, false, false); gint width = 0; gint height = 0; - - if ( gtk_icon_size_lookup( Inkscape::getRegisteredIconSize(Inkscape::ICON_SIZE_DECORATION), &width, &height ) ) { - _temp_arrow.set_size_request(width, height); - } - + gtk_image_set_from_icon_name(_temp_arrow.gobj(), + "pan-start-symbolic", + Inkscape::getRegisteredIconSize(Inkscape::ICON_SIZE_SMALL_TOOLBAR)); _menu_popper.add(_temp_arrow); _menu_popper.signal_button_press_event().connect_notify(sigc::mem_fun(*this, &Panel::_popper)); } diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 370779586..0ea609904 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -18,9 +18,9 @@ #endif #include -#include #include #include +#include #include #include "enums.h" #include @@ -157,7 +157,7 @@ private: Gtk::VBox _right_bar; Gtk::VBox _contents; Gtk::Label _tab_title; - Gtk::Arrow _temp_arrow; + Gtk::Image _temp_arrow; Gtk::EventBox _menu_popper; Gtk::Button _close_button; Gtk::Menu *_menu; -- cgit v1.2.3 From bcfec16e05533d0fd11134c7712ca213835d5f84 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 26 Dec 2016 19:19:37 +0000 Subject: frame: Gtk3 fixes (bzr r15361) --- src/ui/dialog/text-edit.h | 1 + src/ui/widget/frame.cpp | 30 +++++++++++++++++++----------- src/ui/widget/frame.h | 3 --- 3 files changed, 20 insertions(+), 14 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/text-edit.h b/src/ui/dialog/text-edit.h index e974874d2..1fc0099fb 100644 --- a/src/ui/dialog/text-edit.h +++ b/src/ui/dialog/text-edit.h @@ -22,6 +22,7 @@ # include #endif +#include #include #include #include diff --git a/src/ui/widget/frame.cpp b/src/ui/widget/frame.cpp index 65d10dcc4..6593d9c7c 100644 --- a/src/ui/widget/frame.cpp +++ b/src/ui/widget/frame.cpp @@ -21,26 +21,20 @@ namespace UI { namespace Widget { Frame::Frame(Glib::ustring const &label_text /*= ""*/, gboolean label_bold /*= TRUE*/ ) - : _label(label_text, 1.0, 0.5, TRUE), - _alignment() + : _label(label_text, 1.0, 0.5, TRUE) { set_shadow_type(Gtk::SHADOW_NONE); - //Put an indented GtkAlignment inside the frame. - //Further children should be children of this GtkAlignment: - Gtk::Frame::add(_alignment); - set_padding(4, 0, 8, 0); - set_label_widget(_label); set_label(label_text, label_bold); - - show_all_children(); } void Frame::add(Widget& widget) { - _alignment.add(widget); + Gtk::Frame::add(widget); + set_padding(4, 0, 8, 0); + show_all_children(); } void @@ -56,7 +50,21 @@ Frame::set_label(const Glib::ustring &label_text, gboolean label_bold /*= TRUE*/ void Frame::set_padding (guint padding_top, guint padding_bottom, guint padding_left, guint padding_right) { - _alignment.set_padding(padding_top, padding_bottom, padding_left, padding_right); + auto child = get_child(); + + if(child) + { + child->set_margin_top(padding_top); + child->set_margin_bottom(padding_bottom); + +#if GTK_CHECK_VERSION(3,12,0) + child->set_margin_start(padding_left); + child->set_margin_end(padding_right); +#else + child->set_margin_left(padding_left); + child->set_margin_right(padding_right); +#endif + } } Gtk::Label const * diff --git a/src/ui/widget/frame.h b/src/ui/widget/frame.h index a04666651..24dd716e6 100644 --- a/src/ui/widget/frame.h +++ b/src/ui/widget/frame.h @@ -10,7 +10,6 @@ #ifndef INKSCAPE_UI_WIDGET_FRAME_H #define INKSCAPE_UI_WIDGET_FRAME_H -#include #include #include @@ -55,8 +54,6 @@ public: protected: Gtk::Label _label; - Gtk::Alignment _alignment; - }; } // namespace Widget -- cgit v1.2.3 From 223ba2e5e0060a4fef243fb3249c946168698e59 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 26 Dec 2016 23:00:38 +0000 Subject: Fix header inclusion ordering (bzr r15365) --- src/ui/widget/font-button.cpp | 3 +++ src/ui/widget/font-button.h | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/widget/font-button.cpp b/src/ui/widget/font-button.cpp index a472ac6a4..ed57c803a 100644 --- a/src/ui/widget/font-button.cpp +++ b/src/ui/widget/font-button.cpp @@ -8,8 +8,11 @@ #endif #include "font-button.h" + #include +#include + namespace Inkscape { namespace UI { namespace Widget { diff --git a/src/ui/widget/font-button.h b/src/ui/widget/font-button.h index 1f1ad2d01..98c3db440 100644 --- a/src/ui/widget/font-button.h +++ b/src/ui/widget/font-button.h @@ -8,7 +8,6 @@ #ifndef INKSCAPE_UI_WIDGET_FONT_BUTTON_H #define INKSCAPE_UI_WIDGET_FONT_BUTTON_H -#include #include "labelled.h" namespace Inkscape { -- cgit v1.2.3 From 9144e83f27ca6ad76ec6d72a8426ebd76c63a6a5 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 27 Dec 2016 01:27:19 +0000 Subject: Rm some deprecated Gtk::Stock usage (bzr r15366) --- src/ui/dialog/aboutbox.cpp | 2 +- src/ui/dialog/calligraphic-profile-rename.cpp | 8 ++++---- src/ui/dialog/document-properties.cpp | 9 +++------ src/ui/dialog/export.cpp | 15 +++++---------- src/ui/dialog/export.h | 2 -- src/ui/dialog/panel-dialog.h | 6 +++--- src/ui/dialog/pixelartdialog.cpp | 4 ++-- src/ui/dialog/tracedialog.cpp | 4 ++-- src/ui/dialog/transformation.cpp | 4 ++-- src/ui/widget/panel.cpp | 10 +--------- src/ui/widget/panel.h | 1 - 11 files changed, 23 insertions(+), 42 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index 552500fe8..b7a48e859 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -102,7 +102,7 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) { tabs->show_all(); - add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE); + add_button(_("_Close"), Gtk::RESPONSE_CLOSE); set_default_response(Gtk::RESPONSE_CLOSE); Gtk::Label *label=new Gtk::Label(); diff --git a/src/ui/dialog/calligraphic-profile-rename.cpp b/src/ui/dialog/calligraphic-profile-rename.cpp index 50dae0fd8..0835043ab 100644 --- a/src/ui/dialog/calligraphic-profile-rename.cpp +++ b/src/ui/dialog/calligraphic-profile-rename.cpp @@ -46,17 +46,17 @@ CalligraphicProfileRename::CalligraphicProfileRename() : mainVBox->pack_start(*_layout_table, false, false, 4); // Buttons - _close_button.set_use_stock(true); - _close_button.set_label(Gtk::Stock::CANCEL.id); + _close_button.set_use_underline(); + _close_button.set_label(_("_Cancel")); _close_button.set_can_default(); _delete_button.set_use_underline(true); - _delete_button.set_label(_("Delete")); + _delete_button.set_label(_("_Delete")); _delete_button.set_can_default(); _delete_button.set_visible(false); _apply_button.set_use_underline(true); - _apply_button.set_label(_("Save")); + _apply_button.set_label(_("_Save")); _apply_button.set_can_default(); _close_button.signal_clicked() diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 053549b73..8593223c1 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -44,9 +44,6 @@ #include "color-profile.h" #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -#include -#include - #include "ui/icon-names.h" using std::pair; @@ -558,7 +555,7 @@ void DocumentProperties::linked_profiles_list_button_release(GdkEventButton* eve void DocumentProperties::cms_create_popup_menu(Gtk::Widget& parent, sigc::slot rem) { - Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE)); + Gtk::MenuItem* mi = Gtk::manage(new Gtk::MenuItem(_("_Remove"), true)); _EmbProfContextMenu.append(*mi); mi->signal_activate().connect(rem); mi->show(); @@ -568,7 +565,7 @@ void DocumentProperties::cms_create_popup_menu(Gtk::Widget& parent, sigc::slot rem) { - Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE)); + Gtk::MenuItem* mi = Gtk::manage(new Gtk::MenuItem(_("_Remove"), true)); _ExternalScriptsContextMenu.append(*mi); mi->signal_activate().connect(rem); mi->show(); @@ -577,7 +574,7 @@ void DocumentProperties::external_create_popup_menu(Gtk::Widget& parent, sigc::s void DocumentProperties::embedded_create_popup_menu(Gtk::Widget& parent, sigc::slot rem) { - Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE)); + Gtk::MenuItem* mi = Gtk::manage(new Gtk::MenuItem(_("_Remove"), true)); _EmbeddedScriptsContextMenu.append(*mi); mi->signal_activate().connect(rem); mi->show(); diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 98ecf6db7..9bebde00f 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #ifdef WITH_GNOME_VFS # include // gnome_vfs_initialized @@ -142,7 +141,7 @@ Export::Export (void) : units_label(_("Units:")), filename_box(false, 5), browse_label(_("_Export As..."), 1), - browse_image(Gtk::StockID(Gtk::Stock::INDEX), Gtk::ICON_SIZE_BUTTON), + browse_image(), batch_box(false, 5), batch_export(_("B_atch export all selected objects"), _("Export each selected object into its own PNG file, using export hints if any (caution, overwrites without asking!)")), interlacing(_("Use interlacing"),_("Enables ADAM7 interlacing for PNG output. This results in slightly heavier images, but big images will look better sooner when loading the file")), @@ -156,8 +155,6 @@ Export::Export (void) : hide_export(_("Hide a_ll except selected"), _("In the exported image, hide all objects except those that are selected")), closeWhenDone(_("Close when complete"), _("Once the export completes, close this dialog")), button_box(false, 3), - export_label(_("_Export"), 1), - export_image(Gtk::StockID(Gtk::Stock::APPLY), Gtk::ICON_SIZE_BUTTON), _prog(), prog_dlg(NULL), interrupted(false), @@ -290,6 +287,7 @@ Export::Export (void) : filename_box.pack_start (filename_entry, true, true, 0); Gtk::HBox* browser_im_label = new Gtk::HBox(false, 3); + browse_image.set_from_icon_name("folder", Gtk::ICON_SIZE_BUTTON); browser_im_label->pack_start(browse_image); browser_im_label->pack_start(browse_label); browse_button.add(*browser_im_label); @@ -318,11 +316,8 @@ Export::Export (void) : /* Export Button row */ button_box.set_border_width(3); - Gtk::HBox* export_image_label = new Gtk::HBox(false, 3); - export_image_label->pack_start(export_image); - export_image_label->pack_start(export_label); - - export_button.add(*export_image_label); + export_button.set_label(_("_Export")); + export_button.set_use_underline(); export_button.set_tooltip_text (_("Export the bitmap file with these settings")); button_box.pack_start(closeWhenDone, true, true, 0 ); @@ -906,7 +901,7 @@ Gtk::Dialog * Export::create_progress_dialog (Glib::ustring progress_text) { auto CA = dlg->get_content_area(); CA->pack_start(*prg, FALSE, FALSE, 4); - Gtk::Button* btn = dlg->add_button (Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL ); + Gtk::Button* btn = dlg->add_button (_("_Cancel"),Gtk::RESPONSE_CANCEL ); btn->signal_clicked().connect( sigc::mem_fun(*this, &Export::onProgressCancel) ); dlg->signal_delete_event().connect( sigc::mem_fun(*this, &Export::onProgressDelete) ); diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h index 112f42312..f64d92341 100644 --- a/src/ui/dialog/export.h +++ b/src/ui/dialog/export.h @@ -331,8 +331,6 @@ private: /* Export Button widgets */ Gtk::HBox button_box; Gtk::Button export_button; - Gtk::Label export_label; - Gtk::Image export_image; Gtk::ProgressBar _prog; diff --git a/src/ui/dialog/panel-dialog.h b/src/ui/dialog/panel-dialog.h index 39110f47a..5919fcaeb 100644 --- a/src/ui/dialog/panel-dialog.h +++ b/src/ui/dialog/panel-dialog.h @@ -15,8 +15,8 @@ # include #endif +#include #include -#include #include "verbs.h" #include "dialog.h" @@ -165,7 +165,7 @@ PanelDialog::PanelDialog(Widget::Panel &panel, char const *prefs_path, int co panel.addResponseButton(apply_label, Gtk::RESPONSE_APPLY); panel.setDefaultResponse(Gtk::RESPONSE_APPLY); } - panel.addResponseButton(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE); + panel.addResponseButton(_("_Close"), Gtk::RESPONSE_CLOSE); } show_all_children(); @@ -214,7 +214,7 @@ PanelDialog::PanelDialog(UI::Widget::Panel &panel, c panel.addResponseButton(apply_label, Gtk::RESPONSE_APPLY); panel.setDefaultResponse(Gtk::RESPONSE_APPLY); } - panel.addResponseButton(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE); + panel.addResponseButton(_("_Close"), Gtk::RESPONSE_CLOSE); } show_all_children(); diff --git a/src/ui/dialog/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp index b838b0842..79747a798 100644 --- a/src/ui/dialog/pixelartdialog.cpp +++ b/src/ui/dialog/pixelartdialog.cpp @@ -291,12 +291,12 @@ PixelArtDialogImpl::PixelArtDialogImpl() : mainResetButton ->set_tooltip_text(_("Reset all settings to defaults")); //## The OK button - mainCancelButton = addResponseButton(Gtk::Stock::STOP, GTK_RESPONSE_CANCEL); + mainCancelButton = addResponseButton(_("_Stop"), GTK_RESPONSE_CANCEL); if (mainCancelButton) { mainCancelButton->set_tooltip_text(_("Abort a trace in progress")); mainCancelButton->set_sensitive(false); } - mainOkButton = addResponseButton(Gtk::Stock::OK, GTK_RESPONSE_OK); + mainOkButton = addResponseButton(_("_OK"), GTK_RESPONSE_OK); mainOkButton->set_tooltip_text(_("Execute the trace")); contents->pack_start(buttonsHBox); diff --git a/src/ui/dialog/tracedialog.cpp b/src/ui/dialog/tracedialog.cpp index 1c0cb5708..6f31935a4 100644 --- a/src/ui/dialog/tracedialog.cpp +++ b/src/ui/dialog/tracedialog.cpp @@ -813,12 +813,12 @@ TraceDialogImpl::TraceDialogImpl() : mainResetButton ->set_tooltip_text(_("Reset all settings to defaults")); //## The OK button - mainCancelButton = addResponseButton(Gtk::Stock::STOP, GTK_RESPONSE_CANCEL); + mainCancelButton = addResponseButton(_("_Stop"), GTK_RESPONSE_CANCEL); if (mainCancelButton) { mainCancelButton->set_tooltip_text(_("Abort a trace in progress")); mainCancelButton->set_sensitive(false); } - mainOkButton = addResponseButton(Gtk::Stock::OK, GTK_RESPONSE_OK); + mainOkButton = addResponseButton(_("_OK"), GTK_RESPONSE_OK); mainOkButton->set_tooltip_text(_("Execute the trace")); show_all_children(); diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 5ec47b0dc..475c3a9c6 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -134,14 +134,14 @@ Transformation::Transformation() updateSelection(PAGE_MOVE, _getSelection()); - resetButton = addResponseButton(Gtk::Stock::CLEAR, 0); + resetButton = addResponseButton(_("_Clear"), 0); if (resetButton) { resetButton->set_tooltip_text(_("Reset the values on the current tab to defaults")); resetButton->set_sensitive(true); resetButton->signal_clicked().connect(sigc::mem_fun(*this, &Transformation::onClear)); } - applyButton = addResponseButton(Gtk::Stock::APPLY, Gtk::RESPONSE_APPLY); + applyButton = addResponseButton(_("_Apply"), Gtk::RESPONSE_APPLY); if (applyButton) { applyButton->set_tooltip_text(_("Apply transformation to selection")); applyButton->set_sensitive(false); diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index d2ec340c8..dff92594b 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -17,7 +17,6 @@ #include // for Gtk::RESPONSE_* #include -#include #include #include #include @@ -576,14 +575,7 @@ void Panel::_apply() Gtk::Button *Panel::addResponseButton(const Glib::ustring &button_text, int response_id, bool pack_start) { - Gtk::Button *button = new Gtk::Button(button_text); - _addResponseButton(button, response_id, pack_start); - return button; -} - -Gtk::Button *Panel::addResponseButton(const Gtk::StockID &stock_id, int response_id, bool pack_start) -{ - Gtk::Button *button = new Gtk::Button(stock_id); + Gtk::Button *button = new Gtk::Button(button_text, true); _addResponseButton(button, response_id, pack_start); return button; } diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 0ea609904..9cbf39de9 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -101,7 +101,6 @@ public: /* Methods providing a Gtk::Dialog like interface for adding buttons that emit Gtk::RESPONSE * signals on click. */ Gtk::Button* addResponseButton (const Glib::ustring &button_text, int response_id, bool pack_start=false); - Gtk::Button* addResponseButton (const Gtk::StockID &stock_id, int response_id, bool pack_start=false); void setDefaultResponse(int response_id); void setResponseSensitive(int response_id, bool setting); -- cgit v1.2.3 From d14c66ec084bb5a53e1a47942cca89f189da8caf Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 27 Dec 2016 14:38:57 +0000 Subject: Rm more deprecated Gtk::Stock (bzr r15367) --- src/ui/dialog/filedialogimpl-gtkmm.cpp | 13 ++++++------- src/ui/dialog/filter-effects-dialog.cpp | 5 ++--- src/ui/dialog/guides.cpp | 8 +++----- src/ui/dialog/knot-properties.cpp | 12 ++++++++---- src/ui/dialog/knot-properties.h | 11 +++++------ src/ui/dialog/layer-properties.cpp | 9 +++++---- src/ui/dialog/livepatheffect-add.cpp | 6 ++---- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 11 +++++------ src/ui/dialog/lpe-powerstroke-properties.cpp | 7 ++++--- src/ui/dialog/ocaldialogs.cpp | 10 +++++----- src/ui/dialog/svg-fonts-dialog.cpp | 10 +++++----- src/ui/dialog/text-edit.cpp | 5 ++--- src/ui/dialog/undo-history.cpp | 10 +++++----- src/ui/widget/dock-item.cpp | 8 -------- src/ui/widget/preferences-widget.cpp | 6 +++--- 15 files changed, 60 insertions(+), 71 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index e8c1bf723..f5450ac9a 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -35,7 +35,6 @@ #endif #include -#include #include #include @@ -735,8 +734,8 @@ FileOpenDialogImplGtk::FileOpenDialogImplGtk(Gtk::Window &parentWindow, const Gl //###### Add the file types menu createFilterMenu(); - add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - set_default(*add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK)); + add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL); + set_default(*add_button(_("_Open"), Gtk::RESPONSE_OK)); //###### Allow easy access to our examples folder if (Inkscape::IO::file_test(INKSCAPE_EXAMPLESDIR, G_FILE_TEST_EXISTS) && @@ -1050,8 +1049,8 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk(Gtk::Window &parentWindow, const Gl // if (extension == NULL) // checkbox.set_sensitive(FALSE); - add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - set_default(*add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK)); + add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL); + set_default(*add_button(_("_Save"), Gtk::RESPONSE_OK)); show_all_children(); } @@ -1597,8 +1596,8 @@ FileExportDialogImpl::FileExportDialogImpl(Gtk::Window &parentWindow, const Glib // if (extension == NULL) // checkbox.set_sensitive(FALSE); - add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - set_default(*add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK)); + add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL); + set_default(*add_button(_("_Save"), Gtk::RESPONSE_OK)); show_all_children(); } diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index f657e1b76..80dc08ccf 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -64,7 +64,6 @@ #include "selection-chemistry.h" #include -#include #include #include @@ -1305,7 +1304,7 @@ static Glib::RefPtr create_popup_menu(Gtk::Widget& parent, sigc::slot mi->show(); menu->append(*mi); - mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE)); + mi = Gtk::manage(new Gtk::MenuItem(_("_Remove"), true)); menu->append(*mi); mi->signal_activate().connect(rem); mi->show(); @@ -1319,7 +1318,7 @@ FilterEffectsDialog::FilterModifier::FilterModifier(FilterEffectsDialog& d) : _desktop(NULL), _deskTrack(), _dialog(d), - _add(Gtk::Stock::NEW), + _add(_("_New"), true), _observer(new Inkscape::XML::SignalObserver) { Gtk::ScrolledWindow* sw = Gtk::manage(new Gtk::ScrolledWindow); diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 8d6ca4143..9c8b14953 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -32,8 +32,6 @@ #include "message-context.h" #include "verbs.h" -#include - namespace Inkscape { namespace UI { namespace Dialogs { @@ -158,9 +156,9 @@ void GuidelinePropertiesDialog::_response(gint response) void GuidelinePropertiesDialog::_setup() { set_title(_("Guideline")); - add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); - add_button(Gtk::Stock::DELETE, -12); - add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + add_button(_("_OK"), Gtk::RESPONSE_OK); + add_button(_("_Delete"), -12); + add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL); auto mainVBox = get_content_area(); _layout_table.set_row_spacing(4); diff --git a/src/ui/dialog/knot-properties.cpp b/src/ui/dialog/knot-properties.cpp index 133ed6f4c..954fe2a66 100644 --- a/src/ui/dialog/knot-properties.cpp +++ b/src/ui/dialog/knot-properties.cpp @@ -14,11 +14,14 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include "config.h" #endif + #include "ui/dialog/knot-properties.h" + #include #include +#include #include "inkscape.h" #include "util/units.h" #include "desktop.h" @@ -35,7 +38,10 @@ namespace UI { namespace Dialogs { KnotPropertiesDialog::KnotPropertiesDialog() -: _desktop(NULL), _knotpoint(NULL), _position_visible(false) + : _desktop(NULL), + _knotpoint(NULL), + _position_visible(false), + _close_button(_("_Close"), true) { Gtk::Box *mainVBox = get_vbox(); @@ -68,8 +74,6 @@ KnotPropertiesDialog::KnotPropertiesDialog() mainVBox->pack_start(_layout_table, true, true, 4); // Buttons - _close_button.set_use_stock(true); - _close_button.set_label(Gtk::Stock::CANCEL.id); _close_button.set_can_default(); _apply_button.set_use_underline(true); diff --git a/src/ui/dialog/knot-properties.h b/src/ui/dialog/knot-properties.h index fd87df03d..f6157168f 100644 --- a/src/ui/dialog/knot-properties.h +++ b/src/ui/dialog/knot-properties.h @@ -12,11 +12,10 @@ #ifndef INKSCAPE_DIALOG_KNOT_PROPERTIES_H #define INKSCAPE_DIALOG_KNOT_PROPERTIES_H -#ifdef HAVE_CONFIG_H -# include -#endif - -#include +#include +#include +#include +#include #include <2geom/point.h> #include "knot.h" #include "ui/tools/measure-tool.h" @@ -40,7 +39,7 @@ class KnotPropertiesDialog : public Gtk::Dialog { protected: SPDesktop *_desktop; - SPKnot *_knotpoint; + SPKnot *_knotpoint; Gtk::Label _knot_x_label; Gtk::SpinButton _knot_x_entry; diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index f28f8336a..c8c42ef90 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -14,7 +14,6 @@ */ #include "layer-properties.h" -#include #include #include @@ -36,7 +35,11 @@ namespace UI { namespace Dialogs { LayerPropertiesDialog::LayerPropertiesDialog() -: _strategy(NULL), _desktop(NULL), _layer(NULL), _position_visible(false) + : _strategy(NULL), + _desktop(NULL), + _layer(NULL), + _position_visible(false), + _close_button(_("_Cancel"), true) { auto mainVBox = get_content_area(); _layout_table.set_row_spacing(4); @@ -59,8 +62,6 @@ LayerPropertiesDialog::LayerPropertiesDialog() mainVBox->pack_start(_layout_table, true, true, 4); // Buttons - _close_button.set_use_stock(true); - _close_button.set_label(Gtk::Stock::CANCEL.id); _close_button.set_can_default(); _apply_button.set_use_underline(true); diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp index 917e48ac6..cada915c9 100644 --- a/src/ui/dialog/livepatheffect-add.cpp +++ b/src/ui/dialog/livepatheffect-add.cpp @@ -14,7 +14,6 @@ #include "livepatheffect-add.h" #include -#include #include "desktop.h" @@ -23,8 +22,8 @@ namespace UI { namespace Dialog { LivePathEffectAdd::LivePathEffectAdd() : - add_button(Gtk::Stock::ADD), - close_button(Gtk::Stock::CANCEL), + add_button(_("_Add"), true), + close_button(_("_Cancel"), true), converter(Inkscape::LivePathEffect::LPETypeConverter), applied(false) { @@ -68,7 +67,6 @@ LivePathEffectAdd::LivePathEffectAdd() : /** * Buttons */ - close_button.set_use_stock(true); //close_button.set_can_default(); add_button.set_use_underline(true); add_button.set_can_default(); diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index d33ee758d..d6ecae5a9 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -27,7 +27,10 @@ namespace UI { namespace Dialogs { FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() - : _desktop(NULL), _knotpoint(NULL), _position_visible(false) + : _desktop(NULL), + _knotpoint(NULL), + _position_visible(false), + _close_button(_("_Cancel"), true) { Gtk::Box *mainVBox = get_vbox(); mainVBox->set_homogeneous(false); @@ -76,8 +79,6 @@ FilletChamferPropertiesDialog::FilletChamferPropertiesDialog() mainVBox->pack_start(_fillet_chamfer_type_inverse_chamfer, true, true, 4); // Buttons - _close_button.set_use_stock(true); - _close_button.set_label(Gtk::Stock::CANCEL.id); _close_button.set_can_default(); _apply_button.set_use_underline(true); @@ -264,6 +265,4 @@ void FilletChamferPropertiesDialog::_set_desktop(SPDesktop *desktop) fill-column:99 End: */ -// vim: -// filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 -// : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 diff --git a/src/ui/dialog/lpe-powerstroke-properties.cpp b/src/ui/dialog/lpe-powerstroke-properties.cpp index d5b3bb30d..ca10721db 100644 --- a/src/ui/dialog/lpe-powerstroke-properties.cpp +++ b/src/ui/dialog/lpe-powerstroke-properties.cpp @@ -33,7 +33,10 @@ namespace UI { namespace Dialogs { PowerstrokePropertiesDialog::PowerstrokePropertiesDialog() -: _desktop(NULL), _knotpoint(NULL), _position_visible(false) + : _desktop(NULL), + _knotpoint(NULL), + _position_visible(false), + _close_button(_("_Cancel"), true) { Gtk::Box *mainVBox = get_vbox(); @@ -66,8 +69,6 @@ PowerstrokePropertiesDialog::PowerstrokePropertiesDialog() mainVBox->pack_start(_layout_table, true, true, 4); // Buttons - _close_button.set_use_stock(true); - _close_button.set_label(Gtk::Stock::CANCEL.id); _close_button.set_can_default(); _apply_button.set_use_underline(true); diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index 878b68d55..72a2814ed 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include @@ -463,7 +462,8 @@ bool PreviewWidget::_on_draw(const Cairo::RefPtr& cr) StatusWidget::StatusWidget() : Gtk::HBox(false, 6) { - image = new Gtk::Image(Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_MENU); + image = new Gtk::Image(); + image->set_from_icon_name("dialog-error", Gtk::ICON_SIZE_MENU); spinner = new Gtk::Spinner(); label = new Gtk::Label(); @@ -488,7 +488,7 @@ void StatusWidget::set_info(Glib::ustring text) spinner->hide(); image->show(); label->show(); - image->set(Gtk::Stock::DIALOG_INFO, Gtk::ICON_SIZE_MENU); + image->set_from_icon_name("dialog-information", Gtk::ICON_SIZE_MENU); label->set_text(text); } @@ -497,7 +497,7 @@ void StatusWidget::set_error(Glib::ustring text) spinner->hide(); image->show(); label->show(); - image->set(Gtk::Stock::DIALOG_ERROR, Gtk::ICON_SIZE_MENU); + image->set_from_icon_name("dialog-error", Gtk::ICON_SIZE_MENU); label->set_text(text); } @@ -1086,7 +1086,7 @@ ImportDialog::ImportDialog(Gtk::Window& parent_window, FileDialogType file_types Gtk::ScrolledWindow* scrolledwindow_preview = new Gtk::ScrolledWindow(); preview_files = new PreviewWidget(); /// Add the buttons in the bottom of the dialog - button_cancel = new Gtk::Button(Gtk::Stock::CANCEL); + button_cancel = new Gtk::Button(_("_Cancel"), true); button_close = new Gtk::Button(_("Close")); button_import = new Gtk::Button(_("Import")); list_results = new SearchResultList(RESULTS_COLUMN_LENGTH); diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index e55a32bd5..791677807 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -20,7 +20,6 @@ #include "document-undo.h" #include #include -#include #include #include #include "selection.h" @@ -299,7 +298,7 @@ void SvgFontsDialog::fonts_list_button_release(GdkEventButton* event) void SvgFontsDialog::create_glyphs_popup_menu(Gtk::Widget& parent, sigc::slot rem) { - Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE)); + auto mi = Gtk::manage(new Gtk::MenuItem(_("_Remove"), true)); _GlyphsContextMenu.append(*mi); mi->signal_activate().connect(rem); mi->show(); @@ -308,7 +307,7 @@ void SvgFontsDialog::create_glyphs_popup_menu(Gtk::Widget& parent, sigc::slot rem) { - Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE)); + auto mi = Gtk::manage(new Gtk::MenuItem(_("_Remove"), true)); _KerningPairsContextMenu.append(*mi); mi->signal_activate().connect(rem); mi->show(); @@ -317,7 +316,7 @@ void SvgFontsDialog::create_kerning_pairs_popup_menu(Gtk::Widget& parent, sigc:: void SvgFontsDialog::create_fonts_popup_menu(Gtk::Widget& parent, sigc::slot rem) { - Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE)); + auto mi = Gtk::manage(new Gtk::MenuItem(_("_Remove"), true)); _FontsContextMenu.append(*mi); mi->signal_activate().connect(rem); mi->show(); @@ -986,7 +985,8 @@ void SvgFontsDialog::add_font(){ } SvgFontsDialog::SvgFontsDialog() - : UI::Widget::Panel("", "/dialogs/svgfonts", SP_VERB_DIALOG_SVG_FONTS), _add(Gtk::Stock::NEW) + : UI::Widget::Panel("", "/dialogs/svgfonts", SP_VERB_DIALOG_SVG_FONTS), + _add(_("_New"), true) { kerning_slider = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL)); _add.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::add_font)); diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index a38085c85..94f307828 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -29,7 +29,6 @@ extern "C" { } #endif -#include #include #include "helper/window.h" @@ -64,8 +63,8 @@ TextEdit::TextEdit() text_label(_("_Text"), true), vari_label(_("_Variants"), true), setasdefault_button(_("Set as _default")), - close_button(Gtk::Stock::CLOSE), - apply_button(Gtk::Stock::APPLY), + close_button(_("_Close"), true), + apply_button(_("_Apply"), true), desktop(NULL), deskTrack(), selectChangedConn(), diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index 53aa7e6ff..bf5bdc76d 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -24,7 +24,7 @@ #include "util/signal-blocker.h" #include "desktop.h" -#include +#include namespace Inkscape { namespace UI { @@ -43,8 +43,8 @@ void CellRendererSPIcon::render_vfunc(const Cairo::RefPtr& cr, // if the icon isn't cached, render it to a pixbuf if ( !_icon_cache[_property_event_type] ) { - Glib::ustring image = Inkscape::Verb::get(_property_event_type)->get_image(); - Gtk::Widget* icon = sp_icon_get_icon(image, Inkscape::ICON_SIZE_MENU); + Glib::ustring image_name = Inkscape::Verb::get(_property_event_type)->get_image(); + Gtk::Widget* icon = sp_icon_get_icon(image_name, Inkscape::ICON_SIZE_MENU); if (icon) { @@ -54,8 +54,8 @@ void CellRendererSPIcon::render_vfunc(const Cairo::RefPtr& cr, sp_icon_fetch_pixbuf(sp_icon); _property_icon = Glib::wrap(sp_icon->pb, true); } else if ( GTK_IS_IMAGE(icon->gobj()) ) { - _property_icon = Gtk::Invisible().render_icon_pixbuf(Gtk::StockID(image), - Gtk::ICON_SIZE_MENU); + auto icon_theme = Gtk::IconTheme::get_default(); + _property_icon = icon_theme->load_icon(image_name, 16); } else { delete icon; return; diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 2860df12e..d124854ae 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -15,7 +15,6 @@ #include "widgets/icon.h" #include -#include #include namespace Inkscape { @@ -47,18 +46,11 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l if (!iconTheme->has_icon(icon_name)) { Inkscape::queueIconPrerender( INKSCAPE_ICON(icon_name.data()), Inkscape::ICON_SIZE_MENU ); } - // Icon might be in the icon theme, or might be a stock item. Check the proper source: if ( iconTheme->has_icon(icon_name) ) { int width = 0; int height = 0; Gtk::IconSize::lookup(Gtk::ICON_SIZE_MENU, width, height); _icon_pixbuf = iconTheme->load_icon(icon_name, width); - } else { - Gtk::StockItem item; - Gtk::StockID stockId(icon_name); - if ( Gtk::StockItem::lookup(stockId, item) ) { - _icon_pixbuf = _dock.getWidget().render_icon_pixbuf( stockId, Gtk::ICON_SIZE_MENU ); - } } } diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 1205cd012..b2cebcaa6 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include "preferences.h" @@ -708,8 +707,9 @@ void PrefEntryFileButtonHBox::init(Glib::ustring const &prefs_path, relatedButton = new Gtk::Button(); Gtk::HBox* pixlabel = new Gtk::HBox(false, 3); - Gtk::Image *im = new Gtk::Image(Gtk::StockID(Gtk::Stock::INDEX), - Gtk::ICON_SIZE_BUTTON); + Gtk::Image *im = new Gtk::Image(); + im->set_from_icon_name("applications-graphics", + Gtk::ICON_SIZE_BUTTON); pixlabel->pack_start(*im); Gtk::Label *l = new Gtk::Label(); l->set_markup_with_mnemonic(_("_Browse...")); -- cgit v1.2.3 From 2e8438d76a5f26719d381843cd3ce3fa694809fb Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 27 Dec 2016 15:49:22 +0000 Subject: Rm remaining Gtk::Stock usage (bzr r15368) --- src/ui/dialog/aboutbox.cpp | 3 - src/ui/dialog/calligraphic-profile-rename.cpp | 1 - src/ui/dialog/dialog.cpp | 1 - src/ui/dialog/dock-behavior.cpp | 3 - src/ui/dialog/floating-behavior.cpp | 1 - src/ui/dialog/grid-arrange-tab.cpp | 321 +++++++++++++------------- src/ui/dialog/icon-preview.cpp | 1 - src/ui/dialog/livepatheffect-editor.cpp | 1 - src/ui/dialog/objects.cpp | 1 - src/ui/dialog/pixelartdialog.cpp | 1 - src/ui/dialog/tracedialog.cpp | 1 - src/ui/dialog/transformation.cpp | 1 - src/ui/dialog/xml-tree.cpp | 1 - src/ui/interface.cpp | 6 +- 14 files changed, 162 insertions(+), 181 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index b7a48e859..8f0545e96 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include "path-prefix.h" #include "document.h" @@ -39,8 +38,6 @@ #include "inkscape-version.h" - - namespace Inkscape { namespace UI { namespace Dialog { diff --git a/src/ui/dialog/calligraphic-profile-rename.cpp b/src/ui/dialog/calligraphic-profile-rename.cpp index 0835043ab..36570e769 100644 --- a/src/ui/dialog/calligraphic-profile-rename.cpp +++ b/src/ui/dialog/calligraphic-profile-rename.cpp @@ -15,7 +15,6 @@ #include "calligraphic-profile-rename.h" #include -#include #include #include "desktop.h" diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index d0b618c65..27a6e55d9 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -19,7 +19,6 @@ #include "dialog-manager.h" #include -#include #include #include "inkscape.h" diff --git a/src/ui/dialog/dock-behavior.cpp b/src/ui/dialog/dock-behavior.cpp index ec630c08f..02955b9a8 100644 --- a/src/ui/dialog/dock-behavior.cpp +++ b/src/ui/dialog/dock-behavior.cpp @@ -25,9 +25,6 @@ #include "dialog.h" #include "ui/dialog-events.h" -#include -#include - namespace Inkscape { namespace UI { namespace Dialog { diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp index fa8e11dfd..9abad3e7b 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -15,7 +15,6 @@ #endif #include -#include #include #include "floating-behavior.h" diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 5872393ae..9ec8d3148 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -1,25 +1,24 @@ -/* - * A simple dialog for creating grid type arrangements of selected objects - * - * Authors: - * Bob Jamison ( based off trace dialog) - * John Cliff - * Other dudes from The Inkscape Organization - * Abhishek Sharma - * Declara Denis - * - * Copyright (C) 2004 Bob Jamison - * Copyright (C) 2004 John Cliff - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ -//#define DEBUG_GRID_ARRANGE 1 + /* + * A simple dialog for creating grid type arrangements of selected objects + * + * Authors: + * Bob Jamison ( based off trace dialog) + * John Cliff + * Other dudes from The Inkscape Organization + * Abhishek Sharma + * Declara Denis + * + * Copyright (C) 2004 Bob Jamison + * Copyright (C) 2004 John Cliff + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + //#define DEBUG_GRID_ARRANGE 1 #include "ui/dialog/grid-arrange-tab.h" #include #include -#include #include <2geom/transforms.h> @@ -31,193 +30,193 @@ #include "document-undo.h" #include "widgets/icon.h" #include "desktop.h" -//#include "sp-item-transform.h" FIXME + //#include "sp-item-transform.h" FIXME #include "ui/dialog/tile.h" // for Inkscape::UI::Dialog::ArrangeDialog -/* - * Sort items by their x co-ordinates, taking account of y (keeps rows intact) - * - * <0 *elem1 goes before *elem2 - * 0 *elem1 == *elem2 - * >0 *elem1 goes after *elem2 - */ -static bool sp_compare_x_position(SPItem *first, SPItem *second) -{ - using Geom::X; - using Geom::Y; + /* + * Sort items by their x co-ordinates, taking account of y (keeps rows intact) + * + * <0 *elem1 goes before *elem2 + * 0 *elem1 == *elem2 + * >0 *elem1 goes after *elem2 + */ + static bool sp_compare_x_position(SPItem *first, SPItem *second) + { + using Geom::X; + using Geom::Y; - Geom::OptRect a = first->documentVisualBounds(); - Geom::OptRect b = second->documentVisualBounds(); + Geom::OptRect a = first->documentVisualBounds(); + Geom::OptRect b = second->documentVisualBounds(); - if ( !a || !b ) { - // FIXME? - return false; - } + if ( !a || !b ) { + // FIXME? + return false; + } - double const a_height = a->dimensions()[Y]; - double const b_height = b->dimensions()[Y]; + double const a_height = a->dimensions()[Y]; + double const b_height = b->dimensions()[Y]; - bool a_in_b_vert = false; - if ((a->min()[Y] < b->min()[Y] + 0.1) && (a->min()[Y] > b->min()[Y] - b_height)) { - a_in_b_vert = true; - } else if ((b->min()[Y] < a->min()[Y] + 0.1) && (b->min()[Y] > a->min()[Y] - a_height)) { - a_in_b_vert = true; - } else if (b->min()[Y] == a->min()[Y]) { - a_in_b_vert = true; - } else { - a_in_b_vert = false; - } + bool a_in_b_vert = false; + if ((a->min()[Y] < b->min()[Y] + 0.1) && (a->min()[Y] > b->min()[Y] - b_height)) { + a_in_b_vert = true; + } else if ((b->min()[Y] < a->min()[Y] + 0.1) && (b->min()[Y] > a->min()[Y] - a_height)) { + a_in_b_vert = true; + } else if (b->min()[Y] == a->min()[Y]) { + a_in_b_vert = true; + } else { + a_in_b_vert = false; + } - if (!a_in_b_vert) { // a and b are not in the same row - return (a->min()[Y] < b->min()[Y]); + if (!a_in_b_vert) { // a and b are not in the same row + return (a->min()[Y] < b->min()[Y]); + } + return (a->min()[X] < b->min()[X]); } - return (a->min()[X] < b->min()[X]); -} -/* - * Sort items by their y co-ordinates. - */ -static bool sp_compare_y_position(SPItem *first, SPItem *second) -{ - Geom::OptRect a = first->documentVisualBounds(); - Geom::OptRect b = second->documentVisualBounds(); + /* + * Sort items by their y co-ordinates. + */ + static bool sp_compare_y_position(SPItem *first, SPItem *second) + { + Geom::OptRect a = first->documentVisualBounds(); + Geom::OptRect b = second->documentVisualBounds(); - if ( !a || !b ) { - // FIXME? - return false; - } + if ( !a || !b ) { + // FIXME? + return false; + } + + if (a->min()[Geom::Y] > b->min()[Geom::Y]) { + return false; + } + if (a->min()[Geom::Y] < b->min()[Geom::Y]) { + return true; + } - if (a->min()[Geom::Y] > b->min()[Geom::Y]) { return false; } - if (a->min()[Geom::Y] < b->min()[Geom::Y]) { - return true; - } - - return false; -} -namespace Inkscape { -namespace UI { -namespace Dialog { + namespace Inkscape { + namespace UI { + namespace Dialog { -//######################################################################### -//## E V E N T S -//######################################################################### - -/* - * - * This arranges the selection in a grid pattern. - * - */ + //######################################################################### + //## E V E N T S + //######################################################################### -void GridArrangeTab::arrange() -{ + /* + * + * This arranges the selection in a grid pattern. + * + */ - int cnt,row_cnt,col_cnt,a,row,col; - double grid_left,grid_top,col_width,row_height,paddingx,paddingy,width, height, new_x, new_y; - double total_col_width,total_row_height; - col_width = 0; - row_height = 0; - total_col_width=0; - total_row_height=0; + void GridArrangeTab::arrange() + { - // check for correct numbers in the row- and col-spinners - on_col_spinbutton_changed(); - on_row_spinbutton_changed(); + int cnt,row_cnt,col_cnt,a,row,col; + double grid_left,grid_top,col_width,row_height,paddingx,paddingy,width, height, new_x, new_y; + double total_col_width,total_row_height; + col_width = 0; + row_height = 0; + total_col_width=0; + total_row_height=0; - // set padding to manual values - paddingx = XPadding.getValue("px"); - paddingy = YPadding.getValue("px"); + // check for correct numbers in the row- and col-spinners + on_col_spinbutton_changed(); + on_row_spinbutton_changed(); - std::vector row_heights; - std::vector col_widths; - std::vector row_ys; - std::vector col_xs; + // set padding to manual values + paddingx = XPadding.getValue("px"); + paddingy = YPadding.getValue("px"); - int NoOfCols = NoOfColsSpinner.get_value_as_int(); - int NoOfRows = NoOfRowsSpinner.get_value_as_int(); + std::vector row_heights; + std::vector col_widths; + std::vector row_ys; + std::vector col_xs; - width = 0; - for (a=0;agetDesktop(); - desktop->getDocument()->ensureUpToDate(); + height = 0; + for (a=0;agetSelection(); - std::vector items; - if (selection) { - items.insert(items.end(), selection->items().begin(), selection->items().end()); - } + SPDesktop *desktop = Parent->getDesktop(); + desktop->getDocument()->ensureUpToDate(); - for(std::vector::const_iterator i = items.begin();i!=items.end(); ++i){ - SPItem *item = *i; - Geom::OptRect b = item->documentVisualBounds(); - if (!b) { - continue; + Inkscape::Selection *selection = desktop->getSelection(); + std::vector items; + if (selection) { + items.insert(items.end(), selection->items().begin(), selection->items().end()); } - width = b->dimensions()[Geom::X]; - height = b->dimensions()[Geom::Y]; + for(std::vector::const_iterator i = items.begin();i!=items.end(); ++i){ + SPItem *item = *i; + Geom::OptRect b = item->documentVisualBounds(); + if (!b) { + continue; + } + + width = b->dimensions()[Geom::X]; + height = b->dimensions()[Geom::Y]; - if (b->min()[Geom::X] < grid_left) { - grid_left = b->min()[Geom::X]; - } - if (b->min()[Geom::Y] < grid_top) { - grid_top = b->min()[Geom::Y]; - } - if (width > col_width) { - col_width = width; - } - if (height > row_height) { - row_height = height; + if (b->min()[Geom::X] < grid_left) { + grid_left = b->min()[Geom::X]; + } + if (b->min()[Geom::Y] < grid_top) { + grid_top = b->min()[Geom::Y]; + } + if (width > col_width) { + col_width = width; + } + if (height > row_height) { + row_height = height; + } } - } - // require the sorting done before we can calculate row heights etc. + // require the sorting done before we can calculate row heights etc. - g_return_if_fail(selection); - std::vector sorted(selection->items().begin(), selection->items().end()); - sort(sorted.begin(),sorted.end(),sp_compare_y_position); - sort(sorted.begin(),sorted.end(),sp_compare_x_position); + g_return_if_fail(selection); + std::vector sorted(selection->items().begin(), selection->items().end()); + sort(sorted.begin(),sorted.end(),sp_compare_y_position); + sort(sorted.begin(),sorted.end(),sp_compare_x_position); - // Calculate individual Row and Column sizes if necessary + // Calculate individual Row and Column sizes if necessary - cnt=0; - const std::vector sizes(sorted); - for (std::vector::const_iterator i = sizes.begin();i!=sizes.end(); ++i) { - SPItem *item = *i; - Geom::OptRect b = item->documentVisualBounds(); - if (b) { - width = b->dimensions()[Geom::X]; - height = b->dimensions()[Geom::Y]; - if (width > col_widths[(cnt % NoOfCols)]) { - col_widths[(cnt % NoOfCols)] = width; + cnt=0; + const std::vector sizes(sorted); + for (std::vector::const_iterator i = sizes.begin();i!=sizes.end(); ++i) { + SPItem *item = *i; + Geom::OptRect b = item->documentVisualBounds(); + if (b) { + width = b->dimensions()[Geom::X]; + height = b->dimensions()[Geom::Y]; + if (width > col_widths[(cnt % NoOfCols)]) { + col_widths[(cnt % NoOfCols)] = width; + } + if (height > row_heights[(cnt / NoOfCols)]) { + row_heights[(cnt / NoOfCols)] = height; + } } - if (height > row_heights[(cnt / NoOfCols)]) { - row_heights[(cnt / NoOfCols)] = height; - } - } - cnt++; - } + cnt++; + } - /// Make sure the top and left of the grid dont move by compensating for align values. + /// Make sure the top and left of the grid dont move by compensating for align values. if (RowHeightButton.get_active()){ grid_top = grid_top - (((row_height - row_heights[0]) / 2)*(VertAlign)); } diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index a4fcc9947..19050fb1d 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include "ui/widget/frame.h" #include "desktop.h" diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 8910005aa..e5becdb5c 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -17,7 +17,6 @@ #endif #include "livepatheffect-editor.h" -#include #include "desktop.h" diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 446af4ccb..c7c696cdc 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -15,7 +15,6 @@ #include "objects.h" #include -#include #include #include #include diff --git a/src/ui/dialog/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp index 79747a798..3e6617cfe 100644 --- a/src/ui/dialog/pixelartdialog.cpp +++ b/src/ui/dialog/pixelartdialog.cpp @@ -28,7 +28,6 @@ #include "pixelartdialog.h" #include -#include #include #include diff --git a/src/ui/dialog/tracedialog.cpp b/src/ui/dialog/tracedialog.cpp index 6f31935a4..a1d4d88b8 100644 --- a/src/ui/dialog/tracedialog.cpp +++ b/src/ui/dialog/tracedialog.cpp @@ -21,7 +21,6 @@ #include #include "ui/widget/spinbutton.h" #include "ui/widget/frame.h" -#include #include diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 475c3a9c6..d209a450c 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -16,7 +16,6 @@ #endif #include -#include #include <2geom/transforms.h> #include "document.h" diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index d05c52531..fa35b092a 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -19,7 +19,6 @@ #include "xml-tree.h" #include "widgets/icon.h" #include -#include #include "desktop.h" diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index e0c767509..d50c56b76 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -73,8 +73,6 @@ #include "message-stack.h" #include "ui/dialog/layer-properties.h" -#include "widgets/image-menu-item.h" - using Inkscape::DocumentUndo; /* Drag and Drop */ @@ -405,7 +403,7 @@ sp_ui_menuitem_add_icon( GtkWidget *item, gchar *icon_name ) icon = sp_icon_new( Inkscape::ICON_SIZE_MENU, icon_name ); gtk_widget_show(icon); - image_menu_item_set_image((ImageMenuItem *) item, icon); + gtk_image_menu_item_set_image((GtkImageMenuItem *) item, icon); } // end of sp_ui_menu_add_icon void @@ -459,7 +457,7 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb if (radio) { item = gtk_radio_menu_item_new_with_mnemonic(group, action->name); } else { - item = image_menu_item_new_with_mnemonic(action->name); + item = gtk_image_menu_item_new_with_mnemonic(action->name); } gtk_label_set_markup_with_mnemonic( GTK_LABEL(gtk_bin_get_child(GTK_BIN (item))), action->name); -- cgit v1.2.3 From bfcc1fb5a5142a71469834cac2d507f15626a8b5 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Wed, 4 Jan 2017 03:32:40 +0200 Subject: Extract some common code into a routine. (bzr r15369.1.8) --- src/ui/clipboard.cpp | 11 ++--------- src/ui/interface.cpp | 11 ++--------- 2 files changed, 4 insertions(+), 18 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index a8e708597..73b632a2c 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -76,6 +76,7 @@ #include "sp-namedview.h" #include "persp3d.h" #include "object-set.h" +#include "extension/find_extension_by_mime.h" /// Made up mimetype to represent Gdk::Pixbuf clipboard contents. #define CLIPBOARD_GDK_PIXBUF_TARGET "image/x-gdk-pixbuf" @@ -945,15 +946,7 @@ bool ClipboardManagerImpl::_pasteImage(SPDocument *doc) return false; } - // TODO unify with interface.cpp's sp_ui_drag_data_received() - // AARGH stupid - Inkscape::Extension::DB::InputList o; - Inkscape::Extension::db.get_input_list(o); - Inkscape::Extension::DB::InputList::const_iterator i = o.begin(); - while (i != o.end() && strcmp( (*i)->get_mimetype(), "image/png" ) != 0) { - ++i; - } - Inkscape::Extension::Extension *png = *i; + Inkscape::Extension::Extension *png = Inkscape::Extension::find_by_mime("image/png"); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Glib::ustring attr_saved = prefs->getString("/dialogs/import/link"); bool ask_saved = prefs->getBool("/dialogs/import/ask"); diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index d50c56b76..5e85065d1 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -72,6 +72,7 @@ #include "sp-mask.h" #include "message-stack.h" #include "ui/dialog/layer-properties.h" +#include "extension/find_extension_by_mime.h" using Inkscape::DocumentUndo; @@ -1234,15 +1235,7 @@ sp_ui_drag_data_received(GtkWidget *widget, case PNG_DATA: case JPEG_DATA: case IMAGE_DATA: { - const char *mime = (info == JPEG_DATA ? "image/jpeg" : "image/png"); - - Inkscape::Extension::DB::InputList o; - Inkscape::Extension::db.get_input_list(o); - Inkscape::Extension::DB::InputList::const_iterator i = o.begin(); - while (i != o.end() && strcmp( (*i)->get_mimetype(), mime ) != 0) { - ++i; - } - Inkscape::Extension::Extension *ext = *i; + Inkscape::Extension::Extension *ext = Inkscape::Extension::find_by_mime((info == JPEG_DATA ? "image/jpeg" : "image/png")); bool save = (strcmp(ext->get_param_optiongroup("link"), "embed") == 0); ext->set_param_optiongroup("link", "embed"); ext->set_gui(false); -- cgit v1.2.3 From 16f60109208481bdf7c28e7ea4c93c661bc49d9d Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Wed, 4 Jan 2017 21:01:13 +0200 Subject: Correct/rephrase a comment. Remove trailing space. (bzr r15369.1.11) --- src/ui/tools/freehand-base.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/freehand-base.h b/src/ui/tools/freehand-base.h index a3e7b42f9..3ee4cd7d0 100644 --- a/src/ui/tools/freehand-base.h +++ b/src/ui/tools/freehand-base.h @@ -76,8 +76,10 @@ public: GSList *white_curves; GSList *white_anchors; - //ALternative curve to use on continuing exisiting curve in case of bspline or spirolive - //because usigh anchor curves give memory and random bugs, - and obscure code- in some plataform reported by su_v in mac + // Alternative curve to use on continuing the exisiting curve in case of + // bspline or spirolive, because using anchor curves gives random memory + // bugs as reported by su_v when running this code on macOS (as well as + // making the code hard to understand). SPCurve *overwrite_curve; // Start anchor -- cgit v1.2.3 From b6200950a88ac9b1bb7eee4fb7f86b01e323dbcc Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 5 Jan 2017 00:08:02 +0100 Subject: antialiasing options on export (bzr r15391) --- src/ui/dialog/export.cpp | 15 ++++++++++++--- src/ui/dialog/export.h | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 9bebde00f..1bb952de4 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -151,8 +151,10 @@ Export::Export (void) : zlib_compression(), pHYs_label(_("pHYs dpi")), pHYs_sb(pHYs_adj, 1.0, 2), + antialiasing_label(_("Antialiasing")), + antialiasing_cb(), hide_box(false, 5), - hide_export(_("Hide a_ll except selected"), _("In the exported image, hide all objects except those that are selected")), + hide_export(_("Hide all except selected"), _("In the exported image, hide all objects except those that are selected")), closeWhenDone(_("Close when complete"), _("Once the export completes, close this dialog")), button_box(false, 3), _prog(), @@ -340,6 +342,10 @@ Export::Export (void) : pHYs_sb.set_width_chars(7); pHYs_sb.set_tooltip_text( _("Will force-set the physical dpi for the png file. Set this to 72 if you're planning to work on your png with Photoshop") ); zlib_compression.set_hexpand(); + const char* const antialising_list[] = {"CAIRO_ANTIALIAS_NONE","CAIRO_ANTIALIAS_FAST","CAIRO_ANTIALIAS_GOOD (default)","CAIRO_ANTIALIAS_BEST"}; + for(int i=0; i<4; ++i) + antialiasing_cb.append(antialising_list[i]); + antialiasing_cb.set_active_text(antialising_list[2]); auto table = new Gtk::Grid(); gtk_container_add(GTK_CONTAINER(expander.gobj()), (GtkWidget*)(table->gobj())); table->attach(interlacing,0,0,1,1); @@ -349,6 +355,8 @@ Export::Export (void) : table->attach(zlib_compression,1,2,1,1); table->attach(pHYs_label,0,3,1,1); table->attach(pHYs_sb,1,3,1,1); + table->attach(antialiasing_label,0,4,1,1); + table->attach(antialiasing_cb,1,4,1,1); table->show(); /* Main dialog */ @@ -984,6 +992,7 @@ void Export::onExport () int bitdepths[] = {1,2,4,8,16,8,16,8,16,8,16}; int color_type = colortypes[bitdepth_cb.get_active_row_number()] ; int bit_depth = bitdepths[bitdepth_cb.get_active_row_number()] ; + int antialiasing = antialiasing_cb.get_active_row_number(); if (batch_export.get_active ()) { @@ -1052,7 +1061,7 @@ void Export::onExport () onProgressCallback, (void*)prog_dlg, TRUE, // overwrite without asking hide ? selected : x, - do_interlace, color_type, bit_depth, zlib + do_interlace, color_type, bit_depth, zlib, antialiasing )) { gchar * error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile); @@ -1145,7 +1154,7 @@ void Export::onExport () onProgressCallback, (void*)prog_dlg, FALSE, hide ? selected : x, - do_interlace, color_type, bit_depth, zlib + do_interlace, color_type, bit_depth, zlib, antialiasing ); if (status == EXPORT_ERROR) { gchar * safeFile = Inkscape::IO::sanitizeString(path.c_str()); diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h index f64d92341..1f8e87dbc 100644 --- a/src/ui/dialog/export.h +++ b/src/ui/dialog/export.h @@ -327,6 +327,8 @@ private: Gtk::Label pHYs_label; Glib::RefPtr pHYs_adj; Gtk::SpinButton pHYs_sb; + Gtk::Label antialiasing_label; + Gtk::ComboBoxText antialiasing_cb; /* Export Button widgets */ Gtk::HBox button_box; -- cgit v1.2.3 From d994d8f220eec4293101dbe0b8299119efa6e4e0 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sun, 8 Jan 2017 12:46:00 +0100 Subject: Fix a bad inicialization of unsigned int (bzr r15402) --- src/ui/widget/registered-widget.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index d410dbfe6..f66d5cbf2 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -135,7 +135,7 @@ private: repr = NULL; doc = NULL; write_undo = false; - event_type = -1; + event_type = 0; //SP_VERB_INVALID } }; -- cgit v1.2.3 From a990b228dac4df40190334093d695e486ba1eee4 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Wed, 11 Jan 2017 14:51:54 +0000 Subject: fix comment typos (bzr r15408) --- src/ui/dialog/align-and-distribute.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 236832beb..1c88fc849 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -614,7 +614,7 @@ private : } }; -// instantiae the private static member +// instantiate the private static member boost::optional ActionExchangePositions::center; class ActionUnclump : public Action { @@ -928,7 +928,7 @@ AlignAndDistribute::AlignAndDistribute() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - //Instanciate the align buttons + //Instantiate the align buttons addAlignButton(INKSCAPE_ICON("align-horizontal-right-to-anchor"), _("Align right edges of objects to the left edge of the anchor"), 0, 0); -- cgit v1.2.3 From 00bf8be09a333bb7434eeba9e885e6089b6eb5fd Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Thu, 12 Jan 2017 22:45:33 +0100 Subject: Use GStatBuf where appropriate to ensure usage of the correct type (fixes compilation with i686-w64-mingw32) (bzr r15414) --- src/ui/dialog/filedialogimpl-gtkmm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index f5450ac9a..92e9ce834 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -554,7 +554,7 @@ bool SVGPreview::set(Glib::ustring &fileName, int dialogType) Glib::ustring fileNameUtf8 = Glib::filename_to_utf8(fileName); gchar *fName = const_cast( fileNameUtf8.c_str()); // const-cast probably not necessary? (not necessary on Windows version of stat()) - struct stat info; + GStatBuf info; if (g_stat(fName, &info)) // stat returns 0 upon success { g_warning("SVGPreview::set() : %s : %s", fName, strerror(errno)); -- cgit v1.2.3 From 8907ced418b6c40782d2d2c0f3f944edcb3c08df Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Fri, 20 Jan 2017 20:19:49 +0100 Subject: Fixes bugs in copy LPE's. #1656093:Paste path effect doesn't work on 0.92 and #1656527:Copy & paste of group with shaped path corrupts it, in v0.92 Fixed bugs: - https://launchpad.net/bugs/1656093 - https://launchpad.net/bugs/1656527 (bzr r15426) --- src/ui/clipboard.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index a8e708597..c1e824c1e 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -643,7 +643,6 @@ Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId(SPDesktop *desktop) return svgd; } - /** * Iterate over a list of items and copy them to the clipboard. */ @@ -689,25 +688,6 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection) else obj_copy = _copyNode(obj, _doc, _clipnode); - // For lpe items, copy lpe stack if applicable - SPLPEItem *lpeitem = dynamic_cast(item); - if (lpeitem) { - Inkscape::SVGOStringStream os; - if (lpeitem->hasPathEffect()) { - for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it) - { - LivePathEffectObject *lpeobj = (*it)->lpeobject; - if (lpeobj) { - Inkscape::XML::Node * lpeobjcopy = _copyNode(lpeobj->getRepr(), _doc, _defs); - gchar *new_conflict_id = sp_object_get_unique_id(lpeobj, lpeobj->getAttribute("id")); - lpeobjcopy->setAttribute("id", new_conflict_id); - g_free(new_conflict_id); - os << "#" << lpeobjcopy->attribute("id") << ";"; - } - } - } - obj_copy->setAttribute("inkscape:path-effect", os.str().c_str()); - } // copy complete inherited style SPCSSAttr *css = sp_repr_css_attr_inherited(obj, "style"); sp_repr_css_set(obj_copy, css, "style"); @@ -739,6 +719,13 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection) sp_repr_css_set(_clipnode, style, "style"); sp_repr_css_attr_unref(style); } + // copy path effect from the first path + if (object) { + gchar const *effect =object->getRepr()->attribute("inkscape:path-effect"); + if (effect) { + _clipnode->setAttribute("inkscape:path-effect", effect); + } + } } Geom::OptRect size = selection->visualBounds(); @@ -841,6 +828,19 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) } } + // For lpe items, copy lpe stack if applicable + SPLPEItem *lpeitem = dynamic_cast(item); + if (lpeitem) { + if (lpeitem->hasPathEffect()) { + for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it){ + LivePathEffectObject *lpeobj = (*it)->lpeobject; + if (lpeobj) { + _copyNode(lpeobj->getRepr(), _doc, _defs); + } + } + } + } + // recurse for(auto& o: item->children) { SPItem *childItem = dynamic_cast(&o); -- cgit v1.2.3 From e8dcb5062f6114a9fb06d496ab5d906aec405c78 Mon Sep 17 00:00:00 2001 From: "alexandru.roman" Date: Sat, 21 Jan 2017 23:28:05 +0100 Subject: Fix "swap fill and stroke" for multiple objects in selection Add verb and shortcut possibility Fixed bugs: - https://launchpad.net/bugs/367360 - https://launchpad.net/bugs/675690 (bzr r15428) --- src/ui/widget/selected-style.cpp | 57 +--------------------------------------- 1 file changed, 1 insertion(+), 56 deletions(-) (limited to 'src/ui') diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index fa7a83732..0370d55db 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -781,62 +781,7 @@ void SelectedStyle::on_stroke_paste() { } void SelectedStyle::on_fillstroke_swap() { - SPCSSAttr *css = sp_repr_css_attr_new (); - - switch (_mode[SS_FILL]) { - case SS_NA: - case SS_MANY: - break; - case SS_NONE: - sp_repr_css_set_property (css, "stroke", "none"); - break; - case SS_UNSET: - sp_repr_css_unset_property (css, "stroke"); - break; - case SS_COLOR: - gchar c[64]; - sp_svg_write_color (c, sizeof(c), _thisselected[SS_FILL]); - sp_repr_css_set_property (css, "stroke", c); - break; - case SS_LGRADIENT: - case SS_RGRADIENT: -#ifdef WITH_MESH - case SS_MGRADIENT: -#endif - case SS_PATTERN: - sp_repr_css_set_property (css, "stroke", _paintserver_id[SS_FILL].c_str()); - break; - } - - switch (_mode[SS_STROKE]) { - case SS_NA: - case SS_MANY: - break; - case SS_NONE: - sp_repr_css_set_property (css, "fill", "none"); - break; - case SS_UNSET: - sp_repr_css_unset_property (css, "fill"); - break; - case SS_COLOR: - gchar c[64]; - sp_svg_write_color (c, sizeof(c), _thisselected[SS_STROKE]); - sp_repr_css_set_property (css, "fill", c); - break; - case SS_LGRADIENT: - case SS_RGRADIENT: -#ifdef WITH_MESH - case SS_MGRADIENT: -#endif - case SS_PATTERN: - sp_repr_css_set_property (css, "fill", _paintserver_id[SS_STROKE].c_str()); - break; - } - - sp_desktop_set_style (_desktop, css); - sp_repr_css_attr_unref (css); - DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE, - _("Swap fill and stroke")); + _desktop->getSelection()->swapFillStroke(); } void SelectedStyle::on_fill_edit() { -- cgit v1.2.3 From d431044fc72f9b668dcfa5771f361f4d6088bdd7 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sun, 22 Jan 2017 18:53:31 +0100 Subject: Update to new code in trunk (bzr r13645.1.166) --- src/ui/tools/node-tool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp index 94e684bc4..8561e234f 100644 --- a/src/ui/tools/node-tool.cpp +++ b/src/ui/tools/node-tool.cpp @@ -297,9 +297,9 @@ void sp_update_helperpath() { Inkscape::UI::Node *n = dynamic_cast(*i); selectedNodesPositions.push_back(n->position()); } - lpe->setSelectedNodePoints(selectedNodesPositions); + lpe->setSelectedNodePos(selectedNodesPositions); lpe->setCurrentZoom(desktop->current_zoom()); - + SPCurve *c = new SPCurve(); SPCurve *cc = new SPCurve(); std::vector cs = lpe->getCanvasIndicators(SP_LPE_ITEM(selection->singleItem())); -- cgit v1.2.3 From 30fb0365f10bec566c7e57eea4ac5439d2cf325a Mon Sep 17 00:00:00 2001 From: "alexandru.roman" Date: Mon, 23 Jan 2017 19:53:21 +0100 Subject: fix nodes reverting back during editing Fixed bugs: - https://launchpad.net/bugs/1270989 (bzr r15435) --- src/ui/tool/transform-handle-set.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/ui') diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp index 33015fe11..083a7d0ba 100644 --- a/src/ui/tool/transform-handle-set.cpp +++ b/src/ui/tool/transform-handle-set.cpp @@ -183,6 +183,11 @@ void TransformHandle::ungrabbed(GdkEventButton *) _setState(_state); endTransform(); _th.signal_commit.emit(getCommitEvent()); + + //updates the positions of the nodes + Inkscape::UI::Tools::NodeTool *nt = INK_NODE_TOOL(_th._desktop->event_context); + ControlPointSelection* selection = nt->_selected_nodes; + selection->setOriginalPoints(); } -- cgit v1.2.3 From 51c576f161ca3d3ef7f352f67f6091022eb1aca2 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Tue, 24 Jan 2017 09:46:52 +0100 Subject: [Bug #1658397] Object > Arrange > Polar Coordinates dialog text. Fixed bugs: - https://launchpad.net/bugs/1658397 (bzr r15437) --- src/ui/dialog/polar-arrange-tab.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index c51881a96..9485b6ba3 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -43,14 +43,14 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) anchorPointLabel.set_alignment(Gtk::ALIGN_START); pack_start(anchorPointLabel, false, false); - anchorBoundingBoxRadio.set_label(C_("Polar arrange tab", "Object's bounding box:")); + anchorBoundingBoxRadio.set_label(C_("Polar arrange tab", "Objects' bounding boxes:")); anchorRadioGroup = anchorBoundingBoxRadio.get_group(); anchorBoundingBoxRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_anchor_radio_changed)); pack_start(anchorBoundingBoxRadio, false, false); pack_start(anchorSelector, false, false); - anchorObjectPivotRadio.set_label(C_("Polar arrange tab", "Object's rotational center")); + anchorObjectPivotRadio.set_label(C_("Polar arrange tab", "Objects' rotational centers")); anchorObjectPivotRadio.set_group(anchorRadioGroup); anchorObjectPivotRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_anchor_radio_changed)); pack_start(anchorObjectPivotRadio, false, false); -- cgit v1.2.3 From 632c205171ef6734d166ed39b61e10a2b1566bf3 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 25 Jan 2017 10:14:59 +0100 Subject: Comented one of the shortcuts for doc rotate because bad response now interactive mode onlu fire with CTRL+MMB (bzr r15445) --- src/ui/tools/tool-base.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index ca700f652..aab256712 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -732,13 +732,13 @@ bool ToolBase::root_handler(GdkEvent* event) { break; case GDK_KEY_space: - if (event->key.state & GDK_CONTROL_MASK) { - sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); - desktop->canvas->startRotateTo(desktop->namedview->document_rotation); - this->rotating_mode = true; - this->message_context->set(Inkscape::INFORMATION_MESSAGE, - _("Space+mouse move to rotate canvas, use modifiers on screen to change snaps")); - } else { +// if (event->key.state & GDK_CONTROL_MASK) { +// sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); +// desktop->canvas->startRotateTo(desktop->namedview->document_rotation); +// this->rotating_mode = true; +// this->message_context->set(Inkscape::INFORMATION_MESSAGE, +// _("Space+mouse move to rotate canvas, use modifiers on screen to change snaps")); +// } else { within_tolerance = true; xp = yp = 0; if (!allow_panning) break; @@ -746,7 +746,7 @@ bool ToolBase::root_handler(GdkEvent* event) { this->space_panning = true; this->message_context->set(Inkscape::INFORMATION_MESSAGE, _("Space+mouse move to pan canvas")); - } +// } ret = TRUE; break; @@ -805,14 +805,14 @@ bool ToolBase::root_handler(GdkEvent* event) { switch (get_group0_keyval(&event->key)) { case GDK_KEY_space: - if (this->rotating_mode) { - desktop->canvas->clearRotateTo(); - this->rotating_mode = false; - ret = TRUE; - if (desktop->canvas->endRotateTo()) { - sp_repr_set_svg_double(desktop->namedview->getRepr(), "inkscape:document-rotation", angle); - } - } +// if (this->rotating_mode) { +// desktop->canvas->clearRotateTo(); +// this->rotating_mode = false; +// ret = TRUE; +// if (desktop->canvas->endRotateTo()) { +// sp_repr_set_svg_double(desktop->namedview->getRepr(), "inkscape:document-rotation", angle); +// } +// } if (within_tolerance) { // Space was pressed, but not panned sp_toggle_selector(desktop); -- cgit v1.2.3 From bbb714926033738fb53a2d1fd794a391d4c5a292 Mon Sep 17 00:00:00 2001 From: jabiertxof <> Date: Thu, 26 Jan 2017 02:24:46 +0100 Subject: defaults to about.svg when localized versions fail (bzr r15453) --- src/ui/dialog/aboutbox.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/ui') diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index 8f0545e96..e7572b3ce 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -162,6 +162,9 @@ Gtk::Widget *build_splash_widget() { // should be in UTF-*8.. char *about=g_build_filename(INKSCAPE_SCREENSDIR, _("about.svg"), NULL); + if (!g_file_test (about, G_FILE_TEST_EXISTS)) { + about=g_build_filename(INKSCAPE_SCREENSDIR, "about.svg", NULL); + } SPDocument *doc=SPDocument::createNewDoc (about, TRUE); g_free(about); g_return_val_if_fail(doc != NULL, NULL); -- cgit v1.2.3 From 4a81c0fc9ecb2b9196f6cedeaf2ea39d68408936 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 26 Jan 2017 16:50:34 +0100 Subject: [Bug #1659426] About screen - Missing image and small window - Translation comment. Fixed bugs: - https://launchpad.net/bugs/1659426 (bzr r15456) --- src/ui/dialog/aboutbox.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index e7572b3ce..40b948a23 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -152,10 +152,7 @@ Gtk::Widget *build_splash_widget() { the `screens' directory. Thus the translation of "about.svg" should be the filename of its translated version, e.g. about.zh.svg for Chinese. - N.B. about.svg changes once per release. (We should probably rename - the original to about-0.40.svg etc. as soon as we have a translation. - If we do so, then add an item to release-checklist saying that the - string here should be changed.) */ + Please don't translate the filename unless the translated picture exists. */ // FIXME? INKSCAPE_SCREENSDIR and "about.svg" are in UTF-8, not the // native filename encoding... and the filename passed to sp_document_new -- cgit v1.2.3 From 09f59f6114bb5d31bdc8bf0768cd55a111a35349 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 1 Feb 2017 21:19:06 +0100 Subject: Fix typo. (bzr r15463) --- src/ui/tools/mesh-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp index e628094d9..ac43b6c9d 100644 --- a/src/ui/tools/mesh-tool.cpp +++ b/src/ui/tools/mesh-tool.cpp @@ -1137,7 +1137,7 @@ static void sp_mesh_new_default(MeshTool &rc) { Inkscape::FOR_FILL : Inkscape::FOR_STROKE; // Ensure mesh is immediately editable. - // Editting both fill and stroke at same time doesn't work well so avoid. + // Editing both fill and stroke at same time doesn't work well so avoid. if (fill_or_stroke == Inkscape::FOR_FILL) { prefs->setBool("/tools/mesh/edit_fill", true ); prefs->setBool("/tools/mesh/edit_stroke", false); -- cgit v1.2.3 From 349536d49558ec5841e799eb33a4cbbb3fa9722d Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sun, 5 Feb 2017 16:04:35 +0000 Subject: Fix C++11 errors and warnings with g++-7 Fixed bugs: - https://launchpad.net/bugs/1660992 (bzr r15477) --- src/ui/tools/flood-tool.cpp | 59 +++++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 18 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index 1801a0ea0..6e1d085aa 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -21,6 +21,7 @@ #include #endif +#include #include "trace/potrace/inkscape-potrace.h" #include <2geom/pathvector.h> #include @@ -185,6 +186,21 @@ inline unsigned char * get_trace_pixel(guchar *trace_px, int x, int y, int width return trace_px + (x + y * width); } +/** + * \brief Check whether two unsigned integers are close to each other + * + * \param[in] a The 1st unsigned int + * \param[in] b The 2nd unsigned int + * \param[in] d The threshold for comparison + * + * \return true if |a-b| <= d; false otherwise + */ +static bool compare_guint32(guint32 const a, guint32 const b, guint32 const d) +{ + const int difference = std::abs(static_cast(a) - static_cast(b)); + return difference <= d; +} + /** * Compare a pixel in a pixel buffer with another pixel to determine if a point should be included in the fill operation. * @param check The pixel in the pixel buffer to check. @@ -196,7 +212,6 @@ inline unsigned char * get_trace_pixel(guchar *trace_px, int x, int y, int width */ static bool compare_pixels(guint32 check, guint32 orig, guint32 merged_orig_pixel, guint32 dtc, int threshold, PaintBucketChannels method) { - int diff = 0; float hsl_check[3] = {0,0,0}, hsl_orig[3] = {0,0,0}; guint32 ac = 0, rc = 0, gc = 0, bc = 0; @@ -222,27 +237,35 @@ static bool compare_pixels(guint32 check, guint32 orig, guint32 merged_orig_pixe switch (method) { case FLOOD_CHANNELS_ALPHA: - return abs(static_cast(ac) - ao) <= threshold; + return compare_guint32(ac, ao, threshold); case FLOOD_CHANNELS_R: - return abs(static_cast(ac ? unpremul_alpha(rc, ac) : 0) - (ao ? unpremul_alpha(ro, ao) : 0)) <= threshold; + return compare_guint32(ac ? unpremul_alpha(rc, ac) : 0, + ao ? unpremul_alpha(ro, ao) : 0, + threshold); case FLOOD_CHANNELS_G: - return abs(static_cast(ac ? unpremul_alpha(gc, ac) : 0) - (ao ? unpremul_alpha(go, ao) : 0)) <= threshold; + return compare_guint32(ac ? unpremul_alpha(gc, ac) : 0, + ao ? unpremul_alpha(go, ao) : 0, + threshold); case FLOOD_CHANNELS_B: - return abs(static_cast(ac ? unpremul_alpha(bc, ac) : 0) - (ao ? unpremul_alpha(bo, ao) : 0)) <= threshold; + return compare_guint32(ac ? unpremul_alpha(bc, ac) : 0, + ao ? unpremul_alpha(bo, ao) : 0, + threshold); case FLOOD_CHANNELS_RGB: - guint32 amc, rmc, bmc, gmc; - //amc = 255*255 - (255-ac)*(255-ad); amc = (amc + 127) / 255; - //amc = (255-ac)*ad + 255*ac; amc = (amc + 127) / 255; - amc = 255; // Why are we looking at desktop? Cairo version ignores destop alpha - rmc = (255-ac)*rd + 255*rc; rmc = (rmc + 127) / 255; - gmc = (255-ac)*gd + 255*gc; gmc = (gmc + 127) / 255; - bmc = (255-ac)*bd + 255*bc; bmc = (bmc + 127) / 255; - - diff += abs(static_cast(amc ? unpremul_alpha(rmc, amc) : 0) - (amop ? unpremul_alpha(rmop, amop) : 0)); - diff += abs(static_cast(amc ? unpremul_alpha(gmc, amc) : 0) - (amop ? unpremul_alpha(gmop, amop) : 0)); - diff += abs(static_cast(amc ? unpremul_alpha(bmc, amc) : 0) - (amop ? unpremul_alpha(bmop, amop) : 0)); - return ((diff / 3) <= ((threshold * 3) / 4)); - + { + guint32 amc, rmc, bmc, gmc; + //amc = 255*255 - (255-ac)*(255-ad); amc = (amc + 127) / 255; + //amc = (255-ac)*ad + 255*ac; amc = (amc + 127) / 255; + amc = 255; // Why are we looking at desktop? Cairo version ignores destop alpha + rmc = (255-ac)*rd + 255*rc; rmc = (rmc + 127) / 255; + gmc = (255-ac)*gd + 255*gc; gmc = (gmc + 127) / 255; + bmc = (255-ac)*bd + 255*bc; bmc = (bmc + 127) / 255; + + int diff = 0; // The total difference between each of the 3 color components + diff += std::abs(static_cast(amc ? unpremul_alpha(rmc, amc) : 0) - static_cast(amop ? unpremul_alpha(rmop, amop) : 0)); + diff += std::abs(static_cast(amc ? unpremul_alpha(gmc, amc) : 0) - static_cast(amop ? unpremul_alpha(gmop, amop) : 0)); + diff += std::abs(static_cast(amc ? unpremul_alpha(bmc, amc) : 0) - static_cast(amop ? unpremul_alpha(bmop, amop) : 0)); + return ((diff / 3) <= ((threshold * 3) / 4)); + } case FLOOD_CHANNELS_H: return ((int)(fabs(hsl_check[0] - hsl_orig[0]) * 100.0) <= threshold); case FLOOD_CHANNELS_S: -- cgit v1.2.3 From 57cb0b342004378ad4065f07443ab1d835aefaad Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Sun, 5 Feb 2017 18:50:57 +0100 Subject: fix crash when inserting nodes Fixed bugs: - https://launchpad.net/bugs/1617615 (bzr r15479) --- src/ui/tool/multi-path-manipulator.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tool/multi-path-manipulator.h b/src/ui/tool/multi-path-manipulator.h index c908cede2..4f152e0a2 100644 --- a/src/ui/tool/multi-path-manipulator.h +++ b/src/ui/tool/multi-path-manipulator.h @@ -82,8 +82,19 @@ private: template void invokeForAll(R (PathManipulator::*method)()) { - for (MapType::iterator i = _mmap.begin(); i != _mmap.end(); ++i) { - ((i->second.get())->*method)(); + for (MapType::iterator i = _mmap.begin(); i != _mmap.end(); ) { + // Sometimes the PathManipulator got freed at loop end, thus + // invalidating the iterator so make sure that next_i will + // be a valid iterator and then assign i to it. + MapType::iterator next_i = i; + ++next_i; + // i->second is a boost::shared_ptr so try to hold on to it so + // it won't get freed prematurely by the WriteXML() method or + // whatever. See https://bugs.launchpad.net/inkscape/+bug/1617615 + // Applicable to empty paths. + boost::shared_ptr hold(i->second); + ((hold.get())->*method)(); + i = next_i; } } template -- cgit v1.2.3 From 1e3e159499532a145cf09af2dbd1de2ae4d8d565 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 6 Feb 2017 15:34:17 +0000 Subject: Remove some unneeded < C++11 fallback code (bzr r15485) --- src/ui/tool/node.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h index 025c460e2..a05f0e3b9 100644 --- a/src/ui/tool/node.h +++ b/src/ui/tool/node.h @@ -20,12 +20,7 @@ #include #include #include - -#if __cplusplus >= 201103L #include -#else -#include -#endif #include #include -- cgit v1.2.3 From ddb9f75a21c83c5979e467c5adf1b8a7cdf7b98e Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 8 Feb 2017 10:36:56 +0100 Subject: Allow dialog to be resizable. (Fixed inheritance.) Also basic housekeeping. (bzr r15496) --- src/ui/dialog/styledialog.cpp | 11 +++++++++++ src/ui/dialog/styledialog.h | 30 ++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 5246290b4..8d56e10e7 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -1114,3 +1114,14 @@ void StyleDialog::_selectRow(Selection */*sel*/) } // namespace Dialog } // namespace UI } // namespace Inkscape + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index b03a1d2e1..3cc4349e6 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -30,16 +30,16 @@ namespace Dialog { /** * @brief The StyleDialog class - * A list of CSS selectors will show up in this dialog. This dialog allows to - * add and delete selectors. Objects can be added to and removed from the selectors - * in the dialog. Besides, selection of any selector row selects the matching - * objects in the drawing and vice-versa. + * A list of CSS selectors will show up in this dialog. This dialog allows one to + * add and delete selectors. Elements can be added to and removed from the selectors + * in the dialog. Selection of any selector row selects the matching objects in + * the drawing and vice-versa. */ typedef std::pair >, std::string> _selectorVecType; -class StyleDialog : public UI::Widget::Panel -{ +class StyleDialog : public Widget::Panel { + public: StyleDialog(); ~StyleDialog(); @@ -73,8 +73,11 @@ private: class ModelColumns : public Gtk::TreeModel::ColumnRecord { public: - ModelColumns() - { add(_selectorLabel); add(_colAddRemove); add(_colObj); } + ModelColumns() { + add(_selectorLabel); + add(_colAddRemove); + add(_colObj); + } Gtk::TreeModelColumn _selectorLabel; Gtk::TreeModelColumn _colAddRemove; Gtk::TreeModelColumn > _colObj; @@ -115,3 +118,14 @@ private: } // namespace Inkscape #endif // STYLEDIALOG_H + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : -- cgit v1.2.3 From 116c4c4853a080ff7210de2d4e999959c0c0e0ce Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 8 Feb 2017 13:09:58 +0100 Subject: Add naive selector validation on entry in style dialog. (bzr r15497) --- src/ui/dialog/styledialog.cpp | 64 +++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 23 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 8d56e10e7..7b68cfe53 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -16,8 +16,11 @@ #include "sp-object.h" #include "selection.h" #include "xml/attribute-record.h" +#include "attribute-rel-svg.h" + +#include #include - + using Inkscape::Util::List; using Inkscape::XML::AttributeRecord; @@ -169,45 +172,60 @@ void StyleDialog::_addSelector() * is added to a new style element. */ Gtk::Dialog *textDialogPtr = new Gtk::Dialog(); - Gtk::Entry *textEditPtr = manage ( new Gtk::Entry() ); textDialogPtr->add_button("Add", Gtk::RESPONSE_OK); + + Gtk::Entry *textEditPtr = manage ( new Gtk::Entry() ); textDialogPtr->get_vbox()->pack_start(*textEditPtr, Gtk::PACK_SHRINK); + Gtk::Label *textLabelPtr = manage ( new Gtk::Label( + _("Invalid entry: Not an id (#), class (.), or element CSS selector.") + ) ); + textDialogPtr->get_vbox()->pack_start(*textLabelPtr, Gtk::PACK_SHRINK); + /** * By default, the entrybox contains 'Class1' as text. However, if object(s) * is(are) selected and user clicks '+' at the bottom of dialog, the * entrybox will have the id(s) of the selected objects as text. */ if (_desktop->getSelection()->isEmpty()) { - textEditPtr->set_text("Class1"); - } - else { + textEditPtr->set_text(".Class1"); + } else { Inkscape::Selection* selection = _desktop->getSelection(); - std::vector selected = std::vector(selection - ->objects().begin(), - selection-> - objects().end()); + std::vector selected = + std::vector(selection->objects().begin(), + selection->objects().end()); textEditPtr->set_text(_setClassAttribute(selected)); } textDialogPtr->set_size_request(200, 100); - textDialogPtr->show_all(); - int result = textDialogPtr->run(); + textEditPtr->show(); + textLabelPtr->hide(); + textDialogPtr->show(); - /** - * @brief selectorName - * This string stores selector name. The text from entrybox is saved as name - * for selector. If the entrybox is empty, the text (thus selectorName) is - * set to ".Class1" - */ - if (!textEditPtr->get_text().empty()) { + int result = -1; + bool invalid = true; + + while (invalid) { + result = textDialogPtr->run(); + + /** + * @brief selectorName + * This string stores selector name. The text from entrybox is saved as name + * for selector. If the entrybox is empty, the text (thus selectorName) is + * set to ".Class1" + */ _selectorName = textEditPtr->get_text(); - } - else { - _selectorName = ".Class1"; - } - del->set_sensitive(true); + del->set_sensitive(true); + + if (_selectorName[0] == '.' || + _selectorName[0] == '#' || + SPAttributeRelSVG::isSVGElement( _selectorName ) ) { + invalid = false; + } else { + textLabelPtr->show(); + } + } /** * The selector name objects is set to the text that the user sets in the -- cgit v1.2.3 From bd4bad24c8e2c428e07d8afc5bc1009e9809be1b Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Fri, 10 Feb 2017 22:26:04 +0100 Subject: Fix encoding/escaping issues with symbols loaded from .vss (Visio stencils) files There were three issues: - When loading a .vss file an SVG document is created internally and the file name is used to derive this document's "title". This could result in illegal characters (e.g. the ampersand "&") in the title making the document fail to load. The title is now properly escaped. - Loading of files with non-ANSI characers in filename failed on Windows. Fix is equivalent to r15421, see also bug #1416949. - The .vss file name is also used to derive symbol IDs, which were not properly sanitized before (i.e. could cause broken hrefs later or even prevent to load the .vss file). Characters that do not match [a-zA-Z0-9_-] are now laways replaced with an underscore "_") which will result in valid IDs in almost all cases Fixed bugs: - https://launchpad.net/bugs/1662465 (bzr r15501) --- src/ui/dialog/symbols.cpp | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 4840b897b..c8a11b112 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -127,7 +127,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : sigc::connection connSet = symbolSet->signal_changed().connect( sigc::mem_fun(*this, &SymbolsDialog::rebuild)); instanceConns.push_back(connSet); - + ++row; /********************* Icon View **************************/ @@ -342,7 +342,7 @@ void SymbolsDialog::rebuild() { addSymbol->set_sensitive( true ); removeSymbol->set_sensitive( true ); } else { - addSymbol->set_sensitive( false ); + addSymbol->set_sensitive( false ); removeSymbol->set_sensitive( false ); } add_symbols( symbolDocument ); @@ -451,7 +451,14 @@ void SymbolsDialog::iconChanged() { #ifdef WITH_LIBVISIO // Read Visio stencil files -SPDocument* read_vss( gchar* fullname, gchar* filename ) { +SPDocument* read_vss( gchar* fullname, Glib::ustring name ) { + + #ifdef WIN32 + // RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows + // therefore attempt to convert uri to the system codepage + // even if this is not possible the alternate short (8.3) file name will be used if available + fullname = g_win32_locale_filename_from_utf8(fullname); + #endif RVNGFileStream input(fullname); @@ -474,6 +481,12 @@ SPDocument* read_vss( gchar* fullname, gchar* filename ) { return NULL; } + // prepare a valid title for the symbol file + Glib::ustring title = Glib::Markup::escape_text(name); + // prepare a valid id prefix for the symbols (unfortunately libvisio doesn't give us a name) + Glib::RefPtr regex1 = Glib::Regex::create("[^a-zA-Z0-9_-]"); + Glib::ustring id = regex1->replace(name, 0, "_", Glib::REGEX_MATCH_PARTIAL); + Glib::ustring tmpSVGOutput; tmpSVGOutput += "\n"; tmpSVGOutput += "\n"; tmpSVGOutput += " "; - tmpSVGOutput += filename; + tmpSVGOutput += title; tmpSVGOutput += "\n"; tmpSVGOutput += " \n"; - // Create a string we can use for the symbol id (libvisio doesn't give us a name) - std::string sanitized( filename ); - sanitized.erase( sanitized.find_last_of(".vss")-3 ); - sanitized.erase( std::remove_if( sanitized.begin(), sanitized.end(), ispunct ), sanitized.end() ); - std::replace( sanitized.begin(), sanitized.end(), ' ', '_' ); - // std::cout << filename << " |" << sanitized << "|" << std::endl; - // Each "symbol" is in it's own SVG file, we wrap with and merge into one file. for (unsigned i=0; i\n"; @@ -521,12 +527,12 @@ SPDocument* read_vss( gchar* fullname, gchar* filename ) { tmpSVGOutput += " \n"; tmpSVGOutput += "\n"; - + return SPDocument::createNewDocFromMem( tmpSVGOutput.c_str(), strlen( tmpSVGOutput.c_str()), 0 ); } #endif - + /* Hunts preference directories for symbol files */ void SymbolsDialog::get_symbols() { @@ -565,11 +571,14 @@ void SymbolsDialog::get_symbols() { #ifdef WITH_LIBVISIO if( tag.compare( "vss" ) == 0 ) { + // strip extension from filename and use it as name for the symbol set + Glib::ustring name = Glib::ustring(filename); + name = name.erase(name.rfind('.')); - symbol_doc = read_vss( fullname, filename ); + symbol_doc = read_vss( fullname, name ); if( symbol_doc ) { - symbolSets[Glib::ustring(filename)]= symbol_doc; - symbolSet->append(filename); + symbolSets[name]= symbol_doc; + symbolSet->append(name); } } #endif @@ -630,7 +639,7 @@ GSList* SymbolsDialog::symbols_in_doc( SPDocument* symbolDocument ) { } GSList* SymbolsDialog::use_in_doc_recursive (SPObject *r, GSList *l) -{ +{ if ( dynamic_cast(r) ) { l = g_slist_prepend (l, r); @@ -816,7 +825,7 @@ SPDocument* SymbolsDialog::symbols_preview_doc() " xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"" " xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"" " xmlns:xlink=\"http://www.w3.org/1999/xlink\">" -" " +" " " " " " " " -- cgit v1.2.3 From 9f806b86e925bc6817cb111bc50e244cfa302d4a Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Fri, 10 Feb 2017 23:04:01 +0100 Subject: Add missing "#include " for previous commit (bzr r15502) --- src/ui/dialog/symbols.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui') diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index c8a11b112..dcfb7f242 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include -- cgit v1.2.3 From 9faf941d45ce7d23f5cb0d066bd23346f7e3aedf Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 11 Feb 2017 01:16:53 +0100 Subject: Fix a memory leak introduced in r15421 and r15501 respectively (bzr r15505) --- src/ui/dialog/symbols.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ui') diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index dcfb7f242..740ff4f39 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -463,6 +463,10 @@ SPDocument* read_vss( gchar* fullname, Glib::ustring name ) { RVNGFileStream input(fullname); + #ifdef WIN32 + g_free(fullname); + #endif + if (!libvisio::VisioDocument::isSupported(&input)) { return NULL; } -- cgit v1.2.3 From 38ecca9e4639b8aecc55a4becfc1ed9b2793fadc Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 13 Feb 2017 22:37:42 +0100 Subject: AboutBox: Remove superfluous space in website URL (bzr r15516) --- src/ui/dialog/aboutbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index 40b948a23..805bfb562 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -115,7 +115,7 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) { Gtk::Label *link = new Gtk::Label(); const gchar *website_link = - " https://www.inkscape.org"; + "https://www.inkscape.org"; link->set_markup(website_link); link->set_alignment(Gtk::ALIGN_END); -- cgit v1.2.3 From db37e627f21d79c6968f681725c7a4dd8de21081 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 14 Feb 2017 16:39:13 +0100 Subject: Rewrite and cleanup of style dialog. Still WIP. Missing undo and document tracking. (bzr r15520) --- src/ui/dialog/cssdialog.cpp | 53 +- src/ui/dialog/cssdialog.h | 35 +- src/ui/dialog/styledialog.cpp | 1529 +++++++++++++++++++---------------------- src/ui/dialog/styledialog.h | 93 +-- 4 files changed, 791 insertions(+), 919 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/cssdialog.cpp b/src/ui/dialog/cssdialog.cpp index fa266b012..d0ae822bd 100644 --- a/src/ui/dialog/cssdialog.cpp +++ b/src/ui/dialog/cssdialog.cpp @@ -3,8 +3,10 @@ */ /* Authors: * Kamalpreet Kaur Grewal + * Tavmjong Bah * * Copyright (C) Kamalpreet Kaur Grewal 2016 + * Copyright (C) Tavmjong Bah 2017 * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -21,23 +23,6 @@ namespace Inkscape { namespace UI { namespace Dialog { -/** - * @brief CssDialog::_styleButton - * @param btn - * @param iconName - * @param tooltip - * This function sets the style of '+'button at the bottom of dialog. - */ -void CssDialog::_styleButton(Gtk::Button& btn, char const* iconName, - char const* tooltip) -{ - GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); - gtk_widget_show(child); - btn.add(*manage(Glib::wrap(child))); - btn.set_relief(Gtk::RELIEF_NONE); - btn.set_tooltip_text(tooltip); -} - /** * Constructor * A treeview whose each row corresponds to a CSS property of selector selected. @@ -60,8 +45,7 @@ CssDialog::CssDialog(): _store = Gtk::ListStore::create(_cssColumns); _treeView.set_model(_store); - Inkscape::UI::Widget::AddToIcon * addRenderer = manage(new Inkscape::UI:: - Widget::AddToIcon()); + Inkscape::UI::Widget::AddToIcon * addRenderer = manage(new Inkscape::UI::Widget::AddToIcon()); addRenderer->property_active() = false; int addCol = _treeView.append_column("Unset Property", *addRenderer) - 1; @@ -74,6 +58,10 @@ CssDialog::CssDialog(): int nameColNum = _treeView.append_column("Property", *_textRenderer) - 1; _propCol = _treeView.get_column(nameColNum); + if (_propCol) { + _propCol->add_attribute(_textRenderer->property_text(), + _cssColumns._propertyLabel); + } Gtk::Button* create = manage(new Gtk::Button()); _styleButton(*create, "list-add", "Add a new property"); @@ -83,12 +71,12 @@ CssDialog::CssDialog(): _getContents()->pack_start(_mainBox, Gtk::PACK_EXPAND_WIDGET); - _targetDesktop = getDesktop(); - setDesktop(_targetDesktop); + setDesktop(getDesktop()); create->signal_clicked().connect(sigc::mem_fun(*this, &CssDialog::_addProperty)); } + /** * @brief CssDialog::~CssDialog * Class destructor @@ -98,6 +86,7 @@ CssDialog::~CssDialog() setDesktop(NULL); } + /** * @brief CssDialog::setDesktop * @param desktop @@ -108,16 +97,34 @@ void CssDialog::setDesktop(SPDesktop* desktop) _desktop = desktop; } + +/** + * @brief CssDialog::_styleButton + * @param btn + * @param iconName + * @param tooltip + * This function sets the style of '+'button at the bottom of dialog. + */ +void CssDialog::_styleButton(Gtk::Button& btn, char const* iconName, + char const* tooltip) +{ + GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); + gtk_widget_show(child); + btn.add(*manage(Glib::wrap(child))); + btn.set_relief(Gtk::RELIEF_NONE); + btn.set_tooltip_text(tooltip); +} + + /** * @brief CssDialog::_addProperty * This function is a slot to signal_clicked for '+' button at the bottom of CSS * panel. A new row is added, double clicking which text for new property can be - * added. _newProperty is set to true in which case the value is appended. + * added. */ void CssDialog::_addProperty() { _propRow = *(_store->append()); - _newProperty = true; } } // namespace Dialog diff --git a/src/ui/dialog/cssdialog.h b/src/ui/dialog/cssdialog.h index 3bbab5031..1f8b7ca98 100644 --- a/src/ui/dialog/cssdialog.h +++ b/src/ui/dialog/cssdialog.h @@ -3,8 +3,10 @@ */ /* Authors: * Kamalpreet Kaur Grewal + * Tavmjong Bah * * Copyright (C) Kamalpreet Kaur Grewal 2016 + * Copyright (C) Tavmjong Bah 2017 * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -38,32 +40,39 @@ public: ~CssDialog(); static CssDialog &getInstance() { return *new CssDialog(); } - void setDesktop(SPDesktop* desktop); - class CssColumns : public Gtk::TreeModel::ColumnRecord - { + // Data structure + class CssColumns : public Gtk::TreeModel::ColumnRecord { public: - CssColumns() - { add(_colUnsetProp); add(_propertyLabel); } + CssColumns() { + add(_colUnsetProp); + add(_propertyLabel); + } Gtk::TreeModelColumn _colUnsetProp; Gtk::TreeModelColumn _propertyLabel; }; - - SPDesktop* _desktop; - SPDesktop* _targetDesktop; CssColumns _cssColumns; - Gtk::VBox _mainBox; - Gtk::HBox _buttonBox; + + // TreeView Gtk::TreeView _treeView; Glib::RefPtr _store; - Gtk::ScrolledWindow _scrolledWindow; Gtk::TreeModel::Row _propRow; Gtk::CellRendererText *_textRenderer; Gtk::TreeViewColumn *_propCol; - Glib::ustring _editedProp; - bool _newProperty; + // Widgets + Gtk::VBox _mainBox; + Gtk::ScrolledWindow _scrolledWindow; + Gtk::HBox _buttonBox; + + // Variables - Inkscape + SPDesktop* _desktop; + + // Helper functions + void setDesktop(SPDesktop* desktop); void _styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip); + + // Signal handlers void _addProperty(); }; diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 7b68cfe53..581911a1b 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -3,8 +3,10 @@ */ /* Authors: * Kamalpreet Kaur Grewal + * Tavmjong Bah * * Copyright (C) Kamalpreet Kaur Grewal 2016 + * Copyright (C) Tavmjong Bah 2017 * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -21,6 +23,8 @@ #include #include +//#define DEBUG_STYLEDIALOG + using Inkscape::Util::List; using Inkscape::XML::AttributeRecord; @@ -35,22 +39,6 @@ namespace Inkscape { namespace UI { namespace Dialog { -/** - * @brief StyleDialog::_styleButton - * @param btn - * @param iconName - * @param tooltip - * This function sets the style of '+' and '-' buttons at the bottom of dialog. - */ -void StyleDialog::_styleButton(Gtk::Button& btn, char const* iconName, - char const* tooltip) -{ - GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); - gtk_widget_show(child); - btn.add(*manage(Glib::wrap(child))); - btn.set_relief(Gtk::RELIEF_NONE); - btn.set_tooltip_text (tooltip); -} /** * Constructor @@ -60,42 +48,39 @@ void StyleDialog::_styleButton(Gtk::Button& btn, char const* iconName, */ StyleDialog::StyleDialog() : UI::Widget::Panel("", "/dialogs/style", SP_VERB_DIALOG_STYLE), - _desktop(0) + _desktop(0), + _updating(false) { - set_size_request(200, 200); - - _paned.pack1(_mainBox, Gtk::SHRINK); - _mainBox.pack_start(_scrolledWindow, Gtk::PACK_EXPAND_WIDGET); - _treeView.set_headers_visible(false); - _scrolledWindow.add(_treeView); - _scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - - _store = Gtk::TreeStore::create(_mColumns); - _treeView.set_model(_store); + // Tree Inkscape::UI::Widget::AddToIcon * addRenderer = manage( new Inkscape::UI::Widget::AddToIcon() ); addRenderer->property_active() = true; + _store = Gtk::TreeStore::create(_mColumns); + _treeView.set_model(_store); + _treeView.set_headers_visible(false); int addCol = _treeView.append_column("type", *addRenderer) - 1; - Gtk::TreeViewColumn *col = _treeView.get_column(addCol); if ( col ) { col->add_attribute( addRenderer->property_active(), _mColumns._colAddRemove ); } - - _treeView.append_column("Selector Name", _mColumns._selectorLabel); + _treeView.append_column("Selector Name", _mColumns._colSelector); _treeView.set_expander_column(*(_treeView.get_column(1))); + + // Pack widgets + _paned.pack1(_mainBox, Gtk::SHRINK); + _mainBox.pack_start(_scrolledWindow, Gtk::PACK_EXPAND_WIDGET); + _scrolledWindow.add(_treeView); + _scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); create = manage( new Gtk::Button() ); _styleButton(*create, "list-add", "Add a new CSS Selector"); - create->signal_clicked().connect(sigc::mem_fun(*this, - &StyleDialog::_addSelector)); + create->signal_clicked().connect(sigc::mem_fun(*this, &StyleDialog::_addSelector)); del = manage( new Gtk::Button() ); _styleButton(*del, "list-remove", "Remove a CSS Selector"); - del->signal_clicked().connect(sigc::mem_fun(*this, - &StyleDialog::_delSelector)); + del->signal_clicked().connect(sigc::mem_fun(*this, &StyleDialog::_delSelector)); del->set_sensitive(false); _mainBox.pack_end(_buttonBox, Gtk::PACK_SHRINK); @@ -105,8 +90,40 @@ StyleDialog::StyleDialog() : _getContents()->pack_start(_paned, Gtk::PACK_EXPAND_WIDGET); - _targetDesktop = getDesktop(); - setDesktop(_targetDesktop); + // Dialog size request + Gtk::Requisition sreq1, sreq2; + get_preferred_size(sreq1, sreq2); + int minWidth = 200; + int minHeight = 300; + minWidth = (sreq2.width > minWidth ? sreq2.width : minWidth ); + minHeight = (sreq2.height > minHeight ? sreq2.height : minHeight); + set_size_request(minWidth, minHeight); + + // Signal handlers + _treeView.signal_button_release_event().connect( // Needs to be release, not press. + sigc::mem_fun(*this, &StyleDialog::_handleButtonEvent), + false); + + _treeView.signal_button_release_event().connect_notify( + sigc::mem_fun(*this, &StyleDialog::_buttonEventsSelectObjs), + false); + + _treeView.get_selection()->signal_changed().connect( + sigc::mem_fun(*this, &StyleDialog::_selChanged)); + + // Add CSS dialog + _cssPane = new CssDialog; + _paned.pack2(*_cssPane, Gtk::SHRINK); + _cssPane->show_all(); + + _cssPane->_textRenderer->signal_edited().connect( + sigc::mem_fun(*this, &StyleDialog::_handleEdited)); + _cssPane->_treeView.signal_button_release_event().connect( + sigc::mem_fun(*this, &StyleDialog::_delProperty), + false); + + // Document & Desktop TO DO: Fix this brokeness + setDesktop(getDesktop()); // Adds signal handler /** * @brief document @@ -114,27 +131,17 @@ StyleDialog::StyleDialog() : * and is then used to populate the treeview with the already existing * selectors in the style element. */ - _styleExists = false; - _document = _targetDesktop->doc(); - _selectorValue = _populateTree(_getSelectorVec()); + _document = _desktop->doc(); - _treeView.signal_button_press_event().connect(sigc::mem_fun(*this, - &StyleDialog:: - _handleButtonEvent), - false); + _readStyleElement(); - _treeView.signal_button_press_event().connect_notify(sigc::mem_fun - (*this, &StyleDialog:: - _buttonEventsSelectObjs), - false); - - _cssPane = new CssDialog; + if (!_store->children().empty()) { + del->set_sensitive(true); + } - _treeView.get_selection()->signal_changed().connect(sigc::mem_fun(*this, - &StyleDialog:: - _selChanged)); } + /** * @brief StyleDialog::~StyleDialog * Class destructor @@ -144,429 +151,619 @@ StyleDialog::~StyleDialog() setDesktop(NULL); } + /** * @brief StyleDialog::setDesktop * @param desktop - * This function sets the 'desktop' for the Style Dialog. + * Set the 'desktop' for the Style Dialog. */ void StyleDialog::setDesktop( SPDesktop* desktop ) { +#ifdef DEBUG_STYLEDIALOOG + std::cout << "StyleDialog::setDesktop" << std::endl; +#endif Panel::setDesktop(desktop); _desktop = Panel::getDesktop(); - _desktop->getSelection()->connectChanged(sigc::mem_fun(*this, &StyleDialog:: - _selectRow)); + _desktop->getSelection()->connectChanged(sigc::mem_fun(*this, &StyleDialog::_selectRow)); } + /** - * @brief StyleDialog::_addSelector - * This function is the slot to the signal emitted when '+' at the bottom of - * the dialog is clicked. + * @brief StyleDialog::_styleTextNode + * @return Inkscape::XML::Node* pointing to a style element's text node. + * Returns the style element's text node. If there is no style element, one is created. + * Ditto for text node. */ -void StyleDialog::_addSelector() +Inkscape::XML::Node* StyleDialog::_getStyleTextNode() { - Gtk::TreeModel::Row row = *(_store->append()); + Inkscape::XML::Node *root = _document->getReprRoot(); + for (unsigned i = 0; i < root->childCount(); ++i) { + if (Glib::ustring(root->nthChild(i)->name()) == "svg:style") { + Inkscape::XML::Node * styleNode = root->nthChild(i); + + for (unsigned j = 0; j < styleNode->childCount(); ++j) { + if (styleNode->nthChild(j)->type() == Inkscape::XML::TEXT_NODE) { + return styleNode->nthChild(j); + } + } - /** - * On clicking '+' button, an entrybox with default text opens up. If an - * object is already selected, a selector with value in the entry - * is added to a new style element. - */ - Gtk::Dialog *textDialogPtr = new Gtk::Dialog(); - textDialogPtr->add_button("Add", Gtk::RESPONSE_OK); + // Style element found but does not contain text node! + std::cerr << "StyleDialog::_getStyleTextNode(): No text node!" << std::endl; + Inkscape::XML::Node *textNode = _document->getReprDoc()->createTextNode(""); + styleNode->appendChild(textNode); + Inkscape::GC::release(textNode); - Gtk::Entry *textEditPtr = manage ( new Gtk::Entry() ); - textDialogPtr->get_vbox()->pack_start(*textEditPtr, Gtk::PACK_SHRINK); + return textNode; + } + } - Gtk::Label *textLabelPtr = manage ( new Gtk::Label( - _("Invalid entry: Not an id (#), class (.), or element CSS selector.") - ) ); - textDialogPtr->get_vbox()->pack_start(*textLabelPtr, Gtk::PACK_SHRINK); + // Style element not found, create one + Inkscape::XML::Node *styleNode = _document->getReprDoc()->createElement("svg:style"); + Inkscape::XML::Node *textNode = _document->getReprDoc()->createTextNode(""); - /** - * By default, the entrybox contains 'Class1' as text. However, if object(s) - * is(are) selected and user clicks '+' at the bottom of dialog, the - * entrybox will have the id(s) of the selected objects as text. - */ - if (_desktop->getSelection()->isEmpty()) { - textEditPtr->set_text(".Class1"); - } else { - Inkscape::Selection* selection = _desktop->getSelection(); - std::vector selected = - std::vector(selection->objects().begin(), - selection->objects().end()); - textEditPtr->set_text(_setClassAttribute(selected)); - } + styleNode->appendChild(textNode); + Inkscape::GC::release(textNode); - textDialogPtr->set_size_request(200, 100); - textEditPtr->show(); - textLabelPtr->hide(); - textDialogPtr->show(); + root->addChild(styleNode, NULL); + Inkscape::GC::release(styleNode); - int result = -1; - bool invalid = true; + return textNode; +} + + +/** + * @brief StyleDialog::_readStyleElement + * @return selVec + * Fill the Gtk::TreeStore from the svg:style element. + */ +void StyleDialog::_readStyleElement() +{ + + Inkscape::XML::Node * textNode = _getStyleTextNode(); + if (textNode == NULL) { + std::cerr << "StyleDialog::_readStyleElement: No text node!" << std::endl; + } + + // Get content from style text node. + std::string content = (textNode->content() ? textNode->content() : ""); - while (invalid) { - result = textDialogPtr->run(); + // Remove end-of-lines (check it works on Windoze). + content.erase(std::remove(content.begin(), content.end(), '\n'), content.end()); + + // First split into selector/value chunks. + // An attempt to use Glib::Regex failed. A C++11 version worked but + // reportedly has problems on Windows. Using split_simple() is simpler + // and probably faster. + // + // Glib::RefPtr regex1 = + // Glib::Regex::create("([^\\{]+)\\{([^\\{]+)\\}"); + // + // Glib::MatchInfo minfo; + // regex1->match(content, minfo); + + // Split on curly brackets. Even tokens are selectors, odd are values. + std::vector tokens = Glib::Regex::split_simple("[}{]", content); + + // If text node is empty, return (avoids problem with negative below). + if (tokens.size() == 0) { + return; + } - /** - * @brief selectorName - * This string stores selector name. The text from entrybox is saved as name - * for selector. If the entrybox is empty, the text (thus selectorName) is - * set to ".Class1" - */ - _selectorName = textEditPtr->get_text(); + for (unsigned i = 0; i < tokens.size()-1; i += 2) { - del->set_sensitive(true); + Glib::ustring selector = tokens[i]; + REMOVE_SPACES(selector); // Remove leading/trailing spaces - if (_selectorName[0] == '.' || - _selectorName[0] == '#' || - SPAttributeRelSVG::isSVGElement( _selectorName ) ) { - invalid = false; + // Get list of objects selector matches + std::vector objVec = _getObjVec( selector ); + + Glib::ustring properties; + // Check to make sure we do have a value to match selector. + if ((i+1) < tokens.size()) { + properties = tokens[i+1]; } else { - textLabelPtr->show(); + std::cerr << "StyleDialog::_readStyleElement: Missing values " + "for last selector!" << std::endl; + } + REMOVE_SPACES(properties); + + Gtk::TreeModel::Row row = *(_store->append()); + row[_mColumns._colSelector] = selector; + row[_mColumns._colAddRemove] = true; + row[_mColumns._colObj] = objVec; + row[_mColumns._colProperties] = properties; + + // Add as children, objects that match selector. + for (auto& obj: objVec) { + Gtk::TreeModel::Row childrow = *(_store->append(row->children())); + childrow[_mColumns._colSelector] = "#" + Glib::ustring(obj->getId()); + childrow[_mColumns._colAddRemove] = false; + childrow[_mColumns._colObj] = std::vector(1, obj); + childrow[_mColumns._colProperties] = ""; // Unused } } +} - /** - * The selector name objects is set to the text that the user sets in the - * entrybox. If the attribute does not exist, it is - * created. In case the attribute already has a value, the new value entered - * is appended to the values. If a style attribute does not exist, it is - * created with an empty value. Also if a class selector is added, then - * class attribute for the selected object is set too. - */ - std::vector objVec; - bool objExists = false; - if (!_desktop->getSelection()->isEmpty()) { - for (auto& obj: _desktop->getSelection()->objects()) { - objExists = true; - if (!obj->getRepr()->attribute("style")) { - obj->getRepr()->setAttribute("style", NULL); - } +/** + * @brief StyleDialog::_writeStyleElement + * Update the content of the style element as selectors (or objects) are added/removed. + */ +void StyleDialog::_writeStyleElement() +{ + Glib::ustring styleContent; + for (auto& row: _store->children()) { + styleContent = styleContent + row[_mColumns._colSelector] + + " { " + row[_mColumns._colProperties] + " }\n"; + } + // We could test if styleContent is empty and then delete the style node here but there is no + // harm in keeping it around ... - if (obj->getAttribute("style") == NULL) { - _selectorValue = _selectorName + "{" + "}" + "\n"; - } - else { - _selectorValue = _selectorName + "{" - + obj->getAttribute("style") + "}" + "\n"; - } + Inkscape::XML::Node *textNode = _getStyleTextNode(); + textNode->setContent(styleContent.c_str()); - if (_selectorName[0] == '.') { - if (!obj->getRepr()->attribute("class")) { - obj->getRepr()->setAttribute("class", textEditPtr->get_text() - .erase(0,1)); +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::_writeStyleElement(): |" << styleContent << "|" << std::endl; +#endif +} + + +/** + * @brief StyleDialog::_addToSelector + * @param row + * Add selected objects on the desktop to the selector corresponding to 'row'. + */ +void StyleDialog::_addToSelector(Gtk::TreeModel::Row row) +{ +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::_addToSelector: Entrance" << std::endl; +#endif + if (*row) { + + Glib::ustring selector = row[_mColumns._colSelector]; + + if (selector[0] == '#') { + // 'id' selector... add selected object's id's to list. + Inkscape::Selection* selection = _desktop->getSelection(); + for (auto& obj: selection->objects()) { + + Glib::ustring id = (obj->getId()?obj->getId():""); + + std::vector objVec = row[_mColumns._colObj]; + bool found = false; + for (auto& obj: objVec) { + if (id == obj->getId()) { + found = true; + break; + } } - else { - obj->getRepr()->setAttribute("class", std::string(obj-> - getRepr()-> - attribute("class")) - + " " + textEditPtr->get_text() - .erase(0,1)); + + if (!found) { + // Update row + objVec.push_back(obj); // Adding to copy so need to update tree + row[_mColumns._colObj] = objVec; + row[_mColumns._colSelector] = _getIdList( objVec ); + + // Add child row + Gtk::TreeModel::Row childrow = *(_store->append(row->children())); + childrow[_mColumns._colSelector] = "#" + Glib::ustring(obj->getId()); + childrow[_mColumns._colAddRemove] = false; + childrow[_mColumns._colObj] = std::vector(1, obj); } } } - } - else { - _selectorValue = _selectorName + "{" + "}" + "\n"; - objExists = false; - } - switch (result) { - case Gtk::RESPONSE_OK: - textDialogPtr->hide(); - row[_mColumns._selectorLabel] = _selectorName; - row[_mColumns._colAddRemove] = true; - if (objExists) { + else if (selector[0] == '.') { + // 'class' selector... add value to class attribute of selected objects. + + // Get first class (split on white space or comma) + std::vector tokens = Glib::Regex::split_simple("[,\\s]+", selector); + Glib::ustring className = tokens[0]; + className.erase(0,1); + + // Get list of objects to modify Inkscape::Selection* selection = _desktop->getSelection(); - row[_mColumns._colObj] = std::vector(selection->objects() - .begin(), selection - ->objects().end()); - objVec = row[_mColumns._colObj]; + std::vector objVec( selection->objects().begin(), + selection->objects().end() ); + + _insertClass( objVec, className ); + + row[_mColumns._colObj] = _getObjVec( selector ); + + for (auto& obj: objVec) { + // Add child row + Gtk::TreeModel::Row childrow = *(_store->append(row->children())); + childrow[_mColumns._colSelector] = "#" + Glib::ustring(obj->getId()); + childrow[_mColumns._colAddRemove] = false; + childrow[_mColumns._colObj] = std::vector(1, obj); + } } - break; - default: - break; - } - /** - * A new style element is added to the document with value obtained - * from selectorValue above. If style element already exists, then - * the new selector's content is appended to its previous content. - */ - inkSelector._selector = _selectorName; - inkSelector._matchingObjs = objVec; - inkSelector._xmlContent = _selectorValue; - _selectorVec.push_back(inkSelector); - - if (_styleElementNode()) { - _styleChild = _styleElementNode(); - _updateStyleContent(); - } - else if (_styleExists && !_newDrawing) { - _updateStyleContent(); - } - else if (!_styleExists) { - Inkscape::XML::Node *root = _document->getReprDoc()->root(); - Inkscape::XML::Node *newChild = _document->getReprDoc() - ->createElement("svg:style"); - Inkscape::XML::Node *smallChildren = _document->getReprDoc() - ->createTextNode(_selectorValue.c_str()); - - newChild->appendChild(smallChildren); - Inkscape::GC::release(smallChildren); - - root->addChild(newChild, NULL); - Inkscape::GC::release(newChild); - _styleChild = newChild; + else { + // Do nothing for element selectors. + // std::cout << " Element selector... doing nothing!" << std::endl; + } } - _selAdd(row); -} -/** - * @brief StyleDialog::_updateStyleContent - * This function updates the content in style element as new selectors (or - * objects) are added/removed. - */ -void StyleDialog::_updateStyleContent() -{ - std::string styleContent = ""; - for (unsigned i = 0; i < _selectorVec.size(); ++i) { - styleContent = styleContent + _selectorVec[i]._xmlContent; - } - _styleChild->firstChild()->setContent(styleContent.c_str()); + _writeStyleElement(); } + /** - * @brief StyleDialog::_delSelector - * This function deletes selector when '-' at the bottom is clicked. The index - * of selected row is obtained and the corresponding selector and its values are - * deleted from the selector vector. If a row has no parent, it is directly - * erased from the vector along with its child rows. The style element is updated - * accordingly. + * @brief StyleDialog::_removeFromSelector + * @param row + * Remove the object corresponding to 'row' from the parent selector. */ -void StyleDialog::_delSelector() +void StyleDialog::_removeFromSelector(Gtk::TreeModel::Row row) { - Glib::RefPtr refTreeSelection = _treeView.get_selection(); - Gtk::TreeModel::iterator iter = refTreeSelection->get_selected(); - if (iter) { - Gtk::TreeModel::Row row = *iter; - std::string sel, key, value; - std::vector::iterator it; - for (it = _selectorVec.begin(); it != _selectorVec.end();) { - sel = (*it)._xmlContent; - REMOVE_SPACES(sel); - if (!sel.empty()) { - key = strtok((char*)sel.c_str(), "{"); - REMOVE_SPACES(key); - char *temp = strtok(NULL, "}"); - if (strtok(temp, "}") != NULL) { - value = strtok(temp, "}"); +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::_removeFromSelector: Entrance" << std::endl; +#endif + if (*row) { + + Glib::ustring objectLabel = row[_mColumns._colSelector]; + Gtk::TreeModel::iterator iter = row->parent(); + if (iter) { + Gtk::TreeModel::Row parent = *iter; + Glib::ustring selector = parent[_mColumns._colSelector]; + + if (selector[0] == '#') { + // 'id' selector... remove selected object's id's to list. + + // Erase from selector label. + auto i = selector.find(objectLabel); + if (i != Glib::ustring::npos) { + selector.erase(i, objectLabel.length()); + } + // Erase any comma/space + if (i != Glib::ustring::npos && selector[i] == ',') { + selector.erase(i, 1); + } + if (i != Glib::ustring::npos && selector[i] == ' ') { + selector.erase(i, 1); + } + + // Update store + if (selector.empty()) { + _store->erase(parent); + } else { + // Save new selector and update object vector. + parent[_mColumns._colSelector] = selector; + parent[_mColumns._colObj] = _getObjVec( selector ); + _store->erase(row); } } - Glib::ustring selectedRowLabel = row[_mColumns._selectorLabel]; - std::string matchSelector = selectedRowLabel; - REMOVE_SPACES(matchSelector); - if (key == matchSelector) { - it = _selectorVec.erase(it); + else if (selector[0] == '.') { + // 'class' selector... remove value to class attribute of selected objects. + + std::vector objVec = row[_mColumns._colObj]; // Just one + + // Get first class (split on white space or comma) + std::vector tokens = Glib::Regex::split_simple("[,\\s]+", selector); + Glib::ustring className = tokens[0]; + className.erase(0,1); // Erase '.' + + // Erase class name from 'class' attribute. + Glib::ustring classAttr = objVec[0]->getRepr()->attribute("class"); + auto i = classAttr.find( className ); + if (i != Glib::ustring::npos) { + classAttr.erase(i, className.length()); + } + if (i != Glib::ustring::npos && classAttr[i] == ' ') { + classAttr.erase(i, 1); + } + objVec[0]->getRepr()->setAttribute("class", classAttr); + + parent[_mColumns._colObj] = _getObjVec( selector ); _store->erase(row); } - else { - ++it; - } - /** - * The _stylechild is obtained which contains the style element and - * the content in style element is updated. If _selectorVec is - * empty, the style element is removed from the XML repr else - * the content is updated simply using _updateStyleContent(). - */ - _styleChild = _styleElementNode(); - if (_store->children().empty()) { - _document->getReprRoot()->removeChild(_styleChild); - _styleExists = false; - } else { - _updateStyleContent(); + // Do nothing for element selectors. + // std::cout << " Element selector... doing nothing!" << std::endl; } } } + + _writeStyleElement(); + } + /** - * @brief StyleDialog::_styleElementNode - * @return - * This function returns the node containing style element. The document's - * children are iterated and the repr of the style element that occurs is - * obtained. + * @brief StyleDialog::_getIdList + * @param sel + * @return This function returns a comma seperated list of ids for objects in input vector. + * It is used in creating an 'id' selector. It relies on objects having 'id's. */ -Inkscape::XML::Node* StyleDialog::_styleElementNode() +Glib::ustring StyleDialog::_getIdList(std::vector sel) { - for (unsigned i = 0; i < _document->getReprRoot()->childCount(); ++i) { - if (std::string(_document->getReprRoot()->nthChild(i)->name()) - == "svg:style") { - _styleExists = true; - _newDrawing = true; - return _document->getReprRoot()->nthChild(i); - } + Glib::ustring str; + for (auto& obj: sel) { + str += "#" + Glib::ustring(obj->getId()) + ", "; + } + if (!str.empty()) { + str.erase(str.size()-1); // Remove space at end. c++11 has pop_back() but not ustring. + str.erase(str.size()-1); // Remove comma at end. } - return NULL; + return str; } /** - * @brief StyleDialog::_setClassAttribute - * @param sel - * @return This function returns the ids of objects selected which are passed - * to entrybox. + * @brief StyleDialog::_getObjVec + * @return objVec + * Return a vector of all objects that selector matches. This only handles simple id, class, and + * element selectors. Expanding this would take integrating a true CSS parser. */ -std::string StyleDialog::_setClassAttribute(std::vector sel) -{ - std::string str = ""; - for ( unsigned i = 0; i < sel.size(); ++i ) { - SPObject *obj = sel.at(i); - str = str + "#" + std::string(obj->getId()) + " "; +std::vector StyleDialog::_getObjVec(Glib::ustring selector) { + + // Split selector string into individual selectors (which are comma separated). + std::vector tokens = Glib::Regex::split_simple("\\s*,\\s*", selector ); + + std::vector objVec; + + for (auto& token: tokens) { + + // Find objects that match class selector + if (token[0] == '.') { + token.erase(0,1); + std::vector objects = _document->getObjectsByClass( token ); + objVec.insert(objVec.end(), objects.begin(), objects.end()); + } + + // Find objects that match id selector + else if (token[0] == '#') { + token.erase(0,1); + SPObject * object = _document->getObjectById( token ); + if (object) { + objVec.push_back(object); + } + } + + // Find objects that match element selector + else { + std::vector objects = _document->getObjectsByElement( token ); + objVec.insert(objVec.end(), objects.begin(), objects.end()); + } + } - return str; + +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::_getObjVec: |" << selector << "|" << std::endl; + for (auto& obj: objVec) { + std::cout << " " << (obj->getId()?obj->getId():"null") << std::endl; + } +#endif + + return objVec; } + /** - * @brief StyleDialog::_getSelectorVec - * @return selVec - * This function returns a vector whose key is the style selector name and value - * is the style properties. All style selectors are extracted from svg:style - * element. _newDrawing is flag is set to false check if an existing drawing is - * opened. + * @brief StyleDialog::_insertClass + * @param objs: list of objects to insert class + * @param class: class to insert + * Insert a class name into objects' 'class' attribute. */ -std::vector StyleDialog::_getSelectorVec() -{ - for (unsigned i = 0; i < _document->getReprRoot()->childCount(); ++i) { - if (std::string(_document->getReprRoot()->nthChild(i)->name()) == "svg:style") { - _styleExists = true; - _newDrawing = false; - _styleChild = _document->getReprRoot()->nthChild(i); - - // Get content from first style element. - std::string content = _styleChild->firstChild()->content(); - - // Remove end-of-lines (check it works on Windoze). - content.erase(std::remove(content.begin(), content.end(), '\n'), content.end()); - - // First split into selector/value chunks. - // An attempt to use Glib::Regex failed. A C++11 version worked but - // reportedly has problems on Windows. Using split_simple() is simpler - // and probably faster. - // - // Glib::RefPtr regex1 = - // Glib::Regex::create("([^\\{]+)\\{([^\\{]+)\\}"); - // - // Glib::MatchInfo minfo; - // regex1->match(content, minfo); - - // Split on curly brackets. Even tokens are selectors, odd are values. - std::vector tokens = Glib::Regex::split_simple("[}{]", content); - - for (unsigned i = 0; i < tokens.size()-1; i += 2) { - std::string selectors = tokens[i]; - REMOVE_SPACES(selectors); // Remove leading/trailing spaces - - /** Make a list of all objects that selector matches. This is - * currently limited to simple id, class, and element selectors. - * Expanding this would take integrating a true CSS parser. - */ - std::vectorobjVec; - - // Split selector string into individual selectors (which are comma separated). - std::vector tokens2 = Glib::Regex::split_simple - ("\\s*,\\s*", selectors ); - - for(unsigned i = 0; i < tokens2.size(); ++i) { - std::string token2 = tokens2[i]; - - // Find objects that match class selector - if (token2[0] == '.') { - token2.erase(0,1); - std::vector objects = _document - ->getObjectsByClass(token2); - objVec.insert(objVec.end(), objects.begin(), objects.end()); - } +void StyleDialog::_insertClass(const std::vector& objVec, const Glib::ustring& className) { - // Find objects that match id selector - else if (token2[0] == '#') { - token2.erase(0,1); - SPObject * object = _document->getObjectById(token2); - if (object) { - objVec.push_back(object); - } - } + for (auto& obj: objVec) { - // Find objects that match element selector - else { - std::vector objects = _document-> - getObjectsByElement(token2); - objVec.insert(objVec.end(), objects.begin(), objects.end()); - } + if (!obj->getRepr()->attribute("class")) { + // 'class' attribute does not exist, create it. + obj->getRepr()->setAttribute("class", className); + } else { + // 'class' attribute exists, append. + Glib::ustring classAttr = obj->getRepr()->attribute("class"); + + // Split on white space. + std::vector tokens = Glib::Regex::split_simple("\\s+", classAttr); + bool add = true; + for (auto& token: tokens) { + if (token == className) { + add = false; // Might be useful to still add... + break; } + } + if (add) { + obj->getRepr()->setAttribute("class", classAttr + " " + className ); + } + } + } + } - std::string values; - // Check to make sure we do have a value to match selector. - if ((i+1) < tokens.size()) { - values = tokens[i+1]; - } else { - std::cerr << "StyleDialog::_getSelectorVec: Missing values " - "for last selector!" << std::endl; - } - _selectorValue = selectors + "{" + values + "}\n"; - inkSelector._selector = selectors; - inkSelector._matchingObjs = objVec; - inkSelector._xmlContent = _selectorValue; - _selectorVec.push_back(inkSelector); +/** + * @brief StyleDialog::_selectObjects + * @param eventX + * @param eventY + * This function selects objects in the drawing corresponding to the selector + * selected in the treeview. + */ +void StyleDialog::_selectObjects(int eventX, int eventY) +{ +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::_selectObjects: " << eventX << ", " << eventY << std::endl; +#endif + + _desktop->selection->clear(); + Gtk::TreeViewColumn *col = _treeView.get_column(1); + Gtk::TreeModel::Path path; + int x2 = 0; + int y2 = 0; + // To do: We should be able to do this via passing in row. + if (_treeView.get_path_at_pos(eventX, eventY, path, col, x2, y2)) { + if (col == _treeView.get_column(1)) { + Gtk::TreeModel::iterator iter = _store->get_iter(path); + if (iter) { + Gtk::TreeModel::Row row = *iter; + Gtk::TreeModel::Children children = row.children(); + std::vector objVec = row[_mColumns._colObj]; + for (unsigned i = 0; i < objVec.size(); ++i) { + SPObject *obj = objVec[i]; + _desktop->selection->add(obj); + } } } } - return _selectorVec; } + /** - * @brief StyleDialog::_populateTree - * @param _selVec - * This function populates the treeview with selectors available in the - * stylesheet. + * @brief StyleDialog::_addSelector + * + * This function opens a dialog to add a selector. The dialog is prefilled + * with an 'id' selector containing a list of the id's of selected objects + * or with a 'class' selector if no objects are selected. */ -std::string StyleDialog::_populateTree(std::vector _selVec) +void StyleDialog::_addSelector() { - _selectorVec = _selVec; - std::string selectorValue; +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::_addSelector: Entrance" << std::endl; +#endif - for(unsigned it = 0; it < _selectorVec.size(); ++it) { - Gtk::TreeModel::Row row = *(_store->append()); - row[_mColumns._selectorLabel] = _selectorVec[it]._selector; - row[_mColumns._colAddRemove] = true; - row[_mColumns._colObj] = _selectorVec[it]._matchingObjs; - std::string selValue = _selectorVec[it]._xmlContent; - selectorValue.append(selValue.c_str()); + // Store list of selected elements on desktop (not to be confused with selector). + Inkscape::Selection* selection = _desktop->getSelection(); + std::vector objVec( selection->objects().begin(), + selection->objects().end() ); + + // ==== Create popup dialog ==== + Gtk::Dialog *textDialogPtr = new Gtk::Dialog(); + textDialogPtr->add_button(_("Cancel"), Gtk::RESPONSE_CANCEL); + textDialogPtr->add_button(_("Add"), Gtk::RESPONSE_OK); + + Gtk::Entry *textEditPtr = manage ( new Gtk::Entry() ); + textDialogPtr->get_vbox()->pack_start(*textEditPtr, Gtk::PACK_SHRINK); + + Gtk::Label *textLabelPtr = manage ( new Gtk::Label( + _("Invalid entry: Not an id (#), class (.), or element CSS selector.") + ) ); + textDialogPtr->get_vbox()->pack_start(*textLabelPtr, Gtk::PACK_SHRINK); + + /** + * By default, the entrybox contains 'Class1' as text. However, if object(s) + * is(are) selected and user clicks '+' at the bottom of dialog, the + * entrybox will have the id(s) of the selected objects as text. + */ + if (_desktop->getSelection()->isEmpty()) { + textEditPtr->set_text(".Class1"); + } else { + textEditPtr->set_text(_getIdList(objVec)); } - if (_selectorVec.size() > 0) { + Gtk::Requisition sreq1, sreq2; + textDialogPtr->get_preferred_size(sreq1, sreq2); + int minWidth = 200; + int minHeight = 100; + std::cout << " preferred: " << sreq2.width << "x" << sreq2.height << std::endl; + std::cout << " minimum: " << minWidth << "x" << minHeight << std::endl; + minWidth = (sreq2.width > minWidth ? sreq2.width : minWidth ); + minHeight = (sreq2.height > minHeight ? sreq2.height : minHeight); + textDialogPtr->set_size_request(minWidth, minHeight); + textEditPtr->show(); + textLabelPtr->hide(); + textDialogPtr->show(); + + + // ==== Get response ==== + int result = -1; + bool invalid = true; + Glib::ustring selectorValue; + + while (invalid) { + result = textDialogPtr->run(); + if (result != Gtk::RESPONSE_OK) { // Cancel, close dialog, etc. + textDialogPtr->hide(); + return; + } + /** + * @brief selectorName + * This string stores selector name. The text from entrybox is saved as name + * for selector. If the entrybox is empty, the text (thus selectorName) is + * set to ".Class1" + */ + selectorValue = textEditPtr->get_text(); + del->set_sensitive(true); + + if (selectorValue[0] == '.' || + selectorValue[0] == '#' || + SPAttributeRelSVG::isSVGElement( selectorValue ) ) { + invalid = false; + } else { + textLabelPtr->show(); + } } + delete textDialogPtr; - return selectorValue; + // ==== Handle response ==== + + // If class selector, add selector name to class attribute for each object + if (selectorValue[0] == '.') { + + Glib::ustring className = selectorValue; + className.erase(0,1); + _insertClass(objVec, className); + } + + // If 'id' selector, regenerate objVec in case user modified list. + if (selectorValue[0] == '#') { + // To do + } + + // Add entry to GUI tree + Gtk::TreeModel::Row row = *(_store->append()); + row[_mColumns._colSelector] = selectorValue; + row[_mColumns._colAddRemove] = true; + row[_mColumns._colObj] = objVec; + + // Add as children objects that match selector. + for (auto& obj: objVec) { + Gtk::TreeModel::Row childrow = *(_store->append(row->children())); + childrow[_mColumns._colSelector] = "#" + Glib::ustring(obj->getId()); + childrow[_mColumns._colAddRemove] = false; + childrow[_mColumns._colObj] = std::vector(1, obj); + } + + // Add entry to style element + _writeStyleElement(); +} + +/** + * @brief StyleDialog::_delSelector + * This function deletes selector when '-' at the bottom is clicked. + * Note: If deleting a class selector, class attributes are NOT changed. + */ +void StyleDialog::_delSelector() +{ +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::_delSelector" << std::endl; +#endif + Glib::RefPtr refTreeSelection = _treeView.get_selection(); + Gtk::TreeModel::iterator iter = refTreeSelection->get_selected(); + if (iter) { + Gtk::TreeModel::Row row = *iter; + _store->erase(iter); + _writeStyleElement(); + } } /** * @brief StyleDialog::_handleButtonEvent * @param event * @return - * This function handles the event when '+' button in front of a selector name - * is clicked. The selected objects (if any) is added to the selector as a child - * in the treeview. + * Handles the event when '+' button in front of a selector name is clicked or when a '-' button in + * front of a child object is clicked. In the first case, the selected objects on the desktop (if + * any) are added as children of the selector in the treeview. In the latter case, the object + * corresponding to the row is removed from the selector. */ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) { - if (event->type == GDK_BUTTON_PRESS && event->button == 1) { +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::_handleButtonEvent: Entrance" << std::endl; +#endif + if (event->type == GDK_BUTTON_RELEASE && event->button == 1) { Gtk::TreeViewColumn *col = 0; Gtk::TreeModel::Path path; int x = static_cast(event->x); @@ -575,119 +772,16 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) int y2 = 0; if (_treeView.get_path_at_pos(x, y, path, col, x2, y2)) { if (col == _treeView.get_column(0)) { - Glib::RefPtr refTreeSelection = - _treeView.get_selection(); - Gtk::TreeModel::iterator iter = refTreeSelection-> - get_selected(); + Gtk::TreeModel::iterator iter = _store->get_iter(path); Gtk::TreeModel::Row row = *iter; - /** - * This adds child rows to selected rows. If the parent row is - * a class selector, then the class attribute of object added - * to child row is appended with class in the parent row. The - * else below deletes objects from selectors when 'delete' button - * in front of child row is clicked. The class attribute is updated - * by removing the parent row's class selector name. - */ + // Add or remove objects from a if (!row.parent()) { - _selAdd(row); - } - - else { - std::string sel, key, value; - std::vector::iterator it; - Gtk::TreeModel::Row parentRow = *(row).parent(); - Glib::ustring parentKey = parentRow[_mColumns._selectorLabel]; - - for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it) { - sel = (*it)._xmlContent; - REMOVE_SPACES(sel); - if (!sel.empty()) { - key = strtok((char*)sel.c_str(), "{"); - REMOVE_SPACES(key); - char *temp = strtok(NULL, "}"); - if (strtok(temp, "}") != NULL) { - value = strtok(temp, "}"); - } - } - - /** - * @brief matchSelector - * For id selectors, whenever any child row is deleted, - * the row label is updated and so is the entry for the - * selector in style element. - */ - std::string matchSelector = parentKey; - REMOVE_SPACES(matchSelector); - if (key == matchSelector) { - if (key[0] == '#') { - std::string s = parentKey; - Glib::ustring toDelRow = row[_mColumns._selectorLabel]; - std::string toDelKey = toDelRow; - std::size_t idFound = s.find(toDelKey); - if (idFound != std::string::npos) { - if (idFound == 0) { - s.erase(idFound, toDelKey.length()+1); - parentKey = s; - parentRow[_mColumns._selectorLabel] = parentKey; - (*it)._xmlContent.erase(idFound, toDelKey.length()); - } - else { - s.erase(idFound-2, toDelKey.length()+2); - parentKey = s; - parentRow[_mColumns._selectorLabel] = parentKey; - (*it)._xmlContent.erase(idFound-2, toDelKey. - length()+2); - } - } - } - } - - if (parentKey[0] == '.') { - std::vector objVec = row[_mColumns._colObj]; - for (unsigned i = 0; i < objVec.size(); ++i) { - SPObject *obj = objVec[i]; - std::string classAttr = std::string(obj->getRepr() - ->attribute("class")); - std::size_t found = classAttr.find(parentKey.erase(0,1)); - if (found != std::string::npos) { - classAttr.erase(found, parentKey.length()+1); - obj->getRepr()->setAttribute("class", classAttr); - } - } - } - - if (parentKey.empty()) { - (*it)._xmlContent = ""; - } - } - - if (_styleChild) { - _updateStyleContent(); - } - else { - _styleChild = _styleElementNode(); - _updateStyleContent(); - } - - _store->erase(row); - - /** - * On continuous deletion of objects (child rows) from the - * selector (parent row), if the parent row has no child, then - * the row is erased from the _store. Further if there is no - * row left in _store, which implies there is no content in - * XML style element, then the 'svg:style' element is also - * removed. - */ - if (parentKey.empty()) { - _store->erase(parentRow); - } - - if (parentKey.empty() && _store->children().empty()) { - _document->getReprRoot()->removeChild(_styleChild); - _styleExists = false; - } + // Add selected objects to selector. + _addToSelector(row); + } else { + // Remove object from selector + _removeFromSelector(row); } } } @@ -695,275 +789,129 @@ bool StyleDialog::_handleButtonEvent(GdkEventButton *event) return false; } -/** - * @brief StyleDialog::_selAdd - * @param row - * This routine is called when an object is added to a selector by clicking on - * '+' in front of the row with selector's label. - */ -void StyleDialog::_selAdd(Gtk::TreeModel::Row row) -{ - Glib::ustring selectorName; - Gtk::TreeModel::Row childrow; - Inkscape::Selection* selection = _desktop->getSelection(); - std::vector sel = std::vector - (selection->objects().begin(), selection->objects().end()); - for (auto& obj: selection->objects()) { - if (*row) { - if (_selectorVec.size() != 0) { - childrow = *(_store->append(row->children())); - childrow[_mColumns._selectorLabel] = "#" + - std::string(obj->getId()); - childrow[_mColumns._colAddRemove] = false; - childrow[_mColumns._colObj] = sel; - Glib::ustring key = row[_mColumns._selectorLabel]; - if (key[0] == '.') { - if (!obj->getRepr()->attribute("class")) { - obj->setAttribute("class", key.erase(0,1)); - } - else { - if (obj->getRepr()->attribute("class") != key - .erase(0,1)) { - obj->setAttribute("class", std::string - (obj->getRepr()-> - attribute("class")) - + " " + key - .erase(0,1)); - } - } - } - } - selectorName = row[_mColumns._selectorLabel]; - } - - /** - * If the object's parent row is a class selector, then - * there are no changes in style element except the class - * attribute is updated. For the id selector cases, XML - * content's style element is updated. - */ - REMOVE_SPACES(selectorName); - std::vector::iterator it; - for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it) { - std::string sel, key, value; - sel = (*it)._xmlContent; - REMOVE_SPACES(sel); - if (!sel.empty()) { - key = strtok((char*)sel.c_str(), "{"); - REMOVE_SPACES(key); - char *temp = strtok(NULL, "}"); - if (strtok(temp, "}") != NULL) { - value = strtok(temp, "}"); - } - } - - Glib::ustring selectedRowLabel = row[_mColumns._selectorLabel]; - std::string matchSelector = selectedRowLabel; - REMOVE_SPACES(matchSelector); - if (key == matchSelector) { - REMOVE_SPACES((*it)._selector); - if (selectorName[0] == '#') { - if ("#" + std::string(obj->getId()) != selectorName) { - inkSelector._selector = (*it)._selector; - inkSelector._selector.append(", #" + std::string(obj->getId())); - inkSelector._xmlContent = inkSelector._selector + "{" + value + "}\n"; - row[_mColumns._selectorLabel] = selectorName + ", " + - childrow[_mColumns._selectorLabel]; - } - } - else if (selectorName[0] == '.') { - inkSelector._xmlContent = (*it)._selector + "{" + value + "}\n"; - } - - it = _selectorVec.erase(it); - it = _selectorVec.insert(it, inkSelector); - } - } - } - if (_styleElementNode()) { - _styleChild = _styleElementNode(); - _updateStyleContent(); - } - else if (_styleExists && !_newDrawing) { - _updateStyleContent(); - } -} /** - * @brief StyleDialog::_selectObjects + * @brief StyleDialog::_buttonEventsSelectObjs * @param event - * This function detects single or double click on a selector in any row. Single - * click on a selector selects the matching objects. A double click on any - * selector selects the matching objects as well as will open CSS dialog. It - * calls _selectObjects to add objects to selection. + * This function detects single or double click on a selector in any row. Clicking + * on a selector selects the matching objects on the desktop. A double click will + * in addition open the CSS dialog. */ void StyleDialog::_buttonEventsSelectObjs(GdkEventButton* event ) { - if (event->type == GDK_BUTTON_PRESS && event->button == 1) { - int x = static_cast(event->x); - int y = static_cast(event->y); - _selectObjects(x, y); - } - else if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::_buttonEventsSelectObjs" << std::endl; +#endif + _updating = true; + + if (event->type == GDK_BUTTON_RELEASE && event->button == 1) { int x = static_cast(event->x); int y = static_cast(event->y); _selectObjects(x, y); + //} + //else if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { + //int x = static_cast(event->x); + //int y = static_cast(event->y); + //_selectObjects(x, y); - //Open CSS dialog here. - if (!_cssPane->get_visible()) { - _paned.pack2(*_cssPane, Gtk::SHRINK); - _cssPane->show_all(); - } + _cssPane->_store->clear(); + // This should probably be in a member function of CSSDialog. Glib::RefPtr refTreeSelection = _treeView.get_selection(); Gtk::TreeModel::iterator iter = refTreeSelection->get_selected(); if (iter) { Gtk::TreeModel::Row row = *iter; - std::string sel, key, value; - std::vector::iterator it; - for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it) { - sel = (*it)._xmlContent; - REMOVE_SPACES(sel); - if (!sel.empty()) { - key = strtok((char*)sel.c_str(), "{"); - REMOVE_SPACES(key); - char *temp = strtok(NULL, "}"); - if (strtok(temp, "}") != NULL) { - value = strtok(temp, "}"); - } + Glib::ustring properties = row[_mColumns._colProperties]; + REMOVE_SPACES(properties); // Remove leading/trailing spaces + + std::vector tokens = + Glib::Regex::split_simple("\\s*;\\s*", properties); + for (auto& token: tokens) { + if (!token.empty()) { + _cssPane->_propRow = *(_cssPane->_store->append()); + _cssPane->_propRow[_cssPane->_cssColumns._colUnsetProp] = false; + _cssPane->_propRow[_cssPane->_cssColumns._propertyLabel] = token; } + } + } + } + _updating = false; +} - Glib::ustring selectedRowLabel = row[_mColumns._selectorLabel]; - std::string matchSelector = selectedRowLabel; - REMOVE_SPACES(matchSelector); - - if (key == matchSelector) { - _cssPane->_store->clear(); - std::stringstream ss(value); - std::string token; - std::size_t found = value.find(";"); - if (found!=std::string::npos) { - while(std::getline(ss, token, ';')) { - REMOVE_SPACES(token); - if (!token.empty()) { - _cssPane->_propRow = *(_cssPane->_store->append()); - _cssPane->_propRow[_cssPane->_cssColumns._colUnsetProp] = false; - _cssPane->_propRow[_cssPane->_cssColumns._propertyLabel] = token; - _cssPane->_propCol->add_attribute(_cssPane->_textRenderer - ->property_text(), - _cssPane->_cssColumns - ._propertyLabel); - } - } - } + +/** + * @brief StyleDialog::_selectRow + * This function selects the row in treeview corresponding to an object selected + * in the drawing. If more than one row matches, the first is chosen. + */ +void StyleDialog::_selectRow(Selection */*sel*/) +{ + if (_updating) return; // Avoid updating if we have set row via dialog. + + Inkscape::Selection* selection = _desktop->getSelection(); + if (!selection->isEmpty()) { + SPObject *obj = selection->objects().back(); + + Gtk::TreeModel::Children children = _store->children(); + for(Gtk::TreeModel::Children::iterator iter = children.begin(); + iter != children.end(); ++iter) { + + Gtk::TreeModel::Row row = *iter; + std::vector objVec = row[_mColumns._colObj]; + for (unsigned i = 0; i < objVec.size(); ++i) { + if (obj->getId() == objVec[i]->getId()) { + _treeView.get_selection()->select(row); + return; } } } - else { - _cssPane->_store->clear(); - _cssPane->hide(); - } - - _cssPane->_textRenderer->signal_edited().connect(sigc::mem_fun(*this, - &StyleDialog:: - _handleEdited)); - _cssPane->_treeView.signal_button_press_event().connect(sigc::mem_fun - (*this, &StyleDialog:: - _delProperty), - false); } + + // Selection empty or no row matches. + _treeView.get_selection()->unselect_all(); } + /** * @brief StyleDialog::_selChanged - * When no row in _treeView of Style Dialog is selected, the _cssPane is hidden. */ void StyleDialog::_selChanged() { - if (_treeView.get_selection()->count_selected_rows() == 0) { - _cssPane->hide(); - } +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::_selChanged" << std::endl; +#endif } /** * @brief StyleDialog::_handleEdited * @param path * @param new_text - * This function edits CSS properties of the selector chosen. new_text is used - * to update the property in XML repr. The value from selected selector is - * obtained and modified as per value of new_text. If a new property is added, - * value is appended with new_text. Later _updateStyleContent() is called to - * update XML repr and hence changes are reflected in the drawing too. + * Update trees when new text is entered into a CSS dialog row. */ void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& new_text) { +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::_handleEdited: path: " << path + << " new_text: " << new_text << std::endl; +#endif + Gtk::TreeModel::iterator iterCss = _cssPane->_treeView.get_model()->get_iter(path); if (iterCss) { Gtk::TreeModel::Row row = *iterCss; row[_cssPane->_cssColumns._propertyLabel] = new_text; - _cssPane->_editedProp = new_text; } - // Selected selector row is obtained here to get corresponding key and value. + Glib::ustring properties; + for (auto& crow: _cssPane->_store->children()) { + properties = properties + crow[_cssPane->_cssColumns._propertyLabel] + "; "; + } + + // Update selector data. Glib::RefPtr refTreeSelection = _treeView.get_selection(); Gtk::TreeModel::iterator iter = refTreeSelection->get_selected(); if (iter) { Gtk::TreeModel::Row row = *iter; - std::string sel, key, value; - std::vector::iterator it; - for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it) { - sel = (*it)._xmlContent; - REMOVE_SPACES(sel); - if (!sel.empty()) { - key = strtok((char*)sel.c_str(), "{"); - REMOVE_SPACES(key); - char *temp = strtok(NULL, "}"); - if (strtok(temp, "}") != NULL) { - value = strtok(temp, "}"); - } - } - - Glib::ustring selectedRowLabel = row[_mColumns._selectorLabel]; - std::string matchSelector = selectedRowLabel; - REMOVE_SPACES(matchSelector); - - if (key == matchSelector) { - /** If a new property is added, existing value is appended with new - * property, else replacements in value are done in the 'else' block. - */ - if (_cssPane->_newProperty) { - if (!new_text.empty()) { - value.append((new_text + ";").c_str()); - _cssPane->_propCol->add_attribute(_cssPane->_textRenderer - ->property_text(), - _cssPane->_cssColumns - ._propertyLabel); - _cssPane->_newProperty = false; - } - } - else { - std::stringstream ss(value); - std::string token, editedToken; - std::size_t found = value.find(";"); - if (found!=std::string::npos) { - while(std::getline(ss, token, ';')) { - REMOVE_SPACES(token); - if (!token.empty()) { - if (token.substr(0, token.find(":")) == _cssPane - ->_editedProp.substr(0, _cssPane->_editedProp - .find(":"))) { - editedToken = _cssPane->_editedProp; - size_t startPos = value.find(token); - value.replace(startPos, token.length(), editedToken); - } - } - } - } - } - value.erase(std::remove(value.begin(), value.end(), '\n'), value.end()); - (*it)._xmlContent = key + "{" + value + "}\n"; - _updateStyleContent(); - } - } + row[_mColumns._colProperties] = properties; + _writeStyleElement(); } } @@ -971,14 +919,15 @@ void StyleDialog::_handleEdited(const Glib::ustring& path, const Glib::ustring& * @brief StyleDialog::_delProperty * @param event * @return - * This function deletes property when '-' in front of property in CSS panel is - * clicked. The property row is deleted from CSS panel and XML repr is updated. - * toDelProperty is the property to be deleted which is looked in 'value' and is - * erased from 'value'. + * Delete a property from the CSS dialog and then update trees. */ bool StyleDialog::_delProperty(GdkEventButton *event) { - if (event->type == GDK_BUTTON_PRESS && event->button == 1) { +#ifdef DEBUG_STYLEDIALOG + std::cout << "StyleDialog::_delProperty" << std::endl; +#endif + + if (event->type == GDK_BUTTON_RELEASE && event->button == 1) { Gtk::TreeViewColumn *col = 0; Gtk::TreeModel::Path path; int x = static_cast(event->x); @@ -989,45 +938,23 @@ bool StyleDialog::_delProperty(GdkEventButton *event) Glib::ustring toDelProperty; if (_cssPane->_treeView.get_path_at_pos(x, y, path, col, x2, y2)) { if (col == _cssPane->_treeView.get_column(0)) { - Gtk::TreeModel::iterator cssIter = _cssPane->_treeView.get_selection() - ->get_selected(); + Gtk::TreeModel::iterator cssIter = + _cssPane->_treeView.get_selection()->get_selected(); if (cssIter) { - cssRow = *cssIter; - toDelProperty = cssRow[_cssPane->_cssColumns._propertyLabel]; - } + _cssPane->_store->erase(cssIter); + + Glib::ustring properties; + for (auto& crow: _cssPane->_store->children()) { + properties = properties + crow[_cssPane->_cssColumns._propertyLabel] + "; "; + } - Gtk::TreeModel::iterator iter = _treeView.get_selection()->get_selected(); - if (iter) { - Gtk::TreeModel::Row row = *iter; - std::string sel, key, value; - std::vector::iterator it; - for (it = _selectorVec.begin(); it != _selectorVec.end(); ++it) { - sel = (*it)._xmlContent; - REMOVE_SPACES(sel); - if (!sel.empty()) { - key = strtok((char*)sel.c_str(), "{"); - REMOVE_SPACES(key); - char *temp = strtok(NULL, "}"); - if (strtok(temp, "}") != NULL) { - value = strtok(temp, "}"); - } - } - - Glib::ustring selectedRowLabel = row[_mColumns._selectorLabel]; - std::string matchSelector = selectedRowLabel; - REMOVE_SPACES(matchSelector); - - if (key == matchSelector) { - std::size_t found = value.find(toDelProperty); - if (found!=std::string::npos) { - if (!toDelProperty.empty()) { - value.erase(found, toDelProperty.length()+1); - (*it)._xmlContent = key + "{" + value + "}\n"; - _updateStyleContent(); - _cssPane->_store->erase(cssRow); - } - } - } + // Update selector data. + Glib::RefPtr refTreeSelection = _treeView.get_selection(); + Gtk::TreeModel::iterator iter = refTreeSelection->get_selected(); + if (iter) { + Gtk::TreeModel::Row row = *iter; + row[_mColumns._colProperties] = properties; + _writeStyleElement(); } } } @@ -1036,98 +963,24 @@ bool StyleDialog::_delProperty(GdkEventButton *event) return false; } -/** - * @brief StyleDialog::_selectObjects - * @param eventX - * @param eventY - * This function selects objects in the drawing corresponding to the selector - * selected in the treeview. - */ -void StyleDialog::_selectObjects(int eventX, int eventY) -{ - _desktop->selection->clear(); - Gtk::TreeViewColumn *col = _treeView.get_column(1); - Gtk::TreeModel::Path path; - int x = eventX; - int y = eventY; - int x2 = 0; - int y2 = 0; - if (_treeView.get_path_at_pos(x, y, path, col, x2, y2)) { - if (col == _treeView.get_column(1)) { - Gtk::TreeModel::iterator iter = _store->get_iter(path); - if (iter) { - Gtk::TreeModel::Row row = *iter; - Gtk::TreeModel::Children children = row.children(); - std::vector objVec = row[_mColumns._colObj]; - for (unsigned i = 0; i < objVec.size(); ++i) { - SPObject *obj = objVec[i]; - _desktop->selection->add(obj); - } - if (children) { - _checkAllChildren(children); - } - } - } - } -} /** - * @brief StyleDialog::_checkAllChildren - * @param children - * This function iterates children of the row selected in treeview and selects - * the objects corresponding to any selector in child rows. + * @brief StyleDialog::_styleButton + * @param btn + * @param iconName + * @param tooltip + * Set the style of '+' and '-' buttons at the bottom of dialog. */ -void StyleDialog::_checkAllChildren(Gtk::TreeModel::Children& children) +void StyleDialog::_styleButton(Gtk::Button& btn, char const* iconName, + char const* tooltip) { - for (Gtk::TreeModel::Children::iterator iter = children.begin(); - iter!= children.end(); ++iter) { - Gtk::TreeModel::Row childrow = *iter; - std::vector objVec = childrow[_mColumns._colObj]; - for (unsigned i = 0; i < objVec.size(); ++i) { - SPObject *obj = objVec[i]; - _desktop->selection->add(obj); - } - } + GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); + gtk_widget_show(child); + btn.add(*manage(Glib::wrap(child))); + btn.set_relief(Gtk::RELIEF_NONE); + btn.set_tooltip_text (tooltip); } -/** - * @brief StyleDialog::_selectRow - * This function selects the rows in treeview corresponding to an object selected - * in the drawing. - */ -void StyleDialog::_selectRow(Selection */*sel*/) -{ - SPObject *obj = NULL; - if (!_desktop->selection->isEmpty()) { - Inkscape::Selection* selection = _desktop->getSelection(); - std::vector selected = std::vector - (selection->objects().begin(), selection->objects().end()); - obj = selected.back(); - } - - /** - * If obj has some SPObject, then it is added to desktop's selection. If a - * row in treeview has children, those rows are checked too against selected - * object's id. If an object which is not present in any selector is selected, - * the treeview's selections are unselected. - */ - if (obj != NULL) { - Gtk::TreeModel::Children children = _store->children(); - for(Gtk::TreeModel::Children::iterator iter = children.begin(); - iter != children.end(); ++iter) { - Gtk::TreeModel::Row row = *iter; - std::vector objVec = row[_mColumns._colObj]; - for (unsigned i = 0; i < objVec.size(); ++i) { - if (obj->getId() == objVec[i]->getId()) { - _treeView.get_selection()->select(row); - } - } - } - } - else { - _treeView.get_selection()->unselect_all(); - } -} } // namespace Dialog } // namespace UI diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index 3cc4349e6..37a186e40 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -3,8 +3,10 @@ */ /* Authors: * Kamalpreet Kaur Grewal + * Tavmjong Bah * * Copyright (C) Kamalpreet Kaur Grewal 2016 + * Copyright (C) Tavmjong Bah 2017 * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -33,11 +35,12 @@ namespace Dialog { * A list of CSS selectors will show up in this dialog. This dialog allows one to * add and delete selectors. Elements can be added to and removed from the selectors * in the dialog. Selection of any selector row selects the matching objects in - * the drawing and vice-versa. + * the drawing and vice-versa. (Only simple selectors supported for now.) + * + * This class must keep two things in sync: + * 1. The text node of the style element. + * 2. The Gtk::TreeModel. */ -typedef std::pair >, std::string> -_selectorVecType; - class StyleDialog : public Widget::Panel { public: @@ -45,75 +48,75 @@ public: ~StyleDialog(); static StyleDialog &getInstance() { return *new StyleDialog(); } + void setDesktop(SPDesktop* desktop); private: - void _styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip); - std::string _setClassAttribute(std::vector); - class InkSelector { - public: - std::string _selector; - std::vector _matchingObjs; - std::string _xmlContent; - }; - - InkSelector inkSelector; - std::vector _selectorVec; - std::vector _getSelectorVec(); - std::string _populateTree(std::vector); - bool _handleButtonEvent(GdkEventButton *event); - void _buttonEventsSelectObjs(GdkEventButton *event); - void _selectObjects(int, int); - void _checkAllChildren(Gtk::TreeModel::Children& children); - Inkscape::XML::Node *_styleElementNode(); - void _updateStyleContent(); - void _selectRow(Selection *); - - class ModelColumns : public Gtk::TreeModel::ColumnRecord - { + // Data structure + class ModelColumns : public Gtk::TreeModel::ColumnRecord { public: ModelColumns() { - add(_selectorLabel); + add(_colSelector); add(_colAddRemove); add(_colObj); + add(_colProperties); } - Gtk::TreeModelColumn _selectorLabel; - Gtk::TreeModelColumn _colAddRemove; - Gtk::TreeModelColumn > _colObj; + Gtk::TreeModelColumn _colSelector; // Selector or matching object id. + Gtk::TreeModelColumn _colAddRemove; // Selector row or child object row. + Gtk::TreeModelColumn > _colObj; // List of matching objects. + Gtk::TreeModelColumn _colProperties; // List of properties. }; - - SPDesktop* _desktop; - SPDesktop* _targetDesktop; ModelColumns _mColumns; + + // TreeView + Gtk::TreeView _treeView; + Glib::RefPtr _store; + + // Widgets Gtk::VPaned _paned; Gtk::VBox _mainBox; Gtk::HBox _buttonBox; - Gtk::TreeView _treeView; - Glib::RefPtr _store; Gtk::ScrolledWindow _scrolledWindow; Gtk::Button* del; Gtk::Button* create; - SPDocument* _document; - bool _styleExists; - Inkscape::XML::Node *_styleChild; - std::string _selectorName; - std::string _selectorValue; - bool _newDrawing; CssDialog *_cssPane; - void _selAdd(Gtk::TreeModel::Row row); + + // Variables - Inkscape + SPDesktop* _desktop; // To do: use panel _desktop + SPDocument* _document; + bool _updating; + + // Reading and writing the style element. + Inkscape::XML::Node *_getStyleTextNode(); + void _readStyleElement(); + void _writeStyleElement(); + + // Manipulate Tree + void _addToSelector(Gtk::TreeModel::Row row); + void _removeFromSelector(Gtk::TreeModel::Row row); + Glib::ustring _getIdList(std::vector); + std::vector _getObjVec(Glib::ustring selector); + void _insertClass(const std::vector& objVec, const Glib::ustring& className); + void _selectObjects(int, int); // Signal handlers void _addSelector(); void _delSelector(); + bool _handleButtonEvent(GdkEventButton *event); + void _buttonEventsSelectObjs(GdkEventButton *event); + void _selectRow(Selection *); // Select row in tree when selection changed. void _selChanged(); - // Signal handler for CssDialog + // Signal handlers for CssDialog void _handleEdited(const Glib::ustring& path, const Glib::ustring& new_text); bool _delProperty(GdkEventButton *event); + + // GUI + void _styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip); }; -} // namespace Dialog +} // namespace Dialogc } // namespace UI } // namespace Inkscape -- cgit v1.2.3 From 7494443a3f6c759f615e4e98676c0ed027e3ad47 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 18 Feb 2017 09:42:01 +0100 Subject: Implement Undo. Respond to external changes to