Mercurial > mercurial > hgweb_searcher03.cgi
diff include/dndfile.h @ 4:fdba695b99f1
More fast ( read from DB ).
Improve the precision of marksheet judgement.
author | pyon@macmini |
---|---|
date | Wed, 11 Sep 2013 19:09:14 +0900 |
parents | 1a64119ab257 |
children | bc2e2b304095 |
line wrap: on
line diff
--- a/include/dndfile.h Tue Aug 27 18:50:00 2013 +0900 +++ b/include/dndfile.h Wed Sep 11 19:09:14 2013 +0900 @@ -1,5 +1,5 @@ // Filename : dndfile.h -// Last Change: 27-Aug-2013. +// Last Change: 11-Sep-2013. // #include "db.h" @@ -17,6 +17,55 @@ if ( nFiles != 1 ) return false; m_grid->ClearGrid(); + + // ファイルから被保番リストを生成 + wxTextFile csv; + csv.Open( filenames[0] ); + + wxRegEx reHhs( wxT("^0[1238][0-9]{8}$") ); + wxArrayString hhs; + for ( int n = 0; n < csv.GetLineCount(); n++ ) { + wxString hhsno = csv.GetLine( n ).BeforeFirst( ',', NULL ); + if ( ! reHhs.Matches( hhsno ) ) + continue; + hhs.Add( hhsno ); + } + csv.Close(); + + // + int d = hhs.GetCount() - m_grid->GetNumberRows(); + if ( d > 0 ) + m_grid->AppendRows( d, true ); + + // グリッドに情報を読込み + wxArrayString res = GetHhsInfoAndPathByHhsNoList( hhs ); + for ( int r = 0; r < res.GetCount(); r++ ) { + wxArrayString data = wxSplit( res[r], '_', '\\' ); + m_grid->SetCellValue( r, 0, data[0] ); + m_grid->SetCellValue( r, 1, data[1] ); + m_grid->SetCellValue( r, 2, data[2] ); + } + + return true; + } + + private: + 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] );