r591: Added Center-Detector length to scanning and reconstruction
[ctsim.git] / src / dialogs.cpp
index 4681b7c8725b2e7a96d286525c02192f70b9c9b3..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.32 2001/02/14 18:39:47 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
 // #pragma implementation
 #endif
 
-// For compilers that support precompilation, includes "wx/wx.h".
 #include "wx/wxprec.h"
 
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
 #ifndef WX_PRECOMP
 #include "wx/wx.h"
 #endif
@@ -65,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];
@@ -84,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];
@@ -113,23 +108,26 @@ DialogGetPhantom::DialogGetPhantom (wxWindow* pParent, int iDefaultPhantom)
 {
   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
   
-  pTopSizer->Add (new wxStaticText (this, -1, "Select Phantom"), 0, wxALIGN_CENTER | wxALL, 5);
+  pTopSizer->Add (new wxStaticText (this, -1, "Select Phantom"), 0, wxCENTER | wxALL, 5);
   
-  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
+  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
   
   m_pRadioBoxPhantom = new StringValueAndTitleRadioBox (this, _T("Phantom"), Phantom::getPhantomCount(), Phantom::getPhantomTitleArray(), Phantom::getPhantomNameArray());
   m_pRadioBoxPhantom->SetSelection (iDefaultPhantom);
-  pTopSizer->Add (m_pRadioBoxPhantom, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
+  pTopSizer->Add (m_pRadioBoxPhantom, 0, wxALL | wxALIGN_CENTER);
   
   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
   
   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
-  
+  CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PHANTOM);
+  pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
+
   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+  pButtonOk->SetDefault();
   
   SetAutoLayout (true);
   SetSizer (pTopSizer);
@@ -183,11 +181,14 @@ DialogGetComparisonImage::DialogGetComparisonImage (wxWindow* pParent, const cha
   
   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+  CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_COMPARISON);
+  pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
   
   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+  pButtonOk->SetDefault();
   
   SetAutoLayout (true);
   SetSizer (pTopSizer);
@@ -216,7 +217,7 @@ DialogGetComparisonImage::getMakeDifferenceImage()
 /////////////////////////////////////////////////////////////////////
 
 DialogPreferences::DialogPreferences (wxWindow* pParent, const char* const pszTitle, 
-                                      bool bAdvancedOptions, bool bAskDeleteNewDocs)
+                   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);
@@ -233,15 +234,30 @@ DialogPreferences::DialogPreferences (wxWindow* pParent, const char* const pszTi
   m_pCBAskDeleteNewDocs->SetValue (bAskDeleteNewDocs);
   pTopSizer->Add (m_pCBAskDeleteNewDocs, 0, wxALIGN_CENTER_VERTICAL);
 
+  m_pCBVerboseLogging = new wxCheckBox (this, -1, "Verbose Logging", wxDefaultPosition, wxSize(250, 25), 0);
+  m_pCBVerboseLogging->SetValue (bVerboseLogging);
+  pTopSizer->Add (m_pCBVerboseLogging, 0, wxALIGN_CENTER_VERTICAL);
+
+  m_pCBStartupTips = new wxCheckBox (this, -1, "Show Tips at Start", wxDefaultPosition, wxSize(250, 25), 0);
+  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);
   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+  CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PREFERENCES);
+  pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
   
   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+  pButtonOk->SetDefault();
   
   SetAutoLayout (true);
   SetSizer (pTopSizer);
@@ -265,6 +281,24 @@ DialogPreferences::getAskDeleteNewDocs ()
   return static_cast<bool>(m_pCBAskDeleteNewDocs->GetValue());
 }
 
+bool
+DialogPreferences::getVerboseLogging ()
+{
+  return static_cast<bool>(m_pCBVerboseLogging->GetValue());
+}
+
+bool
+DialogPreferences::getStartupTips ()
+{
+  return static_cast<bool>(m_pCBStartupTips->GetValue());
+}
+
+bool
+DialogPreferences::getUseBackgroundTasks ()
+{
+  return static_cast<bool>(m_pCBUseBackgroundTasks->GetValue());
+}
+
 
 /////////////////////////////////////////////////////////////////////
 // CLASS DiaglogGetMinMax Implementation
@@ -297,11 +331,14 @@ DialogGetMinMax::DialogGetMinMax (wxWindow* pParent, const char* const pszTitle,
   
   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+  CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_MINMAX);
+  pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
   
   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+  pButtonOk->SetDefault();
   
   SetAutoLayout (true);
   SetSizer (pTopSizer);
@@ -353,7 +390,7 @@ DialogAutoScaleParameters::DialogAutoScaleParameters (wxWindow *pParent, double
   
   m_pRadioBoxCenter = new wxRadioBox (this, -1, _T("Center"), wxDefaultPosition, wxDefaultSize, 3, asTitle, 1, wxRA_SPECIFY_COLS);
   m_pRadioBoxCenter->SetSelection (0);
-  pTopSizer->Add (m_pRadioBoxCenter, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
+  pTopSizer->Add (m_pRadioBoxCenter, 0, wxALL | wxALIGN_CENTER);
   
   wxGridSizer *pGridSizer = new wxGridSizer (2);
   pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
@@ -367,11 +404,14 @@ DialogAutoScaleParameters::DialogAutoScaleParameters (wxWindow *pParent, double
   
   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+  CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_AUTOSCALE);
+  pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
   
   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+  pButtonOk->SetDefault();
   
   SetAutoLayout (true);
   SetSizer (pTopSizer);
@@ -416,6 +456,7 @@ DialogAutoScaleParameters::getAutoScaleFactor ()
 }
 
 
+
 /////////////////////////////////////////////////////////////////////
 // CLASS IDENTIFICATION
 //
@@ -460,11 +501,14 @@ DialogGetRasterParameters::DialogGetRasterParameters
   
   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
-  
+  CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RASTERIZE);
+  pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
+
   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+  pButtonOk->SetDefault();
   
   SetAutoLayout (true);
   SetSizer (pTopSizer);
@@ -531,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;
@@ -596,12 +641,18 @@ 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;
     m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
-    pText2Sizer->Add (new wxStaticText (this, -1, "Rotation Angle (PI units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+    pText2Sizer->Add (new wxStaticText (this, -1, "Rotation Angle (Fraction of circle)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
     pText2Sizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
   }
   pGridSizer->Add (pText2Sizer);
@@ -612,11 +663,14 @@ DialogGetProjectionParameters::DialogGetProjectionParameters
   
   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+  CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PROJECTIONS);
+  pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
   
   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+  pButtonOk->SetDefault();
   
   SetAutoLayout (true);
   SetSizer (pTopSizer);
@@ -670,7 +724,7 @@ DialogGetProjectionParameters::getRotAngle ()
     wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
     double dValue;
     if (strCtrl.ToDouble (&dValue))
-      return (dValue * PI);
+      return (dValue * TWOPI);
     else
       return (m_dDefaultRotAngle);
   } else {
@@ -678,7 +732,7 @@ DialogGetProjectionParameters::getRotAngle ()
           Scanner::GEOMETRY_PARALLEL)
       return (PI);
     else
-      return (2 * PI);
+      return (TWOPI);
   }
 }
 
@@ -693,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 ()
 {
@@ -760,10 +825,27 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow*
   m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
   pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
   
-  m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
-  m_pRadioBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
-  pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
-  
+  if (theApp->getAdvancedOptions()) {
+    m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
+    m_pRadioBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
+    pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
+  } else {
+#if HAVE_FFTW
+    static const char* aszFilterMethodTitle[] = {"Convolution", "FFT"};
+    static const char* aszFilterMethodName[] = {"convolution", "rfftw"};
+#else
+    static const char* aszFilterMethodTitle[] = {"Convolution", "Fourier"};
+    static const char* aszFilterMethodName[] = {"convolution", "fourier-table"};
+#endif
+      m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), 2, aszFilterMethodTitle, aszFilterMethodName);
+#if HAVE_FFTW
+      m_pRadioBoxFilterMethod->SetSelection (1);
+#else
+      m_pRadioBoxFilterMethod->SetSelection (0);
+#endif
+      pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
+  }
+
   if (theApp->getAdvancedOptions()) {
     m_pRadioBoxFilterGeneration = new StringValueAndTitleRadioBox (this, _T("Filter Generation"), ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray());
     m_pRadioBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
@@ -826,11 +908,14 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow*
   
   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+  CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RECONSTRUCTION);
