Update text variables even when they're changed from other binary.

For instance, you might have PCBNew open but change the variable
value through EEschema > Schematic Setup.

Fixes https://gitlab.com/kicad/code/kicad/issues/4918
This commit is contained in:
Jeff Young 2020-07-17 21:04:14 +01:00
parent 33480ecad1
commit 3fd0a3f842
35 changed files with 70 additions and 63 deletions

View File

@ -625,12 +625,12 @@ void EDA_3D_VIEWER::SynchroniseColoursWithBoard()
}
void EDA_3D_VIEWER::CommonSettingsChanged( bool aEnvVarsChanged )
void EDA_3D_VIEWER::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::CommonSettingsChanged" );
// Regen menu bars, etc
EDA_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged );
EDA_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
// There is no base class that handles toolbars for this frame
ReCreateMainToolbar();

View File

@ -152,7 +152,7 @@ class EDA_3D_VIEWER : public EDA_3D_BOARD_HOLDER, public KIWAY_PLAYER
* This would be private (and only called by the Kiway), but we need to do this manually
* from the PCB frame because the 3D viewer isn't updated via the #KIWAY.
*/
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
void SynchroniseColoursWithBoard();

View File

@ -325,9 +325,9 @@ void EDA_BASE_FRAME::ShowChangedLanguage()
}
void EDA_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
void EDA_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
TOOLS_HOLDER::CommonSettingsChanged( aEnvVarsChanged );
TOOLS_HOLDER::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
@ -469,7 +469,7 @@ void EDA_BASE_FRAME::LoadWindowSettings( WINDOW_SETTINGS* aCfg )
m_perspective = aCfg->perspective;
m_mruPath = aCfg->mru_path;
TOOLS_HOLDER::CommonSettingsChanged( false );
TOOLS_HOLDER::CommonSettingsChanged( false, false );
}
@ -693,7 +693,7 @@ void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event )
book->GetPage( i )->Layout();
if( dlg.ShowModal() == wxID_OK )
dlg.Kiway().CommonSettingsChanged( false );
dlg.Kiway().CommonSettingsChanged( false, false );
}

View File

@ -205,9 +205,9 @@ void EDA_DRAW_FRAME::ToggleUserUnits()
}
void EDA_DRAW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
void EDA_DRAW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
EDA_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged );
EDA_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
KIGFX::VIEW_CONTROLS* viewControls = GetCanvas()->GetViewControls();

View File

@ -473,7 +473,7 @@ void KIWAY::SetLanguage( int aLanguage )
}
}
void KIWAY::CommonSettingsChanged( bool aEnvVarsChanged )
void KIWAY::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
#if 1
if( m_ctl & KFCTL_CPP_PROJECT_SUITE )
@ -484,7 +484,7 @@ void KIWAY::CommonSettingsChanged( bool aEnvVarsChanged )
EDA_BASE_FRAME* top = static_cast<EDA_BASE_FRAME*>( m_top );
if( top )
top->CommonSettingsChanged( aEnvVarsChanged );
top->CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
}
#endif
@ -493,7 +493,7 @@ void KIWAY::CommonSettingsChanged( bool aEnvVarsChanged )
KIWAY_PLAYER* frame = GetPlayerFrame( ( FRAME_T )i );
if( frame )
frame->CommonSettingsChanged( aEnvVarsChanged );
frame->CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
}
}

View File

@ -98,7 +98,7 @@ int COMMON_CONTROL::ConfigurePaths( const TOOL_EVENT& aEvent )
DIALOG_CONFIGURE_PATHS dlg( m_frame, nullptr );
if( dlg.ShowModal() == wxID_OK )
m_frame->Kiway().CommonSettingsChanged( true );
m_frame->Kiway().CommonSettingsChanged( true, false );
}
return 0;

View File

@ -114,7 +114,7 @@ bool TOOLS_HOLDER::IsCurrentTool( const TOOL_ACTION& aAction ) const
}
void TOOLS_HOLDER::CommonSettingsChanged( bool aEnvVarsChanged )
void TOOLS_HOLDER::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
if( GetToolManager() )
GetToolManager()->GetActionManager()->UpdateHotKeys( false );

View File

@ -30,6 +30,7 @@ class PANEL_SETUP_FORMATTING;
class PANEL_SETUP_PINMAP;
class PANEL_TEXT_VARIABLES;
class PANEL_SETUP_NETCLASSES;
class ERC_ITEM;
class DIALOG_SCHEMATIC_SETUP : public PAGED_DIALOG

View File

