diff options
| author | Markus Engel <markus.engel@tum.de> | 2013-07-14 21:09:41 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2013-07-14 21:09:41 +0000 |
| commit | d32efb61f1c2c18d1018e510bbe9bafc04a03905 (patch) | |
| tree | b447bf9856baf1cf485e38c4ce55edb27285129e /src/ui | |
| parent | Merged from trunk (r12305) (diff) | |
| parent | Minor C++ish refactoring pass. (diff) | |
| download | inkscape-d32efb61f1c2c18d1018e510bbe9bafc04a03905.tar.gz inkscape-d32efb61f1c2c18d1018e510bbe9bafc04a03905.zip | |
Merged from trunk (r12419).
(bzr r11608.1.107)
Diffstat (limited to 'src/ui')
68 files changed, 684 insertions, 320 deletions
diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index ba9670d86..6f1137e46 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -359,7 +359,7 @@ void AboutBox::initStrings() { "Nick\n" "Andreas Nilsson\n" "Mitsuru Oka\n" -"Marten Owens\n" +"Martin Owens\n" "Alvin Penner\n" "Jon Phillips\n" "Zdenko Podobny\n" diff --git a/src/ui/dialog/aboutbox.h b/src/ui/dialog/aboutbox.h index 622b1324f..7b3308672 100644 --- a/src/ui/dialog/aboutbox.h +++ b/src/ui/dialog/aboutbox.h @@ -15,6 +15,14 @@ #ifndef INKSCAPE_UI_DIALOG_ABOUTBOX_H #define INKSCAPE_UI_DIALOG_ABOUTBOX_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> namespace Inkscape { diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index dbd06d9e8..8845b60e5 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -88,119 +88,73 @@ Action::Action(const Glib::ustring &id, } -void ActionAlign::do_action(SPDesktop *desktop, int index) { - +void ActionAlign::do_action(SPDesktop *desktop, int index) +{ Inkscape::Selection *selection = sp_desktop_selection(desktop); if (!selection) return; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool sel_as_group = prefs->getBool("/dialogs/align/sel-as-groups"); - int prefs_bbox = prefs->getBool("/tools/bounding_box"); using Inkscape::Util::GSListConstIterator; std::list<SPItem *> selected; selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL); if (selected.empty()) return; - Geom::Point mp; //Anchor point - AlignAndDistribute::AlignTarget target = AlignAndDistribute::getAlignTarget(); - const Coeffs &a= _allCoeffs[index]; - switch (target) - { - case AlignAndDistribute::LAST: - case AlignAndDistribute::FIRST: - case AlignAndDistribute::BIGGEST: - case AlignAndDistribute::SMALLEST: + const Coeffs &a = _allCoeffs[index]; + SPItem *focus = NULL; + Geom::OptRect b = Geom::OptRect(); + Selection::CompareSize horiz = (a.mx0 != 0.0) || (a.mx1 != 0.0) + ? Selection::HORIZONTAL : Selection::VERTICAL; + + switch (AlignTarget(prefs->getInt("/dialogs/align/align-to", 6))) { - //Check 2 or more selected objects - std::list<SPItem *>::iterator second(selected.begin()); - ++second; - if (second == selected.end()) - return; - //Find the master (anchor on which the other objects are aligned) - std::list<SPItem *>::iterator master( - AlignAndDistribute::find_master ( - selected, - (a.mx0 != 0.0) || - (a.mx1 != 0.0) ) - ); - //remove the master from the selection - SPItem * thing = *master; - // TODO: either uncomment or remove the following commented lines, depending on which - // behaviour of moving objects makes most sense; also cf. discussion at - // https://bugs.launchpad.net/inkscape/+bug/255933 - /*if (!sel_as_group) { */ - selected.erase(master); - /*}*/ - //Compute the anchor point - Geom::OptRect b = !prefs_bbox ? thing->desktopVisualBounds() : thing->desktopGeometricBounds(); - if (b) { - mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X], - a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]); - } else { - return; - } + case LAST: + focus = SP_ITEM(*selected.begin()); break; - } - - case AlignAndDistribute::PAGE: - mp = Geom::Point(a.mx1 * sp_desktop_document(desktop)->getWidth(), - a.my1 * sp_desktop_document(desktop)->getHeight()); + case FIRST: + focus = SP_ITEM(*--(selected.end())); break; - - case AlignAndDistribute::DRAWING: - { - Geom::OptRect b = !prefs_bbox ? sp_desktop_document(desktop)->getRoot()->desktopVisualBounds() - : sp_desktop_document(desktop)->getRoot()->desktopGeometricBounds(); - if (b) { - mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X], - a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]); - } else { - return; - } + case BIGGEST: + focus = selection->largestItem(horiz); break; - } - - case AlignAndDistribute::SELECTION: - { - Geom::OptRect b = !prefs_bbox ? selection->visualBounds() : selection->geometricBounds(); - if (b) { - mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X], - a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]); - } else { - return; - } + case SMALLEST: + focus = selection->smallestItem(horiz); + break; + case PAGE: + b = sp_desktop_document(desktop)->preferredBounds(); + break; + case DRAWING: + b = sp_desktop_document(desktop)->getRoot()->desktopPreferredBounds(); + break; + case SELECTION: + b = selection->preferredBounds(); break; - } - default: g_assert_not_reached (); break; - }; // end of switch + }; + + if(focus) + b = focus->desktopPreferredBounds(); + g_return_if_fail(b); - // Top hack: temporarily set clone compensation to unmoved, so that we can align/distribute - // clones with their original (and the move of the original does not disturb the - // clones). The only problem with this is that if there are outside-of-selection clones of - // a selected original, they will be unmoved too, possibly contrary to user's - // expecation. However this is a minor point compared to making align/distribute always - // work as expected, and "unmoved" is the default option anyway. - int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); - prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); + // Generate the move point from the selected bounding box + Geom::Point mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X], + a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]); bool changed = false; - Geom::OptRect b; if (sel_as_group) - b = !prefs_bbox ? selection->visualBounds() : selection->geometricBounds(); + b = selection->preferredBounds(); //Move each item in the selected list separately for (std::list<SPItem *>::iterator it(selected.begin()); - it != selected.end(); - it++) + it != selected.end(); ++it) { sp_desktop_document (desktop)->ensureUpToDate(); if (!sel_as_group) - b = !prefs_bbox ? (*it)->desktopVisualBounds() : (*it)->desktopGeometricBounds(); - if (b) { + b = (*it)->desktopPreferredBounds(); + if (b && (!focus || (*it) != focus)) { Geom::Point const sp(a.sx0 * b->min()[Geom::X] + a.sx1 * b->max()[Geom::X], a.sy0 * b->min()[Geom::Y] + a.sy1 * b->max()[Geom::Y]); Geom::Point const mp_rel( mp - sp ); @@ -211,15 +165,10 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) { } } - // restore compensation setting - prefs->setInt("/options/clonecompensation/value", saved_compensation); - if (changed) { DocumentUndo::done( sp_desktop_document(desktop) , SP_VERB_DIALOG_ALIGN_DISTRIBUTE, _("Align")); } - - } @@ -347,7 +296,7 @@ private : float pos = sorted.front().bbox.min()[_orientation]; for ( std::vector<BBoxSort> ::iterator it (sorted.begin()); it < sorted.end(); - it ++ ) + ++it ) { if (!Geom::are_near(pos, it->bbox.min()[_orientation], 1e-6)) { Geom::Point t(0.0, 0.0); @@ -1265,69 +1214,6 @@ void AlignAndDistribute::addBaselineButton(const Glib::ustring &id, const Glib:: *this, table, orientation, distribute)); } - - - -std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem *> &list, bool horizontal){ - std::list<SPItem *>::iterator master = list.end(); - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - int prefs_bbox = prefs->getBool("/tools/bounding_box"); - switch (getAlignTarget()) { - case LAST: - return list.begin(); - break; - - case FIRST: - return --(list.end()); - break; - - case BIGGEST: - { - gdouble max = -1e18; - for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); ++it) { - Geom::OptRect b = !prefs_bbox ? (*it)->desktopVisualBounds() : (*it)->desktopGeometricBounds(); - if (b) { - gdouble dim = (*b)[horizontal ? Geom::X : Geom::Y].extent(); - if (dim > max) { - max = dim; - master = it; - } - } - } - return master; - } - - case SMALLEST: - { - gdouble max = 1e18; - for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); ++it) { - Geom::OptRect b = !prefs_bbox ? (*it)->desktopVisualBounds() : (*it)->desktopGeometricBounds(); - if (b) { - gdouble dim = (*b)[horizontal ? Geom::X : Geom::Y].extent(); - if (dim < max) { - max = dim; - master = it; - } - } - } - return master; - } - - default: - g_assert_not_reached (); - break; - - } // end of switch statement - return master; -} - -AlignAndDistribute::AlignTarget AlignAndDistribute::getAlignTarget() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - return AlignTarget(prefs->getInt("/dialogs/align/align-to", 6)); -} - - - } // namespace Dialog } // namespace UI } // namespace Inkscape diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h index c9165a83e..dfd84535b 100644 --- a/src/ui/dialog/align-and-distribute.h +++ b/src/ui/dialog/align-and-distribute.h @@ -47,12 +47,6 @@ public: static AlignAndDistribute &getInstance() { return *new AlignAndDistribute(); } - enum AlignTarget { LAST=0, FIRST, BIGGEST, SMALLEST, PAGE, DRAWING, SELECTION }; - - - - static AlignTarget getAlignTarget(); - #if WITH_GTKMM_3_0 Gtk::Grid &align_table(){return _alignTable;} Gtk::Grid &distribute_table(){return _distributeTable;} @@ -67,7 +61,6 @@ public: Gtk::Table &nodes_table(){return _nodesTable;} #endif - static std::list<SPItem *>::iterator find_master(std::list <SPItem *> &list, bool horizontal); void setMode(bool nodeEdit); Geom::OptRect randomize_bbox; @@ -189,6 +182,7 @@ public : double sx0, sx1, sy0, sy1; int verb_id; }; + enum AlignTarget { LAST=0, FIRST, BIGGEST, SMALLEST, PAGE, DRAWING, SELECTION }; ActionAlign(const Glib::ustring &id, const Glib::ustring &tiptext, guint row, guint column, @@ -204,6 +198,7 @@ public : * Static function called to align from a keyboard shortcut */ static void do_verb_action(SPDesktop *desktop, int verb); + static int verb_to_coeff(int verb); private : @@ -217,7 +212,6 @@ private : } static void do_action(SPDesktop *desktop, int index); - static int verb_to_coeff(int verb); guint _index; AlignAndDistribute &_dialog; diff --git a/src/ui/dialog/calligraphic-profile-rename.h b/src/ui/dialog/calligraphic-profile-rename.h index 4ef71900b..3256338eb 100644 --- a/src/ui/dialog/calligraphic-profile-rename.h +++ b/src/ui/dialog/calligraphic-profile-rename.h @@ -15,6 +15,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include <gtkmm/entry.h> #include <gtkmm/label.h> diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp index e09d9b1d1..2292b66fc 100644 --- a/src/ui/dialog/color-item.cpp +++ b/src/ui/dialog/color-item.cpp @@ -11,7 +11,16 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <errno.h> + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/label.h> #include <glibmm/i18n.h> #include <cairo.h> diff --git a/src/ui/dialog/debug.cpp b/src/ui/dialog/debug.cpp index d127261c0..9e2287f80 100644 --- a/src/ui/dialog/debug.cpp +++ b/src/ui/dialog/debug.cpp @@ -13,6 +13,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/dialog.h> #include <gtkmm/textview.h> diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 3017dc117..a851503fe 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -20,6 +20,10 @@ // This has to be included prior to anything that includes setjmp.h, it croaks otherwise #include <png.h> +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/buttonbox.h> #include <gtkmm/dialog.h> @@ -87,6 +91,7 @@ #include <windows.h> #include <commdlg.h> #include <gdk/gdkwin32.h> +#include <glibmm/fileutils.h> #endif #include <gtk/gtk.h> diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp index 3413b0b0d..e71605739 100644 --- a/src/ui/dialog/filedialog.cpp +++ b/src/ui/dialog/filedialog.cpp @@ -15,9 +15,9 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include "filedialogimpl-win32.h" #include "filedialogimpl-gtkmm.h" #include "filedialog.h" -#include "filedialogimpl-win32.h" #include "gc-core.h" #include <dialogs/dialog-events.h> diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h index 7501b5e14..6687915d7 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.h +++ b/src/ui/dialog/filedialogimpl-gtkmm.h @@ -17,6 +17,14 @@ #ifndef __FILE_DIALOGIMPL_H__ #define __FILE_DIALOGIMPL_H__ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + //Gtk includes #include <gtkmm/filechooserdialog.h> #include <glib/gstdio.h> diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index 496836c4d..9d91f5d56 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -16,7 +16,7 @@ #ifdef HAVE_CONFIG_H # include <config.h> #endif - +#include "filedialogimpl-win32.h" //General includes #include <list> #include <unistd.h> @@ -26,9 +26,7 @@ #include <gdk/gdkwin32.h> #include <glib/gstdio.h> #include <glibmm/i18n.h> -#if GLIB_CHECK_VERSION(2,32,0) -#include <glibmm/thread.h> -#endif +#include <glibmm/fileutils.h> #include <gtkmm/window.h> //Inkscape includes @@ -44,7 +42,7 @@ #include "display/canvas-arena.h" #include "filedialog.h" -#include "filedialogimpl-win32.h" + #include "sp-root.h" #include <zlib.h> diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h index e9d8829f7..2e6bb4bb8 100644 --- a/src/ui/dialog/filedialogimpl-win32.h +++ b/src/ui/dialog/filedialogimpl-win32.h @@ -9,11 +9,21 @@ * * Released under GNU GPL, read the file 'COPYING' for more information */ +#if HAVE_CONFIG_H +# include "config.h" +#endif #ifdef WIN32 +#if WITH_GLIBMM_2_32 +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +# include <glibmm/threads.h> +#endif +#endif #include "gc-core.h" #include <windows.h> +#include "filedialogimpl-gtkmm.h" + namespace Inkscape { diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 0d2d0757c..4401d5658 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1155,7 +1155,13 @@ FilterEffectsDialog::FilterModifier::FilterModifier(FilterEffectsDialog& d) sw->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); _list.get_column(1)->set_resizable(true); - + _list.set_reorderable(true); + + // We can track the drag/drop reordering from the row_delete (occurs after + // row_inserted and may occur many times when adding a new item) + _model->signal_row_deleted().connect( + sigc::mem_fun(*this, &FilterModifier::on_filter_reorder)); + sw->set_shadow_type(Gtk::SHADOW_IN); show_all_children(); _add.signal_clicked().connect(sigc::mem_fun(*this, &FilterModifier::add_filter)); @@ -1260,6 +1266,7 @@ void FilterEffectsDialog::FilterModifier::update_selection(Selection *sel) } if (style->filter.set && style->getFilter()) { + SP_ITEM(obj)->bbox_valid = FALSE; used.insert(style->getFilter()); } else { used.insert(0); @@ -1300,6 +1307,13 @@ void FilterEffectsDialog::FilterModifier::on_name_edited(const Glib::ustring& pa } } +void FilterEffectsDialog::FilterModifier::on_filter_reorder(const Gtk::TreeModel::Path& path) { + for(Gtk::TreeModel::iterator i = _model->children().begin(); i != _model->children().end(); ++i) { + SPObject* object = (*i)[_columns.filter]; + object->getRepr()->setPosition(0); + } +} + void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustring& path) { Gtk::TreeIter iter = _model->get_iter(path); diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index 658aac790..a2a2a3c6e 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -86,6 +86,7 @@ private: void on_filter_selection_changed(); void on_name_edited(const Glib::ustring&, const Glib::ustring&); + void on_filter_reorder(const Gtk::TreeModel::Path& path); void on_selection_toggled(const Glib::ustring&); void update_filters(); diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp index d70c5f187..dd07f009a 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -10,6 +10,14 @@ * Released under GNU GPL. Read the file 'COPYING' for more information. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include <gtkmm/stock.h> #include <glibmm/main.h> diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index 9fa94ca8f..bf9133086 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -10,6 +10,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/messagedialog.h> #include <gtkmm/checkbutton.h> #include <gtkmm/scrolledwindow.h> diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h index a15667152..422fed7fe 100644 --- a/src/ui/dialog/guides.h +++ b/src/ui/dialog/guides.h @@ -15,6 +15,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #if WITH_GTKMM_3_0 diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 1a52410b8..468e85d36 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -17,6 +17,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/buttonbox.h> #include <boost/scoped_ptr.hpp> diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 65c6a20fe..bc648002d 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -8,7 +8,7 @@ * Johan Engelen <j.b.c.engelen@ewi.utwente.nl> * Bruno Dilly <bruno.dilly@gmail.com> * - * Copyright (C) 2004-2011 Authors + * Copyright (C) 2004-2013 Authors * * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -642,6 +642,15 @@ void InkscapePreferences::initPageUI() _win_ontop_normal.init ( _("Normal"), "/options/transientpolicy/value", 1, true, &_win_ontop_none); _win_ontop_agressive.init ( _("Aggressive"), "/options/transientpolicy/value", 2, false, &_win_ontop_none); + { + Glib::ustring defaultSizeLabels[] = {_("Small"), _("Large"), _("Maximized")}; + int defaultSizeValues[] = {0, 1, 2}; + + _win_default_size.init( "/options/defaultwindowsize/value", defaultSizeLabels, defaultSizeValues, G_N_ELEMENTS(defaultSizeLabels), 1 ); + _page_windows.add_line( false, _("Default window size:"), _win_default_size, "", + _("Set the default window size"), false); + } + _page_windows.add_group_header( _("Saving window geometry (size and position)")); _page_windows.add_line( true, "", _win_save_geom_off, "", _("Let the window manager determine placement of all windows")); @@ -1332,6 +1341,13 @@ void InkscapePreferences::initPageBehavior() _("Update marker color when object color changes")); this->AddPage(_page_markers, _("Markers"), iter_behavior, PREFS_PAGE_BEHAVIOR_MARKERS); + + + _page_cleanup.add_group_header( _("Document cleanup")); + _cleanup_swatches.init ( _("Remove unused swatches when doing a document cleanup"), "/options/cleanupswatches/value", false); // text label + _page_cleanup.add_line( true, "", _cleanup_swatches, "", + _("Remove unused swatches when doing a document cleanup")); // tooltip + this->AddPage(_page_cleanup, _("Cleanup"), iter_behavior, PREFS_PAGE_BEHAVIOR_CLEANUP); } void InkscapePreferences::initPageRendering() @@ -1423,6 +1439,9 @@ void InkscapePreferences::initPageBitmaps() Glib::ustring values[] = {"embed", "link", "ask"}; _bitmap_import.init("/dialogs/import/link", labels, values, G_N_ELEMENTS(values), "ask"); _page_bitmaps.add_line( false, _("Bitmap import:"), _bitmap_import, "", "", false); + + _bitmap_import_quality.init("/dialogs/import/quality", 1, 100, 1, 1, 100, true, false); + _page_bitmaps.add_line( false, _("Bitmap import quality:"), _bitmap_import_quality, "%", "Bitmap import quality (jpeg only). 100 is best quality", false); } _importexport_import_res.init("/dialogs/import/defaultxdpi/value", 0.0, 6000.0, 1.0, 1.0, PX_PER_IN, true, false); _page_bitmaps.add_line( false, _("Default _import resolution:"), _importexport_import_res, _("dpi"), diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index eaf1ffc3d..37c05df05 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -7,7 +7,7 @@ * Johan Engelen <j.b.c.engelen@ewi.utwente.nl> * Bruno Dilly <bruno.dilly@gmail.com> * - * Copyright (C) 2004-2007 Authors + * Copyright (C) 2004-2013 Authors * * Released under GNU GPL. Read the file 'COPYING' for more information. */ @@ -74,6 +74,7 @@ enum { PREFS_PAGE_BEHAVIOR_CLONES, PREFS_PAGE_BEHAVIOR_MASKS, PREFS_PAGE_BEHAVIOR_MARKERS, + PREFS_PAGE_BEHAVIOR_CLEANUP, PREFS_PAGE_IO, PREFS_PAGE_IO_MOUSE, PREFS_PAGE_IO_SVGOUTPUT, @@ -167,6 +168,7 @@ protected: UI::Widget::DialogPage _page_clones; UI::Widget::DialogPage _page_mask; UI::Widget::DialogPage _page_markers; + UI::Widget::DialogPage _page_cleanup; UI::Widget::DialogPage _page_io; UI::Widget::DialogPage _page_mouse; @@ -241,6 +243,7 @@ protected: UI::Widget::PrefRadioButton _win_gtk; UI::Widget::PrefRadioButton _win_save_dialog_pos_on; UI::Widget::PrefRadioButton _win_save_dialog_pos_off; + UI::Widget::PrefCombo _win_default_size; UI::Widget::PrefRadioButton _win_ontop_none; UI::Widget::PrefRadioButton _win_ontop_normal; UI::Widget::PrefRadioButton _win_ontop_agressive; @@ -310,6 +313,8 @@ protected: UI::Widget::PrefCheckButton _markers_color_stock; UI::Widget::PrefCheckButton _markers_color_custom; UI::Widget::PrefCheckButton _markers_color_update; + + UI::Widget::PrefCheckButton _cleanup_swatches; UI::Widget::PrefSpinButton _importexport_export_res; UI::Widget::PrefSpinButton _importexport_import_res; @@ -366,6 +371,7 @@ protected: UI::Widget::PrefCheckButton _misc_bitmap_autoreload; UI::Widget::PrefSpinButton _bitmap_copy_res; UI::Widget::PrefCombo _bitmap_import; + UI::Widget::PrefSpinButton _bitmap_import_quality; UI::Widget::PrefEntry _kb_search; UI::Widget::PrefCombo _kb_filelist; diff --git a/src/ui/dialog/layer-properties.h b/src/ui/dialog/layer-properties.h index 0e2f8ed94..d38b8edf5 100644 --- a/src/ui/dialog/layer-properties.h +++ b/src/ui/dialog/layer-properties.h @@ -16,6 +16,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include <gtkmm/entry.h> #include <gtkmm/label.h> diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index dd147d00f..c41046123 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -27,6 +27,7 @@ #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" @@ -41,6 +42,7 @@ #include "xml/repr.h" #include "sp-root.h" #include "event-context.h" +#include "selection-chemistry.h" //#define DUMP_LAYERS 1 @@ -98,7 +100,7 @@ void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned i if ( desktop ) { Verb *verb = Verb::get( code ); if ( verb ) { - SPAction *action = verb->get_action(desktop); + 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 ); gtk_widget_show( child ); @@ -130,7 +132,7 @@ Gtk::MenuItem& LayersPanel::_addPopupItem( SPDesktop *desktop, unsigned int code 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 ); } @@ -171,7 +173,7 @@ void LayersPanel::_fireAction( unsigned int code ) if ( _desktop ) { Verb *verb = Verb::get( code ); if ( verb ) { - SPAction *action = verb->get_action(_desktop); + SPAction *action = verb->get_action(Inkscape::ActionContext(_desktop)); if ( action ) { sp_action_perform( action, NULL ); // } else { @@ -403,13 +405,13 @@ void LayersPanel::_addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::R SPObject *child = _desktop->layer_manager->nthChildOf(layer, i); if ( child ) { #if DUMP_LAYERS - g_message(" %3d layer:%p {%s} [%s]", level, child, child->id, child->label() ); + g_message(" %3d layer:%p {%s} [%s]", level, child, child->getId(), child->label() ); #endif // DUMP_LAYERS Gtk::TreeModel::iterator iter = parentRow ? _store->prepend(parentRow->children()) : _store->prepend(); Gtk::TreeModel::Row row = *iter; row[_model->_colObject] = child; - row[_model->_colLabel] = child->label() ? child->label() : child->getId(); + row[_model->_colLabel] = child->defaultLabel(); row[_model->_colVisible] = SP_IS_ITEM(child) ? !SP_ITEM(child)->isHidden() : false; row[_model->_colLocked] = SP_IS_ITEM(child) ? SP_ITEM(child)->isLocked() : false; @@ -536,6 +538,7 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol ) break; } } + Inkscape::SelectionHelper::fixSelection(_desktop); } bool LayersPanel::_handleKeyEvent(GdkEventKey *event) diff --git a/src/ui/dialog/layers.h b/src/ui/dialog/layers.h index e9fd9ebc6..ae0ac6040 100644 --- a/src/ui/dialog/layers.h +++ b/src/ui/dialog/layers.h @@ -12,6 +12,14 @@ #ifndef SEEN_LAYERS_PANEL_H #define SEEN_LAYERS_PANEL_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/treeview.h> #include <gtkmm/treestore.h> diff --git a/src/ui/dialog/livepatheffect-add.h b/src/ui/dialog/livepatheffect-add.h index 00f58b038..7fa766272 100644 --- a/src/ui/dialog/livepatheffect-add.h +++ b/src/ui/dialog/livepatheffect-add.h @@ -11,6 +11,14 @@ #ifndef INKSCAPE_DIALOG_LIVEPATHEFFECT_ADD_H #define INKSCAPE_DIALOG_LIVEPATHEFFECT_ADD_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include <gtkmm/liststore.h> #include <gtkmm/treeview.h> diff --git a/src/ui/dialog/messages.h b/src/ui/dialog/messages.h index 6ed246ece..54ca84f47 100644 --- a/src/ui/dialog/messages.h +++ b/src/ui/dialog/messages.h @@ -16,6 +16,14 @@ #ifndef INKSCAPE_UI_DIALOG_MESSAGES_H #define INKSCAPE_UI_DIALOG_MESSAGES_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/textview.h> #include <gtkmm/button.h> diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index c597bc849..f87288494 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -919,7 +919,7 @@ void ImportDialog::on_image_downloaded(Glib::ustring path, bool success) m_signal_response.emit(path); widget_status->set_info(_("Clipart downloaded successfully")); } catch(Glib::Error) { - success = false; + // success = false; //has no effect, value not returned } cancelled_image = false; @@ -943,7 +943,7 @@ void ImportDialog::on_thumbnail_downloaded(Glib::ustring path, bool success) widget_status->clear(); preview_files->set_image(path); } catch(Glib::Error) { - success = false; + // success = false; //has no effect, value not returned } cancelled_thumbnail = false; diff --git a/src/ui/dialog/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h index 8cb247766..e21030bcd 100644 --- a/src/ui/dialog/ocaldialogs.h +++ b/src/ui/dialog/ocaldialogs.h @@ -13,6 +13,14 @@ #ifndef __OCAL_DIALOG_H__ #define __OCAL_DIALOG_H__ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + //Gtk includes #include <gtkmm/box.h> #include <gtkmm/eventbox.h> diff --git a/src/ui/dialog/spellcheck.h b/src/ui/dialog/spellcheck.h index ab75809f3..27b89e34e 100644 --- a/src/ui/dialog/spellcheck.h +++ b/src/ui/dialog/spellcheck.h @@ -12,6 +12,14 @@ #ifndef SEEN_SPELLCHECK_H #define SEEN_SPELLCHECK_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/button.h> #include <gtkmm/buttonbox.h> diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 2884de173..d4d80c9b1 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -56,6 +56,7 @@ #include "verbs.h" #include "gradient-chemistry.h" #include "helper/action.h" +#include "helper/action-context.h" namespace Inkscape { namespace UI { @@ -153,7 +154,7 @@ static void editGradientImpl( SPDesktop* desktop, SPGradient* gr ) // Invoke the gradient tool Inkscape::Verb *verb = Inkscape::Verb::get( SP_VERB_CONTEXT_GRADIENT ); if ( verb ) { - SPAction *action = verb->get_action( ( Inkscape::UI::View::View * ) SP_ACTIVE_DESKTOP); + SPAction *action = verb->get_action( Inkscape::ActionContext( ( Inkscape::UI::View::View * ) SP_ACTIVE_DESKTOP ) ); if ( action ) { sp_action_perform( action, NULL ); } diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 989375bbd..26bc52947 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -18,10 +18,15 @@ #include <functional> #include <sstream> +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/buttonbox.h> #include <gtkmm/label.h> #if WITH_GTKMM_3_0 +# include <gtkmm/togglebutton.h> # include <gtkmm/grid.h> #else # include <gtkmm/table.h> @@ -40,9 +45,11 @@ #include "ui/cache/svg_preview_cache.h" #include "ui/clipboard.h" +#include "ui/icon-names.h" #include "symbols.h" +#include "selection.h" #include "desktop.h" #include "desktop-handles.h" #include "document.h" @@ -51,6 +58,7 @@ #include "sp-use.h" #include "sp-defs.h" #include "sp-symbol.h" +#include "widgets/icon.h" #ifdef WITH_LIBVISIO #include <libvisio/libvisio.h> @@ -58,6 +66,8 @@ #endif #include "verbs.h" +#include "helper/action.h" +#include "helper/action-context.h" #include "xml/repr.h" namespace Inkscape { @@ -96,8 +106,6 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : UI::Widget::Panel("", prefsPath, SP_VERB_DIALOG_SYMBOLS), store(Gtk::ListStore::create(*getColumns())), iconView(0), - previewScale(0), - previewSize(0), currentDesktop(0), deskTrack(), currentDocument(0), @@ -136,8 +144,8 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : 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)); + sigc::connection connSet = symbolSet->signal_changed().connect( + sigc::mem_fun(*this, &SymbolsDialog::rebuild)); instanceConns.push_back(connSet); ++row; @@ -148,7 +156,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : iconView = new Gtk::IconView(static_cast<Glib::RefPtr<Gtk::TreeModel> >(store)); //iconView->set_text_column( columns->symbol_id ); iconView->set_tooltip_column( 1 ); - iconView->set_pixbuf_column( columns->symbol_image ); + iconView->set_pixbuf_column( columns->symbol_image ); // Giving the iconview a small minimum size will help users understand // What the dialog does. iconView->set_size_request( 100, 200 ); @@ -157,11 +165,12 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : targets.push_back(Gtk::TargetEntry( "application/x-inkscape-paste")); iconView->enable_model_drag_source (targets, Gdk::BUTTON1_MASK, Gdk::ACTION_COPY); - iconView->signal_drag_data_get().connect(sigc::mem_fun(*this, &SymbolsDialog::iconDragDataGet)); + iconView->signal_drag_data_get().connect( + sigc::mem_fun(*this, &SymbolsDialog::iconDragDataGet)); sigc::connection connIconChanged; - connIconChanged = - iconView->signal_selection_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::iconChanged)); + connIconChanged = iconView->signal_selection_changed().connect( + sigc::mem_fun(*this, &SymbolsDialog::iconChanged)); instanceConns.push_back(connIconChanged); Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow(); @@ -178,63 +187,68 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : ++row; - /******************** Preview Scale ***********************/ - Gtk::Label* labelScale = new Gtk::Label(_("Preview scale: ")); + /******************** Tools *******************************/ + Gtk::Button* button; + Gtk::HBox* tools = new Gtk::HBox(); + //tools->set_layout( Gtk::BUTTONBOX_END ); #if WITH_GTKMM_3_0 - table->attach(*Gtk::manage(labelScale),0,row,1,1); + scroller->set_hexpand(); + table->attach(*Gtk::manage(tools),0,row,2,1); #else - table->attach(*Gtk::manage(labelScale),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); + table->attach(*Gtk::manage(tools),0,2,row,row+1,Gtk::EXPAND|Gtk::FILL,Gtk::FILL); #endif - previewScale = new Gtk::ComboBoxText(); - const gchar *scales[] = - {_("Fit"), _("Fit to width"), _("Fit to height"), "0.1", "0.2", "0.5", "1.0", "2.0", "5.0", NULL}; - for( int i = 0; scales[i]; ++i ) { - previewScale->append(scales[i]); - } - previewScale->set_active_text(scales[0]); + 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->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); + + 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->set_tooltip_text(_("Remove Symbol from the current document.")); + removeSymbol->set_relief( Gtk::RELIEF_NONE ); + removeSymbol->set_focus_on_click( false ); + removeSymbol->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::revertSymbol)); + tools->pack_start(* removeSymbol, Gtk::PACK_SHRINK); + + Gtk::Label* spacer = Gtk::manage(new Gtk::Label("")); + tools->pack_start(* Gtk::manage(spacer)); + + in_sizes = 2; // Default 32px + button = Gtk::manage(new Gtk::Button()); + button->add(*Gtk::manage(Glib::wrap( + sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-bigger")))) ); + button->set_tooltip_text(_("Make Icons bigger by zooming in.")); + button->set_relief( Gtk::RELIEF_NONE ); + button->set_focus_on_click( false ); + button->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::zoomin)); + tools->pack_start(* button, Gtk::PACK_SHRINK); + + button = Gtk::manage(new Gtk::Button()); + button->add(*Gtk::manage(Glib::wrap( + sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-smaller")))) ); + button->set_tooltip_text(_("Make Icons smaller by zooming out.")); + button->set_relief( Gtk::RELIEF_NONE ); + button->set_focus_on_click( false ); + button->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::zoomout)); + tools->pack_start(* button, Gtk::PACK_SHRINK); + + 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->set_tooltip_text(_("Toggle 'fit' symbols in icon space.")); + fitSymbol->set_relief( Gtk::RELIEF_NONE ); + fitSymbol->set_focus_on_click( false ); + fitSymbol->set_active( true ); + fitSymbol->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild)); + tools->pack_start(* fitSymbol, Gtk::PACK_SHRINK); -#if WITH_GTKMM_3_0 - previewScale->set_hexpand(); - table->attach(*Gtk::manage(previewScale),1,row,1,1); -#else - table->attach(*Gtk::manage(previewScale),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); -#endif - - sigc::connection connScale = - previewScale->signal_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild)); - instanceConns.push_back(connScale); - - ++row; - - /******************** Preview Size ************************/ - Gtk::Label* labelSize = new Gtk::Label(_("Preview size: ")); - -#if WITH_GTKMM_3_0 - table->attach(*Gtk::manage(labelSize),0,row,1,1); -#else - table->attach(*Gtk::manage(labelSize),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); -#endif - - previewSize = new Gtk::ComboBoxText(); - const gchar *sizes[] = {"16", "24", "32", "48", "64", NULL}; - for( int i = 0; sizes[i]; ++i ) { - previewSize->append(sizes[i]); - } - previewSize->set_active_text(sizes[2]); - -#if WITH_GTKMM_3_0 - previewSize->set_hexpand(); - table->attach(*Gtk::manage(previewSize),1,row,1,1); -#else - table->attach(*Gtk::manage(previewSize),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); -#endif - - sigc::connection connSize = - previewSize->signal_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild)); - instanceConns.push_back(connSize); - ++row; /**********************************************************/ @@ -253,6 +267,10 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : sigc::mem_fun(*this, &SymbolsDialog::defsModified)); instanceConns.push_back(defsModifiedConn); + sigc::connection selectionChangedConn = currentDesktop->selection->connectChanged( + sigc::mem_fun(*this, &SymbolsDialog::selectionChanged)); + instanceConns.push_back(selectionChangedConn); + get_symbols(); draw_symbols( currentDocument ); /* Defaults to current document */ @@ -277,6 +295,20 @@ SymbolsDialog& SymbolsDialog::getInstance() return *new SymbolsDialog(); } +void SymbolsDialog::zoomin() { + if(in_sizes < 4) { + in_sizes++; + rebuild(); + } +} + +void SymbolsDialog::zoomout() { + if(in_sizes > 0) { + in_sizes--; + rebuild(); + } +} + void SymbolsDialog::rebuild() { store->clear(); @@ -287,10 +319,27 @@ void SymbolsDialog::rebuild() { // Symbol must be from Current Document (this method of // checking should be language independent). symbolDocument = currentDocument; + addSymbol->set_sensitive( true ); + removeSymbol->set_sensitive( true ); + } else { + addSymbol->set_sensitive( false ); + removeSymbol->set_sensitive( false ); } draw_symbols( symbolDocument ); } +void SymbolsDialog::insertSymbol() { + Inkscape::Verb *verb = Inkscape::Verb::get( SP_VERB_EDIT_SYMBOL ); + SPAction *action = verb->get_action(Inkscape::ActionContext( (Inkscape::UI::View::View *) this->currentDesktop) ); + sp_action_perform (action, NULL); +} + +void SymbolsDialog::revertSymbol() { + Inkscape::Verb *verb = Inkscape::Verb::get( SP_VERB_EDIT_UNSYMBOL ); + SPAction *action = verb->get_action(Inkscape::ActionContext( (Inkscape::UI::View::View *) this->currentDesktop ) ); + sp_action_perform (action, NULL); +} + void SymbolsDialog::iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& /*context*/, Gtk::SelectionData& data, guint /*info*/, guint /*time*/) { #if WITH_GTKMM_3_0 @@ -312,55 +361,75 @@ void SymbolsDialog::iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& /*cont } -void SymbolsDialog::defsModified(SPObject *object, guint flags) +void SymbolsDialog::defsModified(SPObject * /*object*/, guint /*flags*/) { if ( !symbolSets[symbolSet->get_active_text()] ) { rebuild(); } } -void SymbolsDialog::iconChanged() { -#if WITH_GTKMM_3_0 - std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items(); -#else - Gtk::IconView::ArrayHandle_TreePaths iconArray = iconView->get_selected_items(); -#endif +void SymbolsDialog::selectionChanged(Inkscape::Selection *selection) { + Glib::ustring symbol_id = selectedSymbolId(); + SPDocument* symbolDocument = selectedSymbols(); + SPObject* symbol = symbolDocument->getObjectById(symbol_id); - if( iconArray.empty() ) { - //std::cout << " iconArray empty: huh? " << std::endl; - } else { + if(symbol && !selection->includes(symbol)) { + iconView->unselect_all(); + } +} + +SPDocument* SymbolsDialog::selectedSymbols() { + /* OK, we know symbol name... now we need to copy it to clipboard, bon chance! */ + Glib::ustring symbolSetString = symbolSet->get_active_text(); + + SPDocument* symbolDocument = symbolSets[symbolSetString]; + if( !symbolDocument ) { + // Symbol must be from Current Document (this method of checking should be language independent). + return currentDocument; + } + return symbolDocument; +} + +Glib::ustring SymbolsDialog::selectedSymbolId() { + #if WITH_GTKMM_3_0 + std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items(); + #else + Gtk::IconView::ArrayHandle_TreePaths iconArray = iconView->get_selected_items(); + #endif + if( !iconArray.empty() ) { Gtk::TreeModel::Path const & path = *iconArray.begin(); Gtk::ListStore::iterator row = store->get_iter(path); - Glib::ustring symbol_id = (*row)[getColumns()->symbol_id]; + return (*row)[getColumns()->symbol_id]; + } + return Glib::ustring(""); +} - /* OK, we know symbol name... now we need to copy it to clipboard, bon chance! */ - Glib::ustring symbolSetString = symbolSet->get_active_text(); +void SymbolsDialog::iconChanged() { - SPDocument* symbolDocument = symbolSets[symbolSetString]; - if( !symbolDocument ) { - // Symbol must be from Current Document (this method of - // checking should be language independent). - symbolDocument = currentDocument; - } + Glib::ustring symbol_id = selectedSymbolId(); + SPDocument* symbolDocument = selectedSymbols(); + SPObject* symbol = symbolDocument->getObjectById(symbol_id); - SPObject* symbol = symbolDocument->getObjectById(symbol_id); - if( symbol ) { - - // Find style for use in <use> - // First look for default style stored in <symbol> - gchar const* style = symbol->getAttribute("inkscape:symbol-style"); - if( !style ) { - // If no default style in <symbol>, look in documents. - if( symbolDocument == currentDocument ) { - style = style_from_use( symbol_id.c_str(), currentDocument ); - } else { - style = symbolDocument->getReprRoot()->attribute("style"); - } - } + if( symbol ) { + if( symbolDocument == currentDocument ) { + // Select the symbol on the canvas so it can be manipulated + currentDesktop->selection->set( symbol, false ); + } - ClipboardManager *cm = ClipboardManager::get(); - cm->copySymbol(symbol->getRepr(), style); + // Find style for use in <use> + // First look for default style stored in <symbol> + gchar const* style = symbol->getAttribute("inkscape:symbol-style"); + if( !style ) { + // If no default style in <symbol>, look in documents. + if( symbolDocument == currentDocument ) { + style = style_from_use( symbol_id.c_str(), currentDocument ); + } else { + style = symbolDocument->getReprRoot()->attribute("style"); + } } + + ClipboardManager *cm = ClipboardManager::get(); + cm->copySymbol(symbol->getRepr(), style); } } @@ -485,6 +554,9 @@ void SymbolsDialog::get_symbols() { symbol_doc = SPDocument::createNewDoc( fullname, FALSE ); if( symbol_doc ) { gchar *title = symbol_doc->getRoot()->title(); + if( title == NULL ) { + title = _("Unnamed Symbols"); + } symbolSets[Glib::ustring(title)] = symbol_doc; symbolSet->append(title); } @@ -672,11 +744,7 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id, SPObject *symbol) SPItem *item = SP_ITEM(object_temp); - Glib::ustring previewSizeString = previewSize->get_active_text(); - unsigned psize = atol( previewSizeString.c_str() ); - - Glib::ustring previewScaleString = previewScale->get_active_text(); - int previewScaleRow = previewScale->get_active_row_number(); + unsigned psize = SYMBOL_ICON_SIZES[in_sizes]; /* Update to renderable state */ Glib::ustring key = svg_preview_cache.cache_key(previewDocument->getURI(), symbol_id, psize); @@ -707,21 +775,9 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id, SPObject *symbol) height = 1.0; } - switch (previewScaleRow) { - case 0: - /* Fit */ - scale = psize/std::max(width,height); - break; - case 1: - /* Fit width */ - scale = psize/width; - break; - case 2: - /* Fit height */ - scale = psize/height; - break; - default: - scale = atof( previewScaleString.c_str() ); + if( fitSymbol->get_active() ) { + /* Fit */ + scale = psize/std::max(width,height); } pixbuf = Glib::wrap(render_pixbuf(renderDrawing, scale, *dbox, psize)); diff --git a/src/ui/dialog/symbols.h b/src/ui/dialog/symbols.h index b81f6981e..54b1a3ab0 100644 --- a/src/ui/dialog/symbols.h +++ b/src/ui/dialog/symbols.h @@ -2,9 +2,10 @@ * @brief Symbols dialog */ /* Authors: - * Tavmjong Bah + * Tavmjong Bah, Martin Owens * * Copyright (C) 2012 Tavmjong Bah + * 2013 Martin Owens * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -29,8 +30,27 @@ namespace Dialog { class SymbolColumns; // For Gtk::ListStore /** - * A dialog that displays selectable symbols. + * A dialog that displays selectable symbols and allows users to drag or paste + * those symbols from the dialog into the document. + * + * Symbol documents are loaded from the preferences paths and displayed in a + * drop-down list to the user. The user then selects which of the symbols + * documents they want to get symbols from. The first document in the list is + * always the current document. + * + * This then updates an icon-view with all the symbols available. Selecting one + * puts it onto the clipboard. Dragging it or pasting it onto the canvas copies + * the symbol from the symbol document, into the current document and places a + * new <use element at the correct location on the canvas. + * + * Selected groups on the canvas can be added to the current document's symbols + * table, and symbols can be removed from the current document. This allows + * new symbols documents to be constructed and if saved in the prefs folder will + * make those symbols available for all future documents. */ + +const int SYMBOL_ICON_SIZES[] = {16, 24, 32, 48, 64}; + class SymbolsDialog : public UI::Widget::Panel { public: @@ -45,8 +65,15 @@ private: static SymbolColumns *getColumns(); + void zoomin(); + void zoomout(); void rebuild(); + void insertSymbol(); + void revertSymbol(); void defsModified(SPObject *object, guint flags); + void selectionChanged(Inkscape::Selection *selection); + SPDocument* selectedSymbols(); + Glib::ustring selectedSymbolId(); void iconChanged(); void iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& selection_data, guint info, guint time); @@ -67,12 +94,15 @@ private: /* Keep track of all symbol template documents */ std::map<Glib::ustring, SPDocument*> symbolSets; + // Index into sizes which is selected + int in_sizes; Glib::RefPtr<Gtk::ListStore> store; Gtk::ComboBoxText* symbolSet; Gtk::IconView* iconView; - Gtk::ComboBoxText* previewScale; - Gtk::ComboBoxText* previewSize; + Gtk::Button* addSymbol; + Gtk::Button* removeSymbol; + Gtk::ToggleButton* fitSymbol; void setTargetDesktop(SPDesktop *desktop); SPDesktop* currentDesktop; diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 9f3294275..a662495a0 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -650,7 +650,7 @@ void TextEdit::onFontChange(SPFontSelector * /*fontsel*/, gchar* fontspec, TextE } -void TextEdit::onStartOffsetChange(GtkTextBuffer *text_buffer, TextEdit *self) +void TextEdit::onStartOffsetChange(GtkTextBuffer * /*text_buffer*/, TextEdit *self) { SPItem *text = self->getSelectedTextItem(); if (text && SP_IS_TEXT_TEXTPATH(text)) diff --git a/src/ui/dialog/text-edit.h b/src/ui/dialog/text-edit.h index 0e3ebafa7..8683d80a3 100644 --- a/src/ui/dialog/text-edit.h +++ b/src/ui/dialog/text-edit.h @@ -18,6 +18,14 @@ #ifndef INKSCAPE_UI_DIALOG_TEXT_EDIT_H #define INKSCAPE_UI_DIALOG_TEXT_EDIT_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/notebook.h> #include <gtkmm/button.h> diff --git a/src/ui/dialog/tile.h b/src/ui/dialog/tile.h index 86dbd25a9..6e41723fd 100644 --- a/src/ui/dialog/tile.h +++ b/src/ui/dialog/tile.h @@ -19,6 +19,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/notebook.h> #include <gtkmm/checkbutton.h> diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index c071fcf95..ce8af3f1f 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -15,6 +15,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include <gtkmm/stock.h> #include <2geom/transforms.h> @@ -27,6 +31,7 @@ #include "inkscape.h" #include "selection.h" #include "selection-chemistry.h" +#include "message-stack.h" #include "verbs.h" #include "preferences.h" #include "sp-namedview.h" @@ -758,7 +763,7 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) double move = x; for ( std::vector<BBoxSort> ::iterator it (sorted.begin()); it < sorted.end(); - it ++ ) + ++it ) { sp_item_move_rel(it->item, Geom::Translate(move, 0)); // move each next object by x relative to previous @@ -782,7 +787,7 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) double move = y; for ( std::vector<BBoxSort> ::iterator it (sorted.begin()); it < sorted.end(); - it ++ ) + ++it ) { sp_item_move_rel(it->item, Geom::Translate(0, move)); // move each next object by x relative to previous @@ -898,10 +903,21 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) if (!_units_skew.isAbsolute()) { // percentage double skewX = _scalar_skew_horizontal.getValue("%"); double skewY = _scalar_skew_vertical.getValue("%"); + if (fabs(0.01*skewX*0.01*skewY - 1.0) < Geom::EPSILON) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } sp_item_skew_rel (item, 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"); + if ((fabs(angleX - angleY + M_PI/2) < Geom::EPSILON) + || (fabs(angleX - angleY - M_PI/2) < Geom::EPSILON) + || (fabs((angleX - angleY)/3 + M_PI/2) < Geom::EPSILON) + || (fabs((angleX - angleY)/3 - M_PI/2) < Geom::EPSILON)) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } double skewX = tan(-angleX); double skewY = tan(angleY); sp_item_skew_rel (item, skewX, skewY); @@ -912,6 +928,10 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) if (bbox) { double width = bbox->dimensions()[Geom::X]; double height = bbox->dimensions()[Geom::Y]; + if (fabs(skewX*skewY - width*height) < Geom::EPSILON) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } sp_item_skew_rel (item, skewX/height, skewY/width); } } @@ -927,16 +947,31 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) if (!_units_skew.isAbsolute()) { // percentage double skewX = _scalar_skew_horizontal.getValue("%"); double skewY = _scalar_skew_vertical.getValue("%"); + if (fabs(0.01*skewX*0.01*skewY - 1.0) < Geom::EPSILON) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } sp_selection_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"); + if ((fabs(angleX - angleY + M_PI/2) < Geom::EPSILON) + || (fabs(angleX - angleY - M_PI/2) < Geom::EPSILON) + || (fabs((angleX - angleY)/3 + M_PI/2) < Geom::EPSILON) + || (fabs((angleX - angleY)/3 - M_PI/2) < Geom::EPSILON)) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } double skewX = tan(-angleX); double skewY = tan(angleY); sp_selection_skew_relative(selection, *center, skewX, skewY); } else { // absolute displacement double skewX = _scalar_skew_horizontal.getValue("px"); double skewY = _scalar_skew_vertical.getValue("px"); + if (fabs(skewX*skewY - width*height) < Geom::EPSILON) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } sp_selection_skew_relative(selection, *center, skewX/height, skewY/width); } } @@ -957,6 +992,10 @@ void Transformation::applyPageTransform(Inkscape::Selection *selection) double f = _scalar_transform_f.getValue(); Geom::Affine displayed(a, b, c, d, e, f); + if (displayed.isSingular()) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } if (_check_replace_matrix.get_active()) { for (GSList const *l = selection->itemList(); l != NULL; l = l->next) { diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h index f6d1985cc..f9f923be4 100644 --- a/src/ui/previewholder.h +++ b/src/ui/previewholder.h @@ -16,6 +16,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/bin.h> diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 70bd0e859..5d5ea2adc 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -224,10 +224,12 @@ void MultiPathManipulator::shiftSelection(int dir) SubpathList::iterator last_j; NodeList::iterator last_k; bool anything_found = false; + bool anynode_found = false; for (MapType::iterator i = _mmap.begin(); i != _mmap.end(); ++i) { SubpathList &sp = i->second->subpathList(); for (SubpathList::iterator j = sp.begin(); j != sp.end(); ++j) { + anynode_found = true; for (NodeList::iterator k = (*j)->begin(); k != (*j)->end(); ++k) { if (k->selected()) { last_i = i; @@ -249,10 +251,12 @@ void MultiPathManipulator::shiftSelection(int dir) if (!anything_found) { // select first / last node // this should never fail because there must be at least 1 non-empty manipulator - if (dir == 1) { + if (anynode_found) { + if (dir == 1) { _selection.insert((*_mmap.begin()->second->subpathList().begin())->begin().ptr()); - } else { + } else { _selection.insert((--(*--(--_mmap.end())->second->subpathList().end())->end()).ptr()); + } } return; } diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp index 348420994..daed3a523 100644 --- a/src/ui/tool/transform-handle-set.cpp +++ b/src/ui/tool/transform-handle-set.cpp @@ -459,9 +459,9 @@ private: static Glib::RefPtr<Gdk::Pixbuf> _corner_to_pixbuf(unsigned c) { //sp_select_context_get_type(); switch (c % 4) { - case 0: return Glib::wrap(handles[10], true); - case 1: return Glib::wrap(handles[8], true); - case 2: return Glib::wrap(handles[6], true); + case 0: return Glib::wrap(handles[7], true); + case 1: return Glib::wrap(handles[6], true); + case 2: return Glib::wrap(handles[5], true); default: return Glib::wrap(handles[4], true); } } @@ -606,9 +606,9 @@ private: static Glib::RefPtr<Gdk::Pixbuf> _side_to_pixbuf(unsigned s) { //sp_select_context_get_type(); switch (s % 4) { - case 0: return Glib::wrap(handles[9], true); - case 1: return Glib::wrap(handles[7], true); - case 2: return Glib::wrap(handles[5], true); + case 0: return Glib::wrap(handles[10], true); + case 1: return Glib::wrap(handles[9], true); + case 2: return Glib::wrap(handles[8], true); default: return Glib::wrap(handles[11], true); } } diff --git a/src/ui/widget/button.h b/src/ui/widget/button.h index efadfad07..a214dd881 100644 --- a/src/ui/widget/button.h +++ b/src/ui/widget/button.h @@ -10,6 +10,14 @@ #ifndef INKSCAPE_UI_WIDGET_BUTTON_H #define INKSCAPE_UI_WIDGET_BUTTON_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/checkbutton.h> #include <gtkmm/radiobutton.h> diff --git a/src/ui/widget/color-picker.h b/src/ui/widget/color-picker.h index e20212615..b4da5dbf2 100644 --- a/src/ui/widget/color-picker.h +++ b/src/ui/widget/color-picker.h @@ -13,7 +13,16 @@ #ifndef __COLOR_PICKER_H__ #define __COLOR_PICKER_H__ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <stddef.h> + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include <gtkmm/button.h> #include <sigc++/sigc++.h> diff --git a/src/ui/widget/color-preview.h b/src/ui/widget/color-preview.h index caddfb9a2..959b5e09b 100644 --- a/src/ui/widget/color-preview.h +++ b/src/ui/widget/color-preview.h @@ -15,6 +15,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/widget.h> namespace Inkscape { diff --git a/src/ui/widget/dock-item.h b/src/ui/widget/dock-item.h index 608badb62..cc0c13eea 100644 --- a/src/ui/widget/dock-item.h +++ b/src/ui/widget/dock-item.h @@ -11,6 +11,14 @@ #ifndef INKSCAPE_UI_WIGET_DOCK_ITEM_H #define INKSCAPE_UI_WIGET_DOCK_ITEM_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/frame.h> #include <gtkmm/window.h> diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp index 2bfc7e0df..52e9ea605 100644 --- a/src/ui/widget/dock.cpp +++ b/src/ui/widget/dock.cpp @@ -48,11 +48,21 @@ const int Dock::_default_dock_bar_width = 36; Dock::Dock(Gtk::Orientation orientation) - : _gdl_dock (GDL_DOCK (gdl_dock_new())), - _gdl_dock_bar (GDL_DOCK_BAR (gdl_dock_bar_new(GDL_DOCK(_gdl_dock)))), + : _gdl_dock(gdl_dock_new()), +#if WITH_GDL_3_6 + _gdl_dock_bar(GDL_DOCK_BAR(gdl_dock_bar_new(G_OBJECT(_gdl_dock)))), +#else + _gdl_dock_bar(GDL_DOCK_BAR(gdl_dock_bar_new(GDL_DOCK(_gdl_dock)))), +#endif _scrolled_window (Gtk::manage(new Gtk::ScrolledWindow)) { - gdl_dock_bar_set_orientation(_gdl_dock_bar, static_cast<GtkOrientation>(orientation)); +#if WITH_GDL_3_6 + gtk_orientable_set_orientation(GTK_ORIENTABLE(_gdl_dock_bar), + static_cast<GtkOrientation>(orientation)); +#else + gdl_dock_bar_set_orientation(_gdl_dock_bar, + static_cast<GtkOrientation>(orientation)); +#endif #if WITH_GTKMM_3_0 switch(orientation) { @@ -127,7 +137,9 @@ Dock::~Dock() void Dock::addItem(DockItem& item, DockItem::Placement placement) { _dock_items.push_back(&item); - gdl_dock_add_item(_gdl_dock, GDL_DOCK_ITEM(item.gobj()), (GdlDockPlacement)placement); + gdl_dock_add_item(GDL_DOCK(_gdl_dock), + GDL_DOCK_ITEM(item.gobj()), + (GdlDockPlacement)placement); // FIXME: This is a hack to prevent the dock from expanding the main window, this can't be done // initially as the paned doesn't exist. diff --git a/src/ui/widget/dock.h b/src/ui/widget/dock.h index 28ab42740..33e60b836 100644 --- a/src/ui/widget/dock.h +++ b/src/ui/widget/dock.h @@ -12,6 +12,14 @@ #ifndef INKSCAPE_UI_WIDGET_DOCK_H #define INKSCAPE_UI_WIDGET_DOCK_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <list> #include "ui/widget/dock-item.h" @@ -66,11 +74,11 @@ protected: /** Interface widgets, will be packed like * _scrolled_window -> (_dock_box -> (_paned -> (_dock -> _filler) | _dock_bar)) */ - Gtk::Box *_dock_box; - Gtk::Paned* _paned; - GdlDock *_gdl_dock; - GdlDockBar *_gdl_dock_bar; - Gtk::VBox _filler; + Gtk::Box *_dock_box; + Gtk::Paned *_paned; + GtkWidget *_gdl_dock; + GdlDockBar *_gdl_dock_bar; + Gtk::VBox _filler; Gtk::ScrolledWindow *_scrolled_window; /** Internal signal handlers */ diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index c622796b2..0f526f77a 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -17,6 +17,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/scrolledwindow.h> #include <gtkmm/entry.h> diff --git a/src/ui/widget/filter-effect-chooser.h b/src/ui/widget/filter-effect-chooser.h index ae3ec07c4..6f0c2f26e 100644 --- a/src/ui/widget/filter-effect-chooser.h +++ b/src/ui/widget/filter-effect-chooser.h @@ -12,6 +12,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/combobox.h> diff --git a/src/ui/widget/frame.h b/src/ui/widget/frame.h index a04666651..55638ad40 100644 --- a/src/ui/widget/frame.h +++ b/src/ui/widget/frame.h @@ -10,6 +10,14 @@ #ifndef INKSCAPE_UI_WIDGET_FRAME_H #define INKSCAPE_UI_WIDGET_FRAME_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/alignment.h> #include <gtkmm/frame.h> #include <gtkmm/label.h> diff --git a/src/ui/widget/imageicon.h b/src/ui/widget/imageicon.h index 2ea8b8533..8faf13cb1 100644 --- a/src/ui/widget/imageicon.h +++ b/src/ui/widget/imageicon.h @@ -12,6 +12,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <glibmm/ustring.h> diff --git a/src/ui/widget/imagetoggler.h b/src/ui/widget/imagetoggler.h index 7b02fa4dc..df6eb7ded 100644 --- a/src/ui/widget/imagetoggler.h +++ b/src/ui/widget/imagetoggler.h @@ -14,6 +14,10 @@ #include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/cellrendererpixbuf.h> #include <gtkmm/widget.h> #include <glibmm/property.h> diff --git a/src/ui/widget/labelled.h b/src/ui/widget/labelled.h index 88eb3ce19..5334454bc 100644 --- a/src/ui/widget/labelled.h +++ b/src/ui/widget/labelled.h @@ -11,6 +11,14 @@ #ifndef INKSCAPE_UI_WIDGET_LABELLED_H #define INKSCAPE_UI_WIDGET_LABELLED_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> namespace Gtk { diff --git a/src/ui/widget/licensor.h b/src/ui/widget/licensor.h index ab6abd0a4..0ac3e5ab8 100644 --- a/src/ui/widget/licensor.h +++ b/src/ui/widget/licensor.h @@ -10,6 +10,14 @@ #ifndef INKSCAPE_UI_WIDGET_LICENSOR_H #define INKSCAPE_UI_WIDGET_LICENSOR_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> class SPDocument; diff --git a/src/ui/widget/notebook-page.h b/src/ui/widget/notebook-page.h index d8b8fb0c4..38ae9e054 100644 --- a/src/ui/widget/notebook-page.h +++ b/src/ui/widget/notebook-page.h @@ -14,6 +14,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> namespace Gtk { diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h index bee9f09b9..19a6cb2a5 100644 --- a/src/ui/widget/object-composite-settings.h +++ b/src/ui/widget/object-composite-settings.h @@ -11,6 +11,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/alignment.h> #include <gtkmm/adjustment.h> diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index fa3f8e3a1..988c4e5de 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -36,6 +36,7 @@ #include "document.h" #include "desktop.h" #include "helper/action.h" +#include "helper/action-context.h" #include "helper/units.h" #include "inkscape.h" #include "sp-namedview.h" @@ -619,7 +620,7 @@ PageSizer::fire_fit_canvas_to_selection_or_drawing() Verb *verb = Verb::get( SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING ); if (verb) { - SPAction *action = verb->get_action(dt); + SPAction *action = verb->get_action(Inkscape::ActionContext(dt)); if (action) { sp_action_perform(action, NULL); } diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 7eb114d0a..d60eeefe0 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -15,6 +15,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> // for Gtk::RESPONSE_* #include <gtkmm/menu.h> #include <gtkmm/stock.h> diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 5bb054577..0c3d822b8 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -17,6 +17,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/arrow.h> #include <gtkmm/button.h> diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index d32de6871..567f29f91 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -18,6 +18,10 @@ #include <windows.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/frame.h> #include <gtkmm/alignment.h> diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index e3968045d..cb4ce17d1 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -15,8 +15,17 @@ #ifndef INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H #define INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <iostream> #include <vector> + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/filechooserbutton.h> #include "ui/widget/spinbutton.h" #include <stddef.h> diff --git a/src/ui/widget/rotateable.cpp b/src/ui/widget/rotateable.cpp index 1d91515e5..18d53bf5c 100644 --- a/src/ui/widget/rotateable.cpp +++ b/src/ui/widget/rotateable.cpp @@ -7,6 +7,14 @@ * Released under GNU GPL. Read the file 'COPYING' for more information. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/eventbox.h> #include <glibmm/i18n.h> diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h index 9b78cb17f..e5bc4f883 100644 --- a/src/ui/widget/selected-style.h +++ b/src/ui/widget/selected-style.h @@ -15,6 +15,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #if WITH_GTKMM_3_0 diff --git a/src/ui/widget/spin-scale.cpp b/src/ui/widget/spin-scale.cpp index 548e9a6a6..ade3d1e60 100644 --- a/src/ui/widget/spin-scale.cpp +++ b/src/ui/widget/spin-scale.cpp @@ -6,11 +6,12 @@ * Released under GNU GPL. Read the file 'COPYING' for more information. */ +#include "spin-scale.h" + #include <gtkmm/adjustment.h> #include <glibmm/i18n.h> #include <glibmm/stringutils.h> -#include "spin-scale.h" #include "ui/widget/gimpspinscale.h" namespace Inkscape { diff --git a/src/ui/widget/spin-scale.h b/src/ui/widget/spin-scale.h index a8403307f..5fec8b1d8 100644 --- a/src/ui/widget/spin-scale.h +++ b/src/ui/widget/spin-scale.h @@ -9,6 +9,14 @@ #ifndef INKSCAPE_UI_WIDGET_SPIN_SCALE_H #define INKSCAPE_UI_WIDGET_SPIN_SCALE_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/scale.h> diff --git a/src/ui/widget/spin-slider.h b/src/ui/widget/spin-slider.h index 8a45299e5..5f86fd15a 100644 --- a/src/ui/widget/spin-slider.h +++ b/src/ui/widget/spin-slider.h @@ -10,6 +10,14 @@ #ifndef INKSCAPE_UI_WIDGET_SPIN_SLIDER_H #define INKSCAPE_UI_WIDGET_SPIN_SLIDER_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/scale.h> diff --git a/src/ui/widget/spinbutton.h b/src/ui/widget/spinbutton.h index 57c48369e..fe5d699e7 100644 --- a/src/ui/widget/spinbutton.h +++ b/src/ui/widget/spinbutton.h @@ -10,6 +10,14 @@ #ifndef INKSCAPE_UI_WIDGET_SPINBUTTON_H #define INKSCAPE_UI_WIDGET_SPINBUTTON_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/spinbutton.h> namespace Inkscape { diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index 2880961be..7ab47cb2e 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -28,6 +28,7 @@ #include "widgets/widget-sizes.h" #include "helper/units.h" #include "helper/action.h" +#include "helper/action-context.h" #include "preferences.h" #include "inkscape.h" #include "verbs.h" @@ -200,7 +201,7 @@ StyleSwatch::on_click(GdkEventButton */*event*/) { if (this->_desktop && this->_verb_t != SP_VERB_NONE) { Inkscape::Verb *verb = Inkscape::Verb::get(this->_verb_t); - SPAction *action = verb->get_action((Inkscape::UI::View::View *) this->_desktop); + SPAction *action = verb->get_action(Inkscape::ActionContext((Inkscape::UI::View::View *) this->_desktop)); sp_action_perform (action, NULL); return true; } diff --git a/src/ui/widget/style-swatch.h b/src/ui/widget/style-swatch.h index d7bab3732..6bdb5e248 100644 --- a/src/ui/widget/style-swatch.h +++ b/src/ui/widget/style-swatch.h @@ -17,6 +17,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/label.h> #include <gtkmm/eventbox.h> diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index f92a08d0a..d166e3831 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -12,6 +12,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/label.h> diff --git a/src/ui/widget/unit-menu.h b/src/ui/widget/unit-menu.h index 142b11186..3104d5aef 100644 --- a/src/ui/widget/unit-menu.h +++ b/src/ui/widget/unit-menu.h @@ -10,6 +10,14 @@ #ifndef INKSCAPE_UI_WIDGET_UNIT_H #define INKSCAPE_UI_WIDGET_UNIT_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/comboboxtext.h> #include "util/units.h" |
