0
|
1 // Filename : searcher.cpp
|
5
|
2 // Last Change: 2021-06-15 火 16:11:11.
|
0
|
3 //
|
|
4 #include <wx/msgdlg.h>
|
|
5 #include <wx/dir.h>
|
|
6 #include <wx/fileconf.h>
|
|
7 #include <wx/html/htmprint.h>
|
|
8 #include <wx/clipbrd.h>
|
|
9 #include <wx/regex.h>
|
|
10 #include "searcher.h"
|
|
11 #include "utils.h"
|
|
12 #include "net.h"
|
|
13
|
|
14 #define PWPREFIX "Jo"
|
|
15 #define PWXORN 23
|
|
16
|
|
17 /** MyStaticBitmap **/
|
|
18 MyStaticBitmap::MyStaticBitmap(wxScrolledWindow *parent, wxWindowID id, const wxBitmap &label, const wxPoint &pos, const wxSize &size, long style, const wxString &name)
|
|
19 : wxStaticBitmap(parent, id, label, pos, size, style, name)
|
|
20 {
|
|
21 m_parent = parent;
|
|
22 Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(MyStaticBitmap::OnLeftDown ), NULL, this);
|
|
23 Connect(wxEVT_LEFT_UP, wxMouseEventHandler(MyStaticBitmap::OnLeftUp ), NULL, this);
|
|
24 Connect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(MyStaticBitmap::OnLeftDClick ), NULL, this);
|
|
25 Connect(wxEVT_RIGHT_DCLICK, wxMouseEventHandler(MyStaticBitmap::OnRightDClick ), NULL, this);
|
|
26 Connect(wxEVT_MOTION, wxMouseEventHandler(MyStaticBitmap::OnMotion ), NULL, this);
|
|
27 Connect(wxEVT_MOUSEWHEEL, wxMouseEventHandler(MyStaticBitmap::OnWheel ), NULL, this);
|
|
28 Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(MyStaticBitmap::OnStartRGesture), NULL, this);
|
|
29 Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(MyStaticBitmap::OnEndRGesture ), NULL, this);
|
|
30 }
|
|
31
|
|
32 MyStaticBitmap::~MyStaticBitmap()
|
|
33 {
|
|
34 Disconnect(wxEVT_LEFT_DOWN, wxMouseEventHandler(MyStaticBitmap::OnLeftDown ), NULL, this);
|
|
35 Disconnect(wxEVT_LEFT_UP, wxMouseEventHandler(MyStaticBitmap::OnLeftUp ), NULL, this);
|
|
36 Disconnect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(MyStaticBitmap::OnLeftDClick ), NULL, this);
|
|
37 Disconnect(wxEVT_RIGHT_DCLICK, wxMouseEventHandler(MyStaticBitmap::OnRightDClick ), NULL, this);
|
|
38 Disconnect(wxEVT_MOTION, wxMouseEventHandler(MyStaticBitmap::OnMotion ), NULL, this);
|
|
39 Disconnect(wxEVT_MOUSEWHEEL, wxMouseEventHandler(MyStaticBitmap::OnWheel ), NULL, this);
|
|
40 Disconnect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(MyStaticBitmap::OnStartRGesture), NULL, this);
|
|
41 Disconnect(wxEVT_RIGHT_UP, wxMouseEventHandler(MyStaticBitmap::OnEndRGesture ), NULL, this);
|
|
42 }
|
|
43
|
|
44 /* Event Handlers */
|
|
45 void MyStaticBitmap::OnWheel(wxMouseEvent& event)
|
|
46 {
|
|
47 /*
|
|
48 if (event.ControlDown()) {
|
|
49 if (event.GetWheelRotation() < 0) {
|
|
50 }
|
|
51 else {
|
|
52 }
|
|
53 return;
|
|
54 }
|
|
55 event.Skip();
|
|
56 */
|
|
57 }
|
|
58
|
|
59 void MyStaticBitmap::OnLeftDown(wxMouseEvent& event)
|
|
60 {
|
|
61 event.GetPosition(&m_dragx, &m_dragy);
|
|
62 SetCursor(wxCursor(wxCURSOR_SIZING));
|
|
63 }
|
|
64
|
|
65 void MyStaticBitmap::OnLeftUp(wxMouseEvent& WXUNUSED(event))
|
|
66 {
|
|
67 SetCursor(wxCursor(wxCURSOR_ARROW));
|
|
68 }
|
|
69
|
|
70 void MyStaticBitmap::OnLeftDClick(wxMouseEvent& event)
|
|
71 {
|
|
72 /*
|
|
73 if (with_stl) return;OnDrvDateSelected
|
|
74 MainFrame* mf = (MainFrame*)FindWindowById(ID_MAIN);
|
|
75 mf->ChangeCZoom(1);
|
|
76 */
|
|
77 }
|
|
78
|
|
79 void MyStaticBitmap::OnRightDClick(wxMouseEvent& event)
|
|
80 {
|
|
81 /*
|
|
82 if (with_stl) return;
|
|
83 MainFrame* mf = (MainFrame*)FindWindowById(ID_MAIN);
|
|
84 mf->ChangeCZoom(-1);
|
|
85 */
|
|
86 }
|
|
87
|
|
88 void MyStaticBitmap::OnMotion(wxMouseEvent& event)
|
|
89 {
|
|
90 if (event.RightIsDown()) return;
|
|
91 if (event.Dragging()) {
|
|
92 int xv, yv, x, y;
|
|
93 m_parent->GetViewStart(&xv, &yv);
|
|
94
|
|
95 event.GetPosition(&x, &y);
|
|
96
|
|
97 int xa = abs(x - m_dragx);
|
|
98 int ya = abs(y - m_dragy);
|
|
99 int xs = x - m_dragx < 0 ? -1 : 1;
|
|
100 int ys = y - m_dragy < 0 ? -1 : 1;
|
|
101
|
|
102 // hantai dakedo sumu-zu
|
|
103 m_parent->Scroll(xv + xs * log10(xa + 1), yv + ys * log10(ya + 1));
|
|
104
|
|
105 m_dragx = x; m_dragy = y;
|
|
106 }
|
|
107 }
|
|
108
|
|
109 /* right-gesture: start detect */
|
|
110 void MyStaticBitmap::OnStartRGesture(wxMouseEvent& event)
|
|
111 {
|
|
112 event.GetPosition(&cx, &cy);
|
|
113 }
|
|
114
|
|
115 /* right-gesture: judge */
|
|
116 void MyStaticBitmap::OnEndRGesture(wxMouseEvent& event)
|
|
117 {
|
|
118 //if (with_stl) return;
|
|
119 int x, y;
|
|
120 event.GetPosition(&x, &y);
|
|
121
|
|
122 int dx = x - cx;
|
|
123 int dy = y - cy;
|
|
124 float rad = fabs(atan2(dy, dx));
|
|
125 float pi = 3.14159;
|
|
126
|
|
127 // to right
|
|
128 if (rad < pi / 8 && dx > 0) {
|
|
129 ChangeBook(1);
|
|
130 }
|
|
131 // to left
|
|
132 else if (rad > pi / 8 * 7 && rad < pi && dx < 0) {
|
|
133 ChangeBook(-1);
|
|
134 }
|
|
135 // to up-right
|
|
136 else if (rad > pi / 8 && rad < pi / 8 * 3 && dx > 0) {
|
|
137 m_parent2->Close();
|
|
138 }
|
|
139 // down
|
|
140 else if (rad > pi / 8 * 3 && rad < pi / 8 * 5 && dy > 0) {
|
|
141 //mf->PrintImages();
|
|
142 }
|
|
143 }
|
|
144
|
|
145 /* Functions */
|
|
146 void MyStaticBitmap::ChangeBook(int i)
|
|
147 {
|
|
148 int n = m_parent1->GetSelection();
|
|
149 if (i < 0) {
|
|
150 if (n > 1) m_parent1->SetSelection(n - 1);
|
|
151 } else {
|
|
152 if (n < 6) m_parent1->SetSelection(n + 1);
|
|
153 }
|
|
154 }
|
|
155
|
|
156 /** SearcherFrame **/
|
|
157 SearchFrame::SearchFrame(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
|
|
158 : wxFrame(parent, id, title, pos, size, style)
|
|
159 {
|
|
160 CreateControls();
|
|
161 InitializeControlsValue();
|
|
162 SetVersionInfo();
|
|
163
|
|
164 // Connect Events
|
|
165 m_notebook->Connect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler(SearchFrame::OnPageChanged), NULL, this);
|
|
166
|
|
167 m_filePicker->Connect(wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEventHandler(SearchFrame::OnFile), NULL, this);
|
|
168 m_buttonRead->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SearchFrame::OnRead), NULL, this);
|
|
169 m_dataViewListCtrlBatch->Connect(wxEVT_CHAR, wxKeyEventHandler(SearchFrame::OnSelectBatchListCtrlA), NULL, this);
|
|
170 m_dataViewListCtrlBatch->Connect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler(SearchFrame::OnSelectBatchDClicked), NULL, this);
|
|
171
|
|
172 m_choiceIdxYear->Connect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(SearchFrame::OnIdxYearChoice), NULL, this);
|
|
173 m_dataViewListCtrlIdxDate->Connect(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler(SearchFrame::OnIdxDateSelected), NULL, this);
|
|
174 m_dataViewListCtrlIdx->Connect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler(SearchFrame::OnIdxDClicked), NULL, this);
|
|
175
|
|
176 m_choiceDrvYear->Connect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(SearchFrame::OnDrvYearChoice), NULL, this);
|
|
177 m_dataViewListCtrlDrvDate->Connect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler(SearchFrame::OnDrvDateDClicked), NULL, this);
|
|
178 m_dataViewListCtrlDrvDate->Connect(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler(SearchFrame::OnDrvDateSelected), NULL, this);
|
|
179 m_dataViewListCtrlDrvCcn->Connect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler(SearchFrame::OnDrvCcnDClicked), NULL, this);
|
|
180 m_dataViewListCtrlDrvCcn->Connect(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler(SearchFrame::OnDrvCcnSelected), NULL, this);
|
|
181 m_dataViewListCtrlDrv->Connect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler(SearchFrame::OnDrvDClicked), NULL, this);
|
|
182
|
|
183 m_buttonRegHhs->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SearchFrame::OnUploadHhsDB), NULL, this);
|
|
184 m_buttonRegImg->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SearchFrame::OnUploadImage), NULL, this);
|
|
185 m_buttonCSV->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SearchFrame::OnDB2CSV), NULL, this);
|
|
186
|
|
187 m_textCtrlUPassword->Connect(wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler(SearchFrame::OnUPassword), NULL, this);
|
|
188 m_buttonPw->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SearchFrame::OnSavePw), NULL, this);
|
|
189
|
|
190 m_searchCtrl->Connect(wxEVT_CHAR, wxKeyEventHandler(SearchFrame::OnChar), NULL, this);
|
|
191 m_buttonPaste->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SearchFrame::OnPaste), NULL, this);
|
|
192 m_dataViewListCtrlAny->Connect(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler(SearchFrame::OnSelectAnyListItem), NULL, this);
|
|
193 m_buttonPrint->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SearchFrame::OnPrint), NULL, this);
|
|
194 m_textCtrlPasswd->Connect(wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler(SearchFrame::OnPassword), NULL, this);
|
|
195
|
|
196 this->Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(SearchFrame::OnClose));
|
|
197 }
|
|
198
|
|
199 SearchFrame::~SearchFrame()
|
|
200 {
|
|
201 // Disconnect Events
|
|
202 m_notebook->Disconnect(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler(SearchFrame::OnPageChanged), NULL, this);
|
|
203
|
|
204 m_buttonRead->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SearchFrame::OnRead), NULL, this);
|
|
205 m_filePicker->Disconnect(wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEventHandler(SearchFrame::OnFile), NULL, this);
|
|
206 m_dataViewListCtrlBatch->Disconnect(wxEVT_CHAR, wxKeyEventHandler(SearchFrame::OnSelectBatchListCtrlA), NULL, this);
|
|
207 m_dataViewListCtrlBatch->Disconnect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler(SearchFrame::OnSelectBatchDClicked), NULL, this);
|
|
208
|
|
209 m_choiceIdxYear->Disconnect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(SearchFrame::OnIdxYearChoice), NULL, this);
|
|
210 m_dataViewListCtrlIdxDate->Disconnect(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler(SearchFrame::OnIdxDateSelected), NULL, this);
|
|
211 m_dataViewListCtrlIdx->Disconnect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler(SearchFrame::OnIdxDClicked), NULL, this);
|
|
212
|
|
213 m_choiceDrvYear->Disconnect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(SearchFrame::OnDrvYearChoice), NULL, this);
|
|
214 m_dataViewListCtrlDrvDate->Disconnect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler(SearchFrame::OnDrvDateDClicked), NULL, this);
|
|
215 m_dataViewListCtrlDrvDate->Disconnect(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler(SearchFrame::OnDrvDateSelected), NULL, this);
|
|
216 m_dataViewListCtrlDrvCcn->Disconnect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler(SearchFrame::OnDrvCcnDClicked), NULL, this);
|
|
217 m_dataViewListCtrlDrvCcn->Disconnect(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler(SearchFrame::OnDrvCcnSelected), NULL, this);
|
|
218 m_dataViewListCtrlDrv->Disconnect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED, wxDataViewEventHandler(SearchFrame::OnDrvDClicked), NULL, this);
|
|
219
|
|
220 m_buttonRegHhs->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SearchFrame::OnUploadHhsDB), NULL, this);
|
|
221 m_buttonRegImg->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SearchFrame::OnUploadImage), NULL, this);
|
|
222 m_buttonCSV->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SearchFrame::OnDB2CSV), NULL, this);
|
|
223
|
|
224 m_textCtrlUPassword->Disconnect(wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler(SearchFrame::OnUPassword), NULL, this);
|
|
225 m_buttonPw->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SearchFrame::OnSavePw), NULL, this);
|
|
226
|
|
227 m_searchCtrl->Disconnect(wxEVT_CHAR, wxKeyEventHandler(SearchFrame::OnChar), NULL, this);
|
|
228 m_buttonPaste->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SearchFrame::OnPaste), NULL, this);
|
|
229 m_dataViewListCtrlAny->Disconnect(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler(SearchFrame::OnSelectAnyListItem), NULL, this);
|
|
230 m_buttonPrint->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(SearchFrame::OnPrint), NULL, this);
|
|
231 m_textCtrlPasswd->Disconnect(wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler(SearchFrame::OnPassword), NULL, this);
|
|
232
|
|
233 this->Disconnect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(SearchFrame::OnClose));
|
|
234 }
|
|
235
|
|
236 /* Event-Handlers */
|
|
237 void SearchFrame::OnChar(wxKeyEvent& event)
|
|
238 {
|
|
239 int mod = event.GetModifiers();
|
|
240 int keycode = event.GetKeyCode();
|
|
241 //wxMessageBox(wxString::Format(wxT("%d-%d"), mod, keycode));
|
|
242
|
|
243 if (keycode == 13) { // Enter
|
|
244 m_dataViewListCtrlAny->DeleteAllItems();
|
|
245 RemoveTemp();
|
|
246
|
|
247 wxString s = m_searchCtrl->GetValue();
|
|
248 m_searchCtrl->SelectAll();
|
|
249
|
|
250 if (m_user.IsEmpty()) {
|
|
251 wxMessageBox(wxT("input password."));
|
|
252 this->SetTitle(wxT("Searcher - "));
|
|
253 m_searchCtrl->SetValue(wxEmptyString);
|
|
254 m_textCtrlPasswd->SelectAll();
|
|
255 m_textCtrlPasswd->SetFocus();
|
|
256 return;
|
|
257 }
|
|
258
|
|
259 if (s.IsSameAs(wxT("9")) || s.IsSameAs(wxT("q"))) {
|
|
260 Close();
|
|
261 return;
|
|
262 }
|
|
263
|
|
264 wxRegEx reHhs(wxT("^0[1238][0-9]{8}$"));
|
|
265 if (reHhs.Matches(s)) {
|
|
266 // hno search mode
|
|
267 SetListAnyHeader(0);
|
|
268 SearchByHno(s);
|
|
269 return;
|
|
270 }
|
|
271
|
|
272 if (s.IsEmpty()) {
|
|
273 // history mode
|
|
274 SetListAnyHeader(1);
|
|
275 return;
|
|
276 }
|
|
277
|
|
278 if (IsHiragana(s) || IsKatakana(s)) {
|
|
279 // kana search mode
|
|
280 s = Hiragara2Katakana(s);
|
|
281 SetListAnyHeader(2);
|
|
282 return;
|
|
283 }
|
|
284
|
|
285 wxMessageBox(wxT("bad input !"));
|
|
286 return;
|
|
287 }
|
|
288
|
|
289 if (keycode == 45) { // num-key '-' as BackSpace
|
|
290 wxString t = m_searchCtrl->GetStringSelection();
|
|
291 if (t.IsEmpty()) {
|
|
292 long p = m_searchCtrl->GetInsertionPoint();
|
|
293 if (p > 0) m_searchCtrl->Remove(p - 1, p);
|
|
294 } else {
|
|
295 m_searchCtrl->Cut();
|
|
296 }
|
|
297 return;
|
|
298 }
|
|
299
|
|
300 event.Skip();
|
|
301 }
|
|
302
|
|
303 void SearchFrame::OnPageChanged(wxNotebookEvent& event)
|
|
304 {
|
|
305 int n = event.GetSelection();
|
|
306 int m = event.GetOldSelection();
|
|
307
|
|
308 // setup
|
|
309 if (!m_usergroup.StartsWith(wxT("star")) && n == 7) {
|
|
310 m_notebook->ChangeSelection(m);
|
|
311 wxMessageBox(wxT("you can't view this page."));
|
|
312 return;
|
|
313 }
|
|
314 if (n == 7) LoadPasswd(false);
|
|
315
|
|
316 // batch-print & maintenance
|
|
317 if (!m_usergroup.StartsWith(wxT("nintei")) && !(m_usergroup.StartsWith(wxT("star")))) {
|
|
318 if (n != 5 && n != 6) return;
|
|
319 m_notebook->ChangeSelection(m);
|
|
320 wxMessageBox(wxT("you can't view this page."));
|
|
321 return;
|
|
322 }
|
|
323 }
|
|
324
|
|
325 void SearchFrame::OnRead(wxCommandEvent& WXUNUSED(event))
|
|
326 {
|
|
327 ReadCSV();
|
|
328 }
|
|
329
|
|
330 void SearchFrame::OnFile(wxFileDirPickerEvent& WXUNUSED(event))
|
|
331 {
|
|
332 ReadCSV();
|
|
333 }
|
|
334
|
|
335 void SearchFrame::OnIdxYearChoice(wxCommandEvent& WXUNUSED(evnet))
|
|
336 {
|
|
337 m_dataViewListCtrlIdxDate->DeleteAllItems();
|
|
338 m_dataViewListCtrlIdx->DeleteAllItems();
|
|
339 m_dataViewListCtrlIdxDate->Scroll(0, 0);
|
|
340 m_dataViewListCtrlIdx->Scroll(0, 0);
|
|
341
|
|
342 int n = m_choiceIdxYear->GetSelection();
|
|
343 wxString url = wxT("/d/") + m_choiceIdxYear->GetString(n);
|
|
344 wxString buf = HttpGetText(m_addr, m_port, url);
|
|
345 wxArrayString ymd = wxSplit(buf, ':', '\\');
|
|
346 ymd.Sort(false);
|
|
347
|
|
348 wxVector<wxVariant> data;
|
|
349 for (int i = 0; i < ymd.GetCount(); i++) {
|
|
350 data.push_back(wxVariant(wxString::Format(wxT("%02d"), i + 1)));
|
|
351 wxString buf = ymd[i].Left(4) + wxT("-") + ymd[i].Mid(4,2) + wxT("-") + ymd[i].Right(2);
|
|
352 data.push_back(wxVariant(buf));
|
|
353 m_dataViewListCtrlIdxDate->AppendItem(data);
|
|
354 data.clear();
|
|
355 }
|
|
356 }
|
|
357
|
|
358 void SearchFrame::OnIdxDateSelected(wxDataViewEvent& WXUNUSED(evnet))
|
|
359 {
|
|
360 m_dataViewListCtrlIdx->DeleteAllItems();
|
|
361 m_dataViewListCtrlIdx->Scroll(0, 0);
|
|
362
|
|
363 int r = m_dataViewListCtrlIdxDate->GetSelectedRow();
|
|
364 wxString date = m_dataViewListCtrlIdxDate->GetTextValue(r, 1);
|
|
365 date.Replace(wxT("-"), wxEmptyString, true);
|
|
366
|
|
367 wxString url = wxT("/d/") + date;
|
|
368 wxString buf = HttpGetText(m_addr, m_port, url);
|
|
369 wxArrayString hhs = wxSplit(buf, ':', '\\');
|
|
370 hhs.Sort(false);
|
|
371
|
|
372 url = wxT("/hn/") + wxJoin(hhs, ':', '\\');
|
|
373 buf = HttpGetText(m_addr, m_port, url);
|
|
374 wxArrayString name = wxSplit(buf, ':', '\\');
|
|
375
|
|
376 wxVector<wxVariant> data;
|
|
377 for (int i = 0; i < hhs.GetCount(); i++) {
|
|
378 data.push_back(wxVariant(wxString::Format(wxT("%02d"), i + 1)));
|
|
379 data.push_back(wxVariant(hhs[i]));
|
|
380 data.push_back(wxVariant(name[i]));
|
|
381 m_dataViewListCtrlIdx->AppendItem(data);
|
|
382 data.clear();
|
|
383 }
|
|
384 }
|
|
385
|
|
386 void SearchFrame::OnIdxDClicked(wxDataViewEvent& WXUNUSED(event))
|
|
387 {
|
|
388 int r = m_dataViewListCtrlIdx->GetSelectedRow();
|
|
389 wxString hno = m_dataViewListCtrlIdx->GetTextValue(r, 1);
|
|
390 m_searchCtrl->SetValue(hno);
|
|
391
|
|
392 wxString url = wxT("/h/") + hno;
|
|
393 wxString h = HttpGetText(m_addr, m_port, url); // Get /h/0800012345 -> name:addr:ymd1#ymd2#...
|
|
394
|
|
395 SetHhsInfo(h);
|
|
396 SetImages();
|
|
397
|
|
398 SetListAnyHeader(0);
|
|
399 m_notebook->SetSelection(0);
|
|
400 }
|
|
401
|
|
402 void SearchFrame::OnDrvYearChoice(wxCommandEvent& WXUNUSED(evnet))
|
|
403 {
|
|
404 m_dataViewListCtrlDrvDate->DeleteAllItems();
|
|
405 m_dataViewListCtrlDrvCcn->DeleteAllItems();
|
|
406 m_dataViewListCtrlDrv->DeleteAllItems();
|
|
407 m_dataViewListCtrlDrvDate->Scroll(0, 0);
|
|
408 m_dataViewListCtrlDrvCcn->Scroll(0, 0);
|
|
409 m_dataViewListCtrlDrv->Scroll(0, 0);
|
|
410
|
|
411 int n = m_choiceDrvYear->GetSelection();
|
|
412 if (n == 0) return;
|
|
413
|
|
414 wxString year = wxFILE_SEP_PATH + m_choiceDrvYear->GetString(n);
|
|
415 wxDir dir(year);
|
|
416 if (!dir.IsOpened()) return;
|
|
417
|
|
418 wxString dirname;
|
|
419 bool cont = dir.GetFirst(&dirname, wxEmptyString, wxDIR_DIRS);
|
|
420
|
|
421 wxVector<wxVariant> data;
|
|
422 for (int i = 0; cont; i++) {
|
|
423 wxString n = wxString::Format(wxT("%02d"), i + 1);
|
|
424 data.push_back(wxVariant(n));
|
|
425 data.push_back(wxVariant(dirname));
|
|
426
|
|
427 m_dataViewListCtrlDrvDate->AppendItem(data);
|
|
428 data.clear();
|
|
429
|
|
430 cont = dir.GetNext(&dirname);
|
|
431 }
|
|
432 }
|
|
433
|
|
434 void SearchFrame::OnDrvDateSelected(wxDataViewEvent& WXUNUSED(evnet))
|
|
435 {
|
|
436 m_dataViewListCtrlDrvCcn->DeleteAllItems();
|
|
437 m_dataViewListCtrlDrv->DeleteAllItems();
|
|
438 m_dataViewListCtrlDrvCcn->Scroll(0, 0);
|
|
439 m_dataViewListCtrlDrv->Scroll(0, 0);
|
|
440
|
|
441 int n = m_choiceDrvYear->GetSelection();
|
|
442 int r = m_dataViewListCtrlDrvDate->GetSelectedRow();
|
|
443
|
|
444 wxString date = wxFILE_SEP_PATH + m_choiceDrvYear->GetString(n) + wxFILE_SEP_PATH + m_dataViewListCtrlDrvDate->GetTextValue(r, 1);
|
|
445
|
|
446 wxDir dir(date);
|
|
447 if (!dir.IsOpened()) return;
|
|
448
|
|
449 wxString dirname;
|
|
450 bool cont = dir.GetFirst(&dirname, wxEmptyString, wxDIR_DIRS);
|
|
451
|
|
452 wxVector<wxVariant> data;
|
|
453 for (int i = 0; cont; i++) {
|
|
454 wxString n = wxString::Format(wxT("%02d"), i + 1);
|
|
455 data.push_back(wxVariant(n));
|
|
456 data.push_back(wxVariant(dirname));
|
|
457 m_dataViewListCtrlDrvCcn->AppendItem(data);
|
|
458 data.clear();
|
|
459 cont = dir.GetNext(&dirname);
|
|
460 }
|
|
461 }
|
|
462
|
|
463 void SearchFrame::OnDrvDateDClicked(wxDataViewEvent& WXUNUSED(evnet))
|
|
464 {
|
|
465 int n = m_choiceDrvYear->GetSelection();
|
|
466 int r = m_dataViewListCtrlDrvDate->GetSelectedRow();
|
|
467
|
|
468 wxString date = wxFILE_SEP_PATH + m_choiceDrvYear->GetString(n) + wxFILE_SEP_PATH + m_dataViewListCtrlDrvDate->GetTextValue(r, 1);
|
|
469 wxString cmd = wxT("explorer.exe ") + date;
|
|
470 wxExecute(cmd);
|
|
471 }
|
|
472
|
|
473 void SearchFrame::OnDrvCcnSelected(wxDataViewEvent& event)
|
|
474 {
|
|
475 m_dataViewListCtrlDrv->DeleteAllItems();
|
|
476 m_dataViewListCtrlDrv->Scroll(0, 0);
|
|
477
|
|
478 int n = m_choiceDrvYear->GetSelection();
|
|
479 int r1 = m_dataViewListCtrlDrvDate->GetSelectedRow();
|
|
480 int r2 = m_dataViewListCtrlDrvCcn->GetSelectedRow();
|
|
481
|
|
482 wxString ccn = wxFILE_SEP_PATH + m_choiceDrvYear->GetString(n);
|
|
483 ccn += wxFILE_SEP_PATH + m_dataViewListCtrlDrvDate->GetTextValue(r1, 1);
|
|
484 ccn += wxFILE_SEP_PATH + m_dataViewListCtrlDrvCcn->GetTextValue(r2, 1);
|
|
485
|
|
486 wxDir dir(ccn);
|
|
487 if (!dir.IsOpened()) return;
|
|
488
|
|
489 wxString dirname;
|
|
490 bool cont = dir.GetFirst(&dirname, wxEmptyString, wxDIR_DIRS);
|
|
491
|
|
492 wxArrayString hno;
|
|
493 wxVector<wxVariant> data;
|
|
494 for (int i = 0; cont; i++) {
|
|
495 wxString n = wxString::Format(wxT("%02d"), i);
|
|
496 data.push_back(wxVariant(n));
|
|
497 data.push_back(wxVariant(dirname));
|
|
498 hno.Add(dirname);
|
|
499 data.push_back(wxVariant(wxEmptyString));
|
|
500 m_dataViewListCtrlDrv->AppendItem(data);
|
|
501 data.clear();
|
|
502 cont = dir.GetNext(&dirname);
|
|
503 }
|
|
504
|
|
505 wxString url = wxT("/hn/") + wxJoin(hno, ':', '\\');
|
|
506 wxString buf = HttpGetText(m_addr, m_port, url);
|
|
507 wxArrayString name = wxSplit(buf, ':', '\\');
|
|
508 for (int r = 0; r < name.GetCount(); r++) {
|
|
509 m_dataViewListCtrlDrv->SetTextValue(name[r], r, 2);
|
|
510 }
|
|
511 }
|
|
512
|
|
513 void SearchFrame::OnDrvCcnDClicked(wxDataViewEvent& event)
|
|
514 {
|
|
515 int n = m_choiceDrvYear->GetSelection();
|
|
516 int r1 = m_dataViewListCtrlDrvDate->GetSelectedRow();
|
|
517 int r2 = m_dataViewListCtrlDrvCcn->GetSelectedRow();
|
|
518
|
|
519 wxString ccn = wxFILE_SEP_PATH + m_choiceDrvYear->GetString(n);
|
|
520 ccn += wxFILE_SEP_PATH + m_dataViewListCtrlDrvDate->GetTextValue(r1, 1);
|
|
521 ccn += wxFILE_SEP_PATH + m_dataViewListCtrlDrvCcn->GetTextValue(r2, 1);
|
|
522
|
|
523 wxString cmd = wxT("explorer.exe ") + ccn;
|
|
524 wxExecute(cmd);
|
|
525 }
|
|
526
|
|
527 void SearchFrame::OnDrvDClicked(wxDataViewEvent& WXUNUSED(evnet))
|
|
528 {
|
|
529 int n = m_choiceDrvYear->GetSelection();
|
|
530 int r1 = m_dataViewListCtrlDrvDate->GetSelectedRow();
|
|
531 int r2 = m_dataViewListCtrlDrvCcn->GetSelectedRow();
|
|
532 int r3 = m_dataViewListCtrlDrv->GetSelectedRow();
|
|
533
|
|
534 wxString hno = wxFILE_SEP_PATH + m_choiceDrvYear->GetString(n);
|
|
535 hno += wxFILE_SEP_PATH + m_dataViewListCtrlDrvDate->GetTextValue(r1, 1);
|
|
536 hno += wxFILE_SEP_PATH + m_dataViewListCtrlDrvCcn->GetTextValue(r2, 1);
|
|
537 hno += wxFILE_SEP_PATH + m_dataViewListCtrlDrv->GetTextValue(r3, 1);
|
|
538
|
|
539 wxString cmd = wxT("explorer.exe ") + hno;
|
|
540 wxExecute(cmd);
|
|
541 }
|
|
542
|
|
543 void SearchFrame::OnUploadHhsDB(wxCommandEvent& WXUNUSED(event))
|
|
544 {
|
|
545 wxString incsv = m_filePickerHhsDB->GetPath();
|
|
546 wxString outcsv = m_workdir + wxFILE_SEP_PATH + wxT("hhsdb.csv");
|
|
547 wxString outgz = outcsv + wxT(".gz");
|
|
548 if (wxFileExists(outcsv)) wxRemoveFile(outcsv);
|
|
549
|
|
550 wxFFile input, output;
|
|
551 if (!input.Open(incsv)) {
|
|
552 wxMessageBox(wxT("Cannot open file."));
|
|
553 return;
|
|
554 }
|
|
555
|
|
556 if (!output.Open(outcsv, wxT("w"))) {
|
|
557 wxMessageBox(wxT("Cannot create file."));
|
|
558 return;
|
|
559 }
|
|
560
|
|
561 wxString buf;
|
|
562 wxCSConv cust(wxT("cp932"));
|
|
563 input.ReadAll(&buf, cust);
|
|
564 input.Close();
|
|
565
|
|
566 buf.Replace(wxT("\""), wxEmptyString, true);
|
|
567 output.Write(buf);
|
|
568 output.Close();
|
|
569
|
|
570 Gzip(outcsv, outgz);
|
|
571
|
|
572 wxString url = wxT("/u/");
|
|
573 if (HttpPostFile(m_addr, m_port, url, outgz)) {
|
|
574 wxString url = wxT("/ht/");
|
|
575 wxString date = HttpGetText(m_addr, m_port, url);
|
|
576 m_textCtrlLastHhsDB->SetValue(date);
|
|
577 wxMessageBox(wxT("upload done."));
|
|
578 } else {
|
|
579 wxMessageBox(wxT("upload failed."));
|
|
580 }
|
|
581 wxRemoveFile(outcsv);
|
|
582 wxRemoveFile(outgz);
|
|
583 }
|
|
584
|
|
585 void SearchFrame::OnUploadImage(wxCommandEvent& WXUNUSED(event))
|
|
586 {
|
|
587 wxDateTime dt = m_datePicker->GetValue();
|
|
588 wxString ymd = dt.Format(wxT("%Y%m%d"));
|
|
589 wxString year = dt.Format(wxT("%Y"));
|
|
590
|
|
591 wxDateTime::Month month = dt.GetMonth();
|
|
592 if (month == wxDateTime::Jan || month == wxDateTime::Feb || month == wxDateTime::Mar) {
|
|
593 year = wxString::Format(wxT("%d"), dt.GetYear() - 1);
|
|
594 }
|
|
595
|
|
596 wxString ymddir = wxFILE_SEP_PATH + year + wxFILE_SEP_PATH + ymd;
|
|
597 if (!wxDirExists(ymddir)) {
|
|
598 wxMessageBox(wxT("bad date."));
|
|
599 return;
|
|
600 }
|
|
601
|
|
602 wxDir ymd_dir(ymddir);
|
|
603 if (!ymd_dir.IsOpened()) return;
|
|
604
|
|
605 m_gauge->SetRange(200);
|
|
606 m_gauge->SetValue(0);
|
|
607
|
|
608 wxString url = wxT("/ci/") + ymd;
|
|
609 HttpGetText(m_addr, m_port, url);
|
|
610
|
|
611 wxString ccn;
|
|
612 bool cont = ymd_dir.GetFirst(&ccn, wxEmptyString, wxDIR_DIRS);
|
|
613 for (int i = 0; cont; i++) {
|
|
614 wxDir ccn_dir(ymddir + wxFILE_SEP_PATH + ccn);
|
|
615 wxString hno;
|
|
616 bool cont2 = ccn_dir.GetFirst(&hno, wxEmptyString, wxDIR_DIRS);
|
|
617 while (cont2) {
|
|
618 if (!hno.StartsWith(wxT("0000"))) {
|
|
619 wxString d = ymddir + wxFILE_SEP_PATH + ccn + wxFILE_SEP_PATH + hno;
|
|
620 wxString tar = m_workdir + wxFILE_SEP_PATH + hno + wxT(".tar");
|
|
621 TarDir(d, tar);
|
|
622 wxString gz = m_workdir + wxFILE_SEP_PATH + hno + wxT(".tgz");
|
|
623 Gzip(tar, gz);
|
|
624 wxString url = wxT("/ui/") + ymd + wxT("/") + hno + wxT(".tgz");
|
|
625 if (HttpPostFile(m_addr, m_port, url, gz)) {
|
|
626 wxRemoveFile(tar);
|
|
627 wxRemoveFile(gz);
|
|
628 }
|
|
629 }
|
|
630 cont2 = ccn_dir.GetNext(&hno);
|
|
631 m_gauge->SetValue(i);
|
|
632 i++;
|
|
633 }
|
|
634 cont = ymd_dir.GetNext(&ccn);
|
|
635 }
|
|
636 m_gauge->SetValue(0);
|
|
637
|
|
638 url = wxT("/ud/") + ymd;
|
|
639 HttpGetText(m_addr, m_port, url);
|
|
640
|
|
641 url = wxT("/dt/");
|
|
642 wxString latest = HttpGetText(m_addr, m_port, url);
|
|
643 m_textCtrlLastIndex->SetValue(latest);
|
|
644 wxMessageBox(wxT("upload done."));
|
|
645 }
|
|
646
|
|
647 void SearchFrame::OnDB2CSV(wxCommandEvent& WXUNUSED(event))
|
|
648 {
|
|
649 wxString outcsv = m_filePickerCSV->GetPath();
|
|
650 if (wxFileExists(outcsv)) wxRemoveFile(outcsv);
|
|
651
|
|
652 wxFFile output;
|
|
653 if (!output.Open(outcsv, wxT("w"))) {
|
|
654 wxMessageBox(wxT("Cannot create file."));
|
|
655 return;
|
|
656 }
|
|
657 wxString url = wxT("/hd/");
|
|
658 wxString dbtxt = HttpGetText(m_addr, m_port, url);
|
|
659
|
|
660 output.Write(dbtxt);
|
|
661 output.Close();
|
|
662 wxMessageBox(wxT("finish !"));
|
|
663 }
|
|
664
|
|
665 void SearchFrame::OnUPassword(wxCommandEvent& WXUNUSED(event))
|
|
666 {
|
|
667 wxMessageBox("upw");
|
|
668 }
|
|
669
|
|
670 void SearchFrame::OnSavePw(wxCommandEvent& WXUNUSED(event))
|
|
671 {
|
|
672 wxMessageBox("save pw");
|
|
673 }
|
|
674
|
|
675 void SearchFrame::OnPaste(wxCommandEvent& WXUNUSED(event))
|
|
676 {
|
|
677 if (m_user.IsEmpty()) return;
|
|
678
|
|
679 wxString s;
|
|
680 if (wxTheClipboard->Open()) {
|
|
681 if (wxTheClipboard->IsSupported(wxDF_TEXT)) {
|
|
682 wxTextDataObject data;
|
|
683 wxTheClipboard->GetData(data);
|
|
684 s = data.GetText();
|
|
685 }
|
|
686 wxTheClipboard->Close();
|
|
687 }
|
|
688 s.Replace(wxT(" "), wxT(""), true);
|
|
689
|
|
690 wxRegEx reHhs(wxT("^0[1238][0-9]{8}$"));
|
|
691 if (reHhs.Matches(s)) {
|
|
692 m_searchCtrl->SetValue(s);
|
|
693 m_searchCtrl->SelectAll();
|
|
694 SetListAnyHeader(0);
|
|
695 SearchByHno(s);
|
|
696 return;
|
|
697 }
|
|
698 wxMessageBox(wxT("Bad clipboard data !!"));
|
|
699 }
|
|
700
|
|
701 void SearchFrame::OnSelectBatchListCtrlA(wxKeyEvent& event)
|
|
702 {
|
|
703 int mod = event.GetModifiers();
|
|
704 int keycode = event.GetKeyCode();
|
|
705 //wxMessageBox(wxString::Format(wxT("%d-%d"), mod, keycode));
|
|
706
|
|
707 if (keycode == 1)
|
|
708 m_dataViewListCtrlBatch->SelectAll();
|
|
709
|
|
710 event.Skip();
|
|
711 }
|
|
712
|
|
713 void SearchFrame::OnSelectBatchDClicked(wxDataViewEvent& WXUNUSED(event))
|
|
714 {
|
|
715 int r = m_dataViewListCtrlBatch->GetSelectedRow();
|
|
716 wxString hno = m_dataViewListCtrlBatch->GetTextValue(r, 1);
|
|
717 m_searchCtrl->SetValue(hno);
|
|
718
|
|
719 wxString url = wxT("/h/") + hno;
|
|
720 wxString h = HttpGetText(m_addr, m_port, url); // Get /h/0800012345 -> name:addr:ymd1#ymd2#...
|
|
721
|
|
722 SetHhsInfo(h);
|
|
723 SetImages();
|
|
724
|
|
725 SetListAnyHeader(0);
|
|
726 m_notebook->SetSelection(0);
|
|
727 }
|
|
728
|
|
729 void SearchFrame::OnSelectAnyListItem(wxDataViewEvent& WXUNUSED(event))
|
|
730 {
|
|
731 RemoveTemp();
|
|
732
|
|
733 if (m_searchmode == 0) {
|
|
734 SetImages();
|
|
735 m_notebook->SetSelection(0);
|
|
736 }
|
|
737 }
|
|
738
|
|
739 void SearchFrame::OnPrint(wxCommandEvent& WXUNUSED(event))
|
|
740 {
|
|
741 int zoom = m_spinCtrl->GetValue();
|
|
742 wxString imgsz = wxString::Format(wxT("\" width=\"%d\" height=\"%d\""), 750 * zoom / 100, 1060 * zoom / 100);
|
|
743
|
|
744 switch (m_notebook->GetSelection()) {
|
|
745 case 5: {// batch print
|
|
746 RemoveTemp();
|
|
747 if (m_dataViewListCtrlBatch->GetItemCount() == 0) {
|
|
748 wxMessageBox(wxT("no item."));
|
|
749 return;
|
|
750 }
|
|
751
|
|
752 if (m_dataViewListCtrlBatch->GetSelectedItemsCount() == 0) {
|
|
753 wxMessageDialog dlg(this, wxT("すべてを印刷しますか?"), wxT("Question"), wxYES_NO);
|
|
754 if (dlg.ShowModal() == wxID_NO) return;
|
|
755 m_dataViewListCtrlBatch->SelectAll();
|
|
756 }
|
|
757
|
|
758 wxPrintDialogData pd;
|
|
759 wxPrinter p(&pd);
|
|
760 if (p.PrintDialog(NULL) == NULL) return;
|
|
761
|
|
762 m_checkBoxMask->SetValue(true);
|
|
763 m_gauge->SetRange(m_dataViewListCtrlBatch->GetSelectedItemsCount());
|
|
764 m_gauge->SetValue(0);
|
|
765 for (int r = 0; r < m_dataViewListCtrlBatch->GetItemCount(); r++) {
|
|
766 if (!m_dataViewListCtrlBatch->IsRowSelected(r))
|
|
767 continue;
|
|
768
|
|
769 wxString hno = m_dataViewListCtrlBatch->GetTextValue(r, 1);
|
|
770 wxString date = m_dataViewListCtrlBatch->GetTextValue(r, 3);
|
|
771 if (date.IsEmpty()) continue;
|
|
772 date.Replace(wxT("-"), wxEmptyString, true);
|
|
773
|
|
774 // Get /i/20200110/0800012345.tgz
|
|
775 wxString url = wxT("/i/") + date + wxT("/") + hno + wxT(".tgz");
|
|
776 HttpGetTgzFile(m_addr, m_port, url, m_workdir);
|
|
777
|
|
778 MaskImage();
|
|
779
|
|
780 wxString html;
|
|
781 html = wxT("<html><body>\n");
|
|
782 for (int i = 0; i < 5; i++) {
|
|
783 if (m_dataViewListCtrlBatch->GetToggleValue(r, 4) && i > 2) continue;
|
|
784 html += wxT("<img src=\"") + wxString::Format(wxT("%s/%d"), m_workdir, i + 1) + imgsz + wxT("/>");
|
|
785 html += wxT("<div align=right><font size=-2><u>") + hno + wxT("</u></font></div>");
|
|
786 if (m_checkBoxBoth->IsChecked() && i == 2) {
|
|
787 html += wxT("<div> </div><img src=\"./image/space.tif\"") + imgsz + wxT("/>");
|
|
788 }
|
|
789 }
|
|
790 html += wxT("</body></html>\n");
|
|
791
|
|
792 // start printing
|
|
793 wxHtmlPrintout hpout(wxString::Format(wxT("Searcher - batch mode [%d]"), r + 1));
|
|
794 hpout.SetMargins(0, 0, 0, 0, 0);
|
|
795 hpout.SetHtmlText(html, wxEmptyString, false);
|
|
796
|
|
797 p.Print(NULL, &hpout, false);
|
|
798 m_gauge->SetValue(r);
|
|
799 RemoveTemp();
|
|
800 }
|
|
801 m_gauge->SetValue(0);
|
|
802 break;
|
|
803 }
|
|
804
|
|
805 case 6: {// index
|
|
806 break;
|
|
807 }
|
|
808
|
|
809 default: {
|
|
810 wxString org = m_workdir + wxFILE_SEP_PATH + wxT("1");
|
|
811 wxString cpy = m_workdir + wxFILE_SEP_PATH + wxT("0");
|
|
812 wxCopyFile(org, cpy, true); // backup for mask
|
|
813
|
|
814 wxDateTime now = wxDateTime::Now();
|
|
815 wxString nowstr = now.Format(wxT("%Y/%m/%d %H:%M"), wxDateTime::GMT9).c_str();
|
|
816
|
|
817 wxString html;
|
|
818 html = wxT("<html><body>\n");
|
|
819
|
|
820 wxString footer;
|
|
821 footer += wxT("<div align=right><font size=-2><u>") + m_searchCtrl->GetValue();
|
|
822 footer += wxT( "@" ) + m_usergroup + wxT( "#" ) + nowstr + wxT("</u></font></div>");
|
|
823
|
|
824 wxMessageDialog dlg(this, wxT("5枚すべて印刷しますか?"), wxT("Question"), wxYES_NO);
|
|
825 if (dlg.ShowModal() == wxID_YES) {
|
|
826 if (m_checkBoxMask->IsChecked()) MaskImage();
|
|
827 for (int i = 0; i < 5; i++) {
|
|
828 html += wxT("<img src=\"") + wxString::Format(wxT("%s/%d"), m_workdir, i + 1) + imgsz + wxT("/>");
|
|
829 if (!m_checkBoxBoth->IsChecked()) {
|
|
830 html += footer;
|
|
831 } else {
|
|
832 if (i == 0 || i == 2 || i == 3) html += footer;
|
|
833 }
|
|
834 if (m_checkBoxBoth->IsChecked() && i == 2) {
|
|
835 html += wxT("<div> </div><img src=\"./image/space.tif\"") + imgsz + wxT("/>");
|
|
836 }
|
|
837 }
|
|
838 }
|
|
839 else {
|
|
840 int i = m_notebook->GetSelection();
|
|
841 if (i == 0 && m_checkBoxMask->IsChecked()) MaskImage();
|
|
842 html += wxT("<img src=\"") + wxString::Format(wxT("%s/%d"), m_workdir, i + 1) + imgsz + wxT("/>");
|
|
843 html += footer;
|
|
844 }
|
|
845 html += wxT("</body></html>\n");
|
|
846
|
|
847 wxPrintDialogData pd;
|
|
848 wxPrinter p(&pd);
|
|
849 if (p.PrintDialog(NULL) == NULL) return;
|
|
850
|
|
851 wxHtmlPrintout hpout(wxT("Searcher"));
|
|
852 hpout.SetMargins(0, 0, 0, 0, 0);
|
|
853 hpout.SetHtmlText(html, wxEmptyString, false);
|
|
854
|
|
855 p.Print(NULL, &hpout, false);
|
|
856 wxCopyFile(cpy, org, true);
|
|
857 }
|
|
858 }
|
|
859 }
|
|
860
|
|
861 void SearchFrame::OnPassword(wxCommandEvent& WXUNUSED(event))
|
|
862 {
|
|
863 if (m_textCtrlPasswd->GetValue() == wxT(".")) {
|
|
864 Close();
|
|
865 return;
|
|
866 }
|
|
867 wxString x = XoR(PWPREFIX + m_textCtrlPasswd->GetValue(), PWXORN);
|
|
868
|
|
869 m_user = wxEmptyString;
|
|
870 m_notebook->ChangeSelection(0);
|
|
871
|
|
872 wxString url = wxT("/pw/");
|
|
873 wxString buf = HttpGetText(m_addr, m_port, url);
|
|
874 wxArrayString idpw = wxSplit(buf, ':', '\\');
|
|
875 for (int i = 2; i < idpw.GetCount(); i += 3) {
|
|
876 if (idpw[i].IsSameAs(x)) {
|
|
877 m_user = idpw[i - 1];
|
|
878 m_usergroup = idpw[i - 2];
|
|
879 }
|
|
880 }
|
|
881
|
|
882 if (m_user.IsEmpty()) {
|
|
883 wxMessageBox(wxT("invalid user."));
|
|
884 this->SetTitle(wxT("Searcher - "));
|
|
885 m_textCtrlPasswd->SelectAll();
|
|
886 return;
|
|
887 }
|
|
888
|
|
889 wxMessageBox(wxString::Format(wxT("%s login..."), m_user));
|
|
890 m_textCtrlPasswd->SetValue(wxT("ora ora ora ora !"));
|
|
891
|
|
892 wxString sv;
|
|
893 if (m_usergroup.StartsWith(wxT("star")))
|
|
894 sv = wxT("...") + m_addr + wxT(":") + m_port;
|
|
895 this->SetTitle(wxString::Format(wxT("Searcher - %s(%s) logined"), m_user, m_usergroup) + sv);
|
|
896 m_searchCtrl->SetFocus();
|
|
897 }
|
|
898
|
|
899 void SearchFrame::OnClose(wxCloseEvent& WXUNUSED(event))
|
|
900 {
|
|
901 RemoveTemp();
|
|
902 Destroy();
|
|
903 }
|
|
904
|
|
905 /* Functions */
|
|
906 void SearchFrame::CreateControls()
|
|
907 {
|
|
908 this->SetIcon(wxIcon(wxT("sample")));
|
|
909 this->SetSizeHints(wxDefaultSize, wxDefaultSize);
|
|
910 this->SetBackgroundColour(wxColour(217, 217, 217));
|
|
911
|
|
912 int w, h;
|
|
913 this->GetSize(&w, &h);
|
|
914
|
|
915 wxGridBagSizer* gbSizer = new wxGridBagSizer(0, 0);
|
|
916 gbSizer->SetFlexibleDirection(wxBOTH);
|
|
917 gbSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
|
918
|
|
919 m_notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(1300, h - 40), wxNB_FIXEDWIDTH|wxNB_TOP); // for large-display
|
|
920 //m_notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(1000, h - 50), wxNB_FIXEDWIDTH|wxNB_TOP); // for note-pc
|
|
921
|
|
922 m_scrolledWindow1 = new wxScrolledWindow(m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL);
|
|
923 m_scrolledWindow1->SetScrollRate(5, 5);
|
|
924 m_notebook->AddPage(m_scrolledWindow1, wxT("Mシート1"), false);
|
|
925
|
|
926 m_scrolledWindow2 = new wxScrolledWindow(m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL);
|
|
927 m_scrolledWindow2->SetScrollRate(5, 5);
|
|
928 m_notebook->AddPage(m_scrolledWindow2, wxT("Mシート2"), false);
|
|
929
|
|
930 m_scrolledWindow3 = new wxScrolledWindow(m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL);
|
|
931 m_scrolledWindow3->SetScrollRate(5, 5);
|
|
932 m_notebook->AddPage(m_scrolledWindow3, wxT("特記事項"), false);
|
|
933
|
|
934 m_scrolledWindow4 = new wxScrolledWindow(m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL);
|
|
935 m_scrolledWindow4->SetScrollRate(5, 5);
|
|
936 m_notebook->AddPage(m_scrolledWindow4, wxT("意見書1"), false);
|
|
937
|
|
938 m_scrolledWindow5 = new wxScrolledWindow(m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL);
|
|
939 m_scrolledWindow5->SetScrollRate(5, 5);
|
|
940 m_notebook->AddPage(m_scrolledWindow5, wxT("意見書2"), false);
|
|
941
|
|
942 m_panelBatch = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
|
943 wxGridBagSizer* gbSizerBatch = new wxGridBagSizer(0, 0);
|
|
944 gbSizerBatch->SetFlexibleDirection(wxBOTH);
|
|
945 gbSizerBatch->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
|
946
|
|
947 m_filePicker = new wxFilePickerCtrl(m_panelBatch, wxID_ANY, wxEmptyString, wxT("Select a file"), wxT("CSV file(*.csv)|*.csv"), wxDefaultPosition, wxSize(300, -1), wxFLP_FILE_MUST_EXIST|wxFLP_OPEN|wxFLP_SMALL|wxFLP_USE_TEXTCTRL);
|
|
948 gbSizerBatch->Add(m_filePicker, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL|wxALIGN_CENTER_VERTICAL, 5);
|
|
949
|
|
950 m_buttonRead = new wxButton(m_panelBatch, wxID_ANY, wxT("読込み"), wxDefaultPosition, wxDefaultSize, 0);
|
|
951 gbSizerBatch->Add(m_buttonRead, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALL|wxALIGN_CENTER_VERTICAL, 5);
|
|
952
|
|
953 m_dataViewListCtrlBatch = new wxDataViewListCtrl(m_panelBatch, wxID_ANY, wxDefaultPosition, wxSize(700, h - 120), wxDV_MULTIPLE|wxDV_ROW_LINES);
|
|
954 m_dataViewListColumnBPNo = m_dataViewListCtrlBatch->AppendTextColumn(wxT("No"), wxDATAVIEW_CELL_INERT, 40, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE);
|
|
955 m_dataViewListColumnBPHno = m_dataViewListCtrlBatch->AppendTextColumn(wxT("被保険者番号"), wxDATAVIEW_CELL_INERT, 100, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE);
|
|
956 m_dataViewListColumnBPName = m_dataViewListCtrlBatch->AppendTextColumn(wxT(" 氏名"), wxDATAVIEW_CELL_INERT, 120, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE);
|
|
957 m_dataViewListColumnBPDate = m_dataViewListCtrlBatch->AppendTextColumn(wxT("日付"), wxDATAVIEW_CELL_INERT, 90, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE);
|
|
958 m_dataViewListColumnOnlyIk = m_dataViewListCtrlBatch->AppendToggleColumn(wxT("調査のみ"), wxDATAVIEW_CELL_INERT, 70, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE);
|
|
959 m_dataViewListColumnProgress = m_dataViewListCtrlBatch->AppendProgressColumn(wxT("状態"), wxDATAVIEW_CELL_INERT, 100, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE);
|
|
960 m_dataViewListColumnDummy = m_dataViewListCtrlBatch->AppendTextColumn(wxEmptyString, wxDATAVIEW_CELL_INERT, 80, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE);
|
|
961 m_dataViewListCtrlBatch->SetAlternateRowColour(wxColour(230, 230, 255)) ;
|
|
962 gbSizerBatch->Add(m_dataViewListCtrlBatch, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
|
|
963
|
|
964 m_panelBatch->SetSizer(gbSizerBatch);
|
|
965 m_panelBatch->Layout();
|
|
966 gbSizerBatch->Fit(m_panelBatch);
|
|
967 m_notebook->AddPage(m_panelBatch, wxT("バッチ印刷"), false);
|
|
968
|
|
969 m_panelMainte = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
|
970 wxBoxSizer* bSizerMainte = new wxBoxSizer(wxVERTICAL);
|
|
971
|
|
972 m_staticTextIndex = new wxStaticText(m_panelMainte, wxID_ANY, wxT("インデックス"), wxDefaultPosition, wxDefaultSize, 0);
|
|
973 m_staticTextIndex->SetFont(wxFont(wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, true, wxEmptyString));
|
|
974 bSizerMainte->Add(m_staticTextIndex, 0, wxALL, 5);
|
|
975
|
|
976 wxFlexGridSizer* fgSizerIdx = new wxFlexGridSizer(0, 5, 0, 0);
|
|
977 fgSizerIdx->SetFlexibleDirection(wxBOTH);
|
|
978 fgSizerIdx->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
|
979
|
|
980 m_staticTextDrive = new wxStaticText(m_panelMainte, wxID_ANY, wxT("ドライブ"), wxDefaultPosition, wxDefaultSize, 0);
|
|
981 fgSizerIdx->Add(m_staticTextDrive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
|
|
982
|
|
983 m_staticTextYear = new wxStaticText(m_panelMainte, wxID_ANY, wxT("年度"), wxDefaultPosition, wxDefaultSize, 0);
|
|
984 fgSizerIdx->Add(m_staticTextYear, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
|
|
985
|
|
986 m_staticTextDate = new wxStaticText(m_panelMainte, wxID_ANY, wxT("日付"), wxDefaultPosition, wxDefaultSize, 0);
|
|
987 fgSizerIdx->Add(m_staticTextDate, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
|
|
988
|
|
989 m_staticTextCcn = new wxStaticText(m_panelMainte, wxID_ANY, wxT("審査会"), wxDefaultPosition, wxDefaultSize, 0);
|
|
990 fgSizerIdx->Add(m_staticTextCcn, 0, wxALL, 5);
|
|
991
|
|
992 m_staticTextData = new wxStaticText(m_panelMainte, wxID_ANY, wxT("データ"), wxDefaultPosition, wxDefaultSize, 0);
|
|
993 fgSizerIdx->Add(m_staticTextData, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
|
|
994
|
|
995 // --
|
|
996 m_staticTextDB = new wxStaticText(m_panelMainte, wxID_ANY, wxT("DB"), wxDefaultPosition, wxDefaultSize, 0);
|
|
997 fgSizerIdx->Add(m_staticTextDB, 0, wxALL, 5);
|
|
998
|
|
999 wxString m_choiceIdxYearChoices[] = {wxEmptyString, wxT("2017"), wxT("2018"), wxT("2019"), wxT("2020"), wxT("2021"), wxT("2022"), wxT("2023"), wxT("2024"), wxT("2025"), wxT("2026"), wxT("2027"), wxT("2028"), wxT("2029"), wxT("2030"), wxT("2031"), wxT("2032")};
|
|
1000 int m_choiceIdxYearNChoices = sizeof(m_choiceIdxYearChoices) / sizeof(wxString);
|
|
1001 m_choiceIdxYear = new wxChoice(m_panelMainte, wxID_ANY, wxDefaultPosition, wxSize(100, -1), m_choiceIdxYearNChoices, m_choiceIdxYearChoices, 0);
|
|
1002 m_choiceIdxYear->SetSelection(0);
|
|
1003 fgSizerIdx->Add(m_choiceIdxYear, 0, wxALL, 5);
|
|
1004
|
|
1005 m_dataViewListCtrlIdxDate = new wxDataViewListCtrl(m_panelMainte, wxID_ANY, wxDefaultPosition, wxSize(150, 330), wxDV_SINGLE|wxDV_ROW_LINES);
|
|
1006 m_dataViewListColumnIdxDateNo = m_dataViewListCtrlIdxDate->AppendTextColumn(wxT("No"), wxDATAVIEW_CELL_INERT, 40, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE);
|
|
1007 m_dataViewListColumnIdxDate = m_dataViewListCtrlIdxDate->AppendTextColumn(wxT("日付"), wxDATAVIEW_CELL_INERT, 80, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE);
|
|
1008 m_dataViewListCtrlIdxDate->SetAlternateRowColour(wxColour(230, 230, 255)) ;
|
|
1009 fgSizerIdx->Add(m_dataViewListCtrlIdxDate, 1, wxALL|wxEXPAND, 5);
|
|
1010
|
|
1011 m_staticTextIdxCcn = new wxStaticText(m_panelMainte, wxID_ANY, wxT("---"), wxDefaultPosition, wxDefaultSize, 0);
|
|
1012 fgSizerIdx->Add(m_staticTextIdxCcn, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5);
|
|
1013
|
|
1014 m_dataViewListCtrlIdx = new wxDataViewListCtrl(m_panelMainte, wxID_ANY, wxDefaultPosition, wxSize(300, -1), wxDV_SINGLE|wxDV_ROW_LINES);
|
|
1015 m_dataViewListColumnIdxNo = m_dataViewListCtrlIdx->AppendTextColumn(wxT("No"), wxDATAVIEW_CELL_INERT, 40, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE);
|
|
1016 m_dataViewListColumnIdxHno = m_dataViewListCtrlIdx->AppendTextColumn(wxT("被保険者番号"), wxDATAVIEW_CELL_INERT, 100, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE);
|
|
1017 m_dataViewListColumnIdxName = m_dataViewListCtrlIdx->AppendTextColumn(wxT(" 氏名"), wxDATAVIEW_CELL_INERT, 120, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE);
|
|
1018 m_dataViewListCtrlIdx->SetAlternateRowColour(wxColour(230, 230, 255)) ;
|
|
1019 fgSizerIdx->Add(m_dataViewListCtrlIdx, 1, wxALL|wxEXPAND, 5);
|
|
1020
|
|
1021 // --
|
|
1022 wxString m_choiceDrvChoices[] = {wxT("C"), wxT("Y"), wxT("Z")};
|
|
1023 int m_choiceDrvNChoices = sizeof(m_choiceDrvChoices) / sizeof(wxString);
|
|
1024 m_choiceDrv = new wxChoice(m_panelMainte, wxID_ANY, wxDefaultPosition, wxSize(50, -1), m_choiceDrvNChoices, m_choiceDrvChoices, 0);
|
|
1025 m_choiceDrv->SetSelection(0);
|
|
1026 fgSizerIdx->Add(m_choiceDrv, 0, wxALL, 5);
|
|
1027
|
|
1028 wxString m_choiceDrvYearChoices[] = {wxEmptyString, wxT("2017"), wxT("2018"), wxT("2019"), wxT("2020"), wxT("2021"), wxT("2022"), wxT("2023"), wxT("2024"), wxT("2025"), wxT("2026"), wxT("2027"), wxT("2028"), wxT("2029"), wxT("2030"), wxT("2031"), wxT("2032")};
|
|
1029 int m_choiceDrvYearNChoices = sizeof(m_choiceDrvYearChoices) / sizeof(wxString);
|
|
1030 m_choiceDrvYear = new wxChoice(m_panelMainte, wxID_ANY, wxDefaultPosition, wxSize(100, -1), m_choiceDrvYearNChoices, m_choiceDrvYearChoices, 0);
|
|
1031 m_choiceDrvYear->SetSelection(0);
|
|
1032 fgSizerIdx->Add(m_choiceDrvYear, 0, wxALL, 5);
|
|
1033
|
|
1034 m_dataViewListCtrlDrvDate = new wxDataViewListCtrl(m_panelMainte, wxID_ANY, wxDefaultPosition, wxSize(150, 330), wxDV_SINGLE|wxDV_ROW_LINES);
|
|
1035 m_dataViewListColumnDrvDateNo = m_dataViewListCtrlDrvDate->AppendTextColumn(wxT("No"), wxDATAVIEW_CELL_INERT, 40, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE);
|
|
1036 m_dataViewListColumnDrvDate = m_dataViewListCtrlDrvDate->AppendTextColumn(wxT("日付"), wxDATAVIEW_CELL_INERT, 80, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE);
|
|
1037 m_dataViewListCtrlDrvDate->SetAlternateRowColour(wxColour(230, 230, 255)) ;
|
|
1038 fgSizerIdx->Add(m_dataViewListCtrlDrvDate, 1, wxALL|wxEXPAND, 5);
|
|
1039
|
|
1040 m_dataViewListCtrlDrvCcn = new wxDataViewListCtrl(m_panelMainte, wxID_ANY, wxDefaultPosition, wxSize(130, -1), wxDV_SINGLE|wxDV_ROW_LINES);
|
|
1041 m_dataViewListColumnDrvCcnNo = m_dataViewListCtrlDrvCcn->AppendTextColumn(wxT("No"), wxDATAVIEW_CELL_INERT, 50, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE );
|
|
1042 m_dataViewListColumnDrvCcn = m_dataViewListCtrlDrvCcn->AppendTextColumn(wxT("合議対"), wxDATAVIEW_CELL_INERT, -1, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE);
|
|
1043 m_dataViewListCtrlDrvCcn->SetAlternateRowColour(wxColour(230, 230, 255)) ;
|
|
1044 fgSizerIdx->Add(m_dataViewListCtrlDrvCcn, 1, wxALL|wxEXPAND, 5);
|
|
1045
|
|
1046 m_dataViewListCtrlDrv = new wxDataViewListCtrl(m_panelMainte, wxID_ANY, wxDefaultPosition, wxSize(300, -1), wxDV_SINGLE|wxDV_ROW_LINES);
|
|
1047 m_dataViewListColumnDrvNo = m_dataViewListCtrlDrv->AppendTextColumn(wxT("No"), wxDATAVIEW_CELL_INERT, 40, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE);
|
|
1048 m_dataViewListColumnDrvHno = m_dataViewListCtrlDrv->AppendTextColumn(wxT("被保険者番号"), wxDATAVIEW_CELL_INERT, 100, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE);
|
|
1049 m_dataViewListColumnDrvName = m_dataViewListCtrlDrv->AppendTextColumn(wxT(" 氏名"), wxDATAVIEW_CELL_INERT, 120, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE);
|
|
1050 m_dataViewListCtrlDrv->SetAlternateRowColour(wxColour(230, 230, 255)) ;
|
|
1051 fgSizerIdx->Add(m_dataViewListCtrlDrv, 1, wxALL|wxEXPAND, 5);
|
|
1052
|
|
1053 bSizerMainte->Add(fgSizerIdx, 0, wxLEFT|wxEXPAND, 30);
|
|
1054
|
|
1055 // ----
|
|
1056 m_staticline1 = new wxStaticLine(m_panelMainte, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);
|
|
1057 bSizerMainte->Add(m_staticline1, 0, wxEXPAND|wxALL, 5);
|
|
1058
|
|
1059 m_staticTextDBmainte = new wxStaticText(m_panelMainte, wxID_ANY, wxT("DB更新"), wxDefaultPosition, wxDefaultSize, 0);
|
|
1060 m_staticTextDBmainte->SetFont(wxFont(wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, true, wxEmptyString));
|
|
1061 bSizerMainte->Add(m_staticTextDBmainte, 0, wxALL, 5);
|
|
1062
|
|
1063 wxGridBagSizer* gbSizerDB = new wxGridBagSizer(0, 0);
|
|
1064 gbSizerDB->SetFlexibleDirection(wxBOTH);
|
|
1065 gbSizerDB->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
|
1066
|
|
1067 m_staticTextHhsDB = new wxStaticText(m_panelMainte, wxID_ANY, wxT("被保険者CSV"), wxDefaultPosition, wxDefaultSize, 0);
|
|
1068 gbSizerDB->Add(m_staticTextHhsDB, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
|
|
1069
|
|
1070 m_filePickerHhsDB = new wxFilePickerCtrl(m_panelMainte, wxID_ANY, wxEmptyString, wxT("Select a file"), wxT("CSV and TXT files (*.csv;*.txt)|*.csv;*.txt"), wxDefaultPosition, wxSize(200, -1), wxFLP_FILE_MUST_EXIST|wxFLP_OPEN|wxFLP_SMALL|wxFLP_USE_TEXTCTRL);
|
|
1071 gbSizerDB->Add(m_filePickerHhsDB, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALL|wxALIGN_CENTER_VERTICAL, 5);
|
|
1072
|
|
1073 m_buttonRegHhs = new wxButton(m_panelMainte, wxID_ANY, wxT("アップロード"), wxDefaultPosition, wxDefaultSize, 0);
|
|
1074 gbSizerDB->Add(m_buttonRegHhs, wxGBPosition(0, 2), wxGBSpan(1, 1), wxALL, 5);
|
|
1075
|
|
1076 m_textCtrlLastHhsDB = new wxTextCtrl(m_panelMainte, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(180, -1), 0);
|
|
1077 m_textCtrlLastHhsDB->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENU));
|
|
1078 gbSizerDB->Add(m_textCtrlLastHhsDB, wxGBPosition(0, 3), wxGBSpan(1, 1), wxALL|wxALIGN_CENTER_VERTICAL, 5);
|
|
1079
|
|
1080 m_staticTextRegImg = new wxStaticText(m_panelMainte, wxID_ANY, wxT("画像登録"), wxDefaultPosition, wxDefaultSize, 0);
|
|
1081 gbSizerDB->Add(m_staticTextRegImg, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
|
|
1082
|
|
1083 m_datePicker = new wxDatePickerCtrl(m_panelMainte, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN|wxDP_SHOWCENTURY);
|
|
1084 gbSizerDB->Add(m_datePicker, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALL|wxALIGN_CENTER_VERTICAL, 5);
|
|
1085
|
|
1086 m_buttonRegImg = new wxButton(m_panelMainte, wxID_ANY, wxT("アップロード"), wxDefaultPosition, wxDefaultSize, 0);
|
|
1087 gbSizerDB->Add(m_buttonRegImg, wxGBPosition(1, 2), wxGBSpan(1, 1), wxALL, 5);
|
|
1088
|
|
1089 m_textCtrlLastIndex = new wxTextCtrl(m_panelMainte, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(180, -1), 0);
|
|
1090 m_textCtrlLastIndex->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENU));
|
|
1091 gbSizerDB->Add(m_textCtrlLastIndex, wxGBPosition(1, 3), wxGBSpan(1, 1), wxALL, 5);
|
|
1092
|
|
1093 m_staticTextCSV = new wxStaticText(m_panelMainte, wxID_ANY, wxT("CSV出力"), wxDefaultPosition, wxDefaultSize, 0);
|
|
1094 gbSizerDB->Add(m_staticTextCSV, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
|
|
1095
|
|
1096 m_filePickerCSV = new wxFilePickerCtrl(m_panelMainte, wxID_ANY, wxEmptyString, wxT("Select a file"), wxT("CSV file(*.csv)|*.csv"), wxDefaultPosition, wxSize(200, -1), wxFLP_OVERWRITE_PROMPT|wxFLP_SAVE|wxFLP_SMALL|wxFLP_USE_TEXTCTRL);
|
|
1097 gbSizerDB->Add(m_filePickerCSV, wxGBPosition(2, 1), wxGBSpan(1, 1), wxALL|wxALIGN_CENTER_VERTICAL, 5);
|
|
1098
|
|
1099 m_buttonCSV = new wxButton(m_panelMainte, wxID_ANY, wxT("出力"), wxDefaultPosition, wxDefaultSize, 0);
|
|
1100 gbSizerDB->Add(m_buttonCSV, wxGBPosition(2, 2), wxGBSpan(1, 1), wxALL|wxALIGN_CENTER_VERTICAL, 5);
|
|
1101
|
|
1102 bSizerMainte->Add(gbSizerDB, 0, wxLEFT, 30);
|
|
1103
|
|
1104 m_staticline2 = new wxStaticLine(m_panelMainte, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);
|
|
1105 bSizerMainte->Add(m_staticline2, 0, wxEXPAND | wxALL, 5);
|
|
1106
|
|
1107 m_staticTextVersion = new wxStaticText(m_panelMainte, wxID_ANY, wxT("バージョン情報"), wxDefaultPosition, wxDefaultSize, 0);
|
|
1108 m_staticTextVersion->SetFont(wxFont(wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, true, wxEmptyString));
|
|
1109
|
|
1110 bSizerMainte->Add(m_staticTextVersion, 0, wxALL, 5);
|
|
1111
|
|
1112 m_textCtrlVersion = new wxTextCtrl(m_panelMainte, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_MULTILINE);
|
|
1113 bSizerMainte->Add(m_textCtrlVersion, 1, wxALL|wxEXPAND, 5);
|
|
1114
|
|
1115 m_panelMainte->SetSizer(bSizerMainte);
|
|
1116 m_panelMainte->Layout();
|
|
1117 bSizerMainte->Fit(m_panelMainte);
|
|
1118 m_notebook->AddPage(m_panelMainte, wxT("メンテナンス"), false);
|
|
1119
|
|
1120 m_panelSetup = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
|
1121 wxBoxSizer* bSizerSetup = new wxBoxSizer(wxHORIZONTAL);
|
|
1122
|
|
1123 m_dataViewListCtrlPw = new wxDataViewListCtrl(m_panelSetup, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_HORIZ_RULES|wxDV_ROW_LINES|wxDV_VERT_RULES);
|
|
1124 m_dataViewListColumnUId = m_dataViewListCtrlPw->AppendTextColumn(wxT(" ID"), wxDATAVIEW_CELL_EDITABLE, 80, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE);
|
|
1125 m_dataViewListColumnUName = m_dataViewListCtrlPw->AppendTextColumn(wxT(" Name"), wxDATAVIEW_CELL_EDITABLE, 180, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE);
|
|
1126 m_dataViewListColumnUGroup = m_dataViewListCtrlPw->AppendTextColumn(wxT(" Group"), wxDATAVIEW_CELL_EDITABLE, 80, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE);
|
|
1127 m_dataViewListColumnUPw = m_dataViewListCtrlPw->AppendTextColumn(wxT(" Password"), wxDATAVIEW_CELL_EDITABLE, -1, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE);
|
|
1128 bSizerSetup->Add(m_dataViewListCtrlPw, 1, wxEXPAND|wxALL, 5);
|
|
1129
|
|
1130 m_textCtrlUPassword = new wxTextCtrl(m_panelSetup, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD|wxTE_PROCESS_ENTER);
|
|
1131 bSizerSetup->Add(m_textCtrlUPassword, 0, wxALL, 5);
|
|
1132
|
|
1133 m_buttonPw = new wxButton(m_panelSetup, wxID_ANY, wxT("保存"), wxDefaultPosition, wxDefaultSize, 0);
|
|
1134 bSizerSetup->Add(m_buttonPw, 0, wxALL, 5);
|
|
1135
|
|
1136 m_panelSetup->SetSizer(bSizerSetup);
|
|
1137 m_panelSetup->Layout();
|
|
1138 bSizerSetup->Fit(m_panelSetup);
|
|
1139 m_notebook->AddPage(m_panelSetup, wxT("設定"), true);
|
|
1140
|
|
1141
|
|
1142 gbSizer->Add(m_notebook, wxGBPosition(0, 0), wxGBSpan(9, 1), wxEXPAND|wxALL, 5);
|
|
1143 m_notebook->SetSelection(0);
|
|
1144
|
|
1145 m_searchCtrl = new wxSearchCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
|
|
1146 m_searchCtrl->ShowSearchButton(true);
|
|
1147 m_searchCtrl->ShowCancelButton(false);
|
|
1148 m_searchCtrl->SetMaxLength(10);
|
|
1149 gbSizer->Add(m_searchCtrl, wxGBPosition(0, 1), wxGBSpan(1, 2), wxALL, 5);
|
|
1150
|
|
1151 m_buttonPaste = new wxButton(this, wxID_ANY, wxT("貼付検索"), wxDefaultPosition, wxSize(60, -1), 0);
|
|
1152 gbSizer->Add(m_buttonPaste, wxGBPosition(0, 3), wxGBSpan(1, 1), wxALL, 5);
|
|
1153
|
|
1154 m_textCtrlName = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
|
|
1155 gbSizer->Add(m_textCtrlName, wxGBPosition(1, 1), wxGBSpan(1, 2), wxALL, 5);
|
|
1156
|
|
1157 m_textCtrlAddr = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(220, -1), 0);
|
|
1158 gbSizer->Add(m_textCtrlAddr, wxGBPosition(2, 1), wxGBSpan(1, 3), wxALL, 5);
|
|
1159
|
|
1160 m_dataViewListCtrlAny = new wxDataViewListCtrl(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 400), wxDV_ROW_LINES);
|
|
1161 m_dataViewListColumnAnyNo = m_dataViewListCtrlAny->AppendTextColumn(wxT("番号"), wxDATAVIEW_CELL_INERT, 40, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE);
|
|
1162 m_dataViewListColumnAny1 = m_dataViewListCtrlAny->AppendTextColumn(wxT(" 日付"), wxDATAVIEW_CELL_INERT, 90, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE);
|
|
1163 m_dataViewListColumnAny2 = m_dataViewListCtrlAny->AppendTextColumn(wxEmptyString, wxDATAVIEW_CELL_INERT, 90, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE);
|
|
1164 m_dataViewListColumnAny3 = m_dataViewListCtrlAny->AppendTextColumn(wxEmptyString, wxDATAVIEW_CELL_INERT, 90, static_cast<wxAlignment>(wxALIGN_LEFT), wxDATAVIEW_COL_RESIZABLE);
|
|
1165 m_dataViewListColumnAny4 = m_dataViewListCtrlAny->AppendTextColumn(wxEmptyString, wxDATAVIEW_CELL_INERT, -1, static_cast<wxAlignment>(wxALIGN_CENTER), wxDATAVIEW_COL_RESIZABLE);
|
|
1166 m_dataViewListCtrlAny->SetAlternateRowColour(wxColour(230, 230, 255)) ;
|
|
1167 gbSizer->Add(m_dataViewListCtrlAny, wxGBPosition(3, 1), wxGBSpan(1, 3), wxALL|wxEXPAND, 5);
|
|
1168
|
|
1169 //gbSizer->Add(0, 220, wxGBPosition(4, 1), wxGBSpan(1, 1), wxEXPAND, 5);
|
|
1170 gbSizer->Add(0, 20, wxGBPosition(4, 1), wxGBSpan(1, 1), wxEXPAND, 5);
|
|
1171
|
|
1172 m_checkBoxMask = new wxCheckBox(this, wxID_ANY, wxT("マスク処理"), wxDefaultPosition, wxDefaultSize, 0);
|
|
1173 gbSizer->Add(m_checkBoxMask, wxGBPosition(5, 1), wxGBSpan(1, 1), wxALL, 5);
|
|
1174
|
|
1175 m_checkBoxBoth = new wxCheckBox(this, wxID_ANY, wxT("両面処理"), wxDefaultPosition, wxDefaultSize, 0);
|
|
1176 m_checkBoxBoth->SetValue(true);
|
|
1177 gbSizer->Add(m_checkBoxBoth, wxGBPosition(5, 2), wxGBSpan(1, 1), wxALL, 5);
|
|
1178
|
|
1179 m_buttonPrint = new wxButton(this, wxID_ANY, wxT("印刷"), wxDefaultPosition, wxDefaultSize, 0);
|
|
1180 gbSizer->Add(m_buttonPrint, wxGBPosition(6, 1), wxGBSpan(1, 1), wxALL|wxALIGN_CENTER_VERTICAL, 5);
|
|
1181
|
|
1182 m_spinCtrl = new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(50, -1), wxSP_ARROW_KEYS, 80, 120, 100);
|
|
1183 gbSizer->Add(m_spinCtrl, wxGBPosition(6, 2), wxGBSpan(1, 1), wxALL|wxALIGN_CENTER_VERTICAL, 5);
|
|
1184
|
|
1185 m_gauge = new wxGauge(this, wxID_ANY, 100, wxDefaultPosition, wxSize(200, -1), wxGA_HORIZONTAL);
|
|
1186 m_gauge->SetValue(0);
|
|
1187 gbSizer->Add(m_gauge, wxGBPosition(7, 1), wxGBSpan(1, 2), wxALL, 5);
|
|
1188
|
|
1189 m_textCtrlPasswd = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD|wxTE_PROCESS_ENTER);
|
|
1190 m_textCtrlPasswd->SetMaxLength(16);
|
|
1191 gbSizer->Add(m_textCtrlPasswd, wxGBPosition(8, 1), wxGBSpan(1, 2), wxALL|wxALIGN_BOTTOM, 5);
|
|
1192
|
|
1193 this->SetSizer(gbSizer);
|
|
1194 this->Layout();
|
|
1195
|
|
1196 this->Centre(wxBOTH);
|
|
1197 }
|
|
1198
|
|
1199 void SearchFrame::InitializeControlsValue()
|
|
1200 {
|
|
1201 wxString conf_file = wxGetCwd() + wxFILE_SEP_PATH + wxT("searcher.conf");
|
|
1202 wxFileConfig* conf = new wxFileConfig(wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
|
|
1203 wxString buf;
|
|
1204
|
|
1205 conf->SetPath(wxT("/Server"));
|
|
1206 conf->Read(wxT("addr"), &m_addr);
|
|
1207 conf->Read(wxT("port"), &m_port);
|
|
1208
|
|
1209 conf->SetPath(wxT("/BatchPrint"));
|
|
1210 conf->Read(wxT("file"), &buf);
|
|
1211 m_filePicker->SetPath(buf);
|
|
1212 conf->Read(wxT("zoom"), &buf);
|
|
1213 m_spinCtrl->SetValue(buf);
|
|
1214
|
|
1215 conf->SetPath(wxT("/Mask"));
|
|
1216 conf->Read(wxT("mask1"), &buf);
|
|
1217 m_mask1 = Geo2Rect(buf);
|
|
1218 conf->Read(wxT("mask2"), &buf);
|
|
1219 m_mask2 = Geo2Rect(buf);
|
|
1220 conf->Read(wxT("mask3"), &buf);
|
|
1221 m_mask3 = Geo2Rect(buf);
|
|
1222 conf->Read(wxT("mask4"), &buf);
|
|
1223 m_mask4 = Geo2Rect(buf);
|
|
1224
|
|
1225 conf->SetPath(wxT("/Misc"));
|
|
1226 conf->Read(wxT("workdir"), &m_workdir);
|
|
1227 conf->Read(wxT("uphhscsv"), &m_hhscsv);
|
|
1228
|
|
1229 delete conf;
|
|
1230
|
|
1231 /*
|
|
1232 wxFont font(12, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
|
|
1233 m_searchCtrl->SetFont(font);
|
|
1234 */
|
|
1235
|
|
1236 m_staticBitmap1 = new MyStaticBitmap(m_scrolledWindow1, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString);
|
|
1237 m_staticBitmap2 = new MyStaticBitmap(m_scrolledWindow2, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString);
|
|
1238 m_staticBitmap3 = new MyStaticBitmap(m_scrolledWindow3, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString);
|
|
1239 m_staticBitmap4 = new MyStaticBitmap(m_scrolledWindow4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString);
|
|
1240 m_staticBitmap5 = new MyStaticBitmap(m_scrolledWindow5, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString);
|
|
1241
|
|
1242 m_staticBitmap1->SetParentWidows(this, m_notebook);
|
|
1243 m_staticBitmap2->SetParentWidows(this, m_notebook);
|
|
1244 m_staticBitmap3->SetParentWidows(this, m_notebook);
|
|
1245 m_staticBitmap4->SetParentWidows(this, m_notebook);
|
|
1246 m_staticBitmap5->SetParentWidows(this, m_notebook);
|
|
1247
|
|
1248 m_filePickerHhsDB->SetPath(m_hhscsv);
|
|
1249
|
|
1250 wxString url = wxT("/ht/");
|
|
1251 wxString date = HttpGetText(m_addr, m_port, url);
|
|
1252 m_textCtrlLastHhsDB->SetValue(date);
|
|
1253
|
|
1254 url = wxT("/dt/");
|
|
1255 wxString latest = HttpGetText(m_addr, m_port, url);
|
|
1256 m_textCtrlLastIndex->SetValue(latest);
|
|
1257
|
|
1258 m_searchmode = 0;
|
|
1259 m_textCtrlPasswd->SetFocus();
|
|
1260 }
|
|
1261
|
|
1262 void SearchFrame::SetHhsInfo(wxString h)
|
|
1263 {
|
|
1264 wxArrayString hinfo = wxSplit(h, ':', '\\');
|
|
1265 m_textCtrlName->SetValue(hinfo[0]);
|
|
1266 m_textCtrlAddr->SetValue(hinfo[1]);
|
|
1267
|
|
1268 wxArrayString ccn = wxSplit(hinfo[2], '#', '\\');
|
|
1269 for (int i = 0; i < ccn.GetCount(); i++) {
|
|
1270 ccn[i] = ccn[i].Left(4) + wxT("-") + ccn[i].Mid(4, 2) + wxT("-") + ccn[i].Right(2);
|
|
1271 }
|
|
1272
|
|
1273 m_dataViewListCtrlAny->DeleteAllItems();
|
|
1274 wxVector<wxVariant> data;
|
|
1275 for (int i = 0; i < ccn.GetCount(); i++) {
|
|
1276 data.push_back(wxVariant(wxString::Format(wxT("%02d"), i + 1)));
|
|
1277 data.push_back(wxVariant(ccn[i]));
|
|
1278 data.push_back(wxVariant(wxEmptyString));
|
|
1279 data.push_back(wxVariant(wxEmptyString));
|
|
1280 data.push_back(wxVariant(wxEmptyString));
|
|
1281
|
|
1282 m_dataViewListCtrlAny->AppendItem(data);
|
|
1283 data.clear();
|
|
1284 }
|
|
1285
|
|
1286 if (ccn.GetCount() > 0) m_dataViewListCtrlAny->SelectRow(0);
|
|
1287 }
|
|
1288
|
|
1289 void SearchFrame::SetListAnyHeader(int mode)
|
|
1290 {
|
|
1291 m_textCtrlName->Clear();
|
|
1292 m_textCtrlAddr->Clear();
|
|
1293 m_dataViewListColumnAny1->SetTitle(wxEmptyString);
|
|
1294 m_dataViewListColumnAny2->SetTitle(wxEmptyString);
|
|
1295 m_dataViewListColumnAny3->SetTitle(wxEmptyString);
|
|
1296
|
|
1297 if (mode == 0) { // hno
|
|
1298 m_dataViewListColumnAny1->SetTitle(wxT(" 日付"));
|
|
1299 }
|
|
1300 if (mode == 1) { // history
|
|
1301 m_dataViewListColumnAny1->SetTitle(wxT("被保番"));
|
|
1302 m_dataViewListColumnAny2->SetTitle(wxT(" 氏名"));
|
|
1303 }
|
|
1304 if (mode == 2) { // kana
|
|
1305 m_dataViewListColumnAny1->SetTitle(wxT("被保番"));
|
|
1306 m_dataViewListColumnAny2->SetTitle(wxT(" 氏名"));
|
|
1307 m_dataViewListColumnAny3->SetTitle(wxT(" 住所"));
|
|
1308 }
|
|
1309 m_searchmode = mode;
|
|
1310 }
|
|
1311
|
|
1312 void SearchFrame::SearchByHno(wxString hno)
|
|
1313 {
|
|
1314 wxString url = wxT("/h/") + hno;
|
|
1315 wxString h = HttpGetText(m_addr, m_port, url); // Get /h/0800012345 -> name:addr:ymd1#ymd2#...
|
|
1316
|
|
1317 if (h.IsEmpty()) {
|
|
1318 wxMessageBox(wxT("no data."));
|
|
1319 return;
|
|
1320 } else {
|
|
1321 SetHhsInfo(h);
|
|
1322 SetImages();
|
|
1323 }
|
|
1324
|
|
1325 m_notebook->SetSelection(0);
|
|
1326 }
|
|
1327
|
|
1328 void SearchFrame::SetImages()
|
|
1329 {
|
|
1330 if (m_dataViewListCtrlAny->GetSelectedRow() == wxNOT_FOUND) return;
|
|
1331
|
|
1332 int r = m_dataViewListCtrlAny->GetSelectedRow();
|
|
1333 wxString date = m_dataViewListCtrlAny->GetTextValue(r, 1);
|
|
1334 date.Replace(wxT("-"), wxEmptyString, true);
|
|
1335
|
|
1336 // Get /i/20200110/0800012345.tgz
|
|
1337 wxString url = wxT("/i/") + date + wxT("/") + m_searchCtrl->GetValue() + wxT(".tgz");
|
|
1338 HttpGetTgzFile(m_addr, m_port, url, m_workdir);
|
|
1339 LoadBookImages();
|
|
1340 }
|
|
1341
|
|
1342 void SearchFrame::LoadBookImage(MyStaticBitmap& mysb, wxString file)
|
|
1343 {
|
|
1344 mysb.SetBitmap(wxNullBitmap);
|
|
1345 mysb.zoom = 0;
|
|
1346 mysb.ParentWinScroll(0, 0);
|
|
1347
|
|
1348 if (!wxFileExists(file)) file = wxT("image/testpattern.tif");
|
|
1349
|
|
1350 wxBitmap bmp(file, wxBITMAP_TYPE_TIFF);
|
|
1351 int width = bmp.GetWidth();
|
|
1352 int height = bmp.GetHeight();
|
|
1353 wxImage img = bmp.ConvertToImage();
|
|
1354
|
|
1355 int ww, wh;
|
|
1356 mysb.ParentWinGetSize(&ww, &wh);
|
|
1357
|
|
1358 float w = ww - 30;
|
|
1359 float h = w * height / width;
|
|
1360 mysb.SetBitmap(wxBitmap(img.Scale(w, h, wxIMAGE_QUALITY_HIGH)));
|
|
1361 mysb.ParentWinSetScrollbars(10, 10, (int)w / 10, (int)h / 10);
|
|
1362 }
|
|
1363
|
|
1364 void SearchFrame::LoadBookImages()
|
|
1365 {
|
|
1366 LoadBookImage(*m_staticBitmap1, m_workdir + wxFILE_SEP_PATH + wxT("1"));
|
|
1367 LoadBookImage(*m_staticBitmap2, m_workdir + wxFILE_SEP_PATH + wxT("2"));
|
|
1368 LoadBookImage(*m_staticBitmap3, m_workdir + wxFILE_SEP_PATH + wxT("3"));
|
|
1369 LoadBookImage(*m_staticBitmap4, m_workdir + wxFILE_SEP_PATH + wxT("4"));
|
|
1370 LoadBookImage(*m_staticBitmap5, m_workdir + wxFILE_SEP_PATH + wxT("5"));
|
|
1371 }
|
|
1372
|
|
1373 void SearchFrame::ReadCSV()
|
|
1374 {
|
|
1375 m_dataViewListCtrlBatch->DeleteAllItems();
|
|
1376
|
|
1377 wxString file = m_filePicker->GetPath();
|
|
1378 wxTextFile input(file);
|
|
1379
|
|
1380 if (!input.Exists()) {
|
|
1381 wxMessageBox(wxT("Don't exist file"));
|
|
1382 return;
|
|
1383 }
|
|
1384
|
|
1385 wxCSConv cust(wxT("cp932"));
|
|
1386 input.Open(cust);
|
|
1387 wxArrayString hhslist, iklist;
|
|
1388 for (wxString buf = input.GetFirstLine(); !input.Eof(); buf = input.GetNextLine()) {
|
|
1389 if (buf.StartsWith(wxT("0"))) {
|
|
1390 hhslist.Add(buf.Left(10));
|
|
1391 wxArrayString cols = wxSplit(buf, ',', '\\');
|
|
1392 if (cols[2].IsEmpty()) {
|
|
1393 iklist.Add(wxEmptyString);
|
|
1394 } else {
|
|
1395 iklist.Add(wxT("1"));
|
|
1396 }
|
|
1397 }
|
|
1398 }
|
|
1399 input.Close();
|
|
1400
|
|
1401 wxString url = wxT("/r/") + wxJoin(hhslist, ':', '\\');
|
|
1402 wxString lists = HttpGetText(m_addr, m_port, url);
|
|
1403 wxArrayString list = wxSplit(lists, ':', '\\');
|
|
1404
|
|
1405 wxVector<wxVariant> data;
|
|
1406 for (int i = 0; i < list.GetCount(); i++) {
|
|
1407 wxArrayString hinfo = wxSplit(list[i], ',', '\\');
|
|
1408 data.push_back(wxVariant(wxString::Format(wxT("%03d"), i + 1)));
|
|
1409 data.push_back(wxVariant(hinfo[0]));
|
|
1410 data.push_back(wxVariant(hinfo[1]));
|
|
1411 if (hinfo[2] != wxEmptyString) {
|
|
1412 hinfo[2] = hinfo[2].Left(4) + wxT("-") + hinfo[2].Mid(4,2) + wxT("-") + hinfo[2].Right(2);
|
|
1413 }
|
|
1414 data.push_back(wxVariant(hinfo[2]));
|
|
1415 if (iklist[i].IsEmpty()) {
|
|
1416 data.push_back(wxVariant(false));
|
|
1417 } else {
|
|
1418 data.push_back(wxVariant(true));
|
|
1419 }
|
|
1420 data.push_back(wxVariant(1)); // status
|
|
1421 data.push_back(wxVariant(wxEmptyString)); // dummy
|
|
1422
|
|
1423 m_dataViewListCtrlBatch->AppendItem(data);
|
|
1424 data.clear();
|
|
1425 }
|
|
1426 }
|
|
1427
|
|
1428 void SearchFrame::MaskImage()
|
|
1429 {
|
|
1430 wxString file = m_workdir + wxFILE_SEP_PATH + wxT("1");
|
|
1431 wxImage imgfile(file, wxBITMAP_TYPE_TIFF);
|
|
1432
|
|
1433 // here version check
|
|
1434 int mver = 1;
|
|
1435 int black = 0;
|
|
1436 int th = 38;
|
|
1437 unsigned char r, g, b;
|
|
1438
|
5
|
1439 for (int x = 2450, y = 1600; y < 1850; y++) {
|
0
|
1440 r = imgfile.GetRed(x, y);
|
|
1441 g = imgfile.GetGreen(x, y);
|
|
1442 b = imgfile.GetBlue(x, y);
|
|
1443 if ((int)r < th && (int)g < th && (int)b < th) black++;
|
|
1444 }
|
|
1445 if (black > 25) mver = 2;
|
|
1446
|
|
1447 imgfile.SetRGB(m_mask1, 255, 255, 255);
|
|
1448 imgfile.SetRGB(m_mask2, 255, 255, 255);
|
|
1449 imgfile.SetRGB(m_mask3, 255, 255, 255);
|
|
1450 if (mver == 2) imgfile.SetRGB(m_mask4, 255, 255, 255);
|
|
1451
|
|
1452 imgfile.SaveFile(file, wxBITMAP_TYPE_TIFF);
|
|
1453 }
|
|
1454
|
|
1455 void SearchFrame::LoadPasswd(bool show)
|
|
1456 {
|
|
1457 m_dataViewListCtrlPw->DeleteAllItems();
|
|
1458
|
|
1459 wxString url = wxT("/pw/");
|
|
1460 wxString buf = HttpGetText(m_addr, m_port, url);
|
|
1461 wxArrayString idpw = wxSplit(buf, ':', '\\');
|
|
1462 wxVector<wxVariant> data;
|
|
1463 for (int r = 0; r < idpw.GetCount() / 3; r++) {
|
|
1464 int i = r * 3;
|
|
1465 wxArrayString x = wxSplit(idpw[i], '/', '\\');
|
|
1466 data.push_back(wxVariant(x[1]));
|
|
1467 data.push_back(wxVariant(idpw[i + 1]));
|
|
1468 data.push_back(wxVariant(x[0]));
|
|
1469 //if (!show) idpw[i + 2] = wxT("********");
|
|
1470 //data.push_back(wxVariant(idpw[i + 2]));
|
|
1471 wxString pw = XoR(idpw[i + 2], PWXORN);
|
|
1472 pw.Replace(PWPREFIX, wxEmptyString, false);
|
|
1473 data.push_back(wxVariant(pw));
|
|
1474
|
|
1475 m_dataViewListCtrlPw->AppendItem(data);
|
|
1476 data.clear();
|
|
1477 }
|
|
1478 }
|
|
1479
|
|
1480 void SearchFrame::SavePasswd()
|
|
1481 {
|
|
1482 }
|
|
1483
|
|
1484 void SearchFrame::RemoveTemp()
|
|
1485 {
|
|
1486 for (int p = 0; p < 5; p++) {
|
|
1487 wxString file = m_workdir + wxFILE_SEP_PATH + wxString::Format(wxT("%d"), p + 1);
|
|
1488 if (wxFileExists(file)) wxRemoveFile(file);
|
|
1489 }
|
|
1490 }
|
|
1491
|
|
1492 void SearchFrame::SetVersionInfo()
|
|
1493 {
|
5
|
1494 this->SetTitle(wxT("Searcher - v1.1.1"));
|
|
1495 m_textCtrlVersion->AppendText(wxT("1.1.1 : bug fix (2021-06-15)\n"));
|
0
|
1496 m_textCtrlVersion->AppendText(wxT("1.1.0 : adapt to new marksheet (2021-05-11)\n"));
|
|
1497 m_textCtrlVersion->AppendText(wxT("1.0.4 : small fix (2020-12-24)\n"));
|
|
1498 m_textCtrlVersion->AppendText(wxT("1.0.3 : new feature - paste search (2020-06-26)\n"));
|
|
1499 m_textCtrlVersion->AppendText(wxT("1.0.2 : new feature - dump index (2020-06-24)\n"));
|
|
1500 m_textCtrlVersion->AppendText(wxT("1.0.1 : bug fix (2020-06-22)\n"));
|
|
1501 m_textCtrlVersion->AppendText(wxT("1.0.0 : release out (2020-05-01)\n"));
|
|
1502 }
|
|
1503
|