More intuitive edge colour naming

This commit is contained in:
Trevor SANDY 2021-01-26 16:42:19 +01:00
parent 6fe393d147
commit 2801558458
8 changed files with 83 additions and 93 deletions

View file

@ -58,8 +58,8 @@ void lcPreferences::LoadDefaults()
mPreviewViewSphereSize = lcGetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE);
mPreviewViewSphereLocation = static_cast<lcViewSphereLocation>(lcGetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION));
mDrawPreviewAxis = lcGetProfileInt(LC_PROFILE_PREVIEW_DRAW_AXES);
mStudColor = lcGetProfileInt(LC_PROFILE_STUD_COLOR);
mStudEdgeColor = lcGetProfileInt(LC_PROFILE_STUD_EDGE_COLOR);
mStudCylinderColor = lcGetProfileInt(LC_PROFILE_STUD_CYLINDER_COLOR);
mPartEdgeColor = lcGetProfileInt(LC_PROFILE_PART_EDGE_COLOR);
mBlackEdgeColor = lcGetProfileInt(LC_PROFILE_BLACK_EDGE_COLOR);
mDarkEdgeColor = lcGetProfileInt(LC_PROFILE_DARK_EDGE_COLOR);
mPartEdgeContrast = lcGetProfileFloat(LC_PROFILE_PART_EDGE_CONTRAST);
@ -110,8 +110,8 @@ void lcPreferences::SaveDefaults()
lcSetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE, mPreviewViewSphereSize);
lcSetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION, static_cast<int>(mPreviewViewSphereLocation));
lcSetProfileInt(LC_PROFILE_PREVIEW_DRAW_AXES, mDrawPreviewAxis);
lcSetProfileInt(LC_PROFILE_STUD_COLOR, mStudColor);
lcSetProfileInt(LC_PROFILE_STUD_EDGE_COLOR, mStudEdgeColor);
lcSetProfileInt(LC_PROFILE_STUD_CYLINDER_COLOR, mStudCylinderColor);
lcSetProfileInt(LC_PROFILE_PART_EDGE_COLOR, mPartEdgeColor);
lcSetProfileInt(LC_PROFILE_BLACK_EDGE_COLOR, mBlackEdgeColor);
lcSetProfileInt(LC_PROFILE_DARK_EDGE_COLOR, mDarkEdgeColor);
lcSetProfileFloat(LC_PROFILE_PART_EDGE_CONTRAST, mPartEdgeContrast);
@ -1161,8 +1161,8 @@ void lcApplication::ShowPreferencesDialog()
bool AAChanged = CurrentAASamples != Options.AASamples;
bool StudStyleChanged = CurrentStudStyle != Options.StudStyle;
bool AutomateEdgeColorChanged = Options.Preferences.mAutomateEdgeColor != mPreferences.mAutomateEdgeColor;
AutomateEdgeColorChanged |= Options.Preferences.mStudColor != mPreferences.mStudColor;
AutomateEdgeColorChanged |= Options.Preferences.mStudEdgeColor != mPreferences.mStudEdgeColor;
AutomateEdgeColorChanged |= Options.Preferences.mStudCylinderColor != mPreferences.mStudCylinderColor;
AutomateEdgeColorChanged |= Options.Preferences.mPartEdgeColor != mPreferences.mPartEdgeColor;
AutomateEdgeColorChanged |= Options.Preferences.mBlackEdgeColor != mPreferences.mBlackEdgeColor;
AutomateEdgeColorChanged |= Options.Preferences.mDarkEdgeColor != mPreferences.mDarkEdgeColor;
AutomateEdgeColorChanged |= Options.Preferences.mPartEdgeContrast != mPreferences.mPartEdgeContrast;

View file

@ -73,8 +73,8 @@ public:
lcViewSphereLocation mPreviewViewSphereLocation;
int mDrawPreviewAxis;
quint32 mStudColor;
quint32 mStudEdgeColor;
quint32 mStudCylinderColor;
quint32 mPartEdgeColor;
quint32 mBlackEdgeColor;
quint32 mDarkEdgeColor;
float mPartEdgeContrast;

View file

