mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Customizable marquee colors. Fixes #544.
This commit is contained in:
parent
87d3dab0bb
commit
6c06e329e6
7 changed files with 130 additions and 93 deletions
|
@ -26,6 +26,8 @@ void lcPreferences::LoadDefaults()
|
|||
mDrawAxes = lcGetProfileInt(LC_PROFILE_DRAW_AXES);
|
||||
mAxesColor = lcGetProfileInt(LC_PROFILE_AXES_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);
|
||||
mActiveViewColor = lcGetProfileInt(LC_PROFILE_ACTIVE_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_GRADIENT_COLOR_TOP, mBackgroundGradientColorTop);
|
||||
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_ACTIVE_VIEW_COLOR, mActiveViewColor);
|
||||
lcSetProfileInt(LC_PROFILE_INACTIVE_VIEW_COLOR, mInactiveViewColor);
|
||||
|
|
|
@ -36,6 +36,8 @@ public:
|
|||
bool mDrawAxes;
|
||||
quint32 mAxesColor;
|
||||
quint32 mTextColor;
|
||||
quint32 mMarqueeBorderColor;
|
||||
quint32 mMarqueeFillColor;
|
||||
quint32 mOverlayColor;
|
||||
quint32 mActiveViewColor;
|
||||
quint32 mInactiveViewColor;
|
||||
|
|
|
@ -72,6 +72,8 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
|||
lcProfileEntry("Settings", "DrawAxes", 0), // LC_PROFILE_DRAW_AXES
|
||||
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", "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", "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
|
||||
|
|
|
@ -19,6 +19,8 @@ enum LC_PROFILE_KEY
|
|||
LC_PROFILE_DRAW_AXES,
|
||||
LC_PROFILE_AXES_COLOR,
|
||||
LC_PROFILE_TEXT_COLOR,
|
||||
LC_PROFILE_MARQUEE_BORDER_COLOR,
|
||||
LC_PROFILE_MARQUEE_FILL_COLOR,
|
||||
LC_PROFILE_OVERLAY_COLOR,
|
||||
LC_PROFILE_ACTIVE_VIEW_COLOR,
|
||||
LC_PROFILE_INACTIVE_VIEW_COLOR,
|
||||
|
|
|
@ -1719,18 +1719,22 @@ void lcView::DrawSelectZoomRegionOverlay()
|
|||
{ Right - BorderX, Top - BorderY },
|
||||
};
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
mContext->SetVertexBufferPointer(Verts);
|
||||
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->SetColor(0.25f, 0.25f, 1.0f, 0.25f);
|
||||
mContext->DrawPrimitives(GL_TRIANGLE_STRIP, 10, 4);
|
||||
if (LC_RGBA_ALPHA(Preferences.mMarqueeFillColor))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
|||
connect(ui->BackgroundGradient2ColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
||||
connect(ui->AxesColorButton, 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->FadeStepsColor, 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->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)));
|
||||
ui->BackgroundSolidColorButton->setIcon(pix);
|
||||
Pixmap.fill(QColor(LC_RGBA_RED(Color), LC_RGBA_GREEN(Color), LC_RGBA_BLUE(Color)));
|
||||
Button->setIcon(Pixmap);
|
||||
};
|
||||
|
||||
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mBackgroundGradientColorTop), LC_RGBA_GREEN(mOptions->Preferences.mBackgroundGradientColorTop), LC_RGBA_BLUE(mOptions->Preferences.mBackgroundGradientColorTop)));
|
||||
ui->BackgroundGradient1ColorButton->setIcon(pix);
|
||||
|
||||
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mBackgroundGradientColorBottom), LC_RGBA_GREEN(mOptions->Preferences.mBackgroundGradientColorBottom), LC_RGBA_BLUE(mOptions->Preferences.mBackgroundGradientColorBottom)));
|
||||
ui->BackgroundGradient2ColorButton->setIcon(pix);
|
||||
|
||||
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);
|
||||
|
||||
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)));
|
||||
ui->OverlayColorButton->setIcon(pix);
|
||||
|
||||
pix.fill(QColor(LC_RGBA_RED(mOptions->Preferences.mActiveViewColor), LC_RGBA_GREEN(mOptions->Preferences.mActiveViewColor), LC_RGBA_BLUE(mOptions->Preferences.mActiveViewColor)));
|
||||
ui->ActiveViewColorButton->setIcon(pix);
|
||||
|
||||
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);
|
||||
SetButtonPixmap(mOptions->Preferences.mBackgroundSolidColor, ui->BackgroundSolidColorButton);
|
||||
SetButtonPixmap(mOptions->Preferences.mBackgroundGradientColorTop, ui->BackgroundGradient1ColorButton);
|
||||
SetButtonPixmap(mOptions->Preferences.mBackgroundGradientColorBottom, ui->BackgroundGradient2ColorButton);
|
||||
SetButtonPixmap(mOptions->Preferences.mAxesColor, ui->AxesColorButton);
|
||||
SetButtonPixmap(mOptions->Preferences.mTextColor, ui->TextColorButton);
|
||||
SetButtonPixmap(mOptions->Preferences.mMarqueeBorderColor, ui->MarqueeBorderColorButton);
|
||||
SetButtonPixmap(mOptions->Preferences.mMarqueeFillColor, ui->MarqueeFillColorButton);
|
||||
SetButtonPixmap(mOptions->Preferences.mOverlayColor, ui->OverlayColorButton);
|
||||
SetButtonPixmap(mOptions->Preferences.mActiveViewColor, ui->ActiveViewColorButton);
|
||||
SetButtonPixmap(mOptions->Preferences.mInactiveViewColor, ui->InactiveViewColorButton);
|
||||
SetButtonPixmap(mOptions->Preferences.mFadeStepsColor, ui->FadeStepsColor);
|
||||
SetButtonPixmap(mOptions->Preferences.mHighlightNewPartsColor, ui->HighlightNewPartsColor);
|
||||
SetButtonPixmap(mOptions->Preferences.mGridStudColor, ui->gridStudColor);
|
||||
SetButtonPixmap(mOptions->Preferences.mGridLineColor, ui->gridLineColor);
|
||||
SetButtonPixmap(mOptions->Preferences.mViewSphereColor, ui->ViewSphereColorButton);
|
||||
SetButtonPixmap(mOptions->Preferences.mViewSphereTextColor, ui->ViewSphereTextColorButton);
|
||||
SetButtonPixmap(mOptions->Preferences.mViewSphereHighlightColor, ui->ViewSphereHighlightColorButton);
|
||||
|
||||
on_studLogo_toggled();
|
||||
on_antiAliasing_toggled();
|
||||
|
@ -452,6 +433,17 @@ void lcQPreferencesDialog::ColorButtonClicked()
|
|||
Color = &mOptions->Preferences.mTextColor;
|
||||
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)
|
||||
{
|
||||
Color = &mOptions->Preferences.mOverlayColor;
|
||||
|
@ -518,6 +510,7 @@ void lcQPreferencesDialog::ColorButtonClicked()
|
|||
|
||||
QPixmap pix(12, 12);
|
||||
|
||||
newColor.setAlpha(255);
|
||||
pix.fill(newColor);
|
||||
((QToolButton*)Button)->setIcon(pix);
|
||||
}
|
||||
|
|
|
@ -898,17 +898,10 @@
|
|||
<string>Interface</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<item row="2" column="1">
|
||||
<widget class="QToolButton" name="AxesColorButton">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_32">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_31">
|
||||
<property name="text">
|
||||
<string>Axis Icon:</string>
|
||||
<string>Inactive View Border:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -919,10 +912,24 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_32">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -933,38 +940,10 @@
|
|||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<item row="2" 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/>
|
||||
<string>Camera Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -981,6 +960,55 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</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>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1687,6 +1715,8 @@
|
|||
<tabstop>InactiveViewColorButton</tabstop>
|
||||
<tabstop>TextColorButton</tabstop>
|
||||
<tabstop>AxesColorButton</tabstop>
|
||||
<tabstop>MarqueeBorderColorButton</tabstop>
|
||||
<tabstop>MarqueeFillColorButton</tabstop>
|
||||
<tabstop>OverlayColorButton</tabstop>
|
||||
<tabstop>gridLineColor</tabstop>
|
||||
<tabstop>gridStudColor</tabstop>
|
||||
|
|
Loading…
Reference in a new issue