X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fctsim.cpp;h=bb3b841dba227b70c364ad6df08bd13d749ddeb1;hb=711cae0ee02e046370fdb4d6c6f440596ff71980;hp=c7db0f0501a1ba70c9091d1828646c91d1dfd50b;hpb=e4c1f7f8eb87558c3abf3bf1d20732361f425351;p=ctsim.git diff --git a/src/ctsim.cpp b/src/ctsim.cpp index c7db0f0..bb3b841 100644 --- a/src/ctsim.cpp +++ b/src/ctsim.cpp @@ -1,15 +1,15 @@ /***************************************************************************** ** FILE IDENTIFICATION ** -** Name: ctsim.h -** Purpose: Header file for top-level routines of CTSim program +** Name: ctsim.cpp +** Purpose: Top-level routines of CTSim program ** Programmer: Kevin Rosenberg ** Date Started: July 2000 ** ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ctsim.cpp,v 1.5 2000/07/15 08:36:13 kevin Exp $ +** $Id: ctsim.cpp,v 1.9 2000/07/23 01:49:03 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -41,16 +41,26 @@ #endif #include "wx/docview.h" -#include "ct.h" #include "ctsim.h" #include "docs.h" #include "views.h" +#include "dialogs.h" +#include "ctsupport.h" +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif +#if defined(HAVE_GETOPT_H) || defined(HAVE_GETOPT_LONG) +#include +#endif + +static const char* rcsindent = "$Id"; class CTSimApp* theApp = NULL; struct option CTSimApp::ctsimOptions[] = { {"help", 0, 0, O_HELP}, + {"version", 0, 0, O_VERSION}, {0, 0, 0, 0} }; @@ -72,6 +82,9 @@ CTSimApp::OnInit(void) break; switch (c) { + case O_VERSION: + cout << rcsindent << endl; + exit(0); case O_HELP: case '?': usage (argv[0]); @@ -96,7 +109,7 @@ CTSimApp::OnInit(void) //// Make a menubar wxMenu *file_menu = new wxMenu; - file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "&Create Phantom..."); + file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom..."); file_menu->Append(wxID_OPEN, "&Open..."); file_menu->AppendSeparator(); @@ -136,6 +149,7 @@ CTSimApp::usage(const char* program) cout << "usage: " << fileBasename(program) << " [files-to-open...] [OPTIONS]\n"; cout << "Computed Tomography Simulator (Graphical Shell)\n"; cout << "\n"; + cout << " --version Display version\n"; cout << " --help Display this help message\n"; } @@ -143,6 +157,9 @@ int CTSimApp::OnExit(void) { delete m_docManager; +#ifdef HAVE_DMALLOC + dmalloc_shutdown(); +#endif return 0; } @@ -188,26 +205,13 @@ MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event) ) void MainFrame::OnCreatePhantom(wxCommandEvent& WXUNUSED(event)) { - wxString choiceStringList [5]; - choiceStringList[0] = Phantom::PHM_HERMAN_STR; - choiceStringList[1] = Phantom::PHM_BHERMAN_STR; - choiceStringList[2] = Phantom::PHM_ROWLAND_STR;; - choiceStringList[3] = Phantom::PHM_BROWLAND_STR; - choiceStringList[4] = Phantom::PHM_UNITPULSE_STR; - wxString choiceTitleList [5]; - choiceTitleList[0] = "Herman Head"; - choiceTitleList[1] = "Herman Head Bordered"; - choiceTitleList[2] = "Rowland Head"; - choiceTitleList[3] = "Rowland Head Bordered"; - choiceTitleList[4] = "Unit Pulse"; - wxSingleChoiceDialog dialog (this, "Select phantom", "Phantom Selection", 5, choiceTitleList, NULL, wxOK|wxCANCEL|wxCENTRE); - - int dialogReturn = dialog.ShowModal(); + DialogGetPhantom dialogPhantom (this, Phantom::PHM_HERMAN); + int dialogReturn = dialogPhantom.ShowModal(); if (dialogReturn == wxID_OK) { - int selection = dialog.GetSelection(); - *theApp->getLog() << "Selected phantom " << selection << "\n"; - wxString filename = choiceStringList[selection] + ".phm"; - theApp->getDocManager()->CreateDocument(filename, wxDOC_SILENT); + wxString selection (dialogPhantom.getPhantom()); + *theApp->getLog() << "Selected phantom " << selection.c_str() << "\n"; + wxString filename = selection + ".phm"; + theApp->getDocManager()->CreateDocument(filename, wxDOC_SILENT); } }