Sketcher: Use generic tool hints table for DrawSketchHandlerExtend
This commit is contained in:
@@ -373,22 +373,27 @@ protected:
|
||||
double Increment;
|
||||
std::vector<AutoConstraint> SugConstr;
|
||||
|
||||
// Add hint structures here
|
||||
struct HintEntry
|
||||
{
|
||||
SelectMode state;
|
||||
std::list<Gui::InputHint> hints;
|
||||
};
|
||||
|
||||
using HintTable = std::vector<HintEntry>;
|
||||
|
||||
static HintTable getExtendHintTable();
|
||||
static std::list<Gui::InputHint> lookupExtendHints(SelectMode state);
|
||||
|
||||
public:
|
||||
std::list<Gui::InputHint> getToolHints() const override
|
||||
{
|
||||
return lookupExtendHints(Mode);
|
||||
using enum Gui::InputHint::UserInput;
|
||||
|
||||
return Gui::lookupHints<SelectMode>(
|
||||
Mode,
|
||||
{
|
||||
{.state = STATUS_SEEK_First,
|
||||
.hints =
|
||||
{
|
||||
{QObject::tr("%1 pick edge to extend", "Sketcher Extend: hint"),
|
||||
{MouseLeft}},
|
||||
}},
|
||||
{.state = STATUS_SEEK_Second,
|
||||
.hints =
|
||||
{
|
||||
{QObject::tr("%1 set extension length", "Sketcher Extend: hint"),
|
||||
{MouseLeft}},
|
||||
}},
|
||||
});
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -398,29 +403,6 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
DrawSketchHandlerExtend::HintTable DrawSketchHandlerExtend::getExtendHintTable()
|
||||
{
|
||||
using enum Gui::InputHint::UserInput;
|
||||
|
||||
return {
|
||||
{.state = STATUS_SEEK_First,
|
||||
.hints = {{QObject::tr("%1 pick edge to extend", "Sketcher Extend: hint"), {MouseLeft}}}},
|
||||
{.state = STATUS_SEEK_Second,
|
||||
.hints = {
|
||||
{QObject::tr("%1 set extension length", "Sketcher Extend: hint"), {MouseLeft}}}}};
|
||||
}
|
||||
|
||||
std::list<Gui::InputHint> DrawSketchHandlerExtend::lookupExtendHints(SelectMode state)
|
||||
{
|
||||
const auto extendHintTable = getExtendHintTable();
|
||||
|
||||
auto it = std::ranges::find_if(extendHintTable, [state](const HintEntry& entry) {
|
||||
return entry.state == state;
|
||||
});
|
||||
|
||||
return (it != extendHintTable.end()) ? it->hints : std::list<Gui::InputHint> {};
|
||||
}
|
||||
|
||||
} // namespace SketcherGui
|
||||
|
||||
#endif // SKETCHERGUI_DrawSketchHandlerExtend_H
|
||||
|
||||
Reference in New Issue
Block a user