Mercurial > mercurial > hgweb_rsearcher.cgi
diff src/rsearcher.cpp @ 7:29829e98d510
add net.cpp
author | pyon@macmini |
---|---|
date | Fri, 26 Oct 2018 21:05:11 +0900 |
parents | 9a8b581c1993 |
children | 82f9af6aa7e4 |
line wrap: on
line diff
--- a/src/rsearcher.cpp Tue Oct 23 19:15:22 2018 +0900 +++ b/src/rsearcher.cpp Fri Oct 26 21:05:11 2018 +0900 @@ -1,5 +1,5 @@ // Filename : rsearcher.cpp -// Last Change: 2018-10-23 ‰Î 13:09:30. +// Last Change: 2018-10-26 ‹à 15:12:02. // #include <wx/arrstr.h> @@ -218,6 +218,7 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) { + http = RsHttp(); CreateControls(); SetAccelerator(); LoadBitmaps( wxEmptyString, false ); @@ -233,16 +234,19 @@ EVT_DATAVIEW_SELECTION_CHANGED( ID_LIST, MainFrame::OnItemSelected ) EVT_DATAVIEW_ITEM_ACTIVATED( ID_LIST, MainFrame::OnItemDClicked ) EVT_NOTEBOOK_PAGE_CHANGED( ID_NBOOK, MainFrame::OnNBookChanged ) + EVT_BUTTON( ID_PSEARCH, MainFrame::OnPasteSearch ) EVT_BUTTON( wxID_PRINT, MainFrame::OnPrint ) - EVT_BUTTON( ID_PSEARCH, MainFrame::OnPasteSearch ) + EVT_CLOSE( MainFrame::OnClose ) + EVT_IDLE( MainFrame::OnIdle ) + EVT_TIMER( ID_TIMER, MainFrame::OnTimer ) + // shortcut-key + EVT_BUTTON( ID_FOCUS, MainFrame::OnFocus ) EVT_BUTTON( ID_PZOOM, MainFrame::OnPlusZoom ) EVT_BUTTON( ID_MZOOM, MainFrame::OnMinusZoom ) EVT_BUTTON( ID_DARK, MainFrame::OnDark ) EVT_BUTTON( wxID_HELP, MainFrame::OnHelp ) + EVT_BUTTON( wxID_CLOSE, MainFrame::OnBClose ) EVT_BUTTON( ID_LOGOUT, MainFrame::OnLogout ) - EVT_CLOSE( MainFrame::OnClose ) - EVT_IDLE( MainFrame::OnIdle ) - EVT_TIMER( ID_TIMER, MainFrame::OnTimer ) END_EVENT_TABLE() @@ -281,13 +285,19 @@ m_notebook->SetPageImage( m_notebook->GetSelection(), 0 ); } -void MainFrame::OnClose( wxCloseEvent& WXUNUSED(event) ) // save config +void MainFrame::OnBClose( wxCommandEvent& WXUNUSED(event) ) +{ + Close(); +} + +void MainFrame::OnClose( wxCloseEvent& WXUNUSED(event) ) { - WriteLog( wxT( "[logout]" ) ); - if ( !IsIconized() && !IsMaximized() ) { - wxGetApp().rect = this->GetRect(); - } - Destroy(); + Close(); +} + +void MainFrame::OnFocus( wxCommandEvent& WXUNUSED(event) ) +{ + m_searchCtrl->SetFocus(); } void MainFrame::OnPasteSearch( wxCommandEvent& WXUNUSED(event) ) @@ -435,12 +445,16 @@ bSizerRight->Add( m_buttonLogout, 0, wxALL, 5 ); // invisible buttons for shortcut-key + m_buttonFocus = new wxButton( this, ID_FOCUS, wxT( "Focus" ), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonFocus->Hide(); m_buttonPzoom = new wxButton( this, ID_PZOOM, wxT( "ZOOM" ), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonPzoom->Hide(); m_buttonMzoom = new wxButton( this, ID_MZOOM, wxT( "zoom" ), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonMzoom->Hide(); m_buttonDark = new wxButton( this, ID_DARK, wxT( "Dark" ), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonDark->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 ); m_buttonHelp->Hide(); @@ -460,13 +474,16 @@ void MainFrame::SetAccelerator( void ) { - wxAcceleratorEntry entries[5]; + wxAcceleratorEntry entries[8]; entries[0].Set( wxACCEL_CTRL, (int)'P', wxID_PRINT ); entries[1].Set( wxACCEL_NORMAL, WXK_F1, wxID_HELP ); - entries[2].Set( wxACCEL_NORMAL, (int)'Z', ID_PZOOM ); - entries[3].Set( wxACCEL_NORMAL, (int)'X', ID_MZOOM ); - entries[4].Set( wxACCEL_NORMAL, (int)'D', ID_DARK ); - wxAcceleratorTable accel( 5, entries ); + 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 ) + wxAcceleratorTable accel( 8, entries ); SetAcceleratorTable( accel ); } @@ -562,7 +579,7 @@ if ( !ok && reload ) { wxSleep( 5 ); - LoadBitmaps( date, false ); + ok = LoadBitmaps( date, false ); } return ok; } @@ -623,6 +640,21 @@ void MainFrame::GetImages( wxString hhs, wxString date ) { + GetImages2( hhs, date); return; // here comment out + + 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 ) ); + + http.GetImages( hhs, date ); + for ( int i = 0; i < estimate; i++ ) { + wxSleep( 1 ); + pd.Update( i, wxT( "Now Loading..." ) ); + } +} + +void MainFrame::GetImages2( wxString hhs, wxString date ) +{ wxArrayString args; // http get args.Add( wxT( "client.exe" ) ); args.Add( m_server ); @@ -796,6 +828,15 @@ logfile.Close(); } +void MainFrame::Close( void ) +{ + WriteLog( wxT( "[logout]" ) ); + if ( !IsIconized() && !IsMaximized() ) { + wxGetApp().rect = this->GetRect(); + } + Destroy(); +} + void MainFrame::InDevelop( bool flag ) { if ( !flag ) return;