0
|
1 // Filename : mainframe.cpp
|
1
|
2 // Last Change: 2019-06-09 Sun 17:05:28.
|
0
|
3 //
|
|
4
|
|
5 #include "id.h"
|
|
6 #include "appconf.h"
|
|
7 #include "mainframe.h"
|
|
8
|
|
9 MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style )
|
|
10 : wxFrame( parent, id, title, pos, size, style )
|
|
11 {
|
|
12 CreateControls();
|
|
13
|
1
|
14 AppConf appconf;
|
|
15 wxString dir = appconf.LoadWork();
|
|
16 m_dirPicker->SetPath( dir );
|
|
17
|
0
|
18 m_filelist = new FileList();
|
1
|
19 m_filelist->SetDirectory( dir );
|
0
|
20
|
|
21 m_lookWindow1->SetDefaultParams( 1, SPL_W, SPL_H, SPL_DCW, SPL_DCH );
|
|
22 m_lookWindow2->SetDefaultParams( 2, OPN1_W, OPN1_H, OPN1_DCW, OPN1_DCH );
|
|
23 m_lookWindow3->SetDefaultParams( 3, OPN2_W, OPN2_H, OPN2_DCW, OPN2_DCH );
|
|
24 m_lookWindow3->AddMask();
|
|
25
|
1
|
26 UpdateCanvas();
|
|
27
|
|
28 m_listViewThumb->SetDirectory( dir );
|
|
29
|
|
30 UpdateThumbnail();
|
0
|
31 }
|
|
32
|
|
33 MainFrame::~MainFrame()
|
|
34 {
|
|
35 }
|
|
36
|
|
37 // Event Table
|
|
38 BEGIN_EVENT_TABLE( MainFrame, wxFrame )
|
|
39 /*
|
|
40 EVT_CHOICE( ID_CHOICE, MoverFrame::OnChoice )
|
|
41 EVT_CHECKBOX( ID_CPAPER, MoverFrame::OnPaperCheck )
|
|
42 */
|
|
43 EVT_BUTTON( ID_RST1, MainFrame::OnReset1 )
|
|
44 EVT_BUTTON( ID_RST2, MainFrame::OnReset2 )
|
|
45 EVT_BUTTON( ID_RST3, MainFrame::OnReset3 )
|
|
46 EVT_BUTTON( ID_RST4, MainFrame::OnReset4 )
|
|
47 EVT_BUTTON( ID_PRINT, MainFrame::OnPrint )
|
|
48 EVT_SPINCTRL( ID_SPNW1, MainFrame::OnSpinW1 )
|
1
|
49 EVT_TEXT( ID_HNO, MainFrame::OnHno )
|
|
50 EVT_TEXT_ENTER( ID_HNO, MainFrame::OnHno )
|
|
51 EVT_BUTTON( ID_UPDT, MainFrame::OnUpdate )
|
0
|
52 EVT_CLOSE( MainFrame::OnClose )
|
|
53 /*
|
|
54 EVT_LIST_ITEM_SELECTED( ID_THUMB, MoverFrame::OnThumbItemSelected )
|
|
55 EVT_LIST_ITEM_DESELECTED( ID_THUMB, MoverFrame::OnThumbItemDeselected )
|
|
56 EVT_LIST_ITEM_ACTIVATED( ID_THUMB, MoverFrame::OnThumbItemDClicked )
|
|
57 EVT_DATAVIEW_ITEM_ACTIVATED( ID_RESERVE, MoverFrame::OnListItemDClicked )
|
|
58 EVT_BUTTON( ID_TDEL, MoverFrame::OnThumbDelete)
|
|
59 EVT_SLIDER( ID_ZOOM, MoverFrame::OnZoom )
|
|
60 EVT_TIMER( ID_TIMER, MoverFrame::OnTimer )
|
|
61 EVT_IDLE( MoverFrame::OnIdle )
|
|
62 EVT_CHAR_HOOK( MoverFrame::OnKeyDown )
|
|
63 */
|
|
64 END_EVENT_TABLE()
|
|
65
|
|
66 /* Event Handlers & Functions */
|
|
67 // Event Handlers
|
|
68 void MainFrame::OnReset1( wxCommandEvent& WXUNUSED(event) )
|
|
69 {
|
|
70 m_lookWindow1->ReloadImage();
|
|
71 m_lookWindow1->ResetMask1();
|
|
72 }
|
|
73
|
|
74 void MainFrame::OnReset2( wxCommandEvent& WXUNUSED(event) )
|
|
75 {
|
|
76 m_lookWindow2->ReloadImage();
|
|
77 m_lookWindow2->ResetMask1();
|
|
78 }
|
|
79
|
|
80 void MainFrame::OnReset3( wxCommandEvent& WXUNUSED(event) )
|
|
81 {
|
|
82 m_lookWindow3->ReloadImage();
|
|
83 m_lookWindow3->ResetMask1();
|
|
84 }
|
|
85
|
|
86 void MainFrame::OnReset4( wxCommandEvent& WXUNUSED(event) )
|
|
87 {
|
|
88 m_lookWindow3->ReloadImage();
|
|
89 m_lookWindow3->ResetMask2();
|
|
90 }
|
|
91
|
|
92 void MainFrame::OnPrint( wxCommandEvent& WXUNUSED(event) )
|
|
93 {
|
|
94 wxArrayString files = m_filelist->GetFiles();
|
|
95 if ( files.GetCount() < 6 ) {
|
|
96 MsgBox( "(^^;" );
|
|
97 return;
|
|
98 }
|
|
99
|
|
100 wxString file1 = files[5];
|
|
101 wxString file2 = files[2];
|
|
102 wxString file3 = files[3];
|
|
103 wxString file4 = files[4];
|
|
104
|
|
105 wxString temp1 = "_Trash/01.jpg";
|
|
106 wxString temp2 = "_Trash/02.jpg";
|
|
107 wxString temp3 = "_Trash/03.jpg";
|
|
108 wxString temp4 = "_Trash/04.jpg";
|
|
109
|
|
110 // copy & mask
|
|
111 wxCopyFile( file1, temp1, true );
|
|
112 wxCopyFile( file2, temp2, true );
|
|
113 wxCopyFile( file3, temp3, true );
|
|
114 wxCopyFile( file4, temp4, true );
|
|
115
|
|
116 wxRect rect1 = m_lookWindow1->GetRealMask1Rect();
|
|
117 wxRect rect2 = m_lookWindow2->GetRealMask1Rect();
|
|
118 wxRect rect3 = m_lookWindow3->GetRealMask1Rect();
|
|
119 wxRect rect4 = m_lookWindow3->GetRealMask2Rect();
|
|
120
|
|
121 DoMask( temp2, rect1 );
|
|
122 DoMask( temp3, rect3 );
|
|
123 DoMask( temp3, rect4 );
|
|
124 DoMask( temp4, rect2 );
|
|
125
|
|
126 // make html
|
|
127 int zoom = 100;
|
|
128 wxString html, file;
|
|
129
|
|
130 html = "<html><body>\n";
|
|
131 wxString imgsz = wxString::Format( "\" width=\"%d\" height=\"%d\"", 750 * zoom / 100, 1060 * zoom / 100 );
|
|
132
|
|
133 html = html + "<img src=\"" + temp1 + imgsz + "/>\n";
|
|
134 html = html + "<img src=\"" + temp2 + imgsz + "/>\n";
|
|
135
|
|
136 html = html + "<img src=\"" + temp3 + imgsz + "/>\n";
|
|
137 html = html + "<img src=\"" + temp4 + imgsz + "/>\n";
|
|
138
|
|
139 html = html + "</body></html>";
|
|
140
|
|
141 // start printing
|
|
142 wxHtmlPrintout hpout( "Merge & Move" );
|
|
143 hpout.SetMargins( 0, 0, 0, 0, 0 );
|
|
144 wxPrintDialogData pd;
|
|
145 wxPrinter p( &pd );
|
|
146
|
|
147 hpout.SetHtmlText( html, wxEmptyString, false );
|
|
148 p.Print( NULL, &hpout, true );
|
|
149 }
|
|
150
|
|
151 void MainFrame::OnSpinW1( wxSpinEvent& WXUNUSED(event) )
|
|
152 {
|
|
153 }
|
|
154
|
1
|
155 void MainFrame::OnHno( wxCommandEvent& WXUNUSED(event) )
|
|
156 {
|
|
157 wxString no = m_textCtrlNo->GetValue();
|
|
158 m_textCtrlName->SetBackgroundColour( *wxRED );
|
|
159 m_textCtrlName->SetValue( wxT("It's not a No. style !") );
|
|
160 //if ( no.Len() == 10 ) SetHhsName( no );
|
|
161 }
|
0
|
162 /*
|
|
163 void MainFrame::OnScanner( wxCommandEvent& WXUNUSED(event) )
|
|
164 {
|
|
165 wxExecute( m_scanner );
|
|
166 }
|
|
167 */
|
|
168
|
1
|
169 void MainFrame::OnUpdate( wxCommandEvent& WXUNUSED(event) )
|
|
170 {
|
|
171 UpdateCanvas();
|
|
172 UpdateThumbnail();
|
|
173 }
|
|
174
|
0
|
175 void MainFrame::OnClose( wxCloseEvent& WXUNUSED(event) )
|
|
176 {
|
|
177 if ( !IsIconized() && !IsMaximized() ) {
|
|
178 AppConf appconf;
|
|
179 appconf.SaveRect( GetRect() );
|
|
180 }
|
1
|
181 AppConf appconf;
|
|
182 appconf.SaveWork( m_dirPicker->GetPath() );
|
0
|
183 Destroy();
|
|
184 }
|
|
185
|
|
186 // Functions
|
|
187 void MainFrame::CreateControls( void )
|
|
188 {
|
|
189 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
|
190
|
|
191 // Menu
|
|
192 m_menubar = new wxMenuBar( 0 );
|
|
193 m_menuFile = new wxMenu();
|
|
194 m_menubar->Append( m_menuFile, wxT("File") );
|
|
195
|
|
196 this->SetMenuBar( m_menubar );
|
|
197
|
|
198 wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL );
|
|
199
|
|
200 // Main
|
|
201 wxFlexGridSizer* fgSizerMain = new wxFlexGridSizer( 0, 2, 0, 0 );
|
|
202 fgSizerMain->SetFlexibleDirection( wxBOTH );
|
|
203 fgSizerMain->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
|
204
|
|
205 // Mask & Mearge
|
|
206 wxStaticBoxSizer* sbSizerMerge = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Mask and Merge") ), wxHORIZONTAL );
|
|
207
|
|
208 wxGridBagSizer* gbSizerMask = new wxGridBagSizer( 0, 0 );
|
|
209 gbSizerMask->SetFlexibleDirection( wxBOTH );
|
|
210 gbSizerMask->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
|
211
|
|
212 m_staticTextSpl = new wxStaticText( sbSizerMerge->GetStaticBox(), wxID_ANY, wxT("Special"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
213 gbSizerMask->Add( m_staticTextSpl, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_RIGHT, 5 );
|
|
214
|
|
215 m_staticTextOpn1 = new wxStaticText( sbSizerMerge->GetStaticBox(), wxID_ANY, wxT("Opinion1"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
216 gbSizerMask->Add( m_staticTextOpn1, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_RIGHT, 5 );
|
|
217
|
|
218 m_staticTextOpn2 = new wxStaticText( sbSizerMerge->GetStaticBox(), wxID_ANY, wxT("Opinion2"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
219 gbSizerMask->Add( m_staticTextOpn2, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_RIGHT, 5 );
|
|
220
|
|
221 m_lookWindow1 = new LookWindow( sbSizerMerge->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( SPL_DCW, SPL_DCH ), 0 );
|
|
222 gbSizerMask->Add( m_lookWindow1, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_TOP, 5 );
|
|
223
|
|
224 m_lookWindow2 = new LookWindow( sbSizerMerge->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( OPN1_DCW, OPN1_DCH ), 0 );
|
|
225 gbSizerMask->Add( m_lookWindow2, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_TOP, 5 );
|
|
226
|
|
227 m_lookWindow3 = new LookWindow( sbSizerMerge->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( OPN2_DCW, OPN2_DCH ), 0 );
|
|
228 gbSizerMask->Add( m_lookWindow3, wxGBPosition( 3, 1 ), wxGBSpan( 3, 1 ), wxALL|wxALIGN_TOP, 5 );
|
|
229
|
|
230 m_staticTextX = new wxStaticText( sbSizerMerge->GetStaticBox(), wxID_ANY, wxT("X"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
231 gbSizerMask->Add( m_staticTextX, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM, 5 );
|
|
232
|
|
233 m_staticTextY = new wxStaticText( sbSizerMerge->GetStaticBox(), wxID_ANY, wxT("Y"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
234 gbSizerMask->Add( m_staticTextY, wxGBPosition( 0, 3 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL, 5 );
|
|
235
|
|
236 m_staticTextW = new wxStaticText( sbSizerMerge->GetStaticBox(), wxID_ANY, wxT("W"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
237 gbSizerMask->Add( m_staticTextW, wxGBPosition( 0, 4 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL, 5 );
|
|
238
|
|
239 m_staticTextH = new wxStaticText( sbSizerMerge->GetStaticBox(), wxID_ANY, wxT("H"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
240 gbSizerMask->Add( m_staticTextH, wxGBPosition( 0, 5 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM, 5 );
|
|
241
|
|
242 m_spinCtrlX1 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNX1, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 0 );
|
|
243 gbSizerMask->Add( m_spinCtrlX1, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
244
|
|
245 m_spinCtrlX2 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNX2, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 0 );
|
|
246 gbSizerMask->Add( m_spinCtrlX2, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
247
|
|
248 m_spinCtrlX3 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNX3, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 0 );
|
|
249 gbSizerMask->Add( m_spinCtrlX3, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
250
|
|
251 m_spinCtrlX4 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNX4, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 0 );
|
|
252 gbSizerMask->Add( m_spinCtrlX4, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
253
|
|
254 m_spinCtrlY1 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNY1, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 50 );
|
|
255 gbSizerMask->Add( m_spinCtrlY1, wxGBPosition( 1, 3 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
256
|
|
257 m_spinCtrlY2 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNY2, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 50 );
|
|
258 gbSizerMask->Add( m_spinCtrlY2, wxGBPosition( 2, 3 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
259
|
|
260 m_spinCtrlY3 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNY3, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 50 );
|
|
261 gbSizerMask->Add( m_spinCtrlY3, wxGBPosition( 3, 3 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
262
|
|
263 m_spinCtrlY4 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNY4, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 50 );
|
|
264 gbSizerMask->Add( m_spinCtrlY4, wxGBPosition( 4, 3 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
265
|
|
266 m_spinCtrlW1 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNW1, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 300 );
|
|
267 gbSizerMask->Add( m_spinCtrlW1, wxGBPosition( 1, 4 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
268
|
|
269 m_spinCtrlW2 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNW2, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 300 );
|
|
270 gbSizerMask->Add( m_spinCtrlW2, wxGBPosition( 2, 4 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
271
|
|
272 m_spinCtrlW3 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNW3, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 300 );
|
|
273 gbSizerMask->Add( m_spinCtrlW3, wxGBPosition( 3, 4 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
274
|
|
275 m_spinCtrlW4 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNW4, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 300 );
|
|
276 gbSizerMask->Add( m_spinCtrlW4, wxGBPosition( 4, 4 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
277
|
|
278 m_spinCtrlH1 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNH1, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 100 );
|
|
279 gbSizerMask->Add( m_spinCtrlH1, wxGBPosition( 1, 5 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
280
|
|
281 m_spinCtrlH2 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNH2, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 100 );
|
|
282 gbSizerMask->Add( m_spinCtrlH2, wxGBPosition( 2, 5 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
283
|
|
284 m_spinCtrlH3 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNH3, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 100 );
|
|
285 gbSizerMask->Add( m_spinCtrlH3, wxGBPosition( 3, 5 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
286
|
|
287 m_spinCtrlH4 = new wxSpinCtrl( sbSizerMerge->GetStaticBox(), ID_SPNH4, wxEmptyString, wxDefaultPosition, wxSize( 60, -1 ), wxALIGN_CENTER_HORIZONTAL|wxSP_ARROW_KEYS, 0, 9999, 100 );
|
|
288 gbSizerMask->Add( m_spinCtrlH4, wxGBPosition( 4, 5 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
289
|
|
290 m_buttonReset1 = new wxButton( sbSizerMerge->GetStaticBox(), ID_RST1, wxT("Reset"), wxDefaultPosition, wxSize( 60, -1 ), 0 );
|
|
291 gbSizerMask->Add( m_buttonReset1, wxGBPosition( 1, 6 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
292
|
|
293 m_buttonReset2 = new wxButton( sbSizerMerge->GetStaticBox(), ID_RST2, wxT("Reset"), wxDefaultPosition, wxSize( 60, -1 ), 0 );
|
|
294 gbSizerMask->Add( m_buttonReset2, wxGBPosition( 2, 6 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
295
|
|
296 m_buttonReset3 = new wxButton( sbSizerMerge->GetStaticBox(), ID_RST3, wxT("Reset"), wxDefaultPosition, wxSize( 60, -1 ), 0 );
|
|
297 gbSizerMask->Add( m_buttonReset3, wxGBPosition( 3, 6 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
298
|
|
299 m_buttonReset4 = new wxButton( sbSizerMerge->GetStaticBox(), ID_RST4, wxT("Reset"), wxDefaultPosition, wxSize( 60, -1 ), 0 );
|
|
300 gbSizerMask->Add( m_buttonReset4, wxGBPosition( 4, 6 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP, 5 );
|
|
301
|
|
302 m_buttonMerge = new wxButton( sbSizerMerge->GetStaticBox(), ID_MERGE, wxT("Merge"), wxDefaultPosition, wxSize( 60, -1 ), 0 );
|
|
303 m_buttonMerge->Enable( false );
|
|
304 gbSizerMask->Add( m_buttonMerge, wxGBPosition( 5, 5 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM, 5 );
|
|
305
|
|
306 m_buttonPrint = new wxButton( sbSizerMerge->GetStaticBox(), ID_PRINT, wxT("Print"), wxDefaultPosition, wxSize( 60, -1 ), 0 );
|
|
307 gbSizerMask->Add( m_buttonPrint, wxGBPosition( 5, 6 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM, 5 );
|
|
308
|
|
309 sbSizerMerge->Add( gbSizerMask, 1, wxEXPAND, 5 );
|
|
310
|
|
311 fgSizerMain->Add( sbSizerMerge, 0, wxEXPAND, 5 );
|
|
312
|
|
313 // Dir
|
|
314 wxStaticBoxSizer* sbSizerDir = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Directory Setup") ), wxVERTICAL );
|
|
315
|
|
316 wxFlexGridSizer* fgSizerSetup = new wxFlexGridSizer( 0, 2, 0, 0 );
|
|
317 fgSizerSetup->SetFlexibleDirection( wxBOTH );
|
|
318 fgSizerSetup->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
|
319
|
|
320 m_staticTextDate = new wxStaticText( sbSizerDir->GetStaticBox(), wxID_ANY, wxT("Date"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
|
|
321 sbSizerDir->Add( m_staticTextDate, 0, wxALL, 5 );
|
|
322
|
|
323 m_datePicker = new wxDatePickerCtrl( sbSizerDir->GetStaticBox(), wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN|wxDP_SHOWCENTURY );
|
|
324 sbSizerDir->Add( m_datePicker, 0, wxALL, 5 );
|
|
325
|
|
326 m_staticTextCcn = new wxStaticText( sbSizerDir->GetStaticBox(), wxID_ANY, wxT("CCN"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
|
|
327 sbSizerDir->Add( m_staticTextCcn, 0, wxALL, 5 );
|
|
328
|
|
329 m_comboBox = new wxComboBox( sbSizerDir->GetStaticBox(), wxID_ANY, wxT("Combo!"), wxDefaultPosition, wxSize( 100, -1 ), 0, NULL, 0 );
|
|
330 sbSizerDir->Add( m_comboBox, 0, wxALL, 5 );
|
|
331
|
|
332 m_staticTextDrive = new wxStaticText( sbSizerDir->GetStaticBox(), wxID_ANY, wxT("Drive"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
|
|
333 sbSizerDir->Add( m_staticTextDrive, 0, wxALL, 5 );
|
|
334
|
1
|
335 wxString m_checkListChoices[] = { wxT("C:\\"), wxT("Y:\\"), wxT("Z:\\") };
|
|
336 int m_checkListNChoices = sizeof( m_checkListChoices ) / sizeof( wxString );
|
|
337 m_checkList = new wxCheckListBox( sbSizerDir->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( 100, -1 ), m_checkListNChoices, m_checkListChoices, wxLB_MULTIPLE );
|
|
338 m_checkList->Check( 0, true );
|
|
339 m_checkList->Check( 1, true );
|
|
340 m_checkList->Check( 2, true );
|
|
341 fgSizerSetup->Add( m_checkList, 0, wxALL, 5 );
|
0
|
342
|
|
343 fgSizerSetup->Add( 0, 0, 1, wxEXPAND, 5 );
|
|
344
|
|
345 m_buttonMkdir = new wxButton( sbSizerDir->GetStaticBox(), ID_MKDIR, wxT("Mkdir"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
346 sbSizerDir->Add( m_buttonMkdir, 0, wxALL, 5 );
|
|
347
|
1
|
348 sbSizerDir->Add( fgSizerSetup, 1, wxEXPAND, 5 );
|
0
|
349
|
|
350 m_staticline = new wxStaticLine( sbSizerDir->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
|
351 sbSizerDir->Add( m_staticline, 0, wxEXPAND|wxALL, 5 );
|
|
352
|
|
353 m_checkBox = new wxCheckBox( sbSizerDir->GetStaticBox(), wxID_ANY, wxT("FilingMode"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
354 sbSizerDir->Add( m_checkBox, 0, wxALL|wxALIGN_LEFT, 5 );
|
0
|
355
|
|
356 m_button30 = new wxButton( sbSizerDir->GetStaticBox(), wxID_ANY, wxT("MyButton"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
357 sbSizerDir->Add( m_button30, 0, wxALL|wxALIGN_RIGHT, 5 );
|
|
358
|
|
359 m_buttonFMove = new wxButton( sbSizerDir->GetStaticBox(), ID_FMOVE, wxT("Move"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
360 sbSizerDir->Add( m_buttonFMove, 0, wxALL|wxALIGN_RIGHT, 5 );
|
|
361
|
1
|
362 fgSizerMain->Add( sbSizerDir, 1, wxEXPAND, 5 );
|
0
|
363
|
|
364 // Move
|
|
365 wxStaticBoxSizer* sbSizerMove = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Move") ), wxHORIZONTAL );
|
|
366
|
|
367 wxFlexGridSizer* fgSizerMove = new wxFlexGridSizer( 0, 3, 0, 0 );
|
|
368 fgSizerMove->SetFlexibleDirection( wxBOTH );
|
|
369 fgSizerMove->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
|
370
|
|
371 m_staticTextName = new wxStaticText( sbSizerMove->GetStaticBox(), wxID_ANY, wxT("Name"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
372 fgSizerMove->Add( m_staticTextName, 0, wxALL|wxALIGN_RIGHT, 5 );
|
|
373
|
|
374 m_bitmapName = new wxStaticBitmap( sbSizerMove->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( MNAME_W, MNAME_H ), 0 );
|
|
375 fgSizerMove->Add( m_bitmapName, 0, wxALL, 5 );
|
|
376
|
|
377 m_textCtrlName = new wxTextCtrl( sbSizerMove->GetStaticBox(), wxID_ANY, wxT("Nobi Nobita"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
378 m_textCtrlName->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
|
|
379 fgSizerMove->Add( m_textCtrlName, 0, wxALL|wxALIGN_BOTTOM, 5 );
|
|
380
|
1
|
381 m_staticTextNo = new wxStaticText( sbSizerMove->GetStaticBox(), ID_HNO, wxT("No"), wxDefaultPosition, wxDefaultSize, 0 );
|
0
|
382 fgSizerMove->Add( m_staticTextNo, 0, wxALL|wxALIGN_RIGHT, 5 );
|
|
383
|
|
384 m_bitmapNo = new wxStaticBitmap( sbSizerMove->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( MHNO_W, MHNO_H ), 0 );
|
|
385 fgSizerMove->Add( m_bitmapNo, 0, wxALL, 5 );
|
|
386
|
|
387 m_textCtrlNo = new wxTextCtrl( sbSizerMove->GetStaticBox(), wxID_ANY, wxT("1234567890"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
388 m_textCtrlNo->SetMaxLength( 10 );
|
|
389 fgSizerMove->Add( m_textCtrlNo, 0, wxALL|wxALIGN_BOTTOM, 5 );
|
|
390
|
|
391 fgSizerMove->Add( 50, 0, 1, wxEXPAND, 5 );
|
|
392
|
|
393 m_gauge = new wxGauge( sbSizerMove->GetStaticBox(), wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL );
|
|
394 m_gauge->SetValue( 0 );
|
1
|
395 fgSizerMove->Add( m_gauge, 1, wxALL|wxEXPAND|wxALIGN_TOP, 5 );
|
0
|
396
|
|
397 m_buttonMove = new wxButton( sbSizerMove->GetStaticBox(), ID_MOVE, wxT("Move"), wxDefaultPosition, wxDefaultSize, 0 );
|
1
|
398 fgSizerMove->Add( m_buttonMove, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
0
|
399
|
|
400 sbSizerMove->Add( fgSizerMove, 0, 0, 5 );
|
|
401
|
1
|
402 sbSizerMove->Add( 40, 0, 0, wxEXPAND, 5 );
|
|
403
|
0
|
404 m_dataViewListCtrl = new wxDataViewListCtrl( sbSizerMove->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_MULTIPLE|wxDV_ROW_LINES|wxDV_VERT_RULES );
|
|
405 m_dataViewListColumnNo = m_dataViewListCtrl->AppendTextColumn( wxT("No"), wxDATAVIEW_CELL_INERT, 30, static_cast<wxAlignment>(wxALIGN_RIGHT) , wxDATAVIEW_COL_RESIZABLE );
|
|
406 m_dataViewListColumnHno = m_dataViewListCtrl->AppendTextColumn( wxT("Hno"), wxDATAVIEW_CELL_INERT, 80, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE );
|
|
407 m_dataViewListColumnName = m_dataViewListCtrl->AppendTextColumn( wxT("Name"), wxDATAVIEW_CELL_INERT, 80, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE );
|
|
408 m_dataViewListColumnN = m_dataViewListCtrl->AppendTextColumn( wxT("N"), wxDATAVIEW_CELL_INERT, 40, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE );
|
|
409 m_dataViewListColumnDrv1 = m_dataViewListCtrl->AppendTextColumn( wxT("C:"), wxDATAVIEW_CELL_INERT, 30, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE );
|
|
410 m_dataViewListColumnDrv2 = m_dataViewListCtrl->AppendTextColumn( wxT("Y:"), wxDATAVIEW_CELL_INERT, 30, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE );
|
|
411 m_dataViewListColumnDrv3 = m_dataViewListCtrl->AppendTextColumn( wxT("Z:"), wxDATAVIEW_CELL_INERT, 30, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE );
|
|
412 m_dataViewListColumnEtc = m_dataViewListCtrl->AppendTextColumn( wxT("Status"), wxDATAVIEW_CELL_INERT, -1, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE );
|
|
413 sbSizerMove->Add( m_dataViewListCtrl, 1, wxALL|wxEXPAND, 5 );
|
|
414
|
|
415 fgSizerMain->Add( sbSizerMove, 0, wxEXPAND, 5 );
|
|
416
|
|
417 wxStaticBoxSizer* sbSizerManip;
|
|
418 sbSizerManip = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Manip") ), wxVERTICAL );
|
|
419
|
|
420 m_buttonWork = new wxButton( sbSizerManip->GetStaticBox(), ID_WORK, wxT("WorkDir"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
421 sbSizerManip->Add( m_buttonWork, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
|
422
|
|
423 m_buttonScan = new wxButton( sbSizerManip->GetStaticBox(), ID_SCAN, wxT("Scanner"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
424 sbSizerManip->Add( m_buttonScan, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
|
425
|
|
426 fgSizerMain->Add( sbSizerManip, 1, wxEXPAND, 5 );
|
|
427
|
|
428 bSizerTop->Add( fgSizerMain, 1, wxEXPAND, 5 );
|
|
429
|
|
430 // Work
|
|
431 wxStaticBoxSizer* sbSizerWork = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxT("Work") ), wxVERTICAL );
|
|
432
|
|
433 wxBoxSizer* bSizerWork = new wxBoxSizer( wxHORIZONTAL );
|
|
434
|
|
435 m_staticTextWork = new wxStaticText( sbSizerWork->GetStaticBox(), wxID_ANY, wxT("Folder"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
|
|
436 bSizerWork->Add( m_staticTextWork, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
437
|
|
438 m_dirPicker = new wxDirPickerCtrl( sbSizerWork->GetStaticBox(), wxID_ANY, wxEmptyString, wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_CHANGE_DIR|wxDIRP_DIR_MUST_EXIST|wxDIRP_SMALL|wxDIRP_USE_TEXTCTRL );
|
|
439 bSizerWork->Add( m_dirPicker, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
440
|
|
441 m_buttonSelectAll = new wxButton( sbSizerWork->GetStaticBox(), ID_SELALL, wxT("Select All"), wxDefaultPosition, wxSize( 60, -1 ), 0 );
|
|
442 bSizerWork->Add( m_buttonSelectAll, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
443
|
|
444 m_buttonDel = new wxButton( sbSizerWork->GetStaticBox(), ID_SELDEL, wxT("Delete"), wxDefaultPosition, wxSize( 60, -1 ), 0 );
|
|
445 bSizerWork->Add( m_buttonDel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
446
|
|
447 m_slider = new wxSlider( sbSizerWork->GetStaticBox(), ID_SLDR, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
|
|
448 bSizerWork->Add( m_slider, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
449
|
|
450 m_buttonUpdate = new wxButton( sbSizerWork->GetStaticBox(), ID_UPDT, wxT("Refresh"), wxDefaultPosition, wxSize( 60,-1 ), 0 );
|
|
451 bSizerWork->Add( m_buttonUpdate, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
|
452
|
1
|
453 sbSizerWork->Add( bSizerWork, 0, wxEXPAND, 5 );
|
0
|
454
|
1
|
455 m_listViewThumb = new ListThumbnail( sbSizerWork->GetStaticBox(), ID_THUMB, wxDefaultPosition, wxDefaultSize, wxLC_ICON );
|
|
456 //m_listViewThumb->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) );
|
|
457 sbSizerWork->Add( m_listViewThumb, 1, wxALL|wxEXPAND, 5 );
|
0
|
458
|
|
459 bSizerTop->Add( sbSizerWork, 1, wxEXPAND, 5 );
|
|
460
|
|
461 // Log
|
|
462 m_collapsiblePane = new wxCollapsiblePane( this, wxID_ANY, wxT("Message"), wxDefaultPosition, wxDefaultSize, wxCP_DEFAULT_STYLE );
|
|
463 m_collapsiblePane->Collapse( false );
|
|
464
|
|
465 wxBoxSizer* bSizerMsg = new wxBoxSizer( wxVERTICAL );
|
|
466
|
|
467 m_textCtrlMsg = new wxTextCtrl( m_collapsiblePane->GetPane(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
468 bSizerMsg->Add( m_textCtrlMsg, 1, wxALL|wxEXPAND, 5 );
|
|
469
|
|
470 m_collapsiblePane->GetPane()->SetSizer( bSizerMsg );
|
|
471 m_collapsiblePane->GetPane()->Layout();
|
|
472 bSizerMsg->Fit( m_collapsiblePane->GetPane() );
|
|
473
|
|
474 bSizerTop->Add( m_collapsiblePane, 1, wxEXPAND|wxALL, 5 );
|
|
475
|
|
476 this->SetSizer( bSizerTop );
|
|
477 this->Layout();
|
|
478
|
|
479 this->Centre( wxBOTH );
|
|
480 }
|
|
481
|
1
|
482 void MainFrame::UpdateCanvas( void )
|
0
|
483 {
|
|
484 wxArrayString files = m_filelist->Update();
|
|
485 int n = files.GetCount();
|
|
486 if ( n < 6 ) {
|
|
487 LookMarksheet( m_testpattern );
|
|
488 m_lookWindow1->SetFile( m_testpattern );
|
|
489 m_lookWindow2->SetFile( m_testpattern );
|
|
490 m_lookWindow3->SetFile( m_testpattern );
|
|
491 } else {
|
|
492 LookMarksheet( files[0] );
|
|
493 m_lookWindow1->SetFile( files[2] );
|
|
494 m_lookWindow2->SetFile( files[4] );
|
|
495 m_lookWindow3->SetFile( files[3] );
|
|
496 }
|
|
497
|
|
498 m_lookWindow1->ResetMask1();
|
|
499 m_lookWindow2->ResetMask1();
|
|
500 m_lookWindow3->ResetMask1();
|
|
501 m_lookWindow3->ResetMask2();
|
|
502 }
|
|
503
|
1
|
504 void MainFrame::UpdateThumbnail( void )
|
|
505 {
|
|
506 m_listViewThumb->Reload();
|
|
507 }
|
|
508
|
0
|
509 void MainFrame::LookMarksheet( wxString file )
|
|
510 {
|
|
511 wxImage marksheet( file, wxBITMAP_TYPE_JPEG );
|
|
512 wxRect rect_name( 480, 1040, 1400, 380 );
|
|
513 wxRect rect_hno( 2700, 440, 1200, 200 );
|
|
514
|
|
515 // 氏名画像を表示
|
|
516 wxImage name_image = marksheet.GetSubImage( rect_name );
|
|
517 wxBitmap name_bmp = name_image.Scale( MNAME_W, MNAME_H, wxIMAGE_QUALITY_HIGH );
|
|
518 m_bitmapName->SetBitmap( name_bmp );
|
|
519
|
|
520 // 被保険者番号画像を表示
|
|
521 wxImage hhsno_image = marksheet.GetSubImage( rect_hno );
|
|
522 wxBitmap hhsno_bmp = hhsno_image.Scale( MHNO_W, MHNO_H, wxIMAGE_QUALITY_HIGH );
|
|
523 m_bitmapNo->SetBitmap( hhsno_bmp );
|
|
524
|
|
525 /*
|
|
526 // 推測
|
1
|
527 wxString no = GuessHhs( file, rect_mhno );
|
|
528 m_textCtrlNo->SetValue( no );
|
|
529 SetHhsName( no );
|
0
|
530 */
|
|
531 }
|
|
532
|
|
533 void MainFrame::DoMask( wxString file, wxRect rect )
|
|
534 {
|
|
535 wxImage img_org( file, wxBITMAP_TYPE_JPEG );
|
|
536 //img_org.SetRGB( rect, 255, 255, 255 );
|
|
537 img_org.SetRGB( rect, 0, 255, 0 );
|
|
538 img_org.SaveFile( file );
|
|
539 }
|
|
540
|