Update copyright date; remove old CVS keyword
[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-2009 Kevin Rosenberg
11 **
12 **  This program is free software; you can redistribute it and/or modify
13 **  it under the terms of the GNU General Public License (version 2) as
14 **  published by the Free Software Foundation.
15 **
16 **  This program is distributed in the hope that it will be useful,
17 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
18 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 **  GNU General Public License for more details.
20 **
21 **  You should have received a copy of the GNU General Public License
22 **  along with this program; if not, write to the Free Software
23 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24 ******************************************************************************/
25
26 #ifndef __DLGRECONSTRUCT_H_
27 #define __DLGRECONSTRUCT_H_
28
29 #include "wx/setup.h"
30 #include "wx/dialog.h"
31 #include "wx/dcmemory.h"
32
33 class wxButton;
34 class wxStaticText;
35 class Projections;
36 class ImageFile;
37 class SGP;
38 class SGPDriver;
39 class Reconstructor;
40
41 class ReconstructDialog : public wxDialog
42 {
43   DECLARE_DYNAMIC_CLASS(ReconstructDialog)
44
45 public:
46   ReconstructDialog (Reconstructor& rReconstruct, const Projections& rProj, ImageFile& rIF, const int iTrace, wxWindow *parent);
47
48    ~ReconstructDialog();
49
50    /* Perform projection on view number
51        return true if ABORT button has not been pressed
52    */
53    bool reconstructView (int iViewNumber, bool bBackproject = true);
54
55    /* Can be called to continue after the cancel button has been pressed, but
56        the program decided to continue the operation (e.g., user didn't
57        confirm it)
58    */
59    void Resume() { m_state = Continue; }
60
61    // implementation from now on
62        // callback for optional abort button
63    void OnCancel(wxCommandEvent& event);
64        // callback to disable "hard" window closing
65    void OnClose(wxCloseEvent& event);
66    void OnPaint(wxPaintEvent& event);
67
68    void OnPause(wxCommandEvent& event);
69    void OnStep(wxCommandEvent& event);
70
71    bool isPaused() const {return m_state == Paused;}
72
73    bool isCancelled() const {return m_state == Cancelled;}
74
75 private:
76    // parent top level window (may be NULL)
77    wxWindow *m_parentTop;
78    int m_iLastView;
79    int m_iClientX;   // size of client window
80    int m_iClientY;
81
82    Reconstructor& m_rReconstructor;
83    const Projections& m_rProjections;
84    ImageFile& m_rImageFile;
85    SGPDriver* m_pSGPDriver;
86    SGP* m_pSGP;
87    const int m_iTrace;
88    wxDC* m_pDC;
89
90    wxButton *m_btnAbort;    // the abort button (or NULL if none)
91    wxButton *m_btnPause;
92    wxButton *m_btnStep;
93
94    wxMemoryDC m_memoryDC;  // for restoring image on OnPaint
95    wxBitmap m_bitmap;
96
97    int m_nxImage;
98    int m_nyImage;
99    int m_nxGraph;
100    int m_nyGraph;
101
102    // continue processing or not (return value for Update())
103    enum
104    {
105       Uncancellable = -1,   // dialog can't be canceled
106       Paused,
107       Cancelled,            // can be cancelled and, in fact, was
108       Continue,            // can be cancelled but wasn't
109       Finished             // finished, waiting to be removed from screen
110    } m_state;
111
112    const static int ID_BTN_PAUSE;
113    const static int ID_BTN_STEP;
114    const static int MAX_IMAGE_X;
115    const static int MAX_IMAGE_Y;
116
117    void showView (int iViewNumber, bool bBackprojectView = true);
118
119    DECLARE_EVENT_TABLE()
120 };
121 #endif
122