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 <creaImageIOWxEditFieldsPanel.h>
30 #include <creaImageIOSystem.h>
31 #include <wx/arrstr.h>
33 //using namespace tree;
36 const int ID_COMBO = 140;
38 WxEditFieldsPanel::WxEditFieldsPanel(wxWindow *parent, wxDialog* dial, WxGimmickView* view, tree::Node* nod,
39 const std::vector<std::string> name,
40 const std::vector<std::string> key)
42 -1, wxDefaultPosition,
57 GimmickDebugMessage(1,"WxCustomizeConfigPanel::WxCustomizeConfigPanel"
59 /// \TODO fix warning: unused variable cp
60 wxStaticText * cp=new wxStaticText(this,-1,_T(" Attribute to change: "), wxPoint(5,10));
62 std::vector<std::string>::const_iterator it;
63 for(it=names.begin();it!=names.end();++it)
65 as.Add(crea::std2wx(*it));
67 attributes=new wxComboBox(this, ID_COMBO, crea::std2wx(names.front()), wxPoint(110, 10), wxDefaultSize,as);
68 std::string val=node->GetAttribute(keys[0]);
69 if(val.compare("")==0){val="?";}
71 /// \TODO fix warning: unused variable av
72 wxStaticText * av=new wxStaticText(this,-1,_T(" Current Value: "), wxPoint(5,40));
73 actualVal=new wxStaticText(this,-1,crea::std2wx(val), wxPoint(110,40));
75 /// \TODO fix warning: unused variable nv
76 wxStaticText * nv=new wxStaticText(this,-1,_T(" New Value: "), wxPoint(5,70));
77 newVal=new wxTextCtrl(this, wxID_ANY, crea::std2wx(val), wxPoint(110,70), wxSize(220,20));
79 wxButton *save = new wxButton(this,wxID_ANY,_T("Save Changes"), wxPoint(5,100) );
80 Connect( save->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxEditFieldsPanel::OnEdit );
86 WxEditFieldsPanel::~WxEditFieldsPanel()
88 GimmickDebugMessage(1,"WxEditFieldsPanel::~WxEditFieldsPanel"
92 void WxEditFieldsPanel::OnEdit(wxCommandEvent& event)
94 std::string val=crea::wx2std(newVal->GetValue());
95 int sel=attributes->GetSelection();
100 mView->OnFieldsEdited(node,names[sel],keys[sel],val);
104 void WxEditFieldsPanel::OnComboChange(wxCommandEvent& event)
106 std::string val=node->GetAttribute(keys[attributes->GetSelection()]);
107 if(val.compare("")==0){val="?";}
108 actualVal->SetLabel(crea::std2wx(val));
109 newVal->SetValue(crea::std2wx(val));
112 //======================================================================
113 BEGIN_EVENT_TABLE(WxEditFieldsPanel, wxPanel)
114 EVT_COMBOBOX (ID_COMBO,WxEditFieldsPanel::OnComboChange)
116 //======================================================================
118 } // EO namespace creaImageIO