diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-07-01 02:03:38 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-07-01 02:03:38 +0000 |
| commit | 0d5bb885dee83f041830dc950d3be6f21a37f08b (patch) | |
| tree | 88a0ae7a15ed496ddad1f83f43547783b88843ac /src/ui/dialog | |
| parent | Bug fixes (diff) | |
| parent | Add Mac CI build config (diff) | |
| download | inkscape-0d5bb885dee83f041830dc950d3be6f21a37f08b.tar.gz inkscape-0d5bb885dee83f041830dc950d3be6f21a37f08b.zip | |
update to trunk
Diffstat (limited to 'src/ui/dialog')
37 files changed, 616 insertions, 203 deletions
diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index 805bfb562..9b99dde6b 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -107,8 +107,21 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) { g_strdup_printf("<small>Inkscape %s</small>", Inkscape::version_string); label->set_markup(label_text); + +#if WITH_GTKMM_3_10 + label->set_halign(Gtk::ALIGN_END); + label->set_valign(Gtk::ALIGN_CENTER); +#else label->set_alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER); +#endif + +#if WITH_GTKMM_3_12 + label->set_margin_start(5); + label->set_margin_end(5); +#else label->set_padding(5,0); +#endif + g_free(label_text); label->set_selectable(true); label->show(); @@ -118,8 +131,22 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) { "<a href=\"https://www.inkscape.org\">https://www.inkscape.org</a>"; link->set_markup(website_link); + +#if WITH_GTKMM_3_10 + link->set_halign(Gtk::ALIGN_END); +#else link->set_alignment(Gtk::ALIGN_END); +#endif + +#if WITH_GTKMM_3_12 + label->set_margin_start(5); + label->set_margin_end(5); + label->set_margin_top(5); + label->set_margin_bottom(5); +#else link->set_padding(5,5); +#endif + link->set_selectable(true); link->show(); diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 1c88fc849..27bfa681f 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -41,7 +41,6 @@ #include "ui/tool/multi-path-manipulator.h" #include "ui/tool/control-point-selection.h" #include "verbs.h" -#include "widgets/icon.h" #include "sp-root.h" #include "document-undo.h" #include "desktop.h" @@ -64,7 +63,8 @@ Action::Action(const Glib::ustring &id, _id(id), _parent(parent) { - Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( _id, Inkscape::ICON_SIZE_LARGE_TOOLBAR) ); + Gtk::Image* pIcon = Gtk::manage(new Gtk::Image()); + pIcon->set_from_icon_name( _id, Gtk::ICON_SIZE_LARGE_TOOLBAR); Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); pButton->set_relief(Gtk::RELIEF_NONE); pIcon->show(); diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index 3cdcf594a..cef3c0c71 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -49,7 +49,6 @@ #include "ui/widget/spinbutton.h" #include "unclump.h" #include "verbs.h" -#include "widgets/icon.h" using Inkscape::DocumentUndo; using Inkscape::Util::unit_table; @@ -2678,7 +2677,7 @@ GtkWidget * CloneTiler::table_x_y_rand(int values) auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); - GtkWidget *i = sp_icon_new (Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON("object-rows")); + GtkWidget *i = gtk_image_new_from_icon_name (INKSCAPE_ICON("object-rows"), GTK_ICON_SIZE_MENU); gtk_box_pack_start (GTK_BOX (hb), i, FALSE, FALSE, 2); GtkWidget *l = gtk_label_new (""); @@ -2692,7 +2691,7 @@ GtkWidget * CloneTiler::table_x_y_rand(int values) auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); - GtkWidget *i = sp_icon_new (Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON("object-columns")); + GtkWidget *i = gtk_image_new_from_icon_name (INKSCAPE_ICON("object-columns"), GTK_ICON_SIZE_MENU); gtk_box_pack_start (GTK_BOX (hb), i, FALSE, FALSE, 2); GtkWidget *l = gtk_label_new (""); diff --git a/src/ui/dialog/cssdialog.cpp b/src/ui/dialog/cssdialog.cpp index 85c804b75..0443d7c44 100644 --- a/src/ui/dialog/cssdialog.cpp +++ b/src/ui/dialog/cssdialog.cpp @@ -13,7 +13,6 @@ #include "cssdialog.h" #include "ui/widget/addtoicon.h" -#include "widgets/icon.h" #include "verbs.h" #include "sp-object.h" #include "selection.h" @@ -122,7 +121,7 @@ void CssDialog::setDesktop(SPDesktop* desktop) void CssDialog::_styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip) { - GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); + GtkWidget *child = gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_show(child); btn.add(*manage(Glib::wrap(child))); btn.set_relief(Gtk::RELIEF_NONE); diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 01cd9dd0f..c5392864d 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -26,6 +26,7 @@ #include "ui/dialog/extension-editor.h" #include "ui/dialog/fill-and-stroke.h" #include "ui/dialog/filter-effects-dialog.h" +#include "ui/dialog/filter-editor.h" #include "ui/dialog/find.h" #include "ui/dialog/glyphs.h" #include "ui/dialog/inkscape-preferences.h" @@ -113,6 +114,7 @@ DialogManager::DialogManager() { registerFactory("ExtensionEditor", &create<ExtensionEditor, FloatingBehavior>); registerFactory("FillAndStroke", &create<FillAndStroke, FloatingBehavior>); registerFactory("FilterEffectsDialog", &create<FilterEffectsDialog, FloatingBehavior>); + registerFactory("FilterEditorDialog", &create<FilterEditorDialog, FloatingBehavior>); registerFactory("Find", &create<Find, FloatingBehavior>); registerFactory("Glyphs", &create<GlyphsPanel, FloatingBehavior>); registerFactory("IconPreviewPanel", &create<IconPreviewPanel, FloatingBehavior>); @@ -155,6 +157,7 @@ DialogManager::DialogManager() { registerFactory("ExtensionEditor", &create<ExtensionEditor, DockBehavior>); registerFactory("FillAndStroke", &create<FillAndStroke, DockBehavior>); registerFactory("FilterEffectsDialog", &create<FilterEffectsDialog, DockBehavior>); + registerFactory("FilterEditorDialog", &create<FilterEditorDialog, DockBehavior>); registerFactory("Find", &create<Find, DockBehavior>); registerFactory("Glyphs", &create<GlyphsPanel, DockBehavior>); registerFactory("IconPreviewPanel", &create<IconPreviewPanel, DockBehavior>); diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 27a6e55d9..39c913175 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -19,6 +19,11 @@ #include "dialog-manager.h" #include <gtkmm/dialog.h> + +#if WITH_GTKMM_3_22 +# include <gdkmm/monitor.h> +#endif + #include <gdk/gdkkeysyms.h> #include "inkscape.h" @@ -161,10 +166,23 @@ void Dialog::read_geometry() resize(w, h); } +#if WITH_GTKMM_3_22 + auto const display = Gdk::Display::get_default(); + auto const monitor = display->get_primary_monitor(); + + Gdk::Rectangle screen_geometry; + monitor->get_geometry(screen_geometry); + auto const screen_width = screen_geometry.get_width(); + auto const screen_height = screen_geometry.get_height(); +#else + auto const screen_width = gdk_screen_width(); + auto const screen_height = gdk_screen_width(); +#endif + // If there are stored values for where the dialog should be // located, then restore the dialog to that position. // also check if (x,y) is actually onscreen with the current screen dimensions - if ( (x >= 0) && (y >= 0) && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE)) ) { + if ( (x >= 0) && (y >= 0) && (x < (screen_width-MIN_ONSCREEN_DISTANCE)) && (y < (screen_height-MIN_ONSCREEN_DISTANCE)) ) { move(x, y); } else { // ...otherwise just put it in the middle of the screen diff --git a/src/ui/dialog/dock-behavior.cpp b/src/ui/dialog/dock-behavior.cpp index 02955b9a8..0c8bb3194 100644 --- a/src/ui/dialog/dock-behavior.cpp +++ b/src/ui/dialog/dock-behavior.cpp @@ -19,7 +19,6 @@ #include "inkscape.h" #include "desktop.h" #include "ui/interface.h" -#include "widgets/icon.h" #include "ui/widget/dock.h" #include "verbs.h" #include "dialog.h" @@ -40,9 +39,9 @@ DockBehavior::DockBehavior(Dialog &dialog) : static_cast<Widget::DockItem::State>( Inkscape::Preferences::get()->getInt(_dialog._prefs_path + "/state", UI::Widget::DockItem::DOCKED_STATE)), - static_cast<Widget::DockItem::Placement>( + static_cast<GdlDockPlacement>( Inkscape::Preferences::get()->getInt(_dialog._prefs_path + "/placement", - UI::Widget::DockItem::TOP))) + GDL_DOCK_TOP))) { // Connect signals diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 8593223c1..1b074bb0c 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -34,7 +34,6 @@ #include "ui/tools-switch.h" #include "ui/dialog/filedialog.h" #include "verbs.h" -#include "widgets/icon.h" #include "xml/node-event-vector.h" #include "rdf.h" @@ -74,7 +73,7 @@ static Inkscape::XML::NodeEventVector const _repr_events = { static void docprops_style_button(Gtk::Button& btn, char const* iconName) { - GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); + GtkWidget *child = gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_show( child ); btn.add(*Gtk::manage(Glib::wrap(child))); btn.set_relief(Gtk::RELIEF_NONE); @@ -1429,8 +1428,10 @@ DocumentProperties::_createPageTabLabel(const Glib::ustring& label, const char * { Gtk::HBox *_tab_label_box = Gtk::manage(new Gtk::HBox(false, 0)); _tab_label_box->set_spacing(4); - _tab_label_box->pack_start(*Glib::wrap(sp_icon_new(Inkscape::ICON_SIZE_DECORATION, - label_image))); + + auto img = Gtk::manage(new Gtk::Image()); + img->set_from_icon_name(label_image, Gtk::ICON_SIZE_MENU); + _tab_label_box->pack_start(*img); Gtk::Label *_tab_label = Gtk::manage(new Gtk::Label(label, true)); _tab_label_box->pack_start(*_tab_label); diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 1bb952de4..b1b1cc291 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -54,6 +54,7 @@ #include "extension/db.h" #include "io/sys.h" +#include "io/resource.h" #include "helper/png-write.h" @@ -564,7 +565,7 @@ Glib::ustring Export::create_filepath_from_id (Glib::ustring id, const Glib::ust } if (directory.empty()) { - directory = INKSCAPE.homedir_path(NULL); + directory = Inkscape::IO::Resource::homedir_path(NULL); } Glib::ustring filename = Glib::build_filename(directory, id+".png"); diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 92e9ce834..b69e9ce97 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -27,6 +27,7 @@ #include "ui/dialog-events.h" #include "ui/interface.h" #include "io/sys.h" +#include "io/resource.h" #include "path-prefix.h" #include "preferences.h" @@ -1038,13 +1039,12 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk(Gtk::Window &parentWindow, const Gl } // allow easy access to the user's own templates folder - gchar *templates = Inkscape::Application::profile_path("templates"); + using namespace Inkscape::IO::Resource; + char const *templates = Inkscape::IO::Resource::get_path(USER, TEMPLATES); if (Inkscape::IO::file_test(templates, G_FILE_TEST_EXISTS) && Inkscape::IO::file_test(templates, G_FILE_TEST_IS_DIR) && g_path_is_absolute(templates)) { add_shortcut_folder(templates); } - g_free(templates); - // if (extension == NULL) // checkbox.set_sensitive(FALSE); diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index 0b3b468e9..b271c951b 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -28,7 +28,6 @@ #include "ui/icon-names.h" #include "verbs.h" #include "widgets/fill-style.h" -#include "widgets/icon.h" #include "widgets/paint-selector.h" #include "widgets/stroke-style.h" @@ -173,8 +172,10 @@ Gtk::HBox& FillAndStroke::_createPageTabLabel(const Glib::ustring& label, const char *label_image) { Gtk::HBox *_tab_label_box = Gtk::manage(new Gtk::HBox(false, 4)); - _tab_label_box->pack_start(*Glib::wrap(sp_icon_new(Inkscape::ICON_SIZE_DECORATION, - label_image))); + + auto img = Gtk::manage(new Gtk::Image()); + img->set_from_icon_name(label_image, Gtk::ICON_SIZE_MENU); + _tab_label_box->pack_start(*img); Gtk::Label *_tab_label = Gtk::manage(new Gtk::Label(label, true)); _tab_label_box->pack_start(*_tab_label); diff --git a/src/ui/dialog/filter-editor.cpp b/src/ui/dialog/filter-editor.cpp new file mode 100644 index 000000000..730f8175c --- /dev/null +++ b/src/ui/dialog/filter-editor.cpp @@ -0,0 +1,128 @@ +/** + * @file + * Filter Effects dialog. + */ +/* Authors: + * Marc Jeanmougin + * + * Copyright (C) 2017 Authors + * + * Released under GNU GPL. Read the file 'COPYING' for more information. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "dialog-manager.h" + +#include <gdkmm/display.h> +#if GTK_CHECK_VERSION(3, 20, 0) +# include <gdkmm/seat.h> +#else +# include <gdkmm/devicemanager.h> +#endif + +#include "ui/widget/spinbutton.h" + +#include <glibmm/i18n.h> +#include <glibmm/stringutils.h> +#include <glibmm/main.h> +#include <glibmm/convert.h> +#include <glibmm/error.h> + +#include "desktop.h" + +#include "document.h" +#include "document-undo.h" +#include "filter-chemistry.h" +#include "filter-editor.h" +#include "filter-enums.h" +#include "inkscape.h" +#include "filters/blend.h" +#include "filters/colormatrix.h" +#include "filters/componenttransfer.h" +#include "filters/componenttransfer-funcnode.h" +#include "filters/convolvematrix.h" +#include "filters/distantlight.h" +#include "filters/merge.h" +#include "filters/mergenode.h" +#include "filters/pointlight.h" +#include "filters/spotlight.h" + +#include "style.h" +#include "svg/svg-color.h" +#include "ui/dialog/filedialog.h" +#include "verbs.h" + +#include "io/sys.h" +#include "io/resource.h" +#include "selection-chemistry.h" + +#include <string> + +#include <gtkmm.h> + +using namespace Inkscape::Filters; +using namespace Inkscape::IO::Resource; +namespace Inkscape { +namespace UI { +namespace Dialog { + +FilterEditorDialog::FilterEditorDialog() : UI::Widget::Panel("", "/dialogs/filtereffects", SP_VERB_DIALOG_FILTER_EFFECTS) +{ + + const std::string req_widgets[] = {"FilterEditor", "FilterList", "FilterFERX", "FilterFERY", "FilterFERH", "FilterFERW", "FilterPreview", "FilterPrimitiveDescImage", "FilterPrimitiveList", "FilterPrimitiveDescText", "FilterPrimitiveAdd"}; + Glib::ustring gladefile = get_filename(UIS, "filter-editor.glade"); + try { + builder = Gtk::Builder::create_from_file(gladefile); + } catch(const Glib::Error& ex) { + g_warning("Glade file loading failed for filter effect dialog"); + return; + } + + Gtk::Object* test; + for(std::string w:req_widgets) { + builder->get_widget(w,test); + if(!test){ + g_warning("Required widget %s does not exist", w); + return; + } + } + + builder->get_widget("FilterEditor", FilterEditor); + _getContents()->add(*FilterEditor); + +//test + Gtk::ComboBox *OptionList; + builder->get_widget("OptionList",OptionList); + FilterStore = builder->get_object("FilterStore"); + Glib::RefPtr<Gtk::ListStore> fs = Glib::RefPtr<Gtk::ListStore>::cast_static(FilterStore); + Gtk::TreeModel::Row row = *(fs->append()); + + + + + +} +FilterEditorDialog::~FilterEditorDialog(){} + + + + + + +} // Never put these namespaces together unless you are using gcc 6+ +} +} // P.S. This is for Inkscape::UI::Dialog + +/* + 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/filter-editor.h b/src/ui/dialog/filter-editor.h new file mode 100644 index 000000000..6acb83f02 --- /dev/null +++ b/src/ui/dialog/filter-editor.h @@ -0,0 +1,53 @@ +/** @file + * @brief Filter Editor dialog + */ +/* Authors: + * Marc Jeanmougin + * + * Copyright (C) 2017 Authors + * + * Released under GNU GPL. Read the file 'COPYING' for more information. + */ + +#ifndef INKSCAPE_UI_DIALOG_FILTER_EDITOR_H +#define INKSCAPE_UI_DIALOG_FILTER_EDITOR_H + +#include "attributes.h" +#include "ui/widget/panel.h" +#include "sp-filter.h" + +#include <gtkmm/notebook.h> +#include <gtkmm/sizegroup.h> +#include <gtkmm/builder.h> +#include <gtkmm/comboboxtext.h> +#include <gtkmm/combobox.h> +#include <gtkmm/drawingarea.h> +#include <gtkmm/liststore.h> + +#include <gtkmm/paned.h> +#include <gtkmm/scrolledwindow.h> +#include <gtkmm/treeview.h> + +namespace Inkscape { +namespace UI { +namespace Dialog { + +class FilterEditorDialog : public UI::Widget::Panel { +public: + + FilterEditorDialog(); + ~FilterEditorDialog(); + + static FilterEditorDialog &getInstance() + { return *new FilterEditorDialog(); } + +// void set_attrs_locked(const bool); +private: + Glib::RefPtr<Gtk::Builder> builder; + Glib::RefPtr<Glib::Object> FilterStore; + Gtk::Box *FilterEditor; +}; +} +} +} +#endif diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index 32fabb741..e410a88f9 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -132,11 +132,7 @@ private: Gtk::Button _add; Glib::RefPtr<Gtk::Menu> _menu; sigc::signal<void> _signal_filter_changed; -#if __cplusplus <= 199711L - std::auto_ptr<Inkscape::XML::SignalObserver> _observer; -#else std::unique_ptr<Inkscape::XML::SignalObserver> _observer; -#endif }; class PrimitiveColumns : public Gtk::TreeModel::ColumnRecord @@ -244,11 +240,7 @@ private: sigc::connection _scroll_connection; int _autoscroll_y; int _autoscroll_x; -#if __cplusplus <= 199711L - std::auto_ptr<Inkscape::XML::SignalObserver> _observer; -#else std::unique_ptr<Inkscape::XML::SignalObserver> _observer; -#endif int _input_type_width; int _input_type_height; }; diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 9ec8d3148..bb8fc564a 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -28,7 +28,6 @@ #include "document.h" #include "document-undo.h" -#include "widgets/icon.h" #include "desktop.h" //#include "sp-item-transform.h" FIXME #include "ui/dialog/tile.h" // for Inkscape::UI::Dialog::ArrangeDialog @@ -611,6 +610,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) NoOfRowsLabel.set_text_with_mnemonic(_("_Rows:")); NoOfRowsLabel.set_mnemonic_widget(NoOfRowsSpinner); + NoOfRowsBox.set_orientation(Gtk::ORIENTATION_VERTICAL); NoOfRowsBox.pack_start(NoOfRowsLabel, false, false, MARGIN); NoOfRowsSpinner.set_digits(0); @@ -641,6 +641,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) /*#### Label for X ####*/ padXByYLabel.set_label(" "); + XByYLabelVBox.set_orientation(Gtk::ORIENTATION_VERTICAL); XByYLabelVBox.pack_start(padXByYLabel, false, false, MARGIN); XByYLabel.set_markup(" × "); XByYLabelVBox.pack_start(XByYLabel, false, false, MARGIN); @@ -651,6 +652,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) NoOfColsLabel.set_text_with_mnemonic(_("_Columns:")); NoOfColsLabel.set_mnemonic_widget(NoOfColsSpinner); + NoOfColsBox.set_orientation(Gtk::ORIENTATION_VERTICAL); NoOfColsBox.pack_start(NoOfColsLabel, false, false, MARGIN); NoOfColsSpinner.set_digits(0); @@ -677,6 +679,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) SpinsHBox.pack_start(NoOfColsBox, false, false, MARGIN); + TileBox.set_orientation(Gtk::ORIENTATION_VERTICAL); TileBox.pack_start(SpinsHBox, false, false, MARGIN); VertAlign = prefs->getInt("/dialogs/gridtiler/VertAlign", 1); diff --git a/src/ui/dialog/grid-arrange-tab.h b/src/ui/dialog/grid-arrange-tab.h index 891849f1a..93bc38218 100644 --- a/src/ui/dialog/grid-arrange-tab.h +++ b/src/ui/dialog/grid-arrange-tab.h @@ -73,7 +73,7 @@ private: bool userHidden; bool updating; - Gtk::VBox TileBox; + Gtk::Box TileBox; Gtk::Button *TileOkButton; Gtk::Button *TileCancelButton; @@ -81,22 +81,22 @@ private: Gtk::Label SelectionContentsLabel; - Gtk::HBox AlignHBox; - Gtk::HBox SpinsHBox; + Gtk::Box AlignHBox; + Gtk::Box SpinsHBox; // Number per Row - Gtk::VBox NoOfColsBox; + Gtk::Box NoOfColsBox; Gtk::Label NoOfColsLabel; Inkscape::UI::Widget::SpinButton NoOfColsSpinner; bool AutoRowSize; Gtk::CheckButton RowHeightButton; - Gtk::VBox XByYLabelVBox; + Gtk::Box XByYLabelVBox; Gtk::Label padXByYLabel; Gtk::Label XByYLabel; // Number per Column - Gtk::VBox NoOfRowsBox; + Gtk::Box NoOfRowsBox; Gtk::Label NoOfRowsLabel; Inkscape::UI::Widget::SpinButton NoOfRowsSpinner; bool AutoColSize; @@ -121,15 +121,11 @@ private: bool ManualSpacing; // Row height - Gtk::VBox RowHeightVBox; - Gtk::HBox RowHeightBox; - Gtk::Label RowHeightLabel; + Gtk::Box RowHeightBox; Inkscape::UI::Widget::SpinButton RowHeightSpinner; // Column width - Gtk::VBox ColumnWidthVBox; - Gtk::HBox ColumnWidthBox; - Gtk::Label ColumnWidthLabel; + Gtk::Box ColumnWidthBox; Inkscape::UI::Widget::SpinButton ColumnWidthSpinner; }; diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 19050fb1d..7b1e531b4 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -31,9 +31,12 @@ #include "desktop.h" +#include "display/cairo-utils.h" #include "display/drawing.h" +#include "display/drawing-context.h" #include "document.h" #include "inkscape.h" +#include "sp-namedview.h" #include "sp-root.h" #include "verbs.h" @@ -41,7 +44,6 @@ extern "C" { // takes doc, drawing, icon, and icon name to produce pixels -// this is defined in widgets/icon.cpp guchar * sp_icon_doc_icon( SPDocument *doc, Inkscape::Drawing &drawing, const gchar *name, unsigned int psize, unsigned &stride); @@ -428,6 +430,190 @@ void IconPreviewPanel::modeToggled() refreshPreview(); } +void overlayPixels(guchar *px, int width, int height, int stride, + unsigned r, unsigned g, unsigned b) +{ + int bytesPerPixel = 4; + int spacing = 4; + for ( int y = 0; y < height; y += spacing ) { + guchar *ptr = px + y * stride; + for ( int x = 0; x < width; x += spacing ) { + *(ptr++) = r; + *(ptr++) = g; + *(ptr++) = b; + *(ptr++) = 0xff; + + ptr += bytesPerPixel * (spacing - 1); + } + } + + if ( width > 1 && height > 1 ) { + // point at the last pixel + guchar *ptr = px + ((height-1) * stride) + ((width - 1) * bytesPerPixel); + + if ( width > 2 ) { + px[4] = r; + px[5] = g; + px[6] = b; + px[7] = 0xff; + + ptr[-12] = r; + ptr[-11] = g; + ptr[-10] = b; + ptr[-9] = 0xff; + } + + ptr[-4] = r; + ptr[-3] = g; + ptr[-2] = b; + ptr[-1] = 0xff; + + px[0 + stride] = r; + px[1 + stride] = g; + px[2 + stride] = b; + px[3 + stride] = 0xff; + + ptr[0 - stride] = r; + ptr[1 - stride] = g; + ptr[2 - stride] = b; + ptr[3 - stride] = 0xff; + + if ( height > 2 ) { + ptr[0 - stride * 3] = r; + ptr[1 - stride * 3] = g; + ptr[2 - stride * 3] = b; + ptr[3 - stride * 3] = 0xff; + } + } +} + +// takes doc, drawing, icon, and icon name to produce pixels +extern "C" guchar * +sp_icon_doc_icon( SPDocument *doc, Inkscape::Drawing &drawing, + gchar const *name, unsigned psize, + unsigned &stride) +{ + bool const dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpSvg"); + guchar *px = NULL; + + if (doc) { + SPObject *object = doc->getObjectById(name); + if (object && SP_IS_ITEM(object)) { + SPItem *item = SP_ITEM(object); + // Find bbox in document + Geom::OptRect dbox = item->documentVisualBounds(); + + if ( object->parent == NULL ) + { + dbox = Geom::Rect(Geom::Point(0, 0), + Geom::Point(doc->getWidth().value("px"), doc->getHeight().value("px"))); + } + + /* This is in document coordinates, i.e. pixels */ + if ( dbox ) { + /* Update to renderable state */ + double sf = 1.0; + drawing.root()->setTransform(Geom::Scale(sf)); + drawing.update(); + /* Item integer bbox in points */ + // NOTE: previously, each rect coordinate was rounded using floor(c + 0.5) + Geom::IntRect ibox = dbox->roundOutwards(); + + if ( dump ) { + g_message( " box --'%s' (%f,%f)-(%f,%f)", name, (double)ibox.left(), (double)ibox.top(), (double)ibox.right(), (double)ibox.bottom() ); + } + + /* Find button visible area */ + int width = ibox.width(); + int height = ibox.height(); + + if ( dump ) { + g_message( " vis --'%s' (%d,%d)", name, width, height ); + } + + { + int block = std::max(width, height); + if (block != static_cast<int>(psize) ) { + if ( dump ) { + g_message(" resizing" ); + } + sf = (double)psize / (double)block; + + drawing.root()->setTransform(Geom::Scale(sf)); + drawing.update(); + + auto scaled_box = *dbox * Geom::Scale(sf); + ibox = scaled_box.roundOutwards(); + if ( dump ) { + g_message( " box2 --'%s' (%f,%f)-(%f,%f)", name, (double)ibox.left(), (double)ibox.top(), (double)ibox.right(), (double)ibox.bottom() ); + } + + /* Find button visible area */ + width = ibox.width(); + height = ibox.height(); + if ( dump ) { + g_message( " vis2 --'%s' (%d,%d)", name, width, height ); + } + } + } + + Geom::IntPoint pdim(psize, psize); + int dx, dy; + //dx = (psize - width) / 2; + //dy = (psize - height) / 2; + dx=dy=psize; + dx=(dx-width)/2; // watch out for psize, since 'unsigned'-'signed' can cause problems if the result is negative + dy=(dy-height)/2; + Geom::IntRect area = Geom::IntRect::from_xywh(ibox.min() - Geom::IntPoint(dx,dy), pdim); + /* Actual renderable area */ + Geom::IntRect ua = *Geom::intersect(ibox, area); + + if ( dump ) { + g_message( " area --'%s' (%f,%f)-(%f,%f)", name, (double)area.left(), (double)area.top(), (double)area.right(), (double)area.bottom() ); + g_message( " ua --'%s' (%f,%f)-(%f,%f)", name, (double)ua.left(), (double)ua.top(), (double)ua.right(), (double)ua.bottom() ); + } + + stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, psize); + + /* Set up pixblock */ + px = g_new(guchar, stride * psize); + memset(px, 0x00, stride * psize); + + /* Render */ + cairo_surface_t *s = cairo_image_surface_create_for_data(px, + CAIRO_FORMAT_ARGB32, psize, psize, stride); + Inkscape::DrawingContext dc(s, ua.min()); + + SPNamedView *nv = sp_document_namedview(doc, NULL); + float bg_r = SP_RGBA32_R_F(nv->pagecolor); + float bg_g = SP_RGBA32_G_F(nv->pagecolor); + float bg_b = SP_RGBA32_B_F(nv->pagecolor); + float bg_a = SP_RGBA32_A_F(nv->pagecolor); + + cairo_t *cr = cairo_create(s); + cairo_set_source_rgba(cr, bg_r, bg_g, bg_b, bg_a); + cairo_rectangle(cr, 0, 0, psize, psize); + cairo_fill(cr); + cairo_save(cr); + cairo_destroy(cr); + + drawing.render(dc, ua); + cairo_surface_destroy(s); + + // convert to GdkPixbuf format + convert_pixels_argb32_to_pixbuf(px, psize, psize, stride); + + if ( Inkscape::Preferences::get()->getBool("/debug/icons/overlaySvg") ) { + overlayPixels( px, psize, psize, stride, 0x00, 0x00, 0xff ); + } + } + } + } + + return px; +} // end of sp_icon_doc_icon() + + void IconPreviewPanel::renderPreview( SPObject* obj ) { SPDocument * doc = obj->document; diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 646439613..1ad44941f 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1947,7 +1947,7 @@ void InkscapePreferences::initPageSystem() _page_system.add_group_header( _("System info")); - _sys_user_config.set_text((char const *)Inkscape::Application::profile_path("")); + _sys_user_config.set_text((char const *)Inkscape::IO::Resource::profile_path("")); _sys_user_config.set_editable(false); _page_system.add_line(true, _("User config: "), _sys_user_config, "", _("Location of users configuration"), true); diff --git a/src/ui/dialog/knot-properties.cpp b/src/ui/dialog/knot-properties.cpp index 954fe2a66..9008d943a 100644 --- a/src/ui/dialog/knot-properties.cpp +++ b/src/ui/dialog/knot-properties.cpp @@ -45,14 +45,15 @@ KnotPropertiesDialog::KnotPropertiesDialog() { Gtk::Box *mainVBox = get_vbox(); - _layout_table.set_spacings(4); - _layout_table.resize (2, 2); + _layout_table.set_row_spacing(4); + _layout_table.set_column_spacing(4); _unit_name = ""; // Layer name widgets _knot_x_entry.set_activates_default(true); _knot_x_entry.set_digits(4); _knot_x_entry.set_increments(1,1); _knot_x_entry.set_range(-G_MAXDOUBLE, G_MAXDOUBLE); + _knot_x_entry.set_hexpand(); _knot_x_label.set_label(_("Position X:")); _knot_x_label.set_alignment(1.0, 0.5); @@ -60,16 +61,15 @@ KnotPropertiesDialog::KnotPropertiesDialog() _knot_y_entry.set_digits(4); _knot_y_entry.set_increments(1,1); _knot_y_entry.set_range(-G_MAXDOUBLE, G_MAXDOUBLE); - _knot_y_label.set_label(_("Position Y:")); + _knot_y_entry.set_hexpand(); + _knot_y_label.set_label(_("Position Y:")); _knot_y_label.set_alignment(1.0, 0.5); - _layout_table.attach(_knot_x_label, - 0, 1, 0, 1, Gtk::FILL, Gtk::FILL); - _layout_table.attach(_knot_x_entry, - 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL); + _layout_table.attach(_knot_x_label, 0, 0, 1, 1); + _layout_table.attach(_knot_x_entry, 1, 0, 1, 1); - _layout_table.attach(_knot_y_label, 0, 1, 1, 2, Gtk::FILL, Gtk::FILL); - _layout_table.attach(_knot_y_entry, 1, 2, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::FILL); + _layout_table.attach(_knot_y_label, 0, 1, 1, 1); + _layout_table.attach(_knot_y_entry, 1, 1, 1, 1); mainVBox->pack_start(_layout_table, true, true, 4); diff --git a/src/ui/dialog/knot-properties.h b/src/ui/dialog/knot-properties.h index f6157168f..1297eae1f 100644 --- a/src/ui/dialog/knot-properties.h +++ b/src/ui/dialog/knot-properties.h @@ -13,9 +13,9 @@ #define INKSCAPE_DIALOG_KNOT_PROPERTIES_H #include <gtkmm/dialog.h> +#include <gtkmm/grid.h> #include <gtkmm/label.h> #include <gtkmm/spinbutton.h> -#include <gtkmm/table.h> #include <2geom/point.h> #include "knot.h" #include "ui/tools/measure-tool.h" @@ -45,7 +45,7 @@ protected: Gtk::SpinButton _knot_x_entry; Gtk::Label _knot_y_label; Gtk::SpinButton _knot_y_entry; - Gtk::Table _layout_table; + Gtk::Grid _layout_table; bool _position_visible; Gtk::Button _close_button; diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index dd9d7ec25..7a650b034 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -15,7 +15,6 @@ #include "layers.h" #include <gtkmm/icontheme.h> -#include <gtkmm/imagemenuitem.h> #include <gtkmm/separatormenuitem.h> #include <glibmm/main.h> @@ -31,7 +30,6 @@ #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" #include "verbs.h" -#include "widgets/icon.h" #include "sp-root.h" #include "ui/tools/tool-base.h" #include "selection-chemistry.h" @@ -82,7 +80,7 @@ void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned i bool set = false; if ( iconName ) { - GtkWidget *child = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName ); + GtkWidget *child = gtk_image_new_from_icon_name( iconName, GTK_ICON_SIZE_SMALL_TOOLBAR ); gtk_widget_show( child ); btn.add( *Gtk::manage(Glib::wrap(child)) ); btn.set_relief(Gtk::RELIEF_NONE); @@ -94,7 +92,7 @@ void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned i if ( verb ) { SPAction *action = verb->get_action(Inkscape::ActionContext(desktop)); if ( !set && action && action->image ) { - GtkWidget *child = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, action->image ); + GtkWidget *child = gtk_image_new_from_icon_name( action->image, GTK_ICON_SIZE_SMALL_TOOLBAR ); gtk_widget_show( child ); btn.add( *Gtk::manage(Glib::wrap(child)) ); set = true; @@ -114,11 +112,12 @@ void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned i Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id ) { - GtkWidget* iconWidget = 0; + Gtk::Image *iconWidget = nullptr; const char* label = 0; if ( iconName ) { - iconWidget = sp_icon_new( Inkscape::ICON_SIZE_MENU, iconName ); + iconWidget = Gtk::manage(new Gtk::Image()); + iconWidget->set_from_icon_name( iconName, Gtk::ICON_SIZE_MENU ); } if ( desktop ) { @@ -126,7 +125,8 @@ Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code if ( verb ) { SPAction *action = verb->get_action(Inkscape::ActionContext(desktop)); if ( !iconWidget && action && action->image ) { - iconWidget = sp_icon_new( Inkscape::ICON_SIZE_MENU, action->image ); + iconWidget = Gtk::manage(new Gtk::Image()); + iconWidget->set_from_icon_name( action->image, Gtk::ICON_SIZE_MENU ); } if ( action ) { @@ -139,21 +139,23 @@ Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code label = fallback; } - Gtk::Widget* wrapped = 0; - if ( iconWidget ) { - wrapped = Gtk::manage(Glib::wrap(iconWidget)); - wrapped->show(); - } - - - Gtk::MenuItem* item = 0; + auto box = Gtk::manage(new Gtk::Box()); + Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem()); - if (wrapped) { - item = Gtk::manage(new Gtk::ImageMenuItem(*wrapped, label, true)); - } else { - item = Gtk::manage(new Gtk::MenuItem(label, true)); + if (iconWidget) { + box->pack_start(*iconWidget, false, true, 0); + } + else { + Gtk::Label *fake_icon = Gtk::manage(new Gtk::Label("")); + box->pack_start(*fake_icon, false, true, 0); } + Gtk::Label *menu_label = Gtk::manage(new Gtk::Label(label, true)); + menu_label->set_xalign(0.0); + box->pack_start(*menu_label, true, true, 0); + item->add(*box); + item->show_all(); + item->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &LayersPanel::_takeAction), id)); _popupMenu.append(*item); diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index bb9b61504..98789f7b2 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -36,7 +36,6 @@ #include "ui/icon-names.h" #include "ui/widget/imagetoggler.h" #include "verbs.h" -#include "widgets/icon.h" #include "livepatheffect-add.h" namespace Inkscape { @@ -67,7 +66,7 @@ void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flag static void lpe_style_button(Gtk::Button& btn, char const* iconName) { - GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); + GtkWidget *child = gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_show( child ); btn.add(*Gtk::manage(Glib::wrap(child))); btn.set_relief(Gtk::RELIEF_NONE); diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index fd78fec90..4b673b8b7 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -47,7 +47,6 @@ #include "ui/tools/node-tool.h" #include "verbs.h" #include "ui/widget/color-notebook.h" -#include "widgets/icon.h" #include "xml/node-observer.h" //#define DUMP_LAYERS 1 @@ -224,7 +223,7 @@ public: */ void ObjectsPanel::_styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip) { - GtkWidget *child = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName ); + GtkWidget *child = gtk_image_new_from_icon_name( iconName, GTK_ICON_SIZE_SMALL_TOOLBAR ); gtk_widget_show( child ); btn.add( *Gtk::manage(Glib::wrap(child)) ); btn.set_relief(Gtk::RELIEF_NONE); @@ -242,23 +241,25 @@ void ObjectsPanel::_styleButton(Gtk::Button& btn, char const* iconName, char con */ Gtk::MenuItem& ObjectsPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback, int id ) { - GtkWidget* iconWidget = 0; + Gtk::Image *iconWidget = nullptr; const char* label = 0; if ( iconName ) { - iconWidget = sp_icon_new( Inkscape::ICON_SIZE_MENU, iconName ); + iconWidget = Gtk::manage(new Gtk::Image()); + iconWidget->set_from_icon_name( iconName, Gtk::ICON_SIZE_MENU ); } if ( desktop ) { Verb *verb = Verb::get( code ); if ( verb ) { - SPAction *action = verb->get_action(desktop); + SPAction *action = verb->get_action(Inkscape::ActionContext(desktop)); if ( !iconWidget && action && action->image ) { - iconWidget = sp_icon_new( Inkscape::ICON_SIZE_MENU, action->image ); + iconWidget = Gtk::manage(new Gtk::Image()); + iconWidget->set_from_icon_name( action->image, Gtk::ICON_SIZE_MENU ); } if ( action ) { - // label = action->name; + label = action->name; } } } @@ -267,21 +268,23 @@ Gtk::MenuItem& ObjectsPanel::_addPopupItem( SPDesktop *desktop, unsigned int cod label = fallback; } - Gtk::Widget* wrapped = 0; - if ( iconWidget ) { - wrapped = Gtk::manage(Glib::wrap(iconWidget)); - wrapped->show(); - } - - - Gtk::MenuItem* item = 0; + auto box = Gtk::manage(new Gtk::Box()); + Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem()); - if (wrapped) { - item = Gtk::manage(new Gtk::ImageMenuItem(*wrapped, label, true)); - } else { - item = Gtk::manage(new Gtk::MenuItem(label, true)); + if (iconWidget) { + box->pack_start(*iconWidget, false, true, 0); + } + else { + Gtk::Label *fake_icon = Gtk::manage(new Gtk::Label("")); + box->pack_start(*fake_icon, false, true, 0); } + Gtk::Label *menu_label = Gtk::manage(new Gtk::Label(label, true)); + menu_label->set_xalign(0.0); + box->pack_start(*menu_label, true, true, 0); + item->add(*box); + item->show_all(); + item->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &ObjectsPanel::_takeAction), id)); _popupMenu.append(*item); diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index 9485b6ba3..b65a67e06 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -19,7 +19,6 @@ #include "document.h" #include "document-undo.h" -#include "widgets/icon.h" #include "desktop.h" #include "sp-ellipse.h" #include "sp-item-transform.h" diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp index 045ce3459..4f7657f4f 100644 --- a/src/ui/dialog/spellcheck.cpp +++ b/src/ui/dialog/spellcheck.cpp @@ -13,7 +13,6 @@ */ #include "spellcheck.h" -#include "widgets/icon.h" #include "message-stack.h" #include "helper/window.h" diff --git a/src/ui/dialog/styledialog.cpp b/src/ui/dialog/styledialog.cpp index 8679659ce..3642c0168 100644 --- a/src/ui/dialog/styledialog.cpp +++ b/src/ui/dialog/styledialog.cpp @@ -13,7 +13,6 @@ #include "styledialog.h" #include "ui/widget/addtoicon.h" -#include "widgets/icon.h" #include "verbs.h" #include "sp-object.h" #include "selection.h" @@ -265,7 +264,9 @@ StyleDialog::StyleDialog() : _treeView.set_expander_column(*(_treeView.get_column(1))); // Pack widgets + _paned.set_orientation(Gtk::ORIENTATION_VERTICAL); _paned.pack1(_mainBox, Gtk::SHRINK); + _mainBox.set_orientation(Gtk::ORIENTATION_VERTICAL); _mainBox.pack_start(_scrolledWindow, Gtk::PACK_EXPAND_WIDGET); _scrolledWindow.add(_treeView); _scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); @@ -1515,7 +1516,7 @@ bool StyleDialog::_delProperty(GdkEventButton *event) void StyleDialog::_styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip) { - GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); + GtkWidget *child = gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_show(child); btn.add(*manage(Glib::wrap(child))); btn.set_relief(Gtk::RELIEF_NONE); diff --git a/src/ui/dialog/styledialog.h b/src/ui/dialog/styledialog.h index dbbc1e480..03932e3cc 100644 --- a/src/ui/dialog/styledialog.h +++ b/src/ui/dialog/styledialog.h @@ -108,9 +108,9 @@ private: Glib::RefPtr<TreeStore> _store; // Widgets - Gtk::VPaned _paned; - Gtk::VBox _mainBox; - Gtk::HBox _buttonBox; + Gtk::Paned _paned; + Gtk::Box _mainBox; + Gtk::Box _buttonBox; Gtk::ScrolledWindow _scrolledWindow; Gtk::Button* del; Gtk::Button* create; diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 87bfa9252..82b099bd1 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -512,15 +512,16 @@ compare_swatch_names(SwatchPage const *a, SwatchPage const *b) { static void loadEmUp() { + using namespace Inkscape::IO::Resource; static bool beenHere = false; gboolean userPalette = true; if ( !beenHere ) { beenHere = true; std::list<gchar *> sources; - sources.push_back( Inkscape::Application::profile_path("palettes") ); - sources.push_back( g_strdup(INKSCAPE_PALETTESDIR) ); - sources.push_back( g_strdup(CREATE_PALETTESDIR) ); + sources.push_back(g_strdup(get_path(USER, PALETTES))); + sources.push_back(g_strdup(get_path(SYSTEM, PALETTES))); + sources.push_back(g_strdup(get_path(CREATE, PALETTES))); // Use this loop to iterate through a list of possible document locations. while (!sources.empty()) { diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index e9a13620b..aa3d86b00 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -31,6 +31,7 @@ #include <glibmm/i18n.h> #include "path-prefix.h" #include "io/sys.h" +#include "io/resource.h" #include "ui/cache/svg_preview_cache.h" #include "ui/clipboard.h" @@ -47,7 +48,6 @@ #include "sp-use.h" #include "sp-defs.h" #include "sp-symbol.h" -#include "widgets/icon.h" #ifdef WITH_LIBVISIO #include <libvisio/libvisio.h> @@ -174,18 +174,22 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : scroller->set_hexpand(); table->attach(*Gtk::manage(tools),0,row,2,1); + auto addSymbolImage = Gtk::manage(new Gtk::Image()); + addSymbolImage->set_from_icon_name("symbol-add", Gtk::ICON_SIZE_SMALL_TOOLBAR); + addSymbol = Gtk::manage(new Gtk::Button()); - addSymbol->add(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-add")))) ); + addSymbol->add(*addSymbolImage); addSymbol->set_tooltip_text(_("Add Symbol from the current document.")); addSymbol->set_relief( Gtk::RELIEF_NONE ); addSymbol->set_focus_on_click( false ); addSymbol->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::insertSymbol)); tools->pack_start(* addSymbol, Gtk::PACK_SHRINK); + auto removeSymbolImage = Gtk::manage(new Gtk::Image()); + removeSymbolImage->set_from_icon_name("symbol-remove", Gtk::ICON_SIZE_SMALL_TOOLBAR); + removeSymbol = Gtk::manage(new Gtk::Button()); - removeSymbol->add(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-remove")))) ); + removeSymbol->add(*removeSymbolImage); removeSymbol->set_tooltip_text(_("Remove Symbol from the current document.")); removeSymbol->set_relief( Gtk::RELIEF_NONE ); removeSymbol->set_focus_on_click( false ); @@ -197,18 +201,23 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : // Pack size (controls display area) pack_size = 2; // Default 32px + + auto packMoreImage = Gtk::manage(new Gtk::Image()); + packMoreImage->set_from_icon_name("pack-more", Gtk::ICON_SIZE_SMALL_TOOLBAR); + button = Gtk::manage(new Gtk::Button()); - button->add(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("pack-more")))) ); + button->add(*packMoreImage); button->set_tooltip_text(_("Display more icons in row.")); button->set_relief( Gtk::RELIEF_NONE ); button->set_focus_on_click( false ); button->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::packmore)); tools->pack_start(* button, Gtk::PACK_SHRINK); + auto packLessImage = Gtk::manage(new Gtk::Image()); + packLessImage->set_from_icon_name("pack-less", Gtk::ICON_SIZE_SMALL_TOOLBAR); + button = Gtk::manage(new Gtk::Button()); - button->add(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("pack-less")))) ); + button->add(*packLessImage); button->set_tooltip_text(_("Display fewer icons in row.")); button->set_relief( Gtk::RELIEF_NONE ); button->set_focus_on_click( false ); @@ -216,9 +225,11 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : tools->pack_start(* button, Gtk::PACK_SHRINK); // Toggle scale to fit on/off + auto fitSymbolImage = Gtk::manage(new Gtk::Image()); + fitSymbolImage->set_from_icon_name("symbol-fit", Gtk::ICON_SIZE_SMALL_TOOLBAR); + fitSymbol = Gtk::manage(new Gtk::ToggleButton()); - fitSymbol->add(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-fit")))) ); + fitSymbol->add(*fitSymbolImage); fitSymbol->set_tooltip_text(_("Toggle 'fit' symbols in icon space.")); fitSymbol->set_relief( Gtk::RELIEF_NONE ); fitSymbol->set_focus_on_click( false ); @@ -228,9 +239,11 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : // Render size (scales symbols within display area) scale_factor = 0; // Default 1:1 * pack_size/pack_size default + auto zoomOutImage = Gtk::manage(new Gtk::Image()); + zoomOutImage->set_from_icon_name("symbol-smaller", Gtk::ICON_SIZE_SMALL_TOOLBAR); + zoomOut = Gtk::manage(new Gtk::Button()); - zoomOut->add(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-smaller")))) ); + zoomOut->add(*zoomOutImage); zoomOut->set_tooltip_text(_("Make symbols smaller by zooming out.")); zoomOut->set_relief( Gtk::RELIEF_NONE ); zoomOut->set_focus_on_click( false ); @@ -238,9 +251,11 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : zoomOut->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::zoomout)); tools->pack_start(* zoomOut, Gtk::PACK_SHRINK); + auto zoomInImage = Gtk::manage(new Gtk::Image()); + zoomInImage->set_from_icon_name("symbol-bigger", Gtk::ICON_SIZE_SMALL_TOOLBAR); + zoomIn = Gtk::manage(new Gtk::Button()); - zoomIn->add(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-bigger")))) ); + zoomIn->add(*zoomInImage); zoomIn->set_tooltip_text(_("Make symbols bigger by zooming in.")); zoomIn->set_relief( Gtk::RELIEF_NONE ); zoomIn->set_focus_on_click( false ); @@ -577,19 +592,15 @@ void SymbolsDialog::get_symbols() { std::list<Glib::ustring> directories; -// \TODO optimize this - - if( Inkscape::IO::file_test( INKSCAPE_SYMBOLSDIR, G_FILE_TEST_EXISTS ) && - Inkscape::IO::file_test( INKSCAPE_SYMBOLSDIR, G_FILE_TEST_IS_DIR ) ) { - directories.push_back( INKSCAPE_SYMBOLSDIR ); - } - if( Inkscape::IO::file_test( Inkscape::Application::profile_path("symbols"), G_FILE_TEST_EXISTS ) && - Inkscape::IO::file_test( Inkscape::Application::profile_path("symbols"), G_FILE_TEST_IS_DIR ) ) { - directories.push_back( Inkscape::Application::profile_path("symbols") ); - } + using namespace Inkscape::IO::Resource; + directories.push_back(get_path_ustring(USER, SYMBOLS)); + directories.push_back(get_path_ustring(SYSTEM, SYMBOLS)); std::list<Glib::ustring>::iterator it; for( it = directories.begin(); it != directories.end(); ++it ) { + if(!Inkscape::IO::file_test((*it).c_str(), G_FILE_TEST_IS_DIR)) { + continue; + } GError *err = 0; GDir *dir = g_dir_open( (*it).c_str(), 0, &err ); diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index dfe71bddb..176719995 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -31,7 +31,6 @@ #include "ui/widget/layertypeicon.h" #include "ui/widget/addtoicon.h" #include "verbs.h" -#include "widgets/icon.h" #include "xml/node-observer.h" #include "sp-root.h" #include "ui/tools/tool-base.h" //"event-context.h" @@ -130,7 +129,7 @@ public: void TagsPanel::_styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip) { - GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName); + GtkWidget *child = gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_show(child); btn.add(*manage(Glib::wrap(child))); btn.set_relief(Gtk::RELIEF_NONE); @@ -144,7 +143,7 @@ Gtk::MenuItem& TagsPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, const char* label = 0; if ( iconName ) { - iconWidget = sp_icon_new( Inkscape::ICON_SIZE_MENU, iconName ); + iconWidget = gtk_image_new_from_icon_name( iconName, GTK_ICON_SIZE_MENU ); } if ( desktop ) { @@ -152,11 +151,11 @@ Gtk::MenuItem& TagsPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, if ( verb ) { SPAction *action = verb->get_action(desktop); if ( !iconWidget && action && action->image ) { - iconWidget = sp_icon_new( Inkscape::ICON_SIZE_MENU, action->image ); + iconWidget = gtk_image_new_from_icon_name( action->image, GTK_ICON_SIZE_MENU ); } if ( action ) { - label = action->name; + // label = action->name; } } } @@ -167,7 +166,7 @@ Gtk::MenuItem& TagsPanel::_addPopupItem( SPDesktop *desktop, unsigned int code, Gtk::Widget* wrapped = 0; if ( iconWidget ) { - wrapped = manage(Glib::wrap(iconWidget)); + wrapped = Gtk::manage(Glib::wrap(iconWidget)); wrapped->show(); } diff --git a/src/ui/dialog/template-load-tab.cpp b/src/ui/dialog/template-load-tab.cpp index 7b96c2b97..10b4716ff 100644 --- a/src/ui/dialog/template-load-tab.cpp +++ b/src/ui/dialog/template-load-tab.cpp @@ -24,6 +24,8 @@ #include "file.h" #include "path-prefix.h" +using namespace Inkscape::IO::Resource; + namespace Inkscape { namespace UI { @@ -57,7 +59,6 @@ TemplateLoadTab::TemplateLoadTab(NewFromTemplate* parent) sigc::mem_fun(*this, &TemplateLoadTab::_keywordSelected)); this->show_all(); - _loading_path = ""; _loadTemplates(); _initLists(); } @@ -207,11 +208,8 @@ void TemplateLoadTab::_refreshTemplatesList() void TemplateLoadTab::_loadTemplates() { - // user's local dir - _getTemplatesFromDir(Inkscape::Application::profile_path("templates") + _loading_path); - - // system templates dir - _getTemplatesFromDir(INKSCAPE_TEMPLATESDIR + _loading_path); + _getTemplatesFromDomain(USER); + _getTemplatesFromDomain(SYSTEM); // procedural templates _getProceduralTemplates(); @@ -252,11 +250,12 @@ TemplateLoadTab::TemplateData TemplateLoadTab::_processTemplateFile(const std::s } -void TemplateLoadTab::_getTemplatesFromDir(const std::string &path) +void TemplateLoadTab::_getTemplatesFromDomain(Domain domain) { - if ( !Glib::file_test(path, Glib::FILE_TEST_EXISTS) || - !Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) + Glib::ustring path = get_path_ustring(domain, TEMPLATES); + if (!Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) { return; + } Glib::Dir dir(path); diff --git a/src/ui/dialog/template-load-tab.h b/src/ui/dialog/template-load-tab.h index d11c4c77f..0a5521d93 100644 --- a/src/ui/dialog/template-load-tab.h +++ b/src/ui/dialog/template-load-tab.h @@ -21,6 +21,7 @@ #include <string> #include "xml/node.h" +#include "io/resource.h" #include "extension/effect.h" @@ -66,7 +67,6 @@ protected: Glib::ustring _current_keyword; Glib::ustring _current_template; - std::string _loading_path; std::map<Glib::ustring, TemplateData> _tdata; std::set<Glib::ustring> _keywords; @@ -100,7 +100,7 @@ private: void _getDataFromNode(Inkscape::XML::Node *, TemplateData &); void _getProceduralTemplates(); - void _getTemplatesFromDir(const std::string &); + void _getTemplatesFromDomain(Inkscape::IO::Resource::Domain domain); void _keywordSelected(); TemplateData _processTemplateFile(const std::string &); diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 94f307828..c7d899f45 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -45,7 +45,6 @@ extern "C" { #include "verbs.h" #include "ui/interface.h" #include "svg/css-ostringstream.h" -#include "widgets/icon.h" #include "widgets/font-selector.h" #include <glibmm/i18n.h> #include <glibmm/markup.h> @@ -103,26 +102,6 @@ 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); - - spacing_combo = gtk_combo_box_text_new_with_entry (); - gtk_widget_set_size_request (spacing_combo, 90, -1); - - const gchar *spacings[] = {"50%", "80%", "90%", "100%", "110%", "120%", "130%", "140%", "150%", "200%", "300%", NULL}; - for (int i = 0; spacings[i]; i++) { - gtk_combo_box_text_append_text((GtkComboBoxText *) spacing_combo, spacings[i]); - } - - gtk_widget_set_tooltip_text (px, _("Spacing between baselines (percent of font size)")); - gtk_widget_set_tooltip_text (spacing_combo, _("Spacing between baselines (percent of font size)")); - 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 { startOffset = gtk_combo_box_text_new_with_entry (); @@ -223,10 +202,7 @@ TextEdit::~TextEdit() void TextEdit::styleButton(Gtk::RadioButton *button, gchar const *tooltip, gchar const *icon_name, Gtk::RadioButton *group_button ) { - GtkWidget *icon = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, icon_name ); - if (!GTK_IS_IMAGE(icon)) { - icon = gtk_image_new_from_icon_name ( icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR ); - } + GtkWidget *icon = gtk_image_new_from_icon_name( icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR ); if (group_button) { Gtk::RadioButton::Group group = group_button->get_group(); diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index d209a450c..5ad1b9ec5 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -31,7 +31,6 @@ #include "sp-namedview.h" #include "sp-item-transform.h" #include "ui/icon-names.h" -#include "widgets/icon.h" namespace Inkscape { @@ -278,14 +277,18 @@ void Transformation::layoutPageRotate() _scalar_rotate.setDigits(3); _scalar_rotate.setIncrements(0.1, 1.0); - _counterclockwise_rotate.add(*manage( Glib::wrap( - sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("object-rotate-left"))))); + auto object_rotate_left_icon = Gtk::manage(new Gtk::Image()); + object_rotate_left_icon->set_from_icon_name("object-rotate-left", Gtk::ICON_SIZE_SMALL_TOOLBAR); + + _counterclockwise_rotate.add(*object_rotate_left_icon); _counterclockwise_rotate.set_mode(false); _counterclockwise_rotate.set_relief(Gtk::RELIEF_NONE); _counterclockwise_rotate.set_tooltip_text(_("Rotate in a counterclockwise direction")); - _clockwise_rotate.add(*manage( Glib::wrap( - sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("object-rotate-right"))))); + auto object_rotate_right_icon = Gtk::manage(new Gtk::Image()); + object_rotate_right_icon->set_from_icon_name("object-rotate-right", Gtk::ICON_SIZE_SMALL_TOOLBAR); + + _clockwise_rotate.add(*object_rotate_right_icon); _clockwise_rotate.set_mode(false); _clockwise_rotate.set_relief(Gtk::RELIEF_NONE); _clockwise_rotate.set_tooltip_text(_("Rotate in a clockwise direction")); diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index bf5bdc76d..3d6d71e9a 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -44,16 +44,13 @@ void CellRendererSPIcon::render_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, if ( !_icon_cache[_property_event_type] ) { 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); + Gtk::Image* icon = Gtk::manage(new Gtk::Image()); + icon->set_from_icon_name(image_name, Gtk::ICON_SIZE_MENU); if (icon) { // check icon type (inkscape, gtk, none) - if ( SP_IS_ICON(icon->gobj()) ) { - SPIcon* sp_icon = SP_ICON(icon->gobj()); - sp_icon_fetch_pixbuf(sp_icon); - _property_icon = Glib::wrap(sp_icon->pb, true); - } else if ( GTK_IS_IMAGE(icon->gobj()) ) { + if ( GTK_IS_IMAGE(icon->gobj()) ) { auto icon_theme = Gtk::IconTheme::get_default(); _property_icon = icon_theme->load_icon(image_name, 16); } else { diff --git a/src/ui/dialog/undo-history.h b/src/ui/dialog/undo-history.h index 48929a0d0..3efc25f15 100644 --- a/src/ui/dialog/undo-history.h +++ b/src/ui/dialog/undo-history.h @@ -24,7 +24,6 @@ #include "event-log.h" -#include "widgets/icon.h" #include "ui/dialog/desktop-tracker.h" class SPDesktop; diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index fa35b092a..d9ea73673 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -17,7 +17,6 @@ */ #include "xml-tree.h" -#include "widgets/icon.h" #include <glibmm/i18n.h> #include "desktop.h" @@ -109,57 +108,74 @@ XmlTree::XmlTree (void) : gtk_widget_set_tooltip_text( GTK_WIDGET(tree), _("Drag to reorder nodes") ); tree_toolbar.set_toolbar_style(Gtk::TOOLBAR_ICONS); - xml_element_new_button.set_icon_widget(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("xml-element-new")))) ); + + auto xml_element_new_icon = Gtk::manage(new Gtk::Image()); + xml_element_new_icon->set_from_icon_name("xml-element-new", Gtk::ICON_SIZE_LARGE_TOOLBAR); + + xml_element_new_button.set_icon_widget(*xml_element_new_icon); xml_element_new_button.set_tooltip_text(_("New element node")); xml_element_new_button.set_sensitive(false); tree_toolbar.add(xml_element_new_button); - xml_text_new_button.set_icon_widget(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("xml-text-new"))))); + auto xml_text_new_icon = Gtk::manage(new Gtk::Image()); + xml_text_new_icon->set_from_icon_name("xml-text-new", Gtk::ICON_SIZE_LARGE_TOOLBAR); + + xml_text_new_button.set_icon_widget(*xml_text_new_icon); xml_text_new_button.set_tooltip_text(_("New text node")); xml_text_new_button.set_sensitive(false); tree_toolbar.add(xml_text_new_button); - xml_node_duplicate_button.set_icon_widget(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("xml-node-duplicate"))))); + auto xml_node_duplicate_icon = Gtk::manage(new Gtk::Image()); + xml_node_duplicate_icon->set_from_icon_name("xml-node-duplicate", Gtk::ICON_SIZE_LARGE_TOOLBAR); + + xml_node_duplicate_button.set_icon_widget(*xml_node_duplicate_icon); xml_node_duplicate_button.set_tooltip_text(_("Duplicate node")); xml_node_duplicate_button.set_sensitive(false); tree_toolbar.add(xml_node_duplicate_button); tree_toolbar.add(separator); - xml_node_delete_button.set_icon_widget(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("xml-node-delete"))))); + auto xml_node_delete_icon = Gtk::manage(new Gtk::Image()); + xml_node_delete_icon->set_from_icon_name("xml-node-delete", Gtk::ICON_SIZE_LARGE_TOOLBAR); + + xml_node_delete_button.set_icon_widget(*xml_node_delete_icon); xml_node_delete_button.set_tooltip_text(Q_("nodeAsInXMLdialogTooltip|Delete node")); xml_node_delete_button.set_sensitive(false); tree_toolbar.add(xml_node_delete_button); tree_toolbar.add(separator2); - unindent_node_button.set_icon_widget(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("format-indent-less"))))); + auto format_indent_less_icon = Gtk::manage(new Gtk::Image()); + format_indent_less_icon->set_from_icon_name("format-indent-less", Gtk::ICON_SIZE_LARGE_TOOLBAR); + + unindent_node_button.set_icon_widget(*format_indent_less_icon); unindent_node_button.set_label(_("Unindent node")); unindent_node_button.set_tooltip_text(_("Unindent node")); unindent_node_button.set_sensitive(false); tree_toolbar.add(unindent_node_button); - indent_node_button.set_icon_widget(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("format-indent-more"))))); + auto format_indent_more_icon = Gtk::manage(new Gtk::Image()); + format_indent_more_icon->set_from_icon_name("format-indent-more", Gtk::ICON_SIZE_LARGE_TOOLBAR); + + indent_node_button.set_icon_widget(*format_indent_more_icon); indent_node_button.set_label(_("Indent node")); indent_node_button.set_tooltip_text(_("Indent node")); indent_node_button.set_sensitive(false); tree_toolbar.add(indent_node_button); - raise_node_button.set_icon_widget(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("go-up"))))); + auto go_up_icon = Gtk::manage(new Gtk::Image()); + go_up_icon->set_from_icon_name("go-up", Gtk::ICON_SIZE_LARGE_TOOLBAR); + + raise_node_button.set_icon_widget(*go_up_icon); raise_node_button.set_label(_("Raise node")); raise_node_button.set_tooltip_text(_("Raise node")); raise_node_button.set_sensitive(false); tree_toolbar.add(raise_node_button); - lower_node_button.set_icon_widget(*Gtk::manage(Glib::wrap( - sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("go-down"))))); + auto go_down_icon = Gtk::manage(new Gtk::Image()); + go_down_icon->set_from_icon_name("go-down", Gtk::ICON_SIZE_LARGE_TOOLBAR); + + lower_node_button.set_icon_widget(*go_down_icon); lower_node_button.set_label(_("Lower node")); lower_node_button.set_tooltip_text(_("Lower node")); lower_node_button.set_sensitive(false); @@ -183,7 +199,10 @@ XmlTree::XmlTree (void) : attributes = SP_XMLVIEW_ATTR_LIST(sp_xmlview_attr_list_new(NULL)); attr_toolbar.set_toolbar_style(Gtk::TOOLBAR_ICONS); - xml_attribute_delete_button.set_icon_widget(*Gtk::manage(Glib::wrap(sp_icon_new (Inkscape::ICON_SIZE_LARGE_TOOLBAR, INKSCAPE_ICON("xml-attribute-delete"))))); + + auto xml_attribute_delete_icon = Gtk::manage(new Gtk::Image()); + xml_attribute_delete_icon->set_from_icon_name("xml-attribute-delete", Gtk::ICON_SIZE_LARGE_TOOLBAR); + xml_attribute_delete_button.set_icon_widget(*xml_attribute_delete_icon); xml_attribute_delete_button.set_tooltip_text(_("Delete attribute")); xml_attribute_delete_button.set_sensitive(false); attr_toolbar.add(xml_attribute_delete_button); |
