Change the name to 'Dimension' instead of 'Constrain Contextual'

This commit is contained in:
Paddle
2023-08-26 08:35:27 +02:00
parent 77bab58039
commit 2b2ba0b08a
6 changed files with 34 additions and 32 deletions

View File

@@ -991,12 +991,12 @@ void CmdSketcherConstraint::activated(int /*iMsg*/)
}
// Contextual Constraint tool =======================================================
// Dimension tool =======================================================
class DrawSketchHandlerConstrainContextual : public DrawSketchHandler
class DrawSketchHandlerDimension : public DrawSketchHandler
{
public:
DrawSketchHandlerConstrainContextual()
DrawSketchHandlerDimension()
: specialConstraint(SpecialConstraint::None)
, availableConstraint(AvailableConstraint::FIRST)
, previousOnSketchPos(Base::Vector2d(0.f, 0.f))
@@ -1007,7 +1007,7 @@ public:
, numberOfConstraintsCreated(0)
{
}
virtual ~DrawSketchHandlerConstrainContextual()
virtual ~DrawSketchHandlerDimension()
{
}
@@ -1028,7 +1028,7 @@ public:
void activated() override
{
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Contextual Constrain"));
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Dimension"));
Obj = sketchgui->getSketchObject();
@@ -1042,7 +1042,7 @@ public:
qreal fullIconWidth = 32 * pixelRatio;
qreal iconWidth = 16 * pixelRatio;
QPixmap cursorPixmap = Gui::BitmapFactory().pixmapFromSvg("Sketcher_Crosshair", QSizeF(fullIconWidth, fullIconWidth), colorMapping),
icon = Gui::BitmapFactory().pixmapFromSvg("Constraint_Contextual", QSizeF(iconWidth, iconWidth));
icon = Gui::BitmapFactory().pixmapFromSvg("Constraint_Dimension", QSizeF(iconWidth, iconWidth));
QPainter cursorPainter;
cursorPainter.begin(&cursorPixmap);
cursorPainter.drawPixmap(16 * pixelRatio, 16 * pixelRatio, icon);
@@ -1202,7 +1202,7 @@ public:
bool continuousMode = hGrp->GetBool("ContinuousCreationMode", true);
if (continuousMode) {
Gui::Selection().clearSelection();
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Constrain contextually"));
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Dimension"));
numberOfConstraintsCreated = 0;
specialConstraint = SpecialConstraint::None;
previousOnSketchPos = Base::Vector2d(0.f, 0.f);
@@ -2104,44 +2104,46 @@ protected:
}
};
DEF_STD_CMD_AU(CmdSketcherConstrainContextual)
DEF_STD_CMD_AU(CmdSketcherDimension)
CmdSketcherConstrainContextual::CmdSketcherConstrainContextual()
: Command("Sketcher_ConstrainContextual")
CmdSketcherDimension::CmdSketcherDimension()
: Command("Sketcher_Dimension")
{
sAppModule = "Sketcher";
sGroup = "Sketcher";
sMenuText = QT_TR_NOOP("Contextual constrain");
sToolTipText = QT_TR_NOOP("Constrain contextually based on your selection.\nDepending on your selection you might have several constraints available. You can cycle through them using SHIFT key.\nLeft clicking on empty space will validate the current constraint. Right clicking or pressing Esc will cancel.");
sWhatsThis = "Sketcher_ConstrainContextual";
sMenuText = QT_TR_NOOP("Dimension");
sToolTipText = QT_TR_NOOP("Constrain contextually based on your selection.\n"
"Depending on your selection you might have several constraints available. You can cycle through them using SHIFT key.\n"
"Left clicking on empty space will validate the current constraint. Right clicking or pressing Esc will cancel.");
sWhatsThis = "Sketcher_Dimension";
sStatusTip = sToolTipText;
sPixmap = "Constraint_Contextual";
sAccel = "A";
sPixmap = "Constraint_Dimension";
sAccel = "D";
eType = ForEdit;
}
void CmdSketcherConstrainContextual::activated(int iMsg)
void CmdSketcherDimension::activated(int iMsg)
{
Q_UNUSED(iMsg);
ActivateHandler(getActiveGuiDocument(), new DrawSketchHandlerConstrainContextual());
ActivateHandler(getActiveGuiDocument(), new DrawSketchHandlerDimension());
getSelection().clearSelection();
}
void CmdSketcherConstrainContextual::updateAction(int mode)
void CmdSketcherDimension::updateAction(int mode)
{
switch (mode) {
case Reference:
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().iconFromTheme("Constraint_Contextual_Driven"));
getAction()->setIcon(Gui::BitmapFactory().iconFromTheme("Constraint_Dimension_Driven"));
break;
case Driving:
if (getAction())
getAction()->setIcon(Gui::BitmapFactory().iconFromTheme("Constraint_Contextual"));
getAction()->setIcon(Gui::BitmapFactory().iconFromTheme("Constraint_Dimension"));
break;
}
}
bool CmdSketcherConstrainContextual::isActive(void)
bool CmdSketcherDimension::isActive(void)
{
return isCommandActive(getActiveGuiDocument());
}
@@ -9528,7 +9530,7 @@ CmdSketcherToggleDrivingConstraint::CmdSketcherToggleDrivingConstraint()
rcCmdMgr.addCommandMode("ToggleDrivingConstraint", "Sketcher_ConstrainRadiam");
rcCmdMgr.addCommandMode("ToggleDrivingConstraint", "Sketcher_ConstrainAngle");
rcCmdMgr.addCommandMode("ToggleDrivingConstraint", "Sketcher_CompConstrainRadDia");
rcCmdMgr.addCommandMode("ToggleDrivingConstraint", "Sketcher_ConstrainContextual");
rcCmdMgr.addCommandMode("ToggleDrivingConstraint", "Sketcher_Dimension");
// rcCmdMgr.addCommandMode("ToggleDrivingConstraint", "Sketcher_ConstrainSnellsLaw");
}
@@ -9739,7 +9741,7 @@ void CreateSketcherCommandsConstraints()
rcCmdMgr.addCommand(new CmdSketcherConstrainLock());
rcCmdMgr.addCommand(new CmdSketcherConstrainBlock());
rcCmdMgr.addCommand(new CmdSketcherConstrainCoincident());
rcCmdMgr.addCommand(new CmdSketcherConstrainContextual());
rcCmdMgr.addCommand(new CmdSketcherDimension());
rcCmdMgr.addCommand(new CmdSketcherConstrainParallel());
rcCmdMgr.addCommand(new CmdSketcherConstrainPerpendicular());
rcCmdMgr.addCommand(new CmdSketcherConstrainTangent());

