Mercurial > mercurial > hgweb_searcher03.cgi
diff src/myframe.cpp @ 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 |
line wrap: on
line diff
--- 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) )