Pass un-pretty-printed bus names through menu help text.
Fixes https://gitlab.com/kicad/code/kicad/issues/7412
This commit is contained in:
parent
4679682fe9
commit
a30ae6a237
|
@ -496,19 +496,23 @@ void ACTION_MENU::OnMenuEvent( wxMenuEvent& aEvent )
|
||||||
runEventHandlers( aEvent, evt );
|
runEventHandlers( aEvent, evt );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Handling non-action menu entries (e.g. items in clarification list)
|
// Handling non-ACTION menu entries. Two ranges of ids are supported:
|
||||||
// in some context menus, that have IDs explicitly chosen between
|
// between 0 and ID_CONTEXT_MENU_ID_MAX
|
||||||
// ID_POPUP_MENU_START and ID_POPUP_MENU_END
|
// between ID_POPUP_MENU_START and ID_POPUP_MENU_END
|
||||||
// Note also items in clarification list have an id >= 0 and < wxID_LOWEST
|
|
||||||
// in fact 0 to n-1 for n items in clarification list)
|
#define ID_CONTEXT_MENU_ID_MAX wxID_LOWEST /* = 100 should be plenty */
|
||||||
// id < 0 are automatically created for menuitems created with wxID_ANY
|
|
||||||
#define ID_CONTEXT_MENU_ID_MAX wxID_LOWEST /* = 100 should be enough and better */
|
|
||||||
|
|
||||||
if( !evt &&
|
if( !evt &&
|
||||||
( ( m_selected >= 0 && m_selected < ID_CONTEXT_MENU_ID_MAX ) ||
|
( ( m_selected >= 0 && m_selected < ID_CONTEXT_MENU_ID_MAX ) ||
|
||||||
( m_selected >= ID_POPUP_MENU_START && m_selected <= ID_POPUP_MENU_END ) ) )
|
( m_selected >= ID_POPUP_MENU_START && m_selected <= ID_POPUP_MENU_END ) ) )
|
||||||
{
|
{
|
||||||
|
ACTION_MENU* actionMenu = dynamic_cast<ACTION_MENU*>( GetParent() );
|
||||||
|
|
||||||
|
if( actionMenu && actionMenu->PassHelpTextToHandler() )
|
||||||
|
menuText = GetHelpString( aEvent.GetId() );
|
||||||
|
else
|
||||||
menuText = GetLabelText( aEvent.GetId() );
|
menuText = GetLabelText( aEvent.GetId() );
|
||||||
|
|
||||||
evt = TOOL_EVENT( TC_COMMAND, TA_CHOICE_MENU_CHOICE, m_selected, AS_GLOBAL,
|
evt = TOOL_EVENT( TC_COMMAND, TA_CHOICE_MENU_CHOICE, m_selected, AS_GLOBAL,
|
||||||
&menuText );
|
&menuText );
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@
|
||||||
#include <tool/tool_event.h>
|
#include <tool/tool_event.h>
|
||||||
#include <trigo.h>
|
#include <trigo.h>
|
||||||
#include <undo_redo_container.h>
|
#include <undo_redo_container.h>
|
||||||
|
|
||||||
#include <connection_graph.h>
|
#include <connection_graph.h>
|
||||||
#include <eeschema_id.h>
|
#include <eeschema_id.h>
|
||||||
#include <sch_bus_entry.h>
|
#include <sch_bus_entry.h>
|
||||||
|
@ -61,10 +60,8 @@
|
||||||
#include <sch_sheet.h>
|
#include <sch_sheet.h>
|
||||||
#include <sch_text.h>
|
#include <sch_text.h>
|
||||||
#include <schematic.h>
|
#include <schematic.h>
|
||||||
|
|
||||||
#include <ee_actions.h>
|
#include <ee_actions.h>
|
||||||
#include <ee_grid_helper.h>
|
#include <ee_grid_helper.h>
|
||||||
#include <ee_point_editor.h>
|
|
||||||
#include <ee_selection.h>
|
#include <ee_selection.h>
|
||||||
#include <ee_selection_tool.h>
|
#include <ee_selection_tool.h>
|
||||||
|
|
||||||
|
@ -84,6 +81,7 @@ public:
|
||||||
m_showTitle = true;
|
m_showTitle = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PassHelpTextToHandler() override { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ACTION_MENU* create() const override
|
ACTION_MENU* create() const override
|
||||||
|
@ -139,19 +137,19 @@ private:
|
||||||
for( const auto& member : connection->Members() )
|
for( const auto& member : connection->Members() )
|
||||||
{
|
{
|
||||||
int id = ID_POPUP_SCH_UNFOLD_BUS + ( idx++ );
|
int id = ID_POPUP_SCH_UNFOLD_BUS + ( idx++ );
|
||||||
wxString name = SCH_CONNECTION::PrintBusForUI( member->FullLocalName() );
|
wxString name = member->FullLocalName();
|
||||||
|
|
||||||
if( member->Type() == CONNECTION_TYPE::BUS )
|
if( member->Type() == CONNECTION_TYPE::BUS )
|
||||||
{
|
{
|
||||||
ACTION_MENU* submenu = new ACTION_MENU( true );
|
ACTION_MENU* submenu = new ACTION_MENU( true );
|
||||||
submenu->SetTool( m_tool );
|
submenu->SetTool( m_tool );
|
||||||
AppendSubMenu( submenu, name );
|
AppendSubMenu( submenu, SCH_CONNECTION::PrintBusForUI( name ), name );
|
||||||
|
|
||||||
for( const auto& sub_member : member->Members() )
|
for( const auto& sub_member : member->Members() )
|
||||||
{
|
{
|
||||||
id = ID_POPUP_SCH_UNFOLD_BUS + ( idx++ );
|
id = ID_POPUP_SCH_UNFOLD_BUS + ( idx++ );
|
||||||
name = SCH_CONNECTION::PrintBusForUI( sub_member->FullLocalName() );
|
name = sub_member->FullLocalName();
|
||||||
submenu->Append( id, name, wxEmptyString );
|
submenu->Append( id, SCH_CONNECTION::PrintBusForUI( name ), name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -170,6 +170,8 @@ public:
|
||||||
void OnMenuEvent( wxMenuEvent& aEvent );
|
void OnMenuEvent( wxMenuEvent& aEvent );
|
||||||
void OnIdle( wxIdleEvent& event );
|
void OnIdle( wxIdleEvent& event );
|
||||||
|
|
||||||
|
virtual bool PassHelpTextToHandler() { return false; }
|
||||||
|
|
||||||
static constexpr bool CHECK = true;
|
static constexpr bool CHECK = true;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue