mirror of
https://github.com/leozide/leocad
synced 2025-01-14 08:01:45 +01:00
Automate edge colours
This commit is contained in:
parent
03b9c75d9e
commit
daf459d670
12 changed files with 480 additions and 137 deletions
|
@ -58,6 +58,12 @@ 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);
|
||||
mPartEdgeContrast = lcGetProfileFloat(LC_PROFILE_PART_EDGE_CONTRAST);
|
||||
mPartEdgeGamma = lcGetProfileFloat(LC_PROFILE_PART_EDGE_GAMMA);
|
||||
mPartColorToneIndex = lcGetProfileFloat(LC_PROFILE_PART_COLOR_TONE_INDEX);
|
||||
mAutomateEdgeColor = lcGetProfileInt(LC_PROFILE_AUTOMATE_EDGE_COLOR);
|
||||
}
|
||||
|
||||
void lcPreferences::SaveDefaults()
|
||||
|
@ -103,6 +109,12 @@ 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);
|
||||
lcSetProfileFloat(LC_PROFILE_PART_EDGE_CONTRAST, mPartEdgeContrast);
|
||||
lcSetProfileFloat(LC_PROFILE_PART_EDGE_GAMMA, mPartEdgeGamma);
|
||||
lcSetProfileFloat(LC_PROFILE_PART_COLOR_TONE_INDEX, mPartColorToneIndex);
|
||||
lcSetProfileInt(LC_PROFILE_AUTOMATE_EDGE_COLOR, mAutomateEdgeColor);
|
||||
}
|
||||
|
||||
void lcPreferences::SetInterfaceColors(lcColorTheme ColorTheme)
|
||||
|
@ -1146,7 +1158,15 @@ void lcApplication::ShowPreferencesDialog()
|
|||
bool ColorsChanged = Options.ColorConfigPath != lcGetProfileString(LC_PROFILE_COLOR_CONFIG);
|
||||
bool AAChanged = CurrentAASamples != Options.AASamples;
|
||||
bool StudStyleChanged = CurrentStudStyle != Options.StudStyle;
|
||||
|
||||
bool AutomateEdgeColorChanged = Options.Preferences.mAutomateEdgeColor != 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 PartEdgeContrastChanged = Options.Preferences.mPartEdgeContrast != lcGetProfileFloat(LC_PROFILE_PART_EDGE_CONTRAST);
|
||||
bool PartEdgeGammaChanged = Options.Preferences.mPartEdgeGamma != lcGetProfileFloat(LC_PROFILE_PART_EDGE_GAMMA);
|
||||
bool PartColorToneIndexChanged = Options.Preferences.mPartColorToneIndex != lcGetProfileFloat(LC_PROFILE_PART_COLOR_TONE_INDEX);
|
||||
if (!StudStyleChanged)
|
||||
StudStyleChanged = (StudColorChanged || StudEdgeColorChanged || PartEdgeContrastChanged || PartEdgeGammaChanged || PartColorToneIndexChanged);
|
||||
/*** LPub3D Mod - ***/
|
||||
mPreferences = Options.Preferences;
|
||||
|
||||
mPreferences.SaveDefaults();
|
||||
|
@ -1207,9 +1227,10 @@ void lcApplication::ShowPreferencesDialog()
|
|||
lcSetProfileInt(LC_PROFILE_STUD_STYLE, static_cast<int>(Options.StudStyle));
|
||||
lcGetPiecesLibrary()->SetStudStyle(Options.StudStyle, true);
|
||||
}
|
||||
else if (ColorsChanged)
|
||||
else if (ColorsChanged || AutomateEdgeColorChanged)
|
||||
{
|
||||
lcSetProfileString(LC_PROFILE_COLOR_CONFIG, Options.ColorConfigPath);
|
||||
if (ColorsChanged)
|
||||
lcSetProfileString(LC_PROFILE_COLOR_CONFIG, Options.ColorConfigPath);
|
||||
lcGetPiecesLibrary()->LoadColors();
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,13 @@ public:
|
|||
int mPreviewViewSphereSize;
|
||||
lcViewSphereLocation mPreviewViewSphereLocation;
|
||||
int mDrawPreviewAxis;
|
||||
|
||||
quint32 mStudColor;
|
||||
quint32 mStudEdgeColor;
|
||||
float mPartEdgeContrast;
|
||||
float mPartEdgeGamma;
|
||||
float mPartColorToneIndex;
|
||||
bool mAutomateEdgeColor;
|
||||
};
|
||||
|
||||
struct lcCommandLineOptions
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "lc_colors.h"
|
||||
#include "lc_file.h"
|
||||
#include "lc_library.h"
|
||||
#include "lc_application.h"
|
||||
#include <float.h>
|
||||
|
||||
std::vector<lcColor> gColorList;
|
||||
|
@ -211,7 +212,32 @@ int lcGetBrickLinkColor(int ColorIndex)
|
|||
|
||||
static void lcAdjustStudStyleColors(std::vector<lcColor>& Colors, lcStudStyle StudStyle)
|
||||
{
|
||||
if (StudStyle != lcStudStyle::HighContrast && StudStyle != lcStudStyle::HighContrastLogo)
|
||||
if (lcGetPreferences().mAutomateEdgeColor)
|
||||
{
|
||||
for (lcColor& Color : Colors)
|
||||
{
|
||||
if (Color.Code == 4242)
|
||||
continue;
|
||||
|
||||
float EdgeLuminescence = 0.0f;
|
||||
float r = LC_GAMMA_ADJUST(Color.Value[0], lcGetPreferences().mPartEdgeGamma);
|
||||
float g = LC_GAMMA_ADJUST(Color.Value[1], lcGetPreferences().mPartEdgeGamma);
|
||||
float b = LC_GAMMA_ADJUST(Color.Value[2], lcGetPreferences().mPartEdgeGamma);
|
||||
|
||||
float ValueLuminescence = 0.2126f * r + 0.7152f * g + 0.0722f * b;
|
||||
|
||||
if (LC_GAMMA_APPLY(ValueLuminescence, lcGetPreferences().mPartEdgeGamma) > (lcGetPreferences().mPartColorToneIndex))
|
||||
EdgeLuminescence = ValueLuminescence - (ValueLuminescence * lcGetPreferences().mPartEdgeContrast);
|
||||
else
|
||||
EdgeLuminescence = (1.0f - ValueLuminescence) * lcGetPreferences().mPartEdgeContrast + ValueLuminescence;
|
||||
|
||||
EdgeLuminescence = LC_GAMMA_APPLY(EdgeLuminescence, lcGetPreferences().mPartEdgeGamma);
|
||||
|
||||
Color.Edge = lcVector4(EdgeLuminescence, EdgeLuminescence, EdgeLuminescence, 1.0f);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (StudStyle != lcStudStyle::HighContrast && StudStyle != lcStudStyle::HighContrastLogo)
|
||||
return;
|
||||
|
||||
for (lcColor& Color : Colors)
|
||||
|
|
195
common/lc_edgecolordialog.cpp
Normal file
195
common/lc_edgecolordialog.cpp
Normal file
|
@ -0,0 +1,195 @@
|
|||
#include "lc_edgecolordialog.h"
|
||||
#include "lc_application.h"
|
||||
|
||||
#define MIN_GAMMA 1.0f
|
||||
|
||||
lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent)
|
||||
:QDialog(Parent)
|
||||
{
|
||||
mStudColor = lcGetPreferences().mStudColor;
|
||||
mStudEdgeColor = lcGetPreferences().mStudEdgeColor;
|
||||
mPartEdgeContrast = lcGetPreferences().mPartEdgeContrast;
|
||||
mPartEdgeGamma = lcGetPreferences().mPartEdgeGamma;
|
||||
mPartColorToneIndex = lcGetPreferences().mPartColorToneIndex;
|
||||
|
||||
setWindowTitle(QString("Edge Color Preferences"));
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
||||
|
||||
QGroupBox* EdgeSettingsBox = new QGroupBox("Part Edge Color Settings",this);
|
||||
mainLayout->addWidget(EdgeSettingsBox);
|
||||
QGridLayout* EdgeSettingsLayout = new QGridLayout(EdgeSettingsBox);
|
||||
EdgeSettingsBox->setLayout(EdgeSettingsLayout);
|
||||
|
||||
QLabel* PartEdgeContrastLabel = new QLabel(tr("Contrast:"), this);
|
||||
PartEdgeContrast = new QLabel(this);
|
||||
PartEdgeContrastSlider = new QSlider(Qt::Horizontal, this);
|
||||
PartEdgeContrastSlider->setRange(0, 10);
|
||||
PartEdgeContrastSlider->setValue(mPartEdgeContrast * 10);
|
||||
PartEdgeContrastSlider->setToolTip(tr("Set the amount of contrast - 0.5 is midway."));
|
||||
connect(PartEdgeContrastSlider, SIGNAL(valueChanged(int)), this, SLOT(SliderValueChanged(int)));
|
||||
emit PartEdgeContrastSlider->valueChanged(PartEdgeContrastSlider->value());
|
||||
|
||||
EdgeSettingsLayout->addWidget(PartEdgeContrastLabel,0,0);
|
||||
EdgeSettingsLayout->addWidget(PartEdgeContrastSlider,0,1);
|
||||
EdgeSettingsLayout->addWidget(PartEdgeContrast,0,2);
|
||||
|
||||
QLabel* PartEdgeGammaLabel = new QLabel(tr("Brightness:"), this);
|
||||
PartEdgeGamma = new QLabel(this);
|
||||
PartEdgeGammaSlider = new QSlider(Qt::Horizontal, this);
|
||||
PartEdgeGammaSlider->setRange(0, 20);
|
||||
PartEdgeGammaSlider->setValue(qRound((mPartEdgeGamma - MIN_GAMMA) * 10));
|
||||
PartEdgeGammaSlider->setToolTip(tr("Set the brightness (gamma) - the normal range is 1.8 to 2.8."));
|
||||
connect(PartEdgeGammaSlider, SIGNAL(valueChanged(int)), this, SLOT(SliderValueChanged(int)));
|
||||
emit PartEdgeGammaSlider->valueChanged(PartEdgeGammaSlider->value());
|
||||
|
||||
EdgeSettingsLayout->addWidget(PartEdgeGammaLabel,1,0);
|
||||
EdgeSettingsLayout->addWidget(PartEdgeGammaSlider,1,1);
|
||||
EdgeSettingsLayout->addWidget(PartEdgeGamma,1,2);
|
||||
|
||||
QLabel* PartColorToneIndexLabel = new QLabel(tr("Tone Index:"), this);
|
||||
PartColorToneIndex = new QLabel(this);
|
||||
PartColorToneIndexSlider = new QSlider(Qt::Horizontal, this);
|
||||
PartColorToneIndexSlider->setRange(0, 10);
|
||||
PartColorToneIndexSlider->setValue(mPartColorToneIndex * 10);
|
||||
PartColorToneIndexSlider->setToolTip(tr("Set to classify where colors are either light or dark - e.g. Dark Bluish Gray (72) is classified as a light color at 0.4."));
|
||||
connect(PartColorToneIndexSlider, SIGNAL(valueChanged(int)), this, SLOT(SliderValueChanged(int)));
|
||||
emit PartColorToneIndexSlider->valueChanged(PartColorToneIndexSlider->value());
|
||||
|
||||
EdgeSettingsLayout->addWidget(PartColorToneIndexLabel,2,0);
|
||||
EdgeSettingsLayout->addWidget(PartColorToneIndexSlider,2,1);
|
||||
EdgeSettingsLayout->addWidget(PartColorToneIndex,2,2);
|
||||
|
||||
QGroupBox* StudColorBox = new QGroupBox("High Contrast Style", this);
|
||||
mainLayout->addWidget(StudColorBox);
|
||||
QGridLayout* StudColorLayout = new QGridLayout(StudColorBox);
|
||||
StudColorBox->setLayout(StudColorLayout);
|
||||
|
||||
auto SetButtonPixmap = [](quint32 Color, QToolButton* Button)
|
||||
{
|
||||
QPixmap Pixmap(12, 12);
|
||||
QColor ButtonColor(QColor(LC_RGBA_RED(Color), LC_RGBA_GREEN(Color), LC_RGBA_BLUE(Color)));
|
||||
Pixmap.fill(ButtonColor);
|
||||
Button->setIcon(Pixmap);
|
||||
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()));
|
||||
|
||||
ResetStudColorButton = new QToolButton(this);
|
||||
ResetStudColorButton->setText(tr("..."));
|
||||
ResetStudColorButton->setToolTip(tr("Reset"));
|
||||
connect(ResetStudColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
|
||||
|
||||
StudColorLayout->addWidget(StudColorLabel,0,0);
|
||||
StudColorLayout->addWidget(StudColorButton,0,1);
|
||||
StudColorLayout->addWidget(ResetStudColorButton,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()));
|
||||
|
||||
ResetStudEdgeColorButton = new QToolButton(this);
|
||||
ResetStudEdgeColorButton->setText(tr("..."));
|
||||
ResetStudEdgeColorButton->setToolTip(tr("Reset"));
|
||||
connect(ResetStudEdgeColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
|
||||
|
||||
StudColorLayout->addWidget(StudEdgeColorLabel,1,0);
|
||||
StudColorLayout->addWidget(StudEdgeColorButton,1,1);
|
||||
StudColorLayout->addWidget(ResetStudEdgeColorButton,1,2);
|
||||
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
|
||||
Qt::Horizontal, this);
|
||||
mainLayout->addWidget(buttonBox);
|
||||
QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
|
||||
setMinimumSize(220,100);
|
||||
}
|
||||
|
||||
void lcAutomateEdgeColorDialog::SliderValueChanged(int Value)
|
||||
{
|
||||
float Result;
|
||||
if (sender() == PartEdgeContrastSlider)
|
||||
{
|
||||
Result = Value * 0.1f;
|
||||
PartEdgeContrast->setText(QString::number(Result));
|
||||
}
|
||||
else if (sender() == PartEdgeGammaSlider)
|
||||
{
|
||||
Result = (Value * 0.1f) + MIN_GAMMA;
|
||||
PartEdgeGamma->setText(QString::number(Result));
|
||||
}
|
||||
else if (sender() == PartColorToneIndexSlider)
|
||||
{
|
||||
Result = Value * 0.1f;
|
||||
PartColorToneIndex->setText(QString::number(Result));
|
||||
}
|
||||
}
|
||||
|
||||
void lcAutomateEdgeColorDialog::ColorButtonClicked()
|
||||
{
|
||||
QObject* Button = sender();
|
||||
QString Title;
|
||||
quint32* Color = nullptr;
|
||||
QColorDialog::ColorDialogOptions DialogOptions;
|
||||
|
||||
if (Button == StudColorButton)
|
||||
{
|
||||
Title = tr("Select Stud Color");
|
||||
Color = &mStudColor;
|
||||
}
|
||||
else if (Button == StudEdgeColorButton)
|
||||
{
|
||||
Title = tr("Select Stud Edge Color");
|
||||
Color = &mStudEdgeColor;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
QColor oldColor = QColor(LC_RGBA_RED(*Color), LC_RGBA_GREEN(*Color), LC_RGBA_BLUE(*Color), LC_RGBA_ALPHA(*Color));
|
||||
QColor NewColor = QColorDialog::getColor(oldColor, this, Title, DialogOptions);
|
||||
|
||||
if (NewColor == oldColor || !NewColor.isValid())
|
||||
return;
|
||||
|
||||
*Color = LC_RGBA(NewColor.red(), NewColor.green(), NewColor.blue(), NewColor.alpha());
|
||||
|
||||
QPixmap pix(12, 12);
|
||||
|
||||
NewColor.setAlpha(255);
|
||||
pix.fill(NewColor);
|
||||
((QToolButton*)Button)->setIcon(pix);
|
||||
((QToolButton*)Button)->setToolTip(NewColor.name().toUpper());
|
||||
}
|
||||
|
||||
void lcAutomateEdgeColorDialog::ResetColorButtonClicked()
|
||||
{
|
||||
quint32* Color = nullptr;
|
||||
QPixmap pix(12, 12);
|
||||
QColor ResetColor;
|
||||
|
||||
if (sender() == StudColorButton)
|
||||
{
|
||||
*Color = LC_RGBA(5, 19, 29, 128);
|
||||
if (mStudColor == *Color)
|
||||
return;
|
||||
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());
|
||||
}
|
||||
else if (sender() == StudEdgeColorButton)
|
||||
{
|
||||
*Color = LC_RGBA(255, 255, 255, 255);
|
||||
if (mStudEdgeColor == *Color)
|
||||
return;
|
||||
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());
|
||||
}
|
||||
}
|
35
common/lc_edgecolordialog.h
Normal file
35
common/lc_edgecolordialog.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
class lcAutomateEdgeColorDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
lcAutomateEdgeColorDialog(QWidget *Parent);
|
||||
quint32 mStudColor;
|
||||
quint32 mStudEdgeColor;
|
||||
float mPartEdgeContrast;
|
||||
float mPartEdgeGamma;
|
||||
float mPartColorToneIndex;
|
||||
|
||||
protected slots:
|
||||
void SliderValueChanged(int);
|
||||
void ColorButtonClicked();
|
||||
void ResetColorButtonClicked();
|
||||
|
||||
protected:
|
||||
QSlider* PartEdgeGammaSlider;
|
||||
QSlider* PartColorToneIndexSlider;
|
||||
QSlider* PartEdgeContrastSlider;
|
||||
|
||||
QToolButton* StudColorButton;
|
||||
QToolButton* StudEdgeColorButton;
|
||||
QToolButton* ResetStudColorButton;
|
||||
QToolButton* ResetStudEdgeColorButton;
|
||||
|
||||
QLabel* PartEdgeContrast;
|
||||
QLabel* PartEdgeGamma;
|
||||
QLabel* PartColorToneIndex;
|
||||
};
|
||||
|
|
@ -14,6 +14,8 @@
|
|||
#define LC_RGBA_GREEN(rgba) ((quint8)(((rgba) >> 8) & 0xff))
|
||||
#define LC_RGBA_BLUE(rgba) ((quint8)(((rgba) >> 16) & 0xff))
|
||||
#define LC_RGBA_ALPHA(rgba) ((quint8)(((rgba) >> 24) & 0xff))
|
||||
#define LC_GAMMA_ADJUST(v,g) (powf(v, g))
|
||||
#define LC_GAMMA_APPLY(v,g) (powf(v, 1.0f/g))
|
||||
|
||||
inline quint32 lcRGBAFromQColor(const QColor& Color)
|
||||
{
|
||||
|
|
|
@ -139,6 +139,13 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
|||
lcProfileEntry("Settings", "PreviewViewSphereSize", 75), // LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE
|
||||
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(5, 19, 29, 255)), // LC_PROFILE_STUD_COLOR
|
||||
lcProfileEntry("Settings", "StudEdgeColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_STUD_EDGE_COLOR
|
||||
lcProfileEntry("Settings", "PartEdgeContrast", 0.5f), // LC_PROFILE_PART_EDGE_CONTRAST
|
||||
lcProfileEntry("Settings", "PartEdgeGamma", 1.8f), // LC_PROFILE_PART_EDGE_GAMMA
|
||||
lcProfileEntry("Settings", "PartColorToneIndex", 0.5f), // LC_PROFILE_PART_COLOR_TONE_INDEX
|
||||
lcProfileEntry("Settings", "AutomateEdgeColor", 0) // LC_PROFILE_AUTOMATE_EDGE_COLOR
|
||||
};
|
||||
|
||||
void lcRemoveProfileKey(LC_PROFILE_KEY Key)
|
||||
|
|
|
@ -88,6 +88,13 @@ 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_PART_EDGE_CONTRAST,
|
||||
LC_PROFILE_PART_EDGE_GAMMA,
|
||||
LC_PROFILE_PART_COLOR_TONE_INDEX,
|
||||
LC_PROFILE_AUTOMATE_EDGE_COLOR,
|
||||
|
||||
LC_NUM_PROFILE_KEYS
|
||||
};
|
||||
|
||||
|
|
|
@ -171,6 +171,7 @@ SOURCES += \
|
|||
common/lc_colors.cpp \
|
||||
common/lc_commands.cpp \
|
||||
common/lc_context.cpp \
|
||||
common/lc_edgecolordialog.cpp \
|
||||
common/lc_file.cpp \
|
||||
common/lc_glextensions.cpp \
|
||||
common/lc_http.cpp \
|
||||
|
@ -238,6 +239,7 @@ HEADERS += \
|
|||
common/lc_colors.h \
|
||||
common/lc_commands.h \
|
||||
common/lc_context.h \
|
||||
common/lc_edgecolordialog.h \
|
||||
common/lc_file.h \
|
||||
common/lc_glextensions.h \
|
||||
common/lc_global.h \
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "lc_qutils.h"
|
||||
#include "lc_glextensions.h"
|
||||
#include "pieceinf.h"
|
||||
#include "lc_edgecolordialog.h"
|
||||
|
||||
static const char* gLanguageLocales[] =
|
||||
{
|
||||
|
@ -46,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->AutomateEdgeColorButton, SIGNAL(clicked()), this, SLOT(AutomateEdgeColor()));
|
||||
|
||||
ui->partsLibrary->setText(mOptions->LibraryPath);
|
||||
ui->ColorConfigEdit->setText(mOptions->ColorConfigPath);
|
||||
|
@ -69,6 +71,7 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
|||
ui->fixedDirectionKeys->setChecked(mOptions->Preferences.mFixedAxes);
|
||||
ui->autoLoadMostRecent->setChecked(mOptions->Preferences.mAutoLoadMostRecent);
|
||||
ui->RestoreTabLayout->setChecked(mOptions->Preferences.mRestoreTabLayout);
|
||||
ui->AutomateEdgeColor->setChecked(mOptions->Preferences.mAutomateEdgeColor);
|
||||
|
||||
ui->antiAliasing->setChecked(mOptions->AASamples != 1);
|
||||
if (mOptions->AASamples == 8)
|
||||
|
@ -197,6 +200,7 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
|||
SetButtonPixmap(mOptions->Preferences.mViewSphereHighlightColor, ui->ViewSphereHighlightColorButton);
|
||||
|
||||
on_antiAliasing_toggled();
|
||||
on_AutomateEdgeColor_toggled();
|
||||
on_edgeLines_toggled();
|
||||
on_LineWidthSlider_valueChanged();
|
||||
on_MeshLODSlider_valueChanged();
|
||||
|
@ -243,6 +247,7 @@ void lcQPreferencesDialog::accept()
|
|||
mOptions->DefaultAuthor = ui->authorName->text();
|
||||
mOptions->Preferences.mMouseSensitivity = ui->mouseSensitivity->value();
|
||||
mOptions->Preferences.mColorTheme = static_cast<lcColorTheme>(ui->ColorTheme->currentIndex());
|
||||
mOptions->Preferences.mAutomateEdgeColor = ui->AutomateEdgeColor->isChecked();
|
||||
|
||||
int Language = ui->Language->currentIndex();
|
||||
if (Language < 0 || Language > static_cast<int>(LC_ARRAY_COUNT(gLanguageLocales)))
|
||||
|
@ -547,6 +552,24 @@ void lcQPreferencesDialog::on_ViewSphereSizeCombo_currentIndexChanged(int Index)
|
|||
ui->ViewSphereLocationCombo->setEnabled(Index != 0);
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::on_AutomateEdgeColor_toggled()
|
||||
{
|
||||
ui->AutomateEdgeColorButton->setEnabled(ui->AutomateEdgeColor->isChecked());
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::AutomateEdgeColor()
|
||||
{
|
||||
lcAutomateEdgeColorDialog Dialog(this);
|
||||
if (Dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
mOptions->Preferences.mStudColor = Dialog.mStudColor;
|
||||
mOptions->Preferences.mStudEdgeColor = Dialog.mStudEdgeColor;
|
||||
mOptions->Preferences.mPartEdgeContrast = Dialog.mPartEdgeContrast;
|
||||
mOptions->Preferences.mPartEdgeGamma = Dialog.mPartEdgeGamma;
|
||||
mOptions->Preferences.mPartColorToneIndex = Dialog.mPartColorToneIndex;
|
||||
}
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::updateCategories()
|
||||
{
|
||||
QTreeWidgetItem* CategoryItem;
|
||||
|
|
|
@ -65,6 +65,8 @@ public slots:
|
|||
void on_lgeoPathBrowse_clicked();
|
||||
void on_ColorTheme_currentIndexChanged(int Index);
|
||||
void ColorButtonClicked();
|
||||
void AutomateEdgeColor();
|
||||
void on_AutomateEdgeColor_toggled();
|
||||
void on_antiAliasing_toggled();
|
||||
void on_edgeLines_toggled();
|
||||
void on_LineWidthSlider_valueChanged();
|
||||
|
|
|
@ -333,6 +333,13 @@
|
|||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Shading Mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
|
@ -346,7 +353,98 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="edgeLines">
|
||||
<property name="text">
|
||||
<string>Edge lines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="LineWidthLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="text">
|
||||
<string>Stud Style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QToolButton" name="FadeStepsColor">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="antiAliasing">
|
||||
<property name="text">
|
||||
<string>Anti-aliasing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="FadeSteps">
|
||||
<property name="text">
|
||||
<string>Fade previous steps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="MeshLOD">
|
||||
<property name="text">
|
||||
<string>Mesh LOD</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="ShadingMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Wireframe</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Flat Shading</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Default Lights</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSlider" name="MeshLODSlider">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::NoTicks</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QToolButton" name="HighlightNewPartsColor">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QCheckBox" name="HighlightNewParts">
|
||||
<property name="text">
|
||||
<string>Highlight new parts</string>
|
||||
|
@ -372,113 +470,6 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="MeshLOD">
|
||||
<property name="text">
|
||||
<string>Mesh LOD</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="edgeLines">
|
||||
<property name="text">
|
||||
<string>Edge lines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="antiAliasing">
|
||||
<property name="text">
|
||||
<string>Anti-aliasing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="FadeSteps">
|
||||
<property name="text">
|
||||
<string>Fade previous steps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Shading Mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="ShadingMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Wireframe</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Flat Shading</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Default Lights</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QToolButton" name="FadeStepsColor">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QToolButton" name="HighlightNewPartsColor">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSlider" name="LineWidthSlider">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::NoTicks</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="LineWidthLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSlider" name="MeshLODSlider">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::NoTicks</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLabel" name="MeshLODLabel">
|
||||
<property name="text">
|
||||
|
@ -486,7 +477,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QComboBox" name="studStyleCombo">
|
||||
<item>
|
||||
<property name="text">
|
||||
|
@ -530,10 +521,33 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<item row="2" column="1">
|
||||
<widget class="QSlider" name="LineWidthSlider">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::NoTicks</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QToolButton" name="AutomateEdgeColorButton">
|
||||
<property name="text">
|
||||
<string>Stud Style</string>
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="AutomateEdgeColor">
|
||||
<property name="text">
|
||||
<string>Automate Edge Color:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1712,6 +1726,8 @@
|
|||
<tabstop>LineWidthSlider</tabstop>
|
||||
<tabstop>MeshLOD</tabstop>
|
||||
<tabstop>MeshLODSlider</tabstop>
|
||||
<tabstop>AutomateEdgeColor</tabstop>
|
||||
<tabstop>AutomateEdgeColorButton</tabstop>
|
||||
<tabstop>FadeSteps</tabstop>
|
||||
<tabstop>FadeStepsColor</tabstop>
|
||||
<tabstop>HighlightNewParts</tabstop>
|
||||
|
@ -1729,17 +1745,17 @@
|
|||
<tabstop>PreviewViewSphereLocationCombo</tabstop>
|
||||
<tabstop>PreviewAxisIconCheckBox</tabstop>
|
||||
<tabstop>BackgroundSolidRadio</tabstop>
|
||||
<tabstop>BackgroundSolidColorButton</tabstop>
|
||||
<tabstop>BackgroundGradientRadio</tabstop>
|
||||
<tabstop>BackgroundSolidColorButton</tabstop>
|
||||
<tabstop>BackgroundGradient1ColorButton</tabstop>
|
||||
<tabstop>BackgroundGradient2ColorButton</tabstop>
|
||||
<tabstop>ActiveViewColorButton</tabstop>
|
||||
<tabstop>InactiveViewColorButton</tabstop>
|
||||
<tabstop>TextColorButton</tabstop>
|
||||
<tabstop>AxesColorButton</tabstop>
|
||||
<tabstop>MarqueeBorderColorButton</tabstop>
|
||||
<tabstop>MarqueeFillColorButton</tabstop>
|
||||
<tabstop>OverlayColorButton</tabstop>
|
||||
<tabstop>InactiveViewColorButton</tabstop>
|
||||
<tabstop>AxesColorButton</tabstop>
|
||||
<tabstop>MarqueeFillColorButton</tabstop>
|
||||
<tabstop>gridLineColor</tabstop>
|
||||
<tabstop>gridStudColor</tabstop>
|
||||
<tabstop>ViewSphereColorButton</tabstop>
|
||||
|
|
Loading…
Reference in a new issue