SketcherGui: apply clang-format

This commit is contained in:
Abdullah Tahiri
2023-05-25 15:09:30 +02:00
committed by abdullahtahiriyo
parent dc2d861bf0
commit 78ae9c1d7d
98 changed files with 17648 additions and 13572 deletions

View File

@@ -90,8 +90,8 @@ void CmdSketcherSelectConstraints::activated(int iMsg)
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
Gui::TranslatedUserWarning(doc->getDocument(),
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
return;
}
@@ -163,8 +163,9 @@ void CmdSketcherSelectOrigin::activated(int iMsg)
SketcherGui::ViewProviderSketch* vp =
static_cast<SketcherGui::ViewProviderSketch*>(doc->getInEdit());
Sketcher::SketchObject* Obj = vp->getSketchObject();
// ViewProviderSketch * vp = static_cast<ViewProviderSketch *>(Gui::Application::Instance->getViewProvider(docobj));
// Sketcher::SketchObject* Obj = vp->getSketchObject();
// ViewProviderSketch * vp = static_cast<ViewProviderSketch
// *>(Gui::Application::Instance->getViewProvider(docobj)); Sketcher::SketchObject* Obj =
// vp->getSketchObject();
std::string doc_name = Obj->getDocument()->getName();
std::string obj_name = Obj->getNameInDocument();
@@ -626,8 +627,8 @@ void CmdSketcherSelectElementsAssociatedWithConstraints::activated(int iMsg)
if (elementSubNames.empty()) {
Gui::TranslatedUserWarning(Obj,
QObject::tr("No constraint selected"),
QObject::tr("At least one constraint must be selected"));
QObject::tr("No constraint selected"),
QObject::tr("At least one constraint must be selected"));
}
else {
Gui::Selection().addSelections(doc_name.c_str(), obj_name.c_str(), elementSubNames);
@@ -705,8 +706,8 @@ void CmdSketcherSelectElementsWithDoFs::activated(int iMsg)
if (solvext->getGeometry()
== Sketcher::SolverGeometryExtension::NotFullyConstraint) {
// Coded for consistency with getGeometryWithDependentParameters, read the comments
// on that function
// Coded for consistency with getGeometryWithDependentParameters, read the
// comments on that function
if (solvext->getEdge() == SolverGeometryExtension::Dependent)
testselectedge(geoid);
if (solvext->getStart() == SolverGeometryExtension::Dependent)
@@ -765,8 +766,8 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg)
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
Gui::TranslatedUserWarning(doc->getDocument(),
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
return;
}
@@ -828,9 +829,8 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg)
}
}
catch (const Base::Exception& e) {
Gui::NotifyUserError(Obj,
QT_TRANSLATE_NOOP("Notifications", "Invalid Constraint"),
e.what());
Gui::NotifyUserError(
Obj, QT_TRANSLATE_NOOP("Notifications", "Invalid Constraint"), e.what());
Gui::Command::abortCommand();
tryAutoRecomputeIfNotSolve(static_cast<Sketcher::SketchObject*>(Obj));
@@ -882,8 +882,8 @@ void CmdSketcherSymmetry::activated(int iMsg)
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
Gui::TranslatedUserWarning(getActiveGuiDocument()->getDocument(),
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
return;
}
@@ -891,8 +891,8 @@ void CmdSketcherSymmetry::activated(int iMsg)
const std::vector<std::string>& SubNames = selection[0].getSubNames();
if (SubNames.empty()) {
Gui::TranslatedUserWarning(getActiveGuiDocument()->getDocument(),
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
return;
}
@@ -999,20 +999,20 @@ void CmdSketcherSymmetry::activated(int iMsg)
if (geoids == 0 || (geoids == 1 && LastGeoId >= 0 && !lastvertexoraxis)) {
Gui::TranslatedUserWarning(Obj,
QObject::tr("Wrong selection"),
QObject::tr("A symmetric construction requires "
"at least two geometric elements, "
"the last geometric element being the reference "
"for the symmetry construction."));
QObject::tr("Wrong selection"),
QObject::tr("A symmetric construction requires "
"at least two geometric elements, "
"the last geometric element being the reference "
"for the symmetry construction."));
return;
}
if (lastgeotype == invalid) {
Gui::TranslatedUserWarning(Obj,
QObject::tr("Wrong selection"),
QObject::tr("The last element must be a point "
"or a line serving as reference "
"for the symmetry construction."));
QObject::tr("Wrong selection"),
QObject::tr("The last element must be a point "
"or a line serving as reference "
"for the symmetry construction."));
return;
}
@@ -1049,9 +1049,8 @@ void CmdSketcherSymmetry::activated(int iMsg)
Gui::Command::commitCommand();
}
catch (const Base::Exception& e) {
Gui::NotifyUserError(Obj,
QT_TRANSLATE_NOOP("Notifications", "Invalid Constraint"),
e.what());
Gui::NotifyUserError(
Obj, QT_TRANSLATE_NOOP("Notifications", "Invalid Constraint"), e.what());
Gui::Command::abortCommand();
}
tryAutoRecomputeIfNotSolve(Obj);
@@ -1121,15 +1120,15 @@ class DrawSketchHandlerCopy: public DrawSketchHandler
public:
DrawSketchHandlerCopy(string geoidlist, int origingeoid, Sketcher::PointPos originpos,
int nelements, SketcherCopy::Op op)
: Mode(STATUS_SEEK_First),
snapMode(SnapMode::Free),
geoIdList(geoidlist),
Origin(),
OriginGeoId(origingeoid),
OriginPos(originpos),
nElements(nelements),
Op(op),
EditCurve(2)
: Mode(STATUS_SEEK_First)
, snapMode(SnapMode::Free)
, geoIdList(geoidlist)
, Origin()
, OriginGeoId(origingeoid)
, OriginPos(originpos)
, nElements(nelements)
, Op(op)
, EditCurve(2)
{}
~DrawSketchHandlerCopy() override
@@ -1218,9 +1217,8 @@ public:
Gui::Command::commitCommand();
}
catch (const Base::Exception& e) {
Gui::NotifyUserError(sketchgui->getObject(),
QT_TRANSLATE_NOOP("Notifications", "Error"),
e.what());
Gui::NotifyUserError(
sketchgui->getObject(), QT_TRANSLATE_NOOP("Notifications", "Error"), e.what());
Gui::Command::abortCommand();
}
@@ -1270,8 +1268,8 @@ void SketcherCopy::activate(SketcherCopy::Op op)
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
Gui::TranslatedUserWarning(getActiveGuiDocument()->getDocument(),
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
return;
}
@@ -1280,8 +1278,8 @@ void SketcherCopy::activate(SketcherCopy::Op op)
const std::vector<std::string>& SubNames = selection[0].getSubNames();
if (SubNames.empty()) {
Gui::TranslatedUserWarning(getActiveGuiDocument()->getDocument(),
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
return;
}
@@ -1340,9 +1338,10 @@ void SketcherCopy::activate(SketcherCopy::Op op)
}
if (geoids < 1) {
Gui::TranslatedUserWarning(Obj,
QObject::tr("Wrong selection"),
QObject::tr("A copy requires at least one selected non-external geometric element"));
Gui::TranslatedUserWarning(
Obj,
QObject::tr("Wrong selection"),
QObject::tr("A copy requires at least one selected non-external geometric element"));
return;
}
@@ -1356,7 +1355,8 @@ void SketcherCopy::activate(SketcherCopy::Op op)
geoIdList.append(1, ']');
// if the last element is not a point serving as a reference for the copy process
// then make the start point of the last element the copy reference (if it exists, if not the center point)
// then make the start point of the last element the copy reference (if it exists, if not the
// center point)
if (LastPointPos == Sketcher::PointPos::none) {
if (LastGeo->getTypeId() == Part::GeomCircle::getClassTypeId()
|| LastGeo->getTypeId() == Part::GeomEllipse::getClassTypeId()) {
@@ -1369,9 +1369,10 @@ void SketcherCopy::activate(SketcherCopy::Op op)
// Ask the user if they want to clone or to simple copy
/*
int ret = QMessageBox::question(Gui::getMainWindow(), QObject::tr("Dimensional/Geometric constraints"),
QObject::tr("Do you want to clone the object, i.e. substitute dimensional constraints by geometric constraints?"),
QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel);
int ret = QMessageBox::question(Gui::getMainWindow(), QObject::tr("Dimensional/Geometric
constraints"), QObject::tr("Do you want to clone the object, i.e. substitute dimensional
constraints by geometric constraints?"), QMessageBox::Yes, QMessageBox::No,
QMessageBox::Cancel);
// use an equality constraint
if (ret == QMessageBox::Yes) {
clone = true;
@@ -1692,18 +1693,18 @@ public:
Sketcher::PointPos originpos, int nelements, bool clone,
int rows, int cols, bool constraintSeparation,
bool equalVerticalHorizontalSpacing)
: Mode(STATUS_SEEK_First),
snapMode(SnapMode::Free),
geoIdList(geoidlist),
OriginGeoId(origingeoid),
OriginPos(originpos),
nElements(nelements),
Clone(clone),
Rows(rows),
Cols(cols),
ConstraintSeparation(constraintSeparation),
EqualVerticalHorizontalSpacing(equalVerticalHorizontalSpacing),
EditCurve(2)
: Mode(STATUS_SEEK_First)
, snapMode(SnapMode::Free)
, geoIdList(geoidlist)
, OriginGeoId(origingeoid)
, OriginPos(originpos)
, nElements(nelements)
, Clone(clone)
, Rows(rows)
, Cols(cols)
, ConstraintSeparation(constraintSeparation)
, EqualVerticalHorizontalSpacing(equalVerticalHorizontalSpacing)
, EditCurve(2)
{}
~DrawSketchHandlerRectangularArray() override
@@ -1793,9 +1794,8 @@ public:
Gui::Command::commitCommand();
}
catch (const Base::Exception& e) {
Gui::NotifyUserError(sketchgui,
QT_TRANSLATE_NOOP("Notifications", "Error"),
e.what());
Gui::NotifyUserError(
sketchgui, QT_TRANSLATE_NOOP("Notifications", "Error"), e.what());
Gui::Command::abortCommand();
}
@@ -1869,8 +1869,8 @@ void CmdSketcherRectangularArray::activated(int iMsg)
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
Gui::TranslatedUserWarning(getActiveGuiDocument()->getDocument(),
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
return;
}
@@ -1879,8 +1879,8 @@ void CmdSketcherRectangularArray::activated(int iMsg)
const std::vector<std::string>& SubNames = selection[0].getSubNames();
if (SubNames.empty()) {
Gui::TranslatedUserWarning(getActiveGuiDocument()->getDocument(),
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
return;
}
@@ -1941,9 +1941,10 @@ void CmdSketcherRectangularArray::activated(int iMsg)
}
if (geoids < 1) {
Gui::TranslatedUserWarning(Obj,
QObject::tr("Wrong selection"),
QObject::tr("A copy requires at least one selected non-external geometric element"));
Gui::TranslatedUserWarning(
Obj,
QObject::tr("Wrong selection"),
QObject::tr("A copy requires at least one selected non-external geometric element"));
return;
}
@@ -1957,7 +1958,8 @@ void CmdSketcherRectangularArray::activated(int iMsg)
geoIdList.append(1, ']');
// if the last element is not a point serving as a reference for the copy process
// then make the start point of the last element the copy reference (if it exists, if not the center point)
// then make the start point of the last element the copy reference (if it exists, if not the
// center point)
if (LastPointPos == Sketcher::PointPos::none) {
if (LastGeo->getTypeId() == Part::GeomCircle::getClassTypeId()
|| LastGeo->getTypeId() == Part::GeomEllipse::getClassTypeId()) {
@@ -2034,9 +2036,8 @@ void CmdSketcherDeleteAllGeometry::activated(int iMsg)
Gui::Command::commitCommand();
}
catch (const Base::Exception& e) {
Gui::NotifyUserError(Obj,
QT_TRANSLATE_NOOP("Notifications", "Failed to delete all geometry"),
e.what());
Gui::NotifyUserError(
Obj, QT_TRANSLATE_NOOP("Notifications", "Failed to delete all geometry"), e.what());
Gui::Command::abortCommand();
}
@@ -2103,9 +2104,10 @@ void CmdSketcherDeleteAllConstraints::activated(int iMsg)
Gui::Command::commitCommand();
}
catch (const Base::Exception& e) {
Gui::NotifyUserError(Obj,
QT_TRANSLATE_NOOP("Notifications", "Failed to delete all constraints"),
e.what());
Gui::NotifyUserError(
Obj,
QT_TRANSLATE_NOOP("Notifications", "Failed to delete all constraints"),
e.what());
Gui::Command::abortCommand();
}
@@ -2159,8 +2161,8 @@ void CmdSketcherRemoveAxesAlignment::activated(int iMsg)
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
Gui::TranslatedUserWarning(getActiveGuiDocument()->getDocument(),
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
return;
}
@@ -2169,8 +2171,8 @@ void CmdSketcherRemoveAxesAlignment::activated(int iMsg)
const std::vector<std::string>& SubNames = selection[0].getSubNames();
if (SubNames.empty()) {
Gui::TranslatedUserWarning(getActiveGuiDocument()->getDocument(),
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
QObject::tr("Wrong selection"),
QObject::tr("Select elements from a single sketch."));
return;
}
@@ -2214,10 +2216,11 @@ void CmdSketcherRemoveAxesAlignment::activated(int iMsg)
}
if (geoids < 1) {
Gui::TranslatedUserWarning(Obj,
QObject::tr("Wrong selection"),
QObject::tr("Removal of axes alignment requires at least one selected "
"non-external geometric element"));
Gui::TranslatedUserWarning(
Obj,
QObject::tr("Wrong selection"),
QObject::tr("Removal of axes alignment requires at least one selected "
"non-external geometric element"));
return;
}
@@ -2237,9 +2240,7 @@ void CmdSketcherRemoveAxesAlignment::activated(int iMsg)
Gui::Command::commitCommand();
}
catch (const Base::Exception& e) {
Gui::NotifyUserError(Obj,
QT_TRANSLATE_NOOP("Notifications", "Error"),
e.what());
Gui::NotifyUserError(Obj, QT_TRANSLATE_NOOP("Notifications", "Error"), e.what());
Gui::Command::abortCommand();
}