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