Skip to content

Commit

Permalink
Harmonize Busy Cursor/BusySpinner app-wide.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Register committed Aug 6, 2015
1 parent cc81c34 commit 5ef4d5d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 21 deletions.
4 changes: 2 additions & 2 deletions include/OCPNPlatform.h
Expand Up @@ -86,8 +86,8 @@ class OCPNPlatform
//--------------------------------------------------------------------------
// Platform Display Support
//--------------------------------------------------------------------------
void ShowBusySpinner( void );
void HideBusySpinner( void );
static void ShowBusySpinner( void );
static void HideBusySpinner( void );
double getFontPointsperPixel( void );
wxSize getDisplaySize();
double GetDisplaySizeMM();
Expand Down
5 changes: 3 additions & 2 deletions src/CM93DSlide.cpp
Expand Up @@ -29,6 +29,7 @@
#include "CM93DSlide.h"
#include "chart1.h"
#include "chcanv.h"
#include "OCPNPlatform.h"

extern bool g_bShowCM93DetailSlider;
extern CM93DSlide *pCM93DetailSlider;
Expand Down Expand Up @@ -125,11 +126,11 @@ void CM93DSlide::OnChangeValue( wxScrollEvent& event )
{
g_cm93_zoom_factor = m_pCM93DetailSlider->GetValue();

::wxBeginBusyCursor();
OCPNPlatform::ShowBusySpinner();

cc1->ReloadVP();
cc1->Refresh( false );

::wxEndBusyCursor();
OCPNPlatform::HideBusySpinner();
}

7 changes: 5 additions & 2 deletions src/OCPNPlatform.cpp
Expand Up @@ -1056,7 +1056,7 @@ void OCPNPlatform::ShowBusySpinner( void )
#ifdef __OCPN__ANDROID__
androidShowBusyIcon();
#else
if(! ::wxIsBusy() ){
if( !::wxIsBusy() ){
::wxBeginBusyCursor();
}
#endif
Expand All @@ -1067,7 +1067,10 @@ void OCPNPlatform::HideBusySpinner( void )
#ifdef __OCPN__ANDROID__
androidHideBusyIcon();
#else
if( ::wxIsBusy() ){
#if wxCHECK_VERSION(2, 9, 0 )
if( ::wxIsBusy() )
#endif
{
::wxEndBusyCursor();
}
#endif
Expand Down
13 changes: 7 additions & 6 deletions src/chcanv.cpp
Expand Up @@ -36,6 +36,7 @@
#include <wx/aui/aui.h>

#include "dychart.h"
#include "OCPNPlatform.h"

#include <wx/listimpl.cpp>

Expand Down Expand Up @@ -8117,7 +8118,7 @@ void ChartCanvas::ShowTrackPropertiesDialog( Route* selected )

void pupHandler_PasteWaypoint() {
Kml* kml = new Kml();
::wxBeginBusyCursor();
OCPNPlatform::ShowBusySpinner();

int pasteBuffer = kml->ParsePasteBuffer();
RoutePoint* pasted = kml->GetParsedRoutePoint();
Expand Down Expand Up @@ -8154,12 +8155,12 @@ void pupHandler_PasteWaypoint() {
cc1->InvalidateGL();
cc1->Refresh( false );
delete kml;
::wxEndBusyCursor();
OCPNPlatform::HideBusySpinner();
}

void pupHandler_PasteRoute() {
Kml* kml = new Kml();
::wxBeginBusyCursor();
OCPNPlatform::ShowBusySpinner();

int pasteBuffer = kml->ParsePasteBuffer();
Route* pasted = kml->GetParsedRoute();
Expand Down Expand Up @@ -8274,12 +8275,12 @@ void pupHandler_PasteRoute() {
}

delete kml;
::wxEndBusyCursor();
OCPNPlatform::HideBusySpinner();
}

void pupHandler_PasteTrack() {
Kml* kml = new Kml();
::wxBeginBusyCursor();
OCPNPlatform::ShowBusySpinner();

int pasteBuffer = kml->ParsePasteBuffer();
Track* pasted = kml->GetParsedTrack();
Expand Down Expand Up @@ -8326,7 +8327,7 @@ void pupHandler_PasteTrack() {
cc1->InvalidateGL();
cc1->Refresh( false );
delete kml;
::wxEndBusyCursor();
OCPNPlatform::HideBusySpinner();
}

bool ChartCanvas::InvokeCanvasMenu(int x, int y, int seltype)
Expand Down
6 changes: 3 additions & 3 deletions src/cm93.cpp
Expand Up @@ -2217,7 +2217,7 @@ void cm93chart::SetVPParms ( const ViewPort &vpt )
}
}
if( s_b_busy_shown){
::wxEndBusyCursor();
OCPNPlatform::HideBusySpinner();
s_b_busy_shown = false;
}
}
Expand Down Expand Up @@ -6824,9 +6824,9 @@ void CM93OffsetDialog::UpdateOffsets ( void )

// Closing the current cell will record the offsets in the M_COVR cache file
// Re-opening will then refresh the M_COVRs in the cover set
::wxBeginBusyCursor();
OCPNPlatform::ShowBusySpinner();
m_pcompchart->CloseandReopenCurrentSubchart();
::wxEndBusyCursor();
OCPNPlatform::ShowBusySpinner();

if ( m_pparent ) {
m_pparent->Refresh ( true );
Expand Down
13 changes: 7 additions & 6 deletions src/s57chart.cpp
Expand Up @@ -35,6 +35,7 @@
#include <wx/textfile.h>

#include "dychart.h"
#include "OCPNPlatform.h"

#include "s52s57.h"
#include "s52plib.h"
Expand Down Expand Up @@ -2904,7 +2905,7 @@ InitReturn s57chart::Init( const wxString& name, ChartInitFlag flags )

if( fn.GetExt() == _T("000") ) {
if( m_bbase_file_attr_known ) {
::wxBeginBusyCursor();
OCPNPlatform::ShowBusySpinner();

int sret = FindOrCreateSenc( name );
if( sret != BUILD_SENC_OK ) {
Expand All @@ -2914,18 +2915,18 @@ InitReturn s57chart::Init( const wxString& name, ChartInitFlag flags )
} else
ret_value = PostInit( flags, m_global_color_scheme );

::wxEndBusyCursor();
OCPNPlatform::HideBusySpinner();
}

}

else if( fn.GetExt() == _T("S57") ) {
::wxBeginBusyCursor();
OCPNPlatform::ShowBusySpinner();

m_SENCFileName = name;
ret_value = PostInit( flags, m_global_color_scheme );

::wxEndBusyCursor();
OCPNPlatform::HideBusySpinner();

}

Expand Down Expand Up @@ -4844,12 +4845,12 @@ int s57chart::BuildRAZFromSENCFile( const wxString& FullPath )
nGeo1000 = nGeoFeature / 500;

#ifdef __WXMSW__
wxBeginBusyCursor();
// OCPNPlatform::ShowBusySpinner();
/*
SENC_prog = new wxProgressDialog( _("OpenCPN S57 SENC File Load"), FullPath, nGeo1000, NULL,
wxPD_AUTO_HIDE | wxPD_CAN_ABORT | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME | wxPD_SMOOTH);
*/
wxEndBusyCursor();
// OCPNPlatform::HideBusySpinner();

#endif
}
Expand Down

0 comments on commit 5ef4d5d

Please sign in to comment.