diff src/bprint.cpp @ 22:92188f60323d default tip

Implement Masking function on Preview Dialog.
author pyon@macmini
date Sat, 04 Apr 2015 17:23:46 +0900
parents a2ad87cad48b
children
line wrap: on
line diff
--- a/src/bprint.cpp	Wed Dec 17 00:52:43 2014 +0900
+++ b/src/bprint.cpp	Sat Apr 04 17:23:46 2015 +0900
@@ -1,5 +1,5 @@
 // Filename   : bprint.cpp
-// Last Change: 12-Aug-2014.
+// Last Change: 2015-04-04 11:06:15.
 //
 
 #include "bprint.h"
@@ -124,6 +124,40 @@
     m_grid->ClearGrid();
 }
 
+/* CSVファイルから一括読込み */
+void FrameBatchPrint::LoadCSV( wxString file )
+{
+    m_grid->ClearGrid();
+
+    // ファイルから被保番リストを生成
+    wxTextFile csv;
+    csv.Open( file );
+
+    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] );    
+    }
+}
+
 /* 一括印刷処理 */
 void FrameBatchPrint::OnPrint( wxCommandEvent& WXUNUSED(event) )
 {