Skip to content

Commit

Permalink
concise toolbar option
Browse files Browse the repository at this point in the history
  • Loading branch information
obelisk79 committed Dec 26, 2023
1 parent 1c7b35f commit d58437d
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 143 deletions.
1 change: 1 addition & 0 deletions src/Mod/Sketcher/Gui/CommandConstraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2610,6 +2610,7 @@ class CmdSketcherCompHorizontalVertical : public Gui::GroupCommand
eType = ForEdit;

setCheckable(false);
setRememberLast(false);

addCommand("Sketcher_ConstrainHorVer");
addCommand("Sketcher_ConstrainHorizontal");
Expand Down
114 changes: 114 additions & 0 deletions src/Mod/Sketcher/Gui/CommandCreateGeo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,33 @@ bool CmdSketcherCreatePolyline::isActive()
}


// Comp for Creating PolyLines and Lines =============================================

class CmdSketcherCompDraw : public Gui::GroupCommand
{
public:
CmdSketcherCompDraw()
: GroupCommand("Sketcher_CompDraw")
{
sAppModule = "Sketcher";
sGroup = "Sketcher";
sMenuText = QT_TR_NOOP("PolyLine");
sToolTipText = QT_TR_NOOP("Freeform sketching using lines/arcs.");
sWhatsThis = "Sketcher_CompDraw";
sStatusTip = sToolTipText;
eType = ForEdit;

setCheckable(false);
setRememberLast(false);

addCommand("Sketcher_CreatePolyline");
addCommand("Sketcher_CreateLine");
}

const char* className() const override { return "CmdSketcherCompDraw"; }
};


// ======================================================================================

DEF_STD_CMD_AU(CmdSketcherCreateArc)
Expand Down Expand Up @@ -1383,6 +1410,62 @@ bool CmdSketcherCompCreateCircle::isActive()
}


class CmdSketcherCompCircleEllipse : public Gui::GroupCommand
{
public:
CmdSketcherCompCircleEllipse()
: GroupCommand("Sketcher_CompCircleEllipse")
{
sAppModule = "Sketcher";
sGroup = "Sketcher";
sMenuText = QT_TR_NOOP("Circles");
sToolTipText = QT_TR_NOOP("Create circles and ellipses");
sWhatsThis = "Sketcher_CompCircleEllipse";
sStatusTip = sToolTipText;
eType = ForEdit;

setCheckable(false);

addCommand("Sketcher_CreateCircle");
addCommand("Sketcher_Create3PointCircle");
addCommand("Sketcher_CreateEllipseByCenter");
addCommand("Sketcher_CreateEllipseBy3Points");
}

const char* className() const override { return "CmdSketcherCompCircleEllipse"; }
};



// Comp for Creating Arcs, Parabola, Hyperbola =============================================

class CmdSketcherCompArcs : public Gui::GroupCommand
{
public:
CmdSketcherCompArcs()
: GroupCommand("Sketcher_CompArcs")
{
sAppModule = "Sketcher";
sGroup = "Sketcher";
sMenuText = QT_TR_NOOP("Arcs");
sToolTipText = QT_TR_NOOP("Create various forms of arcs.");
sWhatsThis = "Sketcher_CompArcs";
sStatusTip = sToolTipText;
eType = ForEdit;

setCheckable(false);

addCommand("Sketcher_CreateArc");
addCommand("Sketcher_Create3PointArc");
addCommand("Sketcher_CreateArcOfEllipse");
addCommand("Sketcher_CreateArcOfHyperbola");
addCommand("Sketcher_CreateArcOfParabola");
}

const char* className() const override { return "CmdSketcherCompArcs"; }
};


// ======================================================================================


Expand Down Expand Up @@ -1589,6 +1672,33 @@ bool CmdSketcherCompCreateFillets::isActive()
return isCommandActive(getActiveGuiDocument());
}


// Comp for Creating Fillets =============================================

