add BOARD_CHANGED and UNITS_CHANGED events

This commit is contained in:
Oleg Endo 2020-04-13 10:27:47 +09:00 committed by Jon Evans
parent 7bf8a744f1
commit 2f1d23312f
4 changed files with 21 additions and 5 deletions

View File

@ -47,6 +47,8 @@
#include <wx/stdpaths.h> #include <wx/stdpaths.h>
#include <wx/string.h> #include <wx/string.h>
wxDEFINE_EVENT( UNITS_CHANGED, wxCommandEvent );
// Minimum window size // Minimum window size
static const int s_minsize_x = 500; static const int s_minsize_x = 500;
@ -738,3 +740,12 @@ bool EDA_BASE_FRAME::IsContentModified()
// This function should be overridden in child classes // This function should be overridden in child classes
return false; return false;
} }
void EDA_BASE_FRAME::ChangeUserUnits( EDA_UNITS aUnits )
{
SetUserUnits( aUnits );
unitsChangeRefresh();
wxCommandEvent e( UNITS_CHANGED );
ProcessEventLocally( e );
}

View File

@ -88,6 +88,8 @@ enum id_librarytype {
LIBRARY_TYPE_SYMBOL LIBRARY_TYPE_SYMBOL
}; };
wxDECLARE_EVENT( UNITS_CHANGED, wxCommandEvent );
/** /**
* The base frame for deriving all KiCad main window classes. * The base frame for deriving all KiCad main window classes.
@ -209,11 +211,7 @@ public:
m_userUnits = aUnits; m_userUnits = aUnits;
} }
void ChangeUserUnits( EDA_UNITS aUnits ) void ChangeUserUnits( EDA_UNITS aUnits );
{
SetUserUnits( aUnits );
unitsChangeRefresh();
}
SETTINGS_MANAGER* GetSettingsManager() const { return m_settingsManager; } SETTINGS_MANAGER* GetSettingsManager() const { return m_settingsManager; }

View File

@ -61,6 +61,9 @@ class PCB_PLOT_PARAMS;
class FP_LIB_TABLE; class FP_LIB_TABLE;
class PCBNEW_SETTINGS; class PCBNEW_SETTINGS;
wxDECLARE_EVENT( BOARD_CHANGED, wxCommandEvent );
/** /**
* PCB_BASE_FRAME * PCB_BASE_FRAME
* basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer. * basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.

View File

@ -54,6 +54,7 @@
#include <tool/tool_dispatcher.h> #include <tool/tool_dispatcher.h>
#include <tools/pcb_actions.h> #include <tools/pcb_actions.h>
wxDEFINE_EVENT( BOARD_CHANGED, wxCommandEvent );
BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME ) BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_TB_OPTIONS_SHOW_PADS_SKETCH, PCB_BASE_FRAME::OnTogglePadDrawMode ) 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; delete m_Pcb;
m_Pcb = aBoard; m_Pcb = aBoard;
m_Pcb->SetGeneralSettings( m_Settings ); m_Pcb->SetGeneralSettings( m_Settings );
wxCommandEvent e( BOARD_CHANGED );
ProcessEventLocally( e );
} }
} }