creaImageIO_lib
creaImageIO::WxOutputDlg Class Reference

#include <creaImageIOWxOutputDlg.h>

Inheritance diagram for creaImageIO::WxOutputDlg:
Collaboration diagram for creaImageIO::WxOutputDlg:

Public Member Functions

 WxOutputDlg (wxWindow *parent, const std::vector< std::string > filenames, int i_dim, bool single)
 CTor. More...
 
 ~WxOutputDlg ()
 DTor. More...
 
const std::string getAsking ()
 Get selected storage. More...
 
const std::string getDim ()
 

Private Member Functions

void OnOk (wxCommandEvent &event)
 Validate selected storage. More...
 
void OnChange (wxCommandEvent &event)
 

Private Attributes

std::vector< wxCheckBox * > checkOut
 
wxCheckBox * checkAsking
 

Detailed Description

WxOutputDlg allows to select the different output format

Definition at line 46 of file creaImageIOWxOutputDlg.h.

Constructor & Destructor Documentation

creaImageIO::WxOutputDlg::WxOutputDlg ( wxWindow *  parent,
const std::vector< std::string >  filenames,
int  i_dim,
bool  single 
)

CTor.

fix unused variable ExportText

fix unused variable Cancel

Definition at line 34 of file creaImageIOWxOutputDlg.cpp.

References checkAsking, checkOut, OnChange(), and OnOk().

35  : wxDialog(parent, -1,_T("OUTPUT FORMAT"), wxDefaultPosition, wxSize(350,450))
36  {
37 
38  int size = (int)filenames.size();
39 
40  int deflt = 1;
41 
42  std::string sentence;
43  sentence = "You select";
44  std::string sentence2 = "You have the possibility to select output format :";
45  //int nbsent= 0;
46  std::vector<std::string> outsentences;
47  if (size == 1)
48  {
49  sentence += " 1 ";
50  }
51  else
52  {
53  sentence += " n ";
54  }
55  if(single)
56  {
57  sentence += " single frames";
58  }
59  else
60  {
61  sentence += " multi-frames";
62  }
63  sentence += " as output";
64 
65 
66  if (size == 1)
67  {
68  if(single)
69  {
70  outsentences.push_back("It shall be a single file with a single 2D frmae");
71  }
72  else
73  {
74  outsentences.push_back("It shall be multiple files with 2D frames");
75  outsentences.push_back("It shall be a single file with 3D frames");
76  }
77  }
78  else
79  {
80  if(single)
81  {
82  outsentences.push_back("It shall be a single file with 3D frames");
83  outsentences.push_back("It shall be multiple files with 2D frames");
84  }
85  else
86  {
87  outsentences.push_back("It shall be a single file with (3D+t) frames");
88  outsentences.push_back("It shall be multiple (n+t) files with 2D frames");
89  outsentences.push_back("It shall be multiple (n) files with (2D+t) frames");
90  outsentences.push_back("It shall be a multiple (t) files with (2D+n) frames");
91  deflt = 3;
92  }
93 
94  }
95  if(i_dim != -1)
96  {
97  deflt = i_dim;
98  }
99 
100 
101  int start_point = 45;
103  wxStaticText * ExportText=new wxStaticText(this,-1,crea::std2wx(sentence), wxPoint(5,10));
104 
105  std::vector<std::string>::iterator it = outsentences.begin();
106  for(int i = 0;it != outsentences.end(); it++, i++, start_point += 45)
107  {
108  wxCheckBox *check = new wxCheckBox(this, -1, crea::std2wx((*it)), wxPoint(5,start_point) );
109  if(i == deflt)
110  check->SetValue(true);
111  else
112  check->SetValue(false);
113  Connect( check->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &WxOutputDlg::OnChange );
114  checkOut.push_back(check);
115  }
116 
117  checkAsking = new wxCheckBox(this, -1, _T("Do you want to save this output and no more asking"), wxPoint(5,start_point) );
118 
119  // VALIDATION BUTTON
120  wxButton *Ok = new wxButton(this, -1,_T("OK"), wxPoint(5,start_point+20) );
121 
122  Connect( Ok->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxOutputDlg::OnOk );
123 
125  wxButton *Cancel = new wxButton(this, wxID_CANCEL,_T("CANCEL"), wxPoint(100,start_point+20) );
126  Layout();
127 
128  }

Here is the call graph for this function:

creaImageIO::WxOutputDlg::~WxOutputDlg ( )

DTor.

Definition at line 130 of file creaImageIOWxOutputDlg.cpp.

130 {}

Member Function Documentation

const std::string creaImageIO::WxOutputDlg::getAsking ( )

Get selected storage.

Definition at line 171 of file creaImageIOWxOutputDlg.cpp.

References checkAsking.

172  {
173  if(checkAsking->GetValue())
174  return "false";
175  else
176  return "true";
177  }
const std::string creaImageIO::WxOutputDlg::getDim ( )

Definition at line 154 of file creaImageIOWxOutputDlg.cpp.

References checkOut.

155  {
156  char res[2];
157  std::vector<wxCheckBox*>::iterator it = checkOut.begin();
158  for(int i = 1;it != checkOut.end(); it++, i++)
159  {
160  if( (*it)->GetValue() )
161  {
162  sprintf(res,"%d", i);
163  }
164  else
165  {
166 
167  }
168  }
169  return res;
170  }
void creaImageIO::WxOutputDlg::OnChange ( wxCommandEvent &  event)
private

Definition at line 138 of file creaImageIOWxOutputDlg.cpp.

References checkOut.

Referenced by WxOutputDlg().

139  {
140  std::vector<wxCheckBox*>::iterator it = checkOut.begin();
141 
142  for(int i = 0;it != checkOut.end(); it++, i++)
143  {
144  if( (*it)->GetId() == event.GetId())
145  {
146  }
147  else
148  {
149  (*it)->SetValue(false);
150  }
151  }
152  }

Here is the caller graph for this function:

void creaImageIO::WxOutputDlg::OnOk ( wxCommandEvent &  event)
private

Validate selected storage.

Definition at line 132 of file creaImageIOWxOutputDlg.cpp.

Referenced by WxOutputDlg().

133  {
134  Close();
135  SetReturnCode(wxID_OK);
136  }

Here is the caller graph for this function:

Member Data Documentation

wxCheckBox* creaImageIO::WxOutputDlg::checkAsking
private

Definition at line 66 of file creaImageIOWxOutputDlg.h.

Referenced by getAsking(), and WxOutputDlg().

std::vector<wxCheckBox*> creaImageIO::WxOutputDlg::checkOut
private

Definition at line 63 of file creaImageIOWxOutputDlg.h.

Referenced by getDim(), OnChange(), and WxOutputDlg().


The documentation for this class was generated from the following files: