0
|
1 // Filename : rsearcher.h
|
16
|
2 // Last Change: 2019-07-08 ŒŽ 15:42:44.
|
0
|
3 //
|
|
4
|
16
|
5 #pragma once
|
0
|
6
|
|
7 #include <wx/artprov.h>
|
|
8 #include <wx/xrc/xmlres.h>
|
|
9 #include <wx/string.h>
|
|
10 #include <wx/srchctrl.h>
|
|
11 #include <wx/gdicmn.h>
|
|
12 #include <wx/font.h>
|
|
13 #include <wx/colour.h>
|
|
14 #include <wx/settings.h>
|
|
15 #include <wx/textctrl.h>
|
14
|
16 #include <wx/checklst.h>
|
0
|
17 #include <wx/button.h>
|
|
18 #include <wx/notebook.h>
|
|
19 #include <wx/dataview.h>
|
14
|
20 #include <wx/spinctrl.h>
|
0
|
21 #include <wx/slider.h>
|
|
22 #include <wx/sizer.h>
|
|
23 #include <wx/html/htmlwin.h>
|
|
24 #include <wx/frame.h>
|
10
|
25 #include <wx/splitter.h>
|
0
|
26 #include <wx/statbmp.h>
|
|
27 #include <wx/msgdlg.h>
|
2
|
28 #include <wx/filefn.h>
|
0
|
29 #include <wx/regex.h>
|
3
|
30 #include <wx/progdlg.h>
|
|
31 #include <wx/utils.h>
|
2
|
32 #include <wx/textfile.h>
|
3
|
33 #include <wx/timer.h>
|
5
|
34 #include <wx/hashmap.h>
|
7
|
35 #include "net.h"
|
0
|
36
|
5
|
37 /* Data Class */
|
|
38 class HhsClass {
|
|
39 public:
|
|
40 wxString no;
|
|
41 wxString birth;
|
|
42 wxString name;
|
|
43 wxString kana;
|
|
44 wxString addr;
|
|
45 wxString sex;
|
|
46
|
|
47 HhsClass( wxArrayString& buf );
|
|
48 };
|
|
49
|
|
50 WX_DECLARE_HASH_MAP( wxString, HhsClass*, wxStringHash, wxStringEqual, HhsHash );
|
|
51
|
|
52 /* Control-Window Class */
|
0
|
53 class MySearchCtrl : public wxSearchCtrl
|
|
54 {
|
|
55 DECLARE_EVENT_TABLE()
|
|
56 public:
|
|
57 MySearchCtrl( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style );
|
|
58 ~MySearchCtrl();
|
|
59
|
|
60 void OnKey( wxKeyEvent& event );
|
|
61 };
|
|
62
|
|
63 class MyStaticBitmap : public wxStaticBitmap
|
|
64 {
|
|
65 private:
|
3
|
66 int m_dragx, m_dragy; // for image drag
|
|
67 int cx, cy; // for mouse-gesture
|
9
|
68 bool with_stl = false;
|
6
|
69 wxBitmap m_bmp0;
|
0
|
70 wxScrolledWindow* m_parent;
|
6
|
71
|
|
72 public:
|
|
73 int zoom = 0;
|
0
|
74
|
|
75 public:
|
|
76 MyStaticBitmap( wxScrolledWindow *parent, wxWindowID id, const wxBitmap &label, const wxPoint &pos, const wxSize &size, long style, const wxString &name );
|
|
77 ~MyStaticBitmap();
|
|
78
|
|
79 void OnLeftDown( wxMouseEvent& event );
|
|
80 void OnLeftUp( wxMouseEvent& event );
|
9
|
81 void OnLeftDClick( wxMouseEvent& event );
|
|
82 void OnRightDClick( wxMouseEvent& event );
|
3
|
83 void OnStartRGesture( wxMouseEvent& event );
|
|
84 void OnEndRGesture( wxMouseEvent& event );
|
0
|
85 void OnMotion( wxMouseEvent& event );
|
|
86 void OnWheel( wxMouseEvent& event );
|
6
|
87 void SetOrigImage( wxBitmap bmp ) { m_bmp0 = bmp; };
|
|
88 wxBitmap GetOrigImage( void ) { return m_bmp0; };
|
4
|
89 void ChangeBook( int i );
|
9
|
90 void WithSatellite( bool sw ) { with_stl = sw; };
|
|
91 };
|
|
92
|
|
93 class StlFrame : public wxFrame
|
|
94 {
|
|
95 private:
|
|
96 wxScrolledWindow* m_scrolledWindow;
|
|
97 MyStaticBitmap* m_staticBitmap;
|
|
98
|
|
99 public:
|
|
100 StlFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT( "Searcher Remote" ), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );
|
|
101 ~StlFrame();
|
|
102
|
|
103 void SetBitmap( wxBitmap bmp ) { m_staticBitmap->SetBitmap( bmp ); };
|
|
104 void SetScroll( int w, int h ) { m_scrolledWindow->SetScrollbars( 10, 10, (int)w / 10, (int)h / 10 ); };
|
0
|
105 };
|
|
106
|
|
107 class MainFrame : public wxFrame
|
|
108 {
|
|
109 DECLARE_EVENT_TABLE()
|
|
110 private:
|
2
|
111 bool startup = true;
|
|
112 wxString m_server;
|
|
113 wxString m_hhs;
|
13
|
114 wxString m_dbdir;
|
3
|
115 wxString m_user;
|
2
|
116 wxArrayString m_index;
|
3
|
117 wxTimer m_timer;
|
5
|
118 HhsHash hhash;
|
7
|
119 RsHttp http;
|
6
|
120 bool m_dark = false;
|
0
|
121
|
|
122 protected:
|
|
123 MySearchCtrl* m_searchCtrl;
|
|
124 MyStaticBitmap* m_staticBitmap1;
|
|
125 MyStaticBitmap* m_staticBitmap2;
|
|
126 MyStaticBitmap* m_staticBitmap3;
|
|
127 MyStaticBitmap* m_staticBitmap4;
|
|
128 MyStaticBitmap* m_staticBitmap5;
|
1
|
129 MyStaticBitmap* m_staticBitmap6;
|
0
|
130
|
10
|
131 wxSplitterWindow* m_splitter;
|
|
132 wxPanel* m_panelLeft;
|
|
133 wxPanel* m_panelRight;
|
0
|
134 wxNotebook* m_notebook;
|
|
135 wxScrolledWindow* m_scrolledWindow1;
|
|
136 wxScrolledWindow* m_scrolledWindow2;
|
|
137 wxScrolledWindow* m_scrolledWindow3;
|
|
138 wxScrolledWindow* m_scrolledWindow4;
|
|
139 wxScrolledWindow* m_scrolledWindow5;
|
|
140 wxScrolledWindow* m_scrolledWindow6;
|
|
141
|
|
142 wxTextCtrl* m_textCtrlName;
|
|
143 wxTextCtrl* m_textCtrlAddr;
|
|
144 wxDataViewListCtrl* m_dataViewListCtrl;
|
|
145 wxDataViewColumn* m_dataViewListColumnNo;
|
|
146 wxDataViewColumn* m_dataViewListColumnDate;
|
10
|
147 wxDataViewColumn* m_dataViewListColumnReady;
|
|
148 wxDataViewListCtrl* m_dataViewListKana;
|
|
149 wxDataViewColumn* m_dataViewListColumnKNo;
|
|
150 wxDataViewColumn* m_dataViewListColumnName;
|
|
151 wxDataViewColumn* m_dataViewListColumnAddr;
|
14
|
152 wxCheckListBox* m_checkListBox;
|
0
|
153 wxTextCtrl* m_textCtrlLog;
|
5
|
154 wxButton* m_buttonPsearch;
|
0
|
155 wxButton* m_buttonPrint;
|
14
|
156 wxSpinCtrl* m_spinCtrl;
|
6
|
157
|
|
158 // invisible button for shortcut-key
|
|
159 wxSlider* m_slider;
|
7
|
160 wxButton* m_buttonFocus;
|
6
|
161 wxButton* m_buttonPzoom;
|
|
162 wxButton* m_buttonMzoom;
|
|
163 wxButton* m_buttonDark;
|
9
|
164 wxButton* m_buttonSatellite;
|
13
|
165 wxButton* m_buttonUpdateIndex;
|
|
166 wxButton* m_buttonDLMan;
|
16
|
167 wxButton* m_buttonBPrint;
|
|
168 wxButton* m_buttonIndex;
|
5
|
169 wxButton* m_buttonHelp;
|
7
|
170 wxButton* m_buttonClose;
|
3
|
171 wxButton* m_buttonLogout;
|
0
|
172
|
|
173 public:
|
|
174 MainFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT( "Searcher Remote" ), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );
|
|
175 ~MainFrame();
|
3
|
176
|
13
|
177 void SetServer( wxString addr, int port ) { http.SetServer( addr, port ); m_server = wxString::Format(wxT("%s:%d"),addr,port); };
|
|
178 void SetDBdir( wxString dir ) { m_dbdir = dir; };
|
|
179 bool GetDB( int a, int h, int i ) { return http.GetDB( a, h, i ); };
|
5
|
180 void SetUser( wxString user ) { m_user = user; WriteLog( wxT( "[login] " ) + m_user ); };
|
2
|
181 void CreateControls( void );
|
5
|
182 void SetAccelerator( void );
|
2
|
183 void Cmd( wxString cmd );
|
|
184 void Search( void );
|
8
|
185 void PasteSearch( void );
|
15
|
186 void LoadDB( bool load_hhsdb );
|
13
|
187 void UpdateIndex( void );
|
6
|
188 bool LoadBitmap( wxScrolledWindow* sc, MyStaticBitmap* sb, wxString file );
|
5
|
189 bool LoadBitmaps( wxString date, bool reload );
|
6
|
190 void ChangeCZoom( int z );
|
|
191 void ChangeZoom( wxScrolledWindow* sc, MyStaticBitmap* sb, int z );
|
|
192 void ChangeColor( MyStaticBitmap* sb );
|
2
|
193 void GetImages( wxString hhs, wxString date );
|
3
|
194 void PrintImages( void );
|
5
|
195 void WriteLog( wxString msg );
|
7
|
196 void Close( void );
|
14
|
197 void SetControlsValue( void );
|
2
|
198 void InDevelop( bool );
|
|
199
|
10
|
200 void OnSplitWin( wxSplitterEvent & event );
|
2
|
201 void OnItemSelected( wxDataViewEvent& event );
|
0
|
202 void OnItemDClicked( wxDataViewEvent& event );
|
10
|
203 void OnKanaItemSelected( wxDataViewEvent& event );
|
|
204 void OnKanaItemDClicked( wxDataViewEvent& event );
|
0
|
205 void OnNBookChanged( wxBookCtrlEvent& event );
|
5
|
206 void OnPasteSearch( wxCommandEvent& event );
|
3
|
207 void OnPrint( wxCommandEvent& event );
|
7
|
208 void OnClose( wxCloseEvent& event );
|
|
209 void OnBClose( wxCommandEvent& event );
|
3
|
210 void OnIdle( wxIdleEvent& event );
|
|
211 void OnTimer( wxTimerEvent& event );
|
7
|
212
|
|
213 // for shortcut-key
|
|
214 void OnFocus( wxCommandEvent& event );
|
6
|
215 void OnPlusZoom( wxCommandEvent& event );
|
|
216 void OnMinusZoom( wxCommandEvent& event );
|
|
217 void OnDark( wxCommandEvent& event );
|
9
|
218 void OnSatellite( wxCommandEvent& event );
|
13
|
219 void OnUpdateIndex( wxCommandEvent& event );
|
|
220 void OnDownloadManual( wxCommandEvent& event );
|
16
|
221 void OnBatchPrint( wxCommandEvent& event );
|
|
222 void OnIndex( wxCommandEvent& event );
|
5
|
223 void OnHelp( wxCommandEvent& event );
|
3
|
224 void OnLogout( wxCommandEvent& event );
|
0
|
225 };
|
|
226
|