Added option to select the overlay and axis colors. Fixes #464.

This commit is contained in:
Leonardo Zide 2020-07-11 10:47:52 -07:00
parent 7ca69e37b7
commit 0cead36c7f
7 changed files with 151 additions and 57 deletions

View file

@ -18,6 +18,8 @@ void lcPreferences::LoadDefaults()
mMouseSensitivity = lcGetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY); mMouseSensitivity = lcGetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY);
mShadingMode = static_cast<lcShadingMode>(lcGetProfileInt(LC_PROFILE_SHADING_MODE)); mShadingMode = static_cast<lcShadingMode>(lcGetProfileInt(LC_PROFILE_SHADING_MODE));
mDrawAxes = lcGetProfileInt(LC_PROFILE_DRAW_AXES); mDrawAxes = lcGetProfileInt(LC_PROFILE_DRAW_AXES);
mAxesColor = lcGetProfileInt(LC_PROFILE_AXES_COLOR);
mOverlayColor = lcGetProfileInt(LC_PROFILE_OVERLAY_COLOR);
mDrawEdgeLines = lcGetProfileInt(LC_PROFILE_DRAW_EDGE_LINES); mDrawEdgeLines = lcGetProfileInt(LC_PROFILE_DRAW_EDGE_LINES);
mLineWidth = lcGetProfileFloat(LC_PROFILE_LINE_WIDTH); mLineWidth = lcGetProfileFloat(LC_PROFILE_LINE_WIDTH);
mAllowLOD = lcGetProfileInt(LC_PROFILE_ALLOW_LOD); mAllowLOD = lcGetProfileInt(LC_PROFILE_ALLOW_LOD);
@ -46,6 +48,8 @@ void lcPreferences::SaveDefaults()
lcSetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY, mMouseSensitivity); lcSetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY, mMouseSensitivity);
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_OVERLAY_COLOR, mOverlayColor);
lcSetProfileInt(LC_PROFILE_DRAW_EDGE_LINES, mDrawEdgeLines); lcSetProfileInt(LC_PROFILE_DRAW_EDGE_LINES, mDrawEdgeLines);
lcSetProfileFloat(LC_PROFILE_LINE_WIDTH, mLineWidth); lcSetProfileFloat(LC_PROFILE_LINE_WIDTH, mLineWidth);
lcSetProfileInt(LC_PROFILE_ALLOW_LOD, mAllowLOD); lcSetProfileInt(LC_PROFILE_ALLOW_LOD, mAllowLOD);

View file

@ -30,6 +30,8 @@ public:
int mMouseSensitivity; int mMouseSensitivity;
lcShadingMode mShadingMode; lcShadingMode mShadingMode;
bool mDrawAxes; bool mDrawAxes;
quint32 mAxesColor;
quint32 mOverlayColor;
bool mDrawEdgeLines; bool mDrawEdgeLines;
float mLineWidth; float mLineWidth;
bool mAllowLOD; bool mAllowLOD;

View file

@ -64,6 +64,8 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
lcProfileEntry("Settings", "HighlightNewPartsColor", LC_RGBA(255, 242, 0, 192)), // LC_PROFILE_HIGHLIGHT_NEW_PARTS_COLOR lcProfileEntry("Settings", "HighlightNewPartsColor", LC_RGBA(255, 242, 0, 192)), // LC_PROFILE_HIGHLIGHT_NEW_PARTS_COLOR
lcProfileEntry("Settings", "ShadingMode", static_cast<int>(lcShadingMode::DefaultLights)), // LC_PROFILE_SHADING_MODE lcProfileEntry("Settings", "ShadingMode", static_cast<int>(lcShadingMode::DefaultLights)), // LC_PROFILE_SHADING_MODE
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", "OverlayColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_OVERLAY_COLOR
lcProfileEntry("Settings", "DrawEdgeLines", 1), // LC_PROFILE_DRAW_EDGE_LINES lcProfileEntry("Settings", "DrawEdgeLines", 1), // LC_PROFILE_DRAW_EDGE_LINES
lcProfileEntry("Settings", "GridStuds", 1), // LC_PROFILE_GRID_STUDS lcProfileEntry("Settings", "GridStuds", 1), // LC_PROFILE_GRID_STUDS
lcProfileEntry("Settings", "GridStudColor", LC_RGBA(64, 64, 64, 192)), // LC_PROFILE_GRID_STUD_COLOR lcProfileEntry("Settings", "GridStudColor", LC_RGBA(64, 64, 64, 192)), // LC_PROFILE_GRID_STUD_COLOR

