Added option to choose the axis icon location. Closes #638.

This commit is contained in:
Leonardo Zide 2021-05-30 11:52:13 -07:00
parent 315a693b6a
commit 685cf78515
7 changed files with 69 additions and 1 deletions

View file

@ -24,6 +24,7 @@ void lcPreferences::LoadDefaults()
mBackgroundGradientColorTop = lcGetProfileInt(LC_PROFILE_GRADIENT_COLOR_TOP);
mBackgroundGradientColorBottom = lcGetProfileInt(LC_PROFILE_GRADIENT_COLOR_BOTTOM);
mDrawAxes = lcGetProfileInt(LC_PROFILE_DRAW_AXES);
mAxisIconLocation = static_cast<lcAxisIconLocation>(lcGetProfileInt(LC_PROFILE_DRAW_AXES_LOCATION));
mAxesColor = lcGetProfileInt(LC_PROFILE_AXES_COLOR);
mTextColor = lcGetProfileInt(LC_PROFILE_TEXT_COLOR);
mMarqueeBorderColor = lcGetProfileInt(LC_PROFILE_MARQUEE_BORDER_COLOR);
@ -74,6 +75,7 @@ void lcPreferences::SaveDefaults()
lcSetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY, mMouseSensitivity);
lcSetProfileInt(LC_PROFILE_SHADING_MODE, static_cast<int>(mShadingMode));
lcSetProfileInt(LC_PROFILE_DRAW_AXES, mDrawAxes);
lcSetProfileInt(LC_PROFILE_DRAW_AXES_LOCATION, static_cast<int>(mAxisIconLocation));
lcSetProfileInt(LC_PROFILE_AXES_COLOR, mAxesColor);
lcSetProfileInt(LC_PROFILE_TEXT_COLOR, mTextColor);
lcSetProfileInt(LC_PROFILE_BACKGROUND_GRADIENT, mBackgroundGradient);

View file

@ -21,6 +21,14 @@ enum class lcColorTheme
System
};
enum class lcAxisIconLocation
{
TopLeft,
TopRight,
BottomLeft,
BottomRight
};
class lcPreferences
{
public:
@ -35,6 +43,7 @@ public:
quint32 mBackgroundGradientColorTop;
quint32 mBackgroundGradientColorBottom;
bool mDrawAxes;
lcAxisIconLocation mAxisIconLocation;
quint32 mAxesColor;
quint32 mTextColor;
quint32 mMarqueeBorderColor;

View file

@ -70,6 +70,7 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
lcProfileEntry("Settings", "GradientColorTop", LC_RGB(54, 72, 95)), // LC_PROFILE_GRADIENT_COLOR_TOP
lcProfileEntry("Settings", "GradientColorBottom", LC_RGB(49, 52, 55)), // LC_PROFILE_GRADIENT_COLOR_BOTTOM
lcProfileEntry("Settings", "DrawAxes", 0), // LC_PROFILE_DRAW_AXES
lcProfileEntry("Settings", "DrawAxesLocation", static_cast<int>(lcAxisIconLocation::BottomLeft)), // LC_PROFILE_DRAW_AXES_LOCATION
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

View file

@ -17,6 +17,7 @@ enum LC_PROFILE_KEY
LC_PROFILE_GRADIENT_COLOR_TOP,
LC_PROFILE_GRADIENT_COLOR_BOTTOM,
LC_PROFILE_DRAW_AXES,
LC_PROFILE_DRAW_AXES_LOCATION,
LC_PROFILE_AXES_COLOR,
LC_PROFILE_TEXT_COLOR,
LC_PROFILE_MARQUEE_BORDER_COLOR,

View file

@ -1239,7 +1239,27 @@ void lcView::DrawAxes() const
21, 22, 23, 21, 23, 24, 21, 24, 25, 21, 25, 26, 21, 26, 27, 21, 27, 28, 21, 28, 29, 21, 29, 22
};
lcMatrix44 TranslationMatrix = lcMatrix44Translation(lcVector3(30.375f, 30.375f, 0.0f));
lcMatrix44 TranslationMatrix;
switch (Preferences.mAxisIconLocation)
{
default:
case lcAxisIconLocation::BottomLeft:
TranslationMatrix = lcMatrix44Translation(lcVector3(32, 32, 0.0f));
break;
case lcAxisIconLocation::BottomRight:
TranslationMatrix = lcMatrix44Translation(lcVector3(mWidth - 36, 32, 0.0f));
break;
case lcAxisIconLocation::TopLeft:
TranslationMatrix = lcMatrix44Translation(lcVector3(32, mHeight - 36, 0.0f));
break;
case lcAxisIconLocation::TopRight:
TranslationMatrix = lcMatrix44Translation(lcVector3(mWidth - 36, mHeight - 36, 0.0f));
break;
}
lcMatrix44 WorldViewMatrix = mCamera->mWorldView;
WorldViewMatrix.SetTranslation(lcVector3(0, 0, 0));

View file

@ -121,6 +121,8 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
ui->GridOriginCheckBox->setChecked(mOptions->Preferences.mDrawGridOrigin);
ui->AxisIconCheckBox->setChecked(mOptions->Preferences.mDrawAxes);
ui->AxisIconLocationCombo->setCurrentIndex((int)mOptions->Preferences.mAxisIconLocation);
if (!mOptions->Preferences.mBackgroundGradient)
ui->BackgroundSolidRadio->setChecked(true);
else
@ -294,6 +296,7 @@ void lcQPreferencesDialog::accept()
mOptions->Preferences.mBackgroundGradient = ui->BackgroundGradientRadio->isChecked();
mOptions->Preferences.mDrawAxes = ui->AxisIconCheckBox->isChecked();
mOptions->Preferences.mAxisIconLocation = (lcAxisIconLocation)ui->AxisIconLocationCombo->currentIndex();
mOptions->Preferences.mViewSphereEnabled = ui->ViewSphereSizeCombo->currentIndex() > 0;
mOptions->Preferences.mViewSphereLocation = (lcViewSphereLocation)ui->ViewSphereLocationCombo->currentIndex();

View file

@ -705,6 +705,37 @@
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QLabel" name="AxisIconLocationLabel">
<property name="text">
<string>Location:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QComboBox" name="AxisIconLocationCombo">
<item>
<property name="text">
<string>Top Left</string>
</property>
</item>
<item>
<property name="text">
<string>Top Right</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom Left</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom Right</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
@ -1782,6 +1813,7 @@
<tabstop>ViewSphereSizeCombo</tabstop>
<tabstop>ViewSphereLocationCombo</tabstop>
<tabstop>AxisIconCheckBox</tabstop>
<tabstop>AxisIconLocationCombo</tabstop>
<tabstop>gridStuds</tabstop>
<tabstop>gridLines</tabstop>
<tabstop>gridLineSpacing</tabstop>