comparison myframe.cpp @ 2:25a76c128804

Fix bugs.
author pyon@macmini
date Mon, 03 Feb 2014 18:51:33 +0900
parents 593c93e904b5
children cc1f1fa544a4
comparison
equal deleted inserted replaced
1:593c93e904b5 2:25a76c128804
1 // Filename : myframe.cpp 1 // Filename : myframe.cpp
2 // Last Change: 29-Jan-2014. 2 // Last Change: 03-Feb-2014.
3 // 3 //
4 4
5 #include "myframe.h" 5 #include "myframe.h"
6 #include "dndfile.h" 6 #include "dndfile.h"
7 #include "sample.xpm" 7 #include "sample.xpm"
50 m_comboBoxType->Append( wxT("XPM") ); 50 m_comboBoxType->Append( wxT("XPM") );
51 m_comboBoxType->Append( wxT("GIF") ); 51 m_comboBoxType->Append( wxT("GIF") );
52 m_comboBoxType->Append( wxT("ICON") ); 52 m_comboBoxType->Append( wxT("ICON") );
53 m_comboBoxType->Append( wxT("BMP") ); 53 m_comboBoxType->Append( wxT("BMP") );
54 m_comboBoxType->Append( wxT("TIFF") ); 54 m_comboBoxType->Append( wxT("TIFF") );
55 m_comboBoxType->Append( wxT("JPEG") );
55 m_comboBoxType->SetSelection( 0 ); 56 m_comboBoxType->SetSelection( 0 );
56 bSizerConfig->Add( m_comboBoxType, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); 57 bSizerConfig->Add( m_comboBoxType, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
57 58
58 // Size 59 // Size
59 m_staticTextSize = new wxStaticText( this, wxID_ANY, wxT("Size"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); 60 m_staticTextSize = new wxStaticText( this, wxID_ANY, wxT("Size"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
225 } 226 }
226 else if ( choice_type == 6 ) { 227 else if ( choice_type == 6 ) {
227 out_type = wxBITMAP_TYPE_TIFF; 228 out_type = wxBITMAP_TYPE_TIFF;
228 ext = wxT("tiff"); 229 ext = wxT("tiff");
229 } 230 }
231 else if ( choice_type == 7 ) {
232 out_type = wxBITMAP_TYPE_JPEG;
233 ext = wxT("jpg");
234 }
230 235
231 wxImage image( file, in_type ); 236 wxImage image( file, in_type );
232 if ( w == 0 || h == 0 ) { 237 if ( w == 0 || h == 0 ) {
233 w = (long)(image.GetWidth()); 238 w = (long)(image.GetWidth());
234 h = (long)(image.GetHeight()); 239 h = (long)(image.GetHeight());
277 out_ext = wxT("bmp"); 282 out_ext = wxT("bmp");
278 } 283 }
279 else if ( choice_type == 6 ) { 284 else if ( choice_type == 6 ) {
280 out_type = wxBITMAP_TYPE_TIFF; 285 out_type = wxBITMAP_TYPE_TIFF;
281 out_ext = wxT("tiff"); 286 out_ext = wxT("tiff");
287 }
288 else if ( choice_type == 7 ) {
289 out_type = wxBITMAP_TYPE_JPEG;
290 out_ext = wxT("jpg");
282 } 291 }
283 292
284 wxArrayString files; 293 wxArrayString files;
285 wxDir::GetAllFiles( dir, &files, wxT("*.*"), wxDIR_DEFAULT ); 294 wxDir::GetAllFiles( dir, &files, wxT("*.*"), wxDIR_DEFAULT );
286 295
304 if ( out_type == wxBITMAP_TYPE_INVALID ) out_type = in_type; 313 if ( out_type == wxBITMAP_TYPE_INVALID ) out_type = in_type;
305 314
306 wxString fullpath = fn.GetPath() + wxFILE_SEP_PATH + fn.GetName(); 315 wxString fullpath = fn.GetPath() + wxFILE_SEP_PATH + fn.GetName();
307 316
308 fullpath.Replace( dn.GetPath(), wxEmptyString, false ); 317 fullpath.Replace( dn.GetPath(), wxEmptyString, false );
309 fullpath = out_dir + fullpath + wxT(".") + out_ext; 318 fullpath = out_dir + wxFILE_SEP_PATH + fullpath + wxT(".") + out_ext;
310 319
311 wxFileName tf( fullpath ); 320 wxFileName tf( fullpath );
312 if ( !tf.Exists() ) tf.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ); 321 if ( !tf.Exists() ) tf.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );
313 322
314 wxImage image( files[i], in_type ); 323 wxImage image( files[i], in_type );