r11859: Canonicalize whitespace
[ctsim.git] / src / dlgreconstruct.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          dlgreconstruct.h
5 **   Purpose:       Headers for Reconstruction Animation Dialog
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  August 2000
8 **
9 **  This is part of the CTSim program
10 **  Copyright (c) 1983-2001 Kevin Rosenberg
11 **
12 **  $Id$
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 #ifndef __DLGRECONSTRUCT_H_
29 #define __DLGRECONSTRUCT_H_
30
31 #include "wx/setup.h"
32 #include "wx/dialog.h"
33 #include "wx/dcmemory.h"
34
35 class wxButton;
36 class wxStaticText;
37 class Projections;
38 class ImageFile;
39 class SGP;
40 class SGPDriver;
41 class Reconstructor;
42
43 class ReconstructDialog : public wxDialog
44 {
45   DECLARE_DYNAMIC_CLASS(ReconstructDialog)
46
47 public:
48   ReconstructDialog (Reconstructor& rReconstruct, const Projections& rProj, ImageFile& rIF, const int iTrace, wxWindow *parent);
49
50    ~ReconstructDialog();
51
52    /* Perform projection on view number
53        return true if ABORT button has not been pressed
54    */
55    bool reconstructView (int iViewNumber, bool bBackproject = true);
56
57    /* Can be called to continue after the cancel button has been pressed, but
58        the program decided to continue the operation (e.g., user didn't
59        confirm it)
60    */
61    void Resume() { m_state = Continue; }
62
63    // implementation from now on
64        // callback for optional abort button
65    void OnCancel(wxCommandEvent& event);
66        // callback to disable "hard" window closing
67    void OnClose(wxCloseEvent& event);
68    void OnPaint(wxPaintEvent& event);
69
70    void OnPause(wxCommandEvent& event);
71    void OnStep(wxCommandEvent& event);
72
73    bool isPaused() const {return m_state == Paused;}
74
75    bool isCancelled() const {return m_state == Cancelled;}
76
77 private:
78    // parent top level window (may be NULL)
79    wxWindow *m_parentTop;
80    int m_iLastView;
81    int m_iClientX;   // size of client window
82    int m_iClientY;
83
84    Reconstructor& m_rReconstructor;
85    const Projections& m_rProjections;
86    ImageFile& m_rImageFile;
87    SGPDriver* m_pSGPDriver;
88    SGP* m_pSGP;
89    const int m_iTrace;
90    wxDC* m_pDC;
91
92    wxButton *m_btnAbort;    // the abort button (or NULL if none)
93    wxButton *m_btnPause;
94    wxButton *m_btnStep;
95
96    wxMemoryDC m_memoryDC;  // for restoring image on OnPaint
97    wxBitmap m_bitmap;
98
99    int m_nxImage;
100    int m_nyImage;
101    int m_nxGraph;
102    int m_nyGraph;
103
104    // continue processing or not (return value for Update())
105    enum
106    {
107       Uncancellable = -1,   // dialog can't be canceled
108       Paused,
109       Cancelled,            // can be cancelled and, in fact, was
110       Continue,            // can be cancelled but wasn't
111       Finished             // finished, waiting to be removed from screen
112    } m_state;
113
114    const static int ID_BTN_PAUSE;
115    const static int ID_BTN_STEP;
116    const static int MAX_IMAGE_X;
117    const static int MAX_IMAGE_Y;
118
119    void showView (int iViewNumber, bool bBackprojectView = true);
120
121    DECLARE_EVENT_TABLE()
122 };
123 #endif
124