// MainFrm.cpp : implementation of the CMainFrame class // #include "stdafx.h" #include "PoroMedia.h" #include "MainFrm.h" #include "Splash.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #define TIME_STATUSBAR 1 ///////////////////////////////////////////////////////////////////////////// // CMainFrame IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) //{{AFX_MSG_MAP(CMainFrame) ON_WM_CREATE() ON_UPDATE_COMMAND_UI(ID_INDICATOR_TIME,OnUpdateTimeIndicator) ON_WM_TIMER() //ON_UPDATE_COMMAND_UI(ID_ANALYSIS_3DDATA, OnUpdateAnalysis3ddata) //ON_COMMAND(ID_ANALYSIS_BOUNDARY, OnAnalysisBoundary) //}}AFX_MSG_MAP // Global help commands ON_COMMAND(ID_HELP_FINDER, CFrameWnd::OnHelpFinder) ON_COMMAND(ID_HELP, CFrameWnd::OnHelp) ON_COMMAND(ID_CONTEXT_HELP, CFrameWnd::OnContextHelp) ON_COMMAND(ID_DEFAULT_HELP, CFrameWnd::OnHelpFinder) END_MESSAGE_MAP() static UINT indicators[] = { ID_SEPARATOR, // status line indicator ID_INDICATOR_XYCOOR, ID_INDICATOR_TIME, }; ///////////////////////////////////////////////////////////////////////////// // CMainFrame construction/destruction CMainFrame::CMainFrame() { // TODO: add member initialization code here is_3Ddataready=false; m_thres=1; } CMainFrame::~CMainFrame() { } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } // TODO: Delete these three lines if you don't want the toolbar to // be dockable m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); m_wndStatusBar.SetPaneInfo(m_wndStatusBar.CommandToIndex(ID_INDICATOR_XYCOOR),ID_INDICATOR_XYCOOR,SBPS_NORMAL,60); this->updatexycoor(" "); SetTimer(TIME_STATUSBAR,60000,NULL); memset(time,'\0',7); char tempchar[20]; _strtime(tempchar); strncpy(time,tempchar,5); // CG: The following line was added by the Splash Screen component. CSplashWnd::ShowSplashScreen(this); return 0; } void CMainFrame::OnUpdateTimeIndicator(CCmdUI* /*pCmdUI*/) { CString strStatus; strStatus.Format(ID_INDICATOR_TIME,time); m_wndStatusBar.SetPaneText(m_wndStatusBar.CommandToIndex(ID_INDICATOR_TIME),strStatus); } BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs int xSize=::GetSystemMetrics(SM_CXSCREEN); int ySize=::GetSystemMetrics(SM_CYSCREEN); cs.cx=640; cs.cy=396; cs.x=(xSize-cs.cx)/2; cs.y=(ySize-cs.cy)/2; return TRUE; } ///////////////////////////////////////////////////////////////////////////// // CMainFrame diagnostics #ifdef _DEBUG void CMainFrame::AssertValid() const { CFrameWnd::AssertValid(); } void CMainFrame::Dump(CDumpContext& dc) const { CFrameWnd::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CMainFrame message handlers void CMainFrame::OnTimer(UINT_PTR nIDEvent) { // TODO: Add your message handler code here and/or call default if ( nIDEvent == TIME_STATUSBAR ) { char tempchar[20]; _strtime(tempchar); // get current time strncpy(time,tempchar,5); // extract only hour and minute info } CFrameWnd::OnTimer(nIDEvent); } void CMainFrame::updatexycoor(char* title) { m_wndStatusBar.SetPaneText(m_wndStatusBar.CommandToIndex(ID_INDICATOR_XYCOOR),title); } void CMainFrame::setis_3Ddataready(bool value) { is_3Ddataready=value; } bool CMainFrame::getis_3Ddataready() { return is_3Ddataready; } void CMainFrame::OnUpdateAnalysis3ddata(CCmdUI* pCmdUI) { // TODO: Add your command update UI handler code here pCmdUI->Enable(getis_3Ddataready()); } void CMainFrame::setthres(int value) { m_thres=value; } int CMainFrame::getthres() { return m_thres; } //void CMainFrame::OnAnalysisTortuosity() //{ // TODO: Add your command handler code here //} //void CMainFrame::OnAnalysisBoundary() //{ // TODO: Add your command handler code here //}