Customizable marquee colors. Fixes #544.

This commit is contained in:
Leonardo Zide 2020-12-31 15:54:28 -08:00
parent 87d3dab0bb
commit 6c06e329e6
7 changed files with 130 additions and 93 deletions

View file

@ -26,6 +26,8 @@ void lcPreferences::LoadDefaults()
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); mTextColor = lcGetProfileInt(LC_PROFILE_TEXT_COLOR);
mMarqueeBorderColor = lcGetProfileInt(LC_PROFILE_MARQUEE_BORDER_COLOR);
mMarqueeFillColor = lcGetProfileInt(LC_PROFILE_MARQUEE_FILL_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);
@ -69,6 +71,8 @@ void lcPreferences::SaveDefaults()
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);
lcSetProfileInt(LC_PROFILE_GRADIENT_COLOR_BOTTOM, mBackgroundGradientColorBottom); lcSetProfileInt(LC_PROFILE_GRADIENT_COLOR_BOTTOM, mBackgroundGradientColorBottom);
lcSetProfileInt(LC_PROFILE_MARQUEE_BORDER_COLOR, mMarqueeBorderColor);
lcSetProfileInt(LC_PROFILE_MARQUEE_FILL_COLOR, mMarqueeFillColor);
lcSetProfileInt(LC_PROFILE_OVERLAY_COLOR, mOverlayColor); lcSetProfileInt(LC_PROFILE_OVERLAY_COLOR, mOverlayColor);
lcSetProfileInt(LC_PROFILE_ACTIVE_VIEW_COLOR, mActiveViewColor); lcSetProfileInt(LC_PROFILE_ACTIVE_VIEW_COLOR, mActiveViewColor);
lcSetProfileInt(LC_PROFILE_INACTIVE_VIEW_COLOR, mInactiveViewColor); lcSetProfileInt(LC_PROFILE_INACTIVE_VIEW_COLOR, mInactiveViewColor);

View file

@ -36,6 +36,8 @@ public:
bool mDrawAxes; bool mDrawAxes;
quint32 mAxesColor; quint32 mAxesColor;
quint32 mTextColor; quint32 mTextColor;
quint32 mMarqueeBorderColor;
quint32 mMarqueeFillColor;
quint32 mOverlayColor; quint32 mOverlayColor;
quint32 mActiveViewColor; quint32 mActiveViewColor;
quint32 mInactiveViewColor; quint32 mInactiveViewColor;

View file

@ -72,6 +72,8 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
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", "TextColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_TEXT_COLOR
lcProfileEntry("Settings", "MarqueeBorderColor", LC_RGBA(64, 64, 255, 255)), // LC_PROFILE_MARQUEE_BORDER_COLOR
lcProfileEntry("Settings", "MarqueeFillColor", LC_RGBA(64, 64, 255, 64)), // LC_PROFILE_MARQUEE_FILL_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

@ -19,6 +19,8 @@ enum LC_PROFILE_KEY
LC_PROFILE_DRAW_AXES, LC_PROFILE_DRAW_AXES,
LC_PROFILE_AXES_COLOR, LC_PROFILE_AXES_COLOR,
LC_PROFILE_TEXT_COLOR, LC_PROFILE_TEXT_COLOR,
LC_PROFILE_MARQUEE_BORDER_COLOR,
LC_PROFILE_MARQUEE_FILL_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

@ -1719,18 +1719,22 @@ void lcView::DrawSelectZoomRegionOverlay()
{ Right - BorderX, Top - BorderY }, { Right - BorderX, Top - BorderY },
}; };
glEnable(GL_BLEND);
mContext->SetVertexBufferPointer(Verts); mContext->SetVertexBufferPointer(Verts);
mContext->SetVertexFormatPosition(2); mContext->SetVertexFormatPosition(2);
mContext->SetColor(0.25f, 0.25f, 1.0f, 1.0f); const lcPreferences& Preferences = lcGetPreferences();
mContext->SetColor(lcVector4FromColor(Preferences.mMarqueeBorderColor));
mContext->DrawPrimitives(GL_TRIANGLE_STRIP, 0, 10); mContext->DrawPrimitives(GL_TRIANGLE_STRIP, 0, 10);
mContext->SetColor(0.25f, 0.25f, 1.0f, 0.25f); if (LC_RGBA_ALPHA(Preferences.mMarqueeFillColor))
mContext->DrawPrimitives(GL_TRIANGLE_STRIP, 10, 4); {
glEnable(GL_BLEND);
mContext->SetColor(lcVector4FromColor(Preferences.mMarqueeFillColor));
mContext->DrawPrimitives(GL_TRIANGLE_STRIP, 10, 4);
glDisable(GL_BLEND);
}
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
} }

View file

