leocad/common/project.h

95 lines
2.1 KiB
C
Raw Normal View History

2011-09-07 23:06:51 +02:00
#ifndef _PROJECT_H_
#define _PROJECT_H_
#include "object.h"
#include "opengl.h"
2013-08-16 01:43:18 +02:00
#include "lc_array.h"
2012-05-29 01:33:22 +02:00
#include "lc_math.h"
2013-08-09 06:57:18 +02:00
#include "lc_commands.h"
#include "str.h"
2013-08-09 06:57:18 +02:00
#define LC_SCENE_FOG 0x004 // Enable fog
#define LC_SCENE_BG 0x010 // Draw bg image
#define LC_SCENE_BG_TILE 0x040 // Tile bg image
#define LC_SCENE_GRADIENT 0x100 // Draw gradient
#define LC_HTML_SINGLEPAGE 0x01
#define LC_HTML_INDEX 0x02
#define LC_HTML_IMAGES 0x04
#define LC_HTML_LISTEND 0x08
#define LC_HTML_LISTSTEP 0x10
#define LC_HTML_HIGHLIGHT 0x20
//#define LC_HTML_HTMLEXT 0x40
//#define LC_HTML_LISTID 0x80
2012-10-18 20:57:21 +02:00
enum LC_MOUSE_TRACK
2011-09-07 23:06:51 +02:00
{
LC_TRACK_NONE,
LC_TRACK_LEFT,
LC_TRACK_RIGHT
2012-10-18 20:57:21 +02:00
};
2011-09-07 23:06:51 +02:00
class PieceInfo;
class View;
class Image;
#include "lc_file.h"
2011-09-07 23:06:51 +02:00
2012-03-23 00:44:56 +01:00
struct LC_FILEENTRY
{
lcMemFile File;
char FileName[LC_MAXPATH];
};
2014-05-25 03:45:19 +02:00
#include "lc_model.h"
2013-08-09 06:57:18 +02:00
2014-05-25 03:45:19 +02:00
class Project : public lcModel
2011-09-07 23:06:51 +02:00
{
public:
Project();
~Project();
2014-07-06 08:04:09 +02:00
void SetCurrentStep(lcStep Step)
{
2014-07-06 08:04:09 +02:00
mCurrentStep = Step;
2013-08-09 06:57:18 +02:00
CalculateStep();
}
2014-07-06 08:04:09 +02:00
2014-05-25 03:45:19 +02:00
int GetGroupIndex(lcGroup* Group) const
{
return mGroups.FindIndex(Group);
}
2011-09-07 23:06:51 +02:00
void UpdateInterface();
2014-10-05 07:21:51 +02:00
void LoadDefaults();
2014-10-12 01:26:23 +02:00
void SaveImage();
void SaveStepImages(const QString& BaseName, int Width, int Height, lcStep Start, lcStep End);
2014-10-05 07:21:51 +02:00
void HandleCommand(LC_COMMANDS id);
protected:
2014-07-03 21:10:04 +02:00
void CheckPoint(const char* Description);
2011-09-07 23:06:51 +02:00
2014-10-08 01:02:52 +02:00
static int InstanceOfName(const String& existingString, const String& candidateString, String& baseNameOut);
2011-09-07 23:06:51 +02:00
2014-10-13 05:43:33 +02:00
void ExportHTML();
void CreateHTMLPieceList(QTextStream& Stream, lcStep Step, bool Images, const QString& ImageExtension);
2011-09-07 23:06:51 +02:00
2014-10-12 19:34:18 +02:00
bool DoSave(const QString& FileName);
2012-03-23 00:44:56 +01:00
bool FileLoad(lcFile* file, bool bUndo, bool bMerge);
2013-08-16 01:43:18 +02:00
void FileReadLDraw(lcFile* file, const lcMatrix44& CurrentTransform, int* nOk, int DefColor, int* nStep, lcArray<LC_FILEENTRY*>& FileArray);
void FileReadMPD(lcFile& MPD, lcArray<LC_FILEENTRY*>& FileArray) const;
2011-09-07 23:06:51 +02:00
2014-10-12 19:34:18 +02:00
void SetFileName(const QString& FileName);
QString GetTitle() const;
QString mFileName;
2014-10-08 01:02:52 +02:00
2011-09-07 23:06:51 +02:00
public:
bool OnNewDocument();
2014-10-12 19:34:18 +02:00
bool OnOpenDocument(const QString& FileName);
bool OpenProject(const QString& FileName);
bool SaveIfModified();
2011-09-07 23:06:51 +02:00
};
#endif // _PROJECT_H_