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