leocad/common/lc_mainwindow.h

195 lines
3.8 KiB
C
Raw Normal View History

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"
#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;
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];
};
2013-08-09 06:57:18 +02:00
class lcMainWindow : public lcBaseWindow
2011-09-07 23:06:51 +02:00
{
2014-09-21 03:31:01 +02:00
public:
2013-08-09 06:57:18 +02:00
lcMainWindow();
~lcMainWindow();
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;
}
2014-10-05 07:21:51 +02:00
int GetMoveXYSnap() const
{
const int SnapXYTable[] = { 0, 1, 5, 8, 10, 20, 40, 60, 80, 160 };
return SnapXYTable[mMoveXYSnapIndex];
}
int GetMoveZSnap() const
{
const int SnapZTable[] = { 0, 1, 5, 8, 10, 20, 24, 48, 96, 192 };
return SnapZTable[mMoveZSnapIndex];
}
int GetAngleSnap() const
{
const int AngleTable[] = { 0, 1, 5, 10, 15, 30, 45, 60, 90, 180 };
return AngleTable[mAngleSnapIndex];
}
int GetMoveXYSnapIndex() const
{
return mMoveXYSnapIndex;
}
int GetMoveZSnapIndex() const
{
return mMoveZSnapIndex;
}
int GetAngleSnapIndex() const
{
return mAngleSnapIndex;
}
const char* GetMoveXYSnapText() const
{
const char* SnapXYText[] = { "0", "1/20S", "1/4S", "1F", "1/2S", "1S", "2S", "3S", "4S", "8S" };
return SnapXYText[mMoveXYSnapIndex];
}
const char* GetMoveZSnapText() const
{
const char* SnapZText[] = { "0", "1/20S", "1/4S", "1F", "1/2S", "1S", "1B", "2B", "4B", "8B" };
return SnapZText[mMoveZSnapIndex];
}
bool GetLockX() const
{
return mLockX;
}
bool GetLockY() const
{
return mLockY;
}
bool GetLockZ() const
{
return mLockZ;
}
2014-05-03 23:16:48 +02:00
View* GetActiveView() const
{
return mActiveView;
}
const lcArray<View*>& GetViews()
{
return mViews;
}
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);
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);
2013-08-09 06:57:18 +02:00
void Close();
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();
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();
void RemoveView();
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);
2013-08-09 06:57:18 +02:00
void UpdateAction(int NewAction);
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();
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();
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;
2014-05-03 23:16:48 +02:00
protected:
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;
2014-10-05 07:21:51 +02:00
int mMoveXYSnapIndex;
int mMoveZSnapIndex;
int mAngleSnapIndex;
bool mLockX;
bool mLockY;
bool mLockZ;
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_