1 // MainFrm.cpp : implementation of the CMainFrame class
13 static char THIS_FILE
[] = __FILE__
;
16 /////////////////////////////////////////////////////////////////////////////
19 IMPLEMENT_DYNAMIC(CMainFrame
, CMDIFrameWnd
)
21 BEGIN_MESSAGE_MAP(CMainFrame
, CMDIFrameWnd
)
22 //{{AFX_MSG_MAP(CMainFrame)
23 // NOTE - the ClassWizard will add and remove mapping macros here.
24 // DO NOT EDIT what you see in these blocks of generated code !
27 ON_UPDATE_COMMAND_UI(ID_INDICATOR_IMAGEINFO
, OnUpdateImageInfo
)
30 static UINT indicators
[] =
32 ID_SEPARATOR
, // status line indicator
33 ID_INDICATOR_IMAGEINFO
,
36 /////////////////////////////////////////////////////////////////////////////
37 // CMainFrame construction/destruction
39 CMainFrame::CMainFrame()
43 CMainFrame::~CMainFrame()
47 int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct
)
49 if (CMDIFrameWnd::OnCreate(lpCreateStruct
) == -1)
52 // Note: I changed the default toolbar creation code so we can still compile with VC5:
53 // if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
54 // | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
55 // !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
56 if (!m_wndToolBar
.Create(this) ||
57 !m_wndToolBar
.LoadToolBar(IDR_MAINFRAME
))
59 TRACE0("Failed to create toolbar\n");
60 return -1; // fail to create
63 if (!m_wndStatusBar
.Create(this) ||
64 !m_wndStatusBar
.SetIndicators(indicators
,
65 sizeof(indicators
)/sizeof(UINT
)))
67 TRACE0("Failed to create status bar\n");
68 return -1; // fail to create
71 m_wndStatusBar
.SetPaneInfo(1, ID_INDICATOR_IMAGEINFO
, SBPS_NORMAL
, 220);
73 m_wndToolBar
.EnableDocking(CBRS_ALIGN_ANY
);
74 EnableDocking(CBRS_ALIGN_ANY
);
75 DockControlBar(&m_wndToolBar
);
80 /////////////////////////////////////////////////////////////////////////////
81 // CMainFrame diagnostics
84 void CMainFrame::AssertValid() const
86 CMDIFrameWnd::AssertValid();
89 void CMainFrame::Dump(CDumpContext
& dc
) const
91 CMDIFrameWnd::Dump(dc
);
96 /////////////////////////////////////////////////////////////////////////////
97 // CMainFrame message handlers
98 void CMainFrame::OnUpdateImageInfo(CCmdUI
*pCmdUI
)
102 // Get the active MDI child window.
103 CMDIChildWnd
*pChild
= (CMDIChildWnd
*)GetActiveFrame();
105 if (pChild
!= NULL
&& pChild
!= (CMDIChildWnd
*)this)
107 // Get the active view attached to the active MDI child window.
108 CDxtexView
* pView
= (CDxtexView
*)pChild
->GetActiveView();
109 pView
->GetImageInfo(strInfo
);
111 pCmdUI
->SetText(strInfo
);
115 pCmdUI
->Enable(FALSE
);