2017-07-19 14:20:32 -07:00
|
|
|
#pragma once
|
2011-09-07 21:06:51 +00:00
|
|
|
|
|
|
|
#include "object.h"
|
2013-08-15 23:43:18 +00:00
|
|
|
#include "lc_array.h"
|
2014-12-08 07:32:39 +00:00
|
|
|
#include "lc_application.h"
|
2013-08-09 04:57:18 +00:00
|
|
|
|
2016-05-30 22:41:03 +00:00
|
|
|
#define LC_HTML_SINGLEPAGE 0x01
|
|
|
|
#define LC_HTML_INDEX 0x02
|
|
|
|
#define LC_HTML_LISTEND 0x08
|
|
|
|
#define LC_HTML_LISTSTEP 0x10
|
|
|
|
#define LC_HTML_SUBMODELS 0x40
|
|
|
|
#define LC_HTML_CURRENT_ONLY 0x80
|
2013-08-09 04:57:18 +00:00
|
|
|
|
2017-12-11 11:14:37 -08:00
|
|
|
class lcHTMLExportOptions
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
lcHTMLExportOptions(const Project* Project);
|
|
|
|
void SaveDefaults();
|
|
|
|
|
|
|
|
QString PathName;
|
|
|
|
bool TransparentImages;
|
|
|
|
bool SubModels;
|
|
|
|
bool CurrentOnly;
|
|
|
|
bool SinglePage;
|
|
|
|
bool IndexPage;
|
|
|
|
int StepImagesWidth;
|
|
|
|
int StepImagesHeight;
|
|
|
|
bool PartsListStep;
|
|
|
|
bool PartsListEnd;
|
|
|
|
};
|
|
|
|
|
2012-10-18 18:57:21 +00:00
|
|
|
enum LC_MOUSE_TRACK
|
2011-09-07 21:06:51 +00:00
|
|
|
{
|
2011-09-20 01:26:31 +00:00
|
|
|
LC_TRACK_NONE,
|
|
|
|
LC_TRACK_LEFT,
|
|
|
|
LC_TRACK_RIGHT
|
2012-10-18 18:57:21 +00:00
|
|
|
};
|
2011-09-07 21:06:51 +00:00
|
|
|
|
2014-12-08 07:32:39 +00:00
|
|
|
class Project
|
2011-09-07 21:06:51 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
Project();
|
|
|
|
~Project();
|
|
|
|
|
2020-05-03 15:39:39 -07:00
|
|
|
Project(const Project&) = delete;
|
|
|
|
Project(Project&&) = delete;
|
|
|
|
Project& operator=(const Project&) = delete;
|
|
|
|
Project& operator=(Project&&) = delete;
|
|
|
|
|
2014-12-09 23:56:29 +00:00
|
|
|
const lcArray<lcModel*>& GetModels() const
|
|
|
|
{
|
|
|
|
return mModels;
|
|
|
|
}
|
|
|
|
|
2020-05-03 12:11:51 -07:00
|
|
|
lcModel* GetModel(const QString& FileName) const;
|
2018-01-02 19:46:50 -08:00
|
|
|
|
2014-12-08 07:32:39 +00:00
|
|
|
lcModel* GetActiveModel() const
|
|
|
|
{
|
|
|
|
return mActiveModel;
|
|
|
|
}
|
|
|
|
|
2017-12-10 15:01:12 -08:00
|
|
|
int GetActiveModelIndex() const
|
|
|
|
{
|
|
|
|
return mModels.FindIndex(mActiveModel);
|
|
|
|
}
|
|
|
|
|
2016-11-25 17:12:19 -08:00
|
|
|
lcModel* GetMainModel() const
|
|
|
|
{
|
2017-04-13 17:26:40 -07:00
|
|
|
return !mModels.IsEmpty() ? mModels[0] : nullptr;
|
2016-11-25 17:12:19 -08:00
|
|
|
}
|
|
|
|
|
2014-12-12 23:42:09 +00:00
|
|
|
bool IsModified() const;
|
2019-03-08 19:54:58 +01:00
|
|
|
void MarkAsModified();
|
2014-12-04 01:47:28 +00:00
|
|
|
QString GetTitle() const;
|
2014-12-12 23:42:09 +00:00
|
|
|
|
2014-12-04 01:47:28 +00:00
|
|
|
QString GetFileName() const
|
|
|
|
{
|
|
|
|
return mFileName;
|
|
|
|
}
|
|
|
|
|
2018-04-14 18:27:16 -07:00
|
|
|
QString GetImageFileName(bool AllowCurrentFolder) const;
|
2017-12-27 13:55:37 -08:00
|
|
|
|
2019-12-30 16:04:58 -08:00
|
|
|
std::vector<std::pair<lcModel*, lcStep>> GetPageLayouts() const;
|
|
|
|
|
2014-12-12 23:42:09 +00:00
|
|
|
void SetActiveModel(int ModelIndex);
|
2020-05-03 12:11:51 -07:00
|
|
|
void SetActiveModel(const QString& FileName);
|
2014-12-12 23:42:09 +00:00
|
|
|
|
2015-12-02 01:16:12 +00:00
|
|
|
lcModel* CreateNewModel(bool ShowModel);
|
2016-09-08 22:34:51 +00:00
|
|
|
QString GetNewModelName(QWidget* ParentWidget, const QString& DialogTitle, const QString& CurrentName, const QStringList& ExistingModels) const;
|
2014-12-12 23:42:09 +00:00
|
|
|
void ShowModelListDialog();
|
2016-09-25 17:15:30 -07:00
|
|
|
|
2014-12-04 01:47:28 +00:00
|
|
|
bool Load(const QString& FileName);
|
2014-12-08 07:32:39 +00:00
|
|
|
bool Save(const QString& FileName);
|
2016-09-25 17:15:30 -07:00
|
|
|
bool Save(QTextStream& Stream);
|
2014-12-23 17:02:23 +00:00
|
|
|
void Merge(Project* Other);
|
2017-06-25 18:20:34 -07:00
|
|
|
bool ImportLDD(const QString& FileName);
|
2017-08-20 13:47:53 -07:00
|
|
|
bool ImportInventory(const QByteArray& Inventory, const QString& Name, const QString& Description);
|
2014-12-04 01:47:28 +00:00
|
|
|
|
2015-01-12 05:02:50 +00:00
|
|
|
void SaveImage();
|
2019-05-27 16:39:51 -07:00
|
|
|
bool ExportModel(const QString& FileName, lcModel* Model) const;
|
2015-03-27 20:20:12 +00:00
|
|
|
void Export3DStudio(const QString& FileName);
|
2014-12-30 16:30:12 +00:00
|
|
|
void ExportBrickLink();
|
2017-08-25 16:10:06 -07:00
|
|
|
void ExportCOLLADA(const QString& FileName);
|
2014-12-30 16:30:12 +00:00
|
|
|
void ExportCSV();
|
2017-12-11 11:14:37 -08:00
|
|
|
void ExportHTML(const lcHTMLExportOptions& Options);
|
2017-09-22 10:08:02 -07:00
|
|
|
bool ExportPOVRay(const QString& FileName);
|
2015-01-23 01:58:33 +00:00
|
|
|
void ExportWavefront(const QString& FileName);
|
2014-12-30 16:30:12 +00:00
|
|
|
|
2016-11-25 17:12:19 -08:00
|
|
|
void UpdatePieceInfo(PieceInfo* Info) const;
|
|
|
|
|
2014-12-08 07:32:39 +00:00
|
|
|
protected:
|
2015-03-27 20:39:43 +00:00
|
|
|
QString GetExportFileName(const QString& FileName, const QString& DefaultExtension, const QString& DialogTitle, const QString& DialogFilter) const;
|
2019-05-27 16:39:51 -07:00
|
|
|
std::vector<lcModelPartsEntry> GetModelParts();
|
2018-01-02 06:10:58 -08:00
|
|
|
void SetFileName(const QString& FileName);
|
2014-12-30 16:30:12 +00:00
|
|
|
|
2014-12-08 07:32:39 +00:00
|
|
|
bool mModified;
|
|
|
|
QString mFileName;
|
2018-01-02 06:10:58 -08:00
|
|
|
QFileSystemWatcher mFileWatcher;
|
2014-12-04 01:47:28 +00:00
|
|
|
|
2014-12-08 07:32:39 +00:00
|
|
|
lcArray<lcModel*> mModels;
|
|
|
|
lcModel* mActiveModel;
|
|
|
|
|
|
|
|
Q_DECLARE_TR_FUNCTIONS(Project);
|
2011-09-07 21:06:51 +00:00
|
|
|
};
|
|
|
|
|
2014-12-08 07:32:39 +00:00
|
|
|
inline lcModel* lcGetActiveModel()
|
|
|
|
{
|
2020-03-22 20:18:52 -07:00
|
|
|
const Project* const Project = lcGetActiveProject();
|
2017-04-13 17:26:40 -07:00
|
|
|
return Project ? Project->GetActiveModel() : nullptr;
|
2014-12-08 07:32:39 +00:00
|
|
|
}
|
|
|
|
|