Renamed view class.

This commit is contained in:
Leonardo Zide 2020-12-25 10:54:33 -08:00
parent 939e80ab4b
commit 7de5d4eb22
15 changed files with 170 additions and 175 deletions

View file

@ -795,7 +795,7 @@ bool lcApplication::Initialize(QList<QPair<QString, bool>>& LibraryPaths, bool&
if (!ModelName.isEmpty())
mProject->SetActiveModel(ModelName);
View* ActiveView = gMainWindow->GetActiveView();
lcView* ActiveView = gMainWindow->GetActiveView();
if (!CameraName.isEmpty())
{
@ -1134,5 +1134,5 @@ void lcApplication::ShowPreferencesDialog()
*/
gMainWindow->SetShadingMode(Options.Preferences.mShadingMode);
View::UpdateAllViews();
lcView::UpdateAllViews();
}

View file

@ -79,7 +79,7 @@ void lcModelTabWidget::Clear()
{
ResetLayout();
mModel = nullptr;
for (View* View : mViews)
for (lcView* View : mViews)
View->Clear();
mViews.RemoveAll();
mActiveView = nullptr;
@ -768,9 +768,9 @@ void lcMainWindow::CreateToolBars()
mPartsToolBar->raise();
}
View* lcMainWindow::CreateView(lcModel* Model)
lcView* lcMainWindow::CreateView(lcModel* Model)
{
View* NewView = new View(lcViewType::View, Model);
lcView* NewView = new lcView(lcViewType::View, Model);
connect(NewView, SIGNAL(CameraChanged()), this, SLOT(ViewCameraChanged()));
connect(NewView, SIGNAL(FocusReceived()), this, SLOT(ViewFocusReceived()));
@ -1012,7 +1012,7 @@ void lcMainWindow::UpdateGamepads()
if (!gMainWindow)
return;
View* ActiveView = GetActiveView();
lcView* ActiveView = GetActiveView();
if (!ActiveView)
return;
@ -1138,7 +1138,7 @@ void lcMainWindow::ProjectFileChanged(const QString& Path)
QByteArray TabLayout = GetTabLayout();
gApplication->SetProject(NewProject);
RestoreTabLayout(TabLayout);
View::UpdateAllViews();
lcView::UpdateAllViews();
}
}
else
@ -1349,7 +1349,7 @@ void lcMainWindow::SetShadingMode(lcShadingMode ShadingMode)
UpdateShadingMode();
View::UpdateAllViews();
lcView::UpdateAllViews();
if (mPartSelectionWidget)
mPartSelectionWidget->Redraw();
@ -1366,28 +1366,28 @@ void lcMainWindow::ToggleViewSphere()
{
lcGetPreferences().mViewSphereEnabled = !lcGetPreferences().mViewSphereEnabled;
View::UpdateAllViews();
lcView::UpdateAllViews();
}
void lcMainWindow::ToggleAxisIcon()
{
lcGetPreferences().mDrawAxes = !lcGetPreferences().mDrawAxes;
View::UpdateAllViews();
lcView::UpdateAllViews();
}
void lcMainWindow::ToggleGrid()
{
lcGetPreferences().mGridEnabled = !lcGetPreferences().mGridEnabled;
View::UpdateAllViews();
lcView::UpdateAllViews();
}
void lcMainWindow::ToggleFadePreviousSteps()
{
lcGetPreferences().mFadeSteps = !lcGetPreferences().mFadeSteps;
View::UpdateAllViews();
lcView::UpdateAllViews();
}
QByteArray lcMainWindow::GetTabLayout()
@ -1410,7 +1410,7 @@ QByteArray lcMainWindow::GetTabLayout()
{
if (Widget->metaObject() == &lcViewWidget::staticMetaObject)
{
View* CurrentView = (View*)((lcViewWidget*)Widget)->GetView();
lcView* CurrentView = ((lcViewWidget*)Widget)->GetView();
DataStream << (qint32)0;
DataStream << (qint32)(TabWidget->GetActiveView() == CurrentView ? 1 : 0);
@ -1506,10 +1506,10 @@ void lcMainWindow::RestoreTabLayout(const QByteArray& TabLayout)
qint32 CameraType;
DataStream >> CameraType;
View* CurrentView = nullptr;
lcView* CurrentView = nullptr;
if (ParentWidget)
CurrentView = (View*)((lcViewWidget*)ParentWidget)->GetView();
CurrentView = ((lcViewWidget*)ParentWidget)->GetView();
if (CameraType == 0)
{
@ -1633,7 +1633,7 @@ void lcMainWindow::SetCurrentModelTab(lcModel* Model)
lcModelTabWidget* TabWidget;
lcViewWidget* ViewWidget;
View* NewView;
lcView* NewView;
if (!EmptyWidget)
{
@ -1674,7 +1674,7 @@ void lcMainWindow::ResetCameras()
if (!CurrentTab)
return;
const lcArray<View*>* Views = CurrentTab->GetViews();
const lcArray<lcView*>* Views = CurrentTab->GetViews();
for (int ViewIdx = 0; ViewIdx < Views->GetSize(); ViewIdx++)
(*Views)[ViewIdx]->SetDefaultCamera();
@ -1682,7 +1682,7 @@ void lcMainWindow::ResetCameras()
lcGetActiveModel()->DeleteAllCameras();
}
void lcMainWindow::AddView(View* View)
void lcMainWindow::AddView(lcView* View)
{
lcModelTabWidget* TabWidget = GetTabWidgetForModel(View->GetModel());
@ -1698,7 +1698,7 @@ void lcMainWindow::AddView(View* View)
}
}
void lcMainWindow::RemoveView(View* View)
void lcMainWindow::RemoveView(lcView* View)
{
lcModelTabWidget* TabWidget = GetTabForView(View);
@ -1706,10 +1706,10 @@ void lcMainWindow::RemoveView(View* View)
TabWidget->RemoveView(View);
}
void lcMainWindow::SetActiveView(View* ActiveView)
void lcMainWindow::SetActiveView(lcView* ActiveView)
{
lcModelTabWidget* TabWidget = GetTabForView(ActiveView);
View* CurrentActiveView = TabWidget->GetActiveView();
lcView* CurrentActiveView = TabWidget->GetActiveView();
if (!TabWidget || CurrentActiveView == ActiveView)
return;
@ -1732,7 +1732,7 @@ void lcMainWindow::SetTool(lcTool Tool)
if (Action)
Action->setChecked(true);
View::UpdateAllViews();
lcView::UpdateAllViews();
}
void lcMainWindow::SetColorIndex(int ColorIndex)
@ -1779,7 +1779,7 @@ void lcMainWindow::SetRelativeTransform(bool RelativeTransform)
{
mRelativeTransform = RelativeTransform;
UpdateLockSnap();
View::UpdateAllViews();
lcView::UpdateAllViews();
}
void lcMainWindow::SetLocalTransform(bool SelectionTransform)
@ -2179,14 +2179,14 @@ void lcMainWindow::UpdateUndoRedo(const QString& UndoText, const QString& RedoTe
void lcMainWindow::ViewFocusReceived()
{
SetActiveView(dynamic_cast<View*>(sender()));
SetActiveView(dynamic_cast<lcView*>(sender()));
}
void lcMainWindow::ViewCameraChanged()
{
View* _View = dynamic_cast<View*>(sender());
lcView* View = dynamic_cast<lcView*>(sender());
if (!_View || !_View->IsLastFocused())
if (!View || !View->IsLastFocused())
return;
UpdateCameraMenu();
@ -2195,7 +2195,7 @@ void lcMainWindow::ViewCameraChanged()
void lcMainWindow::UpdateCameraMenu()
{
const lcArray<lcCamera*>& Cameras = lcGetActiveModel()->GetCameras();
View* ActiveView = GetActiveView();
lcView* ActiveView = GetActiveView();
const lcCamera* CurrentCamera = ActiveView ? ActiveView->GetCamera() : nullptr;
bool CurrentSet = false;
@ -2227,7 +2227,7 @@ void lcMainWindow::UpdateCameraMenu()
void lcMainWindow::UpdatePerspective()
{
View* ActiveView = GetActiveView();
lcView* ActiveView = GetActiveView();
if (ActiveView)
{
@ -2401,7 +2401,7 @@ bool lcMainWindow::OpenProjectFile(const QString& FileName)
{
gApplication->SetProject(NewProject);
AddRecentFile(FileName);
View::UpdateProjectViews(NewProject);
lcView::UpdateProjectViews(NewProject);
return true;
}
@ -2457,7 +2457,7 @@ void lcMainWindow::ImportLDD()
if (NewProject->ImportLDD(LoadFileName))
{
gApplication->SetProject(NewProject);
View::UpdateProjectViews(NewProject);
lcView::UpdateProjectViews(NewProject);
}
else
delete NewProject;
@ -2477,7 +2477,7 @@ void lcMainWindow::ImportInventory()
if (NewProject->ImportInventory(Dialog.GetSetInventory(), Dialog.GetSetName(), Dialog.GetSetDescription()))
{
gApplication->SetProject(NewProject);
View::UpdateProjectViews(NewProject);
lcView::UpdateProjectViews(NewProject);
}
else
delete NewProject;
@ -2588,13 +2588,13 @@ void lcMainWindow::SetModelFromSelection()
lcModel* lcMainWindow::GetActiveModel() const
{
View* ActiveView = GetActiveView();
lcView* ActiveView = GetActiveView();
return ActiveView ? ActiveView->GetActiveModel() : nullptr;
}
void lcMainWindow::HandleCommand(lcCommandId CommandId)
{
View* ActiveView = GetActiveView();
lcView* ActiveView = GetActiveView();
lcModel* ActiveModel = ActiveView ? ActiveView->GetActiveModel() : nullptr;
switch (CommandId)

View file

@ -6,7 +6,6 @@
#include "lc_commands.h"
#include "lc_model.h"
class View;
class lcPartSelectionWidget;
class lcPreviewDockWidget;
class PiecePreview;
@ -84,22 +83,22 @@ public:
return Widget;
}
View* GetActiveView() const
lcView* GetActiveView() const
{
return mActiveView;
}
void SetActiveView(View* ActiveView)
void SetActiveView(lcView* ActiveView)
{
mActiveView = ActiveView;
}
void AddView(View* View)
void AddView(lcView* View)
{
mViews.Add(View);
}
void RemoveView(View* View)
void RemoveView(lcView* View)
{
if (View == mActiveView)
mActiveView = nullptr;
@ -117,15 +116,15 @@ public:
mModel = Model;
}
const lcArray<View*>* GetViews() const
const lcArray<lcView*>* GetViews() const
{
return &mViews;
}
protected:
lcModel* mModel;
View* mActiveView;
lcArray<View*> mViews;
lcView* mActiveView;
lcArray<lcView*> mViews;
};
class lcMainWindow : public QMainWindow
@ -208,7 +207,7 @@ public:
return mCurrentPieceInfo;
}
View* GetActiveView() const
lcView* GetActiveView() const
{
const lcModelTabWidget* const CurrentTab = mModelTabWidget ? (lcModelTabWidget*)mModelTabWidget->currentWidget() : nullptr;
return CurrentTab ? CurrentTab->GetActiveView() : nullptr;
@ -222,13 +221,13 @@ public:
return CurrentTab ? CurrentTab->GetModel() : nullptr;
}
const lcArray<View*>* GetViewsForModel(const lcModel* Model) const
const lcArray<lcView*>* GetViewsForModel(const lcModel* Model) const
{
const lcModelTabWidget* const TabWidget = GetTabWidgetForModel(Model);
return TabWidget ? TabWidget->GetViews() : nullptr;
}
lcModelTabWidget* GetTabForView(View* View) const
lcModelTabWidget* GetTabForView(lcView* View) const
{
for (int TabIdx = 0; TabIdx < mModelTabWidget->count(); TabIdx++)
{
@ -283,8 +282,8 @@ public:
void CloseCurrentModelTab();
void SetCurrentModelTab(lcModel* Model);
void ResetCameras();
void AddView(View* View);
void RemoveView(View* View);
void AddView(lcView* View);
void RemoveView(lcView* View);
void SetTool(lcTool Tool);
void SetTransformType(lcTransformType TransformType);
@ -384,8 +383,8 @@ protected:
void CreateMenus();
void CreateToolBars();
void CreateStatusBar();
View* CreateView(lcModel* Model);
void SetActiveView(View* ActiveView);
lcView* CreateView(lcModel* Model);
void SetActiveView(lcView* ActiveView);
void ToggleDockWidget(QWidget* DockWidget);
void SplitView(Qt::Orientation Orientation);
void ShowSearchDialog();

View file

@ -47,7 +47,7 @@ lcMinifigDialog::lcMinifigDialog(QWidget* Parent)
PreviewLayout->setContentsMargins(0, 0, 0, 0);
mMinifigWizard = new MinifigWizard();
mView = new View(lcViewType::Minifig, mMinifigWizard->GetModel());
mView = new lcView(lcViewType::Minifig, mMinifigWizard->GetModel());
lcViewWidget* ViewWidget = new lcViewWidget(nullptr, mView);
ViewWidget->setMinimumWidth(100);

View file

@ -2,9 +2,9 @@
#include "minifig.h"
class lcQColorPicker;
class View;
namespace Ui {
namespace Ui
{
class lcMinifigDialog;
}
@ -33,7 +33,7 @@ protected:
Ui::lcMinifigDialog* ui;
View* mView;
lcView* mView;
std::array<QComboBox*, LC_MFW_NUMITEMS> mComboBoxes;
std::array<lcQColorPicker*, LC_MFW_NUMITEMS> mColorPickers;
std::array<QDoubleSpinBox*, LC_MFW_NUMITEMS> mSpinBoxes;

View file

@ -193,14 +193,14 @@ void lcModel::DeleteModel()
{
if (gMainWindow)
{
const lcArray<View*>* Views = gMainWindow->GetViewsForModel(this);
const lcArray<lcView*>* Views = gMainWindow->GetViewsForModel(this);
// TODO: this is only needed to avoid a dangling pointer during undo/redo if a camera is set to a view but we should find a better solution instead
if (Views)
{
for (int ViewIdx = 0; ViewIdx < Views->GetSize(); ViewIdx++)
{
View* View = (*Views)[ViewIdx];
lcView* View = (*Views)[ViewIdx];
lcCamera* Camera = View->GetCamera();
if (!Camera->IsSimple() && mCameras.FindIndex(Camera) != -1)
@ -231,7 +231,7 @@ void lcModel::UpdateMesh()
void lcModel::UpdateAllViews() const
{
View::UpdateProjectViews(mProject);
lcView::UpdateProjectViews(mProject);
}
void lcModel::UpdatePieceInfo(std::vector<lcModel*>& UpdatedModels)
@ -1266,7 +1266,7 @@ void lcModel::AddSubModelRenderMeshes(lcScene* Scene, const lcMatrix44& WorldMat
QImage lcModel::GetStepImage(bool Zoom, int Width, int Height, lcStep Step)
{
View* ActiveView = gMainWindow->GetActiveView();
lcView* ActiveView = gMainWindow->GetActiveView();
ActiveView->MakeCurrent();
lcContext* Context = ActiveView->mContext;
@ -1276,7 +1276,7 @@ QImage lcModel::GetStepImage(bool Zoom, int Width, int Height, lcStep Step)
if (Zoom)
ZoomExtents(Camera, (float)Width / (float)Height);
View View(lcViewType::View, this);
lcView View(lcViewType::View, this);
View.SetCamera(Camera, false);
View.SetContext(Context);
@ -1348,7 +1348,7 @@ QImage lcModel::GetPartsListImage(int MaxWidth, lcStep Step) const
std::sort(Images.begin(), Images.end(), ImageCompare);
View* View = gMainWindow->GetActiveView();
lcView* View = gMainWindow->GetActiveView();
View->MakeCurrent();
lcContext* Context = View->mContext;
const int ThumbnailSize = qMin(MaxWidth, 512);
@ -2610,10 +2610,10 @@ bool lcModel::RemoveSelectedObjects()
if (Camera->IsSelected())
{
const lcArray<View*>* Views = gMainWindow->GetViewsForModel(this);
const lcArray<lcView*>* Views = gMainWindow->GetViewsForModel(this);
for (int ViewIdx = 0; ViewIdx < Views->GetSize(); ViewIdx++)
{
View* View = (*Views)[ViewIdx];
lcView* View = (*Views)[ViewIdx];
if (Camera == View->GetCamera())
View->SetCamera(Camera, true);
@ -4091,10 +4091,10 @@ void lcModel::EraserToolClicked(lcObject* Object)
case lcObjectType::Camera:
{
const lcArray<View*>* Views = gMainWindow->GetViewsForModel(this);
const lcArray<lcView*>* Views = gMainWindow->GetViewsForModel(this);
for (int ViewIdx = 0; ViewIdx < Views->GetSize(); ViewIdx++)
{
View* View = (*Views)[ViewIdx];
lcView* View = (*Views)[ViewIdx];
lcCamera* Camera = View->GetCamera();
if (Camera == Object)

View file

@ -387,7 +387,7 @@ void lcPartSelectionListModel::PartLoaded(PieceInfo* Info)
void lcPartSelectionListModel::DrawPreview(int InfoIndex)
{
View* ActiveView = gMainWindow->GetActiveView();
lcView* ActiveView = gMainWindow->GetActiveView();
if (!ActiveView)
return;

View file

@ -83,7 +83,7 @@ void lcPreviewDockWidget::SetPreviewLock()
}
lcPreview::lcPreview()
: View(lcViewType::Preview, nullptr), mLoader(new Project(true))
: lcView(lcViewType::Preview, nullptr), mLoader(new Project(true))
{
mLoader->SetActiveModel(0);
mModel = mLoader->GetActiveModel();

View file

@ -26,7 +26,7 @@ protected:
lcViewWidget* mViewWidget;
};
class lcPreview : public View
class lcPreview : public lcView
{
public:
lcPreview();

View file

@ -12,13 +12,13 @@
#include "lc_context.h"
#include "lc_viewsphere.h"
View* View::mLastFocusedView;
std::vector<View*> View::mViews;
lcView* lcView::mLastFocusedView;
std::vector<lcView*> lcView::mViews;
lcVertexBuffer View::mRotateMoveVertexBuffer;
lcIndexBuffer View::mRotateMoveIndexBuffer;
lcVertexBuffer lcView::mRotateMoveVertexBuffer;
lcIndexBuffer lcView::mRotateMoveIndexBuffer;
View::View(lcViewType ViewType, lcModel* Model)
lcView::lcView(lcViewType ViewType, lcModel* Model)
: mScene(new lcScene()), mModel(Model), mViewType(ViewType)
{
mContext = new lcContext();
@ -30,14 +30,14 @@ View::View(lcViewType ViewType, lcModel* Model)
mDragState = lcDragState::None;
mTrackToolFromOverlay = false;
View* ActiveView = gMainWindow->GetActiveView();
lcView* ActiveView = gMainWindow->GetActiveView();
if (ActiveView)
SetCamera(ActiveView->mCamera, false);
else
SetDefaultCamera();
}
View::~View()
lcView::~lcView()
{
mContext->DestroyVertexBuffer(mGridBuffer);
@ -56,9 +56,9 @@ View::~View()
delete mContext;
}
void View::UpdateProjectViews(const Project* Project)
void lcView::UpdateProjectViews(const Project* Project)
{
for (View* View : mViews)
for (lcView* View : mViews)
{
const lcModel* ViewModel = View->GetActiveModel();
@ -67,23 +67,23 @@ void View::UpdateProjectViews(const Project* Project)
}
}
void View::UpdateAllViews()
void lcView::UpdateAllViews()
{
for (View* View : mViews)
for (lcView* View : mViews)
View->Redraw();
}
void View::MakeCurrent()
void lcView::MakeCurrent()
{
mWidget->makeCurrent();
}
void View::Redraw()
void lcView::Redraw()
{
mWidget->update();
}
void View::SetContext(lcContext* Context)
void lcView::SetContext(lcContext* Context)
{
if (mDeleteContext)
delete mContext;
@ -92,7 +92,7 @@ void View::SetContext(lcContext* Context)
mDeleteContext = false;
}
void View::SetFocus(bool Focus)
void lcView::SetFocus(bool Focus)
{
if (Focus)
{
@ -102,23 +102,23 @@ void View::SetFocus(bool Focus)
}
}
void View::SetMousePosition(int MouseX, int MouseY)
void lcView::SetMousePosition(int MouseX, int MouseY)
{
mMouseX = MouseX;
mMouseY = MouseY;
}
void View::SetMouseModifiers(Qt::KeyboardModifiers MouseModifiers)
void lcView::SetMouseModifiers(Qt::KeyboardModifiers MouseModifiers)
{
mMouseModifiers = MouseModifiers;
}
lcModel* View::GetActiveModel() const
lcModel* lcView::GetActiveModel() const
{
return !mActiveSubmodelInstance ? mModel : mActiveSubmodelInstance->mPieceInfo->GetModel();
}
void View::SetTopSubmodelActive()
void lcView::SetTopSubmodelActive()
{
lcModel* ActiveModel = GetActiveModel();
@ -131,7 +131,7 @@ void View::SetTopSubmodelActive()
GetActiveModel()->UpdateInterface();
}
void View::SetSelectedSubmodelActive()
void lcView::SetSelectedSubmodelActive()
{
lcModel* ActiveModel = GetActiveModel();
lcObject* Object = ActiveModel->GetFocusObject();
@ -160,7 +160,7 @@ void View::SetSelectedSubmodelActive()
GetActiveModel()->UpdateInterface();
}
void View::CreateResources(lcContext* Context)
void lcView::CreateResources(lcContext* Context)
{
gGridTexture = new lcTexture;
gGridTexture->CreateGridTexture();
@ -168,7 +168,7 @@ void View::CreateResources(lcContext* Context)
CreateSelectMoveOverlayMesh(Context);
}
void View::CreateSelectMoveOverlayMesh(lcContext* Context)
void lcView::CreateSelectMoveOverlayMesh(lcContext* Context)
{
float Verts[(51 + 138 + 10) * 3];
float* CurVert = Verts;
@ -314,7 +314,7 @@ void View::CreateSelectMoveOverlayMesh(lcContext* Context)
mRotateMoveIndexBuffer = Context->CreateIndexBuffer(sizeof(Indices), Indices);
}
void View::DestroyResources(lcContext* Context)
void lcView::DestroyResources(lcContext* Context)
{
delete gGridTexture;
gGridTexture = nullptr;
@ -323,7 +323,7 @@ void View::DestroyResources(lcContext* Context)
Context->DestroyIndexBuffer(mRotateMoveIndexBuffer);
}
void View::RemoveCamera()
void lcView::RemoveCamera()
{
if (mCamera && mCamera->IsSimple())
return;
@ -340,25 +340,25 @@ void View::RemoveCamera()
Redraw();
}
lcVector3 View::ProjectPoint(const lcVector3& Point) const
lcVector3 lcView::ProjectPoint(const lcVector3& Point) const
{
int Viewport[4] = { 0, 0, mWidth, mHeight };
return lcProjectPoint(Point, mCamera->mWorldView, GetProjectionMatrix(), Viewport);
}
lcVector3 View::UnprojectPoint(const lcVector3& Point) const
lcVector3 lcView::UnprojectPoint(const lcVector3& Point) const
{
int Viewport[4] = { 0, 0, mWidth, mHeight };
return lcUnprojectPoint(Point, mCamera->mWorldView, GetProjectionMatrix(), Viewport);
}
void View::UnprojectPoints(lcVector3* Points, int NumPoints) const
void lcView::UnprojectPoints(lcVector3* Points, int NumPoints) const
{
int Viewport[4] = { 0, 0, mWidth, mHeight };
lcUnprojectPoints(Points, NumPoints, mCamera->mWorldView, GetProjectionMatrix(), Viewport);
}
lcMatrix44 View::GetProjectionMatrix() const
lcMatrix44 lcView::GetProjectionMatrix() const
{
float AspectRatio = (float)mWidth / (float)mHeight;
@ -373,7 +373,7 @@ lcMatrix44 View::GetProjectionMatrix() const
return lcMatrix44Perspective(mCamera->m_fovy, AspectRatio, mCamera->m_zNear, mCamera->m_zFar);
}
lcMatrix44 View::GetTileProjectionMatrix(int CurrentRow, int CurrentColumn, int CurrentTileWidth, int CurrentTileHeight) const
lcMatrix44 lcView::GetTileProjectionMatrix(int CurrentRow, int CurrentColumn, int CurrentTileWidth, int CurrentTileHeight) const
{
int ImageWidth = mRenderImage.width();
int ImageHeight = mRenderImage.height();
@ -420,7 +420,7 @@ lcMatrix44 View::GetTileProjectionMatrix(int CurrentRow, int CurrentColumn, int
return lcMatrix44Frustum(Left, Right, Bottom, Top, Near, Far);
}
void View::ShowContextMenu() const
void lcView::ShowContextMenu() const
{
QAction** Actions = gMainWindow->mActions;
@ -463,7 +463,7 @@ void View::ShowContextMenu() const
delete Popup;
}
lcVector3 View::GetMoveDirection(const lcVector3& Direction) const
lcVector3 lcView::GetMoveDirection(const lcVector3& Direction) const
{
if (lcGetPreferences().mFixedAxes)
return Direction;
@ -511,7 +511,7 @@ lcVector3 View::GetMoveDirection(const lcVector3& Direction) const
return axis;
}
lcMatrix44 View::GetPieceInsertPosition(bool IgnoreSelected, PieceInfo* Info) const
lcMatrix44 lcView::GetPieceInsertPosition(bool IgnoreSelected, PieceInfo* Info) const
{
lcPiece* HitPiece = (lcPiece*)FindObjectUnderPointer(true, IgnoreSelected).Object;
lcModel* ActiveModel = GetActiveModel();
@ -567,7 +567,7 @@ lcMatrix44 View::GetPieceInsertPosition(bool IgnoreSelected, PieceInfo* Info) co
return lcMatrix44Translation(UnprojectPoint(lcVector3((float)mMouseX, (float)mMouseY, 0.9f)));
}
lcVector3 View::GetCameraLightInsertPosition() const
lcVector3 lcView::GetCameraLightInsertPosition() const
{
lcModel* ActiveModel = GetActiveModel();
@ -593,7 +593,7 @@ lcVector3 View::GetCameraLightInsertPosition() const
return lcRayPointClosestPoint(Center, ClickPoints[0], ClickPoints[1]);
}
void View::GetRayUnderPointer(lcVector3& Start, lcVector3& End) const
void lcView::GetRayUnderPointer(lcVector3& Start, lcVector3& End) const
{
lcVector3 StartEnd[2] =
{
@ -607,7 +607,7 @@ void View::GetRayUnderPointer(lcVector3& Start, lcVector3& End) const
End = StartEnd[1];
}
lcObjectSection View::FindObjectUnderPointer(bool PiecesOnly, bool IgnoreSelected) const
lcObjectSection lcView::FindObjectUnderPointer(bool PiecesOnly, bool IgnoreSelected) const
{
lcVector3 StartEnd[2] =
{
@ -643,7 +643,7 @@ lcObjectSection View::FindObjectUnderPointer(bool PiecesOnly, bool IgnoreSelecte
return ObjectRayTest.ObjectSection;
}
lcArray<lcObject*> View::FindObjectsInBox(float x1, float y1, float x2, float y2) const
lcArray<lcObject*> lcView::FindObjectsInBox(float x1, float y1, float x2, float y2) const
{
float Left, Top, Bottom, Right;
@ -713,7 +713,7 @@ lcArray<lcObject*> View::FindObjectsInBox(float x1, float y1, float x2, float y2
return ObjectBoxTest.Objects;
}
bool View::BeginRenderToImage(int Width, int Height)
bool lcView::BeginRenderToImage(int Width, int Height)
{
GLint MaxTexture;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &MaxTexture);
@ -733,14 +733,14 @@ bool View::BeginRenderToImage(int Width, int Height)
return mRenderFramebuffer.first.IsValid();
}
void View::EndRenderToImage()
void lcView::EndRenderToImage()
{
mRenderImage = QImage();
mContext->DestroyRenderFramebuffer(mRenderFramebuffer);
mContext->ClearFramebuffer();
}
void View::OnDraw()
void lcView::OnDraw()
{
if (!mModel)
return;
@ -891,7 +891,7 @@ void View::OnDraw()
mContext->ClearResources();
}
void View::DrawBackground() const
void lcView::DrawBackground() const
{
const lcPreferences& Preferences = lcGetPreferences();
@ -942,7 +942,7 @@ void View::DrawBackground() const
Context->SetDepthWrite(true);
}
void View::DrawViewport() const
void lcView::DrawViewport() const
{
mContext->SetWorldMatrix(lcMatrix44Identity());
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
@ -983,7 +983,7 @@ void View::DrawViewport() const
glEnable(GL_DEPTH_TEST);
}
void View::DrawAxes() const
void lcView::DrawAxes() const
{
// glClear(GL_DEPTH_BUFFER_BIT);
@ -1051,7 +1051,7 @@ void View::DrawAxes() const
glDisable(GL_BLEND);
}
void View::DrawSelectMoveOverlay()
void lcView::DrawSelectMoveOverlay()
{
mContext->SetMaterial(lcMaterialType::UnlitColor);
mContext->SetViewMatrix(mCamera->mWorldView);
@ -1240,7 +1240,7 @@ void View::DrawSelectMoveOverlay()
glEnable(GL_DEPTH_TEST);
}
void View::DrawRotateOverlay()
void lcView::DrawRotateOverlay()
{
const float OverlayScale = GetOverlayScale();
const float OverlayRotateRadius = 2.0f;
@ -1537,7 +1537,7 @@ void View::DrawRotateOverlay()
glEnable(GL_DEPTH_TEST);
}
void View::DrawSelectZoomRegionOverlay()
void lcView::DrawSelectZoomRegionOverlay()
{
mContext->SetMaterial(lcMaterialType::UnlitColor);
mContext->SetWorldMatrix(lcMatrix44Identity());
@ -1616,7 +1616,7 @@ void View::DrawSelectZoomRegionOverlay()
glEnable(GL_DEPTH_TEST);
}
void View::DrawRotateViewOverlay()
void lcView::DrawRotateViewOverlay()
{
int x, y, w, h;
@ -1682,7 +1682,7 @@ void View::DrawRotateViewOverlay()
glEnable(GL_DEPTH_TEST);
}
void View::DrawGrid()
void lcView::DrawGrid()
{
const lcPreferences& Preferences = lcGetPreferences();
@ -1865,7 +1865,7 @@ void View::DrawGrid()
}
}
lcTrackTool View::GetOverrideTrackTool(Qt::MouseButton Button) const
lcTrackTool lcView::GetOverrideTrackTool(Qt::MouseButton Button) const
{
if (mTrackToolFromOverlay)
return lcTrackTool::None;
@ -1899,7 +1899,7 @@ lcTrackTool View::GetOverrideTrackTool(Qt::MouseButton Button) const
return TrackToolFromTool[static_cast<int>(OverrideTool)];
}
float View::GetOverlayScale() const
float lcView::GetOverlayScale() const
{
lcVector3 OverlayCenter;
lcMatrix33 RelativeRotation;
@ -1914,13 +1914,13 @@ float View::GetOverlayScale() const
return Dist.Length() * 5.0f;
}
void View::BeginDrag(lcDragState DragState)
void lcView::BeginDrag(lcDragState DragState)
{
mDragState = DragState;
UpdateTrackTool();
}
void View::EndDrag(bool Accept)
void lcView::EndDrag(bool Accept)
{
lcModel* ActiveModel = GetActiveModel();
@ -1949,7 +1949,7 @@ void View::EndDrag(bool Accept)
ActiveModel->UpdateAllViews();
}
void View::SetViewpoint(lcViewpoint Viewpoint)
void lcView::SetViewpoint(lcViewpoint Viewpoint)
{
if (!mCamera || !mCamera->IsSimple())
{
@ -1968,7 +1968,7 @@ void View::SetViewpoint(lcViewpoint Viewpoint)
emit CameraChanged();
}
void View::SetViewpoint(const lcVector3& Position)
void lcView::SetViewpoint(const lcVector3& Position)
{
if (!mCamera || !mCamera->IsSimple())
{
@ -1987,7 +1987,7 @@ void View::SetViewpoint(const lcVector3& Position)
emit CameraChanged();
}
void View::SetViewpoint(const lcVector3& Position, const lcVector3& Target, const lcVector3& Up)
void lcView::SetViewpoint(const lcVector3& Position, const lcVector3& Target, const lcVector3& Up)
{
if (!mCamera || !mCamera->IsSimple())
{
@ -2005,7 +2005,7 @@ void View::SetViewpoint(const lcVector3& Position, const lcVector3& Target, cons
emit CameraChanged();
}
void View::SetCameraAngles(float Latitude, float Longitude)
void lcView::SetCameraAngles(float Latitude, float Longitude)
{
if (!mCamera || !mCamera->IsSimple())
{
@ -2022,7 +2022,7 @@ void View::SetCameraAngles(float Latitude, float Longitude)
Redraw();
}
void View::SetDefaultCamera()
void lcView::SetDefaultCamera()
{
if (!mCamera || !mCamera->IsSimple())
mCamera = new lcCamera(true);
@ -2032,7 +2032,7 @@ void View::SetDefaultCamera()
emit CameraChanged();
}
void View::SetCamera(lcCamera* Camera, bool ForceCopy)
void lcView::SetCamera(lcCamera* Camera, bool ForceCopy)
{
if (Camera->IsSimple() || ForceCopy)
{
@ -2050,7 +2050,7 @@ void View::SetCamera(lcCamera* Camera, bool ForceCopy)
}
}
void View::SetCamera(const QString& CameraName)
void lcView::SetCamera(const QString& CameraName)
{
const lcArray<lcCamera*>& Cameras = mModel->GetCameras();
@ -2064,7 +2064,7 @@ void View::SetCamera(const QString& CameraName)
}
}
void View::SetCameraIndex(int Index)
void lcView::SetCameraIndex(int Index)
{
const lcArray<lcCamera*>& Cameras = mModel->GetCameras();
@ -2078,7 +2078,7 @@ void View::SetCameraIndex(int Index)
Redraw();
}
void View::SetProjection(bool Ortho)
void lcView::SetProjection(bool Ortho)
{
if (mCamera->IsSimple())
{
@ -2095,35 +2095,35 @@ void View::SetProjection(bool Ortho)
}
}
void View::LookAt()
void lcView::LookAt()
{
lcModel* ActiveModel = GetActiveModel();
if (ActiveModel)
ActiveModel->LookAt(mCamera);
}
void View::MoveCamera(const lcVector3& Direction)
void lcView::MoveCamera(const lcVector3& Direction)
{
lcModel* ActiveModel = GetActiveModel();
if (ActiveModel)
ActiveModel->MoveCamera(mCamera, Direction);
}
void View::Zoom(float Amount)
void lcView::Zoom(float Amount)
{
lcModel* ActiveModel = GetActiveModel();
if (ActiveModel)
ActiveModel->Zoom(mCamera, Amount);
}
void View::ZoomExtents()
void lcView::ZoomExtents()
{
lcModel* ActiveModel = GetActiveModel();
if (ActiveModel)
ActiveModel->ZoomExtents(mCamera, (float)mWidth / (float)mHeight);
}
lcCursor View::GetCursor() const
lcCursor lcView::GetCursor() const
{
if (mTrackButton != lcTrackButton::None)
return lcCursor::Hidden;
@ -2179,7 +2179,7 @@ lcCursor View::GetCursor() const
return lcCursor::Select;
}
void View::SetCursor(lcCursor CursorType)
void lcView::SetCursor(lcCursor CursorType)
{
if (mCursor == CursorType)
return;
@ -2235,12 +2235,12 @@ void View::SetCursor(lcCursor CursorType)
}
}
void View::UpdateCursor()
void lcView::UpdateCursor()
{
SetCursor(GetCursor());
}
lcTool View::GetCurrentTool() const
lcTool lcView::GetCurrentTool() const
{
constexpr lcTool ToolFromTrackTool[] =
{
@ -2284,7 +2284,7 @@ lcTool View::GetCurrentTool() const
return lcTool::Select;
}
void View::UpdateTrackTool()
void lcView::UpdateTrackTool()
{
if (mViewType != lcViewType::View)
{
@ -2744,7 +2744,7 @@ void View::UpdateTrackTool()
ActiveModel->UpdateAllViews();
}
bool View::IsTrackToolAllowed(lcTrackTool TrackTool, quint32 AllowedTransforms) const
bool lcView::IsTrackToolAllowed(lcTrackTool TrackTool, quint32 AllowedTransforms) const
{
switch (TrackTool)
{
@ -2815,7 +2815,7 @@ bool View::IsTrackToolAllowed(lcTrackTool TrackTool, quint32 AllowedTransforms)
return false;
}
void View::StartOrbitTracking()
void lcView::StartOrbitTracking()
{
mTrackTool = lcTrackTool::OrbitXY;
UpdateCursor();
@ -2823,7 +2823,7 @@ void View::StartOrbitTracking()
}
void View::StartTracking(lcTrackButton TrackButton)
void lcView::StartTracking(lcTrackButton TrackButton)
{
mTrackButton = TrackButton;
mTrackUpdated = false;
@ -2884,7 +2884,7 @@ void View::StartTracking(lcTrackButton TrackButton)
UpdateCursor();
}
void View::StopTracking(bool Accept)
void lcView::StopTracking(bool Accept)
{
if (mTrackButton == lcTrackButton::None)
return;
@ -2974,7 +2974,7 @@ void View::StopTracking(bool Accept)
ActiveModel->UpdateAllViews();
}
void View::CancelTrackingOrClearSelection()
void lcView::CancelTrackingOrClearSelection()
{
if (mTrackButton != lcTrackButton::None)
StopTracking(false);
@ -2986,7 +2986,7 @@ void View::CancelTrackingOrClearSelection()
}
}
void View::OnButtonDown(lcTrackButton TrackButton)
void lcView::OnButtonDown(lcTrackButton TrackButton)
{
lcModel* ActiveModel = GetActiveModel();
@ -3095,7 +3095,7 @@ void View::OnButtonDown(lcTrackButton TrackButton)
}
}
void View::OnLeftButtonDown()
void lcView::OnLeftButtonDown()
{
if (mTrackButton != lcTrackButton::None)
{
@ -3117,7 +3117,7 @@ void View::OnLeftButtonDown()
OnButtonDown(lcTrackButton::Left);
}
void View::OnLeftButtonUp()
void lcView::OnLeftButtonUp()
{
StopTracking(mTrackButton == lcTrackButton::Left);
@ -3125,7 +3125,7 @@ void View::OnLeftButtonUp()
return;
}
void View::OnLeftButtonDoubleClick()
void lcView::OnLeftButtonDoubleClick()
{
lcObjectSection ObjectSection = FindObjectUnderPointer(false, false);
lcModel* ActiveModel = GetActiveModel();
@ -3138,7 +3138,7 @@ void View::OnLeftButtonDoubleClick()
ActiveModel->ClearSelectionAndSetFocus(ObjectSection, true);
}
void View::OnMiddleButtonDown()
void lcView::OnMiddleButtonDown()
{
if (mTrackButton != lcTrackButton::None)
{
@ -3158,12 +3158,12 @@ void View::OnMiddleButtonDown()
OnButtonDown(lcTrackButton::Middle);
}
void View::OnMiddleButtonUp()
void lcView::OnMiddleButtonUp()
{
StopTracking(mTrackButton == lcTrackButton::Middle);
}
void View::OnRightButtonDown()
void lcView::OnRightButtonDown()
{
if (mTrackButton != lcTrackButton::None)
{
@ -3182,7 +3182,7 @@ void View::OnRightButtonDown()
OnButtonDown(lcTrackButton::Right);
}
void View::OnRightButtonUp()
void lcView::OnRightButtonUp()
{
bool ShowMenu = mTrackButton == lcTrackButton::None || !mTrackUpdated;
@ -3193,25 +3193,25 @@ void View::OnRightButtonUp()
ShowContextMenu();
}
void View::OnBackButtonDown()
void lcView::OnBackButtonDown()
{
}
void View::OnBackButtonUp()
void lcView::OnBackButtonUp()
{
gMainWindow->HandleCommand(LC_VIEW_TIME_PREVIOUS);
}
void View::OnForwardButtonDown()
void lcView::OnForwardButtonDown()
{
}
void View::OnForwardButtonUp()
void lcView::OnForwardButtonUp()
{
gMainWindow->HandleCommand(LC_VIEW_TIME_NEXT);
}
void View::OnMouseMove()
void lcView::OnMouseMove()
{
lcModel* ActiveModel = GetActiveModel();
@ -3549,7 +3549,7 @@ void View::OnMouseMove()
}
}
void View::OnMouseWheel(float Direction)
void lcView::OnMouseWheel(float Direction)
{
mModel->Zoom(mCamera, (int)(((mMouseModifiers & Qt::ControlModifier) ? 100 : 10) * Direction));
}

View file

@ -89,16 +89,16 @@ enum class lcViewType
Count
};
class View : public QObject
class lcView : public QObject
{
Q_OBJECT
public:
View(lcViewType ViewType, lcModel* Model);
~View();
lcView(lcViewType ViewType, lcModel* Model);
~lcView();
View(const View&) = delete;
View& operator=(const View&) = delete;
lcView(const lcView&) = delete;
lcView& operator=(const lcView&) = delete;
void Clear()
{
@ -311,8 +311,8 @@ protected:
lcVertexBuffer mGridBuffer;
int mGridSettings[7];
static View* mLastFocusedView;
static std::vector<View*> mViews;
static lcView* mLastFocusedView;
static std::vector<lcView*> mViews;
static lcVertexBuffer mRotateMoveVertexBuffer;
static lcIndexBuffer mRotateMoveIndexBuffer;

View file

@ -15,7 +15,7 @@ const float lcViewSphere::mRadius = 1.0f;
const float lcViewSphere::mHighlightRadius = 0.35f;
const int lcViewSphere::mSubdivisions = 7;
lcViewSphere::lcViewSphere(View* View)
lcViewSphere::lcViewSphere(lcView* View)
: mView(View)
{
UpdateSettings();

View file

@ -4,8 +4,6 @@
#include "lc_context.h"
#include <bitset>
class View;
enum class lcViewSphereLocation
{
TopLeft,
@ -17,7 +15,7 @@ enum class lcViewSphereLocation
class lcViewSphere
{
public:
lcViewSphere(View* View);
lcViewSphere(lcView* View);
void Draw();
bool OnMouseMove();
@ -34,7 +32,7 @@ protected:
lcMatrix44 GetProjectionMatrix() const;
std::bitset<6> GetIntersectionFlags(lcVector3& Intersection) const;
View* const mView = nullptr;
lcView* const mView = nullptr;
int mSize = 1;
bool mEnabled = false;

View file

@ -18,7 +18,7 @@
static QList<lcViewWidget*> gWidgetList;
lcViewWidget::lcViewWidget(QWidget* Parent, View* View)
lcViewWidget::lcViewWidget(QWidget* Parent, lcView* View)
: QGLWidget(Parent, gWidgetList.isEmpty() ? nullptr : gWidgetList.first())
{
mWheelAccumulator = 0;
@ -35,7 +35,7 @@ lcViewWidget::lcViewWidget(QWidget* Parent, View* View)
lcInitializeGLExtensions(context());
lcContext::CreateResources();
View::CreateResources(mView->mContext);
lcView::CreateResources(mView->mContext);
lcViewSphere::CreateResources(mView->mContext);
if (!gSupportsShaderObjects && lcGetPreferences().mShadingMode == lcShadingMode::DefaultLights)
@ -69,7 +69,7 @@ lcViewWidget::~lcViewWidget()
gTexFont.Reset();
lcGetPiecesLibrary()->ReleaseBuffers(mView->mContext);
View::DestroyResources(mView->mContext);
lcView::DestroyResources(mView->mContext);
lcContext::DestroyResources();
lcViewSphere::DestroyResources(mView->mContext);
@ -85,7 +85,7 @@ QSize lcViewWidget::sizeHint() const
return mPreferredSize.isEmpty() ? QGLWidget::sizeHint() : mPreferredSize;
}
void lcViewWidget::SetView(View* View)
void lcViewWidget::SetView(lcView* View)
{
mView = View;

View file

@ -1,19 +1,17 @@
#pragma once
class View;
class lcViewWidget : public QGLWidget
{
public:
lcViewWidget(QWidget* Parent, View* View);
lcViewWidget(QWidget* Parent, lcView* View);
~lcViewWidget();
View* GetView() const
lcView* GetView() const
{
return mView;
}
void SetView(View* View);
void SetView(lcView* View);
void SetPreviewPosition(const QRect& ParentRect);
QSize sizeHint() const override;
@ -44,7 +42,7 @@ protected:
void dragMoveEvent(QDragMoveEvent* DragMoveEvent) override;
void dropEvent(QDropEvent* DropEvent) override;
View* mView;
lcView* mView;
QSize mPreferredSize;
int mWheelAccumulator;
};