Mercurial > mercurial > hgweb_searcher2.cgi
changeset 12:9452ed888d10
start EazyPrint implementation.
author | pyon@macmini |
---|---|
date | Sun, 26 Jun 2011 13:43:46 +0900 |
parents | 07adad93df84 |
children | 3e045b68738a 5ce7757b4350 |
files | include/myframe.h src/myframe.cpp |
diffstat | 2 files changed, 36 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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; // 履歴機能
--- 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><body>"); + html = html + wxT("<img src=\"") + file + wxT("\" width=\"750\" height=\"1060\"/>"); + html = html + wxT("</body></html>"); + + 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 )