View file

@ -12,6 +12,8 @@ enum LC_PROFILE_KEY
LC_PROFILE_HIGHLIGHT_NEW_PARTS_COLOR, LC_PROFILE_HIGHLIGHT_NEW_PARTS_COLOR,
LC_PROFILE_SHADING_MODE, LC_PROFILE_SHADING_MODE,
LC_PROFILE_DRAW_AXES, LC_PROFILE_DRAW_AXES,
LC_PROFILE_AXES_COLOR,
LC_PROFILE_OVERLAY_COLOR,
LC_PROFILE_DRAW_EDGE_LINES, LC_PROFILE_DRAW_EDGE_LINES,
LC_PROFILE_GRID_STUDS, LC_PROFILE_GRID_STUDS,
LC_PROFILE_GRID_STUD_COLOR, LC_PROFILE_GRID_STUD_COLOR,

View file

@ -1532,7 +1532,7 @@ void View::DrawRotateViewOverlay()
mContext->SetProjectionMatrix(lcMatrix44Ortho(0, w, 0, h, -1, 1)); mContext->SetProjectionMatrix(lcMatrix44Ortho(0, w, 0, h, -1, 1));
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
mContext->SetColor(0.0f, 0.0f, 0.0f, 1.0f); mContext->SetColor(lcVector4FromColor(lcGetPreferences().mOverlayColor));
float Verts[32 * 16 * 2]; float Verts[32 * 16 * 2];
float* CurVert = Verts; float* CurVert = Verts;
@ -1824,7 +1824,7 @@ void View::DrawAxes()
mContext->SetVertexBufferPointer(TextBuffer); mContext->SetVertexBufferPointer(TextBuffer);
mContext->SetVertexFormat(0, 3, 0, 2, 0, false); mContext->SetVertexFormat(0, 3, 0, 2, 0, false);
mContext->SetColor(0.0f, 0.0f, 0.0f, 1.0f); mContext->SetColor(lcVector4FromColor(lcGetPreferences().mAxesColor));
mContext->DrawPrimitives(GL_TRIANGLES, 0, 6 * 3); mContext->DrawPrimitives(GL_TRIANGLES, 0, 6 * 3);
glDisable(GL_BLEND); glDisable(GL_BLEND);

View file

