From 7b60905dcba7dbb6cbf488c3eae5c68e57327db9 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 2 May 2014 21:54:07 +0000 Subject: [PATCH] Removed cm units option. --- common/project.cpp | 38 ++++++++++++------------------------ common/project.h | 2 +- qt/lc_qpreferencesdialog.cpp | 6 +----- qt/lc_qpreferencesdialog.ui | 10 +--------- 4 files changed, 15 insertions(+), 41 deletions(-) diff --git a/common/project.cpp b/common/project.cpp index 7adefede..ea424950 100644 --- a/common/project.cpp +++ b/common/project.cpp @@ -6852,14 +6852,12 @@ bool Project::GetSelectionCenter(lcVector3& Center) const void Project::ConvertToUserUnits(lcVector3& Value) const { - if ((m_nSnap & LC_DRAW_CM_UNITS) == 0) - Value /= 0.04f; + Value /= 0.04f; } void Project::ConvertFromUserUnits(lcVector3& Value) const { - if ((m_nSnap & LC_DRAW_CM_UNITS) == 0) - Value *= 0.04f; + Value *= 0.04f; } bool Project::GetFocusPosition(lcVector3& Position) const @@ -7327,31 +7325,19 @@ void Project::GetSnapDistance(float* SnapXY, float* SnapZ) const void Project::GetSnapText(char* SnapXY, char* SnapZ, char* SnapAngle) const { - if (m_nSnap & LC_DRAW_CM_UNITS) - { - float xy, z; + const char* SnapXYText[] = { "0", "1/20S", "1/4S", "1F", "1/2S", "1S", "2S", "3S", "4S", "8S" }; + const char* SnapZText[] = { "0", "1/20S", "1/4S", "1F", "1/2S", "1S", "1B", "2B", "4B", "8B" }; + const char* SnapAngleText[] = { "0", "1", "5", "10", "15", "30", "45", "60", "90", "180" }; - GetSnapDistance(&xy, &z); + int SXY, SZ, SA; + GetSnapIndex(&SXY, &SZ, &SA); - sprintf(SnapXY, "%.2f", xy); - sprintf(SnapZ, "%.2f", z); - } - else - { - const char* SnapXYText[] = { "0", "1/20S", "1/4S", "1F", "1/2S", "1S", "2S", "3S", "4S", "8S" }; - const char* SnapZText[] = { "0", "1/20S", "1/4S", "1F", "1/2S", "1S", "1B", "2B", "4B", "8B" }; - const char* SnapAngleText[] = { "0", "1", "5", "10", "15", "30", "45", "60", "90", "180" }; + SXY = lcMin(SXY, 9); + SZ = lcMin(SZ, 9); - int SXY, SZ, SA; - GetSnapIndex(&SXY, &SZ, &SA); - - SXY = lcMin(SXY, 9); - SZ = lcMin(SZ, 9); - - strcpy(SnapXY, SnapXYText[SXY]); - strcpy(SnapZ, SnapZText[SZ]); - strcpy(SnapAngle, SnapAngleText[SA]); - } + strcpy(SnapXY, SnapXYText[SXY]); + strcpy(SnapZ, SnapZText[SZ]); + strcpy(SnapAngle, SnapAngleText[SA]); } void Project::SnapVector(lcVector3& Delta, lcVector3& Leftover) const diff --git a/common/project.h b/common/project.h index 0bc66f53..e119c0bf 100644 --- a/common/project.h +++ b/common/project.h @@ -20,7 +20,7 @@ #define LC_DRAW_LOCK_XYZ (LC_DRAW_LOCK_X | LC_DRAW_LOCK_Y | LC_DRAW_LOCK_Z) #define LC_DRAW_MOVEAXIS 0x0800 // Move on fixed axis //#define LC_DRAW_PREVIEW 0x1000 // Show piece position -#define LC_DRAW_CM_UNITS 0x2000 // Use centimeters +//#define LC_DRAW_CM_UNITS 0x2000 // Use centimeters //#define LC_DRAW_3DMOUSE 0x4000 // Mouse moves in all directions #define LC_SCENE_FOG 0x004 // Enable fog diff --git a/qt/lc_qpreferencesdialog.cpp b/qt/lc_qpreferencesdialog.cpp index e077c499..500db1b6 100644 --- a/qt/lc_qpreferencesdialog.cpp +++ b/qt/lc_qpreferencesdialog.cpp @@ -30,7 +30,6 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget *parent, void *data) : ui->lgeoPath->setText(options->LGEOPath); ui->mouseSensitivity->setValue(options->Preferences.mMouseSensitivity); ui->checkForUpdates->setCurrentIndex(options->CheckForUpdates); - ui->centimeterUnits->setChecked((options->Snap & LC_DRAW_CM_UNITS) != 0); ui->noRelativeSnap->setChecked((options->Snap & LC_DRAW_GLOBAL_SNAP) != 0); ui->fixedDirectionKeys->setChecked((options->Snap & LC_DRAW_MOVEAXIS) != 0); @@ -85,7 +84,7 @@ void lcQPreferencesDialog::accept() return; } - options->Snap &= ~(LC_DRAW_CM_UNITS | LC_DRAW_GLOBAL_SNAP | LC_DRAW_MOVEAXIS); + options->Snap &= ~(LC_DRAW_GLOBAL_SNAP | LC_DRAW_MOVEAXIS); strcpy(options->DefaultAuthor, ui->authorName->text().toLocal8Bit().data()); strcpy(options->ProjectsPath, ui->projectsFolder->text().toLocal8Bit().data()); @@ -95,9 +94,6 @@ void lcQPreferencesDialog::accept() options->Preferences.mMouseSensitivity = ui->mouseSensitivity->value(); options->CheckForUpdates = ui->checkForUpdates->currentIndex(); - if (ui->centimeterUnits->isChecked()) - options->Snap |= LC_DRAW_CM_UNITS; - if (ui->noRelativeSnap->isChecked()) options->Snap |= LC_DRAW_GLOBAL_SNAP; diff --git a/qt/lc_qpreferencesdialog.ui b/qt/lc_qpreferencesdialog.ui index 14e870b0..a8dabcc1 100644 --- a/qt/lc_qpreferencesdialog.ui +++ b/qt/lc_qpreferencesdialog.ui @@ -192,20 +192,13 @@ - - - Centimeter units - - - - Don't allow relative snap - + Fixed direction keys @@ -724,7 +717,6 @@ lgeoPathBrowse mouseSensitivity checkForUpdates - centimeterUnits noRelativeSnap fixedDirectionKeys antiAliasing