0
|
1 // Filename : rsearcher.h
|
10
|
2 // Last Change: 2018-11-08 –Ø 13:51: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>
|
|
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;
|
3
|
113 wxString m_user;
|
2
|
114 wxArrayString m_index;
|
3
|
115 wxTimer m_timer;
|
5
|
116 HhsHash hhash;
|
7
|
117 RsHttp http;
|
6
|
118 bool m_dark = false;
|
0
|
119
|
|
120 protected:
|
|
121 MySearchCtrl* m_searchCtrl;
|
|
122 MyStaticBitmap* m_staticBitmap1;
|
|
123 MyStaticBitmap* m_staticBitmap2;
|
|
124 MyStaticBitmap* m_staticBitmap3;
|
|
125 MyStaticBitmap* m_staticBitmap4;
|
|
126 MyStaticBitmap* m_staticBitmap5;
|
1
|
127 MyStaticBitmap* m_staticBitmap6;
|
0
|
128
|
10
|
129 wxSplitterWindow* m_splitter;
|
|
130 wxPanel* m_panelLeft;
|
|
131 wxPanel* m_panelRight;
|
0
|
132 wxNotebook* m_notebook;
|
|
133 wxScrolledWindow* m_scrolledWindow1;
|
|
134 wxScrolledWindow* m_scrolledWindow2;
|
|
135 wxScrolledWindow* m_scrolledWindow3;
|
|
136 wxScrolledWindow* m_scrolledWindow4;
|
|
137 wxScrolledWindow* m_scrolledWindow5;
|
|
138 wxScrolledWindow* m_scrolledWindow6;
|
|
139
|
|
140 wxTextCtrl* m_textCtrlName;
|
|
141 wxTextCtrl* m_textCtrlAddr;
|
|
142 wxDataViewListCtrl* m_dataViewListCtrl;
|
|
143 wxDataViewColumn* m_dataViewListColumnNo;
|
|
144 wxDataViewColumn* m_dataViewListColumnDate;
|
10
|
145 wxDataViewColumn* m_dataViewListColumnReady;
|
|
146 wxDataViewListCtrl* m_dataViewListKana;
|
|
147 wxDataViewColumn* m_dataViewListColumnKNo;
|
|
148 wxDataViewColumn* m_dataViewListColumnName;
|
|
149 wxDataViewColumn* m_dataViewListColumnAddr;
|
0
|
150 wxTextCtrl* m_textCtrlLog;
|
5
|
151 wxButton* m_buttonPsearch;
|
0
|
152 wxButton* m_buttonPrint;
|
6
|
153
|
|
154 // invisible button for shortcut-key
|
|
155 wxSlider* m_slider;
|
7
|
156 wxButton* m_buttonFocus;
|
6
|
157 wxButton* m_buttonPzoom;
|
|
158 wxButton* m_buttonMzoom;
|
|
159 wxButton* m_buttonDark;
|
9
|
160 wxButton* m_buttonSatellite;
|
5
|
161 wxButton* m_buttonHelp;
|
7
|
162 wxButton* m_buttonClose;
|
3
|
163 wxButton* m_buttonLogout;
|
0
|
164
|
|
165 public:
|
|
166 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 );
|
|
167 ~MainFrame();
|
3
|
168
|
7
|
169 void SetServer( wxString addr, int port ) { http.SetServer( addr, port ); m_server = wxString::Format(wxT("%s:%d"),addr,port);};
|
9
|
170 bool GetDB( void ) { return http.GetDB(); };
|
5
|
171 void SetUser( wxString user ) { m_user = user; WriteLog( wxT( "[login] " ) + m_user ); };
|
2
|
172 void CreateControls( void );
|
5
|
173 void SetAccelerator( void );
|
2
|
174 void Cmd( wxString cmd );
|
|
175 void Search( void );
|
8
|
176 void PasteSearch( void );
|
3
|
177 void LoadDB( void );
|
6
|
178 bool LoadBitmap( wxScrolledWindow* sc, MyStaticBitmap* sb, wxString file );
|
5
|
179 bool LoadBitmaps( wxString date, bool reload );
|
6
|
180 void ChangeCZoom( int z );
|
|
181 void ChangeZoom( wxScrolledWindow* sc, MyStaticBitmap* sb, int z );
|
|
182 void ChangeColor( MyStaticBitmap* sb );
|
2
|
183 void GetImages( wxString hhs, wxString date );
|
3
|
184 void PrintImages( void );
|
5
|
185 void WriteLog( wxString msg );
|
7
|
186 void Close( void );
|
2
|
187 void InDevelop( bool );
|
|
188
|
10
|
189 void OnSplitWin( wxSplitterEvent & event );
|
2
|
190 void OnItemSelected( wxDataViewEvent& event );
|
0
|
191 void OnItemDClicked( wxDataViewEvent& event );
|
10
|
192 void OnKanaItemSelected( wxDataViewEvent& event );
|
|
193 void OnKanaItemDClicked( wxDataViewEvent& event );
|
0
|
194 void OnNBookChanged( wxBookCtrlEvent& event );
|
5
|
195 void OnPasteSearch( wxCommandEvent& event );
|
3
|
196 void OnPrint( wxCommandEvent& event );
|
7
|
197 void OnClose( wxCloseEvent& event );
|
|
198 void OnBClose( wxCommandEvent& event );
|
3
|
199 void OnIdle( wxIdleEvent& event );
|
|
200 void OnTimer( wxTimerEvent& event );
|
7
|
201
|
|
202 // for shortcut-key
|
|
203 void OnFocus( wxCommandEvent& event );
|
6
|
204 void OnPlusZoom( wxCommandEvent& event );
|
|
205 void OnMinusZoom( wxCommandEvent& event );
|
|
206 void OnDark( wxCommandEvent& event );
|
9
|
207 void OnSatellite( wxCommandEvent& event );
|
5
|
208 void OnHelp( wxCommandEvent& event );
|
3
|
209 void OnLogout( wxCommandEvent& event );
|
0
|
210 };
|
|
211
|
|
212 #endif // __RSEARCH_H__
|
|
213
|