View File

@@ -7,8 +7,8 @@
<qresource>
<file>icons/constraints/Constraint_Block.svg</file>
<file>icons/constraints/Constraint_Concentric.svg</file>
<file>icons/constraints/Constraint_Contextual.svg</file>
<file>icons/constraints/Constraint_Contextual_Driven.svg</file>
<file>icons/constraints/Constraint_Dimension.svg</file>
<file>icons/constraints/Constraint_Dimension_Driven.svg</file>
<file>icons/constraints/Constraint_Diameter.svg</file>
<file>icons/constraints/Constraint_Diameter_Driven.svg</file>
<file>icons/constraints/Constraint_Ellipse_Axis_Angle.svg</file>

View File

@@ -171,7 +171,7 @@ Requires to re-enter edit mode to take effect.</string>
</sizepolicy>
</property>
<property name="title">
<string>Contextual Constrain</string>
<string>Dimension Constraint</string>
</property>
<layout class="QGridLayout" name="gridLayout_general">
<item row="0" column="0">
@@ -185,9 +185,9 @@ Requires to re-enter edit mode to take effect.</string>
<widget class="QComboBox" name="dimensioningMode">
<property name="toolTip">
<string>Select the type of dimensioning constraints for your toolbar:
'Single tool': 'Constrain Contextual': A single tool for all dimensioning constraints : Distance, Distance X / Y, Angle, Radius.
'Single tool': A single tool for all dimensioning constraints : Distance, Distance X / Y, Angle, Radius.
'Separated tools': Separated tools for each dimensioning constraint.
'Both': You will have both the 'Constrain Contextual' tool and the separated tools.
'Both': You will have both the 'Dimension' tool and the separated tools.
This setting is only for the toolbar. Whichever you chose, all tools are always available in the menu and through shortcuts.</string>
</property>
</widget>
@@ -195,14 +195,14 @@ This setting is only for the toolbar. Whichever you chose, all tools are always
<item row="1" column="0">
<widget class="QLabel" name="radiusDiameterLabel">
<property name="text">
<string>Dimensioning diameter/radius mode:</string>
<string>Dimension tool diameter/radius mode:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="radiusDiameterMode">
<property name="toolTip">
<string>While using Constraint Contextually you may chose how to handle circles and arcs:
<string>While using the Dimension tool you may chose how to handle circles and arcs:
'Auto': The tool will apply radius to arcs and diameter to circles.
'Diameter': The tool will apply diameter to both arcs and circles.
'Radius': The tool will apply radius to both arcs and circles.</string>

View File

@@ -408,7 +408,7 @@ inline void SketcherAddWorkbenchConstraints<Gui::MenuItem>(Gui::MenuItem& cons)
<< "Sketcher_ConstrainSymmetric"
<< "Sketcher_ConstrainBlock"
<< "Separator"
<< "Sketcher_ConstrainContextual"
<< "Sketcher_Dimension"
<< "Sketcher_ConstrainLock"
<< "Sketcher_ConstrainDistanceX"
<< "Sketcher_ConstrainDistanceY"
@@ -441,7 +441,7 @@ inline void SketcherAddWorkbenchConstraints<Gui::ToolBarItem>(Gui::ToolBarItem&
<< "Sketcher_ConstrainBlock"
<< "Separator";
if (hGrp->GetBool("SingleDimensioningTool", true)) {
cons << "Sketcher_ConstrainContextual";
cons << "Sketcher_Dimension";
}
if (hGrp->GetBool("SeparatedDimensioningTools", false)) {
cons << "Sketcher_ConstrainLock"