Mercurial > mercurial > hgweb_rsearcher.cgi
changeset 9:ae89ce4793d8
add satellite-view.
author | pyon@macmini |
---|---|
date | Wed, 31 Oct 2018 20:10:29 +0900 |
parents | 82f9af6aa7e4 |
children | 36811fd22bd2 |
files | Makefile app.conf include/auth.h include/id.h include/main.h include/net.h include/rsearcher.h src/auth.cpp src/main.cpp src/net.cpp src/rsearcher.cpp |
diffstat | 11 files changed, 179 insertions(+), 105 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Tue Oct 30 17:26:02 2018 +0900 +++ b/Makefile Wed Oct 31 20:10:29 2018 +0900 @@ -1,5 +1,5 @@ # Makefile for wxWidgets Application -# Last Change: 2018-10-25 木 17:08:35. +# Last Change: 2018-10-31 水 17:05:07. # by Takayuki Mutoh # @@ -51,14 +51,14 @@ $(CXX) $^ -o $@ $(LIBS) -$(OBJDIR)/main.o: main.cpp main.h rsearcher.h auth.h +$(OBJDIR)/main.o: main.cpp main.h rsearcher.h auth.h id.h -mkdir -p $(OBJDIR) $(CXX) -c $< -o $@ $(CXXFLAGS) -$(OBJDIR)/rsearcher.o: rsearcher.cpp rsearcher.h net.h +$(OBJDIR)/rsearcher.o: rsearcher.cpp rsearcher.h net.h id.h $(CXX) -c $< -o $@ $(CXXFLAGS) -$(OBJDIR)/auth.o: auth.cpp auth.h +$(OBJDIR)/auth.o: auth.cpp auth.h id.h $(CXX) -c $< -o $@ $(CXXFLAGS) $(OBJDIR)/net.o: net.cpp net.h
--- a/app.conf Tue Oct 30 17:26:02 2018 +0900 +++ b/app.conf Wed Oct 31 20:10:29 2018 +0900 @@ -9,3 +9,7 @@ port=3910 proxy_address= proxy_port= + +[Misc] +splash=-1 +
--- a/include/auth.h Tue Oct 30 17:26:02 2018 +0900 +++ b/include/auth.h Wed Oct 31 20:10:29 2018 +0900 @@ -1,5 +1,5 @@ // Filename : auth.h -// Last Change: 2018-10-29 月 09:11:18. +// Last Change: 2018-10-31 水 11:06:01. // #ifndef __AUTH_H__ @@ -27,11 +27,6 @@ wxArrayString m_users; protected: - enum { - ID_UID = wxID_HIGHEST + 200, - ID_PW, - }; - wxStaticText* m_staticTextId; wxTextCtrl* m_textCtrlId; wxStaticText* m_staticTextIdmsg; @@ -47,7 +42,6 @@ void SetServer( wxString server ) { m_server = server; }; void CreateControls( void ); - //bool GetDB( void ); bool LoadDB( void ); bool IsValidUser( void ); wxString GetUser( void ) { return m_user; };
--- a/include/id.h Tue Oct 30 17:26:02 2018 +0900 +++ b/include/id.h Wed Oct 31 20:10:29 2018 +0900 @@ -1,5 +1,5 @@ // Filename : id.h -// Last Change: 2018-10-30 火 11:07:41. +// Last Change: 2018-10-31 水 16:40:38. // #ifndef __ID_H__ @@ -7,10 +7,11 @@ #include <wx/wx.h> -#define RSVER "1.2" -#define RSRELEASE "2018.10.30" +#define RSVER "1.3" +#define RSRELEASE "2018.10.31" enum { + /* for mainframe */ ID_MAIN = wxID_HIGHEST + 1, ID_SEARCH, ID_PSEARCH, @@ -22,9 +23,14 @@ ID_FOCUS, ID_PZOOM, ID_MZOOM, + ID_SWIN, ID_DARK, ID_TIMER, ID_LOGOUT, + + /* for auth */ + ID_UID, + ID_PW, }; #endif // __ID_H__
--- a/include/main.h Tue Oct 30 17:26:02 2018 +0900 +++ b/include/main.h Wed Oct 31 20:10:29 2018 +0900 @@ -1,5 +1,5 @@ // Filename : main.h -// Last Change: 2018-10-25 木 17:24:41. +// Last Change: 2018-10-31 水 13:21:30. // #include <wx/wx.h> #include <wx/config.h> @@ -17,6 +17,7 @@ private: wxFileConfig *config; wxString conf_file; + int splash = 150; wxString m_serveraddr; int m_serverport; bool develop; @@ -32,6 +33,7 @@ void InitSetting(); void SaveSetting(); + void SplashScreen( int ms ); void RemoveFile( wxString pattern ); };
--- a/include/net.h Tue Oct 30 17:26:02 2018 +0900 +++ b/include/net.h Wed Oct 31 20:10:29 2018 +0900 @@ -1,5 +1,5 @@ // Filename : net.h -// Last Change: 2018-10-29 譛 15:31:38. +// Last Change: 2018-10-31 豌エ 10:34:32. // #ifndef __NET_H__ @@ -19,8 +19,8 @@ ~RsHttp(); void SetServer( wxString server, int port ) { m_server = server; m_port = port; }; - void Get( wxString url, wxString file ); - void GetDB(); + bool Get( wxString url, wxString file ); + bool GetDB(); int GetImagesSize( wxString hhs, wxString date ); void GetImages( wxString hhs, wxString date ); };
--- a/include/rsearcher.h Tue Oct 30 17:26:02 2018 +0900 +++ b/include/rsearcher.h Wed Oct 31 20:10:29 2018 +0900 @@ -1,5 +1,5 @@ // Filename : rsearcher.h -// Last Change: 2018-10-30 火 08:48:18. +// Last Change: 2018-10-31 水 16:38:57. // #ifndef __RSEARCH_H__ @@ -63,6 +63,7 @@ private: int m_dragx, m_dragy; // for image drag int cx, cy; // for mouse-gesture + bool with_stl = false; wxBitmap m_bmp0; wxScrolledWindow* m_parent; @@ -75,6 +76,8 @@ void OnLeftDown( wxMouseEvent& event ); void OnLeftUp( wxMouseEvent& event ); + void OnLeftDClick( wxMouseEvent& event ); + void OnRightDClick( wxMouseEvent& event ); void OnStartRGesture( wxMouseEvent& event ); void OnEndRGesture( wxMouseEvent& event ); void OnMotion( wxMouseEvent& event ); @@ -82,6 +85,21 @@ void SetOrigImage( wxBitmap bmp ) { m_bmp0 = bmp; }; wxBitmap GetOrigImage( void ) { return m_bmp0; }; void ChangeBook( int i ); + void WithSatellite( bool sw ) { with_stl = sw; }; +}; + +class StlFrame : public wxFrame +{ + private: + wxScrolledWindow* m_scrolledWindow; + MyStaticBitmap* m_staticBitmap; + + public: + 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 ); + ~StlFrame(); + + void SetBitmap( wxBitmap bmp ) { m_staticBitmap->SetBitmap( bmp ); }; + void SetScroll( int w, int h ) { m_scrolledWindow->SetScrollbars( 10, 10, (int)w / 10, (int)h / 10 ); }; }; class MainFrame : public wxFrame @@ -130,6 +148,7 @@ wxButton* m_buttonPzoom; wxButton* m_buttonMzoom; wxButton* m_buttonDark; + wxButton* m_buttonSatellite; wxButton* m_buttonHelp; wxButton* m_buttonClose; wxButton* m_buttonLogout; @@ -139,7 +158,7 @@ ~MainFrame(); void SetServer( wxString addr, int port ) { http.SetServer( addr, port ); m_server = wxString::Format(wxT("%s:%d"),addr,port);}; - void GetDB( void ) { http.GetDB(); }; + bool GetDB( void ) { return http.GetDB(); }; void SetUser( wxString user ) { m_user = user; WriteLog( wxT( "[login] " ) + m_user ); }; void CreateControls( void ); void SetAccelerator( void ); @@ -152,7 +171,6 @@ void ChangeCZoom( int z ); void ChangeZoom( wxScrolledWindow* sc, MyStaticBitmap* sb, int z ); void ChangeColor( MyStaticBitmap* sb ); - void GetImages2( wxString hhs, wxString date ); void GetImages( wxString hhs, wxString date ); void PrintImages( void ); void WriteLog( wxString msg ); @@ -174,6 +192,7 @@ void OnPlusZoom( wxCommandEvent& event ); void OnMinusZoom( wxCommandEvent& event ); void OnDark( wxCommandEvent& event ); + void OnSatellite( wxCommandEvent& event ); void OnHelp( wxCommandEvent& event ); void OnLogout( wxCommandEvent& event ); };
--- a/src/auth.cpp Tue Oct 30 17:26:02 2018 +0900 +++ b/src/auth.cpp Wed Oct 31 20:10:29 2018 +0900 @@ -1,5 +1,5 @@ // Filename : auth.cpp -// Last Change: 2018-10-29 譛 09:09:57. +// Last Change: 2018-10-31 豌エ 10:57:25. // #include "id.h" @@ -118,17 +118,6 @@ m_textCtrlId->SetFocus(); } -/* -bool AuthDialog::GetDB( void ) -{ // http get ( auth.db, hhs.db, index.db ) - wxArrayString args; - args.Add( wxT( "client.exe" ) ); - args.Add( wxT( "-u" ) ); - args.Add( m_server ); - wxExecute( wxJoin( args, ' ', '\\' ), wxEXEC_SYNC|wxEXEC_HIDE_CONSOLE ); -} -*/ - bool AuthDialog::LoadDB( void ) { wxTextFile file;
--- a/src/main.cpp Tue Oct 30 17:26:02 2018 +0900 +++ b/src/main.cpp Wed Oct 31 20:10:29 2018 +0900 @@ -1,6 +1,7 @@ // Filename : main.cpp -// Last Change: 2018-10-26 驥 13:14:54. +// Last Change: 2018-10-31 豌エ 15:18:12. // + #include "id.h" #include "main.h" #include "auth.h" @@ -24,29 +25,19 @@ wxImage::AddHandler( new wxJPEGHandler ); wxImage::AddHandler( new wxPNGHandler ); + wxFileSystem::AddHandler( new wxZipFSHandler ); InitSetting(); // Main Window MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxEmptyString, wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE ); mainframe->SetServer( m_serveraddr, m_serverport ); - mainframe->GetDB(); + if ( !mainframe->GetDB() ) { + mainframe->Destroy(); + return true; + } // Splash Screen - wxFileSystem::AddHandler( new wxZipFSHandler ); - wxFileSystem* fs = new wxFileSystem(); - wxString archive = wxT( "file:///./myapp.bin" ); - for ( int i = 0; i < 11; i++ ) { - wxFSFile* file = fs->OpenFile( archive + wxString::Format( wxT( "#zip:startup%02d.png" ), i ) ); - if ( file ) { - wxInputStream* s = file->GetStream(); - wxImage image( *s, wxBITMAP_TYPE_PNG ); - wxBitmap bmp = wxBitmap( image ); - wxSplashScreen* splash = new wxSplashScreen( bmp, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, 2000, NULL, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE|wxSTAY_ON_TOP ); - delete file; - } - wxMilliSleep( 150 ); - } - delete fs; + SplashScreen( splash ); // User Dialgo AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxT( "Who are you ?" ), wxDefaultPosition, wxDefaultSize, wxCAPTION ); @@ -64,6 +55,7 @@ srand( seed ); int n = rand() % 13; wxFileSystem* fs = new wxFileSystem(); + wxString archive = wxT( "file:///./myapp.bin" ); wxFSFile* file = fs->OpenFile( archive + wxString::Format( wxT( "#zip:%02d.jpg" ), n ) ); if ( file ) { wxInputStream* s = file->GetStream(); @@ -114,12 +106,16 @@ config->Read( wxT( "address" ), &m_serveraddr ); config->Read( wxT( "port" ), &m_serverport ); } - delete config; if ( m_serveraddr.IsSameAs( wxEmptyString, false ) ) { m_serveraddr = wxT( "192.168.21.151" ); // nginx m_serverport = 80; } + + config->SetPath( wxT( "/Misc" ) ); + config->Read( wxT( "splash" ), &splash ); + + delete config; } void MyApp::SaveSetting() @@ -134,6 +130,26 @@ delete config; } +void MyApp::SplashScreen( int ms ) +{ + if ( ms < 0 ) return; + + wxFileSystem* fs = new wxFileSystem(); + wxString archive = wxT( "file:///./myapp.bin" ); + for ( int i = 0; i < 11; i++ ) { + wxFSFile* file = fs->OpenFile( archive + wxString::Format( wxT( "#zip:startup%02d.png" ), i ) ); + if ( file ) { + wxInputStream* s = file->GetStream(); + wxImage image( *s, wxBITMAP_TYPE_PNG ); + wxBitmap bmp = wxBitmap( image ); + wxSplashScreen* splash = new wxSplashScreen( bmp, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, 2000, NULL, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE|wxSTAY_ON_TOP ); + delete file; + } + wxMilliSleep( ms ); + } + delete fs; +} + void MyApp::RemoveFile( wxString pattern ) { wxString file = wxFindFirstFile( pattern );
--- a/src/net.cpp Tue Oct 30 17:26:02 2018 +0900 +++ b/src/net.cpp Wed Oct 31 20:10:29 2018 +0900 @@ -1,5 +1,5 @@ // Filename : net.cpp -// Last Change: 2018-10-30 轣ォ 11:08:25. +// Last Change: 2018-10-31 豌エ 10:42:06. // #include <wx/datetime.h> @@ -17,9 +17,11 @@ { } -void RsHttp::Get( wxString url, wxString file ) +bool RsHttp::Get( wxString url, wxString file ) { + bool ret = false; wxHTTP get; + get.SetFlags( wxSOCKET_WAITALL|wxSOCKET_BLOCK ); while ( !get.Connect( m_server, m_port ) ) wxSleep( 1 ); @@ -27,21 +29,25 @@ if ( get.GetError() == wxPROTO_NOERR ) { wxFileOutputStream out_stream( file ); httpStream->Read( out_stream ); + ret = true; } else { - wxMessageBox( wxT( "Re:Searcher Error: get err" ) ); + wxMessageBox( wxT( "Re:Searcher Error: cannot get data." ) ); } wxDELETE( httpStream ); get.Close(); + return ret; } -void RsHttp::GetDB( void ) +bool RsHttp::GetDB( void ) { - Get( wxT( "/db/auth.db"), wxT( "auth.db") ); - Get( wxT( "/db/hhs.db"), wxT( "hhs.db") ); + bool ret = false; + ret = Get( wxT( "/db/auth.db"), wxT( "auth.db") ); + ret = Get( wxT( "/db/hhs.db"), wxT( "hhs.db") ); wxDateTime now = wxDateTime::Now(); if ( now.GetDay() % 14 == 0 ) Get( wxT( "/db/index.db"), wxT( "index.db" ) ); + return ret; } int RsHttp::GetImagesSize( wxString hhs, wxString date ) @@ -80,13 +86,6 @@ //int size = http_istream->GetSize(); wxZlibInputStream zlib_istream( http_istream ); // 0: no cache : bad - /* - wxMemoryOutputStream mm_ostream; // 1: ok - http_istream->Read( mm_ostream ); - wxMemoryInputStream mm_istream( mm_ostream ); - wxZlibInputStream zlib_istream( mm_istream ); - */ - wxTarEntry* entry; wxTarInputStream tar_istream( zlib_istream ); int i = 1;
--- a/src/rsearcher.cpp Tue Oct 30 17:26:02 2018 +0900 +++ b/src/rsearcher.cpp Wed Oct 31 20:10:29 2018 +0900 @@ -1,5 +1,5 @@ // Filename : rsearcher.cpp -// Last Change: 2018-10-30 火 11:19:28. +// Last Change: 2018-10-31 豌エ 16:39:35. // #include <wx/arrstr.h> @@ -91,39 +91,41 @@ : wxStaticBitmap( parent, id, label, pos, size, style, name ) { m_parent = parent; - Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( OnLeftDown ), NULL, this ); - Connect( wxEVT_LEFT_UP, wxMouseEventHandler( OnLeftUp ), NULL, this ); - Connect( wxEVT_MOTION, wxMouseEventHandler( OnMotion ), NULL, this ); - Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( OnWheel ), NULL, this ); - - Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( OnStartRGesture ), NULL, this ); - Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( OnEndRGesture ), NULL, this ); + Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( OnLeftDown ), NULL, this ); + Connect( wxEVT_LEFT_UP, wxMouseEventHandler( OnLeftUp ), NULL, this ); + Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( OnLeftDClick ), NULL, this ); + Connect( wxEVT_RIGHT_DCLICK, wxMouseEventHandler( OnRightDClick ), NULL, this ); + Connect( wxEVT_MOTION, wxMouseEventHandler( OnMotion ), NULL, this ); + Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( OnWheel ), NULL, this ); + Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( OnStartRGesture ), NULL, this ); + Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( OnEndRGesture ), NULL, this ); } MyStaticBitmap::~MyStaticBitmap() { - Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( OnLeftDown ), NULL, this ); - Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( OnLeftUp ), NULL, this ); - Disconnect( wxEVT_MOTION, wxMouseEventHandler( OnMotion ), NULL, this ); - Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( OnWheel ), NULL, this ); - - Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( OnStartRGesture ), NULL, this ); - Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( OnEndRGesture ), NULL, this ); + Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( OnLeftDown ), NULL, this ); + Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( OnLeftUp ), NULL, this ); + Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( OnLeftDClick ), NULL, this ); + Disconnect( wxEVT_RIGHT_DCLICK, wxMouseEventHandler( OnRightDClick ), NULL, this ); + Disconnect( wxEVT_MOTION, wxMouseEventHandler( OnMotion ), NULL, this ); + Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( OnWheel ), NULL, this ); + Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( OnStartRGesture ), NULL, this ); + Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( OnEndRGesture ), NULL, this ); } // Event Handlers void MyStaticBitmap::OnWheel( wxMouseEvent& event ) { + /* if ( event.ControlDown() ) { if ( event.GetWheelRotation() < 0 ) { - //if ( m_zoom < 4 ) m_zoom++; } else { - //if ( m_zoom > 0 ) m_zoom--; } return; } event.Skip(); + */ } void MyStaticBitmap::OnLeftDown( wxMouseEvent& event ) @@ -137,6 +139,20 @@ SetCursor( wxCursor( wxCURSOR_ARROW ) ); } +void MyStaticBitmap::OnLeftDClick( wxMouseEvent& event ) +{ + if ( with_stl ) return; + MainFrame* mf = (MainFrame*)FindWindowById( ID_MAIN ); + mf->ChangeCZoom( 1 ); +} + +void MyStaticBitmap::OnRightDClick( wxMouseEvent& event ) +{ + if ( with_stl ) return; + MainFrame* mf = (MainFrame*)FindWindowById( ID_MAIN ); + mf->ChangeCZoom( -1 ); +} + void MyStaticBitmap::OnMotion( wxMouseEvent& event ) { if ( event.RightIsDown() ) return; @@ -169,6 +185,7 @@ /* right-gesture: judge */ void MyStaticBitmap::OnEndRGesture( wxMouseEvent& event ) { + if ( with_stl ) return; int x, y; event.GetPosition( &x, &y ); @@ -213,6 +230,30 @@ } /********************/ +/** SatteliteView **/ +/********************/ +StlFrame::StlFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) + : wxFrame( parent, id, title, pos, size, style ) +{ + wxBoxSizer* bSizerTop = new wxBoxSizer( wxHORIZONTAL ); + + m_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); + m_scrolledWindow->SetScrollRate( 5, 5 ); + + m_staticBitmap = new MyStaticBitmap( m_scrolledWindow, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0, wxEmptyString ); + m_staticBitmap->WithSatellite( true ); + + bSizerTop->Add( m_scrolledWindow, 1, wxEXPAND|wxALL, 0 ); + + this->SetSizer( bSizerTop ); + this->Layout(); +} + +StlFrame::~StlFrame() +{ +} + +/********************/ /** Main Frame **/ /********************/ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) @@ -244,6 +285,7 @@ EVT_BUTTON( ID_PZOOM, MainFrame::OnPlusZoom ) EVT_BUTTON( ID_MZOOM, MainFrame::OnMinusZoom ) EVT_BUTTON( ID_DARK, MainFrame::OnDark ) + EVT_BUTTON( ID_SWIN, MainFrame::OnSatellite ) EVT_BUTTON( wxID_HELP, MainFrame::OnHelp ) EVT_BUTTON( wxID_CLOSE, MainFrame::OnBClose ) EVT_BUTTON( ID_LOGOUT, MainFrame::OnLogout ) @@ -254,6 +296,8 @@ void MainFrame::OnItemSelected( wxDataViewEvent& WXUNUSED(event) ) { int r = m_dataViewListCtrl->GetSelectedRow(); + if ( r == wxNOT_FOUND ) return; + wxString ready = m_dataViewListCtrl->GetTextValue( r, 2 ); if ( ready.IsSameAs( wxT( "OK" ), true ) ) { wxString date = m_dataViewListCtrl->GetTextValue( r, 1 ); @@ -333,6 +377,25 @@ m_dark = !m_dark; } +void MainFrame::OnSatellite( wxCommandEvent& WXUNUSED(event ) ) +{ + int n = m_notebook->GetSelection(); + StlFrame *stl = new StlFrame( this, wxID_ANY, wxT( "Re:Searcher - satellite view" ), wxPoint( 0, 0 ), wxSize( 500, 600 ), wxFRAME_NO_TASKBAR|wxCLOSE_BOX|wxCAPTION|wxRESIZE_BORDER ); + wxBitmap bmp; + if ( n == 0 ) bmp = m_staticBitmap1->GetBitmap(); + if ( n == 1 ) bmp = m_staticBitmap2->GetBitmap(); + if ( n == 2 ) bmp = m_staticBitmap3->GetBitmap(); + if ( n == 3 ) bmp = m_staticBitmap4->GetBitmap(); + if ( n == 4 ) bmp = m_staticBitmap5->GetBitmap(); + stl->SetBitmap( bmp ); + + int w = bmp.GetWidth(); + int h = bmp.GetHeight(); + stl->SetScroll( w, h ); + + stl->Show(); +} + void MainFrame::OnHelp( wxCommandEvent& WXUNUSED(event) ) { wxString version, build; @@ -456,6 +519,8 @@ m_buttonMzoom->Hide(); m_buttonDark = new wxButton( this, ID_DARK, wxT( "Dark" ), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonDark->Hide(); + m_buttonSatellite = new wxButton( this, ID_SWIN, wxT( "Satellite" ), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonSatellite->Hide(); m_buttonClose = new wxButton( this, wxID_CLOSE, wxT( "Close" ), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonClose->Hide(); m_buttonHelp = new wxButton( this, wxID_HELP, wxT( "Help" ), wxDefaultPosition, wxDefaultSize, 0 ); @@ -477,15 +542,16 @@ void MainFrame::SetAccelerator( void ) { - wxAcceleratorEntry entries[8]; + wxAcceleratorEntry entries[9]; entries[0].Set( wxACCEL_CTRL, (int)'P', wxID_PRINT ); entries[1].Set( wxACCEL_NORMAL, WXK_F1, wxID_HELP ); entries[2].Set( wxACCEL_NORMAL, WXK_F4, ID_FOCUS ); entries[3].Set( wxACCEL_NORMAL, (int)'Z', ID_PZOOM ); entries[4].Set( wxACCEL_NORMAL, (int)'X', ID_MZOOM ); entries[5].Set( wxACCEL_NORMAL, (int)'D', ID_DARK ); - entries[6].Set( wxACCEL_SHIFT, (int)'Q', wxID_CLOSE ); - entries[7].Set( wxACCEL_SHIFT, (int)'L', ID_DARK ); // now building ( logout ) + entries[6].Set( wxACCEL_CTRL, (int)'Q', wxID_CLOSE ); + entries[7].Set( wxACCEL_SHIFT, (int)'W', ID_SWIN ); + entries[8].Set( wxACCEL_SHIFT, (int)'L', ID_DARK ); // now building ( logout ) wxAcceleratorTable accel( 8, entries ); SetAcceleratorTable( accel ); } @@ -644,8 +710,6 @@ void MainFrame::GetImages( wxString hhs, wxString date ) { - //GetImages2( hhs, date); return; // here comment out ( by client.exe & return ) - int estimate = http.GetImagesSize( hhs, date ) / 1000000; wxProgressDialog pd( wxT( "Connecting Server" ), wxT( "Start..." ), estimate, NULL, wxPD_APP_MODAL|wxPD_ELAPSED_TIME|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE ); pd.SetSize( wxSize( 320, 140 ) ); @@ -657,25 +721,6 @@ } } -void MainFrame::GetImages2( wxString hhs, wxString date ) -{ - wxArrayString args; // http get - args.Add( wxT( "client.exe" ) ); - args.Add( m_server ); - args.Add( hhs ); - args.Add( date ); - - int estimate = 5; - wxProgressDialog pd( wxT( "Connecting Server" ), wxT( "Start..." ), estimate, NULL, wxPD_APP_MODAL|wxPD_ELAPSED_TIME|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE ); - pd.SetSize( wxSize( 320, 140 ) ); - - wxExecute( wxJoin( args, ' ', '\\' ), wxEXEC_ASYNC|wxEXEC_HIDE_CONSOLE ); - for ( int i = 0; i < estimate; i++ ) { - wxSleep( 1 ); - pd.Update( i, wxT( "Now Loading..." ) ); - } -} - void MainFrame::Search( void ) { // hhs info