** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: dialogs.cpp,v 1.39 2001/02/22 00:56:50 kevin Exp $
+** $Id: dialogs.cpp,v 1.48 2001/03/07 21:18:50 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
// 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];
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];
///////////////////////////////////////////////////////////////////////
DialogGetPhantom::DialogGetPhantom (wxWindow* pParent, int iDefaultPhantom)
-: wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+: wxDialog (pParent, -1, _T("Select Phantom"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
{
wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
/////////////////////////////////////////////////////////////////////
DialogPreferences::DialogPreferences (wxWindow* pParent, const char* const pszTitle,
- bool bAdvancedOptions, bool bAskDeleteNewDocs, bool bVerboseLogging, bool bStartupTips)
-: wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+ bool bAdvancedOptions, bool bAskDeleteNewDocs, bool bVerboseLogging, bool bStartupTips, bool bUseBackgroundTasks)
+: wxDialog (pParent, -1, _T(pszTitle), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
{
wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
m_pCBStartupTips->SetValue (bStartupTips);
pTopSizer->Add (m_pCBStartupTips, 0, wxALIGN_CENTER_VERTICAL);
+#ifdef HAVE_WXTHREADS
+ 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);
+#endif
+
pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
return static_cast<bool>(m_pCBStartupTips->GetValue());
}
+bool
+DialogPreferences::getUseBackgroundTasks ()
+{
+#ifdef HAVE_WXTHREADS
+ return static_cast<bool>(m_pCBUseBackgroundTasks->GetValue());
+#else
+ return false;
+#endif
+}
+
/////////////////////////////////////////////////////////////////////
// CLASS DiaglogGetMinMax Implementation
/////////////////////////////////////////////////////////////////////
DialogGetMinMax::DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin, double dDefaultMax)
-: wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+: wxDialog (pParent, -1, _T(pszTitle), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
{
wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
/////////////////////////////////////////////////////////////////////
DialogAutoScaleParameters::DialogAutoScaleParameters (wxWindow *pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor)
-: wxDialog (pParent, -1, "Auto Scale Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_dMean(mean), m_dMode(mode), m_dMedian(median), m_dStdDev(stddev)
+: wxDialog (pParent, -1, _T("Auto Scale Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_dMean(mean), m_dMode(mode), m_dMedian(median), m_dStdDev(stddev)
{
wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
DialogGetRasterParameters::DialogGetRasterParameters
(wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples, double dDefaultViewRatio)
-: wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+: wxDialog (pParent, -1, _T("Set Rasterization Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
{
wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
DialogGetProjectionParameters::DialogGetProjectionParameters
(wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples,
- double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultViewRatio,
- double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
-: wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+ double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultCenterDetectorLength,
+ double dDefaultViewRatio, double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
+: wxDialog (pParent, -1, _T("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;
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;
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 ()
{
int iDefaultYSize, int iDefaultFilterID, double dDefaultHammingParam,
int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad,
int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace)
-: wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+: wxDialog (pParent, -1, _T("Set Reconstruction Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
{
wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam, double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)
-: wxDialog (pParent, -1, "Set Filter Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+: wxDialog (pParent, -1, _T("Set Filter Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
{
wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
///////////////////////////////////////////////////////////////////////
DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultFormatID)
-: wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+: wxDialog (pParent, -1, _T("Select ExportParameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
{
wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
- m_pRadioBoxFormat = new StringValueAndTitleRadioBox (this, _T("Export Type"), ImageFile::getFormatCount(), ImageFile::getFormatTitleArray(), ImageFile::getFormatNameArray());
+ m_pRadioBoxFormat = new StringValueAndTitleRadioBox (this, _T("File Type"),
+ ImageFile::getExportFormatCount(), ImageFile::getExportFormatTitleArray(), ImageFile::getExportFormatNameArray());
m_pRadioBoxFormat->SetSelection (iDefaultFormatID);
- pTopSizer->Add (m_pRadioBoxFormat, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
+ pTopSizer->Add (m_pRadioBoxFormat, 0, wxALL | wxALIGN_CENTER);
pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
}
+///////////////////////////////////////////////////////////////////////
+// CLASS IMPLEMENTATION
+// DialogImportParameters
+///////////////////////////////////////////////////////////////////////
+
+DialogImportParameters::DialogImportParameters (wxWindow* pParent, int iDefaultFormatID)
+: wxDialog (pParent, -1, _T("Select Import Parameters"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+{
+ wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
+
+ pTopSizer->Add (new wxStaticText (this, -1, "Select Import Format"), 0, wxALIGN_CENTER | wxALL, 5);
+
+ pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
+
+ m_pRadioBoxFormat = new StringValueAndTitleRadioBox (this, _T("File Type"),
+ ImageFile::getImportFormatCount(), ImageFile::getImportFormatTitleArray(), ImageFile::getImportFormatNameArray());
+ m_pRadioBoxFormat->SetSelection (iDefaultFormatID);
+ pTopSizer->Add (m_pRadioBoxFormat, 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");
+ 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_IMPORT);
+ pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
+
+ pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+ pButtonOk->SetDefault();
+
+ SetAutoLayout (true);
+ SetSizer (pTopSizer);
+ pTopSizer->Fit (this);
+ pTopSizer->SetSizeHints (this);
+}
+
+const char*
+DialogImportParameters::getFormatName()
+{
+ return m_pRadioBoxFormat->getSelectionStringValue();
+}
+
+
/////////////////////////////////////////////////////////////////////
// CLASS DiaglogGetXYSize Implementation
/////////////////////////////////////////////////////////////////////
DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
-: wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+: wxDialog (pParent, -1, _T(pszTitle), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
{
m_iDefaultXSize = iDefaultXSize;
m_iDefaultYSize = iDefaultYSize;
DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle,
int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad)
-: wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+: wxDialog (pParent, -1, _T(pszTitle), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
{
m_iDefaultXSize = iDefaultXSize;
m_iDefaultYSize = iDefaultYSize;