Use IsShownOnScreen(), not IsShown(), if you really want to know if its visible.

This commit is contained in:
Jeff Young 2021-08-19 22:28:54 +01:00
parent a16bdb7288
commit d5d07e64c9
22 changed files with 41 additions and 42 deletions

View File

@ -364,7 +364,7 @@ void EDA_3D_CANVAS::DoRePaint()
// therefore with invalid board.
// This is dependent of the platform.
// Especially on OSX, but also on Windows, it frequently happens
if( !GetParent()->GetParent()->IsShown() )
if( !GetParent()->GetParent()->IsShownOnScreen() )
return; // The parent board editor frame is no more alive
wxString err_messages;

View File

@ -438,9 +438,8 @@ void EDA_3D_VIEWER_FRAME::OnCloseWindow( wxCloseEvent &event )
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER_FRAME::OnCloseWindow" ) );
// Do not show the layer manager during closing to avoid flicker
// on some platforms (Windows) that generate useless redraw of items in
// the Layer Manager
// Do not show the layer manager during closing to avoid flicker on some platforms (Windows)
// that generate useless redraw of items in the Layer Manager
if( m_auimgr.GetPane( wxS( "LayersManager" ) ).IsShown() )
m_auimgr.GetPane( wxS( "LayersManager" ) ).Show( false );

View File

