comparison src/myframe.cpp @ 13:3e045b68738a

Finish EazyPrint implement.
author pyon@macmini
date Fri, 01 Jul 2011 19:54:15 +0900
parents 9452ed888d10
children b67c74848dd0
comparison
equal deleted inserted replaced
12:9452ed888d10 13:3e045b68738a
1 // Filename : mainframe.cpp 1 // Filename : mainframe.cpp
2 // Last Change: 24-Jun-2011. 2 // Last Change: 01-Jul-2011.
3 // 3 //
4 #include "wx/html/htmprint.h" 4 #include "wx/html/htmprint.h"
5 #include "wx/print.h" 5 #include "wx/print.h"
6 6
7 #include "symbol.h" 7 #include "symbol.h"
163 h->Show(true); 163 h->Show(true);
164 g->Show(false); 164 g->Show(false);
165 165
166 wxRegEx reHhs(wxT("^0[1238][0-9]{8}$")); // 1:被保番チェック 166 wxRegEx reHhs(wxT("^0[1238][0-9]{8}$")); // 1:被保番チェック
167 wxRegEx reCno(wxT("^[0-9]{1,2}$")); // 2:開くフォルダの番号 167 wxRegEx reCno(wxT("^[0-9]{1,2}$")); // 2:開くフォルダの番号
168 wxRegEx rePrint(wxT("^\\.[0-9]*$")); // 3:印刷するフォルダの番号 168 wxRegEx rePrint(wxT("^\\+$")); // 3:印刷するフォルダの番号
169 169
170 wxString cmd; 170 wxString cmd;
171 cmd = this->GetLineText(0); 171 cmd = this->GetLineText(0);
172 int cond = 0; 172 int cond = 0;
173 if ( reHhs.Matches( cmd ) ) 173 if ( reHhs.Matches( cmd ) )
285 path.Shrink(); 285 path.Shrink();
286 286
287 htmlbody += wxT("</table>"); 287 htmlbody += wxT("</table>");
288 htmlbody += wxT("<br />"); 288 htmlbody += wxT("<br />");
289 htmlbody += wxT("<div>"); 289 htmlbody += wxT("<div>");
290 htmlbody += wxT("テンキーの「+」ボタンで番号1の画像を印刷できます.<br />");
290 htmlbody += wxT("フォルダを開くには,番号を入力してください.<br />"); 291 htmlbody += wxT("フォルダを開くには,番号を入力してください.<br />");
291 htmlbody += wxT("他の被保険者を検索するには,被保番を入力してください."); 292 htmlbody += wxT("他の被保険者を検索するには,被保番を入力してください.");
292 htmlbody += wxT("</div>"); 293 htmlbody += wxT("</div>");
293 htmlbody += wxT("</body></html>"); 294 htmlbody += wxT("</body></html>");
294 295
380 } 381 }
381 382
382 // functions 383 // functions
383 void MyCmdBox::PrintImages( wxString& path ) 384 void MyCmdBox::PrintImages( wxString& path )
384 { 385 {
385 wxHtmlPrintout* hpout = new wxHtmlPrintout( wxT("Searcher2") ); 386 wxHtmlPrintout hpout( wxT("Searcher2") );
386 hpout->SetMargins( 0,0,0,0,0 ); 387 hpout.SetMargins( 0,0,0,0,0 );
387 wxPrintDialogData* pd; 388 wxPrintDialogData pd;
388 wxPrinter* p = new wxPrinter( pd ); 389 wxPrinter p( &pd );
389 390
390 wxDir dir(path); 391 wxDir dir(path);
391 wxString file; 392 wxString file;
392 if ( !dir.IsOpened() ) return; 393 if ( !dir.IsOpened() ) return;
393 394
394 bool cout = dir.GetFirst( &file, wxT("*.jpg"), wxDIR_FILES ); 395 bool cout = dir.GetFirst( &file, wxT("*.jpg"), wxDIR_FILES );
396 bool mask_flg = true;
397 wxRect cmname( wxPoint(156,224), wxSize(1204,122) );
398 wxRect cmno( wxPoint(856,1024), wxSize(1060,598) );
395 while ( cout ) { 399 while ( cout ) {
396 file = path + wxFILE_SEP_PATH + file; 400 file = path + wxFILE_SEP_PATH + file;
397 file.Replace( wxT("\\"), wxT("/") ); 401 file.Replace( wxT("\\"), wxT("/") );
398 wxString html; 402 wxString html;
399 html = html + wxT("<html><body>");
400 html = html + wxT("<img src=\"") + file + wxT("\" width=\"750\" height=\"1060\"/>");
401 html = html + wxT("</body></html>");
402 403
403 hpout->SetHtmlText( html, wxEmptyString, false ); 404 if ( mask_flg ) { // 1枚目はマスクする
404 p->Print( NULL, hpout, false ); 405 wxImage img_org( file, wxBITMAP_TYPE_JPEG );
406 img_org.SetRGB( cmname, 255, 255, 255 );
407 img_org.SetRGB( cmno, 255, 255, 255 );
408 img_org.SaveFile( wxT("tmp/tmp.jpg") );
409
410 html = html + wxT("<html><body>");
411 html = html + wxT("<img src=\"tmp/tmp.jpg\" width=\"750\" height=\"1060\"/>");
412 html = html + wxT("</body></html>");
413 hpout.SetHtmlText( html, wxEmptyString, false );
414 p.Print( NULL, &hpout, true );
415 pd = p.GetPrintDialogData();
416 mask_flg = false;
417 }
418 else {
419 html = html + wxT("<html><body>");
420 html = html + wxT("<img src=\"") + file + wxT("\" width=\"750\" height=\"1060\"/>");
421 html = html + wxT("</body></html>");
422 hpout.SetHtmlText( html, wxEmptyString, false );
423 p.Print( NULL, &hpout, false );
424 }
405 cout = dir.GetNext( &file ); 425 cout = dir.GetNext( &file );
406 } 426 }
407 return; 427 return;
408 } 428 }
409 429
615 { 635 {
616 HtmlHelpFrame *f = (HtmlHelpFrame*)FindWindowById( ID_HELP ); 636 HtmlHelpFrame *f = (HtmlHelpFrame*)FindWindowById( ID_HELP );
617 637
618 if ( f == NULL ) { 638 if ( f == NULL ) {
619 HtmlHelpFrame *helpframe = new HtmlHelpFrame( wxT("Online Help"), ID_HELP ); 639 HtmlHelpFrame *helpframe = new HtmlHelpFrame( wxT("Online Help"), ID_HELP );
640 helpframe->SetSize(600,600);
620 helpframe->Show(true); 641 helpframe->Show(true);
621 } 642 }
622 else { 643 else {
623 f->Raise(); 644 f->Raise();
624 } 645 }