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