@ -28,6 +28,8 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
delete ui->povrayLayout; delete ui->povrayLayout;
#endif #endif
connect(ui->AxesColorButton, 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()));
connect(ui->gridStudColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked())); connect(ui->gridStudColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
@ -89,7 +91,7 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
ui->gridStuds->setChecked(mOptions->Preferences.mDrawGridStuds); ui->gridStuds->setChecked(mOptions->Preferences.mDrawGridStuds);
ui->gridLines->setChecked(mOptions->Preferences.mDrawGridLines); ui->gridLines->setChecked(mOptions->Preferences.mDrawGridLines);
ui->gridLineSpacing->setText(QString::number(mOptions->Preferences.mGridLineSpacing)); ui->gridLineSpacing->setText(QString::number(mOptions->Preferences.mGridLineSpacing));
ui->axisIcon->setChecked(mOptions->Preferences.mDrawAxes); ui->AxisIconCheckBox->setChecked(mOptions->Preferences.mDrawAxes);
ui->ViewSphereLocationCombo->setCurrentIndex((int)mOptions->Preferences.mViewSphereLocation); ui->ViewSphereLocationCombo->setCurrentIndex((int)mOptions->Preferences.mViewSphereLocation);
@ -126,6 +128,12 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
QPixmap pix(12, 12); QPixmap pix(12, 12);
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.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.mFadeStepsColor), LC_RGBA_GREEN(mOptions->Preferences.mFadeStepsColor), LC_RGBA_BLUE(mOptions->Preferences.mFadeStepsColor))); 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); ui->FadeStepsColor->setIcon(pix);
@ -228,7 +236,7 @@ void lcQPreferencesDialog::accept()
mOptions->Preferences.mDrawGridLines = ui->gridLines->isChecked(); mOptions->Preferences.mDrawGridLines = ui->gridLines->isChecked();
mOptions->Preferences.mGridLineSpacing = gridLineSpacing; mOptions->Preferences.mGridLineSpacing = gridLineSpacing;
mOptions->Preferences.mDrawAxes = ui->axisIcon->isChecked(); mOptions->Preferences.mDrawAxes = ui->AxisIconCheckBox->isChecked();
mOptions->Preferences.mViewSphereLocation = (lcViewSphereLocation)ui->ViewSphereLocationCombo->currentIndex(); mOptions->Preferences.mViewSphereLocation = (lcViewSphereLocation)ui->ViewSphereLocationCombo->currentIndex();
switch (ui->ViewSphereSizeCombo->currentIndex()) switch (ui->ViewSphereSizeCombo->currentIndex())
@ -318,7 +326,19 @@ void lcQPreferencesDialog::ColorButtonClicked()
quint32* Color = nullptr; quint32* Color = nullptr;
QColorDialog::ColorDialogOptions DialogOptions; QColorDialog::ColorDialogOptions DialogOptions;
if (Button == ui->FadeStepsColor) if (Button == ui->AxesColorButton)
{
Color = &mOptions->Preferences.mAxesColor;
Title = tr("Select Axes Color");
DialogOptions = 0;
}
else if (Button == ui->OverlayColorButton)
{
Color = &mOptions->Preferences.mOverlayColor;
Title = tr("Select Overlay Color");
DialogOptions = 0;
}
else if (Button == ui->FadeStepsColor)
{ {
Color = &mOptions->Preferences.mFadeStepsColor; Color = &mOptions->Preferences.mFadeStepsColor;
Title = tr("Select Fade Color"); Title = tr("Select Fade Color");

View file

@ -309,7 +309,20 @@
<item> <item>
<widget class="QWidget" name="widget" native="true"> <widget class="QWidget" name="widget" native="true">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="6" column="0"> <item row="0" column="3">
<spacer name="horizontalSpacer_2">
<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="5" column="0">
<widget class="QCheckBox" name="HighlightNewParts"> <widget class="QCheckBox" name="HighlightNewParts">
<property name="text"> <property name="text">
<string>Highlight new parts</string> <string>Highlight new parts</string>
@ -335,23 +348,17 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="0" column="3"> <item row="3" column="0">
<spacer name="horizontalSpacer_2"> <widget class="QCheckBox" name="MeshLOD">
<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="0">
<widget class="QCheckBox" name="studLogo">
<property name="text"> <property name="text">
<string>Stud Logo</string> <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> </property>
</widget> </widget>
</item> </item>
@ -384,10 +391,10 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="1" column="0">
<widget class="QCheckBox" name="edgeLines"> <widget class="QCheckBox" name="studLogo">
<property name="text"> <property name="text">
<string>Edge lines</string> <string>Stud Logo</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -398,21 +405,21 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="0">
<widget class="QCheckBox" name="MeshLOD"> <widget class="QCheckBox" name="FadeSteps">
<property name="text"> <property name="text">
<string>Mesh LOD</string> <string>Fade previous steps</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0"> <item row="7" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Shading Mode:</string> <string>Shading Mode:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1" colspan="2"> <item row="7" column="1" colspan="2">
<widget class="QComboBox" name="ShadingMode"> <widget class="QComboBox" name="ShadingMode">
<item> <item>
<property name="text"> <property name="text">
@ -431,28 +438,14 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="4" column="1">
<widget class="QCheckBox" name="axisIcon">
<property name="text">
<string>Axis icon</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="FadeSteps">
<property name="text">
<string>Fade previous steps</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QToolButton" name="FadeStepsColor"> <widget class="QToolButton" name="FadeStepsColor">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="5" column="1">
<widget class="QToolButton" name="HighlightNewPartsColor"> <widget class="QToolButton" name="HighlightNewPartsColor">
<property name="text"> <property name="text">
<string/> <string/>
@ -485,6 +478,76 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Interface</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<widget class="QGroupBox" name="groupBox_6">
<property name="title">
<string>Overlays</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="1">
<widget class="QToolButton" name="AxesColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="AxisIconCheckBox">
<property name="text">
<string>Axis icon</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_7">
<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="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Overlay Color:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QToolButton" name="OverlayColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="groupBox_4"> <widget class="QGroupBox" name="groupBox_4">
<property name="title"> <property name="title">
@ -553,13 +616,13 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="ViewSphereGroup"> <widget class="QGroupBox" name="ViewSphereGroup_2">
<property name="title"> <property name="title">
<string>View Sphere</string> <string>View Sphere</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="7"> <item row="0" column="7">
<spacer name="horizontalSpacer_7"> <spacer name="horizontalSpacer_9">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -596,14 +659,14 @@
</widget> </widget>
</item> </item>
<item row="2" column="5"> <item row="2" column="5">
<widget class="QLabel" name="label_16"> <widget class="QLabel" name="label_20">
<property name="text"> <property name="text">
<string>Highlight Color:</string> <string>Highlight Color:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_21">
<property name="text"> <property name="text">
<string>Size:</string> <string>Size:</string>
</property> </property>
@ -617,7 +680,7 @@
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_14"> <widget class="QLabel" name="label_22">
<property name="text"> <property name="text">
<string>Color:</string> <string>Color:</string>
</property> </property>
@ -631,14 +694,14 @@
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="2" column="2">
<widget class="QLabel" name="label_15"> <widget class="QLabel" name="label_23">
<property name="text"> <property name="text">
<string>Text Color:</string> <string>Text Color:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_24">
<property name="text"> <property name="text">
<string>Location:</string> <string>Location:</string>
</property> </property>
@ -679,7 +742,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -1227,14 +1290,15 @@
<tabstop>studLogoCombo</tabstop> <tabstop>studLogoCombo</tabstop>
<tabstop>edgeLines</tabstop> <tabstop>edgeLines</tabstop>
<tabstop>LineWidthSlider</tabstop> <tabstop>LineWidthSlider</tabstop>
<tabstop>LineWidthLabel</tabstop>
<tabstop>MeshLOD</tabstop> <tabstop>MeshLOD</tabstop>
<tabstop>axisIcon</tabstop>
<tabstop>FadeSteps</tabstop> <tabstop>FadeSteps</tabstop>
<tabstop>FadeStepsColor</tabstop> <tabstop>FadeStepsColor</tabstop>
<tabstop>HighlightNewParts</tabstop> <tabstop>HighlightNewParts</tabstop>
<tabstop>HighlightNewPartsColor</tabstop> <tabstop>HighlightNewPartsColor</tabstop>
<tabstop>ShadingMode</tabstop> <tabstop>ShadingMode</tabstop>
<tabstop>AxisIconCheckBox</tabstop>
<tabstop>AxesColorButton</tabstop>
<tabstop>OverlayColorButton</tabstop>
<tabstop>gridStuds</tabstop> <tabstop>gridStuds</tabstop>
<tabstop>gridStudColor</tabstop> <tabstop>gridStudColor</tabstop>
<tabstop>gridLines</tabstop> <tabstop>gridLines</tabstop>