Mercurial > mercurial > hgweb_mover2.cgi
changeset 40:ce5b61376fd0 v2.7 tip
complete dirview.
author | pyon@macmini |
---|---|
date | Fri, 25 Nov 2011 22:08:47 +0900 |
parents | e0ebc6a4c4dc |
children | |
files | include/dirview.h src/dirview.cpp src/myframe.cpp |
diffstat | 3 files changed, 28 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/include/dirview.h Fri Nov 25 22:08:10 2011 +0900 +++ b/include/dirview.h Fri Nov 25 22:08:47 2011 +0900 @@ -1,5 +1,5 @@ // Filename : dirview.h -// Last Change: 24-Nov-2011. +// Last Change: 25-Nov-2011. // #ifndef __dirview__ @@ -11,6 +11,7 @@ { DECLARE_EVENT_TABLE() private: + wxWindow* m_parent; protected: wxListCtrl* m_listCtrl;
--- a/src/dirview.cpp Fri Nov 25 22:08:10 2011 +0900 +++ b/src/dirview.cpp Fri Nov 25 22:08:47 2011 +0900 @@ -1,20 +1,22 @@ // Filename : dirview.cpp -// Last Change: 24-Nov-2011. +// Last Change: 25-Nov-2011. // #include "dirview.h" -#define THUMB_W 160 -#define THUMB_H 226 +#define THUMB_W 240 +#define THUMB_H 340 // frame constructor DirViewFrame::DirViewFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) { + m_parent = parent; this->SetBackgroundColour( wxColour(wxT("WHEAT")) ); wxBoxSizer* bSizerTop = new wxBoxSizer( wxHORIZONTAL ); m_listCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ICON ); + m_listCtrl->SetBackgroundColour(wxT("LIGHT GREY")); bSizerTop->Add( m_listCtrl, 1, wxEXPAND|wxALL, 5 ); wxBoxSizer* bSizerButton = new wxBoxSizer( wxVERTICAL ); @@ -22,15 +24,14 @@ m_buttonExplorer = new wxButton( this, ID_BUTTONEXPLR, wxT("フォルダオープン"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerButton->Add( m_buttonExplorer, 1, wxALL, 5 ); m_buttonClose = new wxButton( this, ID_BUTTONCLOSE, wxT("閉じる"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerButton->Add( m_buttonClose, 1, wxALL, 5 ); + bSizerButton->Add( m_buttonClose, 1, wxALIGN_RIGHT|wxALL, 5 ); - bSizerTop->Add( bSizerButton, 0, wxALL, 5 ); + bSizerTop->Add( bSizerButton, 0, wxALIGN_BOTTOM|wxALL, 5 ); this->SetSizer( bSizerTop ); this->Layout(); this->Centre( wxBOTH ); - this->LoadListImage(); } // destructor @@ -48,8 +49,8 @@ void DirViewFrame::OnExplorer(wxCommandEvent& WXUNUSED(event)) { wxString execmd = wxT("explorer ") + m_dir; // hhsdir - //wxExecute( execmd ); - wxMessageBox( execmd ); + wxExecute( execmd ); + //wxMessageBox( execmd ); Close(true); } @@ -61,6 +62,11 @@ // Functions void DirViewFrame::LoadListImage() { + SetTitle( m_dir ); + wxRect rect( m_parent->GetScreenPosition(), wxSize(1800,420) ); + SetSize( rect ); + return; + wxImageList* imageList = new wxImageList( THUMB_W, THUMB_H ); m_listCtrl->AssignImageList( imageList, wxIMAGE_LIST_NORMAL ); @@ -71,8 +77,9 @@ wxImage thumbnail = image.Scale( THUMB_W, THUMB_H, wxIMAGE_QUALITY_HIGH ); wxBitmap bmp( thumbnail ); imageList->Add( bmp ); - m_listCtrl->InsertItem( i, filenames[i], i ); - m_listCtrl->SetItem( i, 0, filenames[i], i ); + wxFileName f( filenames[i] ); + m_listCtrl->InsertItem( i, f.GetFullName(), i ); + m_listCtrl->SetItem( i, 0, f.GetFullName(), i ); } }
--- a/src/myframe.cpp Fri Nov 25 22:08:10 2011 +0900 +++ b/src/myframe.cpp Fri Nov 25 22:08:47 2011 +0900 @@ -1,5 +1,5 @@ // Filename : myframe.cpp -// Last Change: 24-Nov-2011. +// Last Change: 25-Nov-2011. // #include "main.h" @@ -216,7 +216,7 @@ this->Centre( wxBOTH ); - autodetect_mode = true; + autodetect_mode = false; m_timer.SetOwner( this, ID_TIMER ); pd = new wxProgressDialog( wxT("進行状況"), wxT("処理開始..."), 100, this, wxPD_APP_MODAL|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE ); @@ -538,15 +538,16 @@ } by_autodetect = false; - SetStatusText( wxEmptyString, 2 ); + int m = m_listCtrlView->GetSelectedItemCount(); + if ( m != 1 ) SetStatusText( wxString::Format(wxT("%d files selected."),m), 2 ); } /* 画像を選択したとき画像の情報をステータスバーに表示 */ void MyFrame::OnItemSelected(wxListEvent& event) { int i = event.GetIndex(); - int m = m_listCtrlView->GetItemCount(); - m_listCtrlView->SetItemImage( i, i+m ); // 青い画像 + int m = m_listCtrlView->GetSelectedItemCount(); + m_listCtrlView->SetItemImage( i, i+m_listCtrlView->GetItemCount() ); // 青い画像 if ( m != 1 ) { SetStatusText( wxString::Format(wxT("%d files selected."),m), 2 ); @@ -564,7 +565,6 @@ { int i = event.GetIndex(); m_listCtrlView->SetItemImage( i, i ); - SetStatusText( wxString::Format(wxT("%d files selected."),m_listCtrlView->GetSelectedItemCount()), 2 ); } /* 画像のスクリーン表示*/ @@ -677,7 +677,7 @@ m_buttonDetect->Enable(true); SetStatusText( wxEmptyString, 0 ); - m_timer.Start( 2*1000, wxTIMER_ONE_SHOT ); // restart + m_timer.Start( 10*1000, wxTIMER_ONE_SHOT ); // restart } /* 被保険者フォルダを列挙 */ @@ -720,8 +720,9 @@ m_listCtrlHhsDir->GetItem( item ); hhsdir.Append( item.GetText() ); - DirViewFrame* dvf = new DirViewFrame( this, wxID_ANY, wxEmptyString ); + DirViewFrame* dvf = new DirViewFrame( (wxWindow*)this, wxID_ANY, wxEmptyString ); dvf->m_dir = hhsdir; + dvf->LoadListImage(); dvf->Show(true); }