Unescape strings for display in symbol browser.
Fixes https://gitlab.com/kicad/code/kicad/issues/8694
This commit is contained in:
parent
04764c9224
commit
d7271c9281
|
@ -477,7 +477,7 @@ bool SYMBOL_VIEWER_FRAME::ReCreateLibList()
|
||||||
|
|
||||||
m_libList->Clear();
|
m_libList->Clear();
|
||||||
|
|
||||||
std::vector< wxString > libs = Prj().SchSymbolLibTable()->GetLogicalLibs();
|
std::vector<wxString> libs = Prj().SchSymbolLibTable()->GetLogicalLibs();
|
||||||
|
|
||||||
// Remove not allowed libs from main list, if the allowed lib list is not empty
|
// Remove not allowed libs from main list, if the allowed lib list is not empty
|
||||||
if( m_allowedLibs.GetCount() )
|
if( m_allowedLibs.GetCount() )
|
||||||
|
@ -513,12 +513,12 @@ bool SYMBOL_VIEWER_FRAME::ReCreateLibList()
|
||||||
wxArrayString libNames;
|
wxArrayString libNames;
|
||||||
|
|
||||||
for( const auto& name : libs )
|
for( const auto& name : libs )
|
||||||
libNames.Add( name );
|
libNames.Add( UnescapeString( name ) );
|
||||||
|
|
||||||
m_libList->Append( libNames );
|
m_libList->Append( libNames );
|
||||||
|
|
||||||
// Search for a previous selection:
|
// Search for a previous selection:
|
||||||
int index = m_libList->FindString( m_libraryName );
|
int index = m_libList->FindString( UnescapeString( m_libraryName ) );
|
||||||
|
|
||||||
if( index != wxNOT_FOUND )
|
if( index != wxNOT_FOUND )
|
||||||
{
|
{
|
||||||
|
@ -567,9 +567,14 @@ bool SYMBOL_VIEWER_FRAME::ReCreateSymbolList()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_symbolList->Append( aliasNames );
|
wxArrayString unescapedNames;
|
||||||
|
|
||||||
int index = m_symbolList->FindString( m_entryName );
|
for( const wxString& name : aliasNames )
|
||||||
|
unescapedNames.Add( UnescapeString( name ) );
|
||||||
|
|
||||||
|
m_symbolList->Append( unescapedNames );
|
||||||
|
|
||||||
|
int index = m_symbolList->FindString( UnescapeString( m_entryName ) );
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
if( index == wxNOT_FOUND )
|
if( index == wxNOT_FOUND )
|
||||||
|
@ -601,7 +606,7 @@ void SYMBOL_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event )
|
||||||
|
|
||||||
m_selection_changed = true;
|
m_selection_changed = true;
|
||||||
|
|
||||||
SetSelectedLibrary( m_libList->GetString( ii ) );
|
SetSelectedLibrary( EscapeString( m_libList->GetString( ii ), CTX_LIBID ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -618,7 +623,7 @@ void SYMBOL_VIEWER_FRAME::SetSelectedLibrary( const wxString& aLibraryName )
|
||||||
// Ensure the corresponding line in m_libList is selected
|
// Ensure the corresponding line in m_libList is selected
|
||||||
// (which is not necessary the case if SetSelectedLibrary is called
|
// (which is not necessary the case if SetSelectedLibrary is called
|
||||||
// by another caller than ClickOnLibList.
|
// by another caller than ClickOnLibList.
|
||||||
m_libList->SetStringSelection( m_libraryName, true );
|
m_libList->SetStringSelection( UnescapeString( m_libraryName ), true );
|
||||||
|
|
||||||
// The m_libList has now the focus, in order to be able to use arrow keys
|
// The m_libList has now the focus, in order to be able to use arrow keys
|
||||||
// to navigate inside the list.
|
// to navigate inside the list.
|
||||||
|
@ -637,7 +642,7 @@ void SYMBOL_VIEWER_FRAME::ClickOnCmpList( wxCommandEvent& event )
|
||||||
|
|
||||||
m_selection_changed = true;
|
m_selection_changed = true;
|
||||||
|
|
||||||
SetSelectedSymbol( m_symbolList->GetString( ii ));
|
SetSelectedSymbol( EscapeString( m_symbolList->GetString( ii ), CTX_LIBID ) );
|
||||||
|
|
||||||
// The m_symbolList has now the focus, in order to be able to use arrow keys
|
// The m_symbolList has now the focus, in order to be able to use arrow keys
|
||||||
// to navigate inside the list.
|
// to navigate inside the list.
|
||||||
|
@ -656,7 +661,7 @@ void SYMBOL_VIEWER_FRAME::SetSelectedSymbol( const wxString& aSymbolName )
|
||||||
// Ensure the corresponding line in m_symbolList is selected
|
// Ensure the corresponding line in m_symbolList is selected
|
||||||
// (which is not necessarily the case if SetSelectedSymbol is called
|
// (which is not necessarily the case if SetSelectedSymbol is called
|
||||||
// by another caller than ClickOnCmpList.
|
// by another caller than ClickOnCmpList.
|
||||||
m_symbolList->SetStringSelection( aSymbolName, true );
|
m_symbolList->SetStringSelection( UnescapeString( aSymbolName ), true );
|
||||||
DisplayLibInfos();
|
DisplayLibInfos();
|
||||||
|
|
||||||
if( m_selection_changed )
|
if( m_selection_changed )
|
||||||
|
@ -802,9 +807,14 @@ const BOX2I SYMBOL_VIEWER_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) c
|
||||||
void SYMBOL_VIEWER_FRAME::FinishModal()
|
void SYMBOL_VIEWER_FRAME::FinishModal()
|
||||||
{
|
{
|
||||||
if( m_symbolList->GetSelection() >= 0 )
|
if( m_symbolList->GetSelection() >= 0 )
|
||||||
DismissModal( true, m_libraryName + ':' + m_symbolList->GetStringSelection() );
|
{
|
||||||
|
DismissModal( true, m_libraryName + ':'
|
||||||
|
+ EscapeString( m_symbolList->GetStringSelection(), CTX_LIBID ) );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
DismissModal( false );
|
DismissModal( false );
|
||||||
|
}
|
||||||
|
|
||||||
Close( true );
|
Close( true );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue