Mercurial > mercurial > hgweb_searcher03.cgi
diff include/dndfile.h @ 5:bc2e2b304095
Clean up code.
author | pyon@macmini |
---|---|
date | Sat, 14 Sep 2013 08:54:47 +0900 |
parents | fdba695b99f1 |
children | 92188f60323d |
line wrap: on
line diff
--- a/include/dndfile.h Wed Sep 11 19:09:14 2013 +0900 +++ b/include/dndfile.h Sat Sep 14 08:54:47 2013 +0900 @@ -1,6 +1,8 @@ // Filename : dndfile.h -// Last Change: 11-Sep-2013. +// Last Change: 12-Sep-2013. // +#ifndef __DNDFILE_H__ +#define __DNDFILE_H__ #include "db.h" @@ -53,50 +55,4 @@ wxGrid* m_grid; }; -class DnDFile2 : public wxFileDropTarget -{ - public: - DnDFile2( wxGrid *grid ) - { - m_grid = grid; - } - virtual bool OnDropFiles( wxCoord x, wxCoord y, const wxArrayString& filenames ) - { - size_t nFiles = filenames.GetCount(); - if ( nFiles != 1 ) return false; - - m_grid->ClearGrid(); - wxTextFile csv; - csv.Open( filenames[0] ); - - int d = csv.GetLineCount() - m_grid->GetNumberRows(); - if ( d > 0 ) - m_grid->AppendRows( d, true ); - - wxRegEx reHhs( wxT("^0[1238][0-9]{8}$") ); - for ( int n = 0, j = 0; n < csv.GetLineCount(); n++ ) { - wxString hhsno = csv.GetLine( n ).BeforeFirst( ',', NULL ); - if ( ! reHhs.Matches( hhsno ) ) { - j++; - continue; - } - int r = n - j; - - wxArrayString info = wxSplit( GetHhsInfoByHhsNo( hhsno ), '_', '\\' ); - wxArrayString path = GetPathByHhsNo( hhsno ); - - if ( info.IsEmpty() ) info.Add( wxEmptyString ); - if ( path.IsEmpty() ) path.Add( wxEmptyString ); - - m_grid->SetCellValue( r, 0, hhsno ); - m_grid->SetCellValue( r, 1, info[0] ); - m_grid->SetCellValue( r, 2, path[0] ); - } - csv.Close(); - return true; - } - - private: - wxGrid* m_grid; -}; - +#endif //__DNDFILE_H__