]> Creatis software - creaImageIO.git/blob - src/creaImageIOWxCustomizeConfigPanel.cpp
#3185 creaImageIO Feature New Normal - Clean code
[creaImageIO.git] / src / creaImageIOWxCustomizeConfigPanel.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 <creaImageIOWxCustomizeConfigPanel.h>
30 #include <creaImageIOSystem.h>
31 namespace creaImageIO
32 {
33   // CTor
34   WxCustomizeConfigPanel::WxCustomizeConfigPanel(wxWindow *parent, wxDialog* dial, WxGimmickView* view, const std::string& cPath, 
35                 const std::string& dPath,
36                 const std::string& sEvent,
37                 const std::string& sFreq)
38  :   wxPanel( parent, 
39                   -1, wxDefaultPosition, 
40                   wxDefaultSize,
41                   wxRESIZE_BORDER | 
42               wxSYSTEM_MENU  |
43                   wxCLOSE_BOX |
44                   wxMAXIMIZE_BOX | 
45                   wxMINIMIZE_BOX | 
46                   wxCAPTION  
47                ),       
48                    dialog(dial),
49                    copyP (cPath), 
50                    databaseP(dPath), 
51                    syncEv(sEvent), 
52                    syncFr(sFreq),
53                    mView(view)
54   {
55     GimmickDebugMessage(1,"WxCustomizeConfigPanel::WxCustomizeConfigPanel"
56                         <<std::endl);
57         /// \TODO fix  warning: unused variable cp
58         wxStaticText * cp=new wxStaticText(this,-1,_T(" Copy Path: "), wxPoint(5,10));
59         copyPath=new wxTextCtrl(this, wxID_ANY, crea::std2wx(copyP), wxPoint(150,10), wxSize(250,20));
60
61         /// \TODO fix  warning: unused variable dp
62         wxStaticText * dp=new wxStaticText(this,-1,_T(" Database Path: "), wxPoint(5,40));
63         dbPath=new wxTextCtrl(this, wxID_ANY, crea::std2wx(databaseP), wxPoint(150,40), wxSize(250,20));
64
65         /// \TODO fix  warning: unused variable se
66         wxStaticText * se=new wxStaticText(this,-1,_T(" Synchronization Event: "), wxPoint(5,70));
67         syncEvent=new wxTextCtrl(this, wxID_ANY, crea::std2wx(syncEv), wxPoint(150,70), wxSize(250,20));
68
69         /// \TODO fix  warning: unused variable sf
70         wxStaticText * sf=new wxStaticText(this,-1,_T(" Synchronization Frequency: "), wxPoint(5,100));
71         syncFrequency=new wxTextCtrl(this, wxID_ANY, crea::std2wx(syncFr), wxPoint(150,100), wxSize(250,20));
72
73         wxButton *save = new wxButton(this,wxID_ANY,_T("Save Changes"), wxPoint(5,130) );
74         Connect( save->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxCustomizeConfigPanel::OnSaveConfig ); 
75   
76     Layout(); 
77   }
78
79   /// Destructor
80   WxCustomizeConfigPanel::~WxCustomizeConfigPanel()
81   {
82     GimmickDebugMessage(1,"WxCustomizeConfigPanel::~WxCustomizeConfigPanel"
83                         <<std::endl);
84   }
85
86   void WxCustomizeConfigPanel::OnSaveConfig(wxCommandEvent& event)
87   {
88           mView->OnSaveSettingsCallback(crea::wx2std(copyPath->GetValue()),
89                   crea::wx2std(dbPath->GetValue()),
90                   crea::wx2std(syncEvent->GetValue()),
91                   crea::wx2std(syncFrequency->GetValue()));
92           dialog->Destroy();
93   }
94   
95 //======================================================================
96   
97 //====================================================================== 
98
99 } // EO namespace creaImageIO
100
101