Ellipsize long heirarchical paths.
Fixes https://gitlab.com/kicad/code/kicad/issues/11499
This commit is contained in:
parent
d01e0bbec6
commit
6d44ca2145
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2014-2021 KiCad Developers, see CHANGELOG.txt for contributors.
|
||||
* Copyright (C) 2014-2022 KiCad Developers, see CHANGELOG.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
|
||||
|
@ -40,6 +40,7 @@
|
|||
#include <settings/color_settings.h>
|
||||
#include <trace_helpers.h>
|
||||
#include "panel_eeschema_color_settings.h"
|
||||
#include "wx/dcclient.h"
|
||||
|
||||
DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_SHEET* aSheet,
|
||||
bool* aClearAnnotationNewItems ) :
|
||||
|
@ -86,6 +87,7 @@ DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S
|
|||
|
||||
// Set font sizes
|
||||
m_hierarchicalPathLabel->SetFont( KIUI::GetInfoFont( this ) );
|
||||
m_hierarchicalPath->SetFont( KIUI::GetInfoFont( this ) );
|
||||
|
||||
// wxFormBuilder doesn't include this event...
|
||||
m_grid->Connect( wxEVT_GRID_CELL_CHANGING,
|
||||
|
@ -852,12 +854,10 @@ void DIALOG_SHEET_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
}
|
||||
|
||||
// Propagate changes in sheetname to displayed hierarchical path
|
||||
wxString hierarchicalPath = _( "Hierarchical path: " );
|
||||
wxString path = m_frame->GetCurrentSheet().PathHumanReadable( false );
|
||||
|
||||
hierarchicalPath += m_frame->GetCurrentSheet().PathHumanReadable( false );
|
||||
|
||||
if( hierarchicalPath.Last() != '/' )
|
||||
hierarchicalPath.Append( '/' );
|
||||
if( path.Last() != '/' )
|
||||
path.Append( '/' );
|
||||
|
||||
wxGridCellEditor* editor = m_grid->GetCellEditor( SHEETNAME, FDC_VALUE );
|
||||
wxControl* control = editor->GetControl();
|
||||
|
@ -871,12 +871,19 @@ void DIALOG_SHEET_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
|
||||
m_dummySheet.SetFields( *m_fields );
|
||||
m_dummySheetNameField.SetText( sheetName );
|
||||
hierarchicalPath += m_dummySheetNameField.GetShownText();
|
||||
path += m_dummySheetNameField.GetShownText();
|
||||
|
||||
editor->DecRef();
|
||||
|
||||
if( m_hierarchicalPathLabel->GetLabel() != hierarchicalPath )
|
||||
m_hierarchicalPathLabel->SetLabel( hierarchicalPath );
|
||||
wxClientDC dc( m_hierarchicalPathLabel );
|
||||
int width = m_sizerBottom->GetSize().x - m_stdDialogButtonSizer->GetSize().x
|
||||
- m_hierarchicalPathLabel->GetSize().x
|
||||
- 30;
|
||||
|
||||
path = wxControl::Ellipsize( path, dc, wxELLIPSIZE_START, width, wxELLIPSIZE_FLAGS_NONE );
|
||||
|
||||
if( m_hierarchicalPath->GetLabel() != path )
|
||||
m_hierarchicalPath->SetLabel( path );
|
||||
|
||||
// Handle a delayed focus
|
||||
if( m_delayedFocusRow >= 0 )
|
||||
|
|
|
@ -186,12 +186,15 @@ DIALOG_SHEET_PROPERTIES_BASE::DIALOG_SHEET_PROPERTIES_BASE( wxWindow* parent, wx
|
|||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
mainSizer->Add( m_staticline1, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
wxBoxSizer* bSizerBottom;
|
||||
bSizerBottom = new wxBoxSizer( wxHORIZONTAL );
|
||||
m_sizerBottom = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
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_sizerBottom->Add( m_hierarchicalPathLabel, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 10 );
|
||||
|
||||
m_hierarchicalPath = new wxStaticText( this, wxID_ANY, _("path"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_hierarchicalPath->Wrap( -1 );
|
||||
m_sizerBottom->Add( m_hierarchicalPath, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_stdDialogButtonSizer = new wxStdDialogButtonSizer();
|
||||
m_stdDialogButtonSizerOK = new wxButton( this, wxID_OK );
|
||||
|
@ -200,10 +203,10 @@ DIALOG_SHEET_PROPERTIES_BASE::DIALOG_SHEET_PROPERTIES_BASE( wxWindow* parent, wx
|
|||
m_stdDialogButtonSizer->AddButton( m_stdDialogButtonSizerCancel );
|
||||
m_stdDialogButtonSizer->Realize();
|
||||
|
||||
bSizerBottom->Add( m_stdDialogButtonSizer, 0, wxEXPAND, 5 );
|
||||
m_sizerBottom->Add( m_stdDialogButtonSizer, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
mainSizer->Add( bSizerBottom, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
|
||||
mainSizer->Add( m_sizerBottom, 0, wxEXPAND|wxLEFT, 5 );
|
||||
|
||||
|
||||
this->SetSizer( mainSizer );
|
||||
|
|
|
@ -1240,17 +1240,17 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND|wxTOP</property>
|
||||
<property name="flag">wxEXPAND|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerBottom</property>
|
||||
<property name="name">m_sizerBottom</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="permission">protected</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxLEFT|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">1</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
|
@ -1308,9 +1308,70 @@
|
|||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStaticText" 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"></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="label">path</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></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_hierarchicalPath</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"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="0">
|
||||
<property name="Apply">0</property>
|
||||
|
|
|
@ -62,7 +62,9 @@ class DIALOG_SHEET_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
wxStaticText* m_pageNumberStaticText;
|
||||
wxTextCtrl* m_pageNumberTextCtrl;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxBoxSizer* m_sizerBottom;
|
||||
wxStaticText* m_hierarchicalPathLabel;
|
||||
wxStaticText* m_hierarchicalPath;
|
||||
wxStdDialogButtonSizer* m_stdDialogButtonSizer;
|
||||
wxButton* m_stdDialogButtonSizerOK;
|
||||
wxButton* m_stdDialogButtonSizerCancel;
|
||||
|
|
Loading…
Reference in New Issue