mirror of
https://github.com/leozide/leocad
synced 2025-01-18 22:26:44 +01:00
Scoped enums.
This commit is contained in:
parent
a5c2e617d5
commit
5a76f4c870
6 changed files with 25 additions and 25 deletions
|
@ -16,7 +16,7 @@
|
|||
#define LC_CAMERA_SAVE_VERSION 7 // LeoCAD 0.80
|
||||
|
||||
lcCamera::lcCamera(bool Simple)
|
||||
: lcObject(LC_OBJECT_CAMERA)
|
||||
: lcObject(lcObjectType::Camera)
|
||||
{
|
||||
Initialize();
|
||||
|
||||
|
@ -37,7 +37,7 @@ lcCamera::lcCamera(bool Simple)
|
|||
}
|
||||
|
||||
lcCamera::lcCamera(float ex, float ey, float ez, float tx, float ty, float tz)
|
||||
: lcObject(LC_OBJECT_CAMERA)
|
||||
: lcObject(lcObjectType::Camera)
|
||||
{
|
||||
// Fix the up vector
|
||||
lcVector3 UpVector(0, 0, 1), FrontVector(ex - tx, ey - ty, ez - tz), SideVector;
|
||||
|
|
|
@ -4147,12 +4147,12 @@ void lcModel::EraserToolClicked(lcObject* Object)
|
|||
|
||||
switch (Object->GetType())
|
||||
{
|
||||
case LC_OBJECT_PIECE:
|
||||
case lcObjectType::Piece:
|
||||
mPieces.Remove((lcPiece*)Object);
|
||||
RemoveEmptyGroups();
|
||||
break;
|
||||
|
||||
case LC_OBJECT_CAMERA:
|
||||
case lcObjectType::Camera:
|
||||
{
|
||||
const lcArray<View*>* Views = gMainWindow->GetViewsForModel(this);
|
||||
for (int ViewIdx = 0; ViewIdx < Views->GetSize(); ViewIdx++)
|
||||
|
@ -4170,7 +4170,7 @@ void lcModel::EraserToolClicked(lcObject* Object)
|
|||
}
|
||||
break;
|
||||
|
||||
case LC_OBJECT_LIGHT:
|
||||
case lcObjectType::Light:
|
||||
mLights.Remove((lcLight*)Object);
|
||||
break;
|
||||
}
|
||||
|
@ -4184,7 +4184,7 @@ void lcModel::EraserToolClicked(lcObject* Object)
|
|||
|
||||
void lcModel::PaintToolClicked(lcObject* Object)
|
||||
{
|
||||
if (!Object || Object->GetType() != LC_OBJECT_PIECE)
|
||||
if (!Object || !Object->IsPiece())
|
||||
return;
|
||||
|
||||
lcPiece* Piece = (lcPiece*)Object;
|
||||
|
@ -4202,7 +4202,7 @@ void lcModel::PaintToolClicked(lcObject* Object)
|
|||
|
||||
void lcModel::ColorPickerToolClicked(lcObject* Object)
|
||||
{
|
||||
if (!Object || Object->GetType() != LC_OBJECT_PIECE)
|
||||
if (!Object || !Object->IsPiece())
|
||||
return;
|
||||
|
||||
lcPiece* Piece = (lcPiece*)Object;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
// New omni light.
|
||||
lcLight::lcLight(float px, float py, float pz)
|
||||
: lcObject(LC_OBJECT_LIGHT)
|
||||
: lcObject(lcObjectType::Light)
|
||||
{
|
||||
Initialize(lcVector3(px, py, pz), lcVector3(0.0f, 0.0f, 0.0f));
|
||||
UpdatePosition(1);
|
||||
|
@ -22,7 +22,7 @@ lcLight::lcLight(float px, float py, float pz)
|
|||
|
||||
// New directional or spot light.
|
||||
lcLight::lcLight(float px, float py, float pz, float tx, float ty, float tz)
|
||||
: lcObject(LC_OBJECT_LIGHT)
|
||||
: lcObject(lcObjectType::Light)
|
||||
{
|
||||
Initialize(lcVector3(px, py, pz), lcVector3(tx, ty, tz));
|
||||
mState |= LC_LIGHT_SPOT;
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
typedef quint32 lcStep;
|
||||
#define LC_STEP_MAX 0xffffffff
|
||||
|
||||
enum lcObjectType
|
||||
enum class lcObjectType
|
||||
{
|
||||
LC_OBJECT_PIECE,
|
||||
LC_OBJECT_CAMERA,
|
||||
LC_OBJECT_LIGHT
|
||||
Piece,
|
||||
Camera,
|
||||
Light
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
@ -63,17 +63,17 @@ public:
|
|||
public:
|
||||
bool IsPiece() const
|
||||
{
|
||||
return mObjectType == LC_OBJECT_PIECE;
|
||||
return mObjectType == lcObjectType::Piece;
|
||||
}
|
||||
|
||||
bool IsCamera() const
|
||||
{
|
||||
return mObjectType == LC_OBJECT_CAMERA;
|
||||
return mObjectType == lcObjectType::Camera;
|
||||
}
|
||||
|
||||
bool IsLight() const
|
||||
{
|
||||
return mObjectType == LC_OBJECT_LIGHT;
|
||||
return mObjectType == lcObjectType::Light;
|
||||
}
|
||||
|
||||
lcObjectType GetType() const
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#define LC_PIECE_CONTROL_POINT_SIZE 10.0f
|
||||
|
||||
lcPiece::lcPiece(PieceInfo* Info)
|
||||
: lcObject(LC_OBJECT_PIECE)
|
||||
: lcObject(lcObjectType::Piece)
|
||||
{
|
||||
mMesh = nullptr;
|
||||
SetPieceInfo(Info, QString(), true);
|
||||
|
@ -33,7 +33,7 @@ lcPiece::lcPiece(PieceInfo* Info)
|
|||
}
|
||||
|
||||
lcPiece::lcPiece(const lcPiece& Other)
|
||||
: lcObject(LC_OBJECT_PIECE)
|
||||
: lcObject(lcObjectType::Piece)
|
||||
{
|
||||
mMesh = nullptr;
|
||||
SetPieceInfo(Other.mPieceInfo, Other.mID, true);
|
||||
|
|
|
@ -316,15 +316,15 @@ void lcQPropertiesTree::Update(const lcArray<lcObject*>& Selection, lcObject* Fo
|
|||
{
|
||||
switch (Focus->GetType())
|
||||
{
|
||||
case LC_OBJECT_PIECE:
|
||||
case lcObjectType::Piece:
|
||||
Mode = LC_PROPERTY_WIDGET_PIECE;
|
||||
break;
|
||||
|
||||
case LC_OBJECT_CAMERA:
|
||||
case lcObjectType::Camera:
|
||||
Mode = LC_PROPERTY_WIDGET_CAMERA;
|
||||
break;
|
||||
|
||||
case LC_OBJECT_LIGHT:
|
||||
case lcObjectType::Light:
|
||||
Mode = LC_PROPERTY_WIDGET_LIGHT;
|
||||
break;
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ void lcQPropertiesTree::Update(const lcArray<lcObject*>& Selection, lcObject* Fo
|
|||
{
|
||||
switch (Selection[ObjectIdx]->GetType())
|
||||
{
|
||||
case LC_OBJECT_PIECE:
|
||||
case lcObjectType::Piece:
|
||||
if (Mode == LC_PROPERTY_WIDGET_EMPTY)
|
||||
Mode = LC_PROPERTY_WIDGET_PIECE;
|
||||
else if (Mode != LC_PROPERTY_WIDGET_PIECE)
|
||||
|
@ -345,7 +345,7 @@ void lcQPropertiesTree::Update(const lcArray<lcObject*>& Selection, lcObject* Fo
|
|||
}
|
||||
break;
|
||||
|
||||
case LC_OBJECT_CAMERA:
|
||||
case lcObjectType::Camera:
|
||||
if (Mode != LC_PROPERTY_WIDGET_EMPTY)
|
||||
{
|
||||
Mode = LC_PROPERTY_WIDGET_MULTIPLE;
|
||||
|
@ -358,7 +358,7 @@ void lcQPropertiesTree::Update(const lcArray<lcObject*>& Selection, lcObject* Fo
|
|||
}
|
||||
break;
|
||||
|
||||
case LC_OBJECT_LIGHT:
|
||||
case lcObjectType::Light:
|
||||
if (Mode != LC_PROPERTY_WIDGET_EMPTY)
|
||||
{
|
||||
Mode = LC_PROPERTY_WIDGET_MULTIPLE;
|
||||
|
@ -933,7 +933,7 @@ void lcQPropertiesTree::SetPiece(const lcArray<lcObject*>& Selection, lcObject*
|
|||
{
|
||||
lcObject* Object = Selection[ObjectIdx];
|
||||
|
||||
if (Object->GetType() != LC_OBJECT_PIECE)
|
||||
if (!Object->IsPiece())
|
||||
continue;
|
||||
|
||||
lcPiece* SelectedPiece = (lcPiece*)Object;
|
||||
|
|
Loading…
Reference in a new issue