summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleo2005-03-16 19:46:14 +0000
committerleo2005-03-16 19:46:14 +0000
commitc8951a1853dfd43aeb43394b9fa1682c3f0db743 (patch)
treeeb812de57f7c0073052549b3fc90d17a2e5f85c3
parent25af63d7d7b85f99f5327d1b97a3ac24fbfd93f0 (diff)
Fixed units in the modify dialog;
Disabled all shortcut keys when the user is entering text. git-svn-id: http://svn.leocad.org/trunk@392 c7d43263-9d01-0410-8a33-9dba5d9f93d6
-rw-r--r--common/project.cpp7
-rw-r--r--common/project.h2
-rw-r--r--win/Mainfrm.cpp16
-rw-r--r--win/Moddlg.cpp49
4 files changed, 69 insertions, 5 deletions
diff --git a/common/project.cpp b/common/project.cpp
index b478600..61e9d71 100644
--- a/common/project.cpp
+++ b/common/project.cpp
@@ -3540,8 +3540,8 @@ void Project::HandleNotify(LC_NOTIFY id, unsigned long param)
}
} break;
- // FIXME: don't change the keys with ChangeKey()
- // FIXME: even if pos == prevpos, the user might want to add a key
+ // FIXME: don't change the keys with ChangeKey()
+ // FIXME: even if pos == prevpos, the user might want to add a key
case LC_PIECE_MODIFIED:
{
@@ -3587,7 +3587,8 @@ void Project::HandleNotify(LC_NOTIFY id, unsigned long param)
SetModifiedFlag(true);
CheckPoint("Modifying");
- UpdateAllViews ();
+ ActivateOverlay();
+ UpdateAllViews();
} break;
case LC_CAMERA_MODIFIED:
diff --git a/common/project.h b/common/project.h
index 42529ae..3ef90b0 100644
--- a/common/project.h
+++ b/common/project.h
@@ -60,6 +60,8 @@ public:
{ return m_bAnimation; }
unsigned short GetCurrentTime ()
{ return m_bAnimation ? m_nCurFrame : m_nCurStep; }
+ unsigned long GetSnapFlags() const
+ { return m_nSnap; }
void SetCurrentPiece(PieceInfo* pInfo)
{ m_pCurPiece = pInfo; }
int GetCurrentColor () const
diff --git a/win/Mainfrm.cpp b/win/Mainfrm.cpp
index dba878f..2c0ad18 100644
--- a/win/Mainfrm.cpp
+++ b/win/Mainfrm.cpp
@@ -1113,6 +1113,22 @@ BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
bool Shift = GetKeyState(VK_SHIFT) < 0;
// Don't process key presses if the user is typing text.
+ if (!Control)
+ {
+ if (m_wndPiecesBar.m_wndPiecesCombo.IsChild(GetFocus()) ||
+ m_wndPiecesBar.m_wndPiecesList.IsChild(GetFocus()))
+ {
+ return CFrameWnd::PreTranslateMessage(pMsg);
+ }
+
+ char Name[256];
+ GetClassName(GetFocus()->m_hWnd, Name, sizeof(Name));
+ if (!strcmp(Name, "Edit"))
+ {
+ return CFrameWnd::PreTranslateMessage(pMsg);
+ }
+ }
+
if (m_wndPiecesBar.m_wndPiecesCombo.IsChild(GetFocus()) ||
m_wndPiecesBar.m_wndPiecesList.IsChild(GetFocus()))
{
diff --git a/win/Moddlg.cpp b/win/Moddlg.cpp
index e185282..c9035f8 100644
--- a/win/Moddlg.cpp
+++ b/win/Moddlg.cpp
@@ -160,8 +160,6 @@ void CModifyDialog::UpdateInfo(Object* pObject)
UpdateControls(m_pObject->GetType());
}
- // TODO: CM UNITS
-
switch (m_nType)
{
case LC_OBJECT_PIECE:
@@ -173,12 +171,20 @@ void CModifyDialog::UpdateInfo(Object* pObject)
Matrix mat(rot, pos);
mat.ToEulerAngles(rot);
+ if ((project->GetSnapFlags() & LC_DRAW_CM_UNITS) == 0)
+ {
+ pos[0] /= 0.08f;
+ pos[1] /= 0.08f;
+ pos[2] /= 0.08f;
+ }
+
m_fPosX = pos[0];
m_fPosY = pos[1];
m_fPosZ = pos[2];
m_fRotX = rot[0];
m_fRotY = rot[1];
m_fRotZ = rot[2];
+
if (project->IsAnimation())
{
m_nFrom = pPiece->GetFrameShow();
@@ -207,17 +213,38 @@ void CModifyDialog::UpdateInfo(Object* pObject)
pCamera = ((CameraTarget*)m_pObject)->GetParent();
pCamera->GetEyePos(tmp);
+ if ((project->GetSnapFlags() & LC_DRAW_CM_UNITS) == 0)
+ {
+ tmp[0] /= 0.08f;
+ tmp[1] /= 0.08f;
+ tmp[2] /= 0.08f;
+ }
m_fPosX = tmp[0];
m_fPosY = tmp[1];
m_fPosZ = tmp[2];
+
pCamera->GetTargetPos(tmp);
+ if ((project->GetSnapFlags() & LC_DRAW_CM_UNITS) == 0)
+ {
+ tmp[0] /= 0.08f;
+ tmp[1] /= 0.08f;
+ tmp[2] /= 0.08f;
+ }
m_fRotX = tmp[0];
m_fRotY = tmp[1];
m_fRotZ = tmp[2];
+
pCamera->GetUpVec(tmp);
+ if ((project->GetSnapFlags() & LC_DRAW_CM_UNITS) == 0)
+ {
+ tmp[0] /= 0.08f;
+ tmp[1] /= 0.08f;
+ tmp[2] /= 0.08f;
+ }
m_fUpX = tmp[0];
m_fUpY = tmp[1];
m_fUpZ = tmp[2];
+
m_fFOV = pCamera->m_fovy;
m_fNear = pCamera->m_zNear;
m_fFar = pCamera->m_zFar;
@@ -345,6 +372,12 @@ void CModifyDialog::OnModdlgApply()
mod.pos[0] = m_fPosX;
mod.pos[1] = m_fPosY;
mod.pos[2] = m_fPosZ;
+ if ((project->GetSnapFlags() & LC_DRAW_CM_UNITS) == 0)
+ {
+ mod.pos[0] *= 0.08f;
+ mod.pos[1] *= 0.08f;
+ mod.pos[2] *= 0.08f;
+ }
mod.rot[0] = m_fRotX;
mod.rot[1] = m_fRotY;
mod.rot[2] = m_fRotZ;
@@ -372,6 +405,18 @@ void CModifyDialog::OnModdlgApply()
mod.up[0] = m_fUpX;
mod.up[1] = m_fUpY;
mod.up[2] = m_fUpZ;
+ if ((project->GetSnapFlags() & LC_DRAW_CM_UNITS) == 0)
+ {
+ mod.eye[0] *= 0.08f;
+ mod.eye[1] *= 0.08f;
+ mod.eye[2] *= 0.08f;
+ mod.target[0] *= 0.08f;
+ mod.target[1] *= 0.08f;
+ mod.target[2] *= 0.08f;
+ mod.up[0] *= 0.08f;
+ mod.up[1] *= 0.08f;
+ mod.up[2] *= 0.08f;
+ }
mod.fovy = m_fFOV;
mod.znear = m_fNear;
mod.zfar = m_fFar;