changeset 10:29021e6e1ebe

Implement thumbnail list in PreviewDialog.
author pyon@macmini
date Mon, 28 Apr 2014 18:14:04 +0900
parents b455f2d8aac9
children dfcf8c973219
files include/myframe.h include/preview.h src/index.cpp src/myframe.cpp src/preview.cpp
diffstat 5 files changed, 170 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/include/myframe.h	Thu Apr 24 18:31:39 2014 +0900
+++ b/include/myframe.h	Mon Apr 28 18:14:04 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : myframe.h
-// Last Change: 23-Apr-2014.
+// Last Change: 28-Apr-2014.
 //
 #ifndef __MYFRAME_H__
 #define __MYFRAME_H__
@@ -30,6 +30,7 @@
 {
 	private:
         wxArrayString m_imagefiles;
+        wxArrayString m_cachefiles;
 	
 	protected:
 		wxStaticBitmap* m_bitmap0;
@@ -49,8 +50,8 @@
         void OnDClick3( wxMouseEvent& event );
         void OnDClick4( wxMouseEvent& event );
         void OnDClick5( wxMouseEvent& event );
-        void SetImages( wxString dirpath );	
-        void Preview( int n );
+        void SetCacheImages( wxString dirpath );	
+        void DoPreview( int n );
 };
 
 ///////////////////////////////////////////////////////////////
@@ -129,17 +130,9 @@
     ID_MNABOUT,
 
     ID_LIST,
-
     ID_THUMB,
-    ID_THBMP0,
-    ID_THBMP1,
-    ID_THBMP2,
-    ID_THBMP3,
-    ID_THBMP4,
-    ID_THBMP5,
 
     ID_SEARCH,
-
     ID_KANA,
     ID_HIST,
 };
--- a/include/preview.h	Thu Apr 24 18:31:39 2014 +0900
+++ b/include/preview.h	Mon Apr 28 18:14:04 2014 +0900
@@ -1,24 +1,57 @@
 // Filename   : preview.h
-// Last Change: 23-Apr-2014.
+// Last Change: 28-Apr-2014.
 //
 
 #ifndef __PREVIEW_H__
 #define __PREVIEW_H__
 
 #include "common.h"
+class PreviewDialog;
 
+// ƒTƒ€ƒlƒCƒ‹ƒpƒlƒ‹
+class PThumbnailPanel : public wxPanel 
+{
+	private:
+        PreviewDialog* m_parent;
+        wxArrayString  m_imagefiles;
+        wxArrayString  m_cachefiles;
+	
+	protected:
+		wxStaticBitmap* m_bitmap0;
+		wxStaticBitmap* m_bitmap1;
+		wxStaticBitmap* m_bitmap2;
+		wxStaticBitmap* m_bitmap3;
+		wxStaticBitmap* m_bitmap4;
+		wxStaticBitmap* m_bitmap5;
+	
+	public:
+		PThumbnailPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ); 
+		~PThumbnailPanel();
+
+        void OnClick0( wxMouseEvent& event );
+        void OnClick1( wxMouseEvent& event );
+        void OnClick2( wxMouseEvent& event );
+        void OnClick3( wxMouseEvent& event );
+        void OnClick4( wxMouseEvent& event );
+        void OnClick5( wxMouseEvent& event );
+        void SetFiles( wxArrayString imagefiles, wxArrayString cachefiles );	
+        void Preview( int n );
+};
+
+// ƒvƒŒƒrƒ…[ƒ_ƒCƒAƒƒO
 class PreviewDialog : public wxDialog 
 {
     DECLARE_EVENT_TABLE()
 	private:
-        wxImageList*      m_imageList;
         wxString          m_preview;
         wxString          m_dir;
+        wxArrayString     m_imagefiles;
+        wxArrayString     m_cachefiles;
 	
 	protected:
         wxScrolledWindow* m_scrolledWindow;
 		wxStaticBitmap*   m_bitmap;
-        wxListCtrl*       m_listCtrl;
+        PThumbnailPanel*  m_thumbPanel;
 		wxButton*         m_buttonPrint;
 		wxButton*         m_buttonClose;
 	
@@ -26,13 +59,13 @@
 		PreviewDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ); 
 		~PreviewDialog();
 	
