]> Creatis software - creaImageIO.git/blob - src/creaImageIOWxGimmickFrame.cpp
#3185 creaImageIO Feature New Normal - Clean code
[creaImageIO.git] / src / creaImageIOWxGimmickFrame.cpp
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
5 #                        pour la Santé)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 #
10 #  This software is governed by the CeCILL-B license under French law and 
11 #  abiding by the rules of distribution of free software. You can  use, 
12 #  modify and/ or redistribute the software under the terms of the CeCILL-B 
13 #  license as circulated by CEA, CNRS and INRIA at the following URL 
14 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
15 #  or in the file LICENSE.txt.
16 #
17 #  As a counterpart to the access to the source code and  rights to copy,
18 #  modify and redistribute granted by the license, users are provided only
19 #  with a limited warranty  and the software's author,  the holder of the
20 #  economic rights,  and the successive licensors  have only  limited
21 #  liability. 
22 #
23 #  The fact that you are presently reading this means that you have had
24 #  knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
26 */
27
28
29 #include <creaImageIOWxGimmickFrame.h>
30 #include <creaImageIOSystem.h>
31 #include <creaImageIOGimmick.h>
32 #ifdef _DEBUG
33 #define new DEBUG_NEW
34 #endif
35 namespace creaImageIO
36 {
37   // CTor
38   WxGimmickFrame::WxGimmickFrame(wxWindow *parent, 
39                                                wxWindowID id,
40                                                wxString title,
41                                                const wxPoint& pos,
42                                                const wxSize& size,
43                                                int threads)
44  :   wxFrame( parent, 
45                   id, 
46                   title,
47                   pos,
48                   size,
49                   wxRESIZE_BORDER | 
50               wxSYSTEM_MENU  |
51                   wxCLOSE_BOX |
52                   wxMAXIMIZE_BOX | 
53                   wxMINIMIZE_BOX | 
54                   wxCAPTION  
55                ),
56     // mGimmick(0),
57      mView(0)
58   {
59     GimmickDebugMessage(1,"WxGimmickFrame::WxGimmickFrame"
60                         <<std::endl);
61     wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
62     
63     try {
64       
65 //              mGimmick = boost::shared_ptr<Gimmick>(new Gimmick());
66       mGimmick->Initialize();
67      
68       int min_dim = GIMMICK_2D_IMAGE_SELECTION;
69           int max_dim = GIMMICK_3D_IMAGE_SELECTION;
70       mView = new WxGimmickView(mGimmick,
71                                 this,
72                                 -1,
73                                 wxDefaultPosition,
74                                 size,
75                                 min_dim,
76                                 max_dim,
77                                 threads);
78       mView->Initialize();
79     }
80     catch (crea::Exception e)
81     {
82       e.Print();
83       return;
84     }
85
86     topsizer->Add( mView,1,wxGROW,0);
87
88     SetSizer( topsizer );     
89     Layout(); 
90   }
91
92   /// Destructor
93   WxGimmickFrame::~WxGimmickFrame()
94   {
95     GimmickDebugMessage(1,"WxGimmickFrame::~WxGimmickFrame"
96                         <<std::endl);
97     if (mView) 
98       {
99         delete mView;
100       }
101     if (mGimmick) 
102       {
103         mGimmick->Finalize();
104 //      delete mGimmick;
105       }
106   }
107   
108   
109   //================================================================
110   //  BEGIN_EVENT_TABLE(WxGimmickFrame, wxDialog)
111   //    END_EVENT_TABLE()
112   //================================================================
113
114
115 } // EO namespace creaImageIO
116
117