diff options
| author | Alexander Valavanis <valavanisalex@gmail.com> | 2019-05-28 14:08:01 +0000 |
|---|---|---|
| committer | Alexander Valavanis <valavanisalex@gmail.com> | 2019-05-28 14:08:01 +0000 |
| commit | c36a1de9d1b762355bbed31ab9b6672dc90aec43 (patch) | |
| tree | 0e5b3320f9d6999b682bdd330f3a4df8ac627bed /src/ui/tools/tweak-tool.cpp | |
| parent | Hackfest2019: Drop unused EgeAdjustmentAction (diff) | |
| download | inkscape-c36a1de9d1b762355bbed31ab9b6672dc90aec43.tar.gz inkscape-c36a1de9d1b762355bbed31ab9b6672dc90aec43.zip | |
Hackfest2019: Get rid of deprecated InkSelectOneAction
Diffstat (limited to 'src/ui/tools/tweak-tool.cpp')
| -rw-r--r-- | src/ui/tools/tweak-tool.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index b8cf5549c..42e3520a0 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -74,6 +74,8 @@ #include "svg/svg.h" +#include "ui/toolbar/tweak-toolbar.h" + #include "ui/tools/tweak-tool.h" using Inkscape::DocumentUndo; @@ -1121,7 +1123,14 @@ sp_tweak_update_area (TweakTool *tc) static void sp_tweak_switch_mode (TweakTool *tc, gint mode, bool with_shift) { - SP_EVENT_CONTEXT(tc)->desktop->setToolboxSelectOneValue ("tweak_tool_mode", mode); + auto tb = dynamic_cast<UI::Toolbar::TweakToolbar*>(SP_EVENT_CONTEXT(tc)->desktop->get_toolbar_by_name("TweakToolbar")); + + if(tb) { + tb->set_mode(mode); + } else { + std::cerr << "Could not access Tweak toolbar" << std::endl; + } + // need to set explicitly, because the prefs may not have changed by the previous tc->mode = mode; tc->update_cursor(with_shift); @@ -1133,7 +1142,15 @@ sp_tweak_switch_mode_temporarily (TweakTool *tc, gint mode, bool with_shift) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); // Juggling about so that prefs have the old value but tc->mode and the button show new mode: gint now_mode = prefs->getInt("/tools/tweak/mode", 0); - SP_EVENT_CONTEXT(tc)->desktop->setToolboxSelectOneValue ("tweak_tool_mode", mode); + + auto tb = dynamic_cast<UI::Toolbar::TweakToolbar*>(SP_EVENT_CONTEXT(tc)->desktop->get_toolbar_by_name("TweakToolbar")); + + if(tb) { + tb->set_mode(mode); + } else { + std::cerr << "Could not access Tweak toolbar" << std::endl; + } + // button has changed prefs, restore prefs->setInt("/tools/tweak/mode", now_mode); // changing prefs changed tc->mode, restore back :) |
