mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +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);
|
||||
mGridLineSpacing = lcGetProfileInt(LC_PROFILE_GRID_LINE_SPACING);
|
||||
mGridLineColor = lcGetProfileInt(LC_PROFILE_GRID_LINE_COLOR);
|
||||
mViewSphereEnabled = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_ENABLED);
|
||||
mViewSphereLocation = (lcViewSphereLocation)lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_LOCATION);
|
||||
mViewSphereSize = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_SIZE);
|
||||
mViewSphereColor = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_COLOR);
|
||||
|
@ -51,6 +52,7 @@ 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_SPHERE_ENABLED, mViewSphereSize ? 1 : 0);
|
||||
lcSetProfileInt(LC_PROFILE_VIEW_SPHERE_LOCATION, (int)mViewSphereLocation);
|
||||
lcSetProfileInt(LC_PROFILE_VIEW_SPHERE_SIZE, mViewSphereSize);
|
||||
lcSetProfileInt(LC_PROFILE_VIEW_SPHERE_COLOR, mViewSphereColor);
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
int mGridLineSpacing;
|
||||
quint32 mGridLineColor;
|
||||
bool mFixedAxes;
|
||||
bool mViewSphereEnabled;
|
||||
lcViewSphereLocation mViewSphereLocation;
|
||||
int mViewSphereSize;
|
||||
quint32 mViewSphereColor;
|
||||
|
|
|
@ -1039,6 +1039,13 @@ lcCommand gCommands[LC_NUM_COMMANDS] =
|
|||
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
|
||||
{
|
||||
QT_TRANSLATE_NOOP("Action", "Piece.Insert"),
|
||||
|
|
|
@ -162,6 +162,7 @@ enum lcCommandId
|
|||
LC_VIEW_PROJECTION_PERSPECTIVE = LC_VIEW_PROJECTION_FIRST,
|
||||
LC_VIEW_PROJECTION_ORTHO,
|
||||
LC_VIEW_PROJECTION_LAST = LC_VIEW_PROJECTION_ORTHO,
|
||||
LC_VIEW_TOGGLE_VIEW_SPHERE,
|
||||
LC_PIECE_INSERT,
|
||||
LC_PIECE_DELETE,
|
||||
LC_PIECE_DUPLICATE,
|
||||
|
|
|
@ -911,7 +911,7 @@ void lcMainWindow::ModelTabContextMenuRequested(const QPoint& Point)
|
|||
if (mModelTabWidget->count() > 1)
|
||||
Menu->addAction(tr("Close Other Tabs"), this, SLOT(ModelTabCloseOtherTabs()));
|
||||
if (mModelTabWidgetContextMenuIndex == mModelTabWidget->currentIndex())
|
||||
Menu->addAction(tr("Reset Views"), this, SLOT(ModelTabResetViews()));
|
||||
Menu->addAction(mActions[LC_VIEW_RESET_VIEWS]);
|
||||
|
||||
Menu->exec(QCursor::pos());
|
||||
delete Menu;
|
||||
|
@ -929,11 +929,6 @@ void lcMainWindow::ModelTabCloseOtherTabs()
|
|||
delete mModelTabWidget->widget(0);
|
||||
}
|
||||
|
||||
void lcMainWindow::ModelTabResetViews()
|
||||
{
|
||||
ResetViews();
|
||||
}
|
||||
|
||||
void lcMainWindow::ModelTabClosed(int Index)
|
||||
{
|
||||
if (mModelTabWidget->count() != 1)
|
||||
|
@ -1225,6 +1220,13 @@ void lcMainWindow::SetSelectionMode(lcSelectionMode SelectionMode)
|
|||
UpdateSelectionMode();
|
||||
}
|
||||
|
||||
void lcMainWindow::ToggleViewSphere()
|
||||
{
|
||||
lcGetPreferences().mViewSphereEnabled = !lcGetPreferences().mViewSphereEnabled;
|
||||
|
||||
UpdateAllViews();
|
||||
}
|
||||
|
||||
QByteArray lcMainWindow::GetTabLayout()
|
||||
{
|
||||
QByteArray TabLayoutData;
|
||||
|
@ -2641,6 +2643,10 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
|
|||
ActiveView->SetProjection(true);
|
||||
break;
|
||||
|
||||
case LC_VIEW_TOGGLE_VIEW_SPHERE:
|
||||
ToggleViewSphere();
|
||||
break;
|
||||
|
||||
case LC_PIECE_INSERT:
|
||||
if (ActiveModel)
|
||||
ActiveModel->AddPiece();
|
||||
|
|
|
@ -289,6 +289,7 @@ public:
|
|||
void SetCurrentPieceInfo(PieceInfo* Info);
|
||||
void SetShadingMode(lcShadingMode ShadingMode);
|
||||
void SetSelectionMode(lcSelectionMode SelectionMode);
|
||||
void ToggleViewSphere();
|
||||
|
||||
void NewProject();
|
||||
bool OpenProject(const QString& FileName);
|
||||
|
@ -348,7 +349,6 @@ protected slots:
|
|||
void UpdateGamepads();
|
||||
void ModelTabContextMenuRequested(const QPoint& Point);
|
||||
void ModelTabCloseOtherTabs();
|
||||
void ModelTabResetViews();
|
||||
void ModelTabClosed(int Index);
|
||||
void ModelTabChanged(int Index);
|
||||
void ClipboardChanged();
|
||||
|
|
|
@ -68,6 +68,7 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
|||
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", "ViewSphereEnabled", 1), // LC_PROFILE_VIEW_SPHERE_ENABLED
|
||||
lcProfileEntry("Settings", "ViewSphereLocation", (int)lcViewSphereLocation::TOP_RIGHT), // LC_PROFILE_VIEW_SPHERE_LOCATION
|
||||
lcProfileEntry("Settings", "ViewSphereSize", 100), // LC_PROFILE_VIEW_SPHERE_SIZE
|
||||
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_COLOR,
|
||||
LC_PROFILE_ANTIALIASING_SAMPLES,
|
||||
LC_PROFILE_VIEW_SPHERE_ENABLED,
|
||||
LC_PROFILE_VIEW_SPHERE_LOCATION,
|
||||
LC_PROFILE_VIEW_SPHERE_SIZE,
|
||||
LC_PROFILE_VIEW_SPHERE_COLOR,
|
||||
|
|
|
@ -154,7 +154,7 @@ void lcViewSphere::Draw()
|
|||
const lcPreferences& Preferences = lcGetPreferences();
|
||||
int ViewportSize = Preferences.mViewSphereSize;
|
||||
|
||||
if (ViewportSize == 0)
|
||||
if (ViewportSize == 0 || !Preferences.mViewSphereEnabled)
|
||||
return;
|
||||
|
||||
lcContext* Context = mView->mContext;
|
||||
|
@ -221,7 +221,7 @@ void lcViewSphere::Draw()
|
|||
bool lcViewSphere::OnLeftButtonDown()
|
||||
{
|
||||
const lcPreferences& Preferences = lcGetPreferences();
|
||||
if (Preferences.mViewSphereSize == 0)
|
||||
if (Preferences.mViewSphereSize == 0 || !Preferences.mViewSphereEnabled)
|
||||
return false;
|
||||
|
||||
mIntersectionFlags = GetIntersectionFlags(mIntersection);
|
||||
|
@ -239,7 +239,7 @@ bool lcViewSphere::OnLeftButtonDown()
|
|||
bool lcViewSphere::OnLeftButtonUp()
|
||||
{
|
||||
const lcPreferences& Preferences = lcGetPreferences();
|
||||
if (Preferences.mViewSphereSize == 0)
|
||||
if (Preferences.mViewSphereSize == 0 || !Preferences.mViewSphereEnabled)
|
||||
return false;
|
||||
|
||||
if (!mMouseDown)
|
||||
|
@ -268,7 +268,7 @@ bool lcViewSphere::OnLeftButtonUp()
|
|||
bool lcViewSphere::OnMouseMove()
|
||||
{
|
||||
const lcPreferences& Preferences = lcGetPreferences();
|
||||
if (Preferences.mViewSphereSize == 0)
|
||||
if (Preferences.mViewSphereSize == 0 || !Preferences.mViewSphereEnabled)
|
||||
return false;
|
||||
|
||||
if (IsDragging())
|
||||
|
|
|
@ -77,21 +77,26 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
|||
|
||||
ui->ViewSphereLocationCombo->setCurrentIndex((int)mOptions->Preferences.mViewSphereLocation);
|
||||
|
||||
switch (mOptions->Preferences.mViewSphereSize)
|
||||
if (mOptions->Preferences.mViewSphereEnabled)
|
||||
{
|
||||
case 200:
|
||||
ui->ViewSphereSizeCombo->setCurrentIndex(3);
|
||||
break;
|
||||
case 100:
|
||||
ui->ViewSphereSizeCombo->setCurrentIndex(2);
|
||||
break;
|
||||
case 50:
|
||||
ui->ViewSphereSizeCombo->setCurrentIndex(1);
|
||||
break;
|
||||
default:
|
||||
ui->ViewSphereSizeCombo->setCurrentIndex(0);
|
||||
break;
|
||||
switch (mOptions->Preferences.mViewSphereSize)
|
||||
{
|
||||
case 200:
|
||||
ui->ViewSphereSizeCombo->setCurrentIndex(3);
|
||||
break;
|
||||
case 100:
|
||||
ui->ViewSphereSizeCombo->setCurrentIndex(2);
|
||||
break;
|
||||
case 50:
|
||||
ui->ViewSphereSizeCombo->setCurrentIndex(1);
|
||||
break;
|
||||
default:
|
||||
ui->ViewSphereSizeCombo->setCurrentIndex(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
ui->ViewSphereSizeCombo->setCurrentIndex(0);
|
||||
|
||||
ui->studLogo->setChecked(mOptions->StudLogo);
|
||||
if (ui->studLogo->isChecked())
|
||||
|
@ -212,7 +217,7 @@ void lcQPreferencesDialog::accept()
|
|||
mOptions->Preferences.mViewSphereSize = 50;
|
||||
break;
|
||||
default:
|
||||
mOptions->Preferences.mViewSphereSize = 0;
|
||||
mOptions->Preferences.mViewSphereEnabled = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue