Removed duplicate window position code.

This commit is contained in:
leo 2012-07-06 23:57:53 +00:00
parent 690a424359
commit eb4576dd7f
2 changed files with 6 additions and 44 deletions

View file

@ -182,16 +182,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY);
// UpdateMenuAccelerators(); // UpdateMenuAccelerators();
CMFCToolBar::AddToolBarForImageCollection(IDR_INVISIBLE);
if (!m_wndInvisibleToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, ID_VIEW_INVISIBLE_BAR) || !m_wndInvisibleToolBar.LoadToolBar(IDR_INVISIBLE))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
m_wndInvisibleToolBar.SetWindowText (_T("Invisible"));
m_wndInvisibleToolBar.SetMaskMode(TRUE);
m_wndInvisibleToolBar.ShowPane(FALSE, FALSE, FALSE);
if (!m_wndProperties.Create("Properties", this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_PROPERTIES_BAR, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI)) if (!m_wndProperties.Create("Properties", this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_PROPERTIES_BAR, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI))
{ {
@ -224,33 +215,6 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
return 0; return 0;
} }
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
int status = theApp.GetProfileInt("Settings", "Window Status", -1);
cs.style &= ~WS_VISIBLE;
if (status != -1)
{
int r,l,b,t;
char szBuf[60];
strcpy (szBuf, theApp.GetProfileString("Settings","Window Position"));
sscanf(szBuf,"%d, %d, %d, %d", &t, &r, &b, &l);
cs.cx = r - l;
cs.cy = b - t;
RECT workArea;
SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
l += workArea.left;
t += workArea.top;
cs.x = min(l, GetSystemMetrics(SM_CXSCREEN) - GetSystemMetrics(SM_CXICON));
cs.y = min(t, GetSystemMetrics(SM_CYSCREEN) - GetSystemMetrics(SM_CYICON));
}
return CFrameWndEx::PreCreateWindow(cs);
}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics // CMainFrame diagnostics

View file

@ -33,7 +33,6 @@ public:
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame) //{{AFX_VIRTUAL(CMainFrame)
public: public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL PreTranslateMessage(MSG* pMsg); virtual BOOL PreTranslateMessage(MSG* pMsg);
protected: protected:
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
@ -55,7 +54,6 @@ public:
CMFCToolBarNoUpdate m_wndStandardBar; CMFCToolBarNoUpdate m_wndStandardBar;
CMFCToolBarNoUpdate m_wndToolsBar; CMFCToolBarNoUpdate m_wndToolsBar;
CMFCToolBarNoUpdate m_wndAnimationBar; CMFCToolBarNoUpdate m_wndAnimationBar;
CMFCToolBar m_wndInvisibleToolBar;
CPiecesBar m_wndPiecesBar; CPiecesBar m_wndPiecesBar;
CPropertiesPane m_wndProperties; CPropertiesPane m_wndProperties;