r571: no message
[ctsim.git] / src / dialogs.cpp
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          dialogs.cpp
5 **   Purpose:       Dialog routines for CTSim program
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  July 2000
8 **
9 **  This is part of the CTSim program
10 **  Copyright (c) 1983-2001 Kevin Rosenberg
11 **
12 **  $Id: dialogs.cpp,v 1.40 2001/02/22 11:05:38 kevin Exp $
13 **
14 **  This program is free software; you can redistribute it and/or modify
15 **  it under the terms of the GNU General Public License (version 2) as
16 **  published by the Free Software Foundation.
17 **
18 **  This program is distributed in the hope that it will be useful,
19 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 **  GNU General Public License for more details.
22 **
23 **  You should have received a copy of the GNU General Public License
24 **  along with this program; if not, write to the Free Software
25 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 ******************************************************************************/
27
28 #ifdef __GNUG__
29 // #pragma implementation
30 #endif
31
32 #include "wx/wxprec.h"
33
34 #ifndef WX_PRECOMP
35 #include "wx/wx.h"
36 #endif
37
38 #if !wxUSE_DOC_VIEW_ARCHITECTURE
39 #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
40 #endif
41
42 #include "wx/statline.h"
43 #include "wx/sizer.h"
44 #include "dialogs.h"
45 #include "ctsim.h"
46 #include "ct.h"
47 #include "docs.h"
48 #include "views.h"
49 #include "imagefile.h"
50
51 #if defined(MSVC) || HAVE_SSTREAM
52 #include <sstream>
53 #else
54 #include <sstream_subst>
55 #endif
56
57
58 ///////////////////////////////////////////////////////////////////////
59 // CLASS IMPLEMENTATION
60 //    StringValueAndTitleListBox
61 ///////////////////////////////////////////////////////////////////////
62
63 StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[])
64 : wxListBox ()
65 {
66   wxString* psTitle = new wxString [nChoices];
67   for (int i = 0; i < nChoices; i++)
68     psTitle[i] = aszTitle[i];
69   
70   Create (pParent, -1, wxDefaultPosition, wxSize(-1,-1), nChoices, psTitle, wxLB_SINGLE | wxLB_NEEDED_SB);
71   
72   m_ppszValues = aszValue;
73   delete [] psTitle;
74 };
75
76 const char*
77 StringValueAndTitleListBox::getSelectionStringValue () const
78 {
79   return m_ppszValues[GetSelection()];
80 }
81
82 StringValueAndTitleRadioBox::StringValueAndTitleRadioBox (wxDialog* pParent, const wxString& strTitle, int nChoices, const char* aszTitle[], const char* aszValue[])
83 : wxRadioBox ()
84 {
85   wxString* psTitle = new wxString [nChoices];
86   for (int i = 0; i < nChoices; i++)
87     psTitle[i] = aszTitle[i];
88   
89   Create (pParent, -1, strTitle, wxDefaultPosition, wxDefaultSize, nChoices, psTitle, 1, wxRA_SPECIFY_COLS);
90   
91   m_ppszValues = aszValue;
92   delete [] psTitle;
93 };
94
95 const char*
96 StringValueAndTitleRadioBox::getSelectionStringValue () const
97 {
98   return m_ppszValues[GetSelection()];
99 }
100
101 ///////////////////////////////////////////////////////////////////////
102 // CLASS IMPLEMENTATION
103 //    DialogGetPhantom
104 ///////////////////////////////////////////////////////////////////////
105
106 DialogGetPhantom::DialogGetPhantom (wxWindow* pParent, int iDefaultPhantom)
107 : wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
108 {
109   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
110   
111   pTopSizer->Add (new wxStaticText (this, -1, "Select Phantom"), 0, wxCENTER | wxALL, 5);
112   
113   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
114   
115   m_pRadioBoxPhantom = new StringValueAndTitleRadioBox (this, _T("Phantom"), Phantom::getPhantomCount(), Phantom::getPhantomTitleArray(), Phantom::getPhantomNameArray());
116   m_pRadioBoxPhantom->SetSelection (iDefaultPhantom);
117   pTopSizer->Add (m_pRadioBoxPhantom, 0, wxALL | wxALIGN_CENTER);
118   
119   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
120   
121   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
122   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
123   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
124   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
125   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
126   CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PHANTOM);
127   pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
128
129   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
130   pButtonOk->SetDefault();
131   
132   SetAutoLayout (true);
133   SetSizer (pTopSizer);
134   pTopSizer->Fit (this);
135   pTopSizer->SetSizeHints (this);
136 }
137
138 const char*
139 DialogGetPhantom::getPhantom()
140 {
141   return m_pRadioBoxPhantom->getSelectionStringValue();
142 }
143
144
145 ///////////////////////////////////////////////////////////////////////
146 // CLASS IMPLEMENTATION
147 //    DialogGetComparisonImage
148 ///////////////////////////////////////////////////////////////////////
149
150 DialogGetComparisonImage::DialogGetComparisonImage (wxWindow* pParent, const char* const pszTitle, const std::vector<ImageFileDocument*>& rVecIF, bool bShowMakeDifference)
151 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_rVecIF(rVecIF)
152 {
153   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
154   
155   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxALL, 5);
156   
157   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
158   
159   int iNImages = m_rVecIF.size();
160   wxString* pstrImages = new wxString [iNImages];
161   for (int i = 0; i < iNImages; i++) {
162     ImageFileView* pView = dynamic_cast<ImageFileView*>(m_rVecIF[i]->GetFirstView());
163     if (pView)
164       pstrImages[i] = pView->getFrame()->GetTitle();
165   }
166
167   m_pListBoxImageChoices = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, iNImages, pstrImages, wxLB_SINGLE);
168   delete [] pstrImages;
169
170   m_pListBoxImageChoices->SetSelection (0);
171   pTopSizer->Add (m_pListBoxImageChoices, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
172   
173   if (bShowMakeDifference) {
174     m_pMakeDifferenceImage = new wxCheckBox (this, -1, "Make Difference Image");
175     m_pMakeDifferenceImage->SetValue (FALSE);
176     pTopSizer->Add (m_pMakeDifferenceImage, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
177   } else
178     m_pMakeDifferenceImage = NULL;
179
180   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
181   
182   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
183   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
184   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
185   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
186   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
187   CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_COMPARISON);
188   pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
189   
190   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
191   pButtonOk->SetDefault();
192   
193   SetAutoLayout (true);
194   SetSizer (pTopSizer);
195   pTopSizer->Fit (this);
196   pTopSizer->SetSizeHints (this);
197 }
198
199 ImageFileDocument*
200 DialogGetComparisonImage::getImageFileDocument()
201 {
202   return m_rVecIF[ m_pListBoxImageChoices->GetSelection() ];
203 }
204
205 bool
206 DialogGetComparisonImage::getMakeDifferenceImage()
207 {
208   if (m_pMakeDifferenceImage)
209     return m_pMakeDifferenceImage->GetValue();
210   else
211     return false;
212 }
213
214
215 /////////////////////////////////////////////////////////////////////
216 // CLASS DiaglogPreferences Implementation
217 /////////////////////////////////////////////////////////////////////
218
219 DialogPreferences::DialogPreferences (wxWindow* pParent, const char* const pszTitle, 
220                    bool bAdvancedOptions, bool bAskDeleteNewDocs, bool bVerboseLogging, bool bStartupTips)
221 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
222 {
223   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
224   
225   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
226   
227   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
228
229   m_pCBAdvancedOptions = new wxCheckBox (this, -1, "Advanced Options", wxDefaultPosition, wxSize(250, 25), 0);
230   m_pCBAdvancedOptions->SetValue (bAdvancedOptions);
231   pTopSizer->Add (m_pCBAdvancedOptions, 0, wxALIGN_CENTER_VERTICAL);
232
233   m_pCBAskDeleteNewDocs = new wxCheckBox (this, -1, "Ask \"Save New Documents\" Before Closing", wxDefaultPosition, wxSize(250, 25), 0);
234   m_pCBAskDeleteNewDocs->SetValue (bAskDeleteNewDocs);
235   pTopSizer->Add (m_pCBAskDeleteNewDocs, 0, wxALIGN_CENTER_VERTICAL);
236
237   m_pCBVerboseLogging = new wxCheckBox (this, -1, "Verbose Logging", wxDefaultPosition, wxSize(250, 25), 0);
238   m_pCBVerboseLogging->SetValue (bVerboseLogging);
239   pTopSizer->Add (m_pCBVerboseLogging, 0, wxALIGN_CENTER_VERTICAL);
240
241   m_pCBStartupTips = new wxCheckBox (this, -1, "Show Tips at Start", wxDefaultPosition, wxSize(250, 25), 0);
242   m_pCBStartupTips->SetValue (bStartupTips);
243   pTopSizer->Add (m_pCBStartupTips, 0, wxALIGN_CENTER_VERTICAL);
244
245   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
246   
247   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
248   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
249   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
250   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
251   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
252   CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PREFERENCES);
253   pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
254   
255   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
256   pButtonOk->SetDefault();
257   
258   SetAutoLayout (true);
259   SetSizer (pTopSizer);
260   pTopSizer->Fit (this);
261   pTopSizer->SetSizeHints (this);
262 }
263
264 DialogPreferences::~DialogPreferences ()
265 {
266 }
267
268 bool
269 DialogPreferences::getAdvancedOptions ()
270 {
271   return static_cast<bool>(m_pCBAdvancedOptions->GetValue());
272 }
273
274 bool
275 DialogPreferences::getAskDeleteNewDocs ()
276 {
277   return static_cast<bool>(m_pCBAskDeleteNewDocs->GetValue());
278 }
279
280 bool
281 DialogPreferences::getVerboseLogging ()
282 {
283   return static_cast<bool>(m_pCBVerboseLogging->GetValue());
284 }
285
286 bool
287 DialogPreferences::getStartupTips ()
288 {
289   return static_cast<bool>(m_pCBStartupTips->GetValue());
290 }
291
292
293 /////////////////////////////////////////////////////////////////////
294 // CLASS DiaglogGetMinMax Implementation
295 /////////////////////////////////////////////////////////////////////
296
297 DialogGetMinMax::DialogGetMinMax (wxWindow* pParent, const char* const pszTitle, double dDefaultMin, double dDefaultMax)
298 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
299 {
300   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
301   
302   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
303   
304   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
305   
306   std::ostringstream os;
307   os << dDefaultMin;
308   m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
309   std::ostringstream osMax;
310   osMax << dDefaultMax;
311   m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
312   
313   wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
314   pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
315   pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
316   pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
317   pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
318   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
319   
320   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
321   
322   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
323   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
324   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
325   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
326   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
327   CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_MINMAX);
328   pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
329   
330   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
331   pButtonOk->SetDefault();
332   
333   SetAutoLayout (true);
334   SetSizer (pTopSizer);
335   pTopSizer->Fit (this);
336   pTopSizer->SetSizeHints (this);
337 }
338
339 DialogGetMinMax::~DialogGetMinMax ()
340 {
341 }
342
343 double
344 DialogGetMinMax::getMinimum ()
345 {
346   wxString strCtrl = m_pTextCtrlMin->GetValue();
347   double dValue;
348   if (strCtrl.ToDouble (&dValue))
349     return dValue;
350   else
351     return (m_dDefaultMin);
352 }
353
354 double
355 DialogGetMinMax::getMaximum ()
356 {
357   wxString strCtrl = m_pTextCtrlMax->GetValue();
358   double dValue;
359   if (strCtrl.ToDouble (&dValue))
360     return dValue;
361   else
362     return (m_dDefaultMax);
363 }
364
365
366 /////////////////////////////////////////////////////////////////////
367 // CLASS DialogAutoScaleParameters IMPLEMENTATION
368 /////////////////////////////////////////////////////////////////////
369
370 DialogAutoScaleParameters::DialogAutoScaleParameters (wxWindow *pParent, double mean, double mode, double median, double stddev, double dDefaultScaleFactor)
371 : wxDialog (pParent, -1, "Auto Scale Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_dMean(mean), m_dMode(mode), m_dMedian(median), m_dStdDev(stddev)
372 {
373   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
374   
375   pTopSizer->Add (new wxStaticText (this, -1, "Auto Scale Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
376   
377   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
378   
379   wxString asTitle[] = {"Median", "Mode", "Mean"};
380   
381   m_pRadioBoxCenter = new wxRadioBox (this, -1, _T("Center"), wxDefaultPosition, wxDefaultSize, 3, asTitle, 1, wxRA_SPECIFY_COLS);
382   m_pRadioBoxCenter->SetSelection (0);
383   pTopSizer->Add (m_pRadioBoxCenter, 0, wxALL | wxALIGN_CENTER);
384   
385   wxGridSizer *pGridSizer = new wxGridSizer (2);
386   pGridSizer->Add (new wxStaticText (this, -1, "Standard Deviation Factor"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
387   std::ostringstream osDefaultFactor;
388   osDefaultFactor << dDefaultScaleFactor;
389   m_pTextCtrlStdDevFactor = new wxTextCtrl (this, -1, osDefaultFactor.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
390   pGridSizer->Add (m_pTextCtrlStdDevFactor, 0, wxALIGN_CENTER_VERTICAL);
391   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
392   
393   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
394   
395   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
396   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
397   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
398   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
399   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
400   CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_AUTOSCALE);
401   pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
402   
403   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
404   pButtonOk->SetDefault();
405   
406   SetAutoLayout (true);
407   SetSizer (pTopSizer);
408   pTopSizer->Fit (this);
409   pTopSizer->SetSizeHints (this);
410 }
411
412 bool
413 DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
414 {
415   int iCenter = m_pRadioBoxCenter->GetSelection();
416   double dCenter = m_dMedian;
417   if (iCenter == 1)
418     dCenter = m_dMode;
419   else if (iCenter == 2)
420     dCenter = m_dMode;
421   
422   wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
423   double dValue;
424   if (! sStddevFactor.ToDouble (&dValue)) {
425     *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
426     return false;
427   }
428   double dHalfWidth = dValue * m_dStdDev / 2;
429   *pMin = dCenter - dHalfWidth;
430   *pMax = dCenter + dHalfWidth;
431   *theApp->getLog() << "Setting minimum to " << *pMin << " and maximum to " << *pMax << "\n";
432   
433   return true;
434 }
435
436 double
437 DialogAutoScaleParameters::getAutoScaleFactor ()
438 {
439   wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
440   double dValue = 1.;
441   if (! sStddevFactor.ToDouble (&dValue)) {
442     *theApp->getLog() << "Error: Non-numeric Standard Deviation Factor of " << sStddevFactor << "\n";
443   }
444   
445   return dValue;
446 }
447
448
449
450 /////////////////////////////////////////////////////////////////////
451 // CLASS IDENTIFICATION
452 //
453 // DialogGetRasterParameters
454 /////////////////////////////////////////////////////////////////////
455
456 DialogGetRasterParameters::DialogGetRasterParameters 
457    (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultNSamples, double dDefaultViewRatio)
458 : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
459 {
460   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
461   
462   pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
463   
464   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
465     
466   wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
467   std::ostringstream os;
468   os << iDefaultXSize;
469   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
470   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
471   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
472   std::ostringstream osYSize;
473   osYSize << iDefaultYSize;
474   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
475   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
476   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
477   std::ostringstream osViewRatio;
478   osViewRatio << dDefaultViewRatio;
479   m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
480   pGridSizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
481   pGridSizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
482   std::ostringstream osNSamples;
483   osNSamples << iDefaultNSamples;
484   m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
485   pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
486   pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
487
488   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
489   
490   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
491   
492   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
493   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
494   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
495   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
496   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
497   CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RASTERIZE);
498   pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
499
500   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
501   pButtonOk->SetDefault();
502   
503   SetAutoLayout (true);
504   SetSizer (pTopSizer);
505   pTopSizer->Fit (this);
506   pTopSizer->SetSizeHints (this);
507 }
508
509 DialogGetRasterParameters::~DialogGetRasterParameters ()
510 {
511 }
512
513
514 unsigned int
515 DialogGetRasterParameters::getXSize ()
516 {
517   wxString strCtrl = m_pTextCtrlXSize->GetValue();
518   unsigned long lValue;
519   if (strCtrl.ToULong (&lValue))
520     return lValue;
521   else
522     return (m_iDefaultXSize);
523 }
524
525 unsigned int
526 DialogGetRasterParameters::getYSize ()
527 {
528   wxString strCtrl = m_pTextCtrlYSize->GetValue();
529   unsigned long lValue;
530   if (strCtrl.ToULong (&lValue))
531     return lValue;
532   else
533     return (m_iDefaultYSize);
534 }
535
536 unsigned int
537 DialogGetRasterParameters::getNSamples ()
538 {
539   wxString strCtrl = m_pTextCtrlNSamples->GetValue();
540   unsigned long lValue;
541   if (strCtrl.ToULong (&lValue))
542     return lValue;
543   else
544     return (m_iDefaultNSamples);
545 }
546
547 double
548 DialogGetRasterParameters::getViewRatio ()
549 {
550   wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
551   double dValue;
552   if (strCtrl.ToDouble (&dValue))
553     return dValue;
554   else
555     return (m_dDefaultViewRatio);
556 }
557
558
559 /////////////////////////////////////////////////////////////////////
560 // CLASS IDENTIFICATION
561 //
562 // DialogGetProjectionParameters
563 /////////////////////////////////////////////////////////////////////
564
565
566 DialogGetProjectionParameters::DialogGetProjectionParameters 
567    (wxWindow* pParent, int iDefaultNDet, int iDefaultNView, int iDefaultNSamples, 
568     double dDefaultRotAngle, double dDefaultFocalLength, double dDefaultViewRatio,
569     double dDefaultScanRatio, int iDefaultGeometry, int iDefaultTrace)
570 : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
571 {
572   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
573   
574   m_dDefaultRotAngle = dDefaultRotAngle;
575   m_dDefaultFocalLength = dDefaultFocalLength;
576   m_dDefaultViewRatio = dDefaultViewRatio;
577   m_dDefaultScanRatio = dDefaultScanRatio;
578   m_iDefaultNSamples = iDefaultNSamples;
579   m_iDefaultNView = iDefaultNView;
580   m_iDefaultNDet = iDefaultNDet;
581   m_iDefaultTrace = iDefaultTrace;
582   m_iDefaultGeometry = iDefaultGeometry;
583   
584   pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
585   
586   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
587     
588   wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
589   m_pRadioBoxGeometry = new StringValueAndTitleRadioBox (this, _T("Geometry"), Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray());
590   m_pRadioBoxGeometry->SetSelection (iDefaultGeometry);
591   
592   pGridSizer->Add (m_pRadioBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
593   
594   m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), Trace::getTraceCount(), Trace::getTraceTitleArray(), Trace::getTraceNameArray());
595   m_pRadioBoxTrace->SetSelection (iDefaultTrace);
596   pGridSizer->Add (m_pRadioBoxTrace, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
597
598           wxFlexGridSizer* pText1Sizer = new wxFlexGridSizer(2);
599   std::ostringstream os;
600   os << iDefaultNDet;
601   m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
602   pText1Sizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
603   pText1Sizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
604   std::ostringstream osNView;
605   osNView << iDefaultNView;
606   m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
607   pText1Sizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
608   pText1Sizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
609   std::ostringstream osNSamples;
610   osNSamples << iDefaultNSamples;
611   m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
612   pText1Sizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
613   pText1Sizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
614
615   pGridSizer->Add (pText1Sizer);
616
617   wxFlexGridSizer* pText2Sizer = new wxFlexGridSizer(2);
618   std::ostringstream osViewRatio;
619   osViewRatio << dDefaultViewRatio;
620   m_pTextCtrlViewRatio = new wxTextCtrl (this, -1, osViewRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
621   pText2Sizer->Add (new wxStaticText (this, -1, "View Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
622   pText2Sizer->Add (m_pTextCtrlViewRatio, 0, wxALIGN_CENTER_VERTICAL);
623   std::ostringstream osScanRatio;
624   osScanRatio << dDefaultScanRatio;
625   m_pTextCtrlScanRatio = new wxTextCtrl (this, -1, osScanRatio.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
626   pText2Sizer->Add (new wxStaticText (this, -1, "Scan Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
627   pText2Sizer->Add (m_pTextCtrlScanRatio, 0, wxALIGN_CENTER_VERTICAL);
628   std::ostringstream osFocalLength;
629   osFocalLength << dDefaultFocalLength;
630   m_pTextCtrlFocalLength = new wxTextCtrl (this, -1, osFocalLength.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
631   pText2Sizer->Add (new wxStaticText (this, -1, "Focal Length Ratio"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
632   pText2Sizer->Add (m_pTextCtrlFocalLength, 0, wxALIGN_CENTER_VERTICAL);
633   
634   if (theApp->getAdvancedOptions()) {
635     std::ostringstream osRotAngle;
636     osRotAngle << dDefaultRotAngle;
637     m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
638     pText2Sizer->Add (new wxStaticText (this, -1, "Rotation Angle (Fraction of circle)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
639     pText2Sizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
640   }
641   pGridSizer->Add (pText2Sizer);
642
643   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
644   
645   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
646   
647   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
648   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
649   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
650   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
651   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
652   CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_PROJECTIONS);
653   pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
654   
655   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
656   pButtonOk->SetDefault();
657   
658   SetAutoLayout (true);
659   SetSizer (pTopSizer);
660   pTopSizer->Fit (this);
661   pTopSizer->SetSizeHints (this);
662 }
663
664 DialogGetProjectionParameters::~DialogGetProjectionParameters ()
665 {
666 }
667
668
669 unsigned int
670 DialogGetProjectionParameters::getNDet ()
671 {
672   wxString strCtrl = m_pTextCtrlNDet->GetValue();
673   unsigned long lValue;
674   if (strCtrl.ToULong (&lValue))
675     return lValue;
676   else
677     return (m_iDefaultNDet);
678 }
679
680 unsigned int
681 DialogGetProjectionParameters::getNView ()
682 {
683   wxString strCtrl = m_pTextCtrlNView->GetValue();
684   unsigned long lValue;
685   if (strCtrl.ToULong (&lValue))
686     return lValue;
687   else
688     return (m_iDefaultNView);
689 }
690
691
692 unsigned int
693 DialogGetProjectionParameters::getNSamples ()
694 {
695   wxString strCtrl = m_pTextCtrlNSamples->GetValue();
696   unsigned long lValue;
697   if (strCtrl.ToULong (&lValue))
698     return lValue;
699   else
700     return (m_iDefaultNSamples);
701 }
702
703 double
704 DialogGetProjectionParameters::getRotAngle ()
705 {
706   if (theApp->getAdvancedOptions()) {
707     wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
708     double dValue;
709     if (strCtrl.ToDouble (&dValue))
710       return (dValue * TWOPI);
711     else
712       return (m_dDefaultRotAngle);
713   } else {
714     if (Scanner::convertGeometryNameToID (m_pRadioBoxGeometry->getSelectionStringValue()) == 
715           Scanner::GEOMETRY_PARALLEL)
716       return (PI);
717     else
718       return (TWOPI);
719   }
720 }
721
722 double
723 DialogGetProjectionParameters::getFocalLengthRatio ()
724 {
725   wxString strCtrl = m_pTextCtrlFocalLength->GetValue();
726   double dValue;
727   if (strCtrl.ToDouble (&dValue))
728     return (dValue);
729   else
730     return (m_dDefaultFocalLength);
731 }
732
733 double
734 DialogGetProjectionParameters::getViewRatio ()
735 {
736   wxString strCtrl = m_pTextCtrlViewRatio->GetValue();
737   double dValue;
738   if (strCtrl.ToDouble (&dValue))
739     return (dValue);
740   else
741     return (m_dDefaultViewRatio);
742 }
743
744 double
745 DialogGetProjectionParameters::getScanRatio ()
746 {
747   wxString strCtrl = m_pTextCtrlScanRatio->GetValue();
748   double dValue;
749   if (strCtrl.ToDouble (&dValue))
750     return (dValue);
751   else
752     return (m_dDefaultScanRatio);
753 }
754
755 const char*
756 DialogGetProjectionParameters::getGeometry ()
757 {
758   return m_pRadioBoxGeometry->getSelectionStringValue();
759 }
760
761 int
762 DialogGetProjectionParameters::getTrace ()
763 {
764   return Trace::convertTraceNameToID(m_pRadioBoxTrace->getSelectionStringValue());
765 }
766
767
768
769 /////////////////////////////////////////////////////////////////////
770 // CLASS IDENTIFICATION
771 //
772 // DialogGetReconstructionParameters
773 /////////////////////////////////////////////////////////////////////
774
775
776 DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxWindow* pParent, int iDefaultXSize, 
777                      int iDefaultYSize, int iDefaultFilterID, double dDefaultHammingParam,  
778                      int iDefaultFilterMethodID, int iDefaultFilterGenerationID, int iDefaultZeropad, 
779                      int iDefaultInterpID, int iDefaultInterpParam, int iDefaultBackprojectID, int iTrace)
780 : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
781 {
782   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
783   
784   pTopSizer->Add (new wxStaticText (this, -1, "Set Reconstruction Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
785   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
786   
787   wxFlexGridSizer* pGridSizer = NULL;
788   if (theApp->getAdvancedOptions())
789     pGridSizer = new wxFlexGridSizer (4);
790   else
791     pGridSizer = new wxFlexGridSizer (3);
792
793   if (theApp->getAdvancedOptions())
794     m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
795   else
796     m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getReconstructFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
797   m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
798   pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
799   
800   if (theApp->getAdvancedOptions()) {
801     m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), ProcessSignal::getFilterMethodCount(), ProcessSignal::getFilterMethodTitleArray(), ProcessSignal::getFilterMethodNameArray());
802     m_pRadioBoxFilterMethod->SetSelection (iDefaultFilterMethodID);
803     pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
804   } else {
805 #if HAVE_FFTW
806     static const char* aszFilterMethodTitle[] = {"Convolution", "FFT"};
807     static const char* aszFilterMethodName[] = {"convolution", "rfftw"};
808 #else
809     static const char* aszFilterMethodTitle[] = {"Convolution", "Fourier"};
810     static const char* aszFilterMethodName[] = {"convolution", "fourier-table"};
811 #endif
812       m_pRadioBoxFilterMethod = new StringValueAndTitleRadioBox (this, _T("Filter Method"), 2, aszFilterMethodTitle, aszFilterMethodName);
813 #if HAVE_FFTW
814       m_pRadioBoxFilterMethod->SetSelection (1);
815 #else
816       m_pRadioBoxFilterMethod->SetSelection (0);
817 #endif
818       pGridSizer->Add (m_pRadioBoxFilterMethod, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
819   }
820
821   if (theApp->getAdvancedOptions()) {
822     m_pRadioBoxFilterGeneration = new StringValueAndTitleRadioBox (this, _T("Filter Generation"), ProcessSignal::getFilterGenerationCount(), ProcessSignal::getFilterGenerationTitleArray(), ProcessSignal::getFilterGenerationNameArray());
823     m_pRadioBoxFilterGeneration->SetSelection (iDefaultFilterGenerationID);
824     pGridSizer->Add (m_pRadioBoxFilterGeneration, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
825   
826     m_pRadioBoxBackproject = new StringValueAndTitleRadioBox (this, _T("Backprojection"), Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray());
827     m_pRadioBoxBackproject->SetSelection (iDefaultBackprojectID);
828     pGridSizer->Add (m_pRadioBoxBackproject, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
829   }
830
831   m_pRadioBoxInterp = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray());
832   m_pRadioBoxInterp->SetSelection (iDefaultInterpID);
833   pGridSizer->Add (m_pRadioBoxInterp, 0, wxALL | wxALIGN_RIGHT | wxEXPAND);
834   
835   static const char* aszTraceTitle[] = {"None", "Full"};
836   static const char* aszTraceName[] = {"none", "full"};
837   m_pRadioBoxTrace = new StringValueAndTitleRadioBox (this, _T("Trace Level"), 2, aszTraceTitle, aszTraceName);
838   iTrace = clamp(iTrace, 0, 1);
839   m_pRadioBoxTrace->SetSelection (iTrace);
840   pGridSizer->Add (m_pRadioBoxTrace);
841
842   wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
843   std::ostringstream os;
844   os << iDefaultXSize;
845   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
846   pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
847   pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
848   std::ostringstream osYSize;
849   osYSize << iDefaultYSize;
850   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
851   pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
852   pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
853
854   std::ostringstream osHammingParam;
855   osHammingParam << dDefaultHammingParam;
856   m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osHammingParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
857   pTextGridSizer->Add (new wxStaticText (this, -1, "Hamming Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
858   pTextGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
859
860   if (theApp->getAdvancedOptions()) {
861     std::ostringstream osZeropad;
862     osZeropad << iDefaultZeropad;
863     m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
864     pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
865     pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
866   }
867   pGridSizer->Add (pTextGridSizer);
868
869 #if HAVE_FREQ_PREINTERP
870   std::ostringstream osInterpParam;
871   osInterpParam << iDefaultInterpParam;
872   m_pTextCtrlInterpParam = new wxTextCtrl (this, -1, osInterpParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
873   pGridSizer->Add (new wxStaticText (this, -1, "Interpolation Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
874   pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
875 #endif  
876   
877   pTopSizer->Add (pGridSizer, 1, wxALL, 3);
878   
879   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
880   
881   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
882   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
883   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
884   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
885   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
886   CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_RECONSTRUCTION);
887   pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
888   
889   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
890   pButtonOk->SetDefault();
891   
892   SetAutoLayout (true);
893   SetSizer (pTopSizer);
894   pTopSizer->Layout();
895   pTopSizer->Fit (this);
896   pTopSizer->SetSizeHints (this);
897 }
898
899 DialogGetReconstructionParameters::~DialogGetReconstructionParameters ()
900 {
901 }
902
903
904 unsigned int
905 DialogGetReconstructionParameters::getXSize ()
906 {
907   wxString strCtrl = m_pTextCtrlXSize->GetValue();
908   unsigned long lValue;
909   if (strCtrl.ToULong (&lValue))
910     return lValue;
911   else
912     return (m_iDefaultXSize);
913 }
914
915 unsigned int
916 DialogGetReconstructionParameters::getYSize ()
917 {
918   wxString strCtrl = m_pTextCtrlYSize->GetValue();
919   unsigned long lValue;
920   if (strCtrl.ToULong (&lValue))
921     return lValue;
922   else
923     return (m_iDefaultYSize);
924 }
925
926 unsigned int
927 DialogGetReconstructionParameters::getZeropad ()
928 {
929   if (theApp->getAdvancedOptions()) {
930     wxString strCtrl = m_pTextCtrlZeropad->GetValue();
931     unsigned long lValue;
932     if (strCtrl.ToULong (&lValue))
933       return lValue;
934     else
935       return (m_iDefaultZeropad);
936   } else
937     return 1;
938 }
939
940
941 unsigned int
942 DialogGetReconstructionParameters::getInterpParam ()
943 {
944 #if HAVE_FREQ_PREINTERP
945   wxString strCtrl = m_pTextCtrlInterpParam->GetValue();
946   unsigned long lValue;
947   if (strCtrl.ToULong (&lValue))
948     return lValue;
949   else
950     return (m_iDefaultInterpParam);
951 #else
952   return 1;
953 #endif
954 }
955
956 double
957 DialogGetReconstructionParameters::getFilterParam ()
958 {
959   wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
960   double dValue;
961   if (strCtrl.ToDouble (&dValue))
962     return (dValue);
963   else
964     return (m_dDefaultFilterParam);
965 }
966
967 const char*
968 DialogGetReconstructionParameters::getFilterName ()
969 {
970   return m_pRadioBoxFilter->getSelectionStringValue();
971 }
972
973 const char*
974 DialogGetReconstructionParameters::getFilterMethodName ()
975 {
976   return m_pRadioBoxFilterMethod->getSelectionStringValue();
977 }
978
979 const char*
980 DialogGetReconstructionParameters::getInterpName ()
981 {
982   return m_pRadioBoxInterp->getSelectionStringValue();
983 }
984
985 int
986 DialogGetReconstructionParameters::getTrace ()
987 {
988   int iTrace = 0;
989   if (strcmp("full", m_pRadioBoxTrace->getSelectionStringValue()) == 0)
990     iTrace = Trace::TRACE_PLOT;
991   return iTrace;
992 }
993
994 const char*
995 DialogGetReconstructionParameters::getBackprojectName ()
996 {
997   if (theApp->getAdvancedOptions()) {
998     return m_pRadioBoxBackproject->getSelectionStringValue();
999   } else
1000     return "idiff";
1001 }
1002
1003 const char*
1004 DialogGetReconstructionParameters::getFilterGenerationName ()
1005 {
1006   if (theApp->getAdvancedOptions()) {
1007     return m_pRadioBoxFilterGeneration->getSelectionStringValue();
1008   } else {
1009     if (ProcessSignal::convertFilterMethodNameToID(m_pRadioBoxFilterMethod->getSelectionStringValue())
1010         == ProcessSignal::FILTER_METHOD_CONVOLUTION)
1011       return "direct";
1012     else
1013       return "inverse-fourier";
1014   }
1015 }
1016
1017
1018 /////////////////////////////////////////////////////////////////////
1019 // CLASS IDENTIFICATION
1020 //
1021 // DialogGetFilterParameters
1022 /////////////////////////////////////////////////////////////////////
1023
1024
1025
1026 DialogGetFilterParameters::DialogGetFilterParameters (wxWindow* pParent, int iDefaultXSize, int iDefaultYSize, int iDefaultFilterID, double dDefaultFilterParam,  double dDefaultBandwidth, int iDefaultDomainID, double dDefaultInputScale, double dDefaultOutputScale)
1027 : wxDialog (pParent, -1, "Set Filter Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1028 {
1029   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1030   
1031   pTopSizer->Add (new wxStaticText (this, -1, "Set Filter Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5); 
1032   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1033   
1034   wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (2);
1035
1036   m_pRadioBoxFilter = new StringValueAndTitleRadioBox (this, _T("Filter"), SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray());
1037   m_pRadioBoxFilter->SetSelection (iDefaultFilterID);
1038   pGridSizer->Add (m_pRadioBoxFilter, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1039   
1040   m_pRadioBoxDomain = new StringValueAndTitleRadioBox (this, _T("Domain"), SignalFilter::getDomainCount(), SignalFilter::getDomainTitleArray(), SignalFilter::getDomainNameArray());
1041   m_pRadioBoxDomain->SetSelection (iDefaultDomainID);
1042   pGridSizer->Add (m_pRadioBoxDomain, 0, wxALL | wxALIGN_LEFT | wxEXPAND);
1043   
1044   std::ostringstream os;
1045   os << iDefaultXSize;
1046   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1047   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1048   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1049
1050   std::ostringstream osYSize;
1051   osYSize << iDefaultYSize;
1052   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1053   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1054   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1055
1056   std::ostringstream osFilterParam;
1057   osFilterParam << dDefaultFilterParam;
1058   m_pTextCtrlFilterParam = new wxTextCtrl (this, -1, osFilterParam.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1059   pGridSizer->Add (new wxStaticText (this, -1, "Filter Parameter"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1060   pGridSizer->Add (m_pTextCtrlFilterParam, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1061
1062   std::ostringstream osBandwidth;
1063   osBandwidth << dDefaultBandwidth;
1064   m_pTextCtrlBandwidth = new wxTextCtrl (this, -1, osBandwidth.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1065   pGridSizer->Add (new wxStaticText (this, -1, "Bandwidth"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1066   pGridSizer->Add (m_pTextCtrlBandwidth, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1067
1068   std::ostringstream osInputScale;
1069   osInputScale << dDefaultInputScale;
1070   m_pTextCtrlInputScale = new wxTextCtrl (this, -1, osInputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1071   pGridSizer->Add (new wxStaticText (this, -1, "Axis (input) Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1072   pGridSizer->Add (m_pTextCtrlInputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1073
1074   std::ostringstream osOutputScale;
1075   osOutputScale << dDefaultOutputScale;
1076   m_pTextCtrlOutputScale = new wxTextCtrl (this, -1, osOutputScale.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1077   pGridSizer->Add (new wxStaticText (this, -1, "Filter Output Scale"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1078   pGridSizer->Add (m_pTextCtrlOutputScale, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1079   
1080   pTopSizer->Add (pGridSizer, 1, wxALL, 3);
1081   
1082   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1083   
1084   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1085   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1086   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1087   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1088   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1089   CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_FILTER);
1090   pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1091   
1092   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1093   pButtonOk->SetDefault();
1094
1095   SetAutoLayout (true);
1096   SetSizer (pTopSizer);
1097   pTopSizer->Layout();
1098   pTopSizer->Fit (this);
1099   pTopSizer->SetSizeHints (this);
1100 }
1101
1102 DialogGetFilterParameters::~DialogGetFilterParameters ()
1103 {
1104 }
1105
1106
1107 unsigned int
1108 DialogGetFilterParameters::getXSize ()
1109 {
1110   wxString strCtrl = m_pTextCtrlXSize->GetValue();
1111   unsigned long lValue;
1112   if (strCtrl.ToULong (&lValue))
1113     return lValue;
1114   else
1115     return (m_iDefaultXSize);
1116 }
1117
1118 unsigned int
1119 DialogGetFilterParameters::getYSize ()
1120 {
1121   wxString strCtrl = m_pTextCtrlYSize->GetValue();
1122   unsigned long lValue;
1123   if (strCtrl.ToULong (&lValue))
1124     return lValue;
1125   else
1126     return (m_iDefaultYSize);
1127 }
1128
1129 double
1130 DialogGetFilterParameters::getBandwidth ()
1131 {
1132   wxString strCtrl = m_pTextCtrlBandwidth->GetValue();
1133   double dValue;
1134   if (strCtrl.ToDouble (&dValue))
1135     return dValue;
1136   else
1137     return (m_dDefaultBandwidth);
1138 }
1139
1140 double
1141 DialogGetFilterParameters::getFilterParam ()
1142 {
1143   wxString strCtrl = m_pTextCtrlFilterParam->GetValue();
1144   double dValue;
1145   if (strCtrl.ToDouble (&dValue))
1146     return (dValue);
1147   else
1148     return (m_dDefaultFilterParam);
1149 }
1150
1151 double
1152 DialogGetFilterParameters::getInputScale ()
1153 {
1154   wxString strCtrl = m_pTextCtrlInputScale->GetValue();
1155   double dValue;
1156   if (strCtrl.ToDouble (&dValue))
1157     return dValue;
1158   else
1159     return (m_dDefaultInputScale);
1160 }
1161
1162 double
1163 DialogGetFilterParameters::getOutputScale ()
1164 {
1165   wxString strCtrl = m_pTextCtrlOutputScale->GetValue();
1166   double dValue;
1167   if (strCtrl.ToDouble (&dValue))
1168     return dValue;
1169   else
1170     return (m_dDefaultOutputScale);
1171 }
1172
1173 const char*
1174 DialogGetFilterParameters::getFilterName ()
1175 {
1176   return m_pRadioBoxFilter->getSelectionStringValue();
1177 }
1178
1179 const char*
1180 DialogGetFilterParameters::getDomainName ()
1181 {
1182   return m_pRadioBoxDomain->getSelectionStringValue();
1183 }
1184
1185
1186 ///////////////////////////////////////////////////////////////////////
1187 // CLASS IMPLEMENTATION
1188 //    DialogExportParameters
1189 ///////////////////////////////////////////////////////////////////////
1190
1191 DialogExportParameters::DialogExportParameters (wxWindow* pParent, int iDefaultFormatID)
1192 : wxDialog (pParent, -1, "Select ExportParameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1193 {
1194   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1195   
1196   pTopSizer->Add (new wxStaticText (this, -1, "Select Export Format"), 0, wxALIGN_CENTER | wxALL, 5);
1197   
1198   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);
1199   
1200   m_pRadioBoxFormat = new StringValueAndTitleRadioBox (this, _T("Export Type"), ImageFile::getFormatCount(), ImageFile::getFormatTitleArray(), ImageFile::getFormatNameArray());
1201   m_pRadioBoxFormat->SetSelection (iDefaultFormatID);
1202   pTopSizer->Add (m_pRadioBoxFormat, 0, wxALL | wxALIGN_CENTER | wxEXPAND);
1203   
1204   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1205   
1206   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1207   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1208   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1209   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1210   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1211   CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_EXPORT);
1212   pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1213   
1214   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1215   pButtonOk->SetDefault();
1216
1217   SetAutoLayout (true);
1218   SetSizer (pTopSizer);
1219   pTopSizer->Fit (this);
1220   pTopSizer->SetSizeHints (this);
1221 }
1222
1223 const char*
1224 DialogExportParameters::getFormatName()
1225 {
1226   return m_pRadioBoxFormat->getSelectionStringValue();
1227 }
1228
1229
1230 /////////////////////////////////////////////////////////////////////
1231 // CLASS DiaglogGetXYSize Implementation
1232 /////////////////////////////////////////////////////////////////////
1233
1234 DialogGetXYSize::DialogGetXYSize (wxWindow* pParent, const char* const pszTitle, int iDefaultXSize, int iDefaultYSize)
1235 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1236 {
1237   m_iDefaultXSize = iDefaultXSize;
1238   m_iDefaultYSize = iDefaultYSize;
1239
1240   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1241   
1242   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
1243   
1244   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1245   
1246   std::ostringstream os;
1247   os << iDefaultXSize;
1248   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1249   std::ostringstream osYSize;
1250   osYSize << iDefaultYSize;
1251   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1252   
1253   wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2);
1254   pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1255   pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
1256   pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1257   pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
1258   pTopSizer->Add (pGridSizer, 1, wxALL, 10);
1259   
1260   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1261   
1262   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1263   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1264   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1265   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1266   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1267   
1268   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1269   pButtonOk->SetDefault();
1270
1271   SetAutoLayout (true);
1272   SetSizer (pTopSizer);
1273   pTopSizer->Fit (this);
1274   pTopSizer->SetSizeHints (this);
1275 }
1276
1277 DialogGetXYSize::~DialogGetXYSize ()
1278 {
1279 }
1280
1281 unsigned int
1282 DialogGetXYSize::getXSize ()
1283 {
1284   wxString strCtrl = m_pTextCtrlXSize->GetValue();
1285   long lValue;
1286   if (strCtrl.ToLong (&lValue))
1287     return lValue;
1288   else
1289     return (m_iDefaultXSize);
1290 }
1291
1292 unsigned int
1293 DialogGetXYSize::getYSize ()
1294 {
1295   wxString strCtrl = m_pTextCtrlYSize->GetValue();
1296   long lValue;
1297   if (strCtrl.ToLong (&lValue))
1298     return lValue;
1299   else
1300     return (m_iDefaultYSize);
1301 }
1302
1303
1304
1305 /////////////////////////////////////////////////////////////////////
1306 // CLASS IDENTIFICATION
1307 //
1308 // DialogGetConvertPolarParameters
1309 /////////////////////////////////////////////////////////////////////
1310
1311 DialogGetConvertPolarParameters::DialogGetConvertPolarParameters (wxWindow* pParent, const char* const pszTitle, 
1312        int iDefaultXSize, int iDefaultYSize, int iDefaultInterpolationID, int iDefaultZeropad)
1313 : wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
1314 {
1315   m_iDefaultXSize = iDefaultXSize;
1316   m_iDefaultYSize = iDefaultYSize;
1317   m_iDefaultZeropad = iDefaultZeropad;
1318
1319   wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
1320   
1321   pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5); 
1322   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1323   
1324   wxFlexGridSizer* pGridSizer = new wxFlexGridSizer (1);
1325   
1326   m_pRadioBoxInterpolation = new StringValueAndTitleRadioBox (this, _T("Interpolation"), Projections::getInterpCount(), Projections::getInterpTitleArray(), Projections::getInterpNameArray());
1327   m_pRadioBoxInterpolation->SetSelection (iDefaultInterpolationID);
1328   pGridSizer->Add (m_pRadioBoxInterpolation, 0, wxALL | wxALIGN_CENTER);
1329   
1330   wxFlexGridSizer* pTextGridSizer = new wxFlexGridSizer (2);
1331   std::ostringstream os;
1332   os << iDefaultXSize;
1333   m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);  
1334   pTextGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1335   pTextGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1336   std::ostringstream osYSize;
1337   osYSize << iDefaultYSize;
1338   m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1339   pTextGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1340   pTextGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1341 #ifdef DEBUG
1342   if (iDefaultZeropad >= 0) {
1343     std::ostringstream osZeropad;
1344     osZeropad << iDefaultZeropad;
1345     m_pTextCtrlZeropad = new wxTextCtrl (this, -1, osZeropad.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
1346     pTextGridSizer->Add (new wxStaticText (this, -1, "Zeropad"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
1347     pTextGridSizer->Add (m_pTextCtrlZeropad, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
1348   }
1349 #endif
1350
1351   pGridSizer->Add (pTextGridSizer, 0, wxALIGN_CENTER | wxALL);
1352
1353   pTopSizer->Add (pGridSizer, 1, wxALL | wxALIGN_CENTER, 3);
1354   
1355   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
1356   
1357   wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
1358   wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
1359   pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
1360   wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
1361   pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
1362   CTSimHelpButton* pButtonHelp = new CTSimHelpButton (this, IDH_DLG_POLAR);
1363   pButtonSizer->Add (pButtonHelp, 0, wxEXPAND | wxALL, 10);
1364   
1365   pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
1366   pButtonOk->SetDefault();
1367   SetAutoLayout (true);
1368   SetSizer (pTopSizer);
1369   pTopSizer->Layout();
1370   pTopSizer->Fit (this);
1371   pTopSizer->SetSizeHints (this);
1372 }
1373
1374
1375 DialogGetConvertPolarParameters::~DialogGetConvertPolarParameters ()
1376 {
1377 }
1378
1379
1380 unsigned int
1381 DialogGetConvertPolarParameters::getXSize ()
1382 {
1383   wxString strCtrl = m_pTextCtrlXSize->GetValue();
1384   unsigned long lValue;
1385   if (strCtrl.ToULong (&lValue))
1386     return lValue;
1387   else
1388     return (m_iDefaultXSize);
1389 }
1390
1391 unsigned int
1392 DialogGetConvertPolarParameters::getYSize ()
1393 {
1394   wxString strCtrl = m_pTextCtrlYSize->GetValue();
1395   unsigned long lValue;
1396   if (strCtrl.ToULong (&lValue))
1397     return lValue;
1398   else
1399     return (m_iDefaultYSize);
1400 }
1401
1402 unsigned int
1403 DialogGetConvertPolarParameters::getZeropad ()
1404 {
1405 #ifdef DEBUG
1406   wxString strCtrl = m_pTextCtrlZeropad->GetValue();
1407   unsigned long lValue;
1408   if (strCtrl.ToULong (&lValue))
1409     return lValue;
1410   else
1411     return (m_iDefaultZeropad);
1412 #else
1413   return 0;
1414 #endif
1415 }
1416
1417 const char*
1418 DialogGetConvertPolarParameters::getInterpolationName ()
1419 {
1420   return m_pRadioBoxInterpolation->getSelectionStringValue();
1421 }
1422