From 3c1af1af74c60c0b2b40e5f3d1f0379e7cc0692f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 23 Jul 2021 20:15:55 +0100 Subject: [PATCH] Update selected tool string when language changes. Fixes https://gitlab.com/kicad/code/kicad/issues/8813 --- common/eda_base_frame.cpp | 2 ++ common/tool/tools_holder.cpp | 10 ++++++++++ cvpcb/tools/cvpcb_fpviewer_selection_tool.cpp | 10 +++------- include/eda_base_frame.h | 2 +- include/tool/tools_holder.h | 2 ++ pcb_calculator/dialogs/dialog_regulator_form.cpp | 2 -- pcb_calculator/dialogs/dialog_regulator_form.h | 2 +- 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 387d488d5d..82245a761f 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -458,6 +458,8 @@ void EDA_BASE_FRAME::AddStandardHelpMenu( wxMenuBar* aMenuBar ) void EDA_BASE_FRAME::ShowChangedLanguage() { + TOOLS_HOLDER::ShowChangedLanguage(); + if( GetMenuBar() ) { ReCreateMenuBar(); diff --git a/common/tool/tools_holder.cpp b/common/tool/tools_holder.cpp index 37eda1ef7a..d32f0f4107 100644 --- a/common/tool/tools_holder.cpp +++ b/common/tool/tools_holder.cpp @@ -115,6 +115,16 @@ bool TOOLS_HOLDER::IsCurrentTool( const TOOL_ACTION& aAction ) const } +void TOOLS_HOLDER::ShowChangedLanguage() +{ + std::string actionName = CurrentToolName(); + TOOL_ACTION* action = m_toolManager->GetActionManager()->FindAction( actionName ); + + if( action ) + DisplayToolMsg( action->GetLabel() ); +} + + void TOOLS_HOLDER::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) { if( GetToolManager() ) diff --git a/cvpcb/tools/cvpcb_fpviewer_selection_tool.cpp b/cvpcb/tools/cvpcb_fpviewer_selection_tool.cpp index f9b649a62c..72f8051039 100644 --- a/cvpcb/tools/cvpcb_fpviewer_selection_tool.cpp +++ b/cvpcb/tools/cvpcb_fpviewer_selection_tool.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -54,19 +54,14 @@ int CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) if( m_frame->ToolStackIsEmpty() ) m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW ); - // single click? Select single object if( evt->IsClick( BUT_LEFT ) ) { clearSelection(); } - - // right click? if there is any object - show the context menu else if( evt->IsClick( BUT_RIGHT ) ) { m_menu.ShowContextMenu( m_selection ); } - - // Middle double click? Do zoom to fit or zoom to objects else if( evt->IsDblClick( BUT_MIDDLE ) ) { m_toolMgr->RunAction( ACTIONS::zoomFitScreen, true ); @@ -75,9 +70,10 @@ int CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) { clearSelection(); } - else + { evt->SetPassEvent(); + } } return 0; diff --git a/include/eda_base_frame.h b/include/eda_base_frame.h index 9f6f1b890e..b7cdebddcc 100644 --- a/include/eda_base_frame.h +++ b/include/eda_base_frame.h @@ -491,7 +491,7 @@ public: /** * Redraw the menus and what not in current language. */ - virtual void ShowChangedLanguage(); + void ShowChangedLanguage() override; /** * Notification event that some of the common (suite-wide) settings have changed. diff --git a/include/tool/tools_holder.h b/include/tool/tools_holder.h index 6b0e689fe6..be85348b67 100644 --- a/include/tool/tools_holder.h +++ b/include/tool/tools_holder.h @@ -120,6 +120,8 @@ public: virtual void DisplayToolMsg( const wxString& msg ) {}; + virtual void ShowChangedLanguage(); + /** * Indicate that hotkeys should perform an immediate action even if another tool is * currently active. If false, the first hotkey should select the relevant tool. diff --git a/pcb_calculator/dialogs/dialog_regulator_form.cpp b/pcb_calculator/dialogs/dialog_regulator_form.cpp index 04302fec2d..d9e792b9b2 100644 --- a/pcb_calculator/dialogs/dialog_regulator_form.cpp +++ b/pcb_calculator/dialogs/dialog_regulator_form.cpp @@ -36,9 +36,7 @@ bool DIALOG_REGULATOR_FORM::TransferDataFromWindow() bool success = true; if( m_textCtrlName->GetValue().IsEmpty() ) - { success = false; - } if( m_textCtrlVref->GetValue().IsEmpty() ) { diff --git a/pcb_calculator/dialogs/dialog_regulator_form.h b/pcb_calculator/dialogs/dialog_regulator_form.h index 3b1516b795..7abf1e6c8f 100644 --- a/pcb_calculator/dialogs/dialog_regulator_form.h +++ b/pcb_calculator/dialogs/dialog_regulator_form.h @@ -57,7 +57,7 @@ public: /** * @return true if regulator parameters are acceptable. */ - bool TransferDataFromWindow(); + bool TransferDataFromWindow() override; /** * Transfer data from dialog to aItem.