@ -293,7 +293,7 @@ bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent )
if( Pgm().m_Quitting )
return true;
if( !m_isClosing && m_supportsAutoSave && IsShown() && IsActive()
if( !m_isClosing && m_supportsAutoSave && IsShownOnScreen() && IsActive()
&& m_autoSavePending != isAutoSaveRequired()
&& GetAutoSaveInterval() > 0 )
{

View File

@ -257,7 +257,7 @@ void INFOBAR_REPORTER::Finalize()
return;
// Short circuit if the message is empty and it is already hidden
if( !HasMessage() && !m_infoBar->IsShown() )
if( !HasMessage() && !m_infoBar->IsShownOnScreen() )
return;
int icon = wxICON_NONE;

View File

@ -681,10 +681,10 @@ void LIB_TREE::onIdle( wxIdleEvent& aEvent )
bool mouseOverWindow = false;
wxPoint screenPos = wxGetMousePosition();
if( m_tree_ctrl->IsShown() )
if( m_tree_ctrl->IsShownOnScreen() )
mouseOverWindow |= m_tree_ctrl->GetScreenRect().Contains( screenPos );
if( m_previewWindow && m_previewWindow->IsShown() )
if( m_previewWindow && m_previewWindow->IsShownOnScreen() )
mouseOverWindow |= m_previewWindow->GetScreenRect().Contains( screenPos );
if( m_previewDisabled || topLevelFocus != topLevelParent || !mouseOverWindow )
@ -737,7 +737,7 @@ void LIB_TREE::onHoverTimer( wxTimerEvent& aEvent )
{
hidePreview();
if( !m_tree_ctrl->IsShown() || m_previewDisabled )
if( !m_tree_ctrl->IsShownOnScreen() || m_previewDisabled )
return;
wxDataViewItem item;

View File

@ -186,7 +186,7 @@ void WX_INFOBAR::ShowMessage( const wxString& aMessage, int aFlags, MESSAGE_TYPE
void WX_INFOBAR::Dismiss()
{
if( !IsShown() )
if( !IsShownOnScreen() )
return;
// Don't do anything if we requested the UI update
@ -270,7 +270,7 @@ void WX_INFOBAR::AddButton( wxButton* aButton )
#endif // __WXMAC__
sizer->Add( aButton, wxSizerFlags().Centre().Border( wxRIGHT ) );
if( IsShown() )
if( IsShownOnScreen() )
sizer->Layout();
}
@ -283,7 +283,7 @@ void WX_INFOBAR::AddButton( wxHyperlinkCtrl* aHypertextButton )
sizer->Add( aHypertextButton, wxSizerFlags().Centre().Border( wxRIGHT ) );
if( IsShown() )
if( IsShownOnScreen() )
sizer->Layout();
}

View File

@ -152,7 +152,7 @@ void DIALOG_ERC::UpdateAnnotationWarning()
if( m_parent->CheckAnnotate( []( ERCE_T, const wxString&, SCH_REFERENCE*, SCH_REFERENCE* )
{ } ) )
{
if( !m_infoBar->IsShown() )
if( !m_infoBar->IsShownOnScreen() )
{
wxHyperlinkCtrl* button = new wxHyperlinkCtrl( m_infoBar, wxID_ANY,
_( "Show Annotation dialog" ),
@ -174,7 +174,7 @@ void DIALOG_ERC::UpdateAnnotationWarning()
}
else
{
if( m_infoBar->IsShown() )
if( m_infoBar->IsShownOnScreen() )
{
m_infoBar->RemoveAllButtons();
m_infoBar->Hide();

View File

@ -414,7 +414,7 @@ void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
void DIALOG_PIN_PROPERTIES::OnPropertiesChange( wxCommandEvent& event )
{
if( !IsShown() ) // do nothing at init time
if( !IsShownOnScreen() ) // do nothing at init time
return;
m_dummyPin->SetName( m_textPinName->GetValue() );

View File

@ -458,7 +458,7 @@ void SCH_EDIT_FRAME::onResizeNetNavigator( wxSizeEvent& aEvent )
wxAuiPaneInfo& netNavigatorPane = m_auimgr.GetPane( NetNavigatorPaneName() );
if( m_netNavigator->IsShown() )
if( m_netNavigator->IsShownOnScreen() )
{
cfg->m_AuiPanels.net_nav_panel_float_size = netNavigatorPane.floating_size;

View File

@ -432,7 +432,7 @@ void SCH_EDIT_FRAME::OnResizeHierarchyNavigator( wxSizeEvent& aEvent )
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
if( cfg && m_hierarchy->IsShown() )
if( cfg && m_hierarchy->IsShownOnScreen() )
{
cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;

View File

@ -148,6 +148,6 @@ void SCH_PREVIEW_PANEL::Refresh( bool aEraseBackground, const wxRect* aRect )
void SCH_PREVIEW_PANEL::onPaint( wxPaintEvent& aEvent )
{
if( IsShown() )
if( IsShownOnScreen() )
EDA_DRAW_PANEL_GAL::onPaint( aEvent );
}

View File

@ -1226,7 +1226,7 @@ bool SYMBOL_EDIT_FRAME::saveAllLibraries( bool aRequireConfirmation )
m_infoBar->ShowMessageFor( msg + wxS( " " ) + msg2,
2000, wxICON_EXCLAMATION );
while( m_infoBar->IsShown() )
while( m_infoBar->IsShownOnScreen() )
wxSafeYield();
retv = false;

View File

@ -163,7 +163,7 @@ int EE_INSPECTION_TOOL::CrossProbe( const TOOL_EVENT& aEvent )
if( dlg )
{
if( !dlg->IsShown() )
if( !dlg->IsShownOnScreen() )
{
dlg->Show( true );
dlg->Raise();

View File

@ -77,7 +77,7 @@ void SCH_SEARCH_PANE::onSchChanged( wxCommandEvent& event )
void SCH_SEARCH_PANE::OnSchItemsAdded( SCHEMATIC& aBoard, std::vector<SCH_ITEM*>& aBoardItems )
{
if( !IsShown() )
if( !IsShownOnScreen() )
return;
RefreshSearch();
@ -86,7 +86,7 @@ void SCH_SEARCH_PANE::OnSchItemsAdded( SCHEMATIC& aBoard, std::vector<SCH_ITEM*>
void SCH_SEARCH_PANE::OnSchItemsRemoved( SCHEMATIC& aBoard, std::vector<SCH_ITEM*>& aBoardItems )
{
if( !IsShown() )
if( !IsShownOnScreen() )
return;
RefreshSearch();
@ -95,7 +95,7 @@ void SCH_SEARCH_PANE::OnSchItemsRemoved( SCHEMATIC& aBoard, std::vector<SCH_ITEM
void SCH_SEARCH_PANE::OnSchItemsChanged( SCHEMATIC& aBoard, std::vector<SCH_ITEM*>& aBoardItems )
{
if( !IsShown() )
if( !IsShownOnScreen() )
return;
RefreshSearch();

View File

@ -242,7 +242,7 @@ void SYMBOL_PREVIEW_WIDGET::DisplaySymbol( const LIB_ID& aSymbolID, int aUnit, i
m_itemBBox = m_previewItem->GetUnitBoundingBox( settings->m_ShowUnit,
settings->m_ShowConvert );
if( !m_preview->IsShown() )
if( !m_preview->IsShownOnScreen() )
{
m_preview->Show();

View File

@ -240,7 +240,7 @@ bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// Ensure the frame is shown when opening the file(s), to avoid issues (crash) on GAL
// when trying to change the view if it is not fully initialized.
// It happens when starting GerbView with a gerber job file to load
if( !IsShown() )
if( !IsShownOnScreen() )
Show();
// The current project path is also a valid command parameter. Check if a single path

View File

@ -140,7 +140,7 @@ void IMPORT_PROJ_HELPER::ImportIndividualFile( KICAD_T aFT, int aImportedFileTyp
std::string packet = StrPrintf( "%d\n%s", aImportedFileType, TO_UTF8( appImportFile ) );
frame->Kiway().ExpressMail( frame_type, MAIL_IMPORT_FILE, packet, m_frame );
if( !frame->IsShown() )
if( !frame->IsShownOnScreen() )
frame->Show( true );
// On Windows, Raise() does not bring the window on screen, when iconized

View File

@ -1034,7 +1034,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory,
if( m_infoBar->GetMessageType() == WX_INFOBAR::MESSAGE_TYPE::OUTDATED_SAVE )
m_infoBar->Dismiss();
if( m_infoBar->IsShown() && m_infoBar->HasCloseButton() )
if( m_infoBar->IsShownOnScreen() && m_infoBar->HasCloseButton() )
m_infoBar->Dismiss();
GetScreen()->SetContentModified( false );

View File

@ -1824,7 +1824,7 @@ int PCB_EDIT_FRAME::TestStandalone()
if( !frame )
return -1;
if( !frame->IsShown() )
if( !frame->IsShownOnScreen() )
{
wxFileName fn( Prj().GetProjectPath(), Prj().GetProjectName(),
KiCadSchematicFileExtension );
@ -1966,7 +1966,7 @@ void PCB_EDIT_FRAME::RunEeschema()
if( !frame )
return;
if( !frame->IsShown() ) // the frame exists, (created by the dialog field editor)
if( !frame->IsShownOnScreen() ) // the frame exists, (created by the dialog field editor)
// but no project loaded.
{
frame->OpenProjectFiles( std::vector<wxString>( 1, schematic.GetFullPath() ) );
@ -2471,7 +2471,7 @@ bool PCB_EDIT_FRAME::PropertiesShown()
void PCB_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
{
if( IsShown() )
if( IsShownOnScreen() )
{
// We only need this until the frame is done resizing and the final client size is
// established.

View File

@ -113,7 +113,7 @@ int DRC_TOOL::ShowDRCDialog( const TOOL_EVENT& aEvent )
bool DRC_TOOL::IsDRCDialogShown()
{
if( m_drcDialog )
return m_drcDialog->IsShown();
return m_drcDialog->IsShownOnScreen();
return false;
}
@ -257,7 +257,7 @@ int DRC_TOOL::CrossProbe( const TOOL_EVENT& aEvent )
if( selection.GetSize() == 1 && selection.Front()->Type() == PCB_MARKER_T )
{
if( !m_drcDialog->IsShown() )
if( !m_drcDialog->IsShownOnScreen() )
m_drcDialog->Show( true );
m_drcDialog->SelectMarker( static_cast<PCB_MARKER*>( selection.Front() ) );

View File

@ -301,7 +301,7 @@ int FOOTPRINT_EDITOR_CONTROL::SaveAs( const TOOL_EVENT& aEvent )
// Get rid of the save-will-update-board-only (or any other dismissable warning)
WX_INFOBAR* infobar = m_frame->GetInfoBar();
if( infobar->IsShown() && infobar->HasCloseButton() )
if( infobar->IsShownOnScreen() && infobar->HasCloseButton() )
infobar->Dismiss();
canvas()->ForceRefresh();
@ -677,7 +677,7 @@ void FOOTPRINT_EDITOR_CONTROL::CrossProbe( const PCB_MARKER* aMarker )
if( !m_checkerDialog )
m_checkerDialog = new DIALOG_FOOTPRINT_CHECKER( m_frame );
if( !m_checkerDialog->IsShown() )
if( !m_checkerDialog->IsShownOnScreen() )
m_checkerDialog->Show( true );
m_checkerDialog->SelectMarker( aMarker );

View File

@ -83,7 +83,7 @@ void PCB_SEARCH_PANE::onBoardChanged( wxCommandEvent& event )
void PCB_SEARCH_PANE::OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem )
{
if( !IsShown() )
if( !IsShownOnScreen() )
return;
RefreshSearch();
@ -92,7 +92,7 @@ void PCB_SEARCH_PANE::OnBoardItemAdded( BOARD& aBoard, BOARD_ITEM* aBoardItem )
void PCB_SEARCH_PANE::OnBoardItemsAdded( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems )
{
if( !IsShown() )
if( !IsShownOnScreen() )
return;
RefreshSearch();
@ -101,7 +101,7 @@ void PCB_SEARCH_PANE::OnBoardItemsAdded( BOARD& aBoard, std::vector<BOARD_ITEM*>
void PCB_SEARCH_PANE::OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem )
{
if( !IsShown() )
if( !IsShownOnScreen() )
return;
RefreshSearch();
@ -110,7 +110,7 @@ void PCB_SEARCH_PANE::OnBoardItemRemoved( BOARD& aBoard, BOARD_ITEM* aBoardItem
void PCB_SEARCH_PANE::OnBoardItemsRemoved( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems )
{
if( !IsShown() )
if( !IsShownOnScreen() )
return;
RefreshSearch();
@ -124,7 +124,7 @@ void PCB_SEARCH_PANE::OnBoardNetSettingsChanged( BOARD& aBoard )
void PCB_SEARCH_PANE::OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem )
{
if( !IsShown() )
if( !IsShownOnScreen() )
return;
RefreshSearch();
@ -133,7 +133,7 @@ void PCB_SEARCH_PANE::OnBoardItemChanged( BOARD& aBoard, BOARD_ITEM* aBoardItem
void PCB_SEARCH_PANE::OnBoardItemsChanged( BOARD& aBoard, std::vector<BOARD_ITEM*>& aBoardItems )
{
if( !IsShown() )
if( !IsShownOnScreen() )
return;
RefreshSearch();
@ -147,7 +147,7 @@ void PCB_SEARCH_PANE::OnBoardHighlightNetChanged( BOARD& aBoard )
void PCB_SEARCH_PANE::OnBoardRatsnestChanged( BOARD& aBoard )
{
if( !IsShown() )
if( !IsShownOnScreen() )
return;
RefreshSearch();