class CmdSketcherCompFillets : public Gui::GroupCommand
{
public:
CmdSketcherCompFillets()
: GroupCommand("Sketcher_CompFillets")
{
sAppModule = "Sketcher";
sGroup = "Sketcher";
sMenuText = QT_TR_NOOP("Fillets");
sToolTipText = QT_TR_NOOP("Create various forms of sketch fillet.");
sWhatsThis = "Sketcher_CompFillets";
sStatusTip = sToolTipText;
eType = ForEdit;

setCheckable(false);

addCommand("Sketcher_CreatePointFillet");
addCommand("Sketcher_CreateFillet");
}

const char* className() const override { return "CmdSketcherCompFillets"; }
};


// ======================================================================================

DEF_STD_CMD_A(CmdSketcherTrimming)
Expand Down Expand Up @@ -2337,4 +2447,8 @@ void CreateSketcherCommandsCreateGeo()
rcCmdMgr.addCommand(new CmdSketcherCompCurveEdition());
rcCmdMgr.addCommand(new CmdSketcherExternal());
rcCmdMgr.addCommand(new CmdSketcherCarbonCopy());
rcCmdMgr.addCommand(new CmdSketcherCompDraw());
rcCmdMgr.addCommand(new CmdSketcherCompCircleEllipse());
rcCmdMgr.addCommand(new CmdSketcherCompArcs());
rcCmdMgr.addCommand(new CmdSketcherCompFillets());
}
45 changes: 5 additions & 40 deletions src/Mod/Sketcher/Gui/SketcherSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,34 +66,12 @@ void SketcherSettings::saveSettings()
ui->checkBoxEnableEscape->onSave();
ui->checkBoxNotifyConstraintSubstitutions->onSave();
ui->checkBoxAutoRemoveRedundants->onSave();
ui->checkBoxUnifiedCoincident->onSave();
ui->checkBoxHorVerAuto->onSave();

enum
{
DimensionSingleTool,
DimensionSeparateTools,
DimensionBoth
};
ui->checkBoxExpandedToolbars->onSave();

// Dimensioning constraints mode
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Sketcher/dimensioning");
bool singleTool = true;
bool SeparatedTools = false;
int index = ui->dimensioningMode->currentIndex();
switch (index) {
case DimensionSeparateTools:
singleTool = false;
SeparatedTools = true;
break;
case DimensionBoth:
singleTool = true;
SeparatedTools = true;
break;
}
hGrp->SetBool("SingleDimensioningTool", singleTool);
hGrp->SetBool("SeparatedDimensioningTools", SeparatedTools);
int index = 0;

ui->radiusDiameterMode->setEnabled(index != 1);

Expand Down Expand Up @@ -135,25 +113,12 @@ void SketcherSettings::loadSettings()
ui->checkBoxEnableEscape->onRestore();
ui->checkBoxNotifyConstraintSubstitutions->onRestore();
ui->checkBoxAutoRemoveRedundants->onRestore();
ui->checkBoxUnifiedCoincident->onRestore();
ui->checkBoxHorVerAuto->onRestore();

// Dimensioning constraints mode
ui->dimensioningMode->clear();
ui->dimensioningMode->addItem(tr("Single tool"));
ui->dimensioningMode->addItem(tr("Separated tools"));
ui->dimensioningMode->addItem(tr("Both"));
ui->checkBoxExpandedToolbars->onRestore();

ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Sketcher/dimensioning");
bool singleTool = hGrp->GetBool("SingleDimensioningTool", true);
bool SeparatedTools = hGrp->GetBool("SeparatedDimensioningTools", false);
int index = SeparatedTools ? (singleTool ? 2 : 1) : 0;
ui->dimensioningMode->setCurrentIndex(index);
connect(ui->dimensioningMode,
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
&SketcherSettings::dimensioningModeChanged);

int index = 0;

ui->radiusDiameterMode->setEnabled(index != 1);

