2013-08-16 03:25:51 +02:00
|
|
|
#ifndef _LC_MAINWINDOW_H_
|
|
|
|
#define _LC_MAINWINDOW_H_
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2013-08-16 03:25:51 +02:00
|
|
|
#include "lc_basewindow.h"
|
2013-08-16 01:43:18 +02:00
|
|
|
#include "lc_array.h"
|
2014-12-04 02:47:28 +01:00
|
|
|
#include "lc_commands.h"
|
2014-12-08 08:32:39 +01:00
|
|
|
#include "lc_model.h"
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2014-05-03 23:16:48 +02:00
|
|
|
class View;
|
2013-08-09 06:57:18 +02:00
|
|
|
class PiecePreview;
|
2015-01-26 00:04:39 +01:00
|
|
|
class lcQGLWidget;
|
|
|
|
class lcQPartsTree;
|
|
|
|
class lcQColorList;
|
|
|
|
class lcQPropertiesTree;
|
2015-03-04 21:37:09 +01:00
|
|
|
class lcTimelineWidget;
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
#define LC_MAX_RECENT_FILES 4
|
|
|
|
|
2014-09-21 03:31:01 +02:00
|
|
|
struct lcSearchOptions
|
|
|
|
{
|
|
|
|
bool MatchInfo;
|
|
|
|
bool MatchColor;
|
|
|
|
bool MatchName;
|
|
|
|
PieceInfo* Info;
|
|
|
|
int ColorIndex;
|
|
|
|
char Name[256];
|
|
|
|
};
|
|
|
|
|
2015-01-26 00:04:39 +01:00
|
|
|
class lcMainWindow : public QMainWindow
|
2011-09-07 23:06:51 +02:00
|
|
|
{
|
2015-01-26 00:04:39 +01:00
|
|
|
Q_OBJECT
|
2015-01-25 02:34:13 +01:00
|
|
|
|
2014-09-21 03:31:01 +02:00
|
|
|
public:
|
2013-08-09 06:57:18 +02:00
|
|
|
lcMainWindow();
|
|
|
|
~lcMainWindow();
|
|
|
|
|
2015-01-26 00:04:39 +01:00
|
|
|
void CreateWidgets();
|
|
|
|
|
2014-05-23 02:02:21 +02:00
|
|
|
lcTool GetTool() const
|
|
|
|
{
|
|
|
|
return mTool;
|
|
|
|
}
|
|
|
|
|
2014-08-27 18:17:09 +02:00
|
|
|
lcTransformType GetTransformType() const
|
|
|
|
{
|
|
|
|
return mTransformType;
|
|
|
|
}
|
|
|
|
|
2014-05-21 00:15:42 +02:00
|
|
|
bool GetAddKeys() const
|
|
|
|
{
|
|
|
|
return mAddKeys;
|
|
|
|
}
|
|
|
|
|
2015-04-25 00:11:50 +02:00
|
|
|
float GetMoveXYSnap() const
|
2014-10-05 07:21:51 +02:00
|
|
|
{
|
2015-04-25 00:11:50 +02:00
|
|
|
const float SnapXYTable[] = { 0.0f, 1.0f, 5.0f, 8.0f, 10.0f, 20.0f, 40.0f, 60.0f, 80.0f, 160.0f };
|
|
|
|
return mMoveSnapEnabled ? SnapXYTable[mMoveXYSnapIndex] : 0.0f;
|
2014-10-05 07:21:51 +02:00
|
|
|
}
|
|
|
|
|
2015-04-25 00:11:50 +02:00
|
|
|
float GetMoveZSnap() const
|
2014-10-05 07:21:51 +02:00
|
|
|
{
|
2015-04-25 00:11:50 +02:00
|
|
|
const float SnapZTable[] = { 0.0f, 1.0f, 5.0f, 8.0f, 10.0f, 20.0f, 24.0f, 48.0f, 96.0f, 192.0f };
|
|
|
|
return mMoveSnapEnabled ? SnapZTable[mMoveZSnapIndex] : 0.0f;
|
2014-10-05 07:21:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int GetAngleSnap() const
|
|
|
|
{
|
|
|
|
const int AngleTable[] = { 0, 1, 5, 10, 15, 30, 45, 60, 90, 180 };
|
2015-04-25 00:11:50 +02:00
|
|
|
return mAngleSnapEnabled ? AngleTable[mAngleSnapIndex] : 0.0f;
|
2014-10-05 07:21:51 +02:00
|
|
|
}
|
|
|
|
|
2015-04-25 00:11:50 +02:00
|
|
|
QString GetMoveXYSnapText() const
|
2014-10-05 07:21:51 +02:00
|
|
|
{
|
2015-04-25 00:11:50 +02:00
|
|
|
QString SnapXYText[] = { tr("0"), tr("1/20S"), tr("1/4S"), tr("1F"), tr("1/2S"), tr("1S"), tr("2S"), tr("3S"), tr("4S"), tr("8S") };
|
|
|
|
return mMoveSnapEnabled ? SnapXYText[mMoveXYSnapIndex] : tr("None");
|
2014-10-05 07:21:51 +02:00
|
|
|
}
|
|
|
|
|
2015-04-25 00:11:50 +02:00
|
|
|
QString GetMoveZSnapText() const
|
2014-10-05 07:21:51 +02:00
|
|
|
{
|
2015-04-25 00:11:50 +02:00
|
|
|
QString SnapZText[] = { tr("0"), tr("1/20S"), tr("1/4S"), tr("1F"), tr("1/2S"), tr("1S"), tr("1B"), tr("2B"), tr("4B"), tr("8B") };
|
|
|
|
return mMoveSnapEnabled ? SnapZText[mMoveZSnapIndex] : tr("None");
|
2014-10-05 07:21:51 +02:00
|
|
|
}
|
|
|
|
|
2015-04-25 00:11:50 +02:00
|
|
|
QString GetAngleSnapText() const
|
2014-10-05 07:21:51 +02:00
|
|
|
{
|
2015-04-25 00:11:50 +02:00
|
|
|
return mAngleSnapEnabled ? QString::number(GetAngleSnap()) : tr("None");
|
2014-10-05 07:21:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool GetLockX() const
|
|
|
|
{
|
|
|
|
return mLockX;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetLockY() const
|
|
|
|
{
|
|
|
|
return mLockY;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetLockZ() const
|
|
|
|
{
|
|
|
|
return mLockZ;
|
|
|
|
}
|
|
|
|
|
2015-01-18 06:36:14 +01:00
|
|
|
bool GetRelativeTransform() const
|
|
|
|
{
|
|
|
|
return mRelativeTransform;
|
|
|
|
}
|
|
|
|
|
2014-05-03 23:16:48 +02:00
|
|
|
View* GetActiveView() const
|
|
|
|
{
|
|
|
|
return mActiveView;
|
|
|
|
}
|
|
|
|
|
|
|
|
const lcArray<View*>& GetViews()
|
|
|
|
{
|
|
|
|
return mViews;
|
|
|
|
}
|
|
|
|
|
2015-12-04 21:32:10 +01:00
|
|
|
QMenu* GetCameraMenu() const
|
|
|
|
{
|
|
|
|
return mCameraMenu;
|
|
|
|
}
|
|
|
|
|
|
|
|
QMenu* GetViewpointMenu() const
|
|
|
|
{
|
|
|
|
return mViewpointMenu;
|
|
|
|
}
|
|
|
|
|
2015-01-25 02:34:13 +01:00
|
|
|
bool DoDialog(LC_DIALOG_TYPE Type, void* Data);
|
|
|
|
|
2015-01-16 03:07:31 +01:00
|
|
|
void ResetCameras();
|
2014-05-03 23:16:48 +02:00
|
|
|
void AddView(View* View);
|
|
|
|
void RemoveView(View* View);
|
|
|
|
void SetActiveView(View* ActiveView);
|
|
|
|
void UpdateAllViews();
|
|
|
|
|
2014-05-23 02:02:21 +02:00
|
|
|
void SetTool(lcTool Tool);
|
2014-08-27 18:17:09 +02:00
|
|
|
void SetTransformType(lcTransformType TransformType);
|
2013-08-09 06:57:18 +02:00
|
|
|
void SetColorIndex(int ColorIndex);
|
2015-04-25 00:11:50 +02:00
|
|
|
void SetMoveSnapEnabled(bool Enabled);
|
|
|
|
void SetAngleSnapEnabled(bool Enabled);
|
2014-10-05 07:21:51 +02:00
|
|
|
void SetMoveXYSnapIndex(int Index);
|
|
|
|
void SetMoveZSnapIndex(int Index);
|
|
|
|
void SetAngleSnapIndex(int Index);
|
|
|
|
void SetLockX(bool LockX);
|
|
|
|
void SetLockY(bool LockY);
|
|
|
|
void SetLockZ(bool LockZ);
|
2015-01-18 06:36:14 +01:00
|
|
|
void SetRelativeTransform(bool RelativeTransform);
|
2014-10-05 07:21:51 +02:00
|
|
|
|
2014-12-04 02:47:28 +01:00
|
|
|
void NewProject();
|
|
|
|
bool OpenProject(const QString& FileName);
|
2014-12-16 00:55:17 +01:00
|
|
|
void MergeProject();
|
2014-12-04 02:47:28 +01:00
|
|
|
bool SaveProject(const QString& FileName);
|
|
|
|
bool SaveProjectIfModified();
|
2015-03-17 05:18:28 +01:00
|
|
|
void SetModelFromFocus();
|
2014-12-04 02:47:28 +01:00
|
|
|
void HandleCommand(lcCommandId CommandId);
|
2013-08-09 06:57:18 +02:00
|
|
|
|
2014-10-12 19:34:18 +02:00
|
|
|
void AddRecentFile(const QString& FileName);
|
2013-08-09 06:57:18 +02:00
|
|
|
void RemoveRecentFile(int FileIndex);
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
void SplitHorizontal();
|
|
|
|
void SplitVertical();
|
2015-01-26 00:04:39 +01:00
|
|
|
void RemoveActiveView();
|
2013-08-09 06:57:18 +02:00
|
|
|
void ResetViews();
|
2011-09-07 23:06:51 +02:00
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
void TogglePrintPreview();
|
|
|
|
void ToggleFullScreen();
|
|
|
|
|
2014-08-07 17:22:33 +02:00
|
|
|
void UpdateFocusObject(lcObject* Focus);
|
|
|
|
void UpdateSelectedObjects(int Flags, int SelectedCount, lcObject* Focus);
|
2015-07-05 03:04:27 +02:00
|
|
|
void UpdateTimeline(bool Clear, bool UpdateItems);
|
2013-08-09 06:57:18 +02:00
|
|
|
void UpdatePaste(bool Enabled);
|
2014-07-06 08:04:09 +02:00
|
|
|
void UpdateCurrentStep();
|
2014-05-21 00:15:42 +02:00
|
|
|
void SetAddKeys(bool AddKeys);
|
2014-10-05 07:21:51 +02:00
|
|
|
void UpdateLockSnap();
|
2013-08-09 06:57:18 +02:00
|
|
|
void UpdateSnap();
|
2015-01-17 03:02:30 +01:00
|
|
|
void UpdateColor();
|
2014-09-15 01:32:58 +02:00
|
|
|
void UpdateUndoRedo(const QString& UndoText, const QString& RedoText);
|
2013-08-09 06:57:18 +02:00
|
|
|
void UpdateCurrentCamera(int CameraIndex);
|
2014-05-03 23:16:48 +02:00
|
|
|
void UpdatePerspective();
|
|
|
|
void UpdateCameraMenu();
|
2014-12-10 00:56:29 +01:00
|
|
|
void UpdateModels();
|
2013-08-09 06:57:18 +02:00
|
|
|
void UpdateCategories();
|
2014-12-08 08:32:39 +01:00
|
|
|
void UpdateTitle();
|
2013-08-09 06:57:18 +02:00
|
|
|
void UpdateModified(bool Modified);
|
|
|
|
void UpdateRecentFiles();
|
|
|
|
void UpdateShortcuts();
|
|
|
|
|
|
|
|
lcVector3 GetTransformAmount();
|
|
|
|
|
2014-10-12 19:34:18 +02:00
|
|
|
QString mRecentFiles[LC_MAX_RECENT_FILES];
|
2013-08-09 06:57:18 +02:00
|
|
|
PiecePreview* mPreviewWidget;
|
|
|
|
int mColorIndex;
|
2014-09-21 03:31:01 +02:00
|
|
|
lcSearchOptions mSearchOptions;
|
2015-01-26 00:04:39 +01:00
|
|
|
QAction* mActions[LC_NUM_COMMANDS];
|
2014-05-03 23:16:48 +02:00
|
|
|
|
2015-01-26 00:04:39 +01:00
|
|
|
protected slots:
|
|
|
|
void ClipboardChanged();
|
|
|
|
void ActionTriggered();
|
|
|
|
void PartsTreeItemChanged(QTreeWidgetItem* Current, QTreeWidgetItem* Previous);
|
|
|
|
void ColorChanged(int ColorIndex);
|
|
|
|
void PartSearchReturn();
|
|
|
|
void PartSearchChanged(const QString& Text);
|
|
|
|
void Print(QPrinter* Printer);
|
2015-01-25 02:34:13 +01:00
|
|
|
|
2014-05-03 23:16:48 +02:00
|
|
|
protected:
|
2015-01-26 00:04:39 +01:00
|
|
|
void closeEvent(QCloseEvent *event);
|
|
|
|
QMenu* createPopupMenu();
|
|
|
|
|
|
|
|
void CreateActions();
|
|
|
|
void CreateMenus();
|
|
|
|
void CreateToolBars();
|
|
|
|
void CreateStatusBar();
|
|
|
|
void SplitView(Qt::Orientation Orientation);
|
|
|
|
void ShowPrintDialog();
|
|
|
|
|
2014-05-03 23:16:48 +02:00
|
|
|
View* mActiveView;
|
|
|
|
lcArray<View*> mViews;
|
2014-05-21 00:15:42 +02:00
|
|
|
|
|
|
|
bool mAddKeys;
|
2014-05-23 02:02:21 +02:00
|
|
|
lcTool mTool;
|
2014-08-27 18:17:09 +02:00
|
|
|
lcTransformType mTransformType;
|
2015-04-25 00:11:50 +02:00
|
|
|
bool mMoveSnapEnabled;
|
|
|
|
bool mAngleSnapEnabled;
|
2014-10-05 07:21:51 +02:00
|
|
|
int mMoveXYSnapIndex;
|
|
|
|
int mMoveZSnapIndex;
|
|
|
|
int mAngleSnapIndex;
|
|
|
|
bool mLockX;
|
|
|
|
bool mLockY;
|
|
|
|
bool mLockZ;
|
2015-01-18 06:36:14 +01:00
|
|
|
bool mRelativeTransform;
|
2015-01-26 00:04:39 +01:00
|
|
|
|
|
|
|
QAction* mActionFileRecentSeparator;
|
|
|
|
|
|
|
|
QToolBar* mStandardToolBar;
|
|
|
|
QToolBar* mToolsToolBar;
|
|
|
|
QToolBar* mTimeToolBar;
|
|
|
|
QDockWidget* mPartsToolBar;
|
|
|
|
QDockWidget* mPropertiesToolBar;
|
2015-03-04 21:37:09 +01:00
|
|
|
QDockWidget* mTimelineToolBar;
|
2015-01-26 00:04:39 +01:00
|
|
|
|
|
|
|
lcQGLWidget* mPiecePreviewWidget;
|
|
|
|
lcQPartsTree* mPartsTree;
|
|
|
|
QLineEdit* mPartSearchEdit;
|
|
|
|
lcQColorList* mColorList;
|
|
|
|
lcQPropertiesTree* mPropertiesWidget;
|
2015-03-04 21:37:09 +01:00
|
|
|
lcTimelineWidget* mTimelineWidget;
|
2015-01-26 00:04:39 +01:00
|
|
|
QLineEdit* mTransformXEdit;
|
|
|
|
QLineEdit* mTransformYEdit;
|
|
|
|
QLineEdit* mTransformZEdit;
|
|
|
|
|
|
|
|
QLabel* mStatusBarLabel;
|
|
|
|
QLabel* mStatusPositionLabel;
|
|
|
|
QLabel* mStatusSnapLabel;
|
|
|
|
QLabel* mStatusTimeLabel;
|
2015-12-04 21:32:10 +01:00
|
|
|
|
|
|
|
QMenu* mCameraMenu;
|
|
|
|
QMenu* mViewpointMenu;
|
2011-09-07 23:06:51 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 06:57:18 +02:00
|
|
|
extern class lcMainWindow* gMainWindow;
|
|
|
|
|
2013-08-16 03:20:51 +02:00
|
|
|
#endif // _LC_MAINWND_H_
|