Use OpenMP for scanner
[ctsim.git] / src / dlgprojections.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          dlgprojections.h
5 **   Purpose:       Headers for Projection Collection 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 __DLGPROJECTIONS_H_
27 #define __DLGPROJECTIONS_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 Phantom;
37 class SGP;
38 class Scanner;
39 class SGPDriver;
40
41 class ProjectionsDialog : public wxDialog
42 {
43   DECLARE_DYNAMIC_CLASS(ProjectionsDialog)
44
45 public:
46   ProjectionsDialog (Scanner& rScanner, Projections& rProj, const Phantom& rPhantom, const int iTrace, wxWindow *parent);
47
48    ~ProjectionsDialog();
49
50    /* Perform projection on view number
51        return true if ABORT button has not been pressed
52    */
53    bool projectView(int iViewNumber);
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    Scanner& m_rScanner;
83    Projections& m_rProjections;
84    const Phantom& m_rPhantom;
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    // continue processing or not (return value for Update())
98    enum
99    {
100       Uncancellable = -1,   // dialog can't be canceled
101       Paused,
102       Cancelled,            // can be cancelled and, in fact, was
103       Continue,            // can be cancelled but wasn't
104       Finished             // finished, waiting to be removed from screen
105    } m_state;
106
107    enum { ID_BTN_PAUSE = 19996, ID_BTN_STEP = 19997 };
108
109    void showView (int iViewNumber);
110
111    DECLARE_EVENT_TABLE()
112 };
113 #endif
114