diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerSlot.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerSlot.h index 9ffe972cba..152446ef9e 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerSlot.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerSlot.h @@ -83,7 +83,27 @@ public: private: std::list getToolHints() const override { - return lookupSlotHints(state()); + using enum Gui::InputHint::UserInput; + + return Gui::lookupHints( + state(), + { + {.state = SelectMode::SeekFirst, + .hints = + { + {QObject::tr("%1 pick slot start point"), {MouseLeft}}, + }}, + {.state = SelectMode::SeekSecond, + .hints = + { + {QObject::tr("%1 pick slot end point"), {MouseLeft}}, + }}, + {.state = SelectMode::SeekThird, + .hints = + { + {QObject::tr("%1 pick slot width"), {MouseLeft}}, + }}, + }); } void updateDataAndDrawToPosition(Base::Vector2d onSketchPos) override @@ -349,17 +369,6 @@ private: double radius, length, angle; bool isHorizontal, isVertical; int firstCurve; - - struct HintEntry - { - SelectMode state; - std::list hints; - }; - - using HintTable = std::vector; - - static HintTable getSlotHintTable(); - static std::list lookupSlotHints(SelectMode state); }; template<> @@ -706,29 +715,6 @@ void DSHSlotController::addConstraints() } } -DrawSketchHandlerSlot::HintTable DrawSketchHandlerSlot::getSlotHintTable() -{ - return {// Structure: {SelectMode, {hints...}} - {SelectMode::SeekFirst, - {{QObject::tr("%1 pick slot start point"), {Gui::InputHint::UserInput::MouseLeft}}}}, - {SelectMode::SeekSecond, - {{QObject::tr("%1 pick slot end point"), {Gui::InputHint::UserInput::MouseLeft}}}}, - {SelectMode::SeekThird, - {{QObject::tr("%1 set slot radius"), {Gui::InputHint::UserInput::MouseMove}}}}}; -} - -std::list DrawSketchHandlerSlot::lookupSlotHints(SelectMode state) -{ - const auto slotHintTable = getSlotHintTable(); - - auto it = - std::find_if(slotHintTable.begin(), slotHintTable.end(), [state](const HintEntry& entry) { - return entry.state == state; - }); - - return (it != slotHintTable.end()) ? it->hints : std::list {}; -} - } // namespace SketcherGui