mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +01:00
Inlined lcInputState.
This commit is contained in:
parent
525df8ad21
commit
a9fac6110b
10 changed files with 189 additions and 179 deletions
|
@ -16,6 +16,17 @@ lcGLWidget::~lcGLWidget()
|
||||||
delete mContext;
|
delete mContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lcGLWidget::SetMousePosition(int MouseX, int MouseY)
|
||||||
|
{
|
||||||
|
mMouseX = MouseX;
|
||||||
|
mMouseY = MouseY;
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcGLWidget::SetMouseModifiers(Qt::KeyboardModifiers MouseModifiers)
|
||||||
|
{
|
||||||
|
mMouseModifiers = MouseModifiers;
|
||||||
|
}
|
||||||
|
|
||||||
void lcGLWidget::SetContext(lcContext* Context)
|
void lcGLWidget::SetContext(lcContext* Context)
|
||||||
{
|
{
|
||||||
if (mDeleteContext)
|
if (mDeleteContext)
|
||||||
|
@ -72,17 +83,17 @@ void lcGLWidget::SetCursor(lcCursor CursorType)
|
||||||
|
|
||||||
static_assert(LC_ARRAY_COUNT(Cursors) == static_cast<int>(lcCursor::Count), "Array size mismatch");
|
static_assert(LC_ARRAY_COUNT(Cursors) == static_cast<int>(lcCursor::Count), "Array size mismatch");
|
||||||
|
|
||||||
QGLWidget* widget = (QGLWidget*)mWidget;
|
QGLWidget* mWidget = (QGLWidget*)mWidget;
|
||||||
|
|
||||||
if (CursorType > lcCursor::Default && CursorType < lcCursor::Count)
|
if (CursorType > lcCursor::Default && CursorType < lcCursor::Count)
|
||||||
{
|
{
|
||||||
const lcCursorInfo& Cursor = Cursors[static_cast<int>(CursorType)];
|
const lcCursorInfo& Cursor = Cursors[static_cast<int>(CursorType)];
|
||||||
widget->setCursor(QCursor(QPixmap(Cursor.Name), Cursor.x, Cursor.y));
|
mWidget->setCursor(QCursor(QPixmap(Cursor.Name), Cursor.x, Cursor.y));
|
||||||
mCursor = CursorType;
|
mCursor = CursorType;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
widget->unsetCursor();
|
mWidget->unsetCursor();
|
||||||
mCursor = lcCursor::Default;
|
mCursor = lcCursor::Default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,13 +40,6 @@ enum class lcTrackButton
|
||||||
Right
|
Right
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lcInputState
|
|
||||||
{
|
|
||||||
int x = 0;
|
|
||||||
int y = 0;
|
|
||||||
Qt::KeyboardModifiers Modifiers = Qt::NoModifier;
|
|
||||||
};
|
|
||||||
|
|
||||||
class lcGLWidget
|
class lcGLWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -66,6 +59,18 @@ public:
|
||||||
return mTrackButton != lcTrackButton::None;
|
return mTrackButton != lcTrackButton::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetMouseX() const
|
||||||
|
{
|
||||||
|
return mMouseX;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetMouseY() const
|
||||||
|
{
|
||||||
|
return mMouseY;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetMousePosition(int MouseX, int MouseY);
|
||||||
|
void SetMouseModifiers(Qt::KeyboardModifiers MouseModifiers);
|
||||||
void SetContext(lcContext* Context);
|
void SetContext(lcContext* Context);
|
||||||
void MakeCurrent();
|
void MakeCurrent();
|
||||||
void Redraw();
|
void Redraw();
|
||||||
|
@ -98,15 +103,19 @@ public:
|
||||||
virtual void BeginDrag(lcDragState DragState) { Q_UNUSED(DragState); }
|
virtual void BeginDrag(lcDragState DragState) { Q_UNUSED(DragState); }
|
||||||
virtual void EndDrag(bool Accept) { Q_UNUSED(Accept); }
|
virtual void EndDrag(bool Accept) { Q_UNUSED(Accept); }
|
||||||
|
|
||||||
lcInputState mInputState;
|
|
||||||
int mWidth = 1;
|
int mWidth = 1;
|
||||||
int mHeight = 1;
|
int mHeight = 1;
|
||||||
QGLWidget* mWidget = nullptr;
|
QGLWidget* mWidget = nullptr;
|
||||||
lcContext* mContext = nullptr;
|
lcContext* mContext = nullptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
int mMouseX = 0;
|
||||||
|
int mMouseY = 0;
|
||||||
|
Qt::KeyboardModifiers mMouseModifiers = Qt::NoModifier;
|
||||||
|
|
||||||
|
lcTrackButton mTrackButton = lcTrackButton::None;
|
||||||
|
lcCursor mCursor = lcCursor::Default;
|
||||||
|
|
||||||
lcCamera* mCamera = nullptr;
|
lcCamera* mCamera = nullptr;
|
||||||
bool mDeleteContext = true;
|
bool mDeleteContext = true;
|
||||||
lcCursor mCursor = lcCursor::Default;
|
|
||||||
lcTrackButton mTrackButton = lcTrackButton::None;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -72,7 +72,7 @@ void lcModelTabWidget::ResetLayout()
|
||||||
TopWidget->deleteLater();
|
TopWidget->deleteLater();
|
||||||
|
|
||||||
Widget->setFocus();
|
Widget->setFocus();
|
||||||
SetActiveView((View*)((lcQGLWidget*)Widget)->widget);
|
SetActiveView((View*)((lcQGLWidget*)Widget)->mWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcModelTabWidget::Clear()
|
void lcModelTabWidget::Clear()
|
||||||
|
@ -84,8 +84,8 @@ void lcModelTabWidget::Clear()
|
||||||
mViews.RemoveAll();
|
mViews.RemoveAll();
|
||||||
mActiveView = nullptr;
|
mActiveView = nullptr;
|
||||||
lcQGLWidget* Widget = (lcQGLWidget*)layout()->itemAt(0)->widget();
|
lcQGLWidget* Widget = (lcQGLWidget*)layout()->itemAt(0)->widget();
|
||||||
delete Widget->widget;
|
delete Widget->mWidget;
|
||||||
Widget->widget = nullptr;
|
Widget->mWidget = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcMainWindow::lcMainWindow()
|
lcMainWindow::lcMainWindow()
|
||||||
|
@ -1364,7 +1364,7 @@ QByteArray lcMainWindow::GetTabLayout()
|
||||||
{
|
{
|
||||||
if (Widget->metaObject() == &lcQGLWidget::staticMetaObject)
|
if (Widget->metaObject() == &lcQGLWidget::staticMetaObject)
|
||||||
{
|
{
|
||||||
View* CurrentView = (View*)((lcQGLWidget*)Widget)->widget;
|
View* CurrentView = (View*)((lcQGLWidget*)Widget)->mWidget;
|
||||||
|
|
||||||
DataStream << (qint32)0;
|
DataStream << (qint32)0;
|
||||||
DataStream << (qint32)(TabWidget->GetActiveView() == CurrentView ? 1 : 0);
|
DataStream << (qint32)(TabWidget->GetActiveView() == CurrentView ? 1 : 0);
|
||||||
|
@ -1463,7 +1463,7 @@ void lcMainWindow::RestoreTabLayout(const QByteArray& TabLayout)
|
||||||
View* CurrentView = nullptr;
|
View* CurrentView = nullptr;
|
||||||
|
|
||||||
if (ParentWidget)
|
if (ParentWidget)
|
||||||
CurrentView = (View*)((lcQGLWidget*)ParentWidget)->widget;
|
CurrentView = (View*)((lcQGLWidget*)ParentWidget)->mWidget;
|
||||||
|
|
||||||
if (CameraType == 0)
|
if (CameraType == 0)
|
||||||
{
|
{
|
||||||
|
@ -1536,7 +1536,7 @@ void lcMainWindow::RestoreTabLayout(const QByteArray& TabLayout)
|
||||||
|
|
||||||
if (ActiveWidget && TabWidget)
|
if (ActiveWidget && TabWidget)
|
||||||
{
|
{
|
||||||
View* ActiveView = (View*)((lcQGLWidget*)ActiveWidget)->widget;
|
View* ActiveView = (View*)((lcQGLWidget*)ActiveWidget)->mWidget;
|
||||||
TabWidget->SetActiveView(ActiveView);
|
TabWidget->SetActiveView(ActiveView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1613,9 +1613,9 @@ void lcMainWindow::SetCurrentModelTab(lcModel* Model)
|
||||||
|
|
||||||
NewView = new View(Model);
|
NewView = new View(Model);
|
||||||
ViewWidget = (lcQGLWidget*)TabWidget->layout()->itemAt(0)->widget();
|
ViewWidget = (lcQGLWidget*)TabWidget->layout()->itemAt(0)->widget();
|
||||||
ViewWidget->widget = NewView;
|
ViewWidget->mWidget = NewView;
|
||||||
NewView->mWidget = ViewWidget;
|
NewView->mWidget = ViewWidget;
|
||||||
float Scale = ViewWidget->deviceScale();
|
float Scale = ViewWidget->GetDeviceScale();
|
||||||
NewView->mWidth = ViewWidget->width() * Scale;
|
NewView->mWidth = ViewWidget->width() * Scale;
|
||||||
NewView->mHeight = ViewWidget->height() * Scale;
|
NewView->mHeight = ViewWidget->height() * Scale;
|
||||||
AddView(NewView);
|
AddView(NewView);
|
||||||
|
@ -1904,7 +1904,7 @@ void lcMainWindow::RemoveActiveView()
|
||||||
}
|
}
|
||||||
|
|
||||||
OtherWidget->setFocus();
|
OtherWidget->setFocus();
|
||||||
SetActiveView((View*)((lcQGLWidget*)OtherWidget)->widget);
|
SetActiveView((View*)((lcQGLWidget*)OtherWidget)->mWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcMainWindow::ResetViews()
|
void lcMainWindow::ResetViews()
|
||||||
|
|
|
@ -290,8 +290,8 @@ void lcPreviewWidget::StartTracking(lcTrackButton TrackButton)
|
||||||
{
|
{
|
||||||
mTrackButton = TrackButton;
|
mTrackButton = TrackButton;
|
||||||
mTrackUpdated = false;
|
mTrackUpdated = false;
|
||||||
mMouseDownX = mInputState.x;
|
mMouseDownX = mMouseX;
|
||||||
mMouseDownY = mInputState.y;
|
mMouseDownY = mMouseY;
|
||||||
lcTool Tool = GetCurrentTool(); // Either lcTrackTool::None (LC_TOOL_SELECT) or lcTrackTool::OrbitXY (LC_TOOL_ROTATE_VIEW)
|
lcTool Tool = GetCurrentTool(); // Either lcTrackTool::None (LC_TOOL_SELECT) or lcTrackTool::OrbitXY (LC_TOOL_ROTATE_VIEW)
|
||||||
lcModel* ActiveModel = GetActiveModel();
|
lcModel* ActiveModel = GetActiveModel();
|
||||||
|
|
||||||
|
@ -563,8 +563,8 @@ void lcPreviewWidget::OnMouseMove()
|
||||||
{
|
{
|
||||||
lcVector3 Points[4] =
|
lcVector3 Points[4] =
|
||||||
{
|
{
|
||||||
lcVector3((float)mInputState.x, (float)mInputState.y, 0.0f),
|
lcVector3((float)mMouseX, (float)mMouseY, 0.0f),
|
||||||
lcVector3((float)mInputState.x, (float)mInputState.y, 1.0f),
|
lcVector3((float)mMouseX, (float)mMouseY, 1.0f),
|
||||||
lcVector3(mMouseDownX, mMouseDownY, 0.0f),
|
lcVector3(mMouseDownX, mMouseDownY, 0.0f),
|
||||||
lcVector3(mMouseDownX, mMouseDownY, 1.0f)
|
lcVector3(mMouseDownX, mMouseDownY, 1.0f)
|
||||||
};
|
};
|
||||||
|
@ -596,7 +596,7 @@ void lcPreviewWidget::OnMouseMove()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lcTrackTool::OrbitXY:
|
case lcTrackTool::OrbitXY:
|
||||||
ActiveModel->UpdateOrbitTool(mCamera, 0.1f * MouseSensitivity * (mInputState.x - mMouseDownX), 0.1f * MouseSensitivity * (mInputState.y - mMouseDownY));
|
ActiveModel->UpdateOrbitTool(mCamera, 0.1f * MouseSensitivity * (mMouseX - mMouseDownX), 0.1f * MouseSensitivity * (mMouseY - mMouseDownY));
|
||||||
Redraw();
|
Redraw();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -607,6 +607,6 @@ void lcPreviewWidget::OnMouseMove()
|
||||||
|
|
||||||
void lcPreviewWidget::OnMouseWheel(float Direction)
|
void lcPreviewWidget::OnMouseWheel(float Direction)
|
||||||
{
|
{
|
||||||
mModel->Zoom(mCamera, (int)(((mInputState.Modifiers & Qt::ControlModifier) ? 100 : 10) * Direction));
|
mModel->Zoom(mCamera, (int)(((mMouseModifiers & Qt::ControlModifier) ? 100 : 10) * Direction));
|
||||||
Redraw();
|
Redraw();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,25 +17,19 @@ const float lcViewSphere::mHighlightRadius = 0.35f;
|
||||||
const int lcViewSphere::mSubdivisions = 7;
|
const int lcViewSphere::mSubdivisions = 7;
|
||||||
|
|
||||||
lcViewSphere::lcViewSphere(View* View)
|
lcViewSphere::lcViewSphere(View* View)
|
||||||
: mPreview(nullptr),
|
: mWidget(View), mPreview(nullptr), mView(View), mIsPreview(false)
|
||||||
mView(View),
|
|
||||||
mIsPreview(false)
|
|
||||||
{
|
{
|
||||||
mMouseDown = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lcViewSphere::lcViewSphere(lcPreviewWidget* Preview)
|
lcViewSphere::lcViewSphere(lcPreviewWidget* Preview)
|
||||||
: mPreview(Preview),
|
: mWidget(Preview), mPreview(Preview), mView(nullptr), mIsPreview(true)
|
||||||
mView(nullptr),
|
|
||||||
mIsPreview(true)
|
|
||||||
{
|
{
|
||||||
mMouseDown = false;
|
|
||||||
mViewSphereSize = lcGetPreferences().mPreviewViewSphereSize;
|
mViewSphereSize = lcGetPreferences().mPreviewViewSphereSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcMatrix44 lcViewSphere::GetViewMatrix() const
|
lcMatrix44 lcViewSphere::GetViewMatrix() const
|
||||||
{
|
{
|
||||||
lcMatrix44 ViewMatrix = mIsPreview ? mPreview->GetCamera()->mWorldView : mView->GetCamera()->mWorldView;
|
lcMatrix44 ViewMatrix = mWidget->GetCamera()->mWorldView;
|
||||||
ViewMatrix.SetTranslation(lcVector3(0, 0, 0));
|
ViewMatrix.SetTranslation(lcVector3(0, 0, 0));
|
||||||
return ViewMatrix;
|
return ViewMatrix;
|
||||||
}
|
}
|
||||||
|
@ -170,9 +164,9 @@ void lcViewSphere::Draw()
|
||||||
if (ViewportSize == 0 || !Preferences.mViewSphereEnabled)
|
if (ViewportSize == 0 || !Preferences.mViewSphereEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lcContext* Context = mIsPreview ? mPreview->mContext : mView->mContext;
|
lcContext* Context = mWidget->mContext;
|
||||||
int Width = mIsPreview ? mPreview->mWidth : mView->mWidth;
|
int Width = mWidget->mWidth;
|
||||||
int Height = mIsPreview ? mPreview->mHeight : mView->mHeight;
|
int Height = mWidget->mHeight;
|
||||||
lcViewSphereLocation Location = mIsPreview ? Preferences.mPreviewViewSphereLocation : Preferences.mViewSphereLocation;
|
lcViewSphereLocation Location = mIsPreview ? Preferences.mPreviewViewSphereLocation : Preferences.mViewSphereLocation;
|
||||||
|
|
||||||
int Left = (Location == lcViewSphereLocation::BottomLeft || Location == lcViewSphereLocation::TopLeft) ? 0 : Width - ViewportSize;
|
int Left = (Location == lcViewSphereLocation::BottomLeft || Location == lcViewSphereLocation::TopLeft) ? 0 : Width - ViewportSize;
|
||||||
|
@ -242,8 +236,8 @@ bool lcViewSphere::OnLeftButtonDown()
|
||||||
if (!mIntersectionFlags.any())
|
if (!mIntersectionFlags.any())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mMouseDownX = mIsPreview ? mPreview->mInputState.x : mView->mInputState.x;
|
mMouseDownX = mWidget->GetMouseX();
|
||||||
mMouseDownY = mIsPreview ? mPreview->mInputState.y : mView->mInputState.y;
|
mMouseDownY = mWidget->GetMouseY();
|
||||||
mMouseDown = true;
|
mMouseDown = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -291,7 +285,7 @@ bool lcViewSphere::OnMouseMove()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIsPreview ? mPreview->IsTracking() : mView->IsTracking())
|
if (mWidget->IsTracking())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::bitset<6> IntersectionFlags = GetIntersectionFlags(mIntersection);
|
std::bitset<6> IntersectionFlags = GetIntersectionFlags(mIntersection);
|
||||||
|
@ -299,7 +293,7 @@ bool lcViewSphere::OnMouseMove()
|
||||||
if (IntersectionFlags != mIntersectionFlags)
|
if (IntersectionFlags != mIntersectionFlags)
|
||||||
{
|
{
|
||||||
mIntersectionFlags = IntersectionFlags;
|
mIntersectionFlags = IntersectionFlags;
|
||||||
mIsPreview ? mPreview->Redraw() : mView->Redraw();
|
mWidget->Redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
return mIntersectionFlags.any();
|
return mIntersectionFlags.any();
|
||||||
|
@ -307,8 +301,8 @@ bool lcViewSphere::OnMouseMove()
|
||||||
|
|
||||||
bool lcViewSphere::IsDragging() const
|
bool lcViewSphere::IsDragging() const
|
||||||
{
|
{
|
||||||
int InputStateX = mIsPreview ? mPreview->mInputState.x : mView->mInputState.x;
|
int InputStateX = mWidget->GetMouseX();
|
||||||
int InputStateY = mIsPreview ? mPreview->mInputState.y : mView->mInputState.y;
|
int InputStateY = mWidget->GetMouseY();
|
||||||
return mMouseDown && (qAbs(mMouseDownX - InputStateX) > 3 || qAbs(mMouseDownY - InputStateY) > 3);
|
return mMouseDown && (qAbs(mMouseDownX - InputStateX) > 3 || qAbs(mMouseDownY - InputStateY) > 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,13 +311,13 @@ std::bitset<6> lcViewSphere::GetIntersectionFlags(lcVector3& Intersection) const
|
||||||
const lcPreferences& Preferences = lcGetPreferences();
|
const lcPreferences& Preferences = lcGetPreferences();
|
||||||
lcViewSphereLocation Location = mIsPreview ? Preferences.mPreviewViewSphereLocation : Preferences.mViewSphereLocation;
|
lcViewSphereLocation Location = mIsPreview ? Preferences.mPreviewViewSphereLocation : Preferences.mViewSphereLocation;
|
||||||
|
|
||||||
int Width = mIsPreview ? mPreview->mWidth : mView->mWidth;
|
int Width = mWidget->mWidth;
|
||||||
int Height = mIsPreview ? mPreview->mHeight : mView->mHeight;
|
int Height = mWidget->mHeight;
|
||||||
int ViewportSize = mIsPreview ? mViewSphereSize : Preferences.mViewSphereSize;
|
int ViewportSize = mIsPreview ? mViewSphereSize : Preferences.mViewSphereSize;
|
||||||
int Left = (Location == lcViewSphereLocation::BottomLeft || Location == lcViewSphereLocation::TopLeft) ? 0 : Width - ViewportSize;
|
int Left = (Location == lcViewSphereLocation::BottomLeft || Location == lcViewSphereLocation::TopLeft) ? 0 : Width - ViewportSize;
|
||||||
int Bottom = (Location == lcViewSphereLocation::BottomLeft || Location == lcViewSphereLocation::BottomRight) ? 0 : Height - ViewportSize;
|
int Bottom = (Location == lcViewSphereLocation::BottomLeft || Location == lcViewSphereLocation::BottomRight) ? 0 : Height - ViewportSize;
|
||||||
int x = (mIsPreview ? mPreview->mInputState.x : mView->mInputState.x) - Left;
|
int x = mWidget->GetMouseX() - Left;
|
||||||
int y = (mIsPreview ? mPreview->mInputState.y : mView->mInputState.y) - Bottom;
|
int y = mWidget->GetMouseY() - Bottom;
|
||||||
std::bitset<6> IntersectionFlags;
|
std::bitset<6> IntersectionFlags;
|
||||||
|
|
||||||
if (x < 0 || x > Width || y < 0 || y > Height)
|
if (x < 0 || x > Width || y < 0 || y > Height)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "lc_context.h"
|
#include "lc_context.h"
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|
||||||
|
class lcGLWidget;
|
||||||
class View;
|
class View;
|
||||||
class lcPreviewWidget;
|
class lcPreviewWidget;
|
||||||
|
|
||||||
|
@ -27,15 +28,16 @@ protected:
|
||||||
lcMatrix44 GetProjectionMatrix() const;
|
lcMatrix44 GetProjectionMatrix() const;
|
||||||
std::bitset<6> GetIntersectionFlags(lcVector3& Intersection) const;
|
std::bitset<6> GetIntersectionFlags(lcVector3& Intersection) const;
|
||||||
|
|
||||||
lcPreviewWidget* mPreview;
|
lcGLWidget* mWidget = nullptr;
|
||||||
View* mView;
|
lcPreviewWidget* mPreview = nullptr;
|
||||||
|
View* mView = nullptr;
|
||||||
lcVector3 mIntersection;
|
lcVector3 mIntersection;
|
||||||
std::bitset<6> mIntersectionFlags;
|
std::bitset<6> mIntersectionFlags;
|
||||||
int mViewSphereSize;
|
int mViewSphereSize = 1;
|
||||||
int mMouseDownX;
|
int mMouseDownX = 0;
|
||||||
int mMouseDownY;
|
int mMouseDownY = 0;
|
||||||
bool mMouseDown;
|
bool mMouseDown = false;
|
||||||
bool mIsPreview;
|
bool mIsPreview = false;
|
||||||
|
|
||||||
static lcTexture* mTexture;
|
static lcTexture* mTexture;
|
||||||
static lcVertexBuffer mVertexBuffer;
|
static lcVertexBuffer mVertexBuffer;
|
||||||
|
|
|
@ -402,8 +402,8 @@ void MinifigWizard::OnLeftButtonDown()
|
||||||
{
|
{
|
||||||
if (mTracking == LC_TRACK_NONE)
|
if (mTracking == LC_TRACK_NONE)
|
||||||
{
|
{
|
||||||
mDownX = mInputState.x;
|
mDownX = mMouseX;
|
||||||
mDownY = mInputState.y;
|
mDownY = mMouseY;
|
||||||
mTracking = LC_TRACK_LEFT;
|
mTracking = LC_TRACK_LEFT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -424,8 +424,8 @@ void MinifigWizard::OnRightButtonDown()
|
||||||
{
|
{
|
||||||
if (mTracking == LC_TRACK_NONE)
|
if (mTracking == LC_TRACK_NONE)
|
||||||
{
|
{
|
||||||
mDownX = mInputState.x;
|
mDownX = mMouseX;
|
||||||
mDownY = mInputState.y;
|
mDownY = mMouseY;
|
||||||
mTracking = LC_TRACK_RIGHT;
|
mTracking = LC_TRACK_RIGHT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -441,30 +441,30 @@ void MinifigWizard::OnMouseMove()
|
||||||
if (mTracking == LC_TRACK_LEFT)
|
if (mTracking == LC_TRACK_LEFT)
|
||||||
{
|
{
|
||||||
// Rotate.
|
// Rotate.
|
||||||
mRotateZ += mInputState.x - mDownX;
|
mRotateZ += mMouseX - mDownX;
|
||||||
mRotateX += mInputState.y - mDownY;
|
mRotateX += mMouseY - mDownY;
|
||||||
|
|
||||||
if (mRotateX > 179.5f)
|
if (mRotateX > 179.5f)
|
||||||
mRotateX = 179.5f;
|
mRotateX = 179.5f;
|
||||||
else if (mRotateX < 0.5f)
|
else if (mRotateX < 0.5f)
|
||||||
mRotateX = 0.5f;
|
mRotateX = 0.5f;
|
||||||
|
|
||||||
mDownX = mInputState.x;
|
mDownX = mMouseX;
|
||||||
mDownY = mInputState.y;
|
mDownY = mMouseY;
|
||||||
|
|
||||||
Redraw();
|
Redraw();
|
||||||
}
|
}
|
||||||
else if (mTracking == LC_TRACK_RIGHT)
|
else if (mTracking == LC_TRACK_RIGHT)
|
||||||
{
|
{
|
||||||
// Zoom.
|
// Zoom.
|
||||||
mDistance += (float)(mDownY - mInputState.y) * 0.2f;
|
mDistance += (float)(mDownY - mMouseY) * 0.2f;
|
||||||
mAutoZoom = false;
|
mAutoZoom = false;
|
||||||
|
|
||||||
if (mDistance < 0.5f)
|
if (mDistance < 0.5f)
|
||||||
mDistance = 0.5f;
|
mDistance = 0.5f;
|
||||||
|
|
||||||
mDownX = mInputState.x;
|
mDownX = mMouseX;
|
||||||
mDownY = mInputState.y;
|
mDownY = mMouseY;
|
||||||
|
|
||||||
Redraw();
|
Redraw();
|
||||||
}
|
}
|
||||||
|
|
|
@ -432,10 +432,10 @@ lcCursor View::GetCursor() const
|
||||||
{
|
{
|
||||||
if (mTrackTool == lcTrackTool::Select)
|
if (mTrackTool == lcTrackTool::Select)
|
||||||
{
|
{
|
||||||
if (mInputState.Modifiers & Qt::ControlModifier)
|
if (mMouseModifiers & Qt::ControlModifier)
|
||||||
return lcCursor::SelectAdd;
|
return lcCursor::SelectAdd;
|
||||||
|
|
||||||
if (mInputState.Modifiers & Qt::ShiftModifier)
|
if (mMouseModifiers & Qt::ShiftModifier)
|
||||||
return lcCursor::SelectRemove;
|
return lcCursor::SelectRemove;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,7 +593,7 @@ lcMatrix44 View::GetPieceInsertPosition(bool IgnoreSelected, PieceInfo* Info) co
|
||||||
return WorldMatrix;
|
return WorldMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<lcVector3, 2> ClickPoints = {{ lcVector3((float)mInputState.x, (float)mInputState.y, 0.0f), lcVector3((float)mInputState.x, (float)mInputState.y, 1.0f) }};
|
std::array<lcVector3, 2> ClickPoints = {{ lcVector3((float)mMouseX, (float)mMouseY, 0.0f), lcVector3((float)mMouseX, (float)mMouseY, 1.0f) }};
|
||||||
UnprojectPoints(ClickPoints.data(), 2);
|
UnprojectPoints(ClickPoints.data(), 2);
|
||||||
|
|
||||||
if (ActiveModel != mModel)
|
if (ActiveModel != mModel)
|
||||||
|
@ -613,14 +613,14 @@ lcMatrix44 View::GetPieceInsertPosition(bool IgnoreSelected, PieceInfo* Info) co
|
||||||
return lcMatrix44Translation(Intersection);
|
return lcMatrix44Translation(Intersection);
|
||||||
}
|
}
|
||||||
|
|
||||||
return lcMatrix44Translation(UnprojectPoint(lcVector3((float)mInputState.x, (float)mInputState.y, 0.9f)));
|
return lcMatrix44Translation(UnprojectPoint(lcVector3((float)mMouseX, (float)mMouseY, 0.9f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
lcVector3 View::GetCameraLightInsertPosition() const
|
lcVector3 View::GetCameraLightInsertPosition() const
|
||||||
{
|
{
|
||||||
lcModel* ActiveModel = GetActiveModel();
|
lcModel* ActiveModel = GetActiveModel();
|
||||||
|
|
||||||
std::array<lcVector3, 2> ClickPoints = { { lcVector3((float)mInputState.x, (float)mInputState.y, 0.0f), lcVector3((float)mInputState.x, (float)mInputState.y, 1.0f) } };
|
std::array<lcVector3, 2> ClickPoints = { { lcVector3((float)mMouseX, (float)mMouseY, 0.0f), lcVector3((float)mMouseX, (float)mMouseY, 1.0f) } };
|
||||||
UnprojectPoints(ClickPoints.data(), 2);
|
UnprojectPoints(ClickPoints.data(), 2);
|
||||||
|
|
||||||
if (ActiveModel != mModel)
|
if (ActiveModel != mModel)
|
||||||
|
@ -646,8 +646,8 @@ void View::GetRayUnderPointer(lcVector3& Start, lcVector3& End) const
|
||||||
{
|
{
|
||||||
lcVector3 StartEnd[2] =
|
lcVector3 StartEnd[2] =
|
||||||
{
|
{
|
||||||
lcVector3((float)mInputState.x, (float)mInputState.y, 0.0f),
|
lcVector3((float)mMouseX, (float)mMouseY, 0.0f),
|
||||||
lcVector3((float)mInputState.x, (float)mInputState.y, 1.0f)
|
lcVector3((float)mMouseX, (float)mMouseY, 1.0f)
|
||||||
};
|
};
|
||||||
|
|
||||||
UnprojectPoints(StartEnd, 2);
|
UnprojectPoints(StartEnd, 2);
|
||||||
|
@ -660,8 +660,8 @@ lcObjectSection View::FindObjectUnderPointer(bool PiecesOnly, bool IgnoreSelecte
|
||||||
{
|
{
|
||||||
lcVector3 StartEnd[2] =
|
lcVector3 StartEnd[2] =
|
||||||
{
|
{
|
||||||
lcVector3((float)mInputState.x, (float)mInputState.y, 0.0f),
|
lcVector3((float)mMouseX, (float)mMouseY, 0.0f),
|
||||||
lcVector3((float)mInputState.x, (float)mInputState.y, 1.0f)
|
lcVector3((float)mMouseX, (float)mMouseY, 1.0f)
|
||||||
};
|
};
|
||||||
|
|
||||||
UnprojectPoints(StartEnd, 2);
|
UnprojectPoints(StartEnd, 2);
|
||||||
|
@ -1435,8 +1435,8 @@ void View::DrawSelectZoomRegionOverlay()
|
||||||
|
|
||||||
float pt1x = (float)mMouseDownX;
|
float pt1x = (float)mMouseDownX;
|
||||||
float pt1y = (float)mMouseDownY;
|
float pt1y = (float)mMouseDownY;
|
||||||
float pt2x = (float)mInputState.x;
|
float pt2x = (float)mMouseX;
|
||||||
float pt2y = (float)mInputState.y;
|
float pt2y = (float)mMouseY;
|
||||||
|
|
||||||
float Left, Right, Bottom, Top;
|
float Left, Right, Bottom, Top;
|
||||||
|
|
||||||
|
@ -1846,7 +1846,7 @@ lcTrackTool View::GetOverrideTrackTool(Qt::MouseButton Button) const
|
||||||
if (mTrackToolFromOverlay)
|
if (mTrackToolFromOverlay)
|
||||||
return lcTrackTool::None;
|
return lcTrackTool::None;
|
||||||
|
|
||||||
lcTool OverrideTool = gMouseShortcuts.GetTool(Button, mInputState.Modifiers);
|
lcTool OverrideTool = gMouseShortcuts.GetTool(Button, mMouseModifiers);
|
||||||
|
|
||||||
if (OverrideTool == lcTool::Count)
|
if (OverrideTool == lcTool::Count)
|
||||||
return lcTrackTool::None;
|
return lcTrackTool::None;
|
||||||
|
@ -1972,8 +1972,8 @@ void View::UpdateTrackTool()
|
||||||
{
|
{
|
||||||
lcTool CurrentTool = gMainWindow->GetTool();
|
lcTool CurrentTool = gMainWindow->GetTool();
|
||||||
lcTrackTool NewTrackTool = mTrackTool;
|
lcTrackTool NewTrackTool = mTrackTool;
|
||||||
int x = mInputState.x;
|
int x = mMouseX;
|
||||||
int y = mInputState.y;
|
int y = mMouseY;
|
||||||
bool Redraw = false;
|
bool Redraw = false;
|
||||||
mTrackToolFromOverlay = false;
|
mTrackToolFromOverlay = false;
|
||||||
lcModel* ActiveModel = GetActiveModel();
|
lcModel* ActiveModel = GetActiveModel();
|
||||||
|
@ -2161,7 +2161,7 @@ void View::UpdateTrackTool()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurrentTool == lcTool::Select && NewTrackTool == lcTrackTool::Select && mInputState.Modifiers == Qt::NoModifier)
|
if (CurrentTool == lcTool::Select && NewTrackTool == lcTrackTool::Select && mMouseModifiers == Qt::NoModifier)
|
||||||
{
|
{
|
||||||
lcObjectSection ObjectSection = FindObjectUnderPointer(false, false);
|
lcObjectSection ObjectSection = FindObjectUnderPointer(false, false);
|
||||||
lcObject* Object = ObjectSection.Object;
|
lcObject* Object = ObjectSection.Object;
|
||||||
|
@ -2506,8 +2506,8 @@ void View::StartTracking(lcTrackButton TrackButton)
|
||||||
{
|
{
|
||||||
mTrackButton = TrackButton;
|
mTrackButton = TrackButton;
|
||||||
mTrackUpdated = false;
|
mTrackUpdated = false;
|
||||||
mMouseDownX = mInputState.x;
|
mMouseDownX = mMouseX;
|
||||||
mMouseDownY = mInputState.y;
|
mMouseDownY = mMouseY;
|
||||||
lcTool Tool = GetCurrentTool();
|
lcTool Tool = GetCurrentTool();
|
||||||
lcModel* ActiveModel = GetActiveModel();
|
lcModel* ActiveModel = GetActiveModel();
|
||||||
|
|
||||||
|
@ -2583,13 +2583,13 @@ void View::StopTracking(bool Accept)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lcTool::Select:
|
case lcTool::Select:
|
||||||
if (Accept && mMouseDownX != mInputState.x && mMouseDownY != mInputState.y)
|
if (Accept && mMouseDownX != mMouseX && mMouseDownY != mMouseY)
|
||||||
{
|
{
|
||||||
lcArray<lcObject*> Objects = FindObjectsInBox(mMouseDownX, mMouseDownY, mInputState.x, mInputState.y);
|
lcArray<lcObject*> Objects = FindObjectsInBox(mMouseDownX, mMouseDownY, mMouseX, mMouseY);
|
||||||
|
|
||||||
if (mInputState.Modifiers & Qt::ControlModifier)
|
if (mMouseModifiers & Qt::ControlModifier)
|
||||||
ActiveModel->AddToSelection(Objects, true, true);
|
ActiveModel->AddToSelection(Objects, true, true);
|
||||||
else if (mInputState.Modifiers & Qt::ShiftModifier)
|
else if (mMouseModifiers & Qt::ShiftModifier)
|
||||||
ActiveModel->RemoveFromSelection(Objects);
|
ActiveModel->RemoveFromSelection(Objects);
|
||||||
else
|
else
|
||||||
ActiveModel->SetSelectionAndFocus(Objects, nullptr, 0, true);
|
ActiveModel->SetSelectionAndFocus(Objects, nullptr, 0, true);
|
||||||
|
@ -2615,15 +2615,15 @@ void View::StopTracking(bool Accept)
|
||||||
|
|
||||||
case lcTool::ZoomRegion:
|
case lcTool::ZoomRegion:
|
||||||
{
|
{
|
||||||
if (mInputState.x == mMouseDownX || mInputState.y == mMouseDownY)
|
if (mMouseX == mMouseDownX || mMouseY == mMouseDownY)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
lcVector3 Points[6] =
|
lcVector3 Points[6] =
|
||||||
{
|
{
|
||||||
lcVector3((mMouseDownX + lcMin(mInputState.x, mWidth - 1)) / 2, (mMouseDownY + lcMin(mInputState.y, mHeight - 1)) / 2, 0.0f),
|
lcVector3((mMouseDownX + lcMin(mMouseX, mWidth - 1)) / 2, (mMouseDownY + lcMin(mMouseY, mHeight - 1)) / 2, 0.0f),
|
||||||
lcVector3((mMouseDownX + lcMin(mInputState.x, mWidth - 1)) / 2, (mMouseDownY + lcMin(mInputState.y, mHeight - 1)) / 2, 1.0f),
|
lcVector3((mMouseDownX + lcMin(mMouseX, mWidth - 1)) / 2, (mMouseDownY + lcMin(mMouseY, mHeight - 1)) / 2, 1.0f),
|
||||||
lcVector3((float)mInputState.x, (float)mInputState.y, 0.0f),
|
lcVector3((float)mMouseX, (float)mMouseY, 0.0f),
|
||||||
lcVector3((float)mInputState.x, (float)mInputState.y, 1.0f),
|
lcVector3((float)mMouseX, (float)mMouseY, 1.0f),
|
||||||
lcVector3(mMouseDownX, mMouseDownY, 0.0f),
|
lcVector3(mMouseDownX, mMouseDownY, 0.0f),
|
||||||
lcVector3(mMouseDownX, mMouseDownY, 1.0f)
|
lcVector3(mMouseDownX, mMouseDownY, 1.0f)
|
||||||
};
|
};
|
||||||
|
@ -2683,7 +2683,7 @@ void View::OnButtonDown(lcTrackButton TrackButton)
|
||||||
|
|
||||||
ActiveModel->InsertPieceToolClicked(GetPieceInsertPosition(false, gMainWindow->GetCurrentPieceInfo()));
|
ActiveModel->InsertPieceToolClicked(GetPieceInsertPosition(false, gMainWindow->GetCurrentPieceInfo()));
|
||||||
|
|
||||||
if ((mInputState.Modifiers & Qt::ControlModifier) == 0)
|
if ((mMouseModifiers & Qt::ControlModifier) == 0)
|
||||||
gMainWindow->SetTool(lcTool::Select);
|
gMainWindow->SetTool(lcTool::Select);
|
||||||
|
|
||||||
UpdateTrackTool();
|
UpdateTrackTool();
|
||||||
|
@ -2694,7 +2694,7 @@ void View::OnButtonDown(lcTrackButton TrackButton)
|
||||||
{
|
{
|
||||||
ActiveModel->PointLightToolClicked(GetCameraLightInsertPosition());
|
ActiveModel->PointLightToolClicked(GetCameraLightInsertPosition());
|
||||||
|
|
||||||
if ((mInputState.Modifiers & Qt::ControlModifier) == 0)
|
if ((mMouseModifiers & Qt::ControlModifier) == 0)
|
||||||
gMainWindow->SetTool(lcTool::Select);
|
gMainWindow->SetTool(lcTool::Select);
|
||||||
|
|
||||||
UpdateTrackTool();
|
UpdateTrackTool();
|
||||||
|
@ -2710,9 +2710,9 @@ void View::OnButtonDown(lcTrackButton TrackButton)
|
||||||
{
|
{
|
||||||
lcObjectSection ObjectSection = FindObjectUnderPointer(false, false);
|
lcObjectSection ObjectSection = FindObjectUnderPointer(false, false);
|
||||||
|
|
||||||
if (mInputState.Modifiers & Qt::ControlModifier)
|
if (mMouseModifiers & Qt::ControlModifier)
|
||||||
ActiveModel->FocusOrDeselectObject(ObjectSection);
|
ActiveModel->FocusOrDeselectObject(ObjectSection);
|
||||||
else if (mInputState.Modifiers & Qt::ShiftModifier)
|
else if (mMouseModifiers & Qt::ShiftModifier)
|
||||||
ActiveModel->RemoveFromSelection(ObjectSection);
|
ActiveModel->RemoveFromSelection(ObjectSection);
|
||||||
else
|
else
|
||||||
ActiveModel->ClearSelectionAndSetFocus(ObjectSection, true);
|
ActiveModel->ClearSelectionAndSetFocus(ObjectSection, true);
|
||||||
|
@ -2813,9 +2813,9 @@ void View::OnLeftButtonDoubleClick()
|
||||||
lcObjectSection ObjectSection = FindObjectUnderPointer(false, false);
|
lcObjectSection ObjectSection = FindObjectUnderPointer(false, false);
|
||||||
lcModel* ActiveModel = GetActiveModel();
|
lcModel* ActiveModel = GetActiveModel();
|
||||||
|
|
||||||
if (mInputState.Modifiers & Qt::ControlModifier)
|
if (mMouseModifiers & Qt::ControlModifier)
|
||||||
ActiveModel->FocusOrDeselectObject(ObjectSection);
|
ActiveModel->FocusOrDeselectObject(ObjectSection);
|
||||||
else if (mInputState.Modifiers & Qt::ShiftModifier)
|
else if (mMouseModifiers & Qt::ShiftModifier)
|
||||||
ActiveModel->RemoveFromSelection(ObjectSection);
|
ActiveModel->RemoveFromSelection(ObjectSection);
|
||||||
else
|
else
|
||||||
ActiveModel->ClearSelectionAndSetFocus(ObjectSection, true);
|
ActiveModel->ClearSelectionAndSetFocus(ObjectSection, true);
|
||||||
|
@ -2953,8 +2953,8 @@ void View::OnMouseMove()
|
||||||
{
|
{
|
||||||
lcVector3 Points[4] =
|
lcVector3 Points[4] =
|
||||||
{
|
{
|
||||||
lcVector3((float)mInputState.x, (float)mInputState.y, 0.0f),
|
lcVector3((float)mMouseX, (float)mMouseY, 0.0f),
|
||||||
lcVector3((float)mInputState.x, (float)mInputState.y, 1.0f),
|
lcVector3((float)mMouseX, (float)mMouseY, 1.0f),
|
||||||
lcVector3(mMouseDownX, mMouseDownY, 0.0f),
|
lcVector3(mMouseDownX, mMouseDownY, 0.0f),
|
||||||
lcVector3(mMouseDownX, mMouseDownY, 1.0f)
|
lcVector3(mMouseDownX, mMouseDownY, 1.0f)
|
||||||
};
|
};
|
||||||
|
@ -3131,8 +3131,8 @@ void View::OnMouseMove()
|
||||||
MoveY = -Dir1;
|
MoveY = -Dir1;
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveX *= 36.0f * (float)(mInputState.x - mMouseDownX) * MouseSensitivity;
|
MoveX *= 36.0f * (float)(mMouseX - mMouseDownX) * MouseSensitivity;
|
||||||
MoveY *= 36.0f * (float)(mInputState.y - mMouseDownY) * MouseSensitivity;
|
MoveY *= 36.0f * (float)(mMouseY - mMouseDownY) * MouseSensitivity;
|
||||||
|
|
||||||
ActiveModel->UpdateRotateTool(MoveX + MoveY, mTrackButton != lcTrackButton::Left);
|
ActiveModel->UpdateRotateTool(MoveX + MoveY, mTrackButton != lcTrackButton::Left);
|
||||||
}
|
}
|
||||||
|
@ -3144,8 +3144,8 @@ void View::OnMouseMove()
|
||||||
lcVector3 ScreenX = lcCross(ScreenZ, mCamera->mUpVector);
|
lcVector3 ScreenX = lcCross(ScreenZ, mCamera->mUpVector);
|
||||||
lcVector3 ScreenY = mCamera->mUpVector;
|
lcVector3 ScreenY = mCamera->mUpVector;
|
||||||
|
|
||||||
lcVector3 MoveX = 36.0f * (float)(mInputState.x - mMouseDownX) * MouseSensitivity * ScreenX;
|
lcVector3 MoveX = 36.0f * (float)(mMouseX - mMouseDownX) * MouseSensitivity * ScreenX;
|
||||||
lcVector3 MoveY = 36.0f * (float)(mInputState.y - mMouseDownY) * MouseSensitivity * ScreenY;
|
lcVector3 MoveY = 36.0f * (float)(mMouseY - mMouseDownY) * MouseSensitivity * ScreenY;
|
||||||
ActiveModel->UpdateRotateTool(MoveX + MoveY, mTrackButton != lcTrackButton::Left);
|
ActiveModel->UpdateRotateTool(MoveX + MoveY, mTrackButton != lcTrackButton::Left);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3154,7 +3154,7 @@ void View::OnMouseMove()
|
||||||
{
|
{
|
||||||
lcVector3 ScreenZ = lcNormalize(mCamera->mTargetPosition - mCamera->mPosition);
|
lcVector3 ScreenZ = lcNormalize(mCamera->mTargetPosition - mCamera->mPosition);
|
||||||
|
|
||||||
ActiveModel->UpdateRotateTool(36.0f * (float)(mInputState.y - mMouseDownY) * MouseSensitivity * ScreenZ, mTrackButton != lcTrackButton::Left);
|
ActiveModel->UpdateRotateTool(36.0f * (float)(mMouseY - mMouseDownY) * MouseSensitivity * ScreenZ, mTrackButton != lcTrackButton::Left);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3164,15 +3164,15 @@ void View::OnMouseMove()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lcTrackTool::Zoom:
|
case lcTrackTool::Zoom:
|
||||||
ActiveModel->UpdateZoomTool(mCamera, 2.0f * MouseSensitivity * (mInputState.y - mMouseDownY));
|
ActiveModel->UpdateZoomTool(mCamera, 2.0f * MouseSensitivity * (mMouseY - mMouseDownY));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lcTrackTool::Pan:
|
case lcTrackTool::Pan:
|
||||||
{
|
{
|
||||||
lcVector3 Points[4] =
|
lcVector3 Points[4] =
|
||||||
{
|
{
|
||||||
lcVector3((float)mInputState.x, (float)mInputState.y, 0.0f),
|
lcVector3((float)mMouseX, (float)mMouseY, 0.0f),
|
||||||
lcVector3((float)mInputState.x, (float)mInputState.y, 1.0f),
|
lcVector3((float)mMouseX, (float)mMouseY, 1.0f),
|
||||||
lcVector3(mMouseDownX, mMouseDownY, 0.0f),
|
lcVector3(mMouseDownX, mMouseDownY, 0.0f),
|
||||||
lcVector3(mMouseDownX, mMouseDownY, 1.0f)
|
lcVector3(mMouseDownX, mMouseDownY, 1.0f)
|
||||||
};
|
};
|
||||||
|
@ -3203,19 +3203,19 @@ void View::OnMouseMove()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lcTrackTool::OrbitX:
|
case lcTrackTool::OrbitX:
|
||||||
ActiveModel->UpdateOrbitTool(mCamera, 0.1f * MouseSensitivity * (mInputState.x - mMouseDownX), 0.0f);
|
ActiveModel->UpdateOrbitTool(mCamera, 0.1f * MouseSensitivity * (mMouseX - mMouseDownX), 0.0f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lcTrackTool::OrbitY:
|
case lcTrackTool::OrbitY:
|
||||||
ActiveModel->UpdateOrbitTool(mCamera, 0.0f, 0.1f * MouseSensitivity * (mInputState.y - mMouseDownY));
|
ActiveModel->UpdateOrbitTool(mCamera, 0.0f, 0.1f * MouseSensitivity * (mMouseY - mMouseDownY));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lcTrackTool::OrbitXY:
|
case lcTrackTool::OrbitXY:
|
||||||
ActiveModel->UpdateOrbitTool(mCamera, 0.1f * MouseSensitivity * (mInputState.x - mMouseDownX), 0.1f * MouseSensitivity * (mInputState.y - mMouseDownY));
|
ActiveModel->UpdateOrbitTool(mCamera, 0.1f * MouseSensitivity * (mMouseX - mMouseDownX), 0.1f * MouseSensitivity * (mMouseY - mMouseDownY));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lcTrackTool::Roll:
|
case lcTrackTool::Roll:
|
||||||
ActiveModel->UpdateRollTool(mCamera, 2.0f * MouseSensitivity * (mInputState.x - mMouseDownX) * LC_DTOR);
|
ActiveModel->UpdateRollTool(mCamera, 2.0f * MouseSensitivity * (mMouseX - mMouseDownX) * LC_DTOR);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lcTrackTool::ZoomRegion:
|
case lcTrackTool::ZoomRegion:
|
||||||
|
@ -3229,5 +3229,5 @@ void View::OnMouseMove()
|
||||||
|
|
||||||
void View::OnMouseWheel(float Direction)
|
void View::OnMouseWheel(float Direction)
|
||||||
{
|
{
|
||||||
mModel->Zoom(mCamera, (int)(((mInputState.Modifiers & Qt::ControlModifier) ? 100 : 10) * Direction));
|
mModel->Zoom(mCamera, (int)(((mMouseModifiers & Qt::ControlModifier) ? 100 : 10) * Direction));
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,21 +23,21 @@ lcQGLWidget::lcQGLWidget(QWidget* Parent, lcGLWidget* Owner)
|
||||||
: QGLWidget(Parent, gWidgetList.isEmpty() ? nullptr : gWidgetList.first())
|
: QGLWidget(Parent, gWidgetList.isEmpty() ? nullptr : gWidgetList.first())
|
||||||
{
|
{
|
||||||
mWheelAccumulator = 0;
|
mWheelAccumulator = 0;
|
||||||
widget = Owner;
|
mWidget = Owner;
|
||||||
widget->mWidget = this;
|
mWidget->mWidget = this;
|
||||||
|
|
||||||
makeCurrent();
|
makeCurrent();
|
||||||
|
|
||||||
if (gWidgetList.isEmpty())
|
if (gWidgetList.isEmpty())
|
||||||
{
|
{
|
||||||
// TODO: Find a better place for the grid texture and font
|
// TODO: Find a better place for the grid texture and font
|
||||||
gStringCache.Initialize(widget->mContext);
|
gStringCache.Initialize(mWidget->mContext);
|
||||||
gTexFont.Initialize(widget->mContext);
|
gTexFont.Initialize(mWidget->mContext);
|
||||||
|
|
||||||
lcInitializeGLExtensions(context());
|
lcInitializeGLExtensions(context());
|
||||||
lcContext::CreateResources();
|
lcContext::CreateResources();
|
||||||
View::CreateResources(widget->mContext);
|
View::CreateResources(mWidget->mContext);
|
||||||
lcViewSphere::CreateResources(widget->mContext);
|
lcViewSphere::CreateResources(mWidget->mContext);
|
||||||
|
|
||||||
if (!gSupportsShaderObjects && lcGetPreferences().mShadingMode == lcShadingMode::DefaultLights)
|
if (!gSupportsShaderObjects && lcGetPreferences().mShadingMode == lcShadingMode::DefaultLights)
|
||||||
lcGetPreferences().mShadingMode = lcShadingMode::Flat;
|
lcGetPreferences().mShadingMode = lcShadingMode::Flat;
|
||||||
|
@ -51,7 +51,7 @@ lcQGLWidget::lcQGLWidget(QWidget* Parent, lcGLWidget* Owner)
|
||||||
|
|
||||||
gWidgetList.append(this);
|
gWidgetList.append(this);
|
||||||
|
|
||||||
widget->OnInitialUpdate();
|
mWidget->OnInitialUpdate();
|
||||||
|
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
||||||
|
@ -71,16 +71,16 @@ lcQGLWidget::~lcQGLWidget()
|
||||||
gStringCache.Reset();
|
gStringCache.Reset();
|
||||||
gTexFont.Reset();
|
gTexFont.Reset();
|
||||||
|
|
||||||
lcGetPiecesLibrary()->ReleaseBuffers(widget->mContext);
|
lcGetPiecesLibrary()->ReleaseBuffers(mWidget->mContext);
|
||||||
View::DestroyResources(widget->mContext);
|
View::DestroyResources(mWidget->mContext);
|
||||||
lcContext::DestroyResources();
|
lcContext::DestroyResources();
|
||||||
lcViewSphere::DestroyResources(widget->mContext);
|
lcViewSphere::DestroyResources(mWidget->mContext);
|
||||||
|
|
||||||
delete gPlaceholderMesh;
|
delete gPlaceholderMesh;
|
||||||
gPlaceholderMesh = nullptr;
|
gPlaceholderMesh = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete widget;
|
delete mWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize lcQGLWidget::sizeHint() const
|
QSize lcQGLWidget::sizeHint() const
|
||||||
|
@ -91,7 +91,7 @@ QSize lcQGLWidget::sizeHint() const
|
||||||
void lcQGLWidget::SetPreviewPosition(const QRect& ParentRect)
|
void lcQGLWidget::SetPreviewPosition(const QRect& ParentRect)
|
||||||
{
|
{
|
||||||
lcPreferences& Preferences = lcGetPreferences();
|
lcPreferences& Preferences = lcGetPreferences();
|
||||||
lcPreviewWidget* Preview = reinterpret_cast<lcPreviewWidget*>(widget);
|
lcPreviewWidget* Preview = reinterpret_cast<lcPreviewWidget*>(mWidget);
|
||||||
|
|
||||||
setWindowTitle(tr("%1 Preview").arg(Preview->IsModel() ? "Submodel" : "Part"));
|
setWindowTitle(tr("%1 Preview").arg(Preview->IsModel() ? "Submodel" : "Part"));
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ void lcQGLWidget::SetPreviewPosition(const QRect& ParentRect)
|
||||||
}
|
}
|
||||||
mPreferredSize = QSize(Size[0], Size[1]);
|
mPreferredSize = QSize(Size[0], Size[1]);
|
||||||
|
|
||||||
float Scale = deviceScale();
|
float Scale = GetDeviceScale();
|
||||||
Preview->mWidth = width() * Scale;
|
Preview->mWidth = width() * Scale;
|
||||||
Preview->mHeight = height() * Scale;
|
Preview->mHeight = height() * Scale;
|
||||||
|
|
||||||
|
@ -142,21 +142,21 @@ void lcQGLWidget::SetPreviewPosition(const QRect& ParentRect)
|
||||||
|
|
||||||
void lcQGLWidget::resizeGL(int Width, int Height)
|
void lcQGLWidget::resizeGL(int Width, int Height)
|
||||||
{
|
{
|
||||||
widget->mWidth = Width;
|
mWidget->mWidth = Width;
|
||||||
widget->mHeight = Height;
|
mWidget->mHeight = Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcQGLWidget::paintGL()
|
void lcQGLWidget::paintGL()
|
||||||
{
|
{
|
||||||
widget->OnDraw();
|
mWidget->OnDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcQGLWidget::keyPressEvent(QKeyEvent* KeyEvent)
|
void lcQGLWidget::keyPressEvent(QKeyEvent* KeyEvent)
|
||||||
{
|
{
|
||||||
if (KeyEvent->key() == Qt::Key_Control || KeyEvent->key() == Qt::Key_Shift)
|
if (KeyEvent->key() == Qt::Key_Control || KeyEvent->key() == Qt::Key_Shift)
|
||||||
{
|
{
|
||||||
widget->mInputState.Modifiers = KeyEvent->modifiers();
|
mWidget->SetMouseModifiers(KeyEvent->modifiers());
|
||||||
widget->OnUpdateCursor();
|
mWidget->OnUpdateCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
QGLWidget::keyPressEvent(KeyEvent);
|
QGLWidget::keyPressEvent(KeyEvent);
|
||||||
|
@ -166,8 +166,8 @@ void lcQGLWidget::keyReleaseEvent(QKeyEvent* KeyEvent)
|
||||||
{
|
{
|
||||||
if (KeyEvent->key() == Qt::Key_Control || KeyEvent->key() == Qt::Key_Shift)
|
if (KeyEvent->key() == Qt::Key_Control || KeyEvent->key() == Qt::Key_Shift)
|
||||||
{
|
{
|
||||||
widget->mInputState.Modifiers = KeyEvent->modifiers();
|
mWidget->SetMouseModifiers(KeyEvent->modifiers());
|
||||||
widget->OnUpdateCursor();
|
mWidget->OnUpdateCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
QGLWidget::keyReleaseEvent(KeyEvent);
|
QGLWidget::keyReleaseEvent(KeyEvent);
|
||||||
|
@ -175,33 +175,32 @@ void lcQGLWidget::keyReleaseEvent(QKeyEvent* KeyEvent)
|
||||||
|
|
||||||
void lcQGLWidget::mousePressEvent(QMouseEvent* MouseEvent)
|
void lcQGLWidget::mousePressEvent(QMouseEvent* MouseEvent)
|
||||||
{
|
{
|
||||||
float scale = deviceScale();
|
float DeviceScale = GetDeviceScale();
|
||||||
|
|
||||||
widget->mInputState.x = MouseEvent->x() * scale;
|
mWidget->SetMousePosition(MouseEvent->x() * DeviceScale, mWidget->mHeight - MouseEvent->y() * DeviceScale - 1);
|
||||||
widget->mInputState.y = widget->mHeight - MouseEvent->y() * scale - 1;
|
mWidget->SetMouseModifiers(MouseEvent->modifiers());
|
||||||
widget->mInputState.Modifiers = MouseEvent->modifiers();
|
|
||||||
|
|
||||||
switch (MouseEvent->button())
|
switch (MouseEvent->button())
|
||||||
{
|
{
|
||||||
case Qt::LeftButton:
|
case Qt::LeftButton:
|
||||||
widget->OnLeftButtonDown();
|
mWidget->OnLeftButtonDown();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::MidButton:
|
case Qt::MidButton:
|
||||||
widget->OnMiddleButtonDown();
|
mWidget->OnMiddleButtonDown();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::RightButton:
|
case Qt::RightButton:
|
||||||
widget->OnRightButtonDown();
|
mWidget->OnRightButtonDown();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||||
case Qt::BackButton:
|
case Qt::BackButton:
|
||||||
widget->OnBackButtonDown();
|
mWidget->OnBackButtonDown();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::ForwardButton:
|
case Qt::ForwardButton:
|
||||||
widget->OnForwardButtonDown();
|
mWidget->OnForwardButtonDown();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -212,33 +211,32 @@ void lcQGLWidget::mousePressEvent(QMouseEvent* MouseEvent)
|
||||||
|
|
||||||
void lcQGLWidget::mouseReleaseEvent(QMouseEvent* MouseEvent)
|
void lcQGLWidget::mouseReleaseEvent(QMouseEvent* MouseEvent)
|
||||||
{
|
{
|
||||||
float scale = deviceScale();
|
float DeviceScale = GetDeviceScale();
|
||||||
|
|
||||||
widget->mInputState.x = MouseEvent->x() * scale;
|
mWidget->SetMousePosition(MouseEvent->x() * DeviceScale, mWidget->mHeight - MouseEvent->y() * DeviceScale - 1);
|
||||||
widget->mInputState.y = widget->mHeight - MouseEvent->y() * scale - 1;
|
mWidget->SetMouseModifiers(MouseEvent->modifiers());
|
||||||
widget->mInputState.Modifiers = MouseEvent->modifiers();
|
|
||||||
|
|
||||||
switch (MouseEvent->button())
|
switch (MouseEvent->button())
|
||||||
{
|
{
|
||||||
case Qt::LeftButton:
|
case Qt::LeftButton:
|
||||||
widget->OnLeftButtonUp();
|
mWidget->OnLeftButtonUp();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::MidButton:
|
case Qt::MidButton:
|
||||||
widget->OnMiddleButtonUp();
|
mWidget->OnMiddleButtonUp();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::RightButton:
|
case Qt::RightButton:
|
||||||
widget->OnRightButtonUp();
|
mWidget->OnRightButtonUp();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||||
case Qt::BackButton:
|
case Qt::BackButton:
|
||||||
widget->OnBackButtonUp();
|
mWidget->OnBackButtonUp();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::ForwardButton:
|
case Qt::ForwardButton:
|
||||||
widget->OnForwardButtonUp();
|
mWidget->OnForwardButtonUp();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -249,16 +247,15 @@ void lcQGLWidget::mouseReleaseEvent(QMouseEvent* MouseEvent)
|
||||||
|
|
||||||
void lcQGLWidget::mouseDoubleClickEvent(QMouseEvent* MouseEvent)
|
void lcQGLWidget::mouseDoubleClickEvent(QMouseEvent* MouseEvent)
|
||||||
{
|
{
|
||||||
float scale = deviceScale();
|
float DeviceScale = GetDeviceScale();
|
||||||
|
|
||||||
widget->mInputState.x = MouseEvent->x() * scale;
|
mWidget->SetMousePosition(MouseEvent->x() * DeviceScale, mWidget->mHeight - MouseEvent->y() * DeviceScale - 1);
|
||||||
widget->mInputState.y = widget->mHeight - MouseEvent->y() * scale - 1;
|
mWidget->SetMouseModifiers(MouseEvent->modifiers());
|
||||||
widget->mInputState.Modifiers = MouseEvent->modifiers();
|
|
||||||
|
|
||||||
switch (MouseEvent->button())
|
switch (MouseEvent->button())
|
||||||
{
|
{
|
||||||
case Qt::LeftButton:
|
case Qt::LeftButton:
|
||||||
widget->OnLeftButtonDoubleClick();
|
mWidget->OnLeftButtonDoubleClick();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -267,13 +264,12 @@ void lcQGLWidget::mouseDoubleClickEvent(QMouseEvent* MouseEvent)
|
||||||
|
|
||||||
void lcQGLWidget::mouseMoveEvent(QMouseEvent* MouseEvent)
|
void lcQGLWidget::mouseMoveEvent(QMouseEvent* MouseEvent)
|
||||||
{
|
{
|
||||||
float scale = deviceScale();
|
float DeviceScale = GetDeviceScale();
|
||||||
|
|
||||||
widget->mInputState.x = MouseEvent->x() * scale;
|
mWidget->SetMousePosition(MouseEvent->x() * DeviceScale, mWidget->mHeight - MouseEvent->y() * DeviceScale - 1);
|
||||||
widget->mInputState.y = widget->mHeight - MouseEvent->y() * scale - 1;
|
mWidget->SetMouseModifiers(MouseEvent->modifiers());
|
||||||
widget->mInputState.Modifiers = MouseEvent->modifiers();
|
|
||||||
|
|
||||||
widget->OnMouseMove();
|
mWidget->OnMouseMove();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcQGLWidget::wheelEvent(QWheelEvent* WheelEvent)
|
void lcQGLWidget::wheelEvent(QWheelEvent* WheelEvent)
|
||||||
|
@ -284,11 +280,10 @@ void lcQGLWidget::wheelEvent(QWheelEvent* WheelEvent)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float scale = deviceScale();
|
float DeviceScale = GetDeviceScale();
|
||||||
|
|
||||||
widget->mInputState.x = WheelEvent->x() * scale;
|
mWidget->SetMousePosition(WheelEvent->x() * DeviceScale, mWidget->mHeight - WheelEvent->y() * DeviceScale - 1);
|
||||||
widget->mInputState.y = widget->mHeight - WheelEvent->y() * scale - 1;
|
mWidget->SetMouseModifiers(WheelEvent->modifiers());
|
||||||
widget->mInputState.Modifiers = WheelEvent->modifiers();
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0))
|
||||||
mWheelAccumulator += WheelEvent->angleDelta().y() / 8;
|
mWheelAccumulator += WheelEvent->angleDelta().y() / 8;
|
||||||
|
@ -299,7 +294,7 @@ void lcQGLWidget::wheelEvent(QWheelEvent* WheelEvent)
|
||||||
|
|
||||||
if (numSteps)
|
if (numSteps)
|
||||||
{
|
{
|
||||||
widget->OnMouseWheel(numSteps);
|
mWidget->OnMouseWheel(numSteps);
|
||||||
mWheelAccumulator -= numSteps * 15;
|
mWheelAccumulator -= numSteps * 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,13 +308,13 @@ void lcQGLWidget::dragEnterEvent(QDragEnterEvent* DragEnterEvent)
|
||||||
if (MimeData->hasFormat("application/vnd.leocad-part"))
|
if (MimeData->hasFormat("application/vnd.leocad-part"))
|
||||||
{
|
{
|
||||||
DragEnterEvent->acceptProposedAction();
|
DragEnterEvent->acceptProposedAction();
|
||||||
widget->BeginDrag(lcDragState::Piece);
|
mWidget->BeginDrag(lcDragState::Piece);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (MimeData->hasFormat("application/vnd.leocad-color"))
|
else if (MimeData->hasFormat("application/vnd.leocad-color"))
|
||||||
{
|
{
|
||||||
DragEnterEvent->acceptProposedAction();
|
DragEnterEvent->acceptProposedAction();
|
||||||
widget->BeginDrag(lcDragState::Color);
|
mWidget->BeginDrag(lcDragState::Color);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,7 +323,7 @@ void lcQGLWidget::dragEnterEvent(QDragEnterEvent* DragEnterEvent)
|
||||||
|
|
||||||
void lcQGLWidget::dragLeaveEvent(QDragLeaveEvent* DragLeaveEvent)
|
void lcQGLWidget::dragLeaveEvent(QDragLeaveEvent* DragLeaveEvent)
|
||||||
{
|
{
|
||||||
widget->EndDrag(false);
|
mWidget->EndDrag(false);
|
||||||
DragLeaveEvent->accept();
|
DragLeaveEvent->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,13 +333,12 @@ void lcQGLWidget::dragMoveEvent(QDragMoveEvent* DragMoveEvent)
|
||||||
|
|
||||||
if (MimeData->hasFormat("application/vnd.leocad-part") || MimeData->hasFormat("application/vnd.leocad-color"))
|
if (MimeData->hasFormat("application/vnd.leocad-part") || MimeData->hasFormat("application/vnd.leocad-color"))
|
||||||
{
|
{
|
||||||
float scale = deviceScale();
|
float DeviceScale = GetDeviceScale();
|
||||||
|
|
||||||
widget->mInputState.x = DragMoveEvent->pos().x() * scale;
|
mWidget->SetMousePosition(DragMoveEvent->pos().x() * DeviceScale, mWidget->mHeight - DragMoveEvent->pos().y() * DeviceScale - 1);
|
||||||
widget->mInputState.y = widget->mHeight - DragMoveEvent->pos().y() * scale - 1;
|
mWidget->SetMouseModifiers(DragMoveEvent->keyboardModifiers());
|
||||||
widget->mInputState.Modifiers = DragMoveEvent->keyboardModifiers();
|
|
||||||
|
|
||||||
widget->OnMouseMove();
|
mWidget->OnMouseMove();
|
||||||
|
|
||||||
DragMoveEvent->accept();
|
DragMoveEvent->accept();
|
||||||
return;
|
return;
|
||||||
|
@ -359,7 +353,7 @@ void lcQGLWidget::dropEvent(QDropEvent* DropEvent)
|
||||||
|
|
||||||
if (MimeData->hasFormat("application/vnd.leocad-part") || MimeData->hasFormat("application/vnd.leocad-color"))
|
if (MimeData->hasFormat("application/vnd.leocad-part") || MimeData->hasFormat("application/vnd.leocad-color"))
|
||||||
{
|
{
|
||||||
widget->EndDrag(true);
|
mWidget->EndDrag(true);
|
||||||
setFocus(Qt::MouseFocusReason);
|
setFocus(Qt::MouseFocusReason);
|
||||||
|
|
||||||
DropEvent->accept();
|
DropEvent->accept();
|
||||||
|
|
|
@ -11,9 +11,9 @@ public:
|
||||||
|
|
||||||
QSize sizeHint() const override;
|
QSize sizeHint() const override;
|
||||||
|
|
||||||
lcGLWidget* widget;
|
lcGLWidget* mWidget;
|
||||||
|
|
||||||
float deviceScale()
|
float GetDeviceScale() const
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||||
return windowHandle()->devicePixelRatio();
|
return windowHandle()->devicePixelRatio();
|
||||||
|
|
Loading…
Add table
Reference in a new issue