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