mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-07 18:35:32 +00:00
pagelayout_editor: Avoid multiple or useless calls to OnAcceptPrms()
These useless calls, have a cost in calculation time.
This commit is contained in:
parent
e04f873765
commit
59f6ffc05d
common/widgets
include/widgets
pagelayout_editor/dialogs
@ -70,7 +70,7 @@ FONT_CHOICE::~FONT_CHOICE()
|
||||
}
|
||||
|
||||
|
||||
void FONT_CHOICE::SetFontSelection( KIFONT::FONT* aFont )
|
||||
void FONT_CHOICE::SetFontSelection( KIFONT::FONT* aFont, bool aSilentMode )
|
||||
{
|
||||
if( !aFont )
|
||||
{
|
||||
@ -87,7 +87,8 @@ void FONT_CHOICE::SetFontSelection( KIFONT::FONT* aFont )
|
||||
}
|
||||
}
|
||||
|
||||
SendSelectionChangedEvent( wxEVT_CHOICE );
|
||||
if( !aSilentMode )
|
||||
SendSelectionChangedEvent( wxEVT_CHOICE );
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,7 +33,14 @@ public:
|
||||
|
||||
virtual ~FONT_CHOICE();
|
||||
|
||||
void SetFontSelection( KIFONT::FONT* aFont );
|
||||
/**
|
||||
* Set the selection in wxChoice widget
|
||||
* @param aFont is the fotn to select
|
||||
* @param aSilentMode allow or not a wxEVT_CHOICE on selection
|
||||
* default = false: the event is sent.
|
||||
* if true, just make silently the selection
|
||||
*/
|
||||
void SetFontSelection( KIFONT::FONT* aFont, bool aSilentMode = false );
|
||||
|
||||
bool HaveFontSelection() const;
|
||||
|
||||
|
@ -298,7 +298,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( DS_DATA_ITEM* aItem )
|
||||
m_constraintY.SetDoubleValue( fromMM( item->m_BoundingBoxSize.y ) );
|
||||
|
||||
// Font Options
|
||||
m_fontCtrl->SetFontSelection( item->m_Font );
|
||||
m_fontCtrl->SetFontSelection( item->m_Font, true /*silent mode */ );
|
||||
|
||||
m_bold->Check( item->m_Bold );
|
||||
m_italic->Check( item->m_Italic );
|
||||
@ -477,6 +477,9 @@ void PROPERTIES_FRAME::OnUpdateUI( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
if( m_propertiesDirty )
|
||||
{
|
||||
// Clear m_propertiesDirty now. Otherwise OnAcceptPrms() is called multiple
|
||||
// times (probably by each updated widget)
|
||||
m_propertiesDirty = false;
|
||||
CallAfter(
|
||||
[this]()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user