summaryrefslogtreecommitdiff
path: root/win
diff options
context:
space:
mode:
authorleo2005-11-09 19:47:51 +0000
committerleo2005-11-09 19:47:51 +0000
commit43de59ee74775c20597182b8fe171f653f1f76d8 (patch)
treed7c1dc2aa672dac91272b475cd8aba60ae0d4a97 /win
parent647e9c0cf53694b39abd24b74440c507cb8cda78 (diff)
Remember the pieces bar size when you exit the program.
git-svn-id: http://svn.leocad.org/trunk@439 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win')
-rw-r--r--win/Mainfrm.cpp4
-rw-r--r--win/Piecebar.cpp42
-rw-r--r--win/Piecebar.h3
3 files changed, 42 insertions, 7 deletions
diff --git a/win/Mainfrm.cpp b/win/Mainfrm.cpp
index 1f487bd..83579b6 100644
--- a/win/Mainfrm.cpp
+++ b/win/Mainfrm.cpp
@@ -227,8 +227,8 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
// members. If you need to change them later, don't forget to call
// RecalcLayout() or DelayRecalcLayout() after you set the size.
// You can use this technique to load/save the size of the control bar.
- m_wndPiecesBar.m_sizeVert = CSize(226, -1); // y size ignored (stretched)
- m_wndPiecesBar.m_sizeFloat = CSize(226, 270);
+// m_wndPiecesBar.m_sizeVert = CSize(226, -1); // y size ignored (stretched)
+// m_wndPiecesBar.m_sizeFloat = CSize(226, 270);
m_wndPiecesBar.SetBarStyle(m_wndPiecesBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_wndPiecesBar.EnableDocking(CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT);
diff --git a/win/Piecebar.cpp b/win/Piecebar.cpp
index 49f1249..43799a2 100644
--- a/win/Piecebar.cpp
+++ b/win/Piecebar.cpp
@@ -31,8 +31,8 @@ CPiecesBar::CPiecesBar()
m_sizeMin = CSize(222, 200);
m_sizeHorz = CSize(200, 200);
- m_sizeVert = CSize(200, 200);
- m_sizeFloat = CSize(200, 200);
+ m_sizeVert = CSize(226, -1);
+ m_sizeFloat = CSize(226, 270);
m_bTracking = FALSE;
m_bInRecalcNC = FALSE;
m_cxEdge = 5;
@@ -44,6 +44,7 @@ CPiecesBar::CPiecesBar()
CPiecesBar::~CPiecesBar()
{
AfxGetApp()->WriteProfileInt("Settings", "Preview Height", m_nPreviewHeight);
+ SaveState();
}
BEGIN_MESSAGE_MAP(CPiecesBar, CControlBar)
@@ -90,20 +91,51 @@ BOOL CPiecesBar::Create(LPCTSTR lpszWindowName, CWnd* pParentWnd, CSize sizeDefa
dwStyle &= ~CBRS_ALL;
dwStyle &= WS_VISIBLE | WS_CHILD;
- if (!CWnd::Create(wndclass, lpszWindowName, dwStyle, CRect(0,0,0,0),
- pParentWnd, nID))
- return FALSE;
+ if (!CWnd::Create(wndclass, lpszWindowName, dwStyle, CRect(0,0,0,0), pParentWnd, nID))
+ return FALSE;
m_sizeHorz = sizeDefault;
m_sizeVert = sizeDefault;
m_sizeFloat = sizeDefault;
+ LoadState();
+
m_bHasGripper = bHasGripper;
m_cyGripper = m_bHasGripper ? 12 : 0;
return TRUE;
}
+void CPiecesBar::SaveState()
+{
+ CWinApp* pApp = AfxGetApp();
+ TCHAR* szSection = _T("PiecesBar");
+
+ pApp->WriteProfileInt(szSection, _T("HorzCX"), m_sizeHorz.cx);
+ pApp->WriteProfileInt(szSection, _T("HorzCY"), m_sizeHorz.cy);
+
+ pApp->WriteProfileInt(szSection, _T("VertCX"), m_sizeVert.cx);
+ pApp->WriteProfileInt(szSection, _T("VertCY"), m_sizeVert.cy);
+
+ pApp->WriteProfileInt(szSection, _T("FloatCX"), m_sizeFloat.cx);
+ pApp->WriteProfileInt(szSection, _T("FloatCY"), m_sizeFloat.cy);
+}
+
+void CPiecesBar::LoadState()
+{
+ CWinApp* pApp = AfxGetApp();
+ TCHAR* szSection = _T("PiecesBar");
+
+ m_sizeHorz.cx = (int)pApp->GetProfileInt(szSection, _T("HorzCX"), m_sizeHorz.cx);
+ m_sizeHorz.cy = (int)pApp->GetProfileInt(szSection, _T("HorzCY"), m_sizeHorz.cy);
+
+ m_sizeVert.cx = (int)pApp->GetProfileInt(szSection, _T("VertCX"), m_sizeVert.cx);
+ m_sizeVert.cy = (int)pApp->GetProfileInt(szSection, _T("VertCY"), m_sizeVert.cy);
+
+ m_sizeFloat.cx = (int)pApp->GetProfileInt(szSection, _T("FloatCX"), m_sizeFloat.cx);
+ m_sizeFloat.cy = (int)pApp->GetProfileInt(szSection, _T("FloatCY"), m_sizeFloat.cy);
+}
+
BOOL CPiecesBar::IsHorzDocked() const
{
return (m_nDockBarID == AFX_IDW_DOCKBAR_TOP || m_nDockBarID == AFX_IDW_DOCKBAR_BOTTOM);
diff --git a/win/Piecebar.h b/win/Piecebar.h
index ac87fa1..ef43760 100644
--- a/win/Piecebar.h
+++ b/win/Piecebar.h
@@ -76,6 +76,9 @@ protected:
int m_cyGripper;
CRect m_rectGripper;
+ void LoadState();
+ void SaveState();
+
public:
void CreateGroupsBar();
BOOL m_bSubParts;