# HG changeset patch # User pyon@macmini # Date 1309063426 -32400 # Node ID 9452ed888d101bf922ed5ea5df04733e3174ff45 # Parent 07adad93df8429080c49f508fca5630c432dd64b start EazyPrint implementation. diff -r 07adad93df84 -r 9452ed888d10 include/myframe.h --- a/include/myframe.h Thu Jun 23 20:13:34 2011 +0900 +++ b/include/myframe.h Sun Jun 26 13:43:46 2011 +0900 @@ -1,5 +1,5 @@ // Filename : myframe.h -// Last Change: 09-Apr-2011. +// Last Change: 24-Jun-2011. // #ifndef MYFRAME #define MYFRAME @@ -31,6 +31,7 @@ virtual void OnChar( wxKeyEvent& event ); void OnCmd( wxCommandEvent& event ); + void PrintImages( wxString& path ); wxArrayString path; // 履歴機能 diff -r 07adad93df84 -r 9452ed888d10 src/myframe.cpp --- a/src/myframe.cpp Thu Jun 23 20:13:34 2011 +0900 +++ b/src/myframe.cpp Sun Jun 26 13:43:46 2011 +0900 @@ -1,6 +1,8 @@ // Filename : mainframe.cpp -// Last Change: 23-Jun-2011. +// Last Change: 24-Jun-2011. // +#include "wx/html/htmprint.h" +#include "wx/print.h" #include "symbol.h" #include "common.h" @@ -163,7 +165,7 @@ wxRegEx reHhs(wxT("^0[1238][0-9]{8}$")); // 1:被保番チェック wxRegEx reCno(wxT("^[0-9]{1,2}$")); // 2:開くフォルダの番号 - wxRegEx rePrint(wxT("^\.[0-9]*$")); // 3:印刷するフォルダの番号 + wxRegEx rePrint(wxT("^\\.[0-9]*$")); // 3:印刷するフォルダの番号 wxString cmd; cmd = this->GetLineText(0); @@ -315,7 +317,7 @@ wxTextFile logFile; logFile.Open( logfn ); wxDateTime now = wxDateTime::Now(); - wxString log = now.Format() + wxT(" " ) + cmd + wxT(" ") + path[val]; + wxString log = now.Format() + wxT(" ") + cmd + wxT(" ") + path[val]; logFile.AddLine( log ); logFile.Write(); logFile.Close(); @@ -329,12 +331,11 @@ mf->m_statusBar->SetStatusText( wxT("不適切な入力です.警告コード3"), 0 ); break; } - wxMessageBox(wxT("333")); + PrintImages( path[0] ); break; } // 制御用コマンド case 0: { - path.Clear(); if ( cmd.Cmp(wxT("s")) == 0 ) { hr->LoadPage( wxT("html/start.html") ); @@ -378,6 +379,34 @@ } } +// functions +void MyCmdBox::PrintImages( wxString& path ) +{ + wxHtmlPrintout* hpout = new wxHtmlPrintout( wxT("Searcher2") ); + hpout->SetMargins( 0,0,0,0,0 ); + wxPrintDialogData* pd; + wxPrinter* p = new wxPrinter( pd ); + + wxDir dir(path); + wxString file; + if ( !dir.IsOpened() ) return; + + bool cout = dir.GetFirst( &file, wxT("*.jpg"), wxDIR_FILES ); + while ( cout ) { + file = path + wxFILE_SEP_PATH + file; + file.Replace( wxT("\\"), wxT("/") ); + wxString html; + html = html + wxT(""); + html = html + wxT(""); + html = html + wxT(""); + + hpout->SetHtmlText( html, wxEmptyString, false ); + p->Print( NULL, hpout, false ); + cout = dir.GetNext( &file ); + } + return; +} + ////////////////////////////////////////////////////////////////////////// // frame constructor MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title )