-        void SetImage( wxString file );
+        void SetFiles( wxArrayString imagefiles, wxArrayString cachefiles );
+        void SetPreviewImage( int n );
         void OnPrint( wxCommandEvent& event );
 };
 
 enum {
-    ID_PRINT = wxID_HIGHEST + 80,
-    ID_PLIST,
+    ID_PRINT = wxID_HIGHEST + 160,
 };
 
 #endif //__PREVIEW_H__
--- a/src/index.cpp	Thu Apr 24 18:31:39 2014 +0900
+++ b/src/index.cpp	Mon Apr 28 18:14:04 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : index.cpp
-// Last Change: 01-Nov-2013.
+// Last Change: 28-Apr-2014.
 //
 
 #include "index.h"
@@ -117,7 +117,7 @@
     wxString buf;
     for ( int i = 0; i < ccn.GetCount(); i++ ) {
         m_listCtrl->InsertItem( i, -1 );
-        buf.Printf( wxT("%02d"), i + 1 );
+        buf.Printf( wxT("%03d"), i + 1 );
         m_listCtrl->SetItem( i, 0, buf, -1 ); // No
 
         wxArrayString ary = wxSplit( ccn[i], '_', '\\' ); // hhsno, path, date
--- a/src/myframe.cpp	Thu Apr 24 18:31:39 2014 +0900
+++ b/src/myframe.cpp	Mon Apr 28 18:14:04 2014 +0900
@@ -1,5 +1,5 @@
 // Filename   : myframe.cpp
-// Last Change: 24-Apr-2014.
+// Last Change: 28-Apr-2014.
 //
 #include "main.h"
 #include "db.h"
@@ -13,6 +13,7 @@
 #include "myframe.h"
 #include "bprint.h"
 
+#define DEBUG 1
 
 ///////////////////////////////////////////////////////////////
 // γ‚«γ‚Ήγ‚Ώγƒ ζ€œη΄’γƒœγƒƒγ‚―γ‚Ή
@@ -104,27 +105,27 @@
     wxString thumb = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("thumbnail.png");
     wxBitmap bmp = wxBitmap( thumb, wxBITMAP_TYPE_PNG );
 	
-	m_bitmap0 = new wxStaticBitmap( this, ID_THBMP0, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
+	m_bitmap0 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
 	bSizer->Add( m_bitmap0, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
     m_bitmap0->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick0 ), NULL, this );
 	
-	m_bitmap1 = new wxStaticBitmap( this, ID_THBMP1, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
+	m_bitmap1 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
 	bSizer->Add( m_bitmap1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
     m_bitmap1->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick1 ), NULL, this );
 	
-	m_bitmap2 = new wxStaticBitmap( this, ID_THBMP2, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
+	m_bitmap2 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
 	bSizer->Add( m_bitmap2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
     m_bitmap2->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick2 ), NULL, this );
 	
-	m_bitmap3 = new wxStaticBitmap( this, ID_THBMP3, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
+	m_bitmap3 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
 	bSizer->Add( m_bitmap3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
     m_bitmap3->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick3 ), NULL, this );
 	
-	m_bitmap4 = new wxStaticBitmap( this, ID_THBMP4, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
+	m_bitmap4 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
 	bSizer->Add( m_bitmap4, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
     m_bitmap4->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick4 ), NULL, this );
 	
-	m_bitmap5 = new wxStaticBitmap( this, ID_THBMP5, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
+	m_bitmap5 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
 	bSizer->Add( m_bitmap5, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
     m_bitmap5->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( ThumbnailPanel::OnDClick5 ), NULL, this );
 	
@@ -144,10 +145,11 @@
 
 // Functions
 /* ァムネむル葨瀺 */
-void ThumbnailPanel::SetImages( wxString dirpath )
+void ThumbnailPanel::SetCacheImages( wxString dirpath )
 {
     wxDir dir( dirpath );
     if ( !dir.IsOpened() ) return;
+
     m_imagefiles.Clear();
     wxDir::GetAllFiles( dirpath, &m_imagefiles, wxT("*.jpg"), wxDIR_FILES );
 
@@ -155,41 +157,42 @@
     wxDir cdir( cachedir );
     if ( !cdir.IsOpened() ) return;
 
-    wxArrayString cachefiles;
-    wxDir::GetAllFiles( cachedir, &cachefiles, wxT("*.png"), wxDIR_FILES );
+    m_cachefiles.Clear();
+    wxDir::GetAllFiles( cachedir, &m_cachefiles, wxT("*.png"), wxDIR_FILES );
 
     wxString thumb = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("thumbnail.png");
-    int n = cachefiles.GetCount();
+    int n = m_cachefiles.GetCount();
     if ( n < 6 ) {
         while ( n < 6 ) {
-            cachefiles.Add( thumb );
+            m_cachefiles.Add( thumb );
             n++;
         }
     }
 
     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 );
+    bmp.LoadFile( m_cachefiles[0], wxBITMAP_TYPE_PNG ); m_bitmap0->SetBitmap( bmp );
+    bmp.LoadFile( m_cachefiles[1], wxBITMAP_TYPE_PNG ); m_bitmap1->SetBitmap( bmp );
+    bmp.LoadFile( m_cachefiles[2], wxBITMAP_TYPE_PNG ); m_bitmap2->SetBitmap( bmp );
+    bmp.LoadFile( m_cachefiles[3], wxBITMAP_TYPE_PNG ); m_bitmap3->SetBitmap( bmp );
+    bmp.LoadFile( m_cachefiles[4], wxBITMAP_TYPE_PNG ); m_bitmap4->SetBitmap( bmp );
+    bmp.LoadFile( m_cachefiles[5], wxBITMAP_TYPE_PNG ); m_bitmap5->SetBitmap( bmp );
 }
-/* 画像クγƒͺックで拑倧葨瀺 */
-void ThumbnailPanel::OnDClick0( wxMouseEvent& WXUNUSED(event) ) { Preview( 0 ); }
-void ThumbnailPanel::OnDClick1( wxMouseEvent& WXUNUSED(event) ) { Preview( 1 ); }
-void ThumbnailPanel::OnDClick2( wxMouseEvent& WXUNUSED(event) ) { Preview( 2 ); }
-void ThumbnailPanel::OnDClick3( wxMouseEvent& WXUNUSED(event) ) { Preview( 3 ); }
-void ThumbnailPanel::OnDClick4( wxMouseEvent& WXUNUSED(event) ) { Preview( 4 ); }
-void ThumbnailPanel::OnDClick5( wxMouseEvent& WXUNUSED(event) ) { Preview( 5 ); }
-void ThumbnailPanel::Preview( int n )
+/* 画像クγƒͺックダブルで拑倧葨瀺 */
+void ThumbnailPanel::OnDClick0( wxMouseEvent& WXUNUSED(event) ) { DoPreview( 0 ); }
+void ThumbnailPanel::OnDClick1( wxMouseEvent& WXUNUSED(event) ) { DoPreview( 1 ); }
+void ThumbnailPanel::OnDClick2( wxMouseEvent& WXUNUSED(event) ) { DoPreview( 2 ); }
+void ThumbnailPanel::OnDClick3( wxMouseEvent& WXUNUSED(event) ) { DoPreview( 3 ); }
+void ThumbnailPanel::OnDClick4( wxMouseEvent& WXUNUSED(event) ) { DoPreview( 4 ); }
+void ThumbnailPanel::OnDClick5( wxMouseEvent& WXUNUSED(event) ) { DoPreview( 5 ); }
+void ThumbnailPanel::DoPreview( int n )
 {
-    if ( m_imagefiles.GetCount() < n ) return;
+    if ( m_imagefiles.GetCount() < n + 1 ) return;
 
     PreviewDialog* pd = new PreviewDialog( this, wxID_ANY, wxT("プレビγƒ₯γƒΌ"), wxDefaultPosition, wxDefaultSize, wxCAPTION|wxFRAME_NO_TASKBAR );
     pd->Show();
     pd->Maximize( true );
-    pd->SetImage( m_imagefiles[n] );
+    pd->SetFiles( m_imagefiles, m_cachefiles );
+    pd->SetPreviewImage( n );
 }
 
 ///////////////////////////////////////////////////////////////
@@ -776,7 +779,7 @@
     item.SetMask( wxLIST_MASK_TEXT );
     m_listCtrl->GetItem( item );
 
-    m_thumbPanel->SetImages( item.GetText() );
+    m_thumbPanel->SetCacheImages( item.GetText() );
 }
 /* γ‚Ήγƒ†γƒΌγ‚Ώγ‚ΉγƒγƒΌγ«γƒ‘γƒƒγ‚»γƒΌγ‚Έγ‚’ε‡ΊεŠ› */
 void MyFrame::SetStatusMessage( wxString msg, long n )
