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