leocad/common/lc_application.h
2017-12-02 19:42:42 -08:00

76 lines
1.4 KiB
C++

#pragma once
#include "lc_array.h"
class Project;
class lcPiecesLibrary;
enum lcShadingMode
{
LC_SHADING_WIREFRAME,
LC_SHADING_FLAT,
LC_SHADING_DEFAULT_LIGHTS,
LC_SHADING_FULL,
LC_NUM_SHADING_MODES
};
class lcPreferences
{
public:
void LoadDefaults();
void SaveDefaults();
int mMouseSensitivity;
lcShadingMode mShadingMode;
bool mDrawAxes;
bool mDrawEdgeLines;
float mLineWidth;
bool mDrawGridStuds;
quint32 mGridStudColor;
bool mDrawGridLines;
int mGridLineSpacing;
quint32 mGridLineColor;
bool mFixedAxes;
};
class lcApplication : public QApplication
{
Q_OBJECT
public:
lcApplication(int Argc, char** Argv);
~lcApplication();
void SetProject(Project* Project);
bool Initialize(QList<QPair<QString, bool>>& LibraryPaths, bool& ShowWindow);
void Shutdown();
void ShowPreferencesDialog();
bool LoadPartsLibrary(const QList<QPair<QString, bool>>& LibraryPaths, bool OnlyUsePaths, bool ShowProgress);
void SetClipboard(const QByteArray& Clipboard);
void ExportClipboard(const QByteArray& Clipboard);
Project* mProject;
lcPiecesLibrary* mLibrary;
lcPreferences mPreferences;
QByteArray mClipboard;
};
extern lcApplication* gApplication;
inline lcPiecesLibrary* lcGetPiecesLibrary()
{
return gApplication->mLibrary;
}
inline Project* lcGetActiveProject()
{
return gApplication->mProject;
}
inline lcPreferences& lcGetPreferences()
{
return gApplication->mPreferences;
}