--- a/src/preview.cpp	Thu Apr 24 18:31:39 2014 +0900
+++ b/src/preview.cpp	Mon Apr 28 18:14:04 2014 +0900
@@ -1,16 +1,94 @@
 // Filename   : preview.cpp
-// Last Change: 24-Apr-2014.
+// Last Change: 28-Apr-2014.
 //
 
 #include "preview.h"
 #define THUMB_W 60
 #define THUMB_H 75
 
+// ァムネむルパネル
+PThumbnailPanel::PThumbnailPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) 
+    : wxPanel( parent, id, pos, size, style )
+{
+    m_parent = (PreviewDialog*)parent;
+
+	wxBoxSizer* bSizer = new wxBoxSizer( wxVERTICAL );
+	this->SetBackgroundColour( wxColour( 192, 192, 192 ) );
+
+    wxString thumb = wxGetCwd() + wxFILE_SEP_PATH + wxT("image") + wxFILE_SEP_PATH + wxT("thumbnail.png");
+    wxBitmap bmp = wxBitmap( thumb, wxBITMAP_TYPE_PNG );
+	
+	m_bitmap0 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
+	bSizer->Add( m_bitmap0, 0, wxALL|wxALIGN_CENTER, 5 );
+    m_bitmap0->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( PThumbnailPanel::OnClick0 ), NULL, this );
+	
+	m_bitmap1 = new wxStaticBitmap(this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
+	bSizer->Add( m_bitmap1, 0, wxALL|wxALIGN_CENTER, 5 );
+    m_bitmap1->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( PThumbnailPanel::OnClick1 ), NULL, this );
+	
+	m_bitmap2 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
+	bSizer->Add( m_bitmap2, 0, wxALL|wxALIGN_CENTER, 5 );
+    m_bitmap2->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( PThumbnailPanel::OnClick2 ), NULL, this );
+	
+	m_bitmap3 = new wxStaticBitmap(this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
+	bSizer->Add( m_bitmap3, 0, wxALL|wxALIGN_CENTER, 5 );
+    m_bitmap3->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( PThumbnailPanel::OnClick3 ), NULL, this );
+	
+	m_bitmap4 = new wxStaticBitmap( this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
+	bSizer->Add( m_bitmap4, 0, wxALL|wxALIGN_CENTER, 5 );
+    m_bitmap4->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( PThumbnailPanel::OnClick4 ), NULL, this );
+	
+	m_bitmap5 = new wxStaticBitmap(this, wxID_ANY, bmp, wxDefaultPosition, wxSize( THUMB_W, THUMB_H ), 0 );
+	bSizer->Add( m_bitmap5, 0, wxALL|wxALIGN_CENTER, 5 );
+    m_bitmap5->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( PThumbnailPanel::OnClick5 ), NULL, this );
+	
+	this->SetSizer( bSizer );
+	this->Layout();
+}
+
+PThumbnailPanel::~PThumbnailPanel()
+{
+    m_bitmap0->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( PThumbnailPanel::OnClick0 ), NULL, this );
+    m_bitmap1->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( PThumbnailPanel::OnClick1 ), NULL, this );
+    m_bitmap2->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( PThumbnailPanel::OnClick2 ), NULL, this );
+    m_bitmap3->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( PThumbnailPanel::OnClick3 ), NULL, this );
+    m_bitmap4->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( PThumbnailPanel::OnClick4 ), NULL, this );
+    m_bitmap5->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( PThumbnailPanel::OnClick5 ), NULL, this );
+}
+
+// Functions
+/* ァムネむル葨瀺 */
+void PThumbnailPanel::SetFiles( wxArrayString imagefiles, wxArrayString cachefiles )
+{
+    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 );
+}
+/* 画像クγƒͺックで拑倧葨瀺 */
+void PThumbnailPanel::OnClick0( wxMouseEvent& WXUNUSED(event) ) { Preview( 0 ); }
+void PThumbnailPanel::OnClick1( wxMouseEvent& WXUNUSED(event) ) { Preview( 1 ); }
+void PThumbnailPanel::OnClick2( wxMouseEvent& WXUNUSED(event) ) { Preview( 2 ); }
+void PThumbnailPanel::OnClick3( wxMouseEvent& WXUNUSED(event) ) { Preview( 3 ); }
+void PThumbnailPanel::OnClick4( wxMouseEvent& WXUNUSED(event) ) { Preview( 4 ); }
+void PThumbnailPanel::OnClick5( wxMouseEvent& WXUNUSED(event) ) { Preview( 5 ); }
+void PThumbnailPanel::Preview( int n )
+{
+    if ( m_imagefiles.GetCount() < n + 1 ) return;
+    m_parent->SetPreviewImage( n );
+}
+
+
+////////////////////////////////////////////////////////
+// プレビγƒ₯ーダむをログ
 PreviewDialog::PreviewDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) 
     : wxDialog( parent, id, title, pos, size, style )
 {
-	//this->SetSizeHints( wxDefaultSize, wxDefaultSize );
-	
 	wxBoxSizer* bSizerTop = new wxBoxSizer( wxHORIZONTAL );
 
     m_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxALWAYS_SHOW_SB );
