Mercurial > mercurial > hgweb_searcher03.cgi
diff src/preview.cpp @ 13:bbd65edf71d4
Implement Hhs DB update dialog.
author | pyon@macmini |
---|---|
date | Sat, 24 May 2014 10:25:13 +0900 |
parents | 52958cd4a073 |
children | ac17a73e39b3 |
line wrap: on
line diff
--- a/src/preview.cpp Sun May 18 19:49:15 2014 +0900 +++ b/src/preview.cpp Sat May 24 10:25:13 2014 +0900 @@ -1,5 +1,5 @@ // Filename : preview.cpp -// Last Change: 16-May-2014. +// Last Change: 23-May-2014. // #include "marksheet.h" @@ -59,17 +59,20 @@ // Functions /* サムネイル表示 */ -void PThumbnailPanel::SetFiles( wxArrayString imagefiles, wxArrayString cachefiles ) +void PThumbnailPanel::SetFiles( wxArrayString imagefiles, wxArrayString cachefiles, int select ) { m_imagefiles = imagefiles; wxBitmap bmp; - bmp.LoadFile( cachefiles[0], wxBITMAP_TYPE_PNG ); m_bitmap0->SetBitmap( bmp ); - bmp.LoadFile( cachefiles[1], wxBITMAP_TYPE_PNG ); m_bitmap1->SetBitmap( bmp ); - bmp.LoadFile( cachefiles[2], wxBITMAP_TYPE_PNG ); m_bitmap2->SetBitmap( bmp ); - bmp.LoadFile( cachefiles[3], wxBITMAP_TYPE_PNG ); m_bitmap3->SetBitmap( bmp ); - bmp.LoadFile( cachefiles[4], wxBITMAP_TYPE_PNG ); m_bitmap4->SetBitmap( bmp ); - bmp.LoadFile( cachefiles[5], wxBITMAP_TYPE_PNG ); m_bitmap5->SetBitmap( bmp ); + m_imageList.Create( THUMB_W, THUMB_H ); + + bmp.LoadFile( cachefiles[0], wxBITMAP_TYPE_PNG ); m_imageList.Add( bmp ); + bmp.LoadFile( cachefiles[1], wxBITMAP_TYPE_PNG ); m_imageList.Add( bmp ); + bmp.LoadFile( cachefiles[2], wxBITMAP_TYPE_PNG ); m_imageList.Add( bmp ); + bmp.LoadFile( cachefiles[3], wxBITMAP_TYPE_PNG ); m_imageList.Add( bmp ); + bmp.LoadFile( cachefiles[4], wxBITMAP_TYPE_PNG ); m_imageList.Add( bmp ); + bmp.LoadFile( cachefiles[5], wxBITMAP_TYPE_PNG ); m_imageList.Add( bmp ); + SetImageList( select ); } /* 画像クリックで拡大表示 */ void PThumbnailPanel::OnClick0( wxMouseEvent& WXUNUSED(event) ) { Preview( 0 ); } @@ -81,9 +84,48 @@ void PThumbnailPanel::Preview( int n ) { if ( m_imagefiles.GetCount() < n + 1 ) return; + SetImageList( n ); m_parent->SetPreviewImage( n ); } +/* サムネイル表示 */ +void PThumbnailPanel::SetImageList( int selected ) +{ + m_bitmap0->SetBitmap( m_imageList.GetBitmap(0) ); + m_bitmap1->SetBitmap( m_imageList.GetBitmap(1) ); + m_bitmap2->SetBitmap( m_imageList.GetBitmap(2) ); + m_bitmap3->SetBitmap( m_imageList.GetBitmap(3) ); + m_bitmap4->SetBitmap( m_imageList.GetBitmap(4) ); + m_bitmap5->SetBitmap( m_imageList.GetBitmap(5) ); + wxImage image = m_imageList.GetBitmap( selected ).ConvertToImage(); + unsigned char *data = image.GetData(); + for ( int y = 0; y < THUMB_H; y++ ) + for ( int x = 0; x <THUMB_W; x++ ) + data[ ( y * THUMB_W + x ) * 3 + 2 ] = 255; // 文字色:黒(0,0,0)->青(0,0,255) + + wxBitmap bmp_mask( image ); + + switch ( selected ) { + case 0: + m_bitmap0->SetBitmap( bmp_mask ); + break; + case 1: + m_bitmap1->SetBitmap( bmp_mask ); + break; + case 2: + m_bitmap2->SetBitmap( bmp_mask ); + break; + case 3: + m_bitmap3->SetBitmap( bmp_mask ); + break; + case 4: + m_bitmap4->SetBitmap( bmp_mask ); + break; + case 5: + m_bitmap5->SetBitmap( bmp_mask ); + break; + } +} //////////////////////////////////////////////////////// // プレビューダイアログ @@ -156,11 +198,11 @@ m_textInfo->SetValue( info ); } -void PreviewDialog::SetFiles( wxArrayString imagefiles, wxArrayString cachefiles ) +void PreviewDialog::SetFiles( wxArrayString imagefiles, wxArrayString cachefiles, int select ) { m_imagefiles = imagefiles; m_cachefiles = cachefiles; - m_thumbPanel->SetFiles( m_imagefiles, m_cachefiles ); + m_thumbPanel->SetFiles( m_imagefiles, m_cachefiles, select ); wxString title = wxT("プレビュー @ ") + m_imagefiles[0].BeforeLast( wxFILE_SEP_PATH ); this->SetTitle( title );