// PoroMedia.cpp : Defines the class behaviors for the application. // //#define CRTDBG_MAP_ALLOC //memory leak detection //#include <stdlib.h> // //#include <crtdbg.h> // #include "stdafx.h" #include "PoroMedia.h" #include ".\poromedia.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif using namespace std; ///////////////////////////////////////////////////////////////////////////// // CPoroMediaApp BEGIN_MESSAGE_MAP(CPoroMediaApp, CWinApp) //{{AFX_MSG_MAP(CPoroMediaApp) ON_COMMAND(ID_APP_ABOUT, OnAppAbout) ON_COMMAND(ID_ANALYSIS_SSA, OnAnalysis_SSA) // ON_COMMAND(ID_ANALYSIS_3DDATA, OnAnalysis3ddata) ON_COMMAND(ID_ANALYSIS_TORTUOSITY, OnAnalysisTortuosity) ON_COMMAND(ID_ANALYSIS_RW, OnAnalysisRW) ON_COMMAND(ID_ANALYSIS_BOUNDARY, OnAnalysisBoundary) //}}AFX_MSG_MAP // Standard file based document commands // Standard print setup command ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) ON_COMMAND(ID_PREPROCESSING_SAMPLEFILTERING, OnPreprocessingSamplefiltering) ON_COMMAND(ID_ANALYSIS_3DSPHEREGROWTH, OnAnalysis3dSphereGrowth) ON_COMMAND(ID_ANALYSIS_3DMEDIALAXIS, OnAnalysis3dmedialaxis) ON_COMMAND(ID_PREPROCESSING_EXTRAS, OnPreprocessingExtras) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CPoroMediaApp construction CPoroMediaApp::CPoroMediaApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } CPoroMediaApp::~CPoroMediaApp() { close_log_file(); } ///////////////////////////////////////////////////////////////////////////// // The one and only CPoroMediaApp object CPoroMediaApp theApp; ///////////////////////////////////////////////////////////////////////////// // CPoroMediaApp initialization BOOL CPoroMediaApp::InitInstance() { // CG: The following block was added by the Splash Screen component. \ { \ CCommandLineInfo cmdInfo; \ ParseCommandLine(cmdInfo); \ \ CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash); \ } AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. //#ifdef _AFXDLL // Enable3dControls(); // Call this when using MFC in a shared DLL //#else // Enable3dControlsStatic(); // Call this when linking to MFC statically //#endif // Change the registry key under which our settings are stored. // TODO: You should modify this string to be something appropriate // such as the name of your company or organization. SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CPoroMediaDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CPoroMediaView)); AddDocTemplate(pDocTemplate); // Enable DDE Execute open EnableShellOpen(); RegisterShellFileTypes(TRUE); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; // The one and only window has been initialized, so show and update it. m_pMainWnd->ShowWindow(SW_HIDE); m_pMainWnd->UpdateWindow(); // Enable drag/drop open m_pMainWnd->DragAcceptFiles(); // set low priority SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS); // start log file if (init_log_file("PoroMediaLog")) //this will be log file name AfxMessageBox("Warning: Could not open the log file"); return TRUE; } ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: RECT m_pRectLink; RECT m_pRectMailto; //{{AFX_MSG(CAboutDlg) virtual BOOL OnInitDialog(); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { //{{AFX_DATA_INIT(CAboutDlg) //}}AFX_DATA_INIT } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) ON_WM_LBUTTONDOWN() ON_WM_MOUSEMOVE() //}}AFX_MSG_MAP END_MESSAGE_MAP() // App command to run the dialog void CPoroMediaApp::OnAppAbout() { CAboutDlg aboutDlg; aboutDlg.DoModal(); } ///////////////////////////////////////////////////////////////////////////// // CPoroMediaApp message handlers BOOL CPoroMediaApp::PreTranslateMessage(MSG* pMsg) { // CG: The following lines were added by the Splash Screen component. if (CSplashWnd::PreTranslateAppMessage(pMsg)) return TRUE; return CWinApp::PreTranslateMessage(pMsg); } BOOL CAboutDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here GetDlgItem(IDC_HOMEPAGE)->GetWindowRect(&m_pRectLink); GetDlgItem(IDC_MAILTO)->GetWindowRect(&m_pRectMailto); ScreenToClient(&m_pRectLink); ScreenToClient(&m_pRectMailto); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CAboutDlg::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default if(point.x>m_pRectLink.left&&point.x<m_pRectLink.right&&point.y>m_pRectLink.top&&point.y<m_pRectLink.bottom) { if(nFlags==MK_LBUTTON) { ShellExecute(0,NULL,"http://www.menet.umn.edu/~wang0620",NULL,NULL,SW_NORMAL); } } if(point.x>m_pRectMailto.left&&point.x<m_pRectMailto.right&&point.y>m_pRectMailto.top&&point.y<m_pRectMailto.bottom) { if(nFlags==MK_LBUTTON) { ShellExecute(0,NULL,"mailto:wang0620@me.umn.edu",NULL,NULL,SW_NORMAL); } } CDialog::OnLButtonDown(nFlags, point); } void CAboutDlg::OnMouseMove(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default if(point.x>m_pRectLink.left&&point.x<m_pRectLink.right&&point.y>m_pRectLink.top&&point.y<m_pRectLink.bottom) { HCURSOR hCursor; hCursor=AfxGetApp()->LoadCursor(IDC_CLICKHAND); SetCursor(hCursor); } if(point.x>m_pRectMailto.left&&point.x<m_pRectMailto.right&&point.y>m_pRectMailto.top&&point.y<m_pRectMailto.bottom) { HCURSOR hCursor; hCursor=AfxGetApp()->LoadCursor(IDC_SENDMAIL); SetCursor(hCursor); } CDialog::OnMouseMove(nFlags, point); } void CPoroMediaApp::OnAnalysis_SSA() { //SSA write_to_log("PorositySSA analysis selected from menu."); CRuntimeClass* prt = RUNTIME_CLASS( PorosityThread ); AfxBeginThread(prt); } void CPoroMediaApp::OnAnalysisTortuosity() { //Tortuosity write_to_log("Tortuosity analysis selected from menu."); CRuntimeClass* prt = RUNTIME_CLASS( TortThread ); AfxBeginThread(prt); } void CPoroMediaApp::OnAnalysisRW() { //RW write_to_log("RW analysis selected from menu."); CRuntimeClass* prt = RUNTIME_CLASS( RW_Thread ); AfxBeginThread(prt); } void CPoroMediaApp::OnAnalysisBoundary() { //Surface Structure Analysis write_to_log("Boundary Analysis selected from menu."); CRuntimeClass* prt = RUNTIME_CLASS( BoundaryThread ); AfxBeginThread(prt); } void CPoroMediaApp::OnPreprocessingSamplefiltering() { // Preprocessing write_to_log("Preprocessing selected from menu."); CRuntimeClass* prt = RUNTIME_CLASS( FiltersThread ); AfxBeginThread(prt); } void CPoroMediaApp::OnAnalysis3dSphereGrowth() { // 3D Sphere growth write_to_log("3D Sphere Growth selected from menu."); CRuntimeClass* prt = RUNTIME_CLASS( SphereThread ); AfxBeginThread(prt); } void CPoroMediaApp::OnAnalysis3dmedialaxis() { // 3D Medial Axis write_to_log("3D Medial Axis selected from menu."); CRuntimeClass* prt = RUNTIME_CLASS( MedialThread ); AfxBeginThread(prt); } void CPoroMediaApp::OnPreprocessingExtras() { // extras write_to_log("Extras selected from menu."); CRuntimeClass* prt = RUNTIME_CLASS( ExtrasThread ); AfxBeginThread(prt); }