r591: Added Center-Detector length to scanning and reconstruction
[ctsim.git] / src / dialogs.cpp
index 8e253387987cc957d5461396fe1ff69a6b69dd5f..d620b12f19f6aff22a825d0ae78835af3a549cab 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: dialogs.cpp,v 1.40 2001/02/22 11:05:38 kevin Exp $
+**  $Id: dialogs.cpp,v 1.44 2001/03/01 07:30:49 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
@@ -60,7 +60,7 @@
 //    StringValueAndTitleListBox
 ///////////////////////////////////////////////////////////////////////
 
-StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[])
+StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* const aszTitle[], const char* const aszValue[])
 : wxListBox ()
 {
   wxString* psTitle = new wxString [nChoices];
@@ -79,7 +79,7 @@ StringValueAndTitleListBox::getSelectionStringValue () const
   return m_ppszValues[GetSelection()];
 }
 
-StringValueAndTitleRadioBox::StringValueAndTitleRadioBox (wxDialog* pParent, const wxString& strTitle, int nChoices, const char* aszTitle[], const char* aszValue[])
+StringValueAndTitleRadioBox::StringValueAndTitleRadioBox (wxDialog* pParent, const wxString& strTitle, int nChoices, const char* const aszTitle[], const char* const aszValue[])
 : wxRadioBox ()
 {
   wxString* psTitle = new wxString [nChoices];
@@ -217,7 +217,7 @@ DialogGetComparisonImage::getMakeDifferenceImage()
 /////////////////////////////////////////////////////////////////////
 
 DialogPreferences::DialogPreferences (wxWindow* pParent, const char* const pszTitle, 
-                   bool bAdvancedOptions, bool bAskDeleteNewDocs, bool bVerboseLogging, bool bStartupTips)
+                   bool bAdvancedOptions, bool bAskDeleteNewDocs, bool bVerboseLogging, bool bStartupTips, bool bUseBackgroundTasks)
 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
 {
   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
@@ -242,6 +242,10 @@ DialogPreferences::DialogPreferences (wxWindow* pParent, const char* const pszTi
   m_pCBStartupTips->SetValue (bStartupTips);
   pTopSizer->Add (m_pCBStartupTips, 0, wxALIGN_CENTER_VERTICAL);
 
+  m_pCBUseBackgroundTasks = new wxCheckBox (this, -1, "Put Tasks in Background", wxDefaultPosition, wxSize(250, 25), 0);
+  m_pCBUseBackgroundTasks->SetValue (bUseBackgroundTasks);
+  pTopSizer->Add (m_pCBUseBackgroundTasks, 0, wxALIGN_CENTER_VERTICAL);
+
   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
   
   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
@@ -289,6 +293,12 @@ DialogPreferences::getStartupTips ()
   return static_cast<bool>(m_pCBStartupTips->GetValue());
 }
 
+bool
+DialogPreferences::getUseBackgroundTasks ()
+{
+  return static_cast<bool>(m_pCBUseBackgroundTasks->GetValue());
+}
+
 
 /////////////////////////////////////////////////////////////////////
 // CLASS DiaglogGetMinMax Implementation
@@ -565,14 +575,15 @@ DialogGetRasterParameters::getViewRatio ()
 
 DialogGetProjectionParameters::DialogGetProjectionParameters 
    (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples, 
-    double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultViewRatio,
-    double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
+    double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultCenterDetectorLength,
+    double dDefaultViewRatio, double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
 : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
 {
   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
   
   m_dDefaultRotAngle = dDefaultRotAngle;
   m_dDefaultFocalLength = dDefaultFocalLength;
+  m_dDefaultCenterDetectorLength = dDefaultCenterDetectorLength;
   m_dDefaultViewRatio = dDefaultViewRatio;
   m_dDefaultScanRatio = dDefaultScanRatio;
   m_iDefaultNSamples = iDefaultNSamples;
@@ -630,7 +641,13 @@ DialogGetProjectionParameters::DialogGetProjectionParameters
   m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
   pText2Sizer->Add (new wxStaticText (this, -1, "Focal Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   pText2Sizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
-  
+
+  std::ostringstream osCenterDetectorLength;
+  osCenterDetectorLength << dDefaultCenterDetectorLength;
+  m_pTextCtrlCenterDetectorLength = new wxTextCtrl (this, -1, osCenterDetectorLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+  pText2Sizer->Add (new wxStaticText (this, -1, "Center-Detector Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  pText2Sizer->Add (m_pTextCtrlCenterDetectorLength, 0, wxALIGN_CENTER_VERTICAL);
+
   if (theApp->getAdvancedOptions()) {
     std::ostringstream osRotAngle;
     osRotAngle << dDefaultRotAngle;
@@ -730,6 +747,17 @@ DialogGetProjectionParameters::getFocalLengthRatio ()
     return (m_dDefaultFocalLength);
 }
 
+double
+DialogGetProjectionParameters::getCenterDetectorLengthRatio ()
+{
+  wxString strCtrl = m_pTextCtrlCenterDetectorLength->GetValue();
+  double dValue;
+  if (strCtrl.ToDouble (&dValue))
+    return (dValue);
+  else
+    return (m_dDefaultCenterDetectorLength);
+}
+
 double
 DialogGetProjectionParameters::getViewRatio ()
 {