Mercurial > mercurial > hgweb_rsearcher.cgi
diff src/rsearcher.cpp @ 9:ae89ce4793d8
add satellite-view.
author | pyon@macmini |
---|---|
date | Wed, 31 Oct 2018 20:10:29 +0900 |
parents | 82f9af6aa7e4 |
children | 36811fd22bd2 |
line wrap: on
line diff
--- 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