dsrc isn't necessary for this repo
[client-tools.git] / src / external / 3rd / application / DXTex / MainFrm.cpp
blob506379cadc8af9b47c8a03edcbc6d72c5d51cae4
1 // MainFrm.cpp : implementation of the CMainFrame class
2 //
4 #include "stdafx.h"
5 #include "dxtex.h"
6 #include "MainFrm.h"
7 #include "DxtexDoc.h"
8 #include "DxtexView.h"
10 #ifdef _DEBUG
11 #define new DEBUG_NEW
12 #undef THIS_FILE
13 static char THIS_FILE[] = __FILE__;
14 #endif
16 /////////////////////////////////////////////////////////////////////////////
17 // CMainFrame
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 !
25 ON_WM_CREATE()
26 //}}AFX_MSG_MAP
27 ON_UPDATE_COMMAND_UI(ID_INDICATOR_IMAGEINFO, OnUpdateImageInfo)
28 END_MESSAGE_MAP()
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)
50 return -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);
77 return 0;
80 /////////////////////////////////////////////////////////////////////////////
81 // CMainFrame diagnostics
83 #ifdef _DEBUG
84 void CMainFrame::AssertValid() const
86 CMDIFrameWnd::AssertValid();
89 void CMainFrame::Dump(CDumpContext& dc) const
91 CMDIFrameWnd::Dump(dc);
94 #endif //_DEBUG
96 /////////////////////////////////////////////////////////////////////////////
97 // CMainFrame message handlers
98 void CMainFrame::OnUpdateImageInfo(CCmdUI *pCmdUI)
100 CString strInfo;
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);
110 pCmdUI->Enable();
111 pCmdUI->SetText(strInfo);
113 else
115 pCmdUI->Enable(FALSE);