Moved relative snap option to the toolbar.

This commit is contained in:
leo
2015-01-18 05:36:14 +00:00
parent dfa7396b29
commit 07062693a8
14 changed files with 29 additions and 42 deletions
-10
View File
@@ -16,7 +16,6 @@ lcApplication* g_App;
void lcPreferences::LoadDefaults()
{
mForceGlobalTransforms = lcGetProfileInt(LC_PROFILE_FORCE_GLOBAL_TRANSFORMS);
mFixedAxes = lcGetProfileInt(LC_PROFILE_FIXED_AXES);
mMouseSensitivity = lcGetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY);
mLightingMode = (lcLightingMode)lcGetProfileInt(LC_PROFILE_LIGHTING_MODE);
@@ -32,7 +31,6 @@ void lcPreferences::LoadDefaults()
void lcPreferences::SaveDefaults()
{
lcSetProfileInt(LC_PROFILE_FORCE_GLOBAL_TRANSFORMS, mForceGlobalTransforms);
lcSetProfileInt(LC_PROFILE_FIXED_AXES, mFixedAxes);
lcSetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY, mMouseSensitivity);
lcSetProfileInt(LC_PROFILE_LIGHTING_MODE, mLightingMode);
@@ -46,14 +44,6 @@ void lcPreferences::SaveDefaults()
lcSetProfileInt(LC_PROFILE_GRID_LINE_COLOR, mGridLineColor);
}
void lcPreferences::SetForceGlobalTransforms(bool ForceGlobalTransforms)
{
mForceGlobalTransforms = ForceGlobalTransforms;
lcSetProfileInt(LC_PROFILE_FORCE_GLOBAL_TRANSFORMS, mForceGlobalTransforms);
gMainWindow->UpdateLockSnap();
gMainWindow->UpdateAllViews();
}
lcApplication::lcApplication()
{
mProject = NULL;
-3
View File
@@ -20,8 +20,6 @@ public:
void LoadDefaults();
void SaveDefaults();
void SetForceGlobalTransforms(bool ForceGlobalTransforms);
int mMouseSensitivity;
lcLightingMode mLightingMode;
bool mDrawAxes;
@@ -32,7 +30,6 @@ public:
bool mDrawGridLines;
int mGridLineSpacing;
lcuint32 mGridLineColor;
bool mForceGlobalTransforms;
bool mFixedAxes;
};
+4 -4
View File
@@ -256,11 +256,11 @@ lcCommand gCommands[LC_NUM_COMMANDS] =
QT_TRANSLATE_NOOP("Status", "Allows movement and rotation in all directions"),
QT_TRANSLATE_NOOP("Shortcut", "")
},
// LC_EDIT_SNAP_RELATIVE
// LC_EDIT_TRANSFORM_RELATIVE
{
"Edit.SnapRelative",
QT_TRANSLATE_NOOP("Menu", "Relative Snap"),
QT_TRANSLATE_NOOP("Status", "Enable relative movement and rotation"),
"Edit.TransformRelative",
QT_TRANSLATE_NOOP("Menu", "Relative Transforms"),
QT_TRANSLATE_NOOP("Status", "Move and rotate objects relative to the one that currently has focus"),
QT_TRANSLATE_NOOP("Shortcut", "")
},
// LC_EDIT_SNAP_MOVE_XY0
+1 -1
View File
@@ -41,7 +41,7 @@ enum lcCommandId
LC_EDIT_LOCK_Y,
LC_EDIT_LOCK_Z,
LC_EDIT_LOCK_NONE,
LC_EDIT_SNAP_RELATIVE,
LC_EDIT_TRANSFORM_RELATIVE,
LC_EDIT_SNAP_MOVE_XY0,
LC_EDIT_SNAP_MOVE_XY1,
LC_EDIT_SNAP_MOVE_XY2,
+10 -2
View File
@@ -23,6 +23,7 @@ lcMainWindow::lcMainWindow()
mLockX = false;
mLockY = false;
mLockZ = false;
mRelativeTransform = true;
memset(&mSearchOptions, 0, sizeof(mSearchOptions));
@@ -143,6 +144,13 @@ void lcMainWindow::SetLockZ(bool LockZ)
UpdateLockSnap();
}
void lcMainWindow::SetRelativeTransform(bool RelativeTransform)
{
mRelativeTransform = RelativeTransform;
UpdateLockSnap();
UpdateAllViews();
}
void lcMainWindow::AddRecentFile(const QString& FileName)
{
QString SavedName = FileName;
@@ -728,8 +736,8 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
SetAddKeys(!GetAddKeys());
break;
case LC_EDIT_SNAP_RELATIVE:
lcGetPreferences().SetForceGlobalTransforms(!lcGetPreferences().mForceGlobalTransforms);
case LC_EDIT_TRANSFORM_RELATIVE:
SetRelativeTransform(!GetRelativeTransform());
break;
case LC_EDIT_LOCK_X:
+7
View File
@@ -102,6 +102,11 @@ public:
return mLockZ;
}
bool GetRelativeTransform() const
{
return mRelativeTransform;
}
View* GetActiveView() const
{
return mActiveView;
@@ -127,6 +132,7 @@ public:
void SetLockX(bool LockX);
void SetLockY(bool LockY);
void SetLockZ(bool LockZ);
void SetRelativeTransform(bool RelativeTransform);
void Close();
void NewProject();
@@ -187,6 +193,7 @@ protected:
bool mLockX;
bool mLockY;
bool mLockZ;
bool mRelativeTransform;
};
extern class lcMainWindow* gMainWindow;
+2 -5
View File
@@ -1767,9 +1767,7 @@ lcVector3 lcModel::SnapRotation(const lcVector3& Angles) const
lcMatrix44 lcModel::GetRelativeRotation() const
{
const lcPreferences& Preferences = lcGetPreferences();
if (!Preferences.mForceGlobalTransforms)
if (gMainWindow->GetRelativeTransform())
{
lcObject* Focus = GetFocusObject();
@@ -2082,8 +2080,7 @@ void lcModel::RotateSelectedPieces(const lcVector3& Angles, bool Relative, bool
if (Angles[2] != 0.0f)
RotationMatrix = lcMul(lcMatrix33RotationZ(Angles[2] * LC_DTOR), RotationMatrix);
const lcPreferences& Preferences = lcGetPreferences();
if (Preferences.mForceGlobalTransforms)
if (!gMainWindow->GetRelativeTransform())
Focus = NULL;
if (Focus && Relative)
-1
View File
@@ -47,7 +47,6 @@ lcProfileEntry::lcProfileEntry(const char* Section, const char* Key)
lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
{
lcProfileEntry("Settings", "ForceGlobalTransforms", false), // LC_PROFILE_FORCE_GLOBAL_TRANSFORMS
lcProfileEntry("Settings", "FixedAxes", false), // LC_PROFILE_FIXED_AXES
lcProfileEntry("Settings", "LineWidth", 1.0f), // LC_PROFILE_LINE_WIDTH
lcProfileEntry("Settings", "LightingMode", LC_LIGHTING_FLAT), // LC_PROFILE_LIGHTING_MODE
-1
View File
@@ -4,7 +4,6 @@
enum LC_PROFILE_KEY
{
// Settings.
LC_PROFILE_FORCE_GLOBAL_TRANSFORMS,
LC_PROFILE_FIXED_AXES,
LC_PROFILE_LINE_WIDTH,
LC_PROFILE_LIGHTING_MODE,
+1
View File
@@ -59,6 +59,7 @@
<file>resources/view_split_horizontal.png</file>
<file>resources/view_split_vertical.png</file>
<file>resources/file_picture.png</file>
<file>resources/edit_transform_relative.png</file>
<file>resources/edit_transform_absolute_rotation.png</file>
<file>resources/edit_transform_absolute_translation.png</file>
<file>resources/edit_transform_relative_rotation.png</file>
+4 -5
View File
@@ -128,6 +128,7 @@ void lcQMainWindow::createActions()
actions[LC_EDIT_ACTION_ROTATE_VIEW]->setIcon(QIcon(":/resources/action_rotate_view.png"));
actions[LC_EDIT_ACTION_ROLL]->setIcon(QIcon(":/resources/action_roll.png"));
actions[LC_EDIT_ACTION_ZOOM_REGION]->setIcon(QIcon(":/resources/action_zoom_region.png"));
actions[LC_EDIT_TRANSFORM_RELATIVE]->setIcon(QIcon(":/resources/edit_transform_relative.png"));
actions[LC_PIECE_SHOW_EARLIER]->setIcon(QIcon(":/resources/piece_show_earlier.png"));
actions[LC_PIECE_SHOW_LATER]->setIcon(QIcon(":/resources/piece_show_later.png"));
actions[LC_VIEW_SPLIT_HORIZONTAL]->setIcon(QIcon(":/resources/view_split_horizontal.png"));
@@ -146,7 +147,7 @@ void lcQMainWindow::createActions()
actions[LC_EDIT_LOCK_X]->setCheckable(true);
actions[LC_EDIT_LOCK_Y]->setCheckable(true);
actions[LC_EDIT_LOCK_Z]->setCheckable(true);
actions[LC_EDIT_SNAP_RELATIVE]->setCheckable(true);
actions[LC_EDIT_TRANSFORM_RELATIVE]->setCheckable(true);
actions[LC_VIEW_CAMERA_NONE]->setCheckable(true);
actions[LC_VIEW_TIME_ADD_KEYS]->setCheckable(true);
@@ -401,7 +402,7 @@ void lcQMainWindow::createToolBars()
standardToolBar->addAction(actions[LC_EDIT_COPY]);
standardToolBar->addAction(actions[LC_EDIT_PASTE]);
standardToolBar->addSeparator();
// standardToolBar->addAction(actions[LC_EDIT_SNAP_RELATIVE]); todo
standardToolBar->addAction(actions[LC_EDIT_TRANSFORM_RELATIVE]);
standardToolBar->addAction(lockAction);
standardToolBar->addAction(moveAction);
standardToolBar->addAction(angleAction);
@@ -1163,9 +1164,7 @@ void lcQMainWindow::setAddKeys(bool addKeys)
void lcQMainWindow::updateLockSnap()
{
const lcPreferences& Preferences = lcGetPreferences();
actions[LC_EDIT_SNAP_RELATIVE]->setChecked(!Preferences.mForceGlobalTransforms);
actions[LC_EDIT_TRANSFORM_RELATIVE]->setChecked(gMainWindow->GetRelativeTransform());
actions[LC_EDIT_LOCK_X]->setChecked(gMainWindow->GetLockX());
actions[LC_EDIT_LOCK_Y]->setChecked(gMainWindow->GetLockY());
actions[LC_EDIT_LOCK_Z]->setChecked(gMainWindow->GetLockZ());
-2
View File
@@ -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->noRelativeSnap->setChecked(options->Preferences.mForceGlobalTransforms);
ui->fixedDirectionKeys->setChecked((options->Preferences.mFixedAxes) != 0);
ui->antiAliasing->setChecked(options->AASamples != 1);
@@ -91,7 +90,6 @@ void lcQPreferencesDialog::accept()
strcpy(options->LGEOPath, ui->lgeoPath->text().toLocal8Bit().data());
options->Preferences.mMouseSensitivity = ui->mouseSensitivity->value();
options->CheckForUpdates = ui->checkForUpdates->currentIndex();
options->Preferences.mForceGlobalTransforms = ui->noRelativeSnap->isChecked();
options->Preferences.mFixedAxes = ui->fixedDirectionKeys->isChecked();
if (!ui->antiAliasing->isChecked())
-8
View File
@@ -192,13 +192,6 @@
</widget>
</item>
<item row="9" column="0" colspan="2">
<widget class="QCheckBox" name="noRelativeSnap">
<property name="text">
<string>Don't allow relative snap</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<widget class="QCheckBox" name="fixedDirectionKeys">
<property name="text">
<string>Fixed direction keys</string>
@@ -717,7 +710,6 @@
<tabstop>lgeoPathBrowse</tabstop>
<tabstop>mouseSensitivity</tabstop>
<tabstop>checkForUpdates</tabstop>
<tabstop>noRelativeSnap</tabstop>
<tabstop>fixedDirectionKeys</tabstop>
<tabstop>antiAliasing</tabstop>
<tabstop>antiAliasingSamples</tabstop>
Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B