2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------
29 #include <creaImageIOWxListenerPanel.h>
30 #include <creaImageIOSystem.h>
35 WxListenerPanel::WxListenerPanel(wxWindow *parent, wxDialog* dial, WxGimmickView* view, bool stat)
37 -1, wxDefaultPosition,
49 GimmickDebugMessage(1,"WxListener::WxListener"
52 /// \TODO fix warning: unused variable cp
53 wxStaticText * cp=new wxStaticText(this,-1,_T(" Drive to monitor: "), wxPoint(5,15));
54 const wxString choices[] = { _T("D:"),
58 drives=new wxComboBox(this, -1,crea::std2wx("E:"),wxPoint(100, 10),wxDefaultSize,4,choices);
60 addCheckBox = new wxCheckBox(this, -1, _T("Automatically add images to the database when CD/DVD is mounted?"), wxPoint(5,45) );
61 addCheckBox->SetValue(true);
62 removeCheckBox = new wxCheckBox(this, -1, _T("Automatically remove images from the database when CD/DVD is unmounted?"), wxPoint(5,75) );
63 removeCheckBox->SetValue(true);
64 Connect( addCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxListenerPanel::OnAdd );
65 Connect( removeCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxListenerPanel::OnRemove );
67 if (state){name="Start Monitoring Drive";}
68 else {name="Stop Monitoring Drive";}
69 wxButton *start = new wxButton(this,wxID_ANY,crea::std2wx(name), wxPoint(5,110) );
70 Connect( start->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxListenerPanel::OnChangeThreadState );
72 wxButton *save = new wxButton(this,wxID_ANY,_T("Save Changes"), wxPoint(130,110) );
73 Connect( save->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxListenerPanel::OnChangeListenState );
76 //topsizer->Add( mView,1,wxGROW,0);
78 // SetSizer( topsizer );
83 WxListenerPanel::~WxListenerPanel()
85 GimmickDebugMessage(1,"WxCustomizeConfigPanel::~WxCustomizeConfigPanel"
89 void WxListenerPanel::OnAdd(wxCommandEvent& event)
91 addFiles = addCheckBox->GetValue();
94 void WxListenerPanel::OnRemove(wxCommandEvent& event)
96 removeFiles = removeCheckBox->GetValue();
99 void WxListenerPanel::OnChangeListenState(wxCommandEvent& event)
101 mView->OnListenerCallback(crea::wx2std(drives->GetValue()),addFiles, removeFiles);
105 void WxListenerPanel::OnChangeThreadState(wxCommandEvent& event)
109 mView->StartListeningThread();
113 mView->StopListeningThread();
118 //======================================================================
120 //======================================================================
122 } // EO namespace creaImageIO