leocad/common/project.h

131 lines
3.2 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];
};
2013-08-09 06:57:18 +02:00
enum lcObjectProperty
{
2014-05-03 03:22:24 +02:00
LC_PIECE_PROPERTY_POSITION,
LC_PIECE_PROPERTY_ROTATION,
LC_PIECE_PROPERTY_SHOW,
LC_PIECE_PROPERTY_HIDE,
LC_PIECE_PROPERTY_COLOR,
LC_PIECE_PROPERTY_ID,
LC_CAMERA_PROPERTY_POSITION,
LC_CAMERA_PROPERTY_TARGET,
LC_CAMERA_PROPERTY_UPVECTOR,
LC_CAMERA_PROPERTY_ORTHO,
LC_CAMERA_PROPERTY_FOV,
LC_CAMERA_PROPERTY_NEAR,
LC_CAMERA_PROPERTY_FAR,
LC_CAMERA_PROPERTY_NAME
2013-08-09 06:57:18 +02:00
};
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
float* GetBackgroundColor() // todo: remove
2014-10-08 01:02:52 +02:00
{
return mProperties.mBackgroundSolidColor;
}
2011-09-07 23:06:51 +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-08 01:02:52 +02:00
void SetPathName(const char* lpszPathName, bool bAddToMRU);
void SetTitle(const char* lpszTitle);
2011-09-07 23:06:51 +02:00
public:
2014-10-05 07:21:51 +02:00
void LoadDefaults();
2014-07-06 08:04:09 +02:00
void CreateImages(Image* images, int width, int height, lcStep from, lcStep to, bool hilite);
void Render(View* view, bool bToMemory);
2014-05-25 03:45:19 +02:00
lcGroup* AddGroup(lcGroup* Parent);
2014-08-27 18:17:09 +02:00
void TransformSelectedObjects(lcTransformType Type, const lcVector3& Transform);
2014-08-07 17:22:33 +02:00
void ModifyObject(lcObject* Object, lcObjectProperty Property, void* Value);
2013-08-09 06:57:18 +02:00
void ZoomActiveView(int Amount);
void GetPieceInsertPosition(View* view, lcVector3& Position, lcVector4& Orientation);
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-08-07 17:22:33 +02:00
void GetPieceInsertPosition(lcPiece* OffsetPiece, lcVector3& Position, lcVector4& Rotation);
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
void RenderBackground(View* view);
2014-04-20 03:50:41 +02:00
void RenderScenePieces(View* view, bool DrawInterface);
2012-01-28 02:05:23 +01:00
void RenderSceneObjects(View* view);
2014-07-06 08:04:09 +02:00
void CreateHTMLPieceList(FILE* f, lcStep Step, bool bImages, const char* ext);
2012-12-13 01:20:40 +01:00
void ZoomExtents(int FirstView, int LastView);
2011-09-07 23:06:51 +02:00
2013-08-09 06:57:18 +02:00
bool DoSave(const char* 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-08 01:02:52 +02:00
char m_strTitle[LC_MAXPATH];
char m_strPathName[LC_MAXPATH];
2011-09-07 23:06:51 +02:00
public:
bool OnNewDocument();
bool OnOpenDocument(const char* FileName);
bool OpenProject(const char* FileName);
bool SaveModified();
};
#endif // _PROJECT_H_