0
|
1 // Filename : rsearcher.h
|
8
|
2 // Last Change: 2018-10-30 ‰Î 08:48:18.
|
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
|
6
|
66 wxBitmap m_bmp0;
|
0
|
67 wxScrolledWindow* m_parent;
|
6
|
68
|
|
69 public:
|
|
70 int zoom = 0;
|
0
|
71
|
|
72 public:
|
|
73 MyStaticBitmap( wxScrolledWindow *parent, wxWindowID id, const wxBitmap &label, const wxPoint &pos, const wxSize &size, long style, const wxString &name );
|
|
74 ~MyStaticBitmap();
|
|
75
|
|
76 void OnLeftDown( wxMouseEvent& event );
|
|
77 void OnLeftUp( wxMouseEvent& event );
|
3
|
78 void OnStartRGesture( wxMouseEvent& event );
|
|
79 void OnEndRGesture( wxMouseEvent& event );
|
0
|
80 void OnMotion( wxMouseEvent& event );
|
|
81 void OnWheel( wxMouseEvent& event );
|
6
|
82 void SetOrigImage( wxBitmap bmp ) { m_bmp0 = bmp; };
|
|
83 wxBitmap GetOrigImage( void ) { return m_bmp0; };
|
4
|
84 void ChangeBook( int i );
|
0
|
85 };
|
|
86
|
|
87 class MainFrame : public wxFrame
|
|
88 {
|
|
89 DECLARE_EVENT_TABLE()
|
|
90 private:
|
2
|
91 bool startup = true;
|
|
92 wxString m_server;
|
|
93 wxString m_hhs;
|
3
|
94 wxString m_user;
|
2
|
95 wxArrayString m_index;
|
3
|
96 wxTimer m_timer;
|
5
|
97 HhsHash hhash;
|
7
|
98 RsHttp http;
|
6
|
99 bool m_dark = false;
|
0
|
100
|
|
101 protected:
|
|
102 MySearchCtrl* m_searchCtrl;
|
|
103 MyStaticBitmap* m_staticBitmap1;
|
|
104 MyStaticBitmap* m_staticBitmap2;
|
|
105 MyStaticBitmap* m_staticBitmap3;
|
|
106 MyStaticBitmap* m_staticBitmap4;
|
|
107 MyStaticBitmap* m_staticBitmap5;
|
1
|
108 MyStaticBitmap* m_staticBitmap6;
|
0
|
109
|
|
110 wxNotebook* m_notebook;
|
|
111 wxScrolledWindow* m_scrolledWindow1;
|
|
112 wxScrolledWindow* m_scrolledWindow2;
|
|
113 wxScrolledWindow* m_scrolledWindow3;
|
|
114 wxScrolledWindow* m_scrolledWindow4;
|
|
115 wxScrolledWindow* m_scrolledWindow5;
|
|
116 wxScrolledWindow* m_scrolledWindow6;
|
|
117
|
|
118 wxTextCtrl* m_textCtrlName;
|
|
119 wxTextCtrl* m_textCtrlAddr;
|
|
120 wxDataViewListCtrl* m_dataViewListCtrl;
|
|
121 wxDataViewColumn* m_dataViewListColumnNo;
|
|
122 wxDataViewColumn* m_dataViewListColumnDate;
|
|
123 wxTextCtrl* m_textCtrlLog;
|
5
|
124 wxButton* m_buttonPsearch;
|
0
|
125 wxButton* m_buttonPrint;
|
6
|
126
|
|
127 // invisible button for shortcut-key
|
|
128 wxSlider* m_slider;
|
7
|
129 wxButton* m_buttonFocus;
|
6
|
130 wxButton* m_buttonPzoom;
|
|
131 wxButton* m_buttonMzoom;
|
|
132 wxButton* m_buttonDark;
|
5
|
133 wxButton* m_buttonHelp;
|
7
|
134 wxButton* m_buttonClose;
|
3
|
135 wxButton* m_buttonLogout;
|
0
|
136
|
|
137 public:
|
|
138 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 );
|
|
139 ~MainFrame();
|
3
|
140
|
7
|
141 void SetServer( wxString addr, int port ) { http.SetServer( addr, port ); m_server = wxString::Format(wxT("%s:%d"),addr,port);};
|
|
142 void GetDB( void ) { http.GetDB(); };
|
5
|
143 void SetUser( wxString user ) { m_user = user; WriteLog( wxT( "[login] " ) + m_user ); };
|
2
|
144 void CreateControls( void );
|
5
|
145 void SetAccelerator( void );
|
2
|
146 void Cmd( wxString cmd );
|
|
147 void Search( void );
|
8
|
148 void PasteSearch( void );
|
3
|
149 void LoadDB( void );
|
6
|
150 bool LoadBitmap( wxScrolledWindow* sc, MyStaticBitmap* sb, wxString file );
|
5
|
151 bool LoadBitmaps( wxString date, bool reload );
|
6
|
152 void ChangeCZoom( int z );
|
|
153 void ChangeZoom( wxScrolledWindow* sc, MyStaticBitmap* sb, int z );
|
|
154 void ChangeColor( MyStaticBitmap* sb );
|
7
|
155 void GetImages2( wxString hhs, wxString date );
|
2
|
156 void GetImages( wxString hhs, wxString date );
|
3
|
157 void PrintImages( void );
|
5
|
158 void WriteLog( wxString msg );
|
7
|
159 void Close( void );
|
2
|
160 void InDevelop( bool );
|
|
161
|
|
162 void OnItemSelected( wxDataViewEvent& event );
|
0
|
163 void OnItemDClicked( wxDataViewEvent& event );
|
|
164 void OnNBookChanged( wxBookCtrlEvent& event );
|
5
|
165 void OnPasteSearch( wxCommandEvent& event );
|
3
|
166 void OnPrint( wxCommandEvent& event );
|
7
|
167 void OnClose( wxCloseEvent& event );
|
|
168 void OnBClose( wxCommandEvent& event );
|
3
|
169 void OnIdle( wxIdleEvent& event );
|
|
170 void OnTimer( wxTimerEvent& event );
|
7
|
171
|
|
172 // for shortcut-key
|
|
173 void OnFocus( wxCommandEvent& event );
|
6
|
174 void OnPlusZoom( wxCommandEvent& event );
|
|
175 void OnMinusZoom( wxCommandEvent& event );
|
|
176 void OnDark( wxCommandEvent& event );
|
5
|
177 void OnHelp( wxCommandEvent& event );
|
3
|
178 void OnLogout( wxCommandEvent& event );
|
0
|
179 };
|
|
180
|
|
181 #endif // __RSEARCH_H__
|
|
182
|