@ -245,7 +245,7 @@ static void lcAdjustStudStyleColors(std::vector<lcColor>& Colors, lcStudStyle St
if (StudStyle != lcStudStyle::HighContrast && StudStyle != lcStudStyle::HighContrastLogo)
return;
const lcVector4 Edge = lcVector4FromColor(Preferences.mStudEdgeColor);
const lcVector4 Edge = lcVector4FromColor(Preferences.mPartEdgeColor);
const lcVector4 DarkEdge = lcVector4FromColor(Preferences.mDarkEdgeColor);
const lcVector4 BlackEdge = lcVector4FromColor(Preferences.mBlackEdgeColor);
@ -468,17 +468,17 @@ bool lcLoadColorFile(lcFile& File, lcStudStyle StudStyle)
if (!FoundStud)
{
const lcPreferences& Preferences = lcGetPreferences();
lcColor StudColor;
lcColor StudCylinderColor;
StudColor.Code = 4242;
StudColor.Translucent = false;
StudColor.Group = LC_NUM_COLORGROUPS;
StudColor.Value = lcVector4FromColor(Preferences.mStudColor);
StudColor.Edge = lcVector4FromColor(Preferences.mStudEdgeColor);
strcpy(StudColor.Name, "Stud Style Black");
strcpy(StudColor.SafeName, "Stud_Style_Black");
StudCylinderColor.Code = 4242;
StudCylinderColor.Translucent = false;
StudCylinderColor.Group = LC_NUM_COLORGROUPS;
StudCylinderColor.Value = lcVector4FromColor(Preferences.mStudCylinderColor);
StudCylinderColor.Edge = lcVector4FromColor(Preferences.mPartEdgeColor);
strcpy(StudCylinderColor.Name, "Stud Cylinder Color");
strcpy(StudCylinderColor.SafeName, "Stud_Cylinder_Color");
Colors.push_back(StudColor);
Colors.push_back(StudCylinderColor);
}
for (lcColor& Color : gColorList)

View file

@ -4,8 +4,8 @@
lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowHighContrastDialog)
:QDialog(Parent)
{
mStudColor = lcGetPreferences().mStudColor;
mStudEdgeColor = lcGetPreferences().mStudEdgeColor;
mStudCylinderColor = lcGetPreferences().mStudCylinderColor;
mPartEdgeColor = lcGetPreferences().mPartEdgeColor;
mBlackEdgeColor = lcGetPreferences().mBlackEdgeColor;
mDarkEdgeColor = lcGetPreferences().mDarkEdgeColor;
@ -31,8 +31,7 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowH
emit PartEdgeContrastSlider->valueChanged(PartEdgeContrastSlider->value());
ResetPartEdgeContrastButton = new QToolButton(this);
ResetPartEdgeContrastButton->setText(tr("..."));
ResetPartEdgeContrastButton->setToolTip(tr("Reset"));
ResetPartEdgeContrastButton->setText(tr("Reset"));
connect(ResetPartEdgeContrastButton, SIGNAL(clicked()), this, SLOT(ResetSliderButtonClicked()));
EdgeSettingsLayout->addWidget(PartEdgeContrastLabel,0,0);
@ -50,8 +49,7 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowH
emit PartColorValueLDIndexSlider->valueChanged(PartColorValueLDIndexSlider->value());
ResetPartColorValueLDIndexButton = new QToolButton(this);
ResetPartColorValueLDIndexButton->setText(tr("..."));
ResetPartColorValueLDIndexButton->setToolTip(tr("Reset"));
ResetPartColorValueLDIndexButton->setText(tr("Reset"));
connect(ResetPartColorValueLDIndexButton, SIGNAL(clicked()), this, SLOT(ResetSliderButtonClicked()));
EdgeSettingsLayout->addWidget(PartColorValueLDIndexLabel,1,0);
@ -59,11 +57,11 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowH
EdgeSettingsLayout->addWidget(PartColorValueLDIndex,1,2);
EdgeSettingsLayout->addWidget(ResetPartColorValueLDIndexButton,1,3);
QGroupBox* StudColorBox = new QGroupBox(tr("High Contrast Studs"), this);
StudColorBox->setVisible(ShowHighContrastDialog);
MainLayout->addWidget(StudColorBox);
QGridLayout* StudColorLayout = new QGridLayout(StudColorBox);
StudColorBox->setLayout(StudColorLayout);
QGroupBox* HighContrastColorBox = new QGroupBox(tr("High Contrast"), this);
HighContrastColorBox->setVisible(ShowHighContrastDialog);
MainLayout->addWidget(HighContrastColorBox);
QGridLayout* HighContrastColorLayout = new QGridLayout(HighContrastColorBox);
HighContrastColorBox->setLayout(HighContrastColorLayout);
auto SetButtonPixmap = [](quint32 Color, QToolButton* Button)
{
@ -74,33 +72,31 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowH
Button->setToolTip(ButtonColor.name().toUpper());
};
QLabel* StudColorLabel = new QLabel(tr("Stud Color:"), this);
StudColorButton = new QToolButton(this);
SetButtonPixmap(mStudColor, StudColorButton);
connect(StudColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
QLabel* StudCylinderColorLabel = new QLabel(tr("Stud Cylinder Color:"), this);
StudCylinderColorButton = new QToolButton(this);
SetButtonPixmap(mStudCylinderColor, StudCylinderColorButton);
connect(StudCylinderColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
ResetStudColorButton = new QToolButton(this);
ResetStudColorButton->setText(tr("..."));
ResetStudColorButton->setToolTip(tr("Reset"));
connect(ResetStudColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
ResetStudCylinderColorButton = new QToolButton(this);
ResetStudCylinderColorButton->setText(tr("Reset"));;
connect(ResetStudCylinderColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
StudColorLayout->addWidget(StudColorLabel,0,0);
StudColorLayout->addWidget(StudColorButton,0,1);
StudColorLayout->addWidget(ResetStudColorButton,0,2);
HighContrastColorLayout->addWidget(StudCylinderColorLabel,0,0);
HighContrastColorLayout->addWidget(StudCylinderColorButton,0,1);
HighContrastColorLayout->addWidget(ResetStudCylinderColorButton,0,2);
QLabel* StudEdgeColorLabel = new QLabel(tr("Stud Edge Color:"), this);
StudEdgeColorButton = new QToolButton(this);
SetButtonPixmap(mStudEdgeColor, StudEdgeColorButton);
connect(StudEdgeColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
QLabel* PartEdgeColorLabel = new QLabel(tr("Parts Edge Color:"), this);
PartEdgeColorButton = new QToolButton(this);
SetButtonPixmap(mPartEdgeColor, PartEdgeColorButton);
connect(PartEdgeColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
ResetStudEdgeColorButton = new QToolButton(this);
ResetStudEdgeColorButton->setText(tr("..."));
ResetStudEdgeColorButton->setToolTip(tr("Reset"));
connect(ResetStudEdgeColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
ResetPartEdgeColorButton = new QToolButton(this);
ResetPartEdgeColorButton->setText(tr("Reset"));
connect(ResetPartEdgeColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
StudColorLayout->addWidget(StudEdgeColorLabel,1,0);
StudColorLayout->addWidget(StudEdgeColorButton,1,1);
StudColorLayout->addWidget(ResetStudEdgeColorButton,1,2);
HighContrastColorLayout->addWidget(PartEdgeColorLabel,1,0);
HighContrastColorLayout->addWidget(PartEdgeColorButton,1,1);
HighContrastColorLayout->addWidget(ResetPartEdgeColorButton,1,2);
QLabel* BlackEdgeColorLabel = new QLabel(tr("Black Parts Edge Color:"), this);
BlackEdgeColorButton = new QToolButton(this);
@ -108,13 +104,12 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowH
connect(BlackEdgeColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
ResetBlackEdgeColorButton = new QToolButton(this);
ResetBlackEdgeColorButton->setText(tr("..."));
ResetBlackEdgeColorButton->setToolTip(tr("Reset"));
ResetBlackEdgeColorButton->setText(tr("Reset"));
connect(ResetBlackEdgeColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
StudColorLayout->addWidget(BlackEdgeColorLabel,2,0);
StudColorLayout->addWidget(BlackEdgeColorButton,2,1);
StudColorLayout->addWidget(ResetBlackEdgeColorButton,2,2);
HighContrastColorLayout->addWidget(BlackEdgeColorLabel,2,0);
HighContrastColorLayout->addWidget(BlackEdgeColorButton,2,1);
HighContrastColorLayout->addWidget(ResetBlackEdgeColorButton,2,2);
QLabel* DarkEdgeColorLabel = new QLabel(tr("Dark Parts Edge Color:"), this);
DarkEdgeColorButton = new QToolButton(this);
@ -122,13 +117,12 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowH
connect(DarkEdgeColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
ResetDarkEdgeColorButton = new QToolButton(this);
ResetDarkEdgeColorButton->setText(tr("..."));
ResetDarkEdgeColorButton->setToolTip(tr("Reset"));
ResetDarkEdgeColorButton->setText(tr("Reset"));
connect(ResetDarkEdgeColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
StudColorLayout->addWidget(DarkEdgeColorLabel,3,0);
StudColorLayout->addWidget(DarkEdgeColorButton,3,1);
StudColorLayout->addWidget(ResetDarkEdgeColorButton,3,2);
HighContrastColorLayout->addWidget(DarkEdgeColorLabel,3,0);
HighContrastColorLayout->addWidget(DarkEdgeColorButton,3,1);
HighContrastColorLayout->addWidget(ResetDarkEdgeColorButton,3,2);
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
MainLayout->addWidget(buttonBox);
@ -159,23 +153,22 @@ void lcAutomateEdgeColorDialog::ColorButtonClicked()
quint32* Color = nullptr;
QColorDialog::ColorDialogOptions DialogOptions;
if (Button == StudColorButton)
if (Button == StudCylinderColorButton)
{
Title = tr("Select Stud Color");
Color = &mStudColor;
Title = tr("Select Stud Cylinder Color");
Color = &mStudCylinderColor;
}
else if (Button == StudEdgeColorButton)
else if (Button == PartEdgeColorButton)
{
Title = tr("Select Stud Edge Color");
Color = &mStudEdgeColor;
Title = tr("Select Part Edge Color");
Color = &mPartEdgeColor;
}
else if (Button == BlackEdgeColorButton)
{
if (lcGetPreferences().mAutomateEdgeColor)
{
QMessageBox msgBox;
msgBox.setText("Automate edge colour appears to be enabled.<br>"
"Black parts edge color setting will not be accessible.");
msgBox.setText("Automate edge color appears to be enabled.<br>Black parts edge color will not be accessible.<br>Do you want to continue ?");
if (msgBox.exec() != QMessageBox::Accepted)
return;
}
@ -187,8 +180,7 @@ void lcAutomateEdgeColorDialog::ColorButtonClicked()
if (lcGetPreferences().mAutomateEdgeColor)
{
QMessageBox msgBox;
msgBox.setText("Automate edge colour appears to be enabled.<br>"
"Dark parts edge color setting will not be accessible.");
msgBox.setText("Automate edge color appears to be enabled.<br>Dark parts edge color will not be accessible.<br>Do you want to continue ?");
if (msgBox.exec() != QMessageBox::Accepted)
return;
}
@ -218,12 +210,10 @@ void lcAutomateEdgeColorDialog::ResetSliderButtonClicked()
if (sender() == ResetPartEdgeContrastButton)
{
PartEdgeContrastSlider->setValue(0.5f * 100);
emit PartEdgeContrastSlider->valueChanged(PartEdgeContrastSlider->value());
}
else if (sender() == ResetPartColorValueLDIndexButton)
{
PartColorValueLDIndexSlider->setValue(0.5f * 100);
emit PartColorValueLDIndexSlider->valueChanged(PartColorValueLDIndexSlider->value());
}
}
@ -233,23 +223,23 @@ void lcAutomateEdgeColorDialog::ResetColorButtonClicked()
QPixmap Pix(12, 12);
QColor ResetColor;
if (sender() == ResetStudColorButton)
if (sender() == ResetStudCylinderColorButton)
{
Color = &mStudColor;
Color = &mStudCylinderColor;
*Color = LC_RGBA(27, 42, 52, 255);
ResetColor = QColor(LC_RGBA_RED(*Color), LC_RGBA_GREEN(*Color), LC_RGBA_BLUE(*Color), LC_RGBA_ALPHA(*Color));
Pix.fill(ResetColor);
StudColorButton->setIcon(Pix);
StudColorButton->setToolTip(ResetColor.name().toUpper());
StudCylinderColorButton->setIcon(Pix);
StudCylinderColorButton->setToolTip(ResetColor.name().toUpper());
}
else if (sender() == ResetStudEdgeColorButton)
else if (sender() == ResetPartEdgeColorButton)
{
Color = &mStudEdgeColor;
Color = &mPartEdgeColor;
*Color = LC_RGBA(0, 0, 0, 255);
ResetColor = QColor(LC_RGBA_RED(*Color), LC_RGBA_GREEN(*Color), LC_RGBA_BLUE(*Color), LC_RGBA_ALPHA(*Color));
Pix.fill(ResetColor);
StudEdgeColorButton->setIcon(Pix);
StudEdgeColorButton->setToolTip(ResetColor.name().toUpper());
PartEdgeColorButton->setIcon(Pix);
PartEdgeColorButton->setToolTip(ResetColor.name().toUpper());
}
else if (sender() == ResetBlackEdgeColorButton)
{

View file

@ -7,8 +7,8 @@ class lcAutomateEdgeColorDialog : public QDialog
Q_OBJECT
public:
lcAutomateEdgeColorDialog(QWidget *Parent, bool ShowHighContrastDialog);
quint32 mStudColor;
quint32 mStudEdgeColor;
quint32 mStudCylinderColor;
quint32 mPartEdgeColor;
quint32 mDarkEdgeColor;
quint32 mBlackEdgeColor;
float mPartEdgeContrast;
@ -30,13 +30,13 @@ protected:
QToolButton* ResetPartEdgeContrastButton;
QToolButton* ResetPartColorValueLDIndexButton;
QToolButton* StudColorButton;
QToolButton* StudEdgeColorButton;
QToolButton* StudCylinderColorButton;
QToolButton* PartEdgeColorButton;
QToolButton* BlackEdgeColorButton;
QToolButton* DarkEdgeColorButton;
QToolButton* ResetStudColorButton;
QToolButton* ResetStudEdgeColorButton;
QToolButton* ResetStudCylinderColorButton;
QToolButton* ResetPartEdgeColorButton;
QToolButton* ResetBlackEdgeColorButton;
QToolButton* ResetDarkEdgeColorButton;
};

View file

@ -140,8 +140,8 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
lcProfileEntry("Settings", "PreviewViewSphereLocation", (int)lcViewSphereLocation::TopRight), // LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION
lcProfileEntry("Settings", "DrawPreviewAxis", 0), // LC_PROFILE_PREVIEW_DRAW_AXES
lcProfileEntry("Settings", "StudColor", LC_RGBA(27, 42, 52, 255)), // LC_PROFILE_STUD_COLOR
lcProfileEntry("Settings", "StudEdgeColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_STUD_EDGE_COLOR
lcProfileEntry("Settings", "StudCylinderColor", LC_RGBA(27, 42, 52, 255)), // LC_PROFILE_STUD_CYLINDER_COLOR
lcProfileEntry("Settings", "PartEdgeColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_PART_EDGE_COLOR
lcProfileEntry("Settings", "BlackEdgeColor", LC_RGBA(255, 255, 255, 255)), // LC_PROFILE_BLACK_EDGE_COLOR
lcProfileEntry("Settings", "DarkEdgeColor", LC_RGBA(27, 42, 52, 255)), // LC_PROFILE_DARK_EDGE_COLOR
lcProfileEntry("Settings", "PartEdgeContrast", 0.5f), // LC_PROFILE_PART_EDGE_CONTRAST

View file

@ -88,8 +88,8 @@ enum LC_PROFILE_KEY
LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION,
LC_PROFILE_PREVIEW_DRAW_AXES,
LC_PROFILE_STUD_COLOR,
LC_PROFILE_STUD_EDGE_COLOR,
LC_PROFILE_STUD_CYLINDER_COLOR,
LC_PROFILE_PART_EDGE_COLOR,
LC_PROFILE_BLACK_EDGE_COLOR,
LC_PROFILE_DARK_EDGE_COLOR,
LC_PROFILE_PART_EDGE_CONTRAST,

View file

@ -569,8 +569,8 @@ void lcQPreferencesDialog::AutomateEdgeColor()
lcAutomateEdgeColorDialog Dialog(this, sender() == ui->HighContrastButton);
if (Dialog.exec() == QDialog::Accepted)
{
mOptions->Preferences.mStudColor = Dialog.mStudColor;
mOptions->Preferences.mStudEdgeColor = Dialog.mStudEdgeColor;
mOptions->Preferences.mStudCylinderColor = Dialog.mStudCylinderColor;
mOptions->Preferences.mPartEdgeColor = Dialog.mPartEdgeColor;
mOptions->Preferences.mBlackEdgeColor = Dialog.mBlackEdgeColor;
mOptions->Preferences.mDarkEdgeColor = Dialog.mDarkEdgeColor;
mOptions->Preferences.mPartEdgeContrast = Dialog.mPartEdgeContrast;