Force update of some text when activation status changes

The text areas aren't always redrawn when the window is activated
or deactivated, so we need to force a refresh of the text to ensure
it is the correct font color.
This commit is contained in:
Ian McInerney 2021-03-26 01:24:12 +00:00
parent 804c09b8f2
commit f6041fb52d
6 changed files with 48 additions and 0 deletions

View File

@ -55,6 +55,7 @@
#include <view/view.h>
#include <drawing_sheet/ds_draw_item.h>
#include <widgets/msgpanel.h>
#include <wx/event.h>
#include <wx/snglinst.h>
#include <dialogs/dialog_grid_settings.h>
#include <widgets/ui_common.h>
@ -65,6 +66,8 @@
BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
EVT_UPDATE_UI( ID_ON_GRID_SELECT, EDA_DRAW_FRAME::OnUpdateSelectGrid )
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, EDA_DRAW_FRAME::OnUpdateSelectZoom )
EVT_ACTIVATE( EDA_DRAW_FRAME::onActivate )
END_EVENT_TABLE()
@ -1066,3 +1069,20 @@ void EDA_DRAW_FRAME::resolveCanvasType()
SaveSettings( config() );
}
}
void EDA_DRAW_FRAME::handleActivateEvent( wxActivateEvent& aEvent )
{
// Force a refresh of the message panel to ensure that the text is the right color
// when the window activates
if( !IsIconized() )
m_messagePanel->Refresh();
}
void EDA_DRAW_FRAME::onActivate( wxActivateEvent& aEvent )
{
handleActivateEvent( aEvent );
aEvent.Skip();
}

View File

@ -474,6 +474,13 @@ protected:
*/
bool saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType );
/**
* Handle a window activation event.
*/
virtual void handleActivateEvent( wxActivateEvent& aEvent );
void onActivate( wxActivateEvent& aEvent );
wxSocketServer* m_socketServer;
std::vector<wxSocketBase*> m_sockets; ///< interprocess communication

View File

@ -222,3 +222,11 @@ wxString PCB_BASE_EDIT_FRAME::GetDesignRulesPath()
fn.SetExt( DesignRulesFileExtension );
return Prj().AbsolutePath( fn.GetFullName() );
}
void PCB_BASE_EDIT_FRAME::handleActivateEvent( wxActivateEvent& aEvent )
{
EDA_DRAW_FRAME::handleActivateEvent( aEvent );
// The text in the collapsible pane headers need to be updated
m_appearancePanel->RefreshCollapsiblePanes();
}

View File

@ -222,6 +222,8 @@ protected:
* @return Pointer to library table selected or nullptr if none selected/canceled
*/
FP_LIB_TABLE* selectLibTable( bool aOptional = false );
void handleActivateEvent( wxActivateEvent& aEvent ) override;
};
#endif

View File

@ -2826,3 +2826,9 @@ void APPEARANCE_CONTROLS::onReadOnlySwatch()
"Preferences to enable color editing." ),
10000, wxICON_INFORMATION );
}
void APPEARANCE_CONTROLS::RefreshCollapsiblePanes()
{
m_paneLayerDisplayOptions->Refresh();
}

View File

@ -270,6 +270,11 @@ public:
///< Set the current notebook tab.
void SetTabIndex( int aTab );
/**
* Function to force a redraw of the collapsible panes in this control.
*/
void RefreshCollapsiblePanes();
protected:
void OnNotebookPageChanged( wxNotebookEvent& event ) override;