@@ -19,12 +97,8 @@
 	
 	wxBoxSizer* bSizerMenu = new wxBoxSizer( wxVERTICAL );
 	
-    /*
-	m_listCtrl = new wxListCtrl( this, ID_PLIST, wxDefaultPosition, wxSize( 140, -1 ), wxLC_ICON );
-    m_imageList = new wxImageList( THUMB_W, THUMB_H );
-    m_listCtrl->AssignImageList( m_imageList, wxIMAGE_LIST_NORMAL );
-	bSizerMenu->Add( m_listCtrl, 1, wxRIGHT|wxLEFT|wxBOTTOM|wxEXPAND, 5 );
-    */
+    m_thumbPanel = new PThumbnailPanel( this, wxID_ANY, wxDefaultPosition, wxSize( 100, -1 ), wxSUNKEN_BORDER );
+	bSizerMenu->Add( m_thumbPanel, 0, wxALL|wxEXPAND, 5 );
 
 	m_buttonPrint = new wxButton( this, ID_PRINT, wxT("印刷"), wxDefaultPosition, wxDefaultSize, 0 );
 	bSizerMenu->Add( m_buttonPrint, 0, wxALL, 5 );
@@ -51,19 +125,26 @@
 
 #define WIDTH  2480
 #define HEIGHT 3509
-void PreviewDialog::SetImage( wxString file )
+void PreviewDialog::SetPreviewImage( int n )
 {
     int w, h;
     m_scrolledWindow->GetSize( &w, &h );
     h = h * WIDTH / ( w - 200 );
 
     wxImage img;
-    img.LoadFile( file, wxBITMAP_TYPE_JPEG );
+    img.LoadFile( m_imagefiles[n], wxBITMAP_TYPE_JPEG );
     wxBitmap bmp( img.Scale( w, h, wxIMAGE_QUALITY_HIGH ) );
     m_bitmap->SetBitmap( bmp );
 
     m_scrolledWindow->SetScrollbars( 10, 10, 0, h/10 );
-    m_preview = file;
+    m_preview = m_imagefiles[n];
+}
+
+void PreviewDialog::SetFiles( wxArrayString imagefiles, wxArrayString cachefiles )
+{ 
+    m_imagefiles = imagefiles;
+    m_cachefiles = cachefiles;
+    m_thumbPanel->SetFiles( m_imagefiles, m_cachefiles );
 }
 
 void PreviewDialog::OnPrint( wxCommandEvent& WXUNUSED(envet) )