diff options
| author | Alexander Valavanis <valavanisalex@gmail.com> | 2019-06-05 19:34:19 +0000 |
|---|---|---|
| committer | Alexander Valavanis <valavanisalex@gmail.com> | 2019-06-05 19:34:19 +0000 |
| commit | 346e764345e1fbf877307313cd4779874dfd3ed9 (patch) | |
| tree | d5c326e85f752a1cd54301bc19592d90d9445e51 /src/ui/tools/tweak-tool.cpp | |
| parent | Merge changes (diff) | |
| parent | Finish TextToolbar migration (diff) | |
| download | inkscape-346e764345e1fbf877307313cd4779874dfd3ed9.tar.gz inkscape-346e764345e1fbf877307313cd4779874dfd3ed9.zip | |
Merge branch 'text-toolbar-migration'
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 :) |
