Mercurial > mercurial > hgweb_searcher03.cgi
changeset 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 | |
files | Changes doc/Searcher03の機能.docx doc/Searcher03の機能.pdf image/0000000000.png image/0123456789.png image/logo2.png image/notfound.png image/to_mover.png include/bprint.h include/common.h include/dndfile.h include/myframe.h include/preview.h src/bprint.cpp src/main.cpp src/myframe.cpp src/preview.cpp |
diffstat | 17 files changed, 240 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Wed Dec 17 00:52:43 2014 +0900 +++ b/Changes Sat Apr 04 17:23:46 2015 +0900 @@ -1,3 +1,9 @@ +version 03.25 +2015-04-06 + Implement Masking function on Preview Dialog. + Show Batch-Print dialog by D&D. + +---- version 03.24 2014-12-14 Enhanced the convenience of Cache dialog.
--- a/include/bprint.h Wed Dec 17 00:52:43 2014 +0900 +++ b/include/bprint.h Sat Apr 04 17:23:46 2015 +0900 @@ -1,5 +1,5 @@ // Filename : bprint.h -// Last Change: 16-May-2014. +// Last Change: 2015-04-04 10:30:01. // #ifndef __BPRINT_H__ #define __BPRINT_H__ @@ -10,14 +10,14 @@ { DECLARE_EVENT_TABLE() private: - wxRect m_mask1; - wxRect m_mask2; - wxRect m_mask3; - wxRect m_mask1old; - wxRect m_mask2old; - wxRect m_mask3old; - long m_lmin, m_lmax; - double m_zmin, m_zmax; + wxRect m_mask1; + wxRect m_mask2; + wxRect m_mask3; + wxRect m_mask1old; + wxRect m_mask2old; + wxRect m_mask3old; + long m_lmin, m_lmax; + double m_zmin, m_zmax; protected: wxGrid* m_grid; @@ -39,6 +39,7 @@ void OnMaskPrint( wxCommandEvent& WXUNUSED(event) ); void OnLoadLog( wxCommandEvent& WXUNUSED(event) ); void SetMark( long lmin, long lmax, double zmin, double zmax ) { m_lmin = lmin; m_lmax = lmax; m_zmin = zmin; m_zmax = zmax; } + void LoadCSV( wxString file ); // Accessor void SetMask1( wxRect rect ) { m_mask1 = rect; }
--- a/include/common.h Wed Dec 17 00:52:43 2014 +0900 +++ b/include/common.h Sat Apr 04 17:23:46 2015 +0900 @@ -1,5 +1,5 @@ // Filename : common.h -// Last Change: 05-Jun-2014. +// Last Change: 2015-04-03 18:56:14. // #ifndef __COMMON_H__ #define __COMMON_H__ @@ -47,6 +47,7 @@ #include <wx/clipbrd.h> #include <wx/html/htmprint.h> #include <wx/datectrl.h> +#include <wx/bmpbuttn.h> #include <wx/xrc/xmlres.h> #endif
--- a/include/dndfile.h Wed Dec 17 00:52:43 2014 +0900 +++ b/include/dndfile.h Sat Apr 04 17:23:46 2015 +0900 @@ -1,10 +1,13 @@ // Filename : dndfile.h -// Last Change: 12-Sep-2013. +// Last Change: 2015-04-04 11:10:10. // #ifndef __DNDFILE_H__ #define __DNDFILE_H__ #include "db.h" +#include "wx/config.h" +#include "wx/fileconf.h" +#include "myframe.h" class DnDFile : public wxFileDropTarget { @@ -54,5 +57,27 @@ private: wxGrid* m_grid; }; - + +class DnDFile2 : public wxFileDropTarget +{ + public: + DnDFile2( MyFrame *frame ) + { + m_frame = frame; + } + virtual bool OnDropFiles( wxCoord x, wxCoord y, const wxArrayString& filenames ) + { + size_t nFiles = filenames.GetCount(); + if ( nFiles != 1 ) return false; + + m_frame->ShowBPrintFrame( filenames[0] ); + + return true; + } + + private: + MyFrame* m_frame; +}; + #endif //__DNDFILE_H__ +
--- a/include/myframe.h Wed Dec 17 00:52:43 2014 +0900 +++ b/include/myframe.h Sat Apr 04 17:23:46 2015 +0900 @@ -1,5 +1,5 @@ // Filename : myframe.h -// Last Change: 12-Dec-2014. +// Last Change: 2015-04-03 17:57:42. // #ifndef __MYFRAME_H__ #define __MYFRAME_H__ @@ -81,6 +81,7 @@ wxMenu* m_menuParam; wxPanel* m_panelMain; wxStaticBitmap* m_bitmap; + wxBitmapButton* m_mvButton; wxTextCtrl* m_textCtrlName; wxTextCtrl* m_textCtrlAddr; wxListCtrl* m_listCtrl; @@ -97,6 +98,7 @@ ~MyFrame(); void OnBPrintMode( wxCommandEvent& WXUNUSED(event) ); + void ShowBPrintFrame( wxString csv ); void OnIndex( wxCommandEvent& WXUNUSED(event) ); void OnCache( wxCommandEvent& WXUNUSED(event) ); void OnUpdateHhs( wxCommandEvent& WXUNUSED(event) ); @@ -113,10 +115,18 @@ void OnKana( wxCommandEvent& WXUNUSED(event) ); void OnHistory( wxCommandEvent& WXUNUSED(event) ); void OnCommand( wxCommandEvent& WXUNUSED(event) ); + void OnMover( wxCommandEvent& WXUNUSED(event) ); void UpdateList( wxString hhsno ); void UpdateThumbmail( int n ); - void PrintImages( wxString hhsno ); + void PrintImages( wxString hhsno, int n ); void SetParams( int tab ); + wxRect GetMask1( void ) { return m_mask1; }; + wxRect GetMask2( void ) { return m_mask2; }; + wxRect GetMask3( void ) { return m_mask3; }; + wxRect GetMask1Old( void ) { return m_mask1old; }; + wxRect GetMask2Old( void ) { return m_mask2old; }; + wxRect GetMask3Old( void ) { return m_mask3old; }; + void DisableMover( void ); void SetStatusMessage( wxString msg, long n ); void OnWinSize( wxSizeEvent& event ); @@ -131,6 +141,7 @@ ID_MNBPNT = wxID_HIGHEST + 10, ID_MNINDEX, ID_MNCACHE, + ID_MNMOVER, ID_MNHHSDB, ID_MNDBBKUP, ID_MNMASKPARAM, @@ -138,6 +149,7 @@ ID_MNAPPDIR, ID_MNABOUT, + ID_MOVER, ID_LIST, ID_THUMB,
--- a/include/preview.h Wed Dec 17 00:52:43 2014 +0900 +++ b/include/preview.h Sat Apr 04 17:23:46 2015 +0900 @@ -1,5 +1,5 @@ // Filename : preview.h -// Last Change: 09-Jun-2014. +// Last Change: 2015-04-03 11:34:20. // #ifndef __PREVIEW_H__ @@ -49,6 +49,12 @@ wxArrayString m_imagefiles; wxArrayString m_cachefiles; float m_zoom; + wxRect m_mask1; + wxRect m_mask2; + wxRect m_mask3; + wxRect m_mask1old; + wxRect m_mask2old; + wxRect m_mask3old; int cx, cy; protected: @@ -67,15 +73,24 @@ void SetFiles( wxArrayString imagefiles, wxArrayString cachefiles, int select ); void SetZoom( float zoom ); void SetPreviewImage( int n ); + void EnableMaskButton( bool flag ); void OnWheel( wxMouseEvent& event ); void OnDClick( wxMouseEvent& WXUNUSED(event) ); void OnStartRGesture( wxMouseEvent& event ); void OnEndRGesture( wxMouseEvent& event ); void OnPrint( wxCommandEvent& WXUNUSED(event) ); + void OnMaskPrint( wxCommandEvent& WXUNUSED(event) ); + void SetMask1( wxRect rect ) { m_mask1 = rect; } + void SetMask2( wxRect rect ) { m_mask2 = rect; } + void SetMask3( wxRect rect ) { m_mask3 = rect; } + void SetMask1Old( wxRect rect ) { m_mask1old = rect; } + void SetMask2Old( wxRect rect ) { m_mask2old = rect; } + void SetMask3Old( wxRect rect ) { m_mask3old = rect; } }; enum { ID_PRINT = wxID_HIGHEST + 160, + ID_MPRINT, }; #endif //__PREVIEW_H__
--- 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) ) {
--- a/src/main.cpp Wed Dec 17 00:52:43 2014 +0900 +++ b/src/main.cpp Sat Apr 04 17:23:46 2015 +0900 @@ -1,5 +1,5 @@ // Filename : main.cpp -// Last Change: 04-Dec-2014. +// Last Change: 25-Dec-2014. // #include "main.h" #include "myframe.h" @@ -35,6 +35,8 @@ MyFrame *mainframe = new MyFrame( NULL, ID_MAIN, wxT("Searcher 03"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE ); mainframe->SetSize( rect ); mainframe->Show( true ); + if ( mode == 0 ) + mainframe->DisableMover(); } return true;
--- a/src/myframe.cpp Wed Dec 17 00:52:43 2014 +0900 +++ b/src/myframe.cpp Sat Apr 04 17:23:46 2015 +0900 @@ -1,5 +1,5 @@ // Filename : myframe.cpp -// Last Change: 16-Dec-2014. +// Last Change: 2015-04-04 10:29:14. // #include "main.h" #include "db.h" @@ -15,6 +15,7 @@ #include "myframe.h" #include "bprint.h" #include "update.h" +#include "dndfile.h" /////////////////////////////////////////////////////////////// // カスタム検索ボックス @@ -222,17 +223,28 @@ if ( m_imagefiles.GetCount() < n + 1 ) return; PreviewDialog* pd = new PreviewDialog( m_parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxCAPTION|wxFRAME_NO_TASKBAR ); + pd->Show(); pd->Maximize( true ); pd->SetFiles( m_imagefiles, m_cachefiles, n ); + + if ( n == 0 ) pd->EnableMaskButton( true ); + else pd->EnableMaskButton( false ); pd->SetPreviewImage( n ); + + MyFrame* p = (MyFrame*)FindWindowById( ID_MAIN ); + pd->SetMask1( p->GetMask1() ); + pd->SetMask2( p->GetMask2() ); + pd->SetMask3( p->GetMask3() ); + pd->SetMask1Old( p->GetMask1Old() ); + pd->SetMask2Old( p->GetMask2Old() ); + pd->SetMask3Old( p->GetMask3Old() ); } /////////////////////////////////////////////////////////////// // メインフレーム #define WINL_W 480 -#define LOGO_W 200 -#define LOGO_H 92 +#define WINL_H 500 // resources #if !defined(__WXMSW__) && !defined(__WXPM__) @@ -242,7 +254,7 @@ MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxSize( WINL_W, 500 ), wxDefaultSize ); + this->SetSizeHints( wxSize( WINL_W, WINL_H ), wxDefaultSize ); //this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); this->SetBackgroundColour( wxColour(wxT("WHEAT")) ); @@ -264,6 +276,11 @@ m_menuFile->AppendSeparator(); // ---- + wxMenuItem* m_menuItemMover = new wxMenuItem( m_menuFile, ID_MNMOVER, wxString( wxT("Mover 起動(&V)") ) , wxT("Start Mover"), wxITEM_NORMAL ); + m_menuFile->Append( m_menuItemMover ); + + m_menuFile->AppendSeparator(); // ---- + wxMenuItem* m_menuItemHhsdb = new wxMenuItem( m_menuFile, ID_MNHHSDB, wxString( wxT("被保険者DB更新(&U)") ) , wxT("Update HHS databases"), wxITEM_NORMAL ); m_menuFile->Append( m_menuItemHhsdb ); @@ -297,14 +314,24 @@ wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL ); m_panelMain = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizerMain = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bSizerMain = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bSizerLogo = new wxBoxSizer( wxHORIZONTAL ); wxString logo = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("logo.png"); wxBitmap bmp = wxBitmap( logo, wxBITMAP_TYPE_PNG ); - m_bitmap = new wxStaticBitmap( m_panelMain, wxID_ANY, bmp, wxDefaultPosition, wxSize( LOGO_W, LOGO_H ), 0 ); - bSizerMain->Add( m_bitmap, 0, wxALL, 5 ); + m_bitmap = new wxStaticBitmap( m_panelMain, wxID_ANY, bmp, wxDefaultPosition, wxDefaultSize, 0 ); + bSizerLogo->Add( m_bitmap, 0, wxALIGN_CENTER_VERTICAL, 0 ); + + bSizerLogo->AddStretchSpacer(); + + logo = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("to_mover.png"); + bmp.LoadFile( logo, wxBITMAP_TYPE_PNG ); + m_mvButton = new wxBitmapButton( m_panelMain, ID_MOVER, bmp, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); + bSizerLogo->Add( m_mvButton, 0, wxALIGN_TOP, 0 ); + bSizerMain->Add( bSizerLogo, 0, wxEXPAND|wxALL, 5 ); + m_textCtrlName = new wxTextCtrl( m_panelMain, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200, -1 ), 0 ); bSizerMain->Add( m_textCtrlName, 0, wxALL, 5 ); @@ -360,16 +387,19 @@ this->Layout(); // ステータスバー Statusbar - m_statusBar = new wxStatusBar( this, wxID_ANY, wxST_SIZEGRIP ); + m_statusBar = new wxStatusBar( this, wxID_ANY, wxST_SIZEGRIP ); int widths[] = { 200, -1, 10, 90 }; m_statusBar->SetFieldsCount( 4, widths ); this->SetStatusBar( m_statusBar ); SetStatusText( wxT("被保番を入力してスタート!") ); + m_panelMain->SetDropTarget( new DnDFile2( this ) ); + // this->Centre( wxBOTH ); LoadParam(); if ( CheckNewFiles( m_shared ) != 0 ) Close(); + } MyFrame::~MyFrame() @@ -380,6 +410,7 @@ BEGIN_EVENT_TABLE( MyFrame, wxFrame ) EVT_MENU( ID_MNABOUT, MyFrame::OnAbout ) EVT_MENU( wxID_EXIT, MyFrame::OnQuit ) + EVT_MENU( ID_MNMOVER, MyFrame::OnMover ) EVT_MENU( ID_MNBPNT, MyFrame::OnBPrintMode ) EVT_MENU( ID_MNINDEX, MyFrame::OnIndex ) EVT_MENU( ID_MNHHSDB, MyFrame::OnUpdateHhs ) @@ -388,6 +419,7 @@ EVT_MENU( ID_MNMASKPARAM, MyFrame::OnMaskParam ) EVT_MENU( ID_MNMARKPARAM, MyFrame::OnMarkParam ) EVT_MENU( ID_MNAPPDIR, MyFrame::OnOpenAppDir ) + EVT_BUTTON( ID_MOVER, MyFrame::OnMover ) EVT_LIST_ITEM_SELECTED( ID_LIST, MyFrame::OnSelectItem ) EVT_LIST_ITEM_ACTIVATED( ID_LIST, MyFrame::OnDClickItem ) EVT_BUTTON( ID_PASTE, MyFrame::OnPaste ) @@ -416,7 +448,13 @@ } if ( s.IsSameAs( wxT("+") ) ) { - PrintImages( m_hhsno ); + if ( !m_hhsno.IsEmpty() ) { + PrintImages( m_hhsno, 0 ); + } + else { + SetStatusMessage( wxT("被保険者番号がセットされていません."), 0 ); + m_searchBox->SelectAll(); + } return; } @@ -509,7 +547,7 @@ } /* 印刷 */ -void MyFrame::PrintImages( wxString hhsno ) +void MyFrame::PrintImages( wxString hhsno, int pn ) { bool mask_flag = false; wxMessageDialog md( this, wxT("マスクしますか?"), wxT("印刷オプション"), wxYES_NO, wxDefaultPosition ); @@ -521,8 +559,12 @@ wxArrayString path = GetPathByHhsNo( hhsno ); if ( path.IsEmpty() ) return; - wxDir dir( path[0] ); - if ( !dir.IsOpened() ) return; + wxDir dir( path[pn] ); + + if ( !dir.IsOpened() ) { + SetStatusMessage( wxT("変な入力がされました."), 0 ); + return; + } wxString html; html = html + wxT("<html><body>\n"); @@ -580,6 +622,10 @@ /* 一括印刷モード */ void MyFrame::OnBPrintMode( wxCommandEvent& WXUNUSED(event) ) { + ShowBPrintFrame( wxEmptyString ); +} +void MyFrame::ShowBPrintFrame( wxString csv ) +{ FrameBatchPrint* bp = new FrameBatchPrint( this, wxID_ANY, wxT("一括印刷"), wxDefaultPosition, wxSize( 700, 600 ), wxCAPTION|wxFRAME_NO_TASKBAR ); bp->SetMask1( m_mask1 ); bp->SetMask2( m_mask2 ); @@ -589,6 +635,8 @@ bp->SetMask3Old( m_mask3old ); bp->SetMark( lmin, lmax, zmin, zmax ); bp->Show( true ); + + if ( !csv.IsEmpty() ) bp->LoadCSV( csv ); } /* インデックス作成ダイアログ */ void MyFrame::OnIndex( wxCommandEvent& WXUNUSED(event) ) @@ -613,6 +661,14 @@ cache->Listup(); cache->ShowModal(); } +/* Mover 禁止 */ +void MyFrame::DisableMover( void ) +{ + wxMenuItem *mi = m_menuFile->FindItem( ID_MNMOVER ); + mi->Enable( false ); + m_mvButton->Show( false ); + m_mvButton->Enable( false ); +} /* 被保険者DB更新 */ void MyFrame::OnUpdateHhs( wxCommandEvent& WXUNUSED(event) ) { @@ -748,6 +804,11 @@ wxString execmd = wxT("explorer ") + dir; wxExecute( execmd ); } +/* Mover を起動 */ +void MyFrame::OnMover( wxCommandEvent& WXUNUSED(event) ) +{ + wxMessageBox(wxT("a")); +} /* 貼付検索 */ void MyFrame::OnPaste( wxCommandEvent& WXUNUSED(event) )
--- a/src/preview.cpp Wed Dec 17 00:52:43 2014 +0900 +++ b/src/preview.cpp Sat Apr 04 17:23:46 2015 +0900 @@ -1,5 +1,5 @@ // Filename : preview.cpp -// Last Change: 11-Jun-2014. +// Last Change: 2015-04-03 11:57:55. // #include "marksheet.h" @@ -83,6 +83,9 @@ void PThumbnailPanel::OnClick5( wxMouseEvent& WXUNUSED(event) ) { Preview( 5 ); } void PThumbnailPanel::Preview( int n ) { + if ( n == 0 ) m_parent->EnableMaskButton( true ); + else m_parent->EnableMaskButton( false ); + if ( m_imagefiles.GetCount() < n + 1 ) return; SetImageList( n ); m_parent->SetPreviewImage( n ); @@ -154,6 +157,10 @@ m_buttonPrint = new wxButton( this, ID_PRINT, wxT("印刷"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerMenu->Add( m_buttonPrint, 0, wxALL, 5 ); + m_buttonMaskPrint = new wxButton( this, ID_MPRINT, wxT("マスク印刷"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerMenu->Add( m_buttonMaskPrint, 0, wxALL, 5 ); + m_buttonMaskPrint->Enable( false ); + bSizerMenu->Add( 0, 0, 0, 0, 5 ); m_buttonClose = new wxButton( this, wxID_CANCEL, wxT("閉じる"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -169,14 +176,15 @@ PreviewDialog::~PreviewDialog() { m_scrolledWindow->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PreviewDialog::OnWheel ), NULL, this ); - m_bitmap->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( PreviewDialog::OnDClick ), NULL, this ); - m_bitmap->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( PreviewDialog::OnStartRGesture ), NULL, this ); - m_bitmap->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( PreviewDialog::OnEndRGesture ), NULL, this ); + m_bitmap->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( PreviewDialog::OnDClick ), NULL, this ); + m_bitmap->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( PreviewDialog::OnStartRGesture ), NULL, this ); + m_bitmap->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( PreviewDialog::OnEndRGesture ), NULL, this ); } // Event Table BEGIN_EVENT_TABLE( PreviewDialog, wxDialog ) - EVT_BUTTON( ID_PRINT, PreviewDialog::OnPrint ) + EVT_BUTTON( ID_PRINT, PreviewDialog::OnPrint ) + EVT_BUTTON( ID_MPRINT, PreviewDialog::OnMaskPrint ) END_EVENT_TABLE() #define WIDTH 2480 @@ -317,3 +325,44 @@ p.Print( NULL, &hpout, true ); } +/* マスク印刷 */ +void PreviewDialog::OnMaskPrint( wxCommandEvent& WXUNUSED(event) ) +{ + wxString html; + html = html + wxT("<html><body>\n"); + + wxString tmpjpg = wxGetCwd() + wxFILE_SEP_PATH + wxT("tmp") + wxFILE_SEP_PATH + wxT("preview.jpg"); + + wxImage img_org( m_imagefiles[m_preview], wxBITMAP_TYPE_JPEG ); + int ver = GetMarksheetVersion( m_imagefiles[m_preview] ); + if ( ver == 2 ) { + img_org.SetRGB( m_mask1, 255, 255, 255 ); // cm name + img_org.SetRGB( m_mask2, 255, 255, 255 ); // cm no. + img_org.SetRGB( m_mask3, 255, 255, 255 ); // barcode + } + else { // 古いマークシート ver == 1 + img_org.SetRGB( m_mask1old, 255, 255, 255 ); // cm name + img_org.SetRGB( m_mask2old, 255, 255, 255 ); // cm no. + img_org.SetRGB( m_mask3old, 255, 255, 255 ); // barcode + } + img_org.SaveFile( tmpjpg ); + + html = html + wxT("<img src=\"") + tmpjpg + wxT("\" width=\"750\" height=\"1060\"/>"); + html = html + wxT("</body></html>"); + + // start printing + wxHtmlPrintout hpout( wxT("Searcher03") ); + hpout.SetMargins( 0, 0, 0, 0, 0 ); + wxPrintDialogData pd; + wxPrinter p( &pd ); + + hpout.SetHtmlText( html, wxEmptyString, false ); + p.Print( NULL, &hpout, true ); +} + +void PreviewDialog::EnableMaskButton( bool flag ) +{ + if ( flag ) m_buttonMaskPrint->Enable( true ); + else m_buttonMaskPrint->Enable( false ); +} +