diff --git a/common/widgets/font_choice.cpp b/common/widgets/font_choice.cpp index f048fec132..b02ecde6c8 100644 --- a/common/widgets/font_choice.cpp +++ b/common/widgets/font_choice.cpp @@ -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 ); } diff --git a/include/widgets/font_choice.h b/include/widgets/font_choice.h index 8a7a728f86..c91599d5f3 100644 --- a/include/widgets/font_choice.h +++ b/include/widgets/font_choice.h @@ -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; diff --git a/pagelayout_editor/dialogs/properties_frame.cpp b/pagelayout_editor/dialogs/properties_frame.cpp index 9f741d0592..a9015816dc 100644 --- a/pagelayout_editor/dialogs/properties_frame.cpp +++ b/pagelayout_editor/dialogs/properties_frame.cpp @@ -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]() {