Expand Down
103 changes: 61 additions & 42 deletions src/Mod/Sketcher/Gui/SketcherSettings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -160,43 +160,62 @@ Requires to re-enter edit mode to take effect.</string>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="checkBoxUnifiedCoincident">
<widget class="Gui::PrefCheckBox" name="checkBoxExpandedToolbars">
<property name="toolTip">
<string>Unify Coincident and PointOnObject in a single tool.</string>
<string>Expanded Toolbars with individual controls in place of 'smart' tools. A change in this setting requires a restart of FreeCAD to display properly.</string>
</property>
<property name="text">
<string>Unify Coincident and PointOnObject</string>
<string>Expanded Toolbars (Requires Restart)</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>UnifiedCoincident</cstring>
<cstring>ExpandToolbars</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Sketcher/Constraints</cstring>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="checkBoxHorVerAuto">
<property name="toolTip">
<string>Use the automatic horizontal/vertical constraint tool. This create a command group in which you have the auto tool, horizontal and vertical.</string>
</property>
<property name="text">
<string>Auto tool for Horizontal/Vertical</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>AutoHorVer</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Sketcher/Constraints</cstring>
<cstring>Mod/Sketcher</cstring>
</property>
</widget>
</item>
<!-- <item>-->
<!-- <widget class="Gui::PrefCheckBox" name="checkBoxUnifiedCoincident">-->
<!-- <property name="toolTip">-->
<!-- <string>Unify Coincident and PointOnObject in a single tool.</string>-->
<!-- </property>-->
<!-- <property name="text">-->
<!-- <string>Unify Coincident and PointOnObject</string>-->
<!-- </property>-->
<!-- <property name="checked">-->
<!-- <bool>false</bool>-->
<!-- </property>-->
<!-- <property name="prefEntry" stdset="0">-->
<!-- <cstring>UnifiedCoincident</cstring>-->
<!-- </property>-->
<!-- <property name="prefPath" stdset="0">-->
<!-- <cstring>Mod/Sketcher/Constraints</cstring>-->
<!-- </property>-->
<!-- </widget>-->
<!-- </item>-->
<!-- <item>-->
<!-- <widget class="Gui::PrefCheckBox" name="checkBoxHorVerAuto">-->
<!-- <property name="toolTip">-->
<!-- <string>Use the automatic horizontal/vertical constraint tool. This create a command group in which you have the auto tool, horizontal and vertical.</string>-->
<!-- </property>-->
<!-- <property name="text">-->
<!-- <string>Auto tool for Horizontal/Vertical</string>-->
<!-- </property>-->
<!-- <property name="checked">-->
<!-- <bool>true</bool>-->
<!-- </property>-->
<!-- <property name="prefEntry" stdset="0">-->
<!-- <cstring>AutoHorVer</cstring>-->
<!-- </property>-->
<!-- <property name="prefPath" stdset="0">-->
<!-- <cstring>Mod/Sketcher/Constraints</cstring>-->
<!-- </property>-->
<!-- </widget>-->
<!-- </item>-->
</layout>
</widget>
</item>
Expand All @@ -212,24 +231,24 @@ Requires to re-enter edit mode to take effect.</string>
<string>Dimension Constraint</string>
</property>
<layout class="QGridLayout" name="gridLayout_general">
<item row="0" column="0">
<widget class="QLabel" name="dimensioningLabel">
<property name="text">
<string>Dimensioning constraints:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="dimensioningMode">
<property name="toolTip">
<string>Select the type of dimensioning constraints for your toolbar:
'Single tool': A single tool for all dimensioning constraints in the toolbar : Distance, Distance X / Y, Angle, Radius. (Others in dropdown)
'Separated tools': Individual tools for each dimensioning constraint.
'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>
</item>
<!-- <item row="0" column="0">-->
<!-- <widget class="QLabel" name="dimensioningLabel">-->
<!-- <property name="text">-->
<!-- <string>Dimensioning constraints:</string>-->
<!-- </property>-->
<!-- </widget>-->
<!-- </item>-->
<!-- <item row="0" column="1">-->
<!-- <widget class="QComboBox" name="dimensioningMode">-->
<!-- <property name="toolTip">-->
<!-- <string>Select the type of dimensioning constraints for your toolbar:-->
<!--'Single tool': A single tool for all dimensioning constraints in the toolbar : Distance, Distance X / Y, Angle, Radius. (Others in dropdown)-->
<!--'Separated tools': Individual tools for each dimensioning constraint.-->
<!--'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>-->
<!-- </item>-->
<item row="1" column="0">
<widget class="QLabel" name="radiusDiameterLabel">
<property name="text">
Expand Down
Loading

0 comments on commit d58437d

Please sign in to comment.