@ -32,6 +32,8 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
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->TextColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
connect(ui->MarqueeBorderColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
connect(ui->MarqueeFillColorButton, 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()));
@ -181,52 +183,31 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
ui->ShadingMode->removeItem(static_cast<int>(lcShadingMode::DefaultLights)); ui->ShadingMode->removeItem(static_cast<int>(lcShadingMode::DefaultLights));
ui->ShadingMode->setCurrentIndex(static_cast<int>(mOptions->Preferences.mShadingMode)); ui->ShadingMode->setCurrentIndex(static_cast<int>(mOptions->Preferences.mShadingMode));
QPixmap pix(12, 12); auto SetButtonPixmap = [](quint32 Color, QToolButton* Button)
{
QPixmap Pixmap(12, 12);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mBackgroundSolidColor), LC_RGBA_GREEN(mOptions->Preferences.mBackgroundSolidColor), LC_RGBA_BLUE(mOptions->Preferences.mBackgroundSolidColor))); Pixmap.fill(QColor(LC_RGBA_RED(Color), LC_RGBA_GREEN(Color), LC_RGBA_BLUE(Color)));
ui->BackgroundSolidColorButton->setIcon(pix); Button->setIcon(Pixmap);
};
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mBackgroundGradientColorTop), LC_RGBA_GREEN(mOptions->Preferences.mBackgroundGradientColorTop), LC_RGBA_BLUE(mOptions->Preferences.mBackgroundGradientColorTop))); SetButtonPixmap(mOptions->Preferences.mBackgroundSolidColor, ui->BackgroundSolidColorButton);
ui->BackgroundGradient1ColorButton->setIcon(pix); SetButtonPixmap(mOptions->Preferences.mBackgroundGradientColorTop, ui->BackgroundGradient1ColorButton);
SetButtonPixmap(mOptions->Preferences.mBackgroundGradientColorBottom, ui->BackgroundGradient2ColorButton);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mBackgroundGradientColorBottom), LC_RGBA_GREEN(mOptions->Preferences.mBackgroundGradientColorBottom), LC_RGBA_BLUE(mOptions->Preferences.mBackgroundGradientColorBottom))); SetButtonPixmap(mOptions->Preferences.mAxesColor, ui->AxesColorButton);
ui->BackgroundGradient2ColorButton->setIcon(pix); SetButtonPixmap(mOptions->Preferences.mTextColor, ui->TextColorButton);
SetButtonPixmap(mOptions->Preferences.mMarqueeBorderColor, ui->MarqueeBorderColorButton);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mAxesColor), LC_RGBA_GREEN(mOptions->Preferences.mAxesColor), LC_RGBA_BLUE(mOptions->Preferences.mAxesColor))); SetButtonPixmap(mOptions->Preferences.mMarqueeFillColor, ui->MarqueeFillColorButton);
ui->AxesColorButton->setIcon(pix); SetButtonPixmap(mOptions->Preferences.mOverlayColor, ui->OverlayColorButton);
SetButtonPixmap(mOptions->Preferences.mActiveViewColor, ui->ActiveViewColorButton);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mTextColor), LC_RGBA_GREEN(mOptions->Preferences.mTextColor), LC_RGBA_BLUE(mOptions->Preferences.mTextColor))); SetButtonPixmap(mOptions->Preferences.mInactiveViewColor, ui->InactiveViewColorButton);
ui->TextColorButton->setIcon(pix); SetButtonPixmap(mOptions->Preferences.mFadeStepsColor, ui->FadeStepsColor);
SetButtonPixmap(mOptions->Preferences.mHighlightNewPartsColor, ui->HighlightNewPartsColor);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mOverlayColor), LC_RGBA_GREEN(mOptions->Preferences.mOverlayColor), LC_RGBA_BLUE(mOptions->Preferences.mOverlayColor))); SetButtonPixmap(mOptions->Preferences.mGridStudColor, ui->gridStudColor);
ui->OverlayColorButton->setIcon(pix); SetButtonPixmap(mOptions->Preferences.mGridLineColor, ui->gridLineColor);
SetButtonPixmap(mOptions->Preferences.mViewSphereColor, ui->ViewSphereColorButton);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mActiveViewColor), LC_RGBA_GREEN(mOptions->Preferences.mActiveViewColor), LC_RGBA_BLUE(mOptions->Preferences.mActiveViewColor))); SetButtonPixmap(mOptions->Preferences.mViewSphereTextColor, ui->ViewSphereTextColorButton);
ui->ActiveViewColorButton->setIcon(pix); SetButtonPixmap(mOptions->Preferences.mViewSphereHighlightColor, ui->ViewSphereHighlightColorButton);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mInactiveViewColor), LC_RGBA_GREEN(mOptions->Preferences.mInactiveViewColor), LC_RGBA_BLUE(mOptions->Preferences.mInactiveViewColor)));
ui->InactiveViewColorButton->setIcon(pix);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mFadeStepsColor), LC_RGBA_GREEN(mOptions->Preferences.mFadeStepsColor), LC_RGBA_BLUE(mOptions->Preferences.mFadeStepsColor)));
ui->FadeStepsColor->setIcon(pix);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mHighlightNewPartsColor), LC_RGBA_GREEN(mOptions->Preferences.mHighlightNewPartsColor), LC_RGBA_BLUE(mOptions->Preferences.mHighlightNewPartsColor)));
ui->HighlightNewPartsColor->setIcon(pix);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mGridStudColor), LC_RGBA_GREEN(mOptions->Preferences.mGridStudColor), LC_RGBA_BLUE(mOptions->Preferences.mGridStudColor)));
ui->gridStudColor->setIcon(pix);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mGridLineColor), LC_RGBA_GREEN(mOptions->Preferences.mGridLineColor), LC_RGBA_BLUE(mOptions->Preferences.mGridLineColor)));
ui->gridLineColor->setIcon(pix);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mViewSphereColor), LC_RGBA_GREEN(mOptions->Preferences.mViewSphereColor), LC_RGBA_BLUE(mOptions->Preferences.mViewSphereColor)));
ui->ViewSphereColorButton->setIcon(pix);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mViewSphereTextColor), LC_RGBA_GREEN(mOptions->Preferences.mViewSphereTextColor), LC_RGBA_BLUE(mOptions->Preferences.mViewSphereTextColor)));
ui->ViewSphereTextColorButton->setIcon(pix);
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mViewSphereHighlightColor), LC_RGBA_GREEN(mOptions->Preferences.mViewSphereHighlightColor), LC_RGBA_BLUE(mOptions->Preferences.mViewSphereHighlightColor)));
ui->ViewSphereHighlightColorButton->setIcon(pix);
on_studLogo_toggled(); on_studLogo_toggled();
on_antiAliasing_toggled(); on_antiAliasing_toggled();
@ -452,6 +433,17 @@ void lcQPreferencesDialog::ColorButtonClicked()
Color = &mOptions->Preferences.mTextColor; Color = &mOptions->Preferences.mTextColor;
Title = tr("Select Text Color"); Title = tr("Select Text Color");
} }
else if (Button == ui->MarqueeBorderColorButton)
{
Color = &mOptions->Preferences.mMarqueeBorderColor;
Title = tr("Select Marquee Border Color");
}
else if (Button == ui->MarqueeFillColorButton)
{
Color = &mOptions->Preferences.mMarqueeFillColor;
Title = tr("Select Marquee Fill Color");
DialogOptions = QColorDialog::ShowAlphaChannel;
}
else if (Button == ui->OverlayColorButton) else if (Button == ui->OverlayColorButton)
{ {
Color = &mOptions->Preferences.mOverlayColor; Color = &mOptions->Preferences.mOverlayColor;
@ -518,6 +510,7 @@ void lcQPreferencesDialog::ColorButtonClicked()
QPixmap pix(12, 12); QPixmap pix(12, 12);
newColor.setAlpha(255);
pix.fill(newColor); pix.fill(newColor);
((QToolButton*)Button)->setIcon(pix); ((QToolButton*)Button)->setIcon(pix);
} }

