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 | |
| 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')
| -rw-r--r-- | src/ui/tools/lpe-tool.cpp | 9 | ||||
| -rw-r--r-- | src/ui/tools/spray-tool.cpp | 10 | ||||
| -rw-r--r-- | src/ui/tools/tweak-tool.cpp | 21 |
3 files changed, 36 insertions, 4 deletions
diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp index 55ec014ab..d1e7e186c 100644 --- a/src/ui/tools/lpe-tool.cpp +++ b/src/ui/tools/lpe-tool.cpp @@ -36,6 +36,7 @@ #include "util/units.h" +#include "ui/toolbar/lpe-toolbar.h" #include "ui/tools/lpe-tool.h" #include "ui/shape-editor.h" @@ -309,7 +310,13 @@ lpetool_context_switch_mode(LpeTool *lc, Inkscape::LivePathEffect::EffectType co int index = lpetool_mode_to_index(type); if (index != -1) { lc->mode = type; - lc->desktop->setToolboxSelectOneValue ("lpetool_mode_action", index); + auto tb = dynamic_cast<UI::Toolbar::LPEToolbar*>(lc->desktop->get_toolbar_by_name("LPEToolToolbar")); + + if(tb) { + tb->set_mode(index); + } else { + std::cerr << "Could not access LPE toolbar" << std::endl; + } } else { g_warning ("Invalid mode selected: %d", type); return; diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 28990bd2d..5fed9e806 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -62,6 +62,7 @@ #include "svg/svg.h" #include "svg/svg-color.h" +#include "ui/toolbar/spray-toolbar.h" #include "ui/tools/spray-tool.h" #include "ui/dialog/dialog-manager.h" @@ -1210,7 +1211,14 @@ static void sp_spray_update_area(SprayTool *tc) static void sp_spray_switch_mode(SprayTool *tc, gint mode, bool with_shift) { // Select the button mode - SP_EVENT_CONTEXT(tc)->desktop->setToolboxSelectOneValue("spray_tool_mode", mode); + auto tb = dynamic_cast<UI::Toolbar::SprayToolbar*>(SP_EVENT_CONTEXT(tc)->desktop->get_toolbar_by_name("SprayToolbar")); + + if(tb) { + tb->set_mode(mode); + } else { + std::cerr << "Could not access Spray 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); 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 :) |