+  pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
   
   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+  pButtonOk->SetDefault();
   
   SetAutoLayout (true);
   SetSizer (pTopSizer);
@@ -1026,12 +1111,15 @@ DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDe
   
   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+  CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_FILTER);
+  pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
   
   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
-  
+  pButtonOk->SetDefault();
+
   SetAutoLayout (true);
   SetSizer (pTopSizer);
   pTopSizer->Layout();
@@ -1145,12 +1233,15 @@ DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultF
   
   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+  CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_EXPORT);
+  pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
   
   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
-  
+  pButtonOk->SetDefault();
+
   SetAutoLayout (true);
   SetSizer (pTopSizer);
   pTopSizer->Fit (this);
@@ -1198,12 +1289,13 @@ DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle,
   
   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
   
   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
-  
+  pButtonOk->SetDefault();
+
   SetAutoLayout (true);
   SetSizer (pTopSizer);
   pTopSizer->Fit (this);
@@ -1254,47 +1346,52 @@ DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pPar
 
   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
   
-  pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
-  
+  pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5); 
   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
   
+  wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (1);
+  
+  m_pRadioBoxInterpolation = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Projections::getInterpCount(), Projections::getInterpTitleArray(), Projections::getInterpNameArray());
+  m_pRadioBoxInterpolation->SetSelection (iDefaultInterpolationID);
+  pGridSizer->Add (m_pRadioBoxInterpolation, 0, wxALL | wxALIGN_CENTER);
+  
+  wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
   std::ostringstream os;
   os << iDefaultXSize;
-  m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+  m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);  
+  pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
   std::ostringstream osYSize;
   osYSize << iDefaultYSize;
   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
-  
-  wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
-  
-  m_pRadioBoxInterpolation = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Projections::getInterpCount(), Projections::getInterpTitleArray(), Projections::getInterpNameArray());
-  m_pRadioBoxInterpolation->SetSelection (iDefaultInterpolationID);
-  pGridSizer->Add (m_pRadioBoxInterpolation, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
-  
-  pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
-  pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
-  pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
-  pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+  pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+  pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+#ifdef DEBUG
   if (iDefaultZeropad >= 0) {
     std::ostringstream osZeropad;
     osZeropad << iDefaultZeropad;
     m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
-    pGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
-    pGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
+    pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+    pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
   }
-  
-  pTopSizer->Add (pGridSizer, 1, wxALL, 3);
+#endif
+
+  pGridSizer->Add (pTextGridSizer, 0, wxALIGN_CENTER | wxALL);
+
+  pTopSizer->Add (pGridSizer, 1, wxALL | wxALIGN_CENTER, 3);
   
   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
   
   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
-  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+  CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_POLAR);
+  pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
   
   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
-  
+  pButtonOk->SetDefault();
   SetAutoLayout (true);
   SetSizer (pTopSizer);
   pTopSizer->Layout();
@@ -1333,12 +1430,16 @@ DialogGetConvertPolarParameters::getYSize ()
 unsigned int
 DialogGetConvertPolarParameters::getZeropad ()
 {
+#ifdef DEBUG
   wxString strCtrl = m_pTextCtrlZeropad->GetValue();
   unsigned long lValue;
   if (strCtrl.ToULong (&lValue))
     return lValue;
   else
     return (m_iDefaultZeropad);
+#else
+  return 0;
+#endif
 }
 
 const char*