diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 6da082859c..ba66474d1e 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -47,6 +47,8 @@ #include #include +wxDEFINE_EVENT( UNITS_CHANGED, wxCommandEvent ); + // Minimum window size static const int s_minsize_x = 500; @@ -738,3 +740,12 @@ bool EDA_BASE_FRAME::IsContentModified() // This function should be overridden in child classes return false; } + +void EDA_BASE_FRAME::ChangeUserUnits( EDA_UNITS aUnits ) +{ + SetUserUnits( aUnits ); + unitsChangeRefresh(); + + wxCommandEvent e( UNITS_CHANGED ); + ProcessEventLocally( e ); +} diff --git a/include/eda_base_frame.h b/include/eda_base_frame.h index bacaf69746..c081da9a88 100644 --- a/include/eda_base_frame.h +++ b/include/eda_base_frame.h @@ -88,6 +88,8 @@ enum id_librarytype { LIBRARY_TYPE_SYMBOL }; +wxDECLARE_EVENT( UNITS_CHANGED, wxCommandEvent ); + /** * The base frame for deriving all KiCad main window classes. @@ -209,11 +211,7 @@ public: m_userUnits = aUnits; } - void ChangeUserUnits( EDA_UNITS aUnits ) - { - SetUserUnits( aUnits ); - unitsChangeRefresh(); - } + void ChangeUserUnits( EDA_UNITS aUnits ); SETTINGS_MANAGER* GetSettingsManager() const { return m_settingsManager; } diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index 6cd3eb97cf..01b00e812c 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -61,6 +61,9 @@ class PCB_PLOT_PARAMS; class FP_LIB_TABLE; class PCBNEW_SETTINGS; + +wxDECLARE_EVENT( BOARD_CHANGED, wxCommandEvent ); + /** * PCB_BASE_FRAME * basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer. diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 13d5bb20e5..2293dffc40 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -54,6 +54,7 @@ #include #include +wxDEFINE_EVENT( BOARD_CHANGED, wxCommandEvent ); BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME ) EVT_TOOL( ID_TB_OPTIONS_SHOW_PADS_SKETCH, PCB_BASE_FRAME::OnTogglePadDrawMode ) @@ -158,6 +159,9 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard ) delete m_Pcb; m_Pcb = aBoard; m_Pcb->SetGeneralSettings( m_Settings ); + + wxCommandEvent e( BOARD_CHANGED ); + ProcessEventLocally( e ); } }