View file

@ -898,17 +898,10 @@
<string>Interface</string> <string>Interface</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_8"> <layout class="QGridLayout" name="gridLayout_8">
<item row="2" column="1"> <item row="0" column="2">
<widget class="QToolButton" name="AxesColorButton"> <widget class="QLabel" name="label_32">
<property name="text"> <property name="text">
<string/> <string>Inactive View Border:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_31">
<property name="text">
<string>Axis Icon:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -919,10 +912,24 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="5" column="0">
<widget class="QLabel" name="label_32"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Inactive View:</string> <string>Overlay Color:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Active View Border:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QToolButton" name="TextColorButton">
<property name="text">
<string/>
</property> </property>
</widget> </widget>
</item> </item>
@ -933,38 +940,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="2" 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"> <widget class="QLabel" name="label_14">
<property name="text"> <property name="text">
<string>Text:</string> <string>Camera Name:</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> </property>
</widget> </widget>
</item> </item>
@ -981,6 +960,55 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="5" column="1">
<widget class="QToolButton" name="OverlayColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_31">
<property name="text">
<string>Axis Icon Labels:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QToolButton" name="AxesColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Marquee Border:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QToolButton" name="MarqueeBorderColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Marquee Fill:</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QToolButton" name="MarqueeFillColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -1687,6 +1715,8 @@
<tabstop>InactiveViewColorButton</tabstop> <tabstop>InactiveViewColorButton</tabstop>
<tabstop>TextColorButton</tabstop> <tabstop>TextColorButton</tabstop>
<tabstop>AxesColorButton</tabstop> <tabstop>AxesColorButton</tabstop>
<tabstop>MarqueeBorderColorButton</tabstop>
<tabstop>MarqueeFillColorButton</tabstop>
<tabstop>OverlayColorButton</tabstop> <tabstop>OverlayColorButton</tabstop>
<tabstop>gridLineColor</tabstop> <tabstop>gridLineColor</tabstop>
<tabstop>gridStudColor</tabstop> <tabstop>gridStudColor</tabstop>