summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleo2006-03-06 01:17:19 +0000
committerleo2006-03-06 01:17:19 +0000
commit7803446ca9074a258ca0184aa9c317c47e2b8523 (patch)
tree16cb04c7233fefa46d517dc5a5b0fff3171ae3bb
parent5313b0d1b2cf4a803d25faa80b6d7b697f046634 (diff)
Added an option to disable relative snap.
git-svn-id: http://svn.leocad.org/trunk@516 c7d43263-9d01-0410-8a33-9dba5d9f93d6
-rw-r--r--common/defines.h2
-rw-r--r--common/project.cpp15
-rw-r--r--win/LeoCAD.rc8
-rw-r--r--win/Prefpage.cpp4
-rw-r--r--win/Prefpage.h1
-rw-r--r--win/resource.h2
6 files changed, 19 insertions, 13 deletions
diff --git a/common/defines.h b/common/defines.h
index f871c6f..e5cd818 100644
--- a/common/defines.h
+++ b/common/defines.h
@@ -155,7 +155,7 @@ int stricmp(const char* str1, const char* str2);
#define LC_DRAW_SNAP_Y 0x0010 // Snap Y
#define LC_DRAW_SNAP_Z 0x0020 // Snap Z
#define LC_DRAW_SNAP_XYZ (LC_DRAW_SNAP_X | LC_DRAW_SNAP_Y | LC_DRAW_SNAP_Z)
-#define LC_DRAW_SNAP_GRID 0x0040 // Snap to grid (world coordinates)
+#define LC_DRAW_GLOBAL_SNAP 0x0040 // Don't allow relative snap.
#define LC_DRAW_MOVE 0x0080 // Switch to move after insert
#define LC_DRAW_LOCK_X 0x0100 // Lock X
#define LC_DRAW_LOCK_Y 0x0200 // Lock Y
diff --git a/common/project.cpp b/common/project.cpp
index 035726a..890bbee 100644
--- a/common/project.cpp
+++ b/common/project.cpp
@@ -2238,7 +2238,7 @@ void Project::RenderOverlays(int Viewport)
Object* Focus = NULL;
float Rot[4];
- if ((m_nSnap & LC_DRAW_SNAP_GRID) == 0)
+ if ((m_nSnap & LC_DRAW_GLOBAL_SNAP) == 0)
{
Focus = GetFocusObject();
@@ -2348,7 +2348,7 @@ void Project::RenderOverlays(int Viewport)
Object* Focus = NULL;
float Rot[4];
- if ((m_nSnap & LC_DRAW_SNAP_GRID) == 0)
+ if ((m_nSnap & LC_DRAW_GLOBAL_SNAP) == 0)
{
Focus = GetFocusObject();
@@ -7270,7 +7270,7 @@ bool Project::MoveSelectedObjects(Vector3& Move, Vector3& Remainder)
return false;
// Transform the translation if we're in relative mode.
- if ((m_nSnap & LC_DRAW_SNAP_GRID) == 0)
+ if ((m_nSnap & LC_DRAW_GLOBAL_SNAP) == 0)
{
Object* Focus = GetFocusObject();
@@ -7401,6 +7401,9 @@ bool Project::RotateSelectedObjects(Vector3& Delta, Vector3& Remainder)
}
// Transform the rotation relative to the focused piece.
+ if (m_nSnap & LC_DRAW_GLOBAL_SNAP)
+ pFocus = NULL;
+
if (pFocus != NULL)
{
float Rot[4];
@@ -8561,7 +8564,7 @@ void Project::OnMouseMove(int x, int y, bool bControl, bool bShift)
Vector3 Axis1 = Dir1;
Vector3 Axis2 = Dir2;
- if ((m_nSnap & LC_DRAW_SNAP_GRID) == 0)
+ if ((m_nSnap & LC_DRAW_GLOBAL_SNAP) == 0)
{
Object* Focus = GetFocusObject();
@@ -8996,7 +8999,7 @@ void Project::MouseUpdateOverlays(int x, int y)
};
// Find the rotation from the focused piece if relative snap is enabled.
- if ((m_nSnap & LC_DRAW_SNAP_GRID) == 0)
+ if ((m_nSnap & LC_DRAW_GLOBAL_SNAP) == 0)
{
Object* Focus = GetFocusObject();
@@ -9165,7 +9168,7 @@ void Project::MouseUpdateOverlays(int x, int y)
continue;
// Find the rotation from the focused piece if relative snap is enabled.
- if ((m_nSnap & LC_DRAW_SNAP_GRID) == 0)
+ if ((m_nSnap & LC_DRAW_GLOBAL_SNAP) == 0)
{
Object* Focus = GetFocusObject();
diff --git a/win/LeoCAD.rc b/win/LeoCAD.rc
index a6e9074..0ed73bc 100644
--- a/win/LeoCAD.rc
+++ b/win/LeoCAD.rc
@@ -327,9 +327,8 @@ BEGIN
BEGIN
MENUITEM "Insert\tIns", ID_PIECE_INSERT
MENUITEM "Delete\tDel", ID_PIECE_DELETE
- MENUITEM "Transform...", ID_PIECE_TRANSFORM
MENUITEM "Array...", ID_PIECE_ARRAY
- MENUITEM "Mirror...", ID_PIECE_MIRROR
+ MENUITEM "Mirror...", ID_PIECE_MIRROR, GRAYED
MENUITEM "Minifig Wizard...", ID_PIECE_MINIFIGWIZARD
MENUITEM "Copy Keys", ID_PIECE_COPYKEYS
MENUITEM SEPARATOR
@@ -477,9 +476,6 @@ BEGIN
END
POPUP "8"
BEGIN
- MENUITEM "2 Buttons", ID_LOCK_2BUTTONS
- MENUITEM "3D Movement", ID_LOCK_3DMOVEMENT
- MENUITEM SEPARATOR
MENUITEM "Lock X", ID_LOCK_LOCKX
MENUITEM "Lock Y", ID_LOCK_LOCKY
MENUITEM "Lock Z", ID_LOCK_LOCKZ
@@ -1010,7 +1006,7 @@ BEGIN
WS_TABSTOP,7,85,49,8
EDITTEXT IDC_AIDDLG_ANGLE,57,84,20,10,ES_AUTOHSCROLL
LTEXT "degrees",IDC_STATIC,79,85,27,8
- CONTROL "Mouse always moves in 3D",IDC_AIDDLG_3DMOUSE,"Button",
+ CONTROL "Don't allow relative snap",IDC_AIDDLG_GLOBAL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,122,7,111,8
CONTROL "Switch to move after inserting",IDC_AIDDLG_MOVE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,122,20,111,8
diff --git a/win/Prefpage.cpp b/win/Prefpage.cpp
index 72f37fa..78e8b7d 100644
--- a/win/Prefpage.cpp
+++ b/win/Prefpage.cpp
@@ -253,6 +253,7 @@ CPreferencesDrawing::CPreferencesDrawing() : CPropertyPage(CPreferencesDrawing::
m_bSnapX = FALSE;
m_bSnapY = FALSE;
m_bSnapZ = FALSE;
+ m_bGlobal = FALSE;
//}}AFX_DATA_INIT
}
@@ -279,6 +280,7 @@ void CPreferencesDrawing::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_AIDDLG_SNAPX, m_bSnapX);
DDX_Check(pDX, IDC_AIDDLG_SNAPY, m_bSnapY);
DDX_Check(pDX, IDC_AIDDLG_SNAPZ, m_bSnapZ);
+ DDX_Check(pDX, IDC_AIDDLG_GLOBAL, m_bGlobal);
//}}AFX_DATA_MAP
}
@@ -306,6 +308,7 @@ void CPreferencesDrawing::SetOptions(unsigned long dwSnap, unsigned short nAngle
m_bSnapX = (dwSnap & LC_DRAW_SNAP_X) != 0;
m_bSnapY = (dwSnap & LC_DRAW_SNAP_Y) != 0;
m_bSnapZ = (dwSnap & LC_DRAW_SNAP_Z) != 0;
+ m_bGlobal = (dwSnap & LC_DRAW_GLOBAL_SNAP) != 0;
}
void CPreferencesDrawing::GetOptions(unsigned long* dwSnap, unsigned short* nAngle, unsigned short* nGrid)
@@ -326,6 +329,7 @@ void CPreferencesDrawing::GetOptions(unsigned long* dwSnap, unsigned short* nAng
if (m_bSnapX) *dwSnap |= LC_DRAW_SNAP_X;
if (m_bSnapY) *dwSnap |= LC_DRAW_SNAP_Y;
if (m_bSnapZ) *dwSnap |= LC_DRAW_SNAP_Z;
+ if (m_bGlobal) *dwSnap |= LC_DRAW_GLOBAL_SNAP;
}
/////////////////////////////////////////////////////////////////////////////
diff --git a/win/Prefpage.h b/win/Prefpage.h
index effda4a..c811ea8 100644
--- a/win/Prefpage.h
+++ b/win/Prefpage.h
@@ -140,6 +140,7 @@ public:
BOOL m_bSnapX;
BOOL m_bSnapY;
BOOL m_bSnapZ;
+ BOOL m_bGlobal;
//}}AFX_DATA
diff --git a/win/resource.h b/win/resource.h
index 88fbb74..328ded0 100644
--- a/win/resource.h
+++ b/win/resource.h
@@ -217,6 +217,7 @@
#define IDC_GENDLG_GROUP 1077
#define IDC_SCNDLG_FLOORSKY 1077
#define IDC_SCNDLG_TERRAIN 1077
+#define IDC_AIDDLG_SNAPX2 1077
#define IDC_GENDLG_SUBPARTS 1078
#define IDC_SCNDLG_SKYGRADIENT 1078
#define IDC_GENDLG_AUTOSAVE 1079
@@ -245,6 +246,7 @@
#define IDC_PROP_SUM_COMMENTS 1091
#define IDC_DETDLG_DITHER 1091
#define IDC_AIDDLG_3DMOUSE 1091
+#define IDC_AIDDLG_GLOBAL 1091
#define IDC_PROP_GEN_CREATED 1092
#define IDC_DETDLG_LIGHTING 1092
#define IDC_PROP_GEN_MODIFIED 1093