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

@ -22,7 +22,7 @@
static char THIS_FILE[] = __FILE__; static char THIS_FILE[] = __FILE__;
#endif #endif
void mainframe_listener (int message, void *data, void *user) void mainframe_listener(int message, void *data, void *user)
{ {
if (message == LC_MSG_FOCUS_CHANGED) if (message == LC_MSG_FOCUS_CHANGED)
{ {
@ -168,7 +168,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
return -1; // fail to create return -1; // fail to create
} }
m_wndAnimationBar.SetWindowText (_T("Animation")); m_wndAnimationBar.SetWindowText(_T("Animation"));
m_wndAnimationBar.EnableDocking(CBRS_ALIGN_ANY); m_wndAnimationBar.EnableDocking(CBRS_ALIGN_ANY);
if (!m_wndPiecesBar.Create(_T("Pieces"), this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_PIECES_BAR, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI)) if (!m_wndPiecesBar.Create(_T("Pieces"), this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_PIECES_BAR, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI))
@ -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))
{ {
@ -213,44 +204,17 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
CDockingManager::SetDockingMode(DT_SMART); CDockingManager::SetDockingMode(DT_SMART);
EnableAutoHidePanes(CBRS_ALIGN_ANY); EnableAutoHidePanes(CBRS_ALIGN_ANY);
messenger->Listen (&mainframe_listener, this); messenger->Listen(&mainframe_listener, this);
main_window->SetXID (this); main_window->SetXID(this);
theApp.LoadState(this); theApp.LoadState(this);
// console.SetWindowCallback (&mainframe_console_func, m_wndSplitter.GetPane (1, 0)); // console.SetWindowCallback(&mainframe_console_func, m_wndSplitter.GetPane(1, 0));
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;