diff options
| author | John Smith <john.smith7545@yahoo.com> | 2012-08-18 08:30:07 +0000 |
|---|---|---|
| committer | John Smith <john.smith7545@yahoo.com> | 2012-08-18 08:30:07 +0000 |
| commit | a06f7c7fc9eacaf6f90eca8ad7190d2ffb700b85 (patch) | |
| tree | 6df0b6faf45848292123e50b1e4f117008093788 | |
| parent | Authors update (diff) | |
| download | inkscape-a06f7c7fc9eacaf6f90eca8ad7190d2ffb700b85.tar.gz inkscape-a06f7c7fc9eacaf6f90eca8ad7190d2ffb700b85.zip | |
Fix for 189535 : align verbs and by keys
(bzr r11611)
| -rw-r--r-- | share/keys/default.xml | 25 | ||||
| -rw-r--r-- | src/ui/dialog/align-and-distribute.cpp | 363 | ||||
| -rw-r--r-- | src/ui/dialog/align-and-distribute.h | 82 | ||||
| -rw-r--r-- | src/verbs.cpp | 42 | ||||
| -rw-r--r-- | src/verbs.h | 12 |
5 files changed, 326 insertions, 198 deletions
diff --git a/share/keys/default.xml b/share/keys/default.xml index b2cf829e5..f4886e254 100644 --- a/share/keys/default.xml +++ b/share/keys/default.xml @@ -584,6 +584,27 @@ override) the bindings in the main default.xml. <bind key="F12" action="DialogsToggle" display="true" /> + <bind key="h" modifiers="Ctrl,Alt" action="AlignHorizontalCenter" display="true" /> + <bind key="H" modifiers="Ctrl,Alt" action="AlignHorizontalCenter" /> + + <bind key="v" modifiers="Ctrl,Alt" action="AlignVerticalCenter" display="true" /> + <bind key="V" modifiers="Ctrl,Alt" action="AlignVerticalCenter" /> + + <bind key="KP_2" modifiers="Ctrl,Alt" action="AlignVerticalBottom" display="true" /> + <bind key="KP_2" modifiers="Ctrl,Alt" action="AlignVerticalBottom" /> + + <bind key="KP_4" modifiers="Ctrl,Alt" action="AlignHorizontalLeft" display="true" /> + <bind key="KP_4" modifiers="Ctrl,Alt" action="AlignHorizontalLeft" /> + + <bind key="KP_5" modifiers="Ctrl,Alt" action="AlignVerticalHorizontalCenter" display="true" /> + <bind key="KP_5" modifiers="Ctrl,Alt" action="AlignVerticalHorizontalCenter" /> + + <bind key="KP_6" modifiers="Ctrl,Alt" action="AlignHorizontalRight" display="true" /> + <bind key="KP_6" modifiers="Ctrl,Alt" action="AlignHorizontalRight" /> + + <bind key="KP_8" modifiers="Ctrl,Alt" action="AlignVerticalTop" display="true" /> + <bind key="KP_8" modifiers="Ctrl,Alt" action="AlignVerticalTop" /> + <!-- Help --> <bind action="HelpAboutExtensions" /> @@ -603,9 +624,11 @@ override) the bindings in the main default.xml. <bind key="g" modifiers="Ctrl,Alt" action="org.inkscape.typography.newglyphlayer" display="true"/> <bind key="G" modifiers="Ctrl,Alt" action="org.inkscape.typography.newglyphlayer"/> +<!-- <bind key="h" modifiers="Ctrl,Alt" action="org.inkscape.typography.previousglyphlayer" display="true"/> <bind key="H" modifiers="Ctrl,Alt" action="org.inkscape.typography.previousglyphlayer"/> - + --> + <bind key="j" modifiers="Ctrl,Alt" action="org.inkscape.typography.nextglyphlayer" display="true"/> <bind key="J" modifiers="Ctrl,Alt" action="org.inkscape.typography.nextglyphlayer"/> diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index f8d63aade..ecac40de5 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -57,227 +57,201 @@ namespace Dialog { /////////helper classes////////////////////////////////// -class Action { -public : - Action(const Glib::ustring &id, - const Glib::ustring &tiptext, - guint row, guint column, +Action::Action(const Glib::ustring &id, + const Glib::ustring &tiptext, + guint row, guint column, #if WITH_GTKMM_3_0 - Gtk::Grid &parent, + Gtk::Grid &parent, #else - Gtk::Table &parent, + Gtk::Table &parent, #endif - AlignAndDistribute &dialog): - _dialog(dialog), - _id(id), - _parent(parent) - { - Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( _id, Inkscape::ICON_SIZE_LARGE_TOOLBAR) ); - Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); - pButton->set_relief(Gtk::RELIEF_NONE); - pIcon->show(); - pButton->add(*pIcon); - pButton->show(); - - pButton->signal_clicked() - .connect(sigc::mem_fun(*this, &Action::on_button_click)); - pButton->set_tooltip_text(tiptext); -#if WITH_GTKMM_3_0 - parent.attach(*pButton, column, row, 1, 1); -#else - parent.attach(*pButton, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL); -#endif - } - virtual ~Action(){} - - AlignAndDistribute &_dialog; - -private : - virtual void on_button_click(){} - - Glib::ustring _id; - + AlignAndDistribute &dialog): + _dialog(dialog), + _id(id), + _parent(parent) +{ + Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( _id, Inkscape::ICON_SIZE_LARGE_TOOLBAR) ); + Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); + pButton->set_relief(Gtk::RELIEF_NONE); + pIcon->show(); + pButton->add(*pIcon); + pButton->show(); + + pButton->signal_clicked() + .connect(sigc::mem_fun(*this, &Action::on_button_click)); + pButton->set_tooltip_text(tiptext); #if WITH_GTKMM_3_0 - Gtk::Grid &_parent; + parent.attach(*pButton, column, row, 1, 1); #else - Gtk::Table &_parent; + parent.attach(*pButton, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL); #endif -}; +} -class ActionAlign : public Action { -public : - struct Coeffs { - double mx0, mx1, my0, my1; - double sx0, sx1, sy0, sy1; - }; - ActionAlign(const Glib::ustring &id, - const Glib::ustring &tiptext, - guint row, guint column, - AlignAndDistribute &dialog, - guint coeffIndex): - Action(id, tiptext, row, column, - dialog.align_table(), dialog), - _index(coeffIndex), - _dialog(dialog) - {} +void ActionAlign::do_action(SPDesktop *desktop, int index) { -private : + Inkscape::Selection *selection = sp_desktop_selection(desktop); + if (!selection) return; - virtual void on_button_click() { - //Retreive selected objects - SPDesktop *desktop = _dialog.getDesktop(); - if (!desktop) 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"); - Inkscape::Selection *selection = sp_desktop_selection(desktop); - if (!selection) return; + using Inkscape::Util::GSListConstIterator; + std::list<SPItem *> selected; + selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL); + if (selected.empty()) 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"); + 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: + { + //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; + } + break; + } - using Inkscape::Util::GSListConstIterator; - std::list<SPItem *> selected; - selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL); - if (selected.empty()) return; + case AlignAndDistribute::PAGE: + mp = Geom::Point(a.mx1 * sp_desktop_document(desktop)->getWidth(), + a.my1 * sp_desktop_document(desktop)->getHeight()); + break; - Geom::Point mp; //Anchor point - AlignAndDistribute::AlignTarget target = _dialog.getAlignTarget(); - const Coeffs &a= _allCoeffs[_index]; - switch (target) - { - case AlignAndDistribute::LAST: - case AlignAndDistribute::FIRST: - case AlignAndDistribute::BIGGEST: - case AlignAndDistribute::SMALLEST: - { - //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( - _dialog.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; - } - 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; } + break; + } - case AlignAndDistribute::PAGE: - mp = Geom::Point(a.mx1 * sp_desktop_document(desktop)->getWidth(), - a.my1 * sp_desktop_document(desktop)->getHeight()); - 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; - } - 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; } + 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; + default: + g_assert_not_reached (); + break; + }; // end of switch + + // 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); + + bool changed = false; + Geom::OptRect b; + if (sel_as_group) + b = !prefs_bbox ? selection->visualBounds() : selection->geometricBounds(); + + //Move each item in the selected list separately + for (std::list<SPItem *>::iterator it(selected.begin()); + it != selected.end(); + it++) + { + sp_desktop_document (desktop)->ensureUpToDate(); + if (!sel_as_group) + b = !prefs_bbox ? (*it)->desktopVisualBounds() : (*it)->desktopGeometricBounds(); + if (b) { + 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 ); + if (LInfty(mp_rel) > 1e-9) { + sp_item_move_rel(*it, Geom::Translate(mp_rel)); + changed = true; } - break; } + } - default: - g_assert_not_reached (); - break; - }; // end of switch - - // 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); + // restore compensation setting + prefs->setInt("/options/clonecompensation/value", saved_compensation); - bool changed = false; - Geom::OptRect b; - if (sel_as_group) - b = !prefs_bbox ? selection->visualBounds() : selection->geometricBounds(); + if (changed) { + DocumentUndo::done( sp_desktop_document(desktop) , SP_VERB_DIALOG_ALIGN_DISTRIBUTE, + _("Align")); + } - //Move each item in the selected list separately - for (std::list<SPItem *>::iterator it(selected.begin()); - it != selected.end(); - it++) - { - sp_desktop_document (desktop)->ensureUpToDate(); - if (!sel_as_group) - b = !prefs_bbox ? (*it)->desktopVisualBounds() : (*it)->desktopGeometricBounds(); - if (b) { - 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 ); - if (LInfty(mp_rel) > 1e-9) { - sp_item_move_rel(*it, Geom::Translate(mp_rel)); - changed = true; - } - } - } - // restore compensation setting - prefs->setInt("/options/clonecompensation/value", saved_compensation); +} - if (changed) { - DocumentUndo::done( sp_desktop_document(desktop) , SP_VERB_DIALOG_ALIGN_DISTRIBUTE, - _("Align")); - } +ActionAlign::Coeffs const ActionAlign::_allCoeffs[11] = { + {1., 0., 0., 0., 0., 1., 0., 0., SP_VERB_ALIGN_HORIZONTAL_RIGHT_TO_ANCHOR}, + {1., 0., 0., 0., 1., 0., 0., 0., SP_VERB_ALIGN_HORIZONTAL_LEFT}, + {.5, .5, 0., 0., .5, .5, 0., 0., SP_VERB_ALIGN_HORIZONTAL_CENTER}, + {0., 1., 0., 0., 0., 1., 0., 0., SP_VERB_ALIGN_HORIZONTAL_RIGHT}, + {0., 1., 0., 0., 1., 0., 0., 0., SP_VERB_ALIGN_HORIZONTAL_LEFT_TO_ANCHOR}, + {0., 0., 0., 1., 0., 0., 1., 0., SP_VERB_ALIGN_VERTICAL_BOTTOM_TO_ANCHOR}, + {0., 0., 0., 1., 0., 0., 0., 1., SP_VERB_ALIGN_VERTICAL_TOP}, + {0., 0., .5, .5, 0., 0., .5, .5, SP_VERB_ALIGN_VERTICAL_CENTER}, + {0., 0., 1., 0., 0., 0., 1., 0., SP_VERB_ALIGN_VERTICAL_BOTTOM}, + {0., 0., 1., 0., 0., 0., 0., 1., SP_VERB_ALIGN_VERTICAL_TOP_TO_ANCHOR}, + {.5, .5, .5, .5, .5, .5, .5, .5, SP_VERB_ALIGN_VERTICAL_HORIZONTAL_CENTER} +}; - } - guint _index; - AlignAndDistribute &_dialog; +void ActionAlign::do_verb_action(SPDesktop *desktop, int verb) +{ + do_action(desktop, verb_to_coeff(verb)); +} - static const Coeffs _allCoeffs[10]; +int ActionAlign::verb_to_coeff(int verb) { -}; -ActionAlign::Coeffs const ActionAlign::_allCoeffs[10] = { - {1., 0., 0., 0., 0., 1., 0., 0.}, - {1., 0., 0., 0., 1., 0., 0., 0.}, - {.5, .5, 0., 0., .5, .5, 0., 0.}, - {0., 1., 0., 0., 0., 1., 0., 0.}, - {0., 1., 0., 0., 1., 0., 0., 0.}, - {0., 0., 0., 1., 0., 0., 1., 0.}, - {0., 0., 0., 1., 0., 0., 0., 1.}, - {0., 0., .5, .5, 0., 0., .5, .5}, - {0., 0., 1., 0., 0., 0., 1., 0.}, - {0., 0., 1., 0., 0., 0., 0., 1.} -}; + for(uint i = 0; i < G_N_ELEMENTS(_allCoeffs); i++) { + if (_allCoeffs[i].verb_id == verb) { + return i; + } + } + + return -1; +} BBoxSort::BBoxSort(SPItem *pItem, Geom::Rect const &bounds, Geom::Dim2 orientation, double kBegin, double kEnd) : item(pItem), @@ -1346,8 +1320,9 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem return master; } -AlignAndDistribute::AlignTarget AlignAndDistribute::getAlignTarget()const { - return AlignTarget(_combo.get_active_row_number()); +AlignAndDistribute::AlignTarget AlignAndDistribute::getAlignTarget() { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + return AlignTarget(prefs->getInt("/dialogs/align/align-to", 6)); } diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h index 59cc0dba4..1c4c8ab54 100644 --- a/src/ui/dialog/align-and-distribute.h +++ b/src/ui/dialog/align-and-distribute.h @@ -48,7 +48,9 @@ public: enum AlignTarget { LAST=0, FIRST, BIGGEST, SMALLEST, PAGE, DRAWING, SELECTION }; - AlignTarget getAlignTarget() const; + + + static AlignTarget getAlignTarget(); #if WITH_GTKMM_3_0 Gtk::Grid &align_table(){return _alignTable;} @@ -64,7 +66,7 @@ public: Gtk::Table &nodes_table(){return _nodesTable;} #endif - std::list<SPItem *>::iterator find_master(std::list <SPItem *> &list, bool horizontal); + static std::list<SPItem *>::iterator find_master(std::list <SPItem *> &list, bool horizontal); void setMode(bool nodeEdit); Geom::OptRect randomize_bbox; @@ -138,6 +140,82 @@ struct BBoxSort }; bool operator< (const BBoxSort &a, const BBoxSort &b); + +class Action { +public : + + Action(const Glib::ustring &id, + const Glib::ustring &tiptext, + guint row, guint column, + #if WITH_GTKMM_3_0 + Gtk::Grid &parent, + #else + Gtk::Table &parent, + #endif + AlignAndDistribute &dialog); + + virtual ~Action(){} + + AlignAndDistribute &_dialog; + +private : + virtual void on_button_click(){} + + Glib::ustring _id; + +#if WITH_GTKMM_3_0 + Gtk::Grid &_parent; +#else + Gtk::Table &_parent; +#endif +}; + + +class ActionAlign : public Action { +public : + struct Coeffs { + double mx0, mx1, my0, my1; + double sx0, sx1, sy0, sy1; + int verb_id; + }; + ActionAlign(const Glib::ustring &id, + const Glib::ustring &tiptext, + guint row, guint column, + AlignAndDistribute &dialog, + guint coeffIndex): + Action(id, tiptext, row, column, + dialog.align_table(), dialog), + _index(coeffIndex), + _dialog(dialog) + {} + + /* + * Static function called to align from a keyboard shortcut + */ + static void do_verb_action(SPDesktop *desktop, int verb); + +private : + + + virtual void on_button_click() { + //Retreive selected objects + SPDesktop *desktop = _dialog.getDesktop(); + if (!desktop) return; + + ActionAlign::do_action(desktop, _index); + } + + static void do_action(SPDesktop *desktop, int index); + static int verb_to_coeff(int verb); + + guint _index; + AlignAndDistribute &_dialog; + + static const Coeffs _allCoeffs[11]; + +}; + + } // namespace Dialog } // namespace UI } // namespace Inkscape diff --git a/src/verbs.cpp b/src/verbs.cpp index 7769a45f4..76d06cb3c 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -66,6 +66,7 @@ #include "sp-namedview.h" #include "text-chemistry.h" #include "tools-switch.h" +#include "ui/dialog/align-and-distribute.h" #include "ui/dialog/clonetiler.h" #include "ui/dialog/dialog-manager.h" #include "ui/dialog/document-properties.h" @@ -85,6 +86,7 @@ #include <gtk/gtk.h> using Inkscape::DocumentUndo; +using Inkscape::UI::Dialog::ActionAlign; //#ifdef WITH_INKBOARD //#include "jabber_whiteboard/session-manager.h" @@ -1634,6 +1636,19 @@ void ContextVerb::perform(SPAction *action, void *data) prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_LPETOOL); dt->_dlg_mgr->showDialog("InkscapePreferences"); break; + case SP_VERB_ALIGN_HORIZONTAL_RIGHT_TO_ANCHOR: + case SP_VERB_ALIGN_HORIZONTAL_LEFT: + case SP_VERB_ALIGN_HORIZONTAL_CENTER: + case SP_VERB_ALIGN_HORIZONTAL_RIGHT: + case SP_VERB_ALIGN_HORIZONTAL_LEFT_TO_ANCHOR: + case SP_VERB_ALIGN_VERTICAL_BOTTOM_TO_ANCHOR: + case SP_VERB_ALIGN_VERTICAL_TOP: + case SP_VERB_ALIGN_VERTICAL_CENTER: + case SP_VERB_ALIGN_VERTICAL_BOTTOM: + case SP_VERB_ALIGN_VERTICAL_TOP_TO_ANCHOR: + case SP_VERB_ALIGN_VERTICAL_HORIZONTAL_CENTER: + ActionAlign::do_verb_action(dt, verb); + break; default: break; @@ -2599,7 +2614,6 @@ Verb *Verb::_base_verbs[] = { N_("Open Preferences for the Eraser tool"), NULL), new ContextVerb(SP_VERB_CONTEXT_LPETOOL_PREFS, "LPEToolPrefs", N_("LPE Tool Preferences"), N_("Open Preferences for the LPETool tool"), NULL), - // Zoom/View new ZoomVerb(SP_VERB_ZOOM_IN, "ZoomIn", N_("Zoom In"), N_("Zoom in"), INKSCAPE_ICON("zoom-in")), new ZoomVerb(SP_VERB_ZOOM_OUT, "ZoomOut", N_("Zoom Out"), N_("Zoom out"), INKSCAPE_ICON("zoom-out")), @@ -2781,6 +2795,32 @@ Verb *Verb::_base_verbs[] = { N_("Link an ICC color profile"), NULL), new EditVerb(SP_VERB_EDIT_REMOVE_COLOR_PROFILE, "RemoveColorProfile", N_("Remove Color Profile"), N_("Remove a linked ICC color profile"), NULL), + + // Align + new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_RIGHT_TO_ANCHOR, "AlignHorizontalRightToAnchor", N_("Align right edges of objects to the left edge of the anchor"), + N_("Align right edges of objects to the left edge of the anchor"), INKSCAPE_ICON("align-horizontal-right-to-anchor")), + new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_LEFT, "AlignHorizontalLeft", N_("Align left edges"), + N_("Align left edges"), INKSCAPE_ICON("align-horizontal-left")), + new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_CENTER, "AlignHorizontalCenter", N_("Center on vertical axis"), + N_("Center on vertical axis"), INKSCAPE_ICON("align-horizontal-center")), + new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_RIGHT, "AlignHorizontalRight", N_("Align right sides"), + N_("Align right sides"), INKSCAPE_ICON("align-horizontal-right")), + new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_LEFT_TO_ANCHOR, "AlignHorizontalLeftToAnchor", N_("Align left edges of objects to the right edge of the anchor"), + N_("Align left edges of objects to the right edge of the anchor"), INKSCAPE_ICON("align-horizontal-left-to-anchor")), + new ContextVerb(SP_VERB_ALIGN_VERTICAL_BOTTOM_TO_ANCHOR, "AlignVerticalBottomToAnchor", N_("Align bottom edges of objects to the top edge of the anchor"), + N_("Align bottom edges of objects to the top edge of the anchor"), INKSCAPE_ICON("align-vertical-bottom-to-anchor")), + new ContextVerb(SP_VERB_ALIGN_VERTICAL_TOP, "AlignVerticalTop", N_("Align top edges"), + N_("Align top edges"), INKSCAPE_ICON("align-vertical-top")), + new ContextVerb(SP_VERB_ALIGN_VERTICAL_CENTER, "AlignVerticalCenter", N_("Center on horizontal axis"), + N_("Center on horizontal axis"), INKSCAPE_ICON("align-vertical-center")), + new ContextVerb(SP_VERB_ALIGN_VERTICAL_BOTTOM, "AlignVerticalBottom", N_("Align bottom edges"), + N_("Align bottom edges"), INKSCAPE_ICON("align-vertical-bottom")), + new ContextVerb(SP_VERB_ALIGN_VERTICAL_TOP_TO_ANCHOR, "AlignVerticalTopToAnchor", N_("Align top edges of objects to the bottom edge of the anchor"), + N_("Align top edges of objects to the bottom edge of the anchor"), INKSCAPE_ICON("align-vertical-top-to-anchor")), + new ContextVerb(SP_VERB_ALIGN_VERTICAL_HORIZONTAL_CENTER, "AlignVerticalHorizontalCenter", N_("Center on horizontal and vertical axis"), + N_("Center on horizontal and vertical axis"), INKSCAPE_ICON("align-vertical-center")), + + // Footer new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL) }; diff --git a/src/verbs.h b/src/verbs.h index 70d65c583..3095d3e87 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -314,6 +314,18 @@ enum { SP_VERB_EDIT_EMBEDDED_SCRIPT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, + /* Alignment */ + SP_VERB_ALIGN_HORIZONTAL_RIGHT_TO_ANCHOR, + SP_VERB_ALIGN_HORIZONTAL_LEFT, + SP_VERB_ALIGN_HORIZONTAL_CENTER, + SP_VERB_ALIGN_HORIZONTAL_RIGHT, + SP_VERB_ALIGN_HORIZONTAL_LEFT_TO_ANCHOR, + SP_VERB_ALIGN_VERTICAL_BOTTOM_TO_ANCHOR, + SP_VERB_ALIGN_VERTICAL_TOP, + SP_VERB_ALIGN_VERTICAL_CENTER, + SP_VERB_ALIGN_VERTICAL_BOTTOM, + SP_VERB_ALIGN_VERTICAL_TOP_TO_ANCHOR, + SP_VERB_ALIGN_VERTICAL_HORIZONTAL_CENTER, /* Footer */ SP_VERB_LAST }; |
