Skip to content

Commit

Permalink
Skeleton of general CmdSketcherConstraint Class
Browse files Browse the repository at this point in the history
  • Loading branch information
AjinkyaDahale authored and wwmayer committed Jan 31, 2017
1 parent 9f68469 commit 3f02c72
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions src/Mod/Sketcher/Gui/CommandConstraints.cpp
Expand Up @@ -739,6 +739,23 @@ int SketchSelection::setUp(void)

/* Constrain commands =======================================================*/

class CmdSketcherConstraint : public Gui::Command
{
public:
CmdSketcherConstraint();
virtual ~CmdSketcherConstraint(){}
virtual const char* className() const
{ return "CmdSketcherConstraint"; }

protected:
virtual void applyConstraint();
virtual void activated(int iMsg);
virtual bool isActive(void)
{ return isCreateGeoActive(getActiveGuiDocument()); }
};

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

namespace SketcherGui {
class HoriVertConstraintSelection : public Gui::SelectionFilterGate
{
Expand Down Expand Up @@ -974,7 +991,7 @@ bool CmdSketcherConstrainHorizontal::isActive(void)
return isCreateGeoActive( getActiveGuiDocument() );
}

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

static const char *cursor_createvertconstraint[]={
"32 32 3 1",
Expand Down Expand Up @@ -1698,6 +1715,7 @@ bool CmdSketcherConstrainCoincident::isActive(void)
return isCreateGeoActive( getActiveGuiDocument() );
}

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

DEF_STD_CMD_AU(CmdSketcherConstrainDistance);

Expand Down Expand Up @@ -1880,6 +1898,7 @@ bool CmdSketcherConstrainDistance::isActive(void)
return isCreateConstraintActive( getActiveGuiDocument() );
}

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

DEF_STD_CMD_A(CmdSketcherConstrainPointOnObject);

Expand Down Expand Up @@ -1978,6 +1997,8 @@ bool CmdSketcherConstrainPointOnObject::isActive(void)
return isCreateConstraintActive( getActiveGuiDocument() );
}

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

DEF_STD_CMD_AU(CmdSketcherConstrainDistanceX);

CmdSketcherConstrainDistanceX::CmdSketcherConstrainDistanceX()
Expand Down Expand Up @@ -2136,6 +2157,7 @@ bool CmdSketcherConstrainDistanceX::isActive(void)
return isCreateConstraintActive( getActiveGuiDocument() );
}

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

DEF_STD_CMD_AU(CmdSketcherConstrainDistanceY);

Expand Down Expand Up @@ -2294,6 +2316,7 @@ bool CmdSketcherConstrainDistanceY::isActive(void)
return isCreateConstraintActive( getActiveGuiDocument() );
}

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

DEF_STD_CMD_A(CmdSketcherConstrainParallel);

Expand Down Expand Up @@ -2394,6 +2417,7 @@ bool CmdSketcherConstrainParallel::isActive(void)
return isCreateConstraintActive( getActiveGuiDocument() );
}

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

DEF_STD_CMD_A(CmdSketcherConstrainPerpendicular);

Expand Down Expand Up @@ -2778,6 +2802,7 @@ bool CmdSketcherConstrainPerpendicular::isActive(void)
return isCreateConstraintActive( getActiveGuiDocument() );
}

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

DEF_STD_CMD_A(CmdSketcherConstrainTangent);

Expand Down Expand Up @@ -3121,6 +3146,7 @@ bool CmdSketcherConstrainTangent::isActive(void)
return isCreateConstraintActive( getActiveGuiDocument() );
}

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

DEF_STD_CMD_AU(CmdSketcherConstrainRadius);

Expand Down Expand Up @@ -3445,6 +3471,8 @@ bool CmdSketcherConstrainRadius::isActive(void)
return isCreateConstraintActive( getActiveGuiDocument() );
}

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

DEF_STD_CMD_AU(CmdSketcherConstrainAngle);

CmdSketcherConstrainAngle::CmdSketcherConstrainAngle()
Expand Down Expand Up @@ -3741,6 +3769,8 @@ bool CmdSketcherConstrainAngle::isActive(void)
return isCreateConstraintActive( getActiveGuiDocument() );
}

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

DEF_STD_CMD_A(CmdSketcherConstrainEqual);

CmdSketcherConstrainEqual::CmdSketcherConstrainEqual()
Expand Down Expand Up @@ -3868,6 +3898,7 @@ bool CmdSketcherConstrainEqual::isActive(void)
return isCreateConstraintActive( getActiveGuiDocument() );
}

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

DEF_STD_CMD_A(CmdSketcherConstrainSymmetric);

Expand Down Expand Up @@ -4040,6 +4071,8 @@ bool CmdSketcherConstrainSymmetric::isActive(void)
return isCreateConstraintActive( getActiveGuiDocument() );
}

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

DEF_STD_CMD_A(CmdSketcherConstrainSnellsLaw);

CmdSketcherConstrainSnellsLaw::CmdSketcherConstrainSnellsLaw()
Expand Down Expand Up @@ -4197,6 +4230,7 @@ bool CmdSketcherConstrainSnellsLaw::isActive(void)
return isCreateConstraintActive( getActiveGuiDocument() );
}

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

DEF_STD_CMD_A(CmdSketcherConstrainInternalAlignment);

Expand Down Expand Up @@ -4621,6 +4655,7 @@ bool CmdSketcherConstrainInternalAlignment::isActive(void)
return isCreateConstraintActive( getActiveGuiDocument() );
}

// ======================================================================================
/*** Creation Mode / Toggle to or from Reference ***/
DEF_STD_CMD_A(CmdSketcherToggleDrivingConstraint);

Expand Down Expand Up @@ -4743,7 +4778,7 @@ void CmdSketcherToggleDrivingConstraint::activated(int iMsg)

bool CmdSketcherToggleDrivingConstraint::isActive(void)
{
return isCreateConstraintActive( getActiveGuiDocument() );
return isCreateGeoActive( getActiveGuiDocument() );
}

void CreateSketcherCommandsConstraints(void)
Expand Down

0 comments on commit 3f02c72

Please sign in to comment.