Added text color option. Fixes #581.

This commit is contained in:
Leonardo Zide 2020-12-30 13:44:08 -08:00
parent 801aab7cce
commit 98411ecebc
7 changed files with 74 additions and 54 deletions

View file

@ -25,6 +25,7 @@ void lcPreferences::LoadDefaults()
mBackgroundGradientColorBottom = lcGetProfileInt(LC_PROFILE_GRADIENT_COLOR_BOTTOM); mBackgroundGradientColorBottom = lcGetProfileInt(LC_PROFILE_GRADIENT_COLOR_BOTTOM);
mDrawAxes = lcGetProfileInt(LC_PROFILE_DRAW_AXES); mDrawAxes = lcGetProfileInt(LC_PROFILE_DRAW_AXES);
mAxesColor = lcGetProfileInt(LC_PROFILE_AXES_COLOR); mAxesColor = lcGetProfileInt(LC_PROFILE_AXES_COLOR);
mTextColor = lcGetProfileInt(LC_PROFILE_TEXT_COLOR);
mOverlayColor = lcGetProfileInt(LC_PROFILE_OVERLAY_COLOR); mOverlayColor = lcGetProfileInt(LC_PROFILE_OVERLAY_COLOR);
mActiveViewColor = lcGetProfileInt(LC_PROFILE_ACTIVE_VIEW_COLOR); mActiveViewColor = lcGetProfileInt(LC_PROFILE_ACTIVE_VIEW_COLOR);
mInactiveViewColor = lcGetProfileInt(LC_PROFILE_INACTIVE_VIEW_COLOR); mInactiveViewColor = lcGetProfileInt(LC_PROFILE_INACTIVE_VIEW_COLOR);
@ -63,6 +64,7 @@ void lcPreferences::SaveDefaults()
lcSetProfileInt(LC_PROFILE_SHADING_MODE, static_cast<int>(mShadingMode)); lcSetProfileInt(LC_PROFILE_SHADING_MODE, static_cast<int>(mShadingMode));
lcSetProfileInt(LC_PROFILE_DRAW_AXES, mDrawAxes); lcSetProfileInt(LC_PROFILE_DRAW_AXES, mDrawAxes);
lcSetProfileInt(LC_PROFILE_AXES_COLOR, mAxesColor); lcSetProfileInt(LC_PROFILE_AXES_COLOR, mAxesColor);
lcSetProfileInt(LC_PROFILE_TEXT_COLOR, mTextColor);
lcSetProfileInt(LC_PROFILE_BACKGROUND_GRADIENT, mBackgroundGradient); lcSetProfileInt(LC_PROFILE_BACKGROUND_GRADIENT, mBackgroundGradient);
lcSetProfileInt(LC_PROFILE_BACKGROUND_COLOR, mBackgroundSolidColor); lcSetProfileInt(LC_PROFILE_BACKGROUND_COLOR, mBackgroundSolidColor);
lcSetProfileInt(LC_PROFILE_GRADIENT_COLOR_TOP, mBackgroundGradientColorTop); lcSetProfileInt(LC_PROFILE_GRADIENT_COLOR_TOP, mBackgroundGradientColorTop);
@ -101,7 +103,8 @@ void lcPreferences::SetInterfaceColors(lcColorTheme ColorTheme)
{ {
if (ColorTheme == lcColorTheme::Dark) if (ColorTheme == lcColorTheme::Dark)
{ {
mAxesColor = LC_RGBA(0, 0, 0, 255); mAxesColor = LC_RGBA(160, 160, 160, 255);
mTextColor = LC_RGBA(160, 160, 160, 255);
mBackgroundSolidColor = LC_RGB(49, 52, 55); mBackgroundSolidColor = LC_RGB(49, 52, 55);
mBackgroundGradientColorTop = LC_RGB(0, 0, 191); mBackgroundGradientColorTop = LC_RGB(0, 0, 191);
mBackgroundGradientColorBottom = LC_RGB(255, 255, 255); mBackgroundGradientColorBottom = LC_RGB(255, 255, 255);
@ -116,6 +119,7 @@ void lcPreferences::SetInterfaceColors(lcColorTheme ColorTheme)
else else
{ {
mAxesColor = LC_RGBA(0, 0, 0, 255); mAxesColor = LC_RGBA(0, 0, 0, 255);
mTextColor = LC_RGBA(0, 0, 0, 255);
mBackgroundSolidColor = LC_RGB(255, 255, 255); mBackgroundSolidColor = LC_RGB(255, 255, 255);
mBackgroundGradientColorTop = LC_RGB(54, 72, 95); mBackgroundGradientColorTop = LC_RGB(54, 72, 95);
mBackgroundGradientColorBottom = LC_RGB(49, 52, 55); mBackgroundGradientColorBottom = LC_RGB(49, 52, 55);

View file

@ -35,6 +35,7 @@ public:
quint32 mBackgroundGradientColorBottom; quint32 mBackgroundGradientColorBottom;
bool mDrawAxes; bool mDrawAxes;
quint32 mAxesColor; quint32 mAxesColor;
quint32 mTextColor;
quint32 mOverlayColor; quint32 mOverlayColor;
quint32 mActiveViewColor; quint32 mActiveViewColor;
quint32 mInactiveViewColor; quint32 mInactiveViewColor;

View file

@ -71,6 +71,7 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
lcProfileEntry("Settings", "GradientColorBottom", LC_RGB(49, 52, 55)), // LC_PROFILE_GRADIENT_COLOR_BOTTOM lcProfileEntry("Settings", "GradientColorBottom", LC_RGB(49, 52, 55)), // LC_PROFILE_GRADIENT_COLOR_BOTTOM
lcProfileEntry("Settings", "DrawAxes", 0), // LC_PROFILE_DRAW_AXES lcProfileEntry("Settings", "DrawAxes", 0), // LC_PROFILE_DRAW_AXES
lcProfileEntry("Settings", "AxesColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_AXES_COLOR lcProfileEntry("Settings", "AxesColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_AXES_COLOR
lcProfileEntry("Settings", "TextColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_TEXT_COLOR
lcProfileEntry("Settings", "OverlayColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_OVERLAY_COLOR lcProfileEntry("Settings", "OverlayColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_OVERLAY_COLOR
lcProfileEntry("Settings", "ActiveViewColor", LC_RGBA(41, 128, 185, 255)), // LC_PROFILE_ACTIVE_VIEW_COLOR lcProfileEntry("Settings", "ActiveViewColor", LC_RGBA(41, 128, 185, 255)), // LC_PROFILE_ACTIVE_VIEW_COLOR
lcProfileEntry("Settings", "InactiveViewColor", LC_RGBA(69, 69, 69, 255)), // LC_PROFILE_INACTIVE_VIEW_COLOR lcProfileEntry("Settings", "InactiveViewColor", LC_RGBA(69, 69, 69, 255)), // LC_PROFILE_INACTIVE_VIEW_COLOR

View file

@ -18,6 +18,7 @@ enum LC_PROFILE_KEY
LC_PROFILE_GRADIENT_COLOR_BOTTOM, LC_PROFILE_GRADIENT_COLOR_BOTTOM,
LC_PROFILE_DRAW_AXES, LC_PROFILE_DRAW_AXES,
LC_PROFILE_AXES_COLOR, LC_PROFILE_AXES_COLOR,
LC_PROFILE_TEXT_COLOR,
LC_PROFILE_OVERLAY_COLOR, LC_PROFILE_OVERLAY_COLOR,
LC_PROFILE_ACTIVE_VIEW_COLOR, LC_PROFILE_ACTIVE_VIEW_COLOR,
LC_PROFILE_INACTIVE_VIEW_COLOR, LC_PROFILE_INACTIVE_VIEW_COLOR,

View file

@ -1061,7 +1061,7 @@ void lcView::DrawViewport() const
if (!CameraName.isEmpty()) if (!CameraName.isEmpty())
{ {
mContext->SetMaterial(lcMaterialType::UnlitTextureModulate); mContext->SetMaterial(lcMaterialType::UnlitTextureModulate);
mContext->SetColor(0.0f, 0.0f, 0.0f, 1.0f); mContext->SetColor(lcVector4FromColor(lcGetPreferences().mTextColor));
mContext->BindTexture2D(gTexFont.GetTexture()); mContext->BindTexture2D(gTexFont.GetTexture());
glEnable(GL_BLEND); glEnable(GL_BLEND);

View file

@ -31,6 +31,7 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
connect(ui->BackgroundGradient1ColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked())); connect(ui->BackgroundGradient1ColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
connect(ui->BackgroundGradient2ColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked())); connect(ui->BackgroundGradient2ColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
connect(ui->AxesColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked())); connect(ui->AxesColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
connect(ui->TextColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
connect(ui->OverlayColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked())); connect(ui->OverlayColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
connect(ui->FadeStepsColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked())); connect(ui->FadeStepsColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
connect(ui->HighlightNewPartsColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked())); connect(ui->HighlightNewPartsColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
@ -194,6 +195,9 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mAxesColor), LC_RGBA_GREEN(mOptions->Preferences.mAxesColor), LC_RGBA_BLUE(mOptions->Preferences.mAxesColor))); pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mAxesColor), LC_RGBA_GREEN(mOptions->Preferences.mAxesColor), LC_RGBA_BLUE(mOptions->Preferences.mAxesColor)));
ui->AxesColorButton->setIcon(pix); ui->AxesColorButton->setIcon(pix);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mTextColor), LC_RGBA_GREEN(mOptions->Preferences.mTextColor), LC_RGBA_BLUE(mOptions->Preferences.mTextColor)));
ui->TextColorButton->setIcon(pix);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mOverlayColor), LC_RGBA_GREEN(mOptions->Preferences.mOverlayColor), LC_RGBA_BLUE(mOptions->Preferences.mOverlayColor))); pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mOverlayColor), LC_RGBA_GREEN(mOptions->Preferences.mOverlayColor), LC_RGBA_BLUE(mOptions->Preferences.mOverlayColor)));
ui->OverlayColorButton->setIcon(pix); ui->OverlayColorButton->setIcon(pix);
@ -311,24 +315,19 @@ void lcQPreferencesDialog::accept()
mOptions->Preferences.mBackgroundGradient = ui->BackgroundGradientRadio->isChecked(); mOptions->Preferences.mBackgroundGradient = ui->BackgroundGradientRadio->isChecked();
mOptions->Preferences.mDrawAxes = ui->AxisIconCheckBox->isChecked(); mOptions->Preferences.mDrawAxes = ui->AxisIconCheckBox->isChecked();
mOptions->Preferences.mViewSphereEnabled = ui->ViewSphereSizeCombo->currentIndex() > 0;
mOptions->Preferences.mViewSphereLocation = (lcViewSphereLocation)ui->ViewSphereLocationCombo->currentIndex(); mOptions->Preferences.mViewSphereLocation = (lcViewSphereLocation)ui->ViewSphereLocationCombo->currentIndex();
switch (ui->ViewSphereSizeCombo->currentIndex()) switch (ui->ViewSphereSizeCombo->currentIndex())
{ {
case 3: case 3:
mOptions->Preferences.mViewSphereSize = 200; mOptions->Preferences.mViewSphereSize = 200;
mOptions->Preferences.mViewSphereEnabled = 1;
break; break;
case 2: case 2:
mOptions->Preferences.mViewSphereSize = 100; mOptions->Preferences.mViewSphereSize = 100;
mOptions->Preferences.mViewSphereEnabled = 1;
break; break;
case 1: case 1:
mOptions->Preferences.mViewSphereSize = 50; mOptions->Preferences.mViewSphereSize = 50;
mOptions->Preferences.mViewSphereEnabled = 1;
break;
default:
mOptions->Preferences.mViewSphereEnabled = 0;
break; break;
} }
@ -340,25 +339,19 @@ void lcQPreferencesDialog::accept()
mOptions->StudLogo = 0; mOptions->StudLogo = 0;
mOptions->Preferences.mDrawPreviewAxis = ui->PreviewAxisIconCheckBox->isChecked(); mOptions->Preferences.mDrawPreviewAxis = ui->PreviewAxisIconCheckBox->isChecked();
mOptions->Preferences.mPreviewViewSphereEnabled = ui->PreviewViewSphereSizeCombo->currentIndex() > 0;
mOptions->Preferences.mPreviewViewSphereLocation = (lcViewSphereLocation)ui->PreviewViewSphereLocationCombo->currentIndex(); mOptions->Preferences.mPreviewViewSphereLocation = (lcViewSphereLocation)ui->PreviewViewSphereLocationCombo->currentIndex();
switch (ui->PreviewViewSphereSizeCombo->currentIndex()) switch (ui->PreviewViewSphereSizeCombo->currentIndex())
{ {
case 3: case 3:
mOptions->Preferences.mPreviewViewSphereSize = 100; mOptions->Preferences.mPreviewViewSphereSize = 100;
mOptions->Preferences.mPreviewViewSphereEnabled = 1;
break; break;
case 2: case 2:
mOptions->Preferences.mPreviewViewSphereSize = 75; mOptions->Preferences.mPreviewViewSphereSize = 75;
mOptions->Preferences.mPreviewViewSphereEnabled = 1;
break; break;
case 1: case 1:
mOptions->Preferences.mPreviewViewSphereSize = 50; mOptions->Preferences.mPreviewViewSphereSize = 50;
mOptions->Preferences.mPreviewViewSphereEnabled = 1;
break;
default:
mOptions->Preferences.mPreviewViewSphereEnabled = 0;
break; break;
} }
@ -454,6 +447,11 @@ void lcQPreferencesDialog::ColorButtonClicked()
Color = &mOptions->Preferences.mAxesColor; Color = &mOptions->Preferences.mAxesColor;
Title = tr("Select Axes Color"); Title = tr("Select Axes Color");
} }
else if (Button == ui->TextColorButton)
{
Color = &mOptions->Preferences.mTextColor;
Title = tr("Select Text Color");
}
else if (Button == ui->OverlayColorButton) else if (Button == ui->OverlayColorButton)
{ {
Color = &mOptions->Preferences.mOverlayColor; Color = &mOptions->Preferences.mOverlayColor;

View file

@ -895,54 +895,20 @@
<item> <item>
<widget class="QGroupBox" name="groupBox_11"> <widget class="QGroupBox" name="groupBox_11">
<property name="title"> <property name="title">
<string>Overlays</string> <string>Interface</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_8"> <layout class="QGridLayout" name="gridLayout_8">
<item row="1" column="3"> <item row="2" column="1">
<widget class="QToolButton" name="OverlayColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_31">
<property name="text">
<string>Axis Icon:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QToolButton" name="AxesColorButton"> <widget class="QToolButton" name="AxesColorButton">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="4"> <item row="2" column="0">
<spacer name="horizontalSpacer_16"> <widget class="QLabel" name="label_31">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Overlay Color:</string> <string>Axis Icon:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Active View:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -967,6 +933,54 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Active View:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Text:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QToolButton" name="TextColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Overlay Color:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QToolButton" name="OverlayColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_16">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -1671,6 +1685,7 @@
<tabstop>BackgroundGradient2ColorButton</tabstop> <tabstop>BackgroundGradient2ColorButton</tabstop>
<tabstop>ActiveViewColorButton</tabstop> <tabstop>ActiveViewColorButton</tabstop>
<tabstop>InactiveViewColorButton</tabstop> <tabstop>InactiveViewColorButton</tabstop>
<tabstop>TextColorButton</tabstop>
<tabstop>AxesColorButton</tabstop> <tabstop>AxesColorButton</tabstop>
<tabstop>OverlayColorButton</tabstop> <tabstop>OverlayColorButton</tabstop>
<tabstop>gridLineColor</tabstop> <tabstop>gridLineColor</tabstop>