mirror of
https://github.com/leozide/leocad
synced 2025-01-18 22:26:44 +01:00
Added view sphere toggle. Fixes #284.
This commit is contained in:
parent
7425c41673
commit
8f48b09ae3
10 changed files with 49 additions and 25 deletions
|
@ -27,6 +27,7 @@ void lcPreferences::LoadDefaults()
|
||||||
mDrawGridLines = lcGetProfileInt(LC_PROFILE_GRID_LINES);
|
mDrawGridLines = lcGetProfileInt(LC_PROFILE_GRID_LINES);
|
||||||
mGridLineSpacing = lcGetProfileInt(LC_PROFILE_GRID_LINE_SPACING);
|
mGridLineSpacing = lcGetProfileInt(LC_PROFILE_GRID_LINE_SPACING);
|
||||||
mGridLineColor = lcGetProfileInt(LC_PROFILE_GRID_LINE_COLOR);
|
mGridLineColor = lcGetProfileInt(LC_PROFILE_GRID_LINE_COLOR);
|
||||||
|
mViewSphereEnabled = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_ENABLED);
|
||||||
mViewSphereLocation = (lcViewSphereLocation)lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_LOCATION);
|
mViewSphereLocation = (lcViewSphereLocation)lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_LOCATION);
|
||||||
mViewSphereSize = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_SIZE);
|
mViewSphereSize = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_SIZE);
|
||||||
mViewSphereColor = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_COLOR);
|
mViewSphereColor = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_COLOR);
|
||||||
|
@ -51,6 +52,7 @@ void lcPreferences::SaveDefaults()
|
||||||
lcSetProfileInt(LC_PROFILE_GRID_LINES, mDrawGridLines);
|
lcSetProfileInt(LC_PROFILE_GRID_LINES, mDrawGridLines);
|
||||||
lcSetProfileInt(LC_PROFILE_GRID_LINE_SPACING, mGridLineSpacing);
|
lcSetProfileInt(LC_PROFILE_GRID_LINE_SPACING, mGridLineSpacing);
|
||||||
lcSetProfileInt(LC_PROFILE_GRID_LINE_COLOR, mGridLineColor);
|
lcSetProfileInt(LC_PROFILE_GRID_LINE_COLOR, mGridLineColor);
|
||||||
|
lcSetProfileInt(LC_PROFILE_VIEW_SPHERE_ENABLED, mViewSphereSize ? 1 : 0);
|
||||||
lcSetProfileInt(LC_PROFILE_VIEW_SPHERE_LOCATION, (int)mViewSphereLocation);
|
lcSetProfileInt(LC_PROFILE_VIEW_SPHERE_LOCATION, (int)mViewSphereLocation);
|
||||||
lcSetProfileInt(LC_PROFILE_VIEW_SPHERE_SIZE, mViewSphereSize);
|
lcSetProfileInt(LC_PROFILE_VIEW_SPHERE_SIZE, mViewSphereSize);
|
||||||
lcSetProfileInt(LC_PROFILE_VIEW_SPHERE_COLOR, mViewSphereColor);
|
lcSetProfileInt(LC_PROFILE_VIEW_SPHERE_COLOR, mViewSphereColor);
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
int mGridLineSpacing;
|
int mGridLineSpacing;
|
||||||
quint32 mGridLineColor;
|
quint32 mGridLineColor;
|
||||||
bool mFixedAxes;
|
bool mFixedAxes;
|
||||||
|
bool mViewSphereEnabled;
|
||||||
lcViewSphereLocation mViewSphereLocation;
|
lcViewSphereLocation mViewSphereLocation;
|
||||||
int mViewSphereSize;
|
int mViewSphereSize;
|
||||||
quint32 mViewSphereColor;
|
quint32 mViewSphereColor;
|
||||||
|
|
|
@ -1039,6 +1039,13 @@ lcCommand gCommands[LC_NUM_COMMANDS] =
|
||||||
QT_TRANSLATE_NOOP("Status", "Set the current camera to use an orthographic projection"),
|
QT_TRANSLATE_NOOP("Status", "Set the current camera to use an orthographic projection"),
|
||||||
""
|
""
|
||||||
},
|
},
|
||||||
|
// LC_VIEW_TOGGLE_VIEW_SPHERE
|
||||||
|
{
|
||||||
|
QT_TRANSLATE_NOOP("Action", "View.ToggleViewSphere"),
|
||||||
|
QT_TRANSLATE_NOOP("Menu", "View Sphere"),
|
||||||
|
QT_TRANSLATE_NOOP("Status", "Toggle the view sphere"),
|
||||||
|
""
|
||||||
|
},
|
||||||
// LC_PIECE_INSERT
|
// LC_PIECE_INSERT
|
||||||
{
|
{
|
||||||
QT_TRANSLATE_NOOP("Action", "Piece.Insert"),
|
QT_TRANSLATE_NOOP("Action", "Piece.Insert"),
|
||||||
|
|
|
@ -162,6 +162,7 @@ enum lcCommandId
|
||||||
LC_VIEW_PROJECTION_PERSPECTIVE = LC_VIEW_PROJECTION_FIRST,
|
LC_VIEW_PROJECTION_PERSPECTIVE = LC_VIEW_PROJECTION_FIRST,
|
||||||
LC_VIEW_PROJECTION_ORTHO,
|
LC_VIEW_PROJECTION_ORTHO,
|
||||||
LC_VIEW_PROJECTION_LAST = LC_VIEW_PROJECTION_ORTHO,
|
LC_VIEW_PROJECTION_LAST = LC_VIEW_PROJECTION_ORTHO,
|
||||||
|
LC_VIEW_TOGGLE_VIEW_SPHERE,
|
||||||
LC_PIECE_INSERT,
|
LC_PIECE_INSERT,
|
||||||
LC_PIECE_DELETE,
|
LC_PIECE_DELETE,
|
||||||
LC_PIECE_DUPLICATE,
|
LC_PIECE_DUPLICATE,
|
||||||
|
|
|
@ -911,7 +911,7 @@ void lcMainWindow::ModelTabContextMenuRequested(const QPoint& Point)
|
||||||
if (mModelTabWidget->count() > 1)
|
if (mModelTabWidget->count() > 1)
|
||||||
Menu->addAction(tr("Close Other Tabs"), this, SLOT(ModelTabCloseOtherTabs()));
|
Menu->addAction(tr("Close Other Tabs"), this, SLOT(ModelTabCloseOtherTabs()));
|
||||||
if (mModelTabWidgetContextMenuIndex == mModelTabWidget->currentIndex())
|
if (mModelTabWidgetContextMenuIndex == mModelTabWidget->currentIndex())
|
||||||
Menu->addAction(tr("Reset Views"), this, SLOT(ModelTabResetViews()));
|
Menu->addAction(mActions[LC_VIEW_RESET_VIEWS]);
|
||||||
|
|
||||||
Menu->exec(QCursor::pos());
|
Menu->exec(QCursor::pos());
|
||||||
delete Menu;
|
delete Menu;
|
||||||
|
@ -929,11 +929,6 @@ void lcMainWindow::ModelTabCloseOtherTabs()
|
||||||
delete mModelTabWidget->widget(0);
|
delete mModelTabWidget->widget(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcMainWindow::ModelTabResetViews()
|
|
||||||
{
|
|
||||||
ResetViews();
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcMainWindow::ModelTabClosed(int Index)
|
void lcMainWindow::ModelTabClosed(int Index)
|
||||||
{
|
{
|
||||||
if (mModelTabWidget->count() != 1)
|
if (mModelTabWidget->count() != 1)
|
||||||
|
@ -1225,6 +1220,13 @@ void lcMainWindow::SetSelectionMode(lcSelectionMode SelectionMode)
|
||||||
UpdateSelectionMode();
|
UpdateSelectionMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lcMainWindow::ToggleViewSphere()
|
||||||
|
{
|
||||||
|
lcGetPreferences().mViewSphereEnabled = !lcGetPreferences().mViewSphereEnabled;
|
||||||
|
|
||||||
|
UpdateAllViews();
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray lcMainWindow::GetTabLayout()
|
QByteArray lcMainWindow::GetTabLayout()
|
||||||
{
|
{
|
||||||
QByteArray TabLayoutData;
|
QByteArray TabLayoutData;
|
||||||
|
@ -2641,6 +2643,10 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
|
||||||
ActiveView->SetProjection(true);
|
ActiveView->SetProjection(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LC_VIEW_TOGGLE_VIEW_SPHERE:
|
||||||
|
ToggleViewSphere();
|
||||||
|
break;
|
||||||
|
|
||||||
case LC_PIECE_INSERT:
|
case LC_PIECE_INSERT:
|
||||||
if (ActiveModel)
|
if (ActiveModel)
|
||||||
ActiveModel->AddPiece();
|
ActiveModel->AddPiece();
|
||||||
|
|
|
@ -289,6 +289,7 @@ public:
|
||||||
void SetCurrentPieceInfo(PieceInfo* Info);
|
void SetCurrentPieceInfo(PieceInfo* Info);
|
||||||
void SetShadingMode(lcShadingMode ShadingMode);
|
void SetShadingMode(lcShadingMode ShadingMode);
|
||||||
void SetSelectionMode(lcSelectionMode SelectionMode);
|
void SetSelectionMode(lcSelectionMode SelectionMode);
|
||||||
|
void ToggleViewSphere();
|
||||||
|
|
||||||
void NewProject();
|
void NewProject();
|
||||||
bool OpenProject(const QString& FileName);
|
bool OpenProject(const QString& FileName);
|
||||||
|
@ -348,7 +349,6 @@ protected slots:
|
||||||
void UpdateGamepads();
|
void UpdateGamepads();
|
||||||
void ModelTabContextMenuRequested(const QPoint& Point);
|
void ModelTabContextMenuRequested(const QPoint& Point);
|
||||||
void ModelTabCloseOtherTabs();
|
void ModelTabCloseOtherTabs();
|
||||||
void ModelTabResetViews();
|
|
||||||
void ModelTabClosed(int Index);
|
void ModelTabClosed(int Index);
|
||||||
void ModelTabChanged(int Index);
|
void ModelTabChanged(int Index);
|
||||||
void ClipboardChanged();
|
void ClipboardChanged();
|
||||||
|
|
|
@ -68,6 +68,7 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
||||||
lcProfileEntry("Settings", "GridLineSpacing", 5), // LC_PROFILE_GRID_LINE_SPACING
|
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", "GridLineColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_GRID_LINE_COLOR
|
||||||
lcProfileEntry("Settings", "AASamples", 1), // LC_PROFILE_ANTIALIASING_SAMPLES
|
lcProfileEntry("Settings", "AASamples", 1), // LC_PROFILE_ANTIALIASING_SAMPLES
|
||||||
|
lcProfileEntry("Settings", "ViewSphereEnabled", 1), // LC_PROFILE_VIEW_SPHERE_ENABLED
|
||||||
lcProfileEntry("Settings", "ViewSphereLocation", (int)lcViewSphereLocation::TOP_RIGHT), // LC_PROFILE_VIEW_SPHERE_LOCATION
|
lcProfileEntry("Settings", "ViewSphereLocation", (int)lcViewSphereLocation::TOP_RIGHT), // LC_PROFILE_VIEW_SPHERE_LOCATION
|
||||||
lcProfileEntry("Settings", "ViewSphereSize", 100), // LC_PROFILE_VIEW_SPHERE_SIZE
|
lcProfileEntry("Settings", "ViewSphereSize", 100), // LC_PROFILE_VIEW_SPHERE_SIZE
|
||||||
lcProfileEntry("Settings", "ViewSphereColor", LC_RGBA(255, 255, 255, 255)), // LC_PROFILE_VIEW_SPHERE_COLOR
|
lcProfileEntry("Settings", "ViewSphereColor", LC_RGBA(255, 255, 255, 255)), // LC_PROFILE_VIEW_SPHERE_COLOR
|
||||||
|
|
|
@ -16,6 +16,7 @@ enum LC_PROFILE_KEY
|
||||||
LC_PROFILE_GRID_LINE_SPACING,
|
LC_PROFILE_GRID_LINE_SPACING,
|
||||||
LC_PROFILE_GRID_LINE_COLOR,
|
LC_PROFILE_GRID_LINE_COLOR,
|
||||||
LC_PROFILE_ANTIALIASING_SAMPLES,
|
LC_PROFILE_ANTIALIASING_SAMPLES,
|
||||||
|
LC_PROFILE_VIEW_SPHERE_ENABLED,
|
||||||
LC_PROFILE_VIEW_SPHERE_LOCATION,
|
LC_PROFILE_VIEW_SPHERE_LOCATION,
|
||||||
LC_PROFILE_VIEW_SPHERE_SIZE,
|
LC_PROFILE_VIEW_SPHERE_SIZE,
|
||||||
LC_PROFILE_VIEW_SPHERE_COLOR,
|
LC_PROFILE_VIEW_SPHERE_COLOR,
|
||||||
|
|
|
@ -154,7 +154,7 @@ void lcViewSphere::Draw()
|
||||||
const lcPreferences& Preferences = lcGetPreferences();
|
const lcPreferences& Preferences = lcGetPreferences();
|
||||||
int ViewportSize = Preferences.mViewSphereSize;
|
int ViewportSize = Preferences.mViewSphereSize;
|
||||||
|
|
||||||
if (ViewportSize == 0)
|
if (ViewportSize == 0 || !Preferences.mViewSphereEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lcContext* Context = mView->mContext;
|
lcContext* Context = mView->mContext;
|
||||||
|
@ -221,7 +221,7 @@ void lcViewSphere::Draw()
|
||||||
bool lcViewSphere::OnLeftButtonDown()
|
bool lcViewSphere::OnLeftButtonDown()
|
||||||
{
|
{
|
||||||
const lcPreferences& Preferences = lcGetPreferences();
|
const lcPreferences& Preferences = lcGetPreferences();
|
||||||
if (Preferences.mViewSphereSize == 0)
|
if (Preferences.mViewSphereSize == 0 || !Preferences.mViewSphereEnabled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
mIntersectionFlags = GetIntersectionFlags(mIntersection);
|
mIntersectionFlags = GetIntersectionFlags(mIntersection);
|
||||||
|
@ -239,7 +239,7 @@ bool lcViewSphere::OnLeftButtonDown()
|
||||||
bool lcViewSphere::OnLeftButtonUp()
|
bool lcViewSphere::OnLeftButtonUp()
|
||||||
{
|
{
|
||||||
const lcPreferences& Preferences = lcGetPreferences();
|
const lcPreferences& Preferences = lcGetPreferences();
|
||||||
if (Preferences.mViewSphereSize == 0)
|
if (Preferences.mViewSphereSize == 0 || !Preferences.mViewSphereEnabled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!mMouseDown)
|
if (!mMouseDown)
|
||||||
|
@ -268,7 +268,7 @@ bool lcViewSphere::OnLeftButtonUp()
|
||||||
bool lcViewSphere::OnMouseMove()
|
bool lcViewSphere::OnMouseMove()
|
||||||
{
|
{
|
||||||
const lcPreferences& Preferences = lcGetPreferences();
|
const lcPreferences& Preferences = lcGetPreferences();
|
||||||
if (Preferences.mViewSphereSize == 0)
|
if (Preferences.mViewSphereSize == 0 || !Preferences.mViewSphereEnabled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (IsDragging())
|
if (IsDragging())
|
||||||
|
|
|
@ -77,21 +77,26 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
||||||
|
|
||||||
ui->ViewSphereLocationCombo->setCurrentIndex((int)mOptions->Preferences.mViewSphereLocation);
|
ui->ViewSphereLocationCombo->setCurrentIndex((int)mOptions->Preferences.mViewSphereLocation);
|
||||||
|
|
||||||
switch (mOptions->Preferences.mViewSphereSize)
|
if (mOptions->Preferences.mViewSphereEnabled)
|
||||||
{
|
{
|
||||||
case 200:
|
switch (mOptions->Preferences.mViewSphereSize)
|
||||||
ui->ViewSphereSizeCombo->setCurrentIndex(3);
|
{
|
||||||
break;
|
case 200:
|
||||||
case 100:
|
ui->ViewSphereSizeCombo->setCurrentIndex(3);
|
||||||
ui->ViewSphereSizeCombo->setCurrentIndex(2);
|
break;
|
||||||
break;
|
case 100:
|
||||||
case 50:
|
ui->ViewSphereSizeCombo->setCurrentIndex(2);
|
||||||
ui->ViewSphereSizeCombo->setCurrentIndex(1);
|
break;
|
||||||
break;
|
case 50:
|
||||||
default:
|
ui->ViewSphereSizeCombo->setCurrentIndex(1);
|
||||||
ui->ViewSphereSizeCombo->setCurrentIndex(0);
|
break;
|
||||||
break;
|
default:
|
||||||
|
ui->ViewSphereSizeCombo->setCurrentIndex(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
ui->ViewSphereSizeCombo->setCurrentIndex(0);
|
||||||
|
|
||||||
ui->studLogo->setChecked(mOptions->StudLogo);
|
ui->studLogo->setChecked(mOptions->StudLogo);
|
||||||
if (ui->studLogo->isChecked())
|
if (ui->studLogo->isChecked())
|
||||||
|
@ -212,7 +217,7 @@ void lcQPreferencesDialog::accept()
|
||||||
mOptions->Preferences.mViewSphereSize = 50;
|
mOptions->Preferences.mViewSphereSize = 50;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mOptions->Preferences.mViewSphereSize = 0;
|
mOptions->Preferences.mViewSphereEnabled = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue