From fd8aca92dfc9860ff5fc61480471d1a15e5744a8 Mon Sep 17 00:00:00 2001 From: Leonardo Zide Date: Sat, 12 Dec 2020 16:58:40 -0800 Subject: [PATCH] Scoped enum lcViewpoint. --- common/camera.cpp | 18 +++++++++--------- common/camera.h | 16 ++++++++-------- common/lc_application.cpp | 14 +++++++------- common/lc_mainwindow.cpp | 16 ++++++++-------- common/lc_previewwidget.cpp | 2 +- common/view.cpp | 4 ++-- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/common/camera.cpp b/common/camera.cpp index 0e176a5d..752e2118 100644 --- a/common/camera.cpp +++ b/common/camera.cpp @@ -1005,13 +1005,13 @@ void lcCamera::SetViewpoint(lcViewpoint Viewpoint) { lcVector3 Positions[] = { - lcVector3( 0.0f, -1250.0f, 0.0f), // LC_VIEWPOINT_FRONT - lcVector3( 0.0f, 1250.0f, 0.0f), // LC_VIEWPOINT_BACK - lcVector3( 0.0f, 0.0f, 1250.0f), // LC_VIEWPOINT_TOP - lcVector3( 0.0f, 0.0f, -1250.0f), // LC_VIEWPOINT_BOTTOM - lcVector3( 1250.0f, 0.0f, 0.0f), // LC_VIEWPOINT_LEFT - lcVector3(-1250.0f, 0.0f, 0.0f), // LC_VIEWPOINT_RIGHT - lcVector3( 375.0f, -375.0f, 187.5f) // LC_VIEWPOINT_HOME + lcVector3( 0.0f, -1250.0f, 0.0f), // lcViewpoint::Front + lcVector3( 0.0f, 1250.0f, 0.0f), // lcViewpoint::Back + lcVector3( 0.0f, 0.0f, 1250.0f), // lcViewpoint::Top + lcVector3( 0.0f, 0.0f, -1250.0f), // lcViewpoint::Bottom + lcVector3( 1250.0f, 0.0f, 0.0f), // lcViewpoint::Left + lcVector3(-1250.0f, 0.0f, 0.0f), // lcViewpoint::Right + lcVector3( 375.0f, -375.0f, 187.5f) // lcViewpoint::Home }; lcVector3 Ups[] = @@ -1025,9 +1025,9 @@ void lcCamera::SetViewpoint(lcViewpoint Viewpoint) lcVector3(0.2357f, -0.2357f, 0.94281f) }; - mPosition = Positions[Viewpoint]; + mPosition = Positions[static_cast(Viewpoint)]; mTargetPosition = lcVector3(0, 0, 0); - mUpVector = Ups[Viewpoint]; + mUpVector = Ups[static_cast(Viewpoint)]; ChangeKey(mPositionKeys, mPosition, 1, false); ChangeKey(mTargetPositionKeys, mTargetPosition, 1, false); diff --git a/common/camera.h b/common/camera.h index 359e9fc9..46ca7e0d 100644 --- a/common/camera.h +++ b/common/camera.h @@ -17,15 +17,15 @@ #define LC_CAMERA_SELECTION_MASK (LC_CAMERA_POSITION_SELECTED | LC_CAMERA_TARGET_SELECTED | LC_CAMERA_UPVECTOR_SELECTED) #define LC_CAMERA_FOCUS_MASK (LC_CAMERA_POSITION_FOCUSED | LC_CAMERA_TARGET_FOCUSED | LC_CAMERA_UPVECTOR_FOCUSED) -enum lcViewpoint +enum class lcViewpoint { - LC_VIEWPOINT_FRONT, - LC_VIEWPOINT_BACK, - LC_VIEWPOINT_TOP, - LC_VIEWPOINT_BOTTOM, - LC_VIEWPOINT_LEFT, - LC_VIEWPOINT_RIGHT, - LC_VIEWPOINT_HOME + Front, + Back, + Top, + Bottom, + Left, + Right, + Home }; enum lcCameraSection diff --git a/common/lc_application.cpp b/common/lc_application.cpp index 8eda2103..35cb283c 100644 --- a/common/lc_application.cpp +++ b/common/lc_application.cpp @@ -721,19 +721,19 @@ bool lcApplication::Initialize(QList>& LibraryPaths, bool& if (!ViewpointName.isEmpty()) { if (ViewpointName == QLatin1String("front")) - ActiveView->SetViewpoint(LC_VIEWPOINT_FRONT); + ActiveView->SetViewpoint(lcViewpoint::Front); else if (ViewpointName == QLatin1String("back")) - ActiveView->SetViewpoint(LC_VIEWPOINT_BACK); + ActiveView->SetViewpoint(lcViewpoint::Back); else if (ViewpointName == QLatin1String("top")) - ActiveView->SetViewpoint(LC_VIEWPOINT_TOP); + ActiveView->SetViewpoint(lcViewpoint::Top); else if (ViewpointName == QLatin1String("bottom")) - ActiveView->SetViewpoint(LC_VIEWPOINT_BOTTOM); + ActiveView->SetViewpoint(lcViewpoint::Bottom); else if (ViewpointName == QLatin1String("left")) - ActiveView->SetViewpoint(LC_VIEWPOINT_LEFT); + ActiveView->SetViewpoint(lcViewpoint::Left); else if (ViewpointName == QLatin1String("right")) - ActiveView->SetViewpoint(LC_VIEWPOINT_RIGHT); + ActiveView->SetViewpoint(lcViewpoint::Right); else if (ViewpointName == QLatin1String("home")) - ActiveView->SetViewpoint(LC_VIEWPOINT_HOME); + ActiveView->SetViewpoint(lcViewpoint::Home); else printf("Unknown viewpoint: '%s'\n", ViewpointName.toLatin1().constData()); diff --git a/common/lc_mainwindow.cpp b/common/lc_mainwindow.cpp index 52b85a49..f6c6ea06 100644 --- a/common/lc_mainwindow.cpp +++ b/common/lc_mainwindow.cpp @@ -1916,7 +1916,7 @@ void lcMainWindow::ResetViews() return; TabWidget->ResetLayout(); - TabWidget->GetActiveView()->SetViewpoint(LC_VIEWPOINT_HOME); + TabWidget->GetActiveView()->SetViewpoint(lcViewpoint::Home); } void lcMainWindow::ToggleDockWidget(QWidget* DockWidget) @@ -3106,37 +3106,37 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId) case LC_VIEW_VIEWPOINT_FRONT: if (ActiveView) - ActiveView->SetViewpoint(LC_VIEWPOINT_FRONT); + ActiveView->SetViewpoint(lcViewpoint::Front); break; case LC_VIEW_VIEWPOINT_BACK: if (ActiveView) - ActiveView->SetViewpoint(LC_VIEWPOINT_BACK); + ActiveView->SetViewpoint(lcViewpoint::Back); break; case LC_VIEW_VIEWPOINT_TOP: if (ActiveView) - ActiveView->SetViewpoint(LC_VIEWPOINT_TOP); + ActiveView->SetViewpoint(lcViewpoint::Top); break; case LC_VIEW_VIEWPOINT_BOTTOM: if (ActiveView) - ActiveView->SetViewpoint(LC_VIEWPOINT_BOTTOM); + ActiveView->SetViewpoint(lcViewpoint::Bottom); break; case LC_VIEW_VIEWPOINT_LEFT: if (ActiveView) - ActiveView->SetViewpoint(LC_VIEWPOINT_LEFT); + ActiveView->SetViewpoint(lcViewpoint::Left); break; case LC_VIEW_VIEWPOINT_RIGHT: if (ActiveView) - ActiveView->SetViewpoint(LC_VIEWPOINT_RIGHT); + ActiveView->SetViewpoint(lcViewpoint::Right); break; case LC_VIEW_VIEWPOINT_HOME: if (ActiveView) - ActiveView->SetViewpoint(LC_VIEWPOINT_HOME); + ActiveView->SetViewpoint(lcViewpoint::Home); break; case LC_VIEW_CAMERA_NONE: diff --git a/common/lc_previewwidget.cpp b/common/lc_previewwidget.cpp index 4120df75..6eaa842f 100644 --- a/common/lc_previewwidget.cpp +++ b/common/lc_previewwidget.cpp @@ -192,7 +192,7 @@ void lcPreviewWidget::SetDefaultCamera() { if (!mCamera || !mCamera->IsSimple()) mCamera = new lcCamera(true); - mCamera->SetViewpoint(LC_VIEWPOINT_HOME); + mCamera->SetViewpoint(lcViewpoint::Home); } void lcPreviewWidget::SetCamera(lcCamera* Camera) // called by lcModel::DeleteModel() diff --git a/common/view.cpp b/common/view.cpp index aef15381..aa5c682f 100644 --- a/common/view.cpp +++ b/common/view.cpp @@ -255,7 +255,7 @@ void View::RemoveCamera() if (Camera) mCamera->CopyPosition(Camera); else - mCamera->SetViewpoint(LC_VIEWPOINT_HOME); + mCamera->SetViewpoint(lcViewpoint::Home); gMainWindow->UpdateCurrentCamera(-1); Redraw(); @@ -385,7 +385,7 @@ void View::SetDefaultCamera() if (!mCamera || !mCamera->IsSimple()) mCamera = new lcCamera(true); - mCamera->SetViewpoint(LC_VIEWPOINT_HOME); + mCamera->SetViewpoint(lcViewpoint::Home); gMainWindow->UpdateCurrentCamera(-1); }