diff --git a/common/advanced_config.cpp b/common/advanced_config.cpp index 1ab0174c21..6a69d3317a 100644 --- a/common/advanced_config.cpp +++ b/common/advanced_config.cpp @@ -123,6 +123,7 @@ static const wxChar ExtensionSnapActivateOnHover[] = wxT( "ExtensionSnapActivate static const wxChar EnableSnapAnchorsDebug[] = wxT( "EnableSnapAnchorsDebug" ); static const wxChar MinParallelAngle[] = wxT( "MinParallelAngle" ); static const wxChar HoleWallPaintingMultiplier[] = wxT( "HoleWallPaintingMultiplier" ); +static const wxChar MsgPanelShowUuids[] = wxT( "MsgPanelShowUuids" ); } // namespace KEYS @@ -240,6 +241,7 @@ ADVANCED_CFG::ADVANCED_CFG() m_SmallDrillMarkSize = 0.35; m_HotkeysDumper = false; m_DrawBoundingBoxes = false; + m_MsgPanelShowUuids = 0; m_ShowPcbnewExportNetlist = false; m_Skip3DModelFileCache = false; m_Skip3DModelMemoryCache = false; @@ -564,6 +566,10 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg ) &m_HoleWallPaintingMultiplier, m_HoleWallPaintingMultiplier, 0.1, 100.0 ) ); + configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::MsgPanelShowUuids, + &m_MsgPanelShowUuids, + m_MsgPanelShowUuids ) ); + // Special case for trace mask setting...we just grab them and set them immediately // Because we even use wxLogTrace inside of advanced config wxString traceMasks; diff --git a/common/widgets/msgpanel.cpp b/common/widgets/msgpanel.cpp index 9934715710..699a2555c5 100644 --- a/common/widgets/msgpanel.cpp +++ b/common/widgets/msgpanel.cpp @@ -30,6 +30,9 @@ #include <wx/settings.h> #include <wx/toplevel.h> +#include <advanced_config.h> +#include <kiid.h> + #include <widgets/ui_common.h> @@ -237,3 +240,20 @@ void EDA_MSG_PANEL::erase( wxDC* aDC ) aDC->SetBrush( brush ); aDC->DrawRectangle( 0, 0, size.x, size.y ); } + + +std::optional<wxString> GetMsgPanelDisplayUuid( const KIID& aKiid ) +{ + const static int showUuids = ADVANCED_CFG::GetCfg().m_MsgPanelShowUuids; + std::optional<wxString> uuid; + + if( showUuids > 0 ) + { + uuid = aKiid.AsString(); + + if( showUuids == 2 ) + uuid = uuid->SubString( 0, 7 ); + } + + return uuid; +} diff --git a/eeschema/tools/ee_inspection_tool.cpp b/eeschema/tools/ee_inspection_tool.cpp index c7454d3284..8b2182c25c 100644 --- a/eeschema/tools/ee_inspection_tool.cpp +++ b/eeschema/tools/ee_inspection_tool.cpp @@ -567,9 +567,12 @@ int EE_INSPECTION_TOOL::UpdateMessagePanel( const TOOL_EVENT& aEvent ) { if( selection.GetSize() == 1 ) { - EDA_ITEM* item = (EDA_ITEM*) selection.Front(); - + EDA_ITEM* item = (EDA_ITEM*) selection.Front(); std::vector<MSG_PANEL_ITEM> msgItems; + + if( std::optional<wxString> uuid = GetMsgPanelDisplayUuid( item->m_Uuid ) ) + msgItems.emplace_back( _( "UUID" ), *uuid ); + item->GetMsgPanelInfo( m_frame, msgItems ); m_frame->SetMsgPanel( msgItems ); } diff --git a/include/advanced_config.h b/include/advanced_config.h index d3a31201ec..a3c16c326a 100644 --- a/include/advanced_config.h +++ b/include/advanced_config.h @@ -396,6 +396,21 @@ public: */ bool m_ShowEventCounters; + /** + * Show UUIDs of items in the message panel. + * + * Can be useful when debugging against a specific item + * saved in a file. + * + * 0: do not show (default) + * 1: show full UUID + * 2: show only first 8 characters of UUID + * + * Setting name: "MsgPanelShowUuids" + * Default value: 0 + */ + int m_MsgPanelShowUuids; + /** * Allow manual scaling of canvas. * diff --git a/include/widgets/msgpanel.h b/include/widgets/msgpanel.h index 9b766c6677..4f469a4d02 100644 --- a/include/widgets/msgpanel.h +++ b/include/widgets/msgpanel.h @@ -28,23 +28,23 @@ * @brief Message panel definition file. */ -#ifndef _MSGPANEL_H_ -#define _MSGPANEL_H_ +#pragma once +#include <optional> +#include <vector> #include <gal/color4d.h> #include <wx/window.h> #include <wx/panel.h> -#include <vector> - using KIGFX::COLOR4D; #define MSG_PANEL_DEFAULT_PAD 6 ///< The default number of spaces between each text string. class EDA_MSG_PANEL; +class KIID; /** @@ -164,4 +164,10 @@ protected: }; -#endif // _MSGPANEL_H_ +/** + * Get a formatted UUID string for display in the message panel, + * according to the current advanced configuration setting. + * + * This will be std::nullopt if the configuration setting disables UUID display. + */ +std::optional<wxString> GetMsgPanelDisplayUuid( const KIID& aKiid ); diff --git a/pagelayout_editor/tools/pl_editor_control.cpp b/pagelayout_editor/tools/pl_editor_control.cpp index 807b8a57a8..201986be1b 100644 --- a/pagelayout_editor/tools/pl_editor_control.cpp +++ b/pagelayout_editor/tools/pl_editor_control.cpp @@ -153,9 +153,12 @@ int PL_EDITOR_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent ) if( selection.GetSize() == 1 ) { - EDA_ITEM* item = (EDA_ITEM*) selection.Front(); - + EDA_ITEM* item = (EDA_ITEM*) selection.Front(); std::vector<MSG_PANEL_ITEM> msgItems; + + if( std::optional<wxString> uuid = GetMsgPanelDisplayUuid( item->m_Uuid ) ) + msgItems.emplace_back( _( "UUID" ), *uuid ); + item->GetMsgPanelInfo( m_frame, msgItems ); m_frame->SetMsgPanel( msgItems ); diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index 71bc5cc463..6df8e7ec83 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -23,13 +23,14 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "pcb_control.h" + #include <kiplatform/ui.h> #include <tools/edit_tool.h> #include <tools/board_inspection_tool.h> #include <router/router_tool.h> #include <pgm_base.h> #include <tools/pcb_actions.h> -#include <tools/pcb_control.h> #include <tools/pcb_picker_tool.h> #include <tools/pcb_selection_tool.h> #include <tools/board_reannotate_tool.h> @@ -1656,6 +1657,9 @@ int PCB_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent ) { EDA_ITEM* item = selection.Front(); + if( std::optional<wxString> uuid = GetMsgPanelDisplayUuid( item->m_Uuid ) ) + msgItems.emplace_back( _( "UUID" ), *uuid ); + item->GetMsgPanelInfo( m_frame, msgItems ); PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item );