summaryrefslogtreecommitdiff
path: root/win
diff options
context:
space:
mode:
authorleo2005-03-18 22:38:22 +0000
committerleo2005-03-18 22:38:22 +0000
commit26885315bc07017948d54962b5d585b8bc666b24 (patch)
treea20876ff14ec7c965cd010f1e7050f4d25617782 /win
parentc8951a1853dfd43aeb43394b9fa1682c3f0db743 (diff)
Better tooltip behavior on the pieces list,
Fixed a possible crash processing shortcuts. git-svn-id: http://svn.leocad.org/trunk@393 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win')
-rw-r--r--win/Mainfrm.cpp23
-rw-r--r--win/Piecelst.cpp6
-rw-r--r--win/Titletip.cpp29
-rw-r--r--win/titletip.h4
4 files changed, 44 insertions, 18 deletions
diff --git a/win/Mainfrm.cpp b/win/Mainfrm.cpp
index 2c0ad18..6ff0d44 100644
--- a/win/Mainfrm.cpp
+++ b/win/Mainfrm.cpp
@@ -1115,17 +1115,22 @@ BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
// 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);
- }
+ CWnd* Focus = GetFocus();
- char Name[256];
- GetClassName(GetFocus()->m_hWnd, Name, sizeof(Name));
- if (!strcmp(Name, "Edit"))
+ if (Focus != NULL)
{
- return CFrameWnd::PreTranslateMessage(pMsg);
+ if (m_wndPiecesBar.m_wndPiecesCombo.IsChild(Focus) ||
+ m_wndPiecesBar.m_wndPiecesList.IsChild(Focus))
+ {
+ return CFrameWnd::PreTranslateMessage(pMsg);
+ }
+
+ char Name[256];
+ GetClassName(Focus->m_hWnd, Name, sizeof(Name));
+ if (!strcmp(Name, "Edit"))
+ {
+ return CFrameWnd::PreTranslateMessage(pMsg);
+ }
}
}
diff --git a/win/Piecelst.cpp b/win/Piecelst.cpp
index 2ea308d..a4f14bb 100644
--- a/win/Piecelst.cpp
+++ b/win/Piecelst.cpp
@@ -261,7 +261,7 @@ int CPiecesList::CellRectFromPoint(CPoint & point, RECT* cellrect, int* col) con
void CPiecesList::OnMouseMove(UINT nFlags, CPoint point)
{
- if( nFlags == 0 )
+ if (nFlags == 0)
{
int row, col;
RECT cellrect;
@@ -269,7 +269,7 @@ void CPiecesList::OnMouseMove(UINT nFlags, CPoint point)
if (row != -1)
{
int offset = 7;
- if( col == 0 )
+ if( col == 0 )
{
CRect rcLabel;
GetItemRect(row, &rcLabel, LVIR_LABEL);
@@ -277,7 +277,7 @@ void CPiecesList::OnMouseMove(UINT nFlags, CPoint point)
}
cellrect.top--;
- m_TitleTip.Show (cellrect, GetItemText(row, col), offset-1, GetItemState (row, LVIS_FOCUSED));
+ m_TitleTip.Show(cellrect, GetItemText(row, col), offset-1, GetItemState(row, LVIS_FOCUSED) && (col == 0));
}
}
diff --git a/win/Titletip.cpp b/win/Titletip.cpp
index 192fe09..9a9f03c 100644
--- a/win/Titletip.cpp
+++ b/win/Titletip.cpp
@@ -44,7 +44,9 @@ CTitleTip::~CTitleTip()
BEGIN_MESSAGE_MAP(CTitleTip, CWnd)
//{{AFX_MSG_MAP(CTitleTip)
ON_WM_MOUSEMOVE()
-//}}AFX_MSG_MAP
+ ON_WM_CAPTURECHANGED()
+ ON_WM_ACTIVATEAPP()
+ //}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -217,10 +219,6 @@ BOOL CTitleTip::PreTranslateMessage(MSG* pMsg)
ShowWindow(SW_HIDE);
m_pParentWnd->PostMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
return TRUE;
- case WM_ACTIVATEAPP:
- ReleaseCapture();
- ShowWindow(SW_HIDE);
- return TRUE;
}
if (GetFocus() == NULL)
@@ -232,3 +230,24 @@ BOOL CTitleTip::PreTranslateMessage(MSG* pMsg)
return CWnd::PreTranslateMessage(pMsg);
}
+
+void CTitleTip::OnCaptureChanged(CWnd *pWnd)
+{
+ if (pWnd != this)
+ {
+ ShowWindow(SW_HIDE);
+ }
+
+ CWnd::OnCaptureChanged(pWnd);
+}
+
+void CTitleTip::OnActivateApp(BOOL bActive, HTASK hTask)
+{
+ CWnd::OnActivateApp(bActive, hTask);
+
+ if (!bActive)
+ {
+ ReleaseCapture();
+ ShowWindow(SW_HIDE);
+ }
+}
diff --git a/win/titletip.h b/win/titletip.h
index b9698a7..dafd0da 100644
--- a/win/titletip.h
+++ b/win/titletip.h
@@ -47,7 +47,9 @@ protected:
protected:
//{{AFX_MSG(CTitleTip)
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
- //}}AFX_MSG
+ afx_msg void OnCaptureChanged(CWnd *pWnd);
+ afx_msg void OnActivateApp(BOOL bActive, HTASK hTask);
+ //}}AFX_MSG
DECLARE_MESSAGE_MAP()
};