Mercurial > mercurial > hgweb_searcher2.cgi
comparison src/preview.cpp @ 5:0f566397974e
add Edit button.
author | pyon@macmini |
---|---|
date | Wed, 13 Apr 2011 18:30:41 +0900 |
parents | d924b09ea2f3 |
children | c6099901f666 |
comparison
equal
deleted
inserted
replaced
4:d924b09ea2f3 | 5:0f566397974e |
---|---|
1 // Filename : preview.cpp | 1 // Filename : preview.cpp |
2 // Last Change: 09-Apr-2011. | 2 // Last Change: 13-Apr-2011. |
3 // | 3 // |
4 | 4 |
5 #include "preview.h" | 5 #include "preview.h" |
6 | 6 |
7 // for all others, include the necessary headers (this file is usually all you | 7 // for all others, include the necessary headers (this file is usually all you |
13 | 13 |
14 | 14 |
15 // constructor | 15 // constructor |
16 FramePreview::FramePreview( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) | 16 FramePreview::FramePreview( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) |
17 { | 17 { |
18 this->SetSize( 1600, 950 ); | 18 this->SetSize( 1400, 1000 ); |
19 this->SetBackgroundColour( wxColour(wxT("WHEAT")) ); | |
19 | 20 |
20 wxBoxSizer* bSizer; | 21 wxBoxSizer* bSizer; |
21 bSizer = new wxBoxSizer( wxHORIZONTAL ); | 22 bSizer = new wxBoxSizer( wxHORIZONTAL ); |
22 | 23 |
23 // LeftPain ( thumbnail ) | 24 // LeftPain ( thumbnail ) |
24 wxBoxSizer* bSizerL; | 25 wxBoxSizer* bSizerL; |
25 bSizerL = new wxBoxSizer( wxVERTICAL ); | 26 bSizerL = new wxBoxSizer( wxVERTICAL ); |
26 | 27 |
27 m_listCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxSize( 140, 900 ), wxLC_ICON|wxLC_SINGLE_SEL ); | 28 m_listCtrl = new wxListCtrl( this, ID_LSTCTRL, wxDefaultPosition, wxSize( 160, 900 ), wxLC_ICON|wxLC_SINGLE_SEL ); |
28 bSizerL->Add( m_listCtrl, 1, wxEXPAND|wxALL|wxALIGN_CENTRE, 5 ); | 29 bSizerL->Add( m_listCtrl, 1, wxEXPAND|wxALL|wxALIGN_CENTRE, 0 ); |
29 m_imageList = new wxImageList( 105, 148 ); | 30 m_imageList = new wxImageList( 105, 148 ); |
30 m_listCtrl->AssignImageList( m_imageList, wxIMAGE_LIST_NORMAL ); | 31 m_listCtrl->AssignImageList( m_imageList, wxIMAGE_LIST_NORMAL ); |
31 | 32 |
32 bSizer->Add( bSizerL, 0, wxEXPAND, 5 ); | 33 bSizer->Add( bSizerL, 0, wxEXPAND, 5 ); |
33 | 34 |
34 // MainPain ( preview ) | 35 // MainPain ( preview ) |
35 m_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); | 36 m_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); |
36 m_scrolledWindow->SetScrollbars( 10, 10, 83, 117 ); | 37 m_scrolledWindow->SetScrollbars( 10, 10, 83, 117 ); |
37 //m_scrolledWindow->SetScrollRate( 5, 5 ); | 38 //m_scrolledWindow->SetScrollRate( 5, 5 ); |
38 m_bitmap = new wxStaticBitmap( m_scrolledWindow, ID_IMG, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); | 39 m_bitmap = new wxStaticBitmap( m_scrolledWindow, ID_IMG, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); |
39 bSizer->Add( m_scrolledWindow, 1, wxEXPAND | wxALL, 5 ); | 40 bSizer->Add( m_scrolledWindow, 1, wxEXPAND|wxALL, 0 ); |
40 //bSizer->Add( m_bitmap, 0, wxALL, 5 ); | |
41 | 41 |
42 // RightPain ( manip ) | 42 // RightPain ( manip ) |
43 wxBoxSizer* bSizerR; | 43 wxBoxSizer* bSizerR; |
44 bSizerR = new wxBoxSizer( wxVERTICAL ); | 44 bSizerR = new wxBoxSizer( wxVERTICAL ); |
45 | 45 |
55 m_staticTextSmall = new wxStaticText( this, wxID_ANY, wxT("[-]"), wxDefaultPosition, wxDefaultSize, 0 ); | 55 m_staticTextSmall = new wxStaticText( this, wxID_ANY, wxT("[-]"), wxDefaultPosition, wxDefaultSize, 0 ); |
56 bSizerR->Add( m_staticTextSmall, 0, wxALL, 5 ); | 56 bSizerR->Add( m_staticTextSmall, 0, wxALL, 5 ); |
57 | 57 |
58 bSizerR->Add( 0, 0, 1, wxEXPAND, 5 ); | 58 bSizerR->Add( 0, 0, 1, wxEXPAND, 5 ); |
59 | 59 |
60 m_buttonEdit = new wxButton( this, ID_PRINT, wxT("編集"), wxDefaultPosition, wxDefaultSize, 0 ); | |
61 bSizerR->Add( m_buttonEdit, 0, wxALL|wxALIGN_CENTRE, 5 ); | |
62 m_buttonMask = new wxButton( this, ID_PRINT, wxT("マスク"), wxDefaultPosition, wxDefaultSize, 0 ); | |
63 bSizerR->Add( m_buttonMask, 0, wxALL|wxALIGN_CENTRE, 5 ); | |
60 m_buttonPrint = new wxButton( this, ID_PRINT, wxT("印刷"), wxDefaultPosition, wxDefaultSize, 0 ); | 64 m_buttonPrint = new wxButton( this, ID_PRINT, wxT("印刷"), wxDefaultPosition, wxDefaultSize, 0 ); |
61 bSizerR->Add( m_buttonPrint, 0, wxALL, 5 ); | 65 bSizerR->Add( m_buttonPrint, 0, wxALL|wxALIGN_CENTRE, 5 ); |
62 m_buttonPrintAll = new wxButton( this, ID_PRTALL, wxT("一括印刷"), wxDefaultPosition, wxDefaultSize, 0 ); | 66 m_buttonPrintAll = new wxButton( this, ID_PRTALL, wxT("一括印刷"), wxDefaultPosition, wxDefaultSize, 0 ); |
63 bSizerR->Add( m_buttonPrintAll, 0, wxALL, 5 ); | 67 bSizerR->Add( m_buttonPrintAll, 0, wxALL|wxALIGN_CENTRE, 5 ); |
64 m_buttonClose = new wxButton( this, ID_CLSFRM, wxT("閉じる"), wxDefaultPosition, wxDefaultSize, 0 ); | 68 m_buttonClose = new wxButton( this, ID_CLSFRM, wxT("閉じる"), wxDefaultPosition, wxDefaultSize, 0 ); |
65 bSizerR->Add( m_buttonClose, 0, wxALL, 5 ); | 69 bSizerR->Add( m_buttonClose, 0, wxALL|wxALIGN_CENTRE, 5 ); |
66 | 70 |
67 bSizer->Add( bSizerR, 0, wxEXPAND, 5 ); | 71 bSizer->Add( bSizerR, 0, wxEXPAND, 5 ); |
68 | 72 |
69 this->SetSizer( bSizer ); | 73 this->SetSizer( bSizer ); |
70 this->Layout(); | 74 this->Layout(); |
79 { | 83 { |
80 } | 84 } |
81 | 85 |
82 // Event Table | 86 // Event Table |
83 BEGIN_EVENT_TABLE( FramePreview, wxFrame ) | 87 BEGIN_EVENT_TABLE( FramePreview, wxFrame ) |
88 //EVT_LIST_ITEM_SELECTED( ID_LSTCTRL, FramePreview::ChageImage ) | |
84 //EVT_BUTTON( ID_PRINT, FramePreview::PrintImage ) | 89 //EVT_BUTTON( ID_PRINT, FramePreview::PrintImage ) |
85 //EVT_BUTTON( ID_PRTALL, FramePreview::PrintAllImages ) | 90 //EVT_BUTTON( ID_PRTALL, FramePreview::PrintAllImages ) |
86 EVT_BUTTON( ID_CLSFRM, FramePreview::CloseFrame ) | 91 EVT_BUTTON( ID_CLSFRM, FramePreview::CloseFrame ) |
87 END_EVENT_TABLE() | 92 END_EVENT_TABLE() |
88 | 93 |
91 { | 96 { |
92 this->Close(); | 97 this->Close(); |
93 return; | 98 return; |
94 } | 99 } |
95 | 100 |
101 void FramePreview::ChageImage(wxCommandEvent& WXUNUSED(event)) | |
102 { | |
103 return; | |
104 } | |
105 | |
96 // Functions | 106 // Functions |
97 void FramePreview::LoadImages(wxString path) | 107 void FramePreview::LoadImages(wxString path) |
98 { | 108 { |
99 path = wxGetCwd() + wxT("/testdrive"); // now test! | 109 path = wxGetCwd() + wxT("/testdrive"); // now test! |
100 wxDir dir(path); | 110 wxDir dir(path); |
101 wxString file; | 111 wxString file; |
102 if ( !dir.IsOpened() ) return; | 112 if ( !dir.IsOpened() ) return; |
103 | 113 |
104 bool cout = dir.GetFirst( &file, wxT("*.jpg"), wxDIR_FILES ); | 114 bool cout = dir.GetFirst( &file, wxT("*.jpg"), wxDIR_FILES ); |
115 // preview | |
105 if ( cout ) { | 116 if ( cout ) { |
106 wxString mfile = path + wxFILE_SEP_PATH + file; | 117 wxString mfile = path + wxFILE_SEP_PATH + file; |
107 wxImage img( mfile, wxBITMAP_TYPE_JPEG ); | 118 wxImage img( mfile, wxBITMAP_TYPE_JPEG ); |
108 wxBitmap bmp( img.Scale( 640, 877, wxIMAGE_QUALITY_HIGH ) ); | 119 wxBitmap bmp( img.Scale( 640, 877, wxIMAGE_QUALITY_HIGH ) ); |
109 m_bitmap->SetBitmap( bmp); | 120 m_bitmap->SetBitmap( bmp); |
110 } | 121 } |
122 // thumbnail | |
111 int i=0; | 123 int i=0; |
112 while ( cout ) { | 124 while ( cout ) { |
113 m_listCtrl->InsertItem( i, file, i ); | 125 m_listCtrl->InsertItem( i, file, i ); |
114 file = path + wxFILE_SEP_PATH + file; | 126 file = path + wxFILE_SEP_PATH + file; |
115 wxImage img( file, wxBITMAP_TYPE_JPEG ); | 127 wxImage img( file, wxBITMAP_TYPE_JPEG ); |