@ -29,8 +29,10 @@
#include <dialogs/panel_eeschema_template_fieldnames.h>
#include <dialogs/panel_libedit_color_settings.h>
#include <dialogs/panel_libedit_settings.h>
#include <dialogs/dialog_schematic_setup.h>
#include <eeschema_config.h>
#include <fctsys.h>
#include <kiway.h>
#include <lib_edit_frame.h>
#include <panel_gal_display_options.h>
#include <panel_hotkeys_editor.h>
@ -38,7 +40,6 @@
#include <project/project_file.h>
#include <project/net_settings.h>
#include <sch_edit_frame.h>
#include <sch_junction.h>
#include <sch_painter.h>
#include <schematic.h>
#include <settings/app_settings.h>
@ -47,8 +48,6 @@
#include <widgets/paged_dialog.h>
#include <wildcards_and_files_ext.h>
#include <ws_data_model.h>
#include <dialogs/dialog_schematic_setup.h>
#include "erc.h"
#define FieldNameTemplatesKey wxT( "FieldNameTemplates" )
@ -272,6 +271,7 @@ void SCH_EDIT_FRAME::ShowSchematicSetupDialog( const wxString& aInitialPage )
Prj().GetProjectFile().NetSettings().ResolveNetClassAssignments();
SaveProjectSettings();
Kiway().CommonSettingsChanged( false, true );
GetCanvas()->Refresh();
}
}

View File

@ -656,9 +656,9 @@ WINDOW_SETTINGS* LIB_VIEW_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
}
void LIB_VIEW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
void LIB_VIEW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged );
SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
if( aEnvVarsChanged )
ReCreateListLib();

View File

@ -104,7 +104,7 @@ public:
WINDOW_SETTINGS* GetWindowSettings( APP_SETTINGS_BASE* aCfg ) override;
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
/**
* Set a filter to display only libraries and/or components which match the filter.

View File

@ -731,9 +731,9 @@ void LIB_EDIT_FRAME::emptyScreen()
}
void LIB_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
void LIB_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged );
SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
GetCanvas()->GetGAL()->SetAxesColor( m_colorSettings->GetColor( LAYER_SCHEMATIC_GRID_AXES ) );

View File

@ -417,7 +417,7 @@ public:
/**
* Called after the preferences dialog is run.
*/
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
void ShowChangedLanguage() override;

View File

@ -418,9 +418,9 @@ COLOR4D SCH_BASE_FRAME::GetLayerColor( SCH_LAYER_ID aLayer )
}
void SCH_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
void SCH_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged );
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
m_colorSettings = Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );

View File

@ -278,7 +278,7 @@ public:
*/
virtual void OnModify() {}
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
/**
* Helper to retrieve a layer color from the global color settings

View File

@ -1031,9 +1031,12 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
}
void SCH_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
void SCH_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged );
SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
if( aTextVarsChanged )
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
RecreateToolbars();
Layout();

View File

@ -937,7 +937,7 @@ public:
/**
* Called after the preferences dialog is run.
*/
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
void ShowChangedLanguage() override;

View File

@ -1170,9 +1170,9 @@ void GERBVIEW_FRAME::setupTools()
}
void GERBVIEW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
void GERBVIEW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged );
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
RecreateToolbars();
Layout();

View File

@ -562,7 +562,7 @@ public:
/**
* Called after the preferences dialog is run.
*/
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
void SyncToolbars() override;

View File

@ -494,7 +494,7 @@ public:
* Notification event that some of the common (suite-wide) settings have changed.
* Update menus, toolbars, local variables, etc.
*/
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
const wxString& GetAboutTitle() const { return m_AboutTitle; }

View File

@ -113,7 +113,7 @@ protected:
void unitsChangeRefresh() override;
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
/**
* Sets the common key-pair for exiting the application (Ctrl-Q) and ties it

View File

@ -380,7 +380,7 @@ public:
* Calls CommonSettingsChanged() on all KIWAY_PLAYERs.
* Used after changing suite-wide options such as panning, autosave interval, etc.
*/
VTBL_ENTRY void CommonSettingsChanged( bool aEnvVarsChanged );
VTBL_ENTRY void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged );
KIWAY( PGM_BASE* aProgram, int aCtlBits, wxFrame* aTop = NULL );

View File

@ -380,7 +380,7 @@ public:
virtual MAGNETIC_SETTINGS* GetMagneticItemsSettings();
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
virtual void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) {}

View File

@ -110,7 +110,7 @@ public:
* Notification event that some of the common (suite-wide) settings have changed.
* Update hotkeys, preferences, etc.
*/
virtual void CommonSettingsChanged( bool aEnvVarsChanged );
virtual void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged );
/**
* Canvas access.

View File

@ -516,7 +516,7 @@ void KICAD_MANAGER_FRAME::ShowChangedLanguage()
}
void KICAD_MANAGER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
void KICAD_MANAGER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
int historySize = Pgm().GetCommonSettings()->m_System.file_history_size;
GetFileHistory().SetMaxFiles( (unsigned) std::max( 0, historySize ) );

View File

@ -147,7 +147,7 @@ public:
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
void ShowChangedLanguage() override;
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
/**
* Called by sending a event with id = ID_INIT_WATCHED_PATHS

View File

@ -892,9 +892,9 @@ void FOOTPRINT_EDIT_FRAME::ActivateGalCanvas()
}
void FOOTPRINT_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
void FOOTPRINT_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
PCB_BASE_EDIT_FRAME::CommonSettingsChanged( aEnvVarsChanged );
PCB_BASE_EDIT_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
if( aEnvVarsChanged )
SyncLibraryTree( true );

View File

@ -321,7 +321,7 @@ public:
/**
* Called after the preferences dialog is run.
*/
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
/**
* Synchronize the footprint library tree to the current state of the footprint library

View File

@ -771,9 +771,9 @@ void FOOTPRINT_VIEWER_FRAME::SetAutoZoom( bool aAutoZoom )
}
void FOOTPRINT_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
void FOOTPRINT_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
PCB_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged );
PCB_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
if( aEnvVarsChanged )
ReCreateLibraryList();

View File

@ -141,7 +141,7 @@ private:
WINDOW_SETTINGS* GetWindowSettings( APP_SETTINGS_BASE* aCfg ) override;
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
/**
* Function OnActivate

View File

@ -685,9 +685,9 @@ MAGNETIC_SETTINGS* PCB_BASE_FRAME::GetMagneticItemsSettings()
}
void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged );
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
RecreateToolbars();
@ -695,7 +695,7 @@ void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
EDA_3D_VIEWER* viewer = Get3DViewerFrame();
if( viewer )
viewer->CommonSettingsChanged( aEnvVarsChanged );
viewer->CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
}

View File

@ -22,6 +22,7 @@
#include <fctsys.h>
#include <kiface_i.h>
#include <kiway.h>
#include <pgm_base.h>
#include <pcb_edit_frame.h>
#include <3d_viewer/eda_3d_viewer.h>
@ -31,7 +32,7 @@
#include <pcbnew_id.h>
#include <drc/drc.h>
#include <pcbnew_settings.h>
#include <layer_widget.h>
//#include <layer_widget.h>
#include <pcb_layer_widget.h>
#include <footprint_edit_frame.h>
#include <dialog_plot.h>
@ -39,8 +40,7 @@
#include <dialogs/dialog_exchange_footprints.h>
#include <dialog_board_setup.h>
#include <convert_to_biu.h>
#include <view/view_controls.h>
#include <pcb_painter.h>
//#include <pcb_painter.h>
#include <invoke_pcb_dialog.h>
#include <class_board.h>
#include <class_module.h>
@ -662,9 +662,7 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage, const w
UpdateUserInterface();
ReCreateAuxiliaryToolbar();
for( auto module : GetBoard()->Modules() )
GetCanvas()->GetView()->Update( module );
Kiway().CommonSettingsChanged( false, true );
GetCanvas()->Refresh();
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
@ -1277,12 +1275,15 @@ int PCB_EDIT_FRAME::InstallExchangeModuleFrame( MODULE* aModule, bool updateMode
}
void PCB_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
void PCB_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
PCB_BASE_EDIT_FRAME::CommonSettingsChanged( aEnvVarsChanged );
PCB_BASE_EDIT_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
ReCreateMicrowaveVToolbar();
if( aTextVarsChanged )
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
Layout();
SendSizeEvent();
}

View File

@ -912,7 +912,7 @@ public:
/**
* Called after the preferences dialog is run.
*/
void CommonSettingsChanged( bool aEnvVarsChanged ) override;
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
void SyncToolbars() override;

View File

@ -90,12 +90,14 @@ void PCB_VIEW::Remove( KIGFX::VIEW_ITEM* aItem )
void PCB_VIEW::Update( KIGFX::VIEW_ITEM* aItem, int aUpdateFlags )
{
auto item = static_cast<BOARD_ITEM*>( aItem );
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aItem );
if( item->Type() == PCB_MODULE_T )
{
auto mod = static_cast<MODULE*>( item );
mod->RunOnChildren([this, aUpdateFlags] ( BOARD_ITEM* aModItem ) {
MODULE* mod = static_cast<MODULE*>( item );
mod->RunOnChildren( [this, aUpdateFlags] ( BOARD_ITEM* aModItem )
{
VIEW::Update( aModItem, aUpdateFlags );
} );
}

View File

@ -120,7 +120,7 @@ static struct IFACE : public KIFACE_I
dlg.SetKiway( &dlg, aKiway );
if( dlg.ShowModal() == wxID_OK )
aKiway->CommonSettingsChanged( true );
aKiway->CommonSettingsChanged( true, false );
// Dialog has completed; nothing to return.
return nullptr;