comparison myframe.cpp @ 1:593c93e904b5

Fix bugs.
author pyon@macmini
date Wed, 29 Jan 2014 19:29:02 +0900
parents ebc42d7a0010
children 25a76c128804
comparison
equal deleted inserted replaced
0:ebc42d7a0010 1:593c93e904b5
1 // Filename : myframe.cpp 1 // Filename : myframe.cpp
2 // Last Change: 24-Jan-2014. 2 // Last Change: 29-Jan-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"
195 else if ( ext.IsSameAs( wxT("gif"), false ) ) in_type = wxBITMAP_TYPE_GIF; 195 else if ( ext.IsSameAs( wxT("gif"), false ) ) in_type = wxBITMAP_TYPE_GIF;
196 else if ( ext.IsSameAs( wxT("ico"), false ) ) in_type = wxBITMAP_TYPE_ICO; 196 else if ( ext.IsSameAs( wxT("ico"), false ) ) in_type = wxBITMAP_TYPE_ICO;
197 else if ( ext.IsSameAs( wxT("bmp"), false ) ) in_type = wxBITMAP_TYPE_BMP; 197 else if ( ext.IsSameAs( wxT("bmp"), false ) ) in_type = wxBITMAP_TYPE_BMP;
198 else if ( ext.IsSameAs( wxT("tif"), false ) ) in_type = wxBITMAP_TYPE_TIFF; 198 else if ( ext.IsSameAs( wxT("tif"), false ) ) in_type = wxBITMAP_TYPE_TIFF;
199 else if ( ext.IsSameAs( wxT("tiff"), false ) ) in_type = wxBITMAP_TYPE_TIFF; 199 else if ( ext.IsSameAs( wxT("tiff"), false ) ) in_type = wxBITMAP_TYPE_TIFF;
200 else {
201 WarnMessage( wxT("Input file type is not supported !") );
202 return false;
203 }
200 204
201 int out_type = in_type; 205 int out_type = in_type;
202 if ( choice_type == 1 ) { 206 if ( choice_type == 1 ) {
203 out_type = wxBITMAP_TYPE_PNG; 207 out_type = wxBITMAP_TYPE_PNG;
204 ext = wxT("png"); 208 ext = wxT("png");
278 } 282 }
279 283
280 wxArrayString files; 284 wxArrayString files;
281 wxDir::GetAllFiles( dir, &files, wxT("*.*"), wxDIR_DEFAULT ); 285 wxDir::GetAllFiles( dir, &files, wxT("*.*"), wxDIR_DEFAULT );
282 286
283 for ( int i = 0; i < files.GetCount(); i++ ) { 287 for ( long i = 0; i < files.GetCount(); i++ ) {
284 288
285 wxFileName fn( files[i] ); 289 wxFileName fn( files[i] );
286 wxString in_ext = fn.GetExt(); 290 wxString in_ext = fn.GetExt();
287 int in_type; 291 int in_type;
288 292
293 else if ( in_ext.IsSameAs( wxT("gif"), false ) ) in_type = wxBITMAP_TYPE_GIF; 297 else if ( in_ext.IsSameAs( wxT("gif"), false ) ) in_type = wxBITMAP_TYPE_GIF;
294 else if ( in_ext.IsSameAs( wxT("ico"), false ) ) in_type = wxBITMAP_TYPE_ICO; 298 else if ( in_ext.IsSameAs( wxT("ico"), false ) ) in_type = wxBITMAP_TYPE_ICO;
295 else if ( in_ext.IsSameAs( wxT("bmp"), false ) ) in_type = wxBITMAP_TYPE_BMP; 299 else if ( in_ext.IsSameAs( wxT("bmp"), false ) ) in_type = wxBITMAP_TYPE_BMP;
296 else if ( in_ext.IsSameAs( wxT("tif"), false ) ) in_type = wxBITMAP_TYPE_TIFF; 300 else if ( in_ext.IsSameAs( wxT("tif"), false ) ) in_type = wxBITMAP_TYPE_TIFF;
297 else if ( in_ext.IsSameAs( wxT("tiff"), false ) ) in_type = wxBITMAP_TYPE_TIFF; 301 else if ( in_ext.IsSameAs( wxT("tiff"), false ) ) in_type = wxBITMAP_TYPE_TIFF;
302 else continue;
298 303
299 if ( out_type == wxBITMAP_TYPE_INVALID ) out_type = in_type; 304 if ( out_type == wxBITMAP_TYPE_INVALID ) out_type = in_type;
300 305
301 wxString fullpath = fn.GetPath() + wxFILE_SEP_PATH + fn.GetName(); 306 wxString fullpath = fn.GetPath() + wxFILE_SEP_PATH + fn.GetName();
302 307