diff --git a/common/lc_application.cpp b/common/lc_application.cpp index cbd0fc21..054c2f1f 100644 --- a/common/lc_application.cpp +++ b/common/lc_application.cpp @@ -60,6 +60,8 @@ void lcPreferences::LoadDefaults() mDrawPreviewAxis = lcGetProfileInt(LC_PROFILE_PREVIEW_DRAW_AXES); mStudColor = lcGetProfileInt(LC_PROFILE_STUD_COLOR); mStudEdgeColor = lcGetProfileInt(LC_PROFILE_STUD_EDGE_COLOR); + mBlackEdgeColor = lcGetProfileInt(LC_PROFILE_BLACK_EDGE_COLOR); + mDarkEdgeColor = lcGetProfileInt(LC_PROFILE_DARK_EDGE_COLOR); mPartEdgeContrast = lcGetProfileFloat(LC_PROFILE_PART_EDGE_CONTRAST); mPartEdgeGamma = lcGetProfileFloat(LC_PROFILE_PART_EDGE_GAMMA); mPartColorValueLDIndex = lcGetProfileFloat(LC_PROFILE_PART_COLOR_VALUE_LD_INDEX); @@ -111,6 +113,8 @@ void lcPreferences::SaveDefaults() lcSetProfileInt(LC_PROFILE_PREVIEW_DRAW_AXES, mDrawPreviewAxis); lcSetProfileInt(LC_PROFILE_STUD_COLOR, mStudColor); lcSetProfileInt(LC_PROFILE_STUD_EDGE_COLOR, mStudEdgeColor); + lcSetProfileInt(LC_PROFILE_BLACK_EDGE_COLOR, mBlackEdgeColor); + lcSetProfileInt(LC_PROFILE_DARK_EDGE_COLOR, mDarkEdgeColor); lcSetProfileFloat(LC_PROFILE_PART_EDGE_CONTRAST, mPartEdgeContrast); lcSetProfileFloat(LC_PROFILE_PART_EDGE_GAMMA, mPartEdgeGamma); lcSetProfileFloat(LC_PROFILE_PART_COLOR_VALUE_LD_INDEX, mPartColorValueLDIndex); @@ -1161,11 +1165,14 @@ void lcApplication::ShowPreferencesDialog() bool AutomateEdgeColorChanged = Options.Preferences.mAutomateEdgeColor != bool(lcGetProfileInt(LC_PROFILE_AUTOMATE_EDGE_COLOR)); bool StudColorChanged = Options.Preferences.mStudColor != quint32(lcGetProfileInt(LC_PROFILE_STUD_COLOR)); bool StudEdgeColorChanged = Options.Preferences.mStudEdgeColor != quint32(lcGetProfileInt(LC_PROFILE_STUD_EDGE_COLOR)); + bool BlackEdgeColorChanged = Options.Preferences.mBlackEdgeColor != quint32(lcGetProfileInt(LC_PROFILE_BLACK_EDGE_COLOR)); + bool DarkEdgeColorChanged = Options.Preferences.mDarkEdgeColor != quint32(lcGetProfileInt(LC_PROFILE_DARK_EDGE_COLOR)); bool PartEdgeContrastChanged = Options.Preferences.mPartEdgeContrast != lcGetProfileFloat(LC_PROFILE_PART_EDGE_CONTRAST); bool PartEdgeGammaChanged = Options.Preferences.mPartEdgeGamma != lcGetProfileFloat(LC_PROFILE_PART_EDGE_GAMMA); bool PartColorValueLDIndexChanged = Options.Preferences.mPartColorValueLDIndex != lcGetProfileFloat(LC_PROFILE_PART_COLOR_VALUE_LD_INDEX); + if (!AutomateEdgeColorChanged) - AutomateEdgeColorChanged = (StudColorChanged || StudEdgeColorChanged || PartEdgeContrastChanged || PartEdgeGammaChanged || PartColorValueLDIndexChanged); + AutomateEdgeColorChanged = (StudColorChanged || StudEdgeColorChanged || BlackEdgeColorChanged || DarkEdgeColorChanged || PartEdgeContrastChanged || PartEdgeGammaChanged || PartColorValueLDIndexChanged); mPreferences = Options.Preferences; diff --git a/common/lc_application.h b/common/lc_application.h index ec4a24a0..4c6c4ca8 100644 --- a/common/lc_application.h +++ b/common/lc_application.h @@ -75,6 +75,8 @@ public: quint32 mStudColor; quint32 mStudEdgeColor; + quint32 mBlackEdgeColor; + quint32 mDarkEdgeColor; float mPartEdgeContrast; float mPartEdgeGamma; float mPartColorValueLDIndex; diff --git a/common/lc_colors.cpp b/common/lc_colors.cpp index d995dd0f..1f97afb1 100644 --- a/common/lc_colors.cpp +++ b/common/lc_colors.cpp @@ -240,17 +240,28 @@ static void lcAdjustStudStyleColors(std::vector& Colors, lcStudStyle St else if (StudStyle != lcStudStyle::HighContrast && StudStyle != lcStudStyle::HighContrastLogo) return; + const lcVector4 Edge(LC_RGBA_RED(lcGetPreferences().mStudEdgeColor), + LC_RGBA_GREEN(lcGetPreferences().mStudEdgeColor), + LC_RGBA_BLUE(lcGetPreferences().mStudEdgeColor), + LC_RGBA_ALPHA(lcGetPreferences().mStudEdgeColor)); + const lcVector4 DarkEdge(LC_RGBA_RED(lcGetPreferences().mDarkEdgeColor), + LC_RGBA_GREEN(lcGetPreferences().mDarkEdgeColor), + LC_RGBA_BLUE(lcGetPreferences().mDarkEdgeColor), + LC_RGBA_ALPHA(lcGetPreferences().mDarkEdgeColor)); + const lcVector4 BlackEdge(LC_RGBA_RED(lcGetPreferences().mBlackEdgeColor), + LC_RGBA_GREEN(lcGetPreferences().mBlackEdgeColor), + LC_RGBA_BLUE(lcGetPreferences().mBlackEdgeColor), + LC_RGBA_ALPHA(lcGetPreferences().mBlackEdgeColor)); + for (lcColor& Color : Colors) { const lcVector4 FillColor = Color.Value * 255.0f; - lcVector4 EdgeColor(0.0f, 0.0f, 0.0f, 255.0f); - if (30.0f * FillColor[0] + 59.0f * FillColor[1] + 11.0f * FillColor[2] <= 3600.0f) - EdgeColor = lcVector4(27.0f, 42.0f, 52.0f, 255.0f); + Color.Edge = DarkEdge / 255.0f; else if (Color.Code == 0) - EdgeColor = lcVector4(255.0f, 255.0f, 255.0f, 255.0f); - - Color.Edge = EdgeColor / 255.0f; + Color.Edge = BlackEdge / 255.0f; + else + Color.Edge = Edge / 255.0f; } } diff --git a/common/lc_edgecolordialog.cpp b/common/lc_edgecolordialog.cpp index c860497f..6bd8b0df 100644 --- a/common/lc_edgecolordialog.cpp +++ b/common/lc_edgecolordialog.cpp @@ -3,11 +3,14 @@ #define MIN_GAMMA 1.0f -lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent) +lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowHighContrastDialog) :QDialog(Parent) { mStudColor = lcGetPreferences().mStudColor; mStudEdgeColor = lcGetPreferences().mStudEdgeColor; + mBlackEdgeColor = lcGetPreferences().mBlackEdgeColor; + mDarkEdgeColor = lcGetPreferences().mDarkEdgeColor; + mPartEdgeContrast = lcGetPreferences().mPartEdgeContrast; mPartEdgeGamma = lcGetPreferences().mPartEdgeGamma; mPartColorValueLDIndex = lcGetPreferences().mPartColorValueLDIndex; @@ -16,6 +19,7 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent) QVBoxLayout* MainLayout = new QVBoxLayout(this); QGroupBox* EdgeSettingsBox = new QGroupBox(tr("Edge Colors"), this); + EdgeSettingsBox->setVisible(!ShowHighContrastDialog); MainLayout->addWidget(EdgeSettingsBox); QGridLayout* EdgeSettingsLayout = new QGridLayout(EdgeSettingsBox); EdgeSettingsBox->setLayout(EdgeSettingsLayout); @@ -60,6 +64,7 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent) EdgeSettingsLayout->addWidget(PartColorValueLDIndex,2,2); QGroupBox* StudColorBox = new QGroupBox(tr("High Contrast Studs"), this); + StudColorBox->setVisible(ShowHighContrastDialog); MainLayout->addWidget(StudColorBox); QGridLayout* StudColorLayout = new QGridLayout(StudColorBox); StudColorBox->setLayout(StudColorLayout); @@ -101,6 +106,34 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent) StudColorLayout->addWidget(StudEdgeColorButton,1,1); StudColorLayout->addWidget(ResetStudEdgeColorButton,1,2); + QLabel* BlackEdgeColorLabel = new QLabel(tr("Black Parts Edge Color:"), this); + BlackEdgeColorButton = new QToolButton(this); + SetButtonPixmap(mBlackEdgeColor, BlackEdgeColorButton); + connect(BlackEdgeColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked())); + + ResetBlackEdgeColorButton = new QToolButton(this); + ResetBlackEdgeColorButton->setText(tr("...")); + ResetBlackEdgeColorButton->setToolTip(tr("Reset")); + connect(ResetBlackEdgeColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked())); + + StudColorLayout->addWidget(BlackEdgeColorLabel,2,0); + StudColorLayout->addWidget(BlackEdgeColorButton,2,1); + StudColorLayout->addWidget(ResetBlackEdgeColorButton,2,2); + + QLabel* DarkEdgeColorLabel = new QLabel(tr("Dark Parts Edge Color:"), this); + DarkEdgeColorButton = new QToolButton(this); + SetButtonPixmap(mDarkEdgeColor, DarkEdgeColorButton); + connect(DarkEdgeColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked())); + + ResetDarkEdgeColorButton = new QToolButton(this); + ResetDarkEdgeColorButton->setText(tr("...")); + ResetDarkEdgeColorButton->setToolTip(tr("Reset")); + connect(ResetDarkEdgeColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked())); + + StudColorLayout->addWidget(DarkEdgeColorLabel,3,0); + StudColorLayout->addWidget(DarkEdgeColorButton,3,1); + StudColorLayout->addWidget(ResetDarkEdgeColorButton,3,2); + QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); MainLayout->addWidget(buttonBox); QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); @@ -145,6 +178,16 @@ void lcAutomateEdgeColorDialog::ColorButtonClicked() Title = tr("Select Stud Edge Color"); Color = &mStudEdgeColor; } + else if (Button == BlackEdgeColorButton) + { + Title = tr("Select Black Edge Color"); + Color = &mBlackEdgeColor; + } + else if (Button == DarkEdgeColorButton) + { + Title = tr("Select Dark Edge Color"); + Color = &mDarkEdgeColor; + } else return; @@ -172,7 +215,7 @@ void lcAutomateEdgeColorDialog::ResetColorButtonClicked() if (sender() == StudColorButton) { Color = &mStudColor; - *Color = LC_RGBA(27, 42, 52, 255); + *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); @@ -181,10 +224,28 @@ void lcAutomateEdgeColorDialog::ResetColorButtonClicked() else if (sender() == StudEdgeColorButton) { Color = &mStudEdgeColor; - *Color = LC_RGBA(0, 0, 0, 255); + *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()); } + else if (sender() == BlackEdgeColorButton) + { + Color = &mBlackEdgeColor; + *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); + BlackEdgeColorButton->setIcon(Pix); + BlackEdgeColorButton->setToolTip(ResetColor.name().toUpper()); + } + else if (sender() == DarkEdgeColorButton) + { + Color = &mDarkEdgeColor; + *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); + DarkEdgeColorButton->setIcon(Pix); + DarkEdgeColorButton->setToolTip(ResetColor.name().toUpper()); + } } diff --git a/common/lc_edgecolordialog.h b/common/lc_edgecolordialog.h index df7d598f..35e46b77 100644 --- a/common/lc_edgecolordialog.h +++ b/common/lc_edgecolordialog.h @@ -6,9 +6,11 @@ class lcAutomateEdgeColorDialog : public QDialog { Q_OBJECT public: - lcAutomateEdgeColorDialog(QWidget *Parent); + lcAutomateEdgeColorDialog(QWidget *Parent, bool ShowHighContrastDialog); quint32 mStudColor; quint32 mStudEdgeColor; + quint32 mDarkEdgeColor; + quint32 mBlackEdgeColor; float mPartEdgeContrast; float mPartEdgeGamma; float mPartColorValueLDIndex; @@ -23,13 +25,18 @@ protected: QSlider* PartColorValueLDIndexSlider; QSlider* PartEdgeContrastSlider; - QToolButton* StudColorButton; - QToolButton* StudEdgeColorButton; - QToolButton* ResetStudColorButton; - QToolButton* ResetStudEdgeColorButton; - QLabel* PartEdgeContrast; QLabel* PartEdgeGamma; QLabel* PartColorValueLDIndex; + + QToolButton* StudColorButton; + QToolButton* StudEdgeColorButton; + QToolButton* BlackEdgeColorButton; + QToolButton* DarkEdgeColorButton; + + QToolButton* ResetStudColorButton; + QToolButton* ResetStudEdgeColorButton; + QToolButton* ResetBlackEdgeColorButton; + QToolButton* ResetDarkEdgeColorButton; }; diff --git a/common/lc_profile.cpp b/common/lc_profile.cpp index 04af1bdc..ef2cb912 100644 --- a/common/lc_profile.cpp +++ b/common/lc_profile.cpp @@ -142,9 +142,11 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] = 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", "PartEdgeContrast", 0.50f), // LC_PROFILE_PART_EDGE_CONTRAST - lcProfileEntry("Settings", "PartEdgeGamma", 2.20f), // LC_PROFILE_PART_EDGE_GAMMA - lcProfileEntry("Settings", "PartColorValueLDIndex", 0.50f), // LC_PROFILE_PART_COLOR_VALUE_LD_INDEX + 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 + lcProfileEntry("Settings", "PartEdgeGamma", 1.8f), // LC_PROFILE_PART_EDGE_GAMMA + lcProfileEntry("Settings", "mPartColorValueLDIndex", 0.5f), // LC_PROFILE_PART_COLOR_VALUE_LD_INDEX lcProfileEntry("Settings", "AutomateEdgeColor", 0) // LC_PROFILE_AUTOMATE_EDGE_COLOR }; diff --git a/common/lc_profile.h b/common/lc_profile.h index a6f24b0c..c8c347ae 100644 --- a/common/lc_profile.h +++ b/common/lc_profile.h @@ -90,6 +90,8 @@ enum LC_PROFILE_KEY LC_PROFILE_STUD_COLOR, LC_PROFILE_STUD_EDGE_COLOR, + LC_PROFILE_BLACK_EDGE_COLOR, + LC_PROFILE_DARK_EDGE_COLOR, LC_PROFILE_PART_EDGE_CONTRAST, LC_PROFILE_PART_EDGE_GAMMA, LC_PROFILE_PART_COLOR_VALUE_LD_INDEX, diff --git a/qt/lc_qpreferencesdialog.cpp b/qt/lc_qpreferencesdialog.cpp index d8811421..b80c1383 100644 --- a/qt/lc_qpreferencesdialog.cpp +++ b/qt/lc_qpreferencesdialog.cpp @@ -47,6 +47,7 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO ui->shortcutEdit->installEventFilter(this); connect(ui->commandList, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(commandChanged(QTreeWidgetItem*))); connect(ui->mouseTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(MouseTreeItemChanged(QTreeWidgetItem*))); + connect(ui->HighContrastButton, SIGNAL(clicked()), this, SLOT(AutomateEdgeColor())); connect(ui->AutomateEdgeColorButton, SIGNAL(clicked()), this, SLOT(AutomateEdgeColor())); ui->partsLibrary->setText(mOptions->LibraryPath); @@ -557,13 +558,20 @@ void lcQPreferencesDialog::on_AutomateEdgeColor_toggled() ui->AutomateEdgeColorButton->setEnabled(ui->AutomateEdgeColor->isChecked()); } +void lcQPreferencesDialog::on_studStyleCombo_currentIndexChanged(int index) +{ + ui->HighContrastButton->setEnabled(index > static_cast(lcStudStyle::FlattenedLogo)); +} + void lcQPreferencesDialog::AutomateEdgeColor() { - lcAutomateEdgeColorDialog Dialog(this); + lcAutomateEdgeColorDialog Dialog(this, sender() == ui->HighContrastButton); if (Dialog.exec() == QDialog::Accepted) { mOptions->Preferences.mStudColor = Dialog.mStudColor; mOptions->Preferences.mStudEdgeColor = Dialog.mStudEdgeColor; + mOptions->Preferences.mBlackEdgeColor = Dialog.mBlackEdgeColor; + mOptions->Preferences.mDarkEdgeColor = Dialog.mDarkEdgeColor; mOptions->Preferences.mPartEdgeContrast = Dialog.mPartEdgeContrast; mOptions->Preferences.mPartEdgeGamma = Dialog.mPartEdgeGamma; mOptions->Preferences.mPartColorValueLDIndex = Dialog.mPartColorValueLDIndex; diff --git a/qt/lc_qpreferencesdialog.h b/qt/lc_qpreferencesdialog.h index c7694f5d..ccd12427 100644 --- a/qt/lc_qpreferencesdialog.h +++ b/qt/lc_qpreferencesdialog.h @@ -67,6 +67,7 @@ public slots: void ColorButtonClicked(); void AutomateEdgeColor(); void on_AutomateEdgeColor_toggled(); + void on_studStyleCombo_currentIndexChanged(int index); void on_antiAliasing_toggled(); void on_edgeLines_toggled(); void on_LineWidthSlider_valueChanged(); diff --git a/qt/lc_qpreferencesdialog.ui b/qt/lc_qpreferencesdialog.ui index ecb0df31..c79712f3 100644 --- a/qt/lc_qpreferencesdialog.ui +++ b/qt/lc_qpreferencesdialog.ui @@ -402,25 +402,6 @@ - - - - - Wireframe - - - - - Flat Shading - - - - - Default Lights - - - - @@ -547,10 +528,36 @@ - Automate edge color: + Automate edge color + + + + ... + + + + + + + + Wireframe + + + + + Flat Shading + + + + + Default Lights + + + + @@ -1733,6 +1740,7 @@ HighlightNewParts HighlightNewPartsColor studStyleCombo + HighContrastButton ShadingMode ViewSphereSizeCombo ViewSphereLocationCombo @@ -1745,8 +1753,8 @@ PreviewViewSphereLocationCombo PreviewAxisIconCheckBox BackgroundSolidRadio - BackgroundGradientRadio BackgroundSolidColorButton + BackgroundGradientRadio BackgroundGradient1ColorButton BackgroundGradient2ColorButton ActiveViewColorButton