2021-01-06 03:48:12 +01:00
|
|
|
#pragma once
|
|
|
|
|
2021-01-15 03:19:58 +01:00
|
|
|
#include "lc_math.h"
|
|
|
|
|
2021-01-07 19:46:57 +01:00
|
|
|
struct lcInstructionsPageSetup
|
|
|
|
{
|
|
|
|
float Width;
|
|
|
|
float Height;
|
|
|
|
float MarginLeft;
|
|
|
|
float MarginRight;
|
|
|
|
float MarginTop;
|
|
|
|
float MarginBottom;
|
|
|
|
};
|
|
|
|
|
2021-01-06 03:48:12 +01:00
|
|
|
enum class lcInstructionsDirection
|
|
|
|
{
|
|
|
|
Horizontal,
|
|
|
|
Vertical
|
|
|
|
};
|
|
|
|
|
|
|
|
struct lcInstructionsPageSettings
|
|
|
|
{
|
|
|
|
int Rows;
|
|
|
|
int Columns;
|
|
|
|
lcInstructionsDirection Direction;
|
|
|
|
};
|
|
|
|
|
2021-01-15 03:19:58 +01:00
|
|
|
enum class lcInstructionsPropertyMode
|
|
|
|
{
|
|
|
|
NotSet,
|
2021-01-15 23:24:44 +01:00
|
|
|
Default,
|
|
|
|
Model,
|
|
|
|
StepForward,
|
2021-01-15 03:19:58 +01:00
|
|
|
StepOnly
|
|
|
|
};
|
|
|
|
|
2021-01-16 02:50:15 +01:00
|
|
|
enum class lcInstructionsPropertyType
|
2021-01-15 03:19:58 +01:00
|
|
|
{
|
2021-01-17 20:05:50 +01:00
|
|
|
ShowStepNumber,
|
|
|
|
ShowStepPLI,
|
2021-01-16 02:50:15 +01:00
|
|
|
StepNumberFont,
|
|
|
|
StepNumberColor,
|
|
|
|
StepBackgroundColor,
|
2021-01-16 23:43:24 +01:00
|
|
|
PLIBackgroundColor,
|
|
|
|
PLIFont,
|
|
|
|
PLITextColor,
|
|
|
|
PLIBorderColor,
|
|
|
|
// PLIBorderWidth,
|
|
|
|
// PLIBorderRound,
|
|
|
|
// pli: spacing and margins, text alignment
|
2021-01-16 02:50:15 +01:00
|
|
|
Count
|
|
|
|
};
|
2021-01-15 23:24:44 +01:00
|
|
|
|
2021-01-16 02:50:15 +01:00
|
|
|
struct lcInstructionsProperty
|
|
|
|
{
|
|
|
|
lcInstructionsPropertyMode Mode = lcInstructionsPropertyMode::NotSet;
|
|
|
|
QVariant Value;
|
2021-01-15 03:19:58 +01:00
|
|
|
};
|
|
|
|
|
2021-01-16 02:50:15 +01:00
|
|
|
using lcInstructionsProperties = std::array<lcInstructionsProperty, static_cast<int>(lcInstructionsPropertyType::Count)>;
|
|
|
|
|
2021-01-06 03:48:12 +01:00
|
|
|
struct lcInstructionsStep
|
|
|
|
{
|
|
|
|
QRectF Rect;
|
|
|
|
lcModel* Model;
|
|
|
|
lcStep Step;
|
2021-01-15 03:19:58 +01:00
|
|
|
|
2021-01-16 02:50:15 +01:00
|
|
|
lcInstructionsProperties Properties;
|
2021-01-06 03:48:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct lcInstructionsPage
|
|
|
|
{
|
|
|
|
// lcInstructionsPageSettings Settings;
|
|
|
|
std::vector<lcInstructionsStep> Steps;
|
|
|
|
};
|
|
|
|
|
2021-01-15 03:19:58 +01:00
|
|
|
struct lcInstructionsModel
|
|
|
|
{
|
2021-01-16 02:50:15 +01:00
|
|
|
std::vector<lcInstructionsProperties> StepProperties;
|
2021-01-15 03:19:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class lcInstructions : public QObject
|
2021-01-06 03:48:12 +01:00
|
|
|
{
|
2021-01-15 03:19:58 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
2021-01-06 03:48:12 +01:00
|
|
|
public:
|
|
|
|
lcInstructions(Project* Project = nullptr);
|
|
|
|
|
2021-01-17 20:05:50 +01:00
|
|
|
static QString GetPropertyLabel(lcInstructionsPropertyType Type);
|
|
|
|
|
2021-01-06 03:48:12 +01:00
|
|
|
void SetDefaultPageSettings(const lcInstructionsPageSettings& PageSettings);
|
2021-01-16 00:37:28 +01:00
|
|
|
|
2021-01-17 20:05:50 +01:00
|
|
|
bool GetBoolProperty(lcInstructionsPropertyType Type, lcModel* Model, lcStep Step) const;
|
2021-01-16 02:50:15 +01:00
|
|
|
QColor GetColorProperty(lcInstructionsPropertyType Type, lcModel* Model, lcStep Step) const;
|
|
|
|
QFont GetFontProperty(lcInstructionsPropertyType Type, lcModel* Model, lcStep Step) const;
|
|
|
|
|
2021-01-17 20:05:50 +01:00
|
|
|
void SetDefaultBool(lcInstructionsPropertyType Type, bool Enabled);
|
2021-01-16 02:50:15 +01:00
|
|
|
void SetDefaultColor(lcInstructionsPropertyType Type, const QColor& Color);
|
|
|
|
void SetDefaultFont(lcInstructionsPropertyType Type, const QFont& Font);
|
2021-01-06 03:48:12 +01:00
|
|
|
|
2021-01-17 20:05:50 +01:00
|
|
|
//protected:
|
2021-01-06 03:48:12 +01:00
|
|
|
std::vector<lcInstructionsPage> mPages;
|
|
|
|
lcInstructionsPageSettings mPageSettings;
|
2021-01-07 19:46:57 +01:00
|
|
|
lcInstructionsPageSetup mPageSetup;
|
2021-01-16 02:50:15 +01:00
|
|
|
lcInstructionsProperties mStepProperties;
|
2021-01-15 03:19:58 +01:00
|
|
|
|
|
|
|
std::map<lcModel*, lcInstructionsModel> mModels;
|
|
|
|
|
|
|
|
signals:
|
2021-01-16 20:11:59 +01:00
|
|
|
void StepSettingsChanged(lcModel* Model, lcStep Step);
|
2021-01-06 03:48:12 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void CreatePages();
|
|
|
|
void AddDefaultPages(lcModel* Model, std::vector<const lcModel*>& AddedModels);
|
|
|
|
|
2021-01-16 02:50:15 +01:00
|
|
|
QVariant GetProperty(lcInstructionsPropertyType Type, lcModel* Model, lcStep Step) const;
|
|
|
|
void SetDefaultProperty(lcInstructionsPropertyType Type, const QVariant& Value);
|
|
|
|
|
2021-01-06 03:48:12 +01:00
|
|
|
Project* mProject = nullptr;
|
2021-01-07 19:46:57 +01:00
|
|
|
|
|
|
|
static const float mDisplayDPI;
|
2021-01-06 03:48:12 +01:00
|
|
|
};
|