diff --git a/common/lc_application.cpp b/common/lc_application.cpp
index 462b5a2a..756568ab 100644
--- a/common/lc_application.cpp
+++ b/common/lc_application.cpp
@@ -25,6 +25,8 @@ void lcPreferences::LoadDefaults()
mDrawGridLines = lcGetProfileInt(LC_PROFILE_GRID_LINES);
mGridLineSpacing = lcGetProfileInt(LC_PROFILE_GRID_LINE_SPACING);
mGridLineColor = lcGetProfileInt(LC_PROFILE_GRID_LINE_COLOR);
+ mViewCubeLocation = (lcViewCubeLocation)lcGetProfileInt(LC_PROFILE_VIEW_CUBE_LOCATION);
+ mViewCubeSize = lcGetProfileInt(LC_PROFILE_VIEW_CUBE_SIZE);
}
void lcPreferences::SaveDefaults()
@@ -40,6 +42,8 @@ void lcPreferences::SaveDefaults()
lcSetProfileInt(LC_PROFILE_GRID_LINES, mDrawGridLines);
lcSetProfileInt(LC_PROFILE_GRID_LINE_SPACING, mGridLineSpacing);
lcSetProfileInt(LC_PROFILE_GRID_LINE_COLOR, mGridLineColor);
+ lcSetProfileInt(LC_PROFILE_VIEW_CUBE_LOCATION, (int)mViewCubeLocation);
+ lcSetProfileInt(LC_PROFILE_VIEW_CUBE_SIZE, mViewCubeSize);
}
lcApplication::lcApplication(int& Argc, char** Argv)
diff --git a/common/lc_application.h b/common/lc_application.h
index 63d3917c..8a46ffe6 100644
--- a/common/lc_application.h
+++ b/common/lc_application.h
@@ -14,6 +14,15 @@ enum lcShadingMode
LC_NUM_SHADING_MODES
};
+enum class lcViewCubeLocation
+{
+ DISABLED,
+ TOP_LEFT,
+ TOP_RIGHT,
+ BOTTOM_LEFT,
+ BOTTOM_RIGHT
+};
+
class lcPreferences
{
public:
@@ -31,6 +40,8 @@ public:
int mGridLineSpacing;
quint32 mGridLineColor;
bool mFixedAxes;
+ lcViewCubeLocation mViewCubeLocation;
+ int mViewCubeSize;
};
class lcApplication : public QApplication
diff --git a/common/lc_profile.cpp b/common/lc_profile.cpp
index 37fa2bb3..b5552ded 100644
--- a/common/lc_profile.cpp
+++ b/common/lc_profile.cpp
@@ -55,64 +55,66 @@ lcProfileEntry::lcProfileEntry(const char* Section, const char* Key)
lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
{
- lcProfileEntry("Settings", "FixedAxes", false), // LC_PROFILE_FIXED_AXES
- lcProfileEntry("Settings", "LineWidth", 1.0f), // LC_PROFILE_LINE_WIDTH
- lcProfileEntry("Settings", "ShadingMode", LC_SHADING_DEFAULT_LIGHTS), // LC_PROFILE_SHADING_MODE
- lcProfileEntry("Settings", "DrawAxes", 0), // LC_PROFILE_DRAW_AXES
- lcProfileEntry("Settings", "DrawEdgeLines", 1), // LC_PROFILE_DRAW_EDGE_LINES
- lcProfileEntry("Settings", "GridStuds", 1), // LC_PROFILE_GRID_STUDS
- lcProfileEntry("Settings", "GridStudColor", LC_RGBA(64, 64, 64, 192)), // LC_PROFILE_GRID_STUD_COLOR
- lcProfileEntry("Settings", "GridLines", 1), // LC_PROFILE_GRID_LINES
- lcProfileEntry("Settings", "GridLineSpacing", 5), // LC_PROFILE_GRID_LINE_SPACING
- lcProfileEntry("Settings", "GridLineColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_GRID_LINE_COLOR
- lcProfileEntry("Settings", "AASamples", 1), // LC_PROFILE_ANTIALIASING_SAMPLES
+ lcProfileEntry("Settings", "FixedAxes", false), // LC_PROFILE_FIXED_AXES
+ lcProfileEntry("Settings", "LineWidth", 1.0f), // LC_PROFILE_LINE_WIDTH
+ lcProfileEntry("Settings", "ShadingMode", LC_SHADING_DEFAULT_LIGHTS), // LC_PROFILE_SHADING_MODE
+ lcProfileEntry("Settings", "DrawAxes", 0), // LC_PROFILE_DRAW_AXES
+ lcProfileEntry("Settings", "DrawEdgeLines", 1), // LC_PROFILE_DRAW_EDGE_LINES
+ lcProfileEntry("Settings", "GridStuds", 1), // LC_PROFILE_GRID_STUDS
+ lcProfileEntry("Settings", "GridStudColor", LC_RGBA(64, 64, 64, 192)), // LC_PROFILE_GRID_STUD_COLOR
+ lcProfileEntry("Settings", "GridLines", 1), // LC_PROFILE_GRID_LINES
+ lcProfileEntry("Settings", "GridLineSpacing", 5), // LC_PROFILE_GRID_LINE_SPACING
+ lcProfileEntry("Settings", "GridLineColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_GRID_LINE_COLOR
+ lcProfileEntry("Settings", "AASamples", 1), // LC_PROFILE_ANTIALIASING_SAMPLES
+ lcProfileEntry("Settings", "ViewCubeLocation", (int)lcViewCubeLocation::TOP_RIGHT), // LC_PROFILE_VIEW_CUBE_LOCATION
+ lcProfileEntry("Settings", "ViewCubeSize", 100), // LC_PROFILE_VIEW_CUBE_SIZE
- lcProfileEntry("Settings", "CheckUpdates", 1), // LC_PROFILE_CHECK_UPDATES
- lcProfileEntry("Settings", "ProjectsPath", ""), // LC_PROFILE_PROJECTS_PATH
- lcProfileEntry("Settings", "PartsLibrary", ""), // LC_PROFILE_PARTS_LIBRARY
- lcProfileEntry("Settings", "Shortcuts"), // LC_PROFILE_KEYBOARD_SHORTCUTS
- lcProfileEntry("Settings", "MouseShortcuts", QStringList()), // LC_PROFILE_MOUSE_SHORTCUTS
- lcProfileEntry("Settings", "Categories"), // LC_PROFILE_CATEGORIES
- lcProfileEntry("Settings", "RecentFile1", ""), // LC_PROFILE_RECENT_FILE1
- lcProfileEntry("Settings", "RecentFile2", ""), // LC_PROFILE_RECENT_FILE2
- lcProfileEntry("Settings", "RecentFile3", ""), // LC_PROFILE_RECENT_FILE3
- lcProfileEntry("Settings", "RecentFile4", ""), // LC_PROFILE_RECENT_FILE4
- lcProfileEntry("Settings", "AutosaveInterval", 10), // LC_PROFILE_AUTOSAVE_INTERVAL
- lcProfileEntry("Settings", "MouseSensitivity", 11), // LC_PROFILE_MOUSE_SENSITIVITY
- lcProfileEntry("Settings", "ImageWidth", 1280), // LC_PROFILE_IMAGE_WIDTH
- lcProfileEntry("Settings", "ImageHeight", 720), // LC_PROFILE_IMAGE_HEIGHT
- lcProfileEntry("Settings", "ImageExtension", ".png"), // LC_PROFILE_IMAGE_EXTENSION
- lcProfileEntry("Settings", "PrintRows", 1), // LC_PROFILE_PRINT_ROWS
- lcProfileEntry("Settings", "PrintColumns", 1), // LC_PROFILE_PRINT_COLUMNS
- lcProfileEntry("Settings", "PartsListIcons", 64), // LC_PROFILE_PARTS_LIST_ICONS
- lcProfileEntry("Settings", "PartsListNames", 0), // LC_PROFILE_PARTS_LIST_NAMES
- lcProfileEntry("Settings", "PartsListFixedColor", -1), // LC_PROFILE_PARTS_LIST_FIXED_COLOR
- lcProfileEntry("Settings", "PartsListDecorated", 1), // LC_PROFILE_PARTS_LIST_DECORATED
- lcProfileEntry("Settings", "PartsListListMode", 0), // LC_PROFILE_PARTS_LIST_LISTMODE
+ lcProfileEntry("Settings", "CheckUpdates", 1), // LC_PROFILE_CHECK_UPDATES
+ lcProfileEntry("Settings", "ProjectsPath", ""), // LC_PROFILE_PROJECTS_PATH
+ lcProfileEntry("Settings", "PartsLibrary", ""), // LC_PROFILE_PARTS_LIBRARY
+ lcProfileEntry("Settings", "Shortcuts"), // LC_PROFILE_KEYBOARD_SHORTCUTS
+ lcProfileEntry("Settings", "MouseShortcuts", QStringList()), // LC_PROFILE_MOUSE_SHORTCUTS
+ lcProfileEntry("Settings", "Categories"), // LC_PROFILE_CATEGORIES
+ lcProfileEntry("Settings", "RecentFile1", ""), // LC_PROFILE_RECENT_FILE1
+ lcProfileEntry("Settings", "RecentFile2", ""), // LC_PROFILE_RECENT_FILE2
+ lcProfileEntry("Settings", "RecentFile3", ""), // LC_PROFILE_RECENT_FILE3
+ lcProfileEntry("Settings", "RecentFile4", ""), // LC_PROFILE_RECENT_FILE4
+ lcProfileEntry("Settings", "AutosaveInterval", 10), // LC_PROFILE_AUTOSAVE_INTERVAL
+ lcProfileEntry("Settings", "MouseSensitivity", 11), // LC_PROFILE_MOUSE_SENSITIVITY
+ lcProfileEntry("Settings", "ImageWidth", 1280), // LC_PROFILE_IMAGE_WIDTH
+ lcProfileEntry("Settings", "ImageHeight", 720), // LC_PROFILE_IMAGE_HEIGHT
+ lcProfileEntry("Settings", "ImageExtension", ".png"), // LC_PROFILE_IMAGE_EXTENSION
+ lcProfileEntry("Settings", "PrintRows", 1), // LC_PROFILE_PRINT_ROWS
+ lcProfileEntry("Settings", "PrintColumns", 1), // LC_PROFILE_PRINT_COLUMNS
+ lcProfileEntry("Settings", "PartsListIcons", 64), // LC_PROFILE_PARTS_LIST_ICONS
+ lcProfileEntry("Settings", "PartsListNames", 0), // LC_PROFILE_PARTS_LIST_NAMES
+ lcProfileEntry("Settings", "PartsListFixedColor", -1), // LC_PROFILE_PARTS_LIST_FIXED_COLOR
+ lcProfileEntry("Settings", "PartsListDecorated", 1), // LC_PROFILE_PARTS_LIST_DECORATED
+ lcProfileEntry("Settings", "PartsListListMode", 0), // LC_PROFILE_PARTS_LIST_LISTMODE
- lcProfileEntry("Defaults", "Author", ""), // LC_PROFILE_DEFAULT_AUTHOR_NAME
- lcProfileEntry("Defaults", "FloorColor", LC_RGB(0, 191, 0)), // LC_PROFILE_DEFAULT_FLOOR_COLOR
- lcProfileEntry("Defaults", "FloorTexture", ""), // LC_PROFILE_DEFAULT_FLOOR_TEXTURE
- lcProfileEntry("Defaults", "AmbientColor", LC_RGB(75, 75, 75)), // LC_PROFILE_DEFAULT_AMBIENT_COLOR
- lcProfileEntry("Defaults", "BackgroundType", LC_BACKGROUND_SOLID), // LC_PROFILE_DEFAULT_BACKGROUND_TYPE
- lcProfileEntry("Defaults", "BackgroundColor", LC_RGB(255, 255, 255)), // LC_PROFILE_DEFAULT_BACKGROUND_COLOR
- lcProfileEntry("Defaults", "GradientColor1", LC_RGB(0, 0, 191)), // LC_PROFILE_DEFAULT_GRADIENT_COLOR1
- lcProfileEntry("Defaults", "GradientColor2", LC_RGB(255, 255, 255)), // LC_PROFILE_DEFAULT_GRADIENT_COLOR2
- lcProfileEntry("Defaults", "BackgroundTexture", ""), // LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE
- lcProfileEntry("Defaults", "BackgroundTile", 0), // LC_PROFILE_DEFAULT_BACKGROUND_TILE
+ lcProfileEntry("Defaults", "Author", ""), // LC_PROFILE_DEFAULT_AUTHOR_NAME
+ lcProfileEntry("Defaults", "FloorColor", LC_RGB(0, 191, 0)), // LC_PROFILE_DEFAULT_FLOOR_COLOR
+ lcProfileEntry("Defaults", "FloorTexture", ""), // LC_PROFILE_DEFAULT_FLOOR_TEXTURE
+ lcProfileEntry("Defaults", "AmbientColor", LC_RGB(75, 75, 75)), // LC_PROFILE_DEFAULT_AMBIENT_COLOR
+ lcProfileEntry("Defaults", "BackgroundType", LC_BACKGROUND_SOLID), // LC_PROFILE_DEFAULT_BACKGROUND_TYPE
+ lcProfileEntry("Defaults", "BackgroundColor", LC_RGB(255, 255, 255)), // LC_PROFILE_DEFAULT_BACKGROUND_COLOR
+ lcProfileEntry("Defaults", "GradientColor1", LC_RGB(0, 0, 191)), // LC_PROFILE_DEFAULT_GRADIENT_COLOR1
+ lcProfileEntry("Defaults", "GradientColor2", LC_RGB(255, 255, 255)), // LC_PROFILE_DEFAULT_GRADIENT_COLOR2
+ lcProfileEntry("Defaults", "BackgroundTexture", ""), // LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE
+ lcProfileEntry("Defaults", "BackgroundTile", 0), // LC_PROFILE_DEFAULT_BACKGROUND_TILE
- lcProfileEntry("HTML", "Options", LC_HTML_SINGLEPAGE), // LC_PROFILE_HTML_OPTIONS
- lcProfileEntry("HTML", "ImageOptions", LC_IMAGE_TRANSPARENT), // LC_PROFILE_HTML_IMAGE_OPTIONS
- lcProfileEntry("HTML", "ImageWidth", 640), // LC_PROFILE_HTML_IMAGE_WIDTH
- lcProfileEntry("HTML", "ImageHeight", 480), // LC_PROFILE_HTML_IMAGE_HEIGHT
- lcProfileEntry("HTML", "PartsColor", 16), // LC_PROFILE_HTML_PARTS_COLOR
- lcProfileEntry("HTML", "PartsWidth", 128), // LC_PROFILE_HTML_PARTS_WIDTH
- lcProfileEntry("HTML", "PartsHeight", 128), // LC_PROFILE_HTML_PARTS_HEIGHT
+ lcProfileEntry("HTML", "Options", LC_HTML_SINGLEPAGE), // LC_PROFILE_HTML_OPTIONS
+ lcProfileEntry("HTML", "ImageOptions", LC_IMAGE_TRANSPARENT), // LC_PROFILE_HTML_IMAGE_OPTIONS
+ lcProfileEntry("HTML", "ImageWidth", 640), // LC_PROFILE_HTML_IMAGE_WIDTH
+ lcProfileEntry("HTML", "ImageHeight", 480), // LC_PROFILE_HTML_IMAGE_HEIGHT
+ lcProfileEntry("HTML", "PartsColor", 16), // LC_PROFILE_HTML_PARTS_COLOR
+ lcProfileEntry("HTML", "PartsWidth", 128), // LC_PROFILE_HTML_PARTS_WIDTH
+ lcProfileEntry("HTML", "PartsHeight", 128), // LC_PROFILE_HTML_PARTS_HEIGHT
- lcProfileEntry("POVRay", "Path", "/usr/bin/povray"), // LC_PROFILE_POVRAY_PATH
- lcProfileEntry("POVRay", "LGEOPath", ""), // LC_PROFILE_POVRAY_LGEO_PATH
- lcProfileEntry("POVRay", "Width", 1280), // LC_PROFILE_POVRAY_WIDTH
- lcProfileEntry("POVRay", "Height", 720) // LC_PROFILE_POVRAY_HEIGHT
+ lcProfileEntry("POVRay", "Path", "/usr/bin/povray"), // LC_PROFILE_POVRAY_PATH
+ lcProfileEntry("POVRay", "LGEOPath", ""), // LC_PROFILE_POVRAY_LGEO_PATH
+ lcProfileEntry("POVRay", "Width", 1280), // LC_PROFILE_POVRAY_WIDTH
+ lcProfileEntry("POVRay", "Height", 720) // LC_PROFILE_POVRAY_HEIGHT
};
void lcRemoveProfileKey(LC_PROFILE_KEY Key)
diff --git a/common/lc_profile.h b/common/lc_profile.h
index c8320a16..13e1538a 100644
--- a/common/lc_profile.h
+++ b/common/lc_profile.h
@@ -14,6 +14,8 @@ enum LC_PROFILE_KEY
LC_PROFILE_GRID_LINE_SPACING,
LC_PROFILE_GRID_LINE_COLOR,
LC_PROFILE_ANTIALIASING_SAMPLES,
+ LC_PROFILE_VIEW_CUBE_LOCATION,
+ LC_PROFILE_VIEW_CUBE_SIZE,
LC_PROFILE_CHECK_UPDATES,
LC_PROFILE_PROJECTS_PATH,
diff --git a/common/lc_viewcube.cpp b/common/lc_viewcube.cpp
index 996978c0..6fafb657 100644
--- a/common/lc_viewcube.cpp
+++ b/common/lc_viewcube.cpp
@@ -3,9 +3,9 @@
#include "view.h"
#include "lc_context.h"
#include "texfont.h"
+#include "lc_application.h"
-//todo: move these and add preferences
-const int ViewportSize = 100;
+//todo: move these
const float BoxSize = 10.0f;
lcViewCube::lcViewCube(View* View)
@@ -28,11 +28,20 @@ lcMatrix44 lcViewCube::GetProjectionMatrix() const
void lcViewCube::Draw()
{
+ const lcPreferences& Preferences = lcGetPreferences();
+ lcViewCubeLocation Location = Preferences.mViewCubeLocation;
+
+ if (Location == lcViewCubeLocation::DISABLED)
+ return;
+
lcContext* Context = mView->mContext;
int Width = mView->mWidth;
int Height = mView->mHeight;
+ int ViewportSize = Preferences.mViewCubeSize;
- Context->SetViewport(Width - ViewportSize, Height - ViewportSize, ViewportSize, ViewportSize);
+ int Left = (Location == lcViewCubeLocation::BOTTOM_LEFT || Location == lcViewCubeLocation::TOP_LEFT) ? 0 : Width - ViewportSize;
+ int Bottom = (Location == lcViewCubeLocation::BOTTOM_LEFT || Location == lcViewCubeLocation::BOTTOM_RIGHT) ? 0 : Height - ViewportSize;
+ Context->SetViewport(Left, Bottom, ViewportSize, ViewportSize);
const lcVector3 BoxVerts[8] =
{
@@ -226,6 +235,10 @@ void lcViewCube::Draw()
bool lcViewCube::OnLeftButtonUp()
{
+ const lcPreferences& Preferences = lcGetPreferences();
+ if (Preferences.mViewCubeLocation == lcViewCubeLocation::DISABLED)
+ return false;
+
if (!mIntersectionFlags.any())
return false;
@@ -246,12 +259,21 @@ bool lcViewCube::OnLeftButtonUp()
bool lcViewCube::OnMouseMove()
{
- int x = mView->mInputState.x;
- int y = mView->mInputState.y;
+ const lcPreferences& Preferences = lcGetPreferences();
+ lcViewCubeLocation Location = Preferences.mViewCubeLocation;
+
+ if (Location == lcViewCubeLocation::DISABLED)
+ return false;
+
int Width = mView->mWidth;
int Height = mView->mHeight;
+ int ViewportSize = Preferences.mViewCubeSize;
+ int Left = (Location == lcViewCubeLocation::BOTTOM_LEFT || Location == lcViewCubeLocation::TOP_LEFT) ? 0 : Width - ViewportSize;
+ int Bottom = (Location == lcViewCubeLocation::BOTTOM_LEFT || Location == lcViewCubeLocation::BOTTOM_RIGHT) ? 0 : Height - ViewportSize;
+ int x = mView->mInputState.x - Left;
+ int y = mView->mInputState.y - Bottom;
- if (x < Width - ViewportSize || x > Width || y < Height - ViewportSize || y > Height)
+ if (x < 0 || x > Width || y < 0 || y > Height)
{
if (mIntersectionFlags.any())
{
@@ -262,9 +284,6 @@ bool lcViewCube::OnMouseMove()
return false;
}
- x -= Width - ViewportSize;
- y -= Height - ViewportSize;
-
lcVector3 StartEnd[2] = { lcVector3(x, y, 0), lcVector3(x, y, 1) };
const int Viewport[4] = { 0, 0, ViewportSize, ViewportSize };
diff --git a/qt/lc_qpreferencesdialog.cpp b/qt/lc_qpreferencesdialog.cpp
index 8c02cd2e..d4354647 100644
--- a/qt/lc_qpreferencesdialog.cpp
+++ b/qt/lc_qpreferencesdialog.cpp
@@ -55,6 +55,8 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget *parent, void *data) :
ui->gridLines->setChecked(options->Preferences.mDrawGridLines);
ui->gridLineSpacing->setText(QString::number(options->Preferences.mGridLineSpacing));
ui->axisIcon->setChecked(options->Preferences.mDrawAxes);
+ ui->ViewCubeLocationCombo->setCurrentIndex((int)options->Preferences.mViewCubeLocation);
+ ui->ViewCubeSizeEdit->setText(QString::number(options->Preferences.mViewCubeSize));
if (!gSupportsShaderObjects)
ui->ShadingMode->removeItem(LC_SHADING_DEFAULT_LIGHTS);
@@ -132,6 +134,8 @@ void lcQPreferencesDialog::accept()
options->Preferences.mGridLineSpacing = gridLineSpacing;
options->Preferences.mDrawAxes = ui->axisIcon->isChecked();
+ options->Preferences.mViewCubeLocation = (lcViewCubeLocation)ui->ViewCubeLocationCombo->currentIndex();
+ options->Preferences.mViewCubeSize = ui->ViewCubeSizeEdit->text().toInt();
options->Preferences.mShadingMode = (lcShadingMode)ui->ShadingMode->currentIndex();
QDialog::accept();
diff --git a/qt/lc_qpreferencesdialog.ui b/qt/lc_qpreferencesdialog.ui
index c944169b..95ed2ee0 100644
--- a/qt/lc_qpreferencesdialog.ui
+++ b/qt/lc_qpreferencesdialog.ui
@@ -324,6 +324,61 @@
+ -
+
+
+ View Cube
+
+
+
-
+
+
+ Location
+
+
+
+ -
+
+
-
+
+ Disabled
+
+
+ -
+
+ Top Left
+
+
+ -
+
+ Top Right
+
+
+ -
+
+ Bottom Left
+
+
+ -
+
+ Bottom Right
+
+
+
+
+ -
+
+
+ Size
+
+
+
+ -
+
+
+
+
+
-
@@ -873,6 +928,8 @@
gridLines
gridLineSpacing
gridLineColor
+ ViewCubeLocationCombo
+ ViewCubeSizeEdit
categoriesTree
partsTree
importCategories