Mercurial > mercurial > hgweb_searcher03.cgi
annotate src/bprint.cpp @ 21:a2ad87cad48b
Enhanced the convenience of Cache dialog.
| author | pyon@macmini |
|---|---|
| date | Wed, 17 Dec 2014 00:52:43 +0900 |
| parents | bbd65edf71d4 |
| children | 92188f60323d |
| rev | line source |
|---|---|
| 2 | 1 // Filename : bprint.cpp |
| 21 | 2 // Last Change: 12-Aug-2014. |
| 2 | 3 // |
| 4 | |
| 5 #include "bprint.h" | |
| 6 #include "marksheet.h" | |
| 3 | 7 #include "dndfile.h" |
| 2 | 8 #include "db.h" |
| 9 | |
| 10 FrameBatchPrint::FrameBatchPrint( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) | |
| 11 : wxDialog( parent, id, title, pos, size, style ) | |
| 12 { | |
| 13 this->SetSizeHints( wxDefaultSize, wxDefaultSize ); | |
| 14 this->SetBackgroundColour( wxColour( wxT("WHEAT") ) ); | |
| 15 | |
| 16 wxBoxSizer* bSizerTop = new wxBoxSizer( wxHORIZONTAL ); | |
| 17 | |
| 18 m_grid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); | |
| 19 | |
| 20 // Grid | |
| 21 m_grid->CreateGrid( 25, 4 ); | |
| 22 m_grid->EnableEditing( true ); | |
| 23 m_grid->EnableGridLines( true ); | |
| 24 m_grid->EnableDragGridSize( false ); | |
| 25 m_grid->SetMargins( 0, 0 ); | |
| 26 | |
| 27 // Columns | |
| 28 m_grid->EnableDragColMove( false ); | |
| 29 m_grid->EnableDragColSize( true ); | |
| 30 m_grid->SetColLabelSize( 30 ); | |
| 31 m_grid->SetColLabelValue( 0, wxT("被保険者番号") ); | |
| 32 m_grid->SetColLabelValue( 1, wxT("氏名") ); | |
| 33 m_grid->SetColLabelValue( 2, wxT("最新フォルダ") ); | |
| 34 m_grid->SetColLabelValue( 3, wxT("ステータス") ); | |
| 35 m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); | |
| 36 m_grid->SetColSize( 0, 100 ); | |
| 37 m_grid->SetColSize( 1, 100 ); | |
| 38 m_grid->SetColSize( 2, 220 ); | |
| 8 | 39 m_grid->SetColSize( 3, 90 ); |
| 3 | 40 m_grid->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_ALWAYS ); |
| 2 | 41 |
| 42 // Rows | |
| 43 m_grid->EnableDragRowSize( true ); | |
| 44 m_grid->SetRowLabelSize( 30 ); | |
| 45 m_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); | |
| 46 | |
| 47 // Cell Defaults | |
| 48 m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); | |
| 49 bSizerTop->Add( m_grid, 1, wxALL|wxEXPAND, 5 ); | |
| 50 | |
| 51 wxBoxSizer* bSizerButton = new wxBoxSizer( wxVERTICAL ); | |
| 52 | |
| 53 bSizerButton->Add( 0, 20, 0, 0, 5 ); | |
| 54 | |
| 55 m_buttonClear = new wxButton( this, ID_BPCLEAR, wxT("クリア"), wxDefaultPosition, wxDefaultSize, 0 ); | |
| 56 bSizerButton->Add( m_buttonClear, 0, wxALL, 5 ); | |
| 57 | |
|
12
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
58 m_buttonMaskPrint = new wxButton( this, ID_BPFFMP, wxT("FFMP"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
59 bSizerButton->Add( m_buttonMaskPrint, 0, wxALL, 5 ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
60 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
61 m_buttonPrint = new wxButton( this, ID_BPPRINT, wxT("一括印刷"), wxDefaultPosition, wxDefaultSize, 0 ); |
| 2 | 62 bSizerButton->Add( m_buttonPrint, 0, wxALL, 5 ); |
|
12
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
63 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
64 m_buttonLdLog = new wxButton( this, ID_BPLDLOG, wxT("一括印刷ログ"), wxDefaultPosition, wxDefaultSize, 0 ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
65 bSizerButton->Add( m_buttonLdLog, 0, wxALL, 5 ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
66 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
67 bSizerButton->Add( 0, 20, 0, 0, 5 ); |
| 2 | 68 |
| 69 bSizerButton->Add( 0, 20, 0, 0, 5 ); | |
| 70 | |
| 71 m_buttonClose = new wxButton( this, wxID_CANCEL, wxT("閉じる"), wxDefaultPosition, wxDefaultSize, 0 ); | |
| 72 m_buttonClose->SetDefault(); | |
| 73 bSizerButton->Add( m_buttonClose, 0, wxALL, 5 ); | |
| 74 | |
| 75 bSizerTop->Add( bSizerButton, 0, wxEXPAND, 5 ); | |
| 76 | |
| 77 this->SetSizer( bSizerTop ); | |
| 78 this->Layout(); | |
| 79 | |
| 80 this->Centre( wxBOTH ); | |
| 81 | |
| 3 | 82 this->SetDropTarget( new DnDFile( m_grid ) ); |
| 2 | 83 SetGridReadOnly(); |
| 84 } | |
| 85 | |
| 86 FrameBatchPrint::~FrameBatchPrint() | |
| 87 { | |
| 88 } | |
| 89 | |
| 90 // Event Table | |
| 91 BEGIN_EVENT_TABLE( FrameBatchPrint, wxDialog ) | |
| 92 EVT_GRID_CELL_CHANGING( FrameBatchPrint::OnInput ) | |
| 93 EVT_BUTTON( ID_BPCLEAR, FrameBatchPrint::OnClear ) | |
|
12
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
94 EVT_BUTTON( ID_BPFFMP, FrameBatchPrint::OnMaskPrint ) |
| 2 | 95 EVT_BUTTON( ID_BPPRINT, FrameBatchPrint::OnPrint ) |
|
12
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
96 EVT_BUTTON( ID_BPLDLOG, FrameBatchPrint::OnLoadLog ) |
| 2 | 97 END_EVENT_TABLE() |
| 98 | |
| 99 // Event Handlers & Functions | |
| 100 /* 氏名などを表示 */ | |
| 101 void FrameBatchPrint::OnInput( wxGridEvent& event ) | |
| 102 { | |
| 103 wxString hhsno = event.GetString(); | |
| 104 int r = event.GetRow(); | |
| 105 for ( int c = 1; c < m_grid->GetNumberCols(); c++ ) | |
| 106 m_grid->SetCellValue( r, c, wxEmptyString ); | |
| 107 | |
| 108 wxArrayString info = wxSplit( GetHhsInfoByHhsNo( hhsno ), '_', '\\' ); | |
| 109 wxArrayString path = GetPathByHhsNo( hhsno ); | |
| 110 | |
| 111 if ( info.IsEmpty() ) info.Add( wxEmptyString ); | |
| 112 if ( path.IsEmpty() ) { | |
| 13 | 113 wxMessageBox( wxT("審査会がありません.") ); |
| 2 | 114 path.Add( wxEmptyString ); |
| 115 } | |
| 116 | |
| 117 m_grid->SetCellValue( r, 1, info[0] ); | |
| 118 m_grid->SetCellValue( r, 2, path[0] ); | |
| 119 } | |
| 120 | |
| 121 /* グリッドをクリア */ | |
| 122 void FrameBatchPrint::OnClear( wxCommandEvent& WXUNUSED(event) ) | |
| 123 { | |
| 124 m_grid->ClearGrid(); | |
| 125 } | |
| 126 | |
| 127 /* 一括印刷処理 */ | |
| 128 void FrameBatchPrint::OnPrint( wxCommandEvent& WXUNUSED(event) ) | |
| 129 { | |
| 130 wxPrintDialogData pd; | |
| 131 wxPrinter p( &pd ); | |
| 132 p.PrintDialog( NULL ); | |
| 6 | 133 wxArrayString log; |
| 2 | 134 |
| 135 for ( int r = 0; r < m_grid->GetNumberRows(); r++ ) { | |
| 136 wxString path = m_grid->GetCellValue( r, 2 ); | |
| 137 | |
| 138 // 印刷用の html を作成 | |
| 139 if ( path.IsEmpty() ) continue; | |
| 140 | |
| 141 wxDir dir( path ); | |
| 142 if ( !dir.IsOpened() ) return; | |
| 143 | |
| 144 wxString html; | |
|
12
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
145 html = wxT("<html><body>\n"); |
| 2 | 146 |
| 147 wxString file; | |
| 148 bool cout = dir.GetFirst( &file, wxT("*.jpg"), wxDIR_FILES ); | |
| 4 | 149 bool notyet_mask = true; |
| 2 | 150 int n = 0; |
| 151 wxString tmpdir = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH; | |
| 152 while ( cout ) { | |
| 153 file = path + wxFILE_SEP_PATH + file; | |
| 154 file.Replace( wxFILE_SEP_PATH, wxT("/") ); | |
| 155 wxString tmpjpg = wxString::Format( wxT("%stmp%d.jpg"), tmpdir, n ); | |
| 156 | |
| 5 | 157 if ( notyet_mask && IsMarksheet( file, m_zmin, m_zmax, m_lmin, m_lmax ) ) { // マークシート表面をマスクする |
| 2 | 158 wxImage img_org( file, wxBITMAP_TYPE_JPEG ); |
| 159 int ver = GetMarksheetVersion( file ); | |
| 160 if ( ver == 2 ) { | |
| 161 img_org.SetRGB( m_mask1, 255, 255, 255 ); // cm name | |
| 162 img_org.SetRGB( m_mask2, 255, 255, 255 ); // cm no. | |
| 163 img_org.SetRGB( m_mask3, 255, 255, 255 ); // barcode | |
| 164 } | |
| 165 else { // 古いマークシート ver == 1 | |
| 166 img_org.SetRGB( m_mask1old, 255, 255, 255 ); // cm name | |
| 167 img_org.SetRGB( m_mask2old, 255, 255, 255 ); // cm no. | |
| 168 img_org.SetRGB( m_mask3old, 255, 255, 255 ); // barcode | |
| 169 } | |
| 170 img_org.SaveFile( tmpjpg ); | |
| 8 | 171 notyet_mask = false; |
| 2 | 172 } |
| 173 else { | |
| 174 wxCopyFile( file, tmpjpg, true ); | |
| 175 } | |
| 176 html = html + wxT("<img src=\"") + tmpjpg + wxT("\" width=\"750\" height=\"1060\"/>"); | |
| 21 | 177 html = html + wxT("<div align=right><font size=-2><u>") + m_grid->GetCellValue( r, 0 ) + wxT("</u></font></div>"); |
| 178 | |
| 2 | 179 cout = dir.GetNext( &file ); |
| 180 n++; | |
| 181 } | |
| 182 html = html + wxT("</body></html>"); | |
| 183 | |
| 184 // start printing | |
| 185 wxHtmlPrintout hpout( wxT("Searcher03") ); | |
| 186 hpout.SetMargins( 0, 0, 0, 0, 0 ); | |
| 187 | |
| 188 hpout.SetHtmlText( html, wxEmptyString, false ); | |
| 189 p.Print( NULL, &hpout, false ); | |
| 190 | |
| 8 | 191 wxString pst = wxT("処理済"); |
| 192 wxString logmsg = path; | |
| 193 if ( notyet_mask ) { | |
| 194 pst.Append( wxT(" 非マスク") ); | |
| 195 logmsg.Append( wxT(" not mask") ); | |
| 196 } | |
| 197 m_grid->SetCellValue( r, 3, pst ); | |
| 198 log.Add( logmsg ); | |
| 2 | 199 } |
| 6 | 200 WriteLog( log ); |
| 2 | 201 } |
| 202 | |
|
12
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
203 /* 一枚目強制マスク印刷 */ |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
204 void FrameBatchPrint::OnMaskPrint( wxCommandEvent& WXUNUSED(event) ) |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
205 { |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
206 wxArrayInt rows = m_grid->GetSelectedRows(); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
207 if ( rows.GetCount() != 1 ) { |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
208 wxMessageDialog md( this, wxT("1件のみ選択してください."), wxT("Message"), wxOK|wxICON_INFORMATION ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
209 md.ShowModal(); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
210 return; |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
211 } |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
212 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
213 wxString path = m_grid->GetCellValue( rows[0], 2 ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
214 wxDir dir( path ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
215 if ( !dir.IsOpened() ) return; |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
216 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
217 wxPrintDialogData pd; |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
218 wxPrinter p( &pd ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
219 p.PrintDialog( NULL ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
220 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
221 // 印刷用の html を作成 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
222 wxString file; |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
223 if ( dir.GetFirst( &file, wxT("*.jpg"), wxDIR_FILES ) ) { |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
224 wxString tmpdir = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH; |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
225 file = path + wxFILE_SEP_PATH + file; |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
226 file.Replace( wxFILE_SEP_PATH, wxT("/") ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
227 wxString tmpjpg = wxString::Format( wxT("%stmp.jpg"), tmpdir ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
228 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
229 wxImage img_org( file, wxBITMAP_TYPE_JPEG ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
230 img_org.SetRGB( m_mask1, 255, 255, 255 ); // cm name |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
231 img_org.SetRGB( m_mask2, 255, 255, 255 ); // cm no. |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
232 img_org.SetRGB( m_mask3, 255, 255, 255 ); // barcode |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
233 img_org.SaveFile( tmpjpg ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
234 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
235 wxString html; |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
236 html = wxT("<html><body>\n"); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
237 html = html + wxT("<img src=\"") + tmpjpg + wxT("\" width=\"750\" height=\"1060\"/>"); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
238 html = html + wxT("</body></html>"); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
239 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
240 // start printing |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
241 wxHtmlPrintout hpout( wxT("Searcher03") ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
242 hpout.SetMargins( 0, 0, 0, 0, 0 ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
243 hpout.SetHtmlText( html, wxEmptyString, false ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
244 p.Print( NULL, &hpout, false ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
245 } |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
246 } |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
247 |
| 2 | 248 /* 入力禁止 */ |
| 249 void FrameBatchPrint::SetGridReadOnly( void ) | |
| 250 { | |
| 251 for ( int r = 0; r < m_grid->GetNumberRows(); r++ ) | |
| 252 for ( int c = 1; c < m_grid->GetNumberCols(); c++ ) | |
| 253 m_grid->SetReadOnly( r, c, true ); | |
| 254 } | |
| 255 | |
|
12
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
256 /* 印刷ログ表示 */ |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
257 void FrameBatchPrint::OnLoadLog( wxCommandEvent& WXUNUSED(event) ) |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
258 { |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
259 wxFileDialog fd( this, wxT("Choose a file"), wxT("log"), wxEmptyString, wxT("log files (*.log)|bp_*.log"), wxFD_OPEN|wxFD_FILE_MUST_EXIST ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
260 if ( fd.ShowModal() == wxID_CANCEL ) |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
261 return; |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
262 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
263 m_grid->ClearGrid(); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
264 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
265 wxTextFile logfile; |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
266 logfile.Open( fd.GetPath() ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
267 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
268 // |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
269 int d = logfile.GetLineCount() - m_grid->GetNumberRows(); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
270 if ( d > 0 ) |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
271 m_grid->AppendRows( d, true ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
272 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
273 wxArrayString hhsno; |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
274 wxString hhs, path, stat; |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
275 for ( int n = 0; n < logfile.GetLineCount(); n++ ) { |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
276 hhs = logfile[n].AfterLast( wxFILE_SEP_PATH ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
277 stat = hhs.AfterFirst( ' ' ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
278 hhs = hhs.BeforeFirst( ' ' ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
279 path = logfile[n]; |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
280 if ( !stat.IsEmpty() ) { |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
281 path = path.BeforeFirst( ' ' ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
282 } |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
283 m_grid->SetCellValue( n, 0, hhs ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
284 m_grid->SetCellValue( n, 2, path ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
285 m_grid->SetCellValue( n, 3, stat ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
286 hhsno.Add( hhs ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
287 } |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
288 for ( int n = 0; n < hhsno.GetCount(); n++ ) { |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
289 wxArrayString info = wxSplit( GetHhsInfoByHhsNo( hhsno[n] ), '_', '\\' ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
290 m_grid->SetCellValue( n, 1, info[0] ); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
291 } |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
292 logfile.Close(); |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
293 } |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
294 |
|
52958cd4a073
Implement Force Mask button in Batch Print Mode.
pyon@macmini
parents:
8
diff
changeset
|
295 /* 印刷ログ出力 */ |
| 6 | 296 void FrameBatchPrint::WriteLog( wxArrayString logline ) |
| 297 { | |
| 298 wxDateTime now = wxDateTime::Now(); | |
| 299 wxString log_file = wxGetCwd() + wxFILE_SEP_PATH + wxT("log") + wxFILE_SEP_PATH + wxT("bp_") + now.Format( wxT("%Y%m%d%H%M%S.log") ); | |
| 300 wxTextFile file( log_file ); | |
| 301 file.Create(); | |
| 302 wxTextFile logfile; | |
| 303 logfile.Open( log_file ); | |
| 2 | 304 |
| 6 | 305 for ( int n = 0; n < logline.GetCount(); n++ ) { |
| 306 logfile.AddLine( logline[n] ); | |
| 307 } | |
| 308 logfile.Write(); | |
| 309 logfile.Close(); | |
| 310 } | |
| 311 |
