Live update sheetpath.
Also makes it a static text to get rid of the spacing/clipping problems it has been having. Fixes https://gitlab.com/kicad/code/kicad/issues/6152
This commit is contained in:
parent
189792cd4c
commit
51dff1c822
|
@ -80,9 +80,7 @@ DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S
|
|||
// Set font sizes
|
||||
wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||
infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
|
||||
m_hiearchicalPathLabel->SetFont( infoFont );
|
||||
m_heirarchyPath->SetFont( infoFont );
|
||||
m_heirarchyPath->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) );
|
||||
m_hierarchicalPathLabel->SetFont( infoFont );
|
||||
|
||||
// wxFormBuilder doesn't include this event...
|
||||
m_grid->Connect( wxEVT_GRID_CELL_CHANGING,
|
||||
|
@ -175,9 +173,6 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataToWindow()
|
|||
|
||||
m_pageNumberTextCtrl->ChangeValue( nextPageNumber );
|
||||
|
||||
// set up the read-only fields
|
||||
m_heirarchyPath->SetValue( instance.PathHumanReadable() );
|
||||
|
||||
Layout();
|
||||
|
||||
return true;
|
||||
|
@ -770,6 +765,28 @@ void DIALOG_SHEET_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
AdjustGridColumns( m_grid->GetRect().GetWidth() );
|
||||
}
|
||||
|
||||
// Propagate changes in sheetname to displayed hierarchical path
|
||||
wxString hierarchicalPath = _( "Hierarchical path: " );
|
||||
|
||||
hierarchicalPath += m_frame->GetCurrentSheet().PathHumanReadable( false );
|
||||
|
||||
if( hierarchicalPath.Last() != '/' )
|
||||
hierarchicalPath.Append( '/' );
|
||||
|
||||
wxGridCellEditor* editor = m_grid->GetCellEditor( SHEETNAME, FDC_VALUE );
|
||||
wxControl* control = editor->GetControl();
|
||||
wxTextEntry* textControl = dynamic_cast<wxTextEntry*>( control );
|
||||
|
||||
if( textControl )
|
||||
hierarchicalPath += textControl->GetValue();
|
||||
else
|
||||
hierarchicalPath += m_grid->GetCellValue( SHEETNAME, FDC_VALUE );
|
||||
|
||||
editor->DecRef();
|
||||
|
||||
if( m_hierarchicalPathLabel->GetLabel() != hierarchicalPath )
|
||||
m_hierarchicalPathLabel->SetLabel( hierarchicalPath );
|
||||
|
||||
// Handle a delayed focus
|
||||
if( m_delayedFocusRow >= 0 )
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.9.0 Jun 18 2020)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -181,14 +181,9 @@ DIALOG_SHEET_PROPERTIES_BASE::DIALOG_SHEET_PROPERTIES_BASE( wxWindow* parent, wx
|
|||
wxBoxSizer* bSizerBottom;
|
||||
bSizerBottom = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_hiearchicalPathLabel = new wxStaticText( this, wxID_ANY, _("Hierarchical path:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_hiearchicalPathLabel->Wrap( -1 );
|
||||
bSizerBottom->Add( m_hiearchicalPathLabel, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 10 );
|
||||
|
||||
m_heirarchyPath = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxBORDER_NONE );
|
||||
m_heirarchyPath->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
|
||||
|
||||
bSizerBottom->Add( m_heirarchyPath, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
m_hierarchicalPathLabel = new wxStaticText( this, wxID_ANY, _("Hierarchical path:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_hierarchicalPathLabel->Wrap( -1 );
|
||||
bSizerBottom->Add( m_hierarchicalPathLabel, 1, wxLEFT|wxALIGN_CENTER_VERTICAL, 10 );
|
||||
|
||||
m_stdDialogButtonSizer = new wxStdDialogButtonSizer();
|
||||
m_stdDialogButtonSizerOK = new wxButton( this, wxID_OK );
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
<property name="file">dialog_sheet_properties_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_sheet_properties_base</property>
|
||||
|
@ -26,7 +25,6 @@
|
|||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
|
@ -194,7 +192,6 @@
|
|||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
|
@ -268,7 +265,6 @@
|
|||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
|
@ -342,7 +338,6 @@
|
|||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
|
@ -426,7 +421,6 @@
|
|||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
|
@ -1196,7 +1190,7 @@
|
|||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxLEFT|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
|
@ -1234,7 +1228,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_hiearchicalPathLabel</property>
|
||||
<property name="name">m_hierarchicalPathLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
@ -1254,70 +1248,6 @@
|
|||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxTextCtrl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg">wxSYS_COLOUR_BTNFACE</property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_heirarchyPath</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxTE_READONLY</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxBORDER_NONE</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.9.0 Jun 18 2020)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -59,8 +59,7 @@ class DIALOG_SHEET_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
wxStaticText* m_pageNumberStaticText;
|
||||
wxTextCtrl* m_pageNumberTextCtrl;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxStaticText* m_hiearchicalPathLabel;
|
||||
wxTextCtrl* m_heirarchyPath;
|
||||
wxStaticText* m_hierarchicalPathLabel;
|
||||
wxStdDialogButtonSizer* m_stdDialogButtonSizer;
|
||||
wxButton* m_stdDialogButtonSizerOK;
|
||||
wxButton* m_stdDialogButtonSizerCancel;
|
||||
|
|
|
@ -708,19 +708,16 @@ int SCH_SHEET::CountSheets() const
|
|||
void SCH_SHEET::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
|
||||
{
|
||||
aList.emplace_back( _( "Sheet Name" ), m_fields[ SHEETNAME ].GetText(), CYAN );
|
||||
aList.emplace_back( _( "File Name" ), m_fields[ SHEETFILENAME ].GetText(), BROWN );
|
||||
|
||||
#if 1 // Set to 1 to display the sheet UUID and hierarchical path
|
||||
|
||||
if( auto schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
|
||||
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
|
||||
{
|
||||
wxString msgU, msgL;
|
||||
msgU << _( "UUID" ) << ": " << m_Uuid.AsString();
|
||||
msgL << _( "Path" ) << ": " << schframe->GetCurrentSheet().PathHumanReadable();
|
||||
SCH_SHEET_PATH path = schframe->GetCurrentSheet();
|
||||
path.push_back( this );
|
||||
|
||||
aList.push_back( MSG_PANEL_ITEM( msgU, msgL, BLUE ) );
|
||||
aList.emplace_back( _( "Hierarchical Path" ), path.PathHumanReadable( false ), BLUE );
|
||||
}
|
||||
#endif
|
||||
|
||||
aList.emplace_back( _( "File Name" ), m_fields[ SHEETFILENAME ].GetText(), BROWN );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -234,16 +234,16 @@ wxString SCH_SHEET_PATH::GetRootPathName( bool aUseShortName )
|
|||
}
|
||||
|
||||
|
||||
wxString SCH_SHEET_PATH::PathHumanReadable() const
|
||||
wxString SCH_SHEET_PATH::PathHumanReadable( bool aUseShortRootName ) const
|
||||
{
|
||||
wxString s;
|
||||
|
||||
if( size() == 1 )
|
||||
return GetRootPathName( true ); // Use only the short name in netlists
|
||||
if( aUseShortRootName )
|
||||
s = GetRootPathName( true ); // Use only the short name in netlists
|
||||
else
|
||||
s = GetRootPathName( false ) + wxT( "/" );
|
||||
|
||||
s = wxT( "/" );
|
||||
|
||||
// Start at 1 to avoid the root sheet, as above.
|
||||
// Start at 1 since we've already processed the root sheet.
|
||||
for( unsigned i = 1; i < size(); i++ )
|
||||
s = s + at( i )->GetFields()[ SHEETNAME ].GetShownText() + wxT( "/" );
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ public:
|
|||
* The the "normal" path instead uses the #KIID objects in the path that do not change
|
||||
* even when editing sheet parameters.
|
||||
*/
|
||||
wxString PathHumanReadable() const;
|
||||
wxString PathHumanReadable( bool aUseShortRootName = true ) const;
|
||||
|
||||
/**
|
||||
* @return a path name for the root sheet (like "/" or "<root>"
|
||||
|
|
Loading…
Reference in New Issue