mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-15 10:43:15 +02:00
Save notebook page titles rather than index.
(Some notebooks have variable pages from invocation to invocation.)
This commit is contained in:
parent
5dabfaf26e
commit
5a358d99bb
@ -450,7 +450,7 @@ void DIALOG_SHIM::SaveControlState()
|
|||||||
else if( wxScrolledWindow* scrolled = dynamic_cast<wxScrolledWindow*>( win ) )
|
else if( wxScrolledWindow* scrolled = dynamic_cast<wxScrolledWindow*>( win ) )
|
||||||
dlgMap[ key ] = scrolled->GetScrollPos( wxVERTICAL );
|
dlgMap[ key ] = scrolled->GetScrollPos( wxVERTICAL );
|
||||||
else if( wxNotebook* notebook = dynamic_cast<wxNotebook*>( win ) )
|
else if( wxNotebook* notebook = dynamic_cast<wxNotebook*>( win ) )
|
||||||
dlgMap[ key ] = notebook->GetSelection();
|
dlgMap[ key ] = notebook->GetPageText( notebook->GetSelection() );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( wxWindow* child : win->GetChildren() )
|
for( wxWindow* child : win->GetChildren() )
|
||||||
@ -555,8 +555,16 @@ void DIALOG_SHIM::LoadControlState()
|
|||||||
}
|
}
|
||||||
else if( wxNotebook* notebook = dynamic_cast<wxNotebook*>( win ) )
|
else if( wxNotebook* notebook = dynamic_cast<wxNotebook*>( win ) )
|
||||||
{
|
{
|
||||||
if( j.is_number_integer() )
|
if( j.is_string() )
|
||||||
notebook->SetSelection( j.get<int>() );
|
{
|
||||||
|
wxString pageTitle = wxString::FromUTF8( j.get<std::string>().c_str() );
|
||||||
|
|
||||||
|
for( int page = 0; page < (int) notebook->GetPageCount(); ++page )
|
||||||
|
{
|
||||||
|
if( notebook->GetPageText( page ) == pageTitle )
|
||||||
|
notebook->SetSelection( page );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user