Layout adjustments and language-change-updating for modview.

This commit is contained in:
Jeff Young 2018-08-04 12:59:04 +01:00
parent fb28d45886
commit fd3e57d67f
7 changed files with 85 additions and 29 deletions

View File

@ -177,8 +177,8 @@ void LIB_TREE_MODEL_ADAPTER::AttachTo( wxDataViewCtrl* aDataViewCtrl )
aDataViewCtrl->AssociateModel( this );
aDataViewCtrl->ClearColumns();
wxString part_head = _( "Symbol" );
wxString desc_head = _( "Desc" );
wxString part_head = _( "Item" );
wxString desc_head = _( "Description" );
m_col_part = aDataViewCtrl->AppendTextColumn( part_head, 0, wxDATAVIEW_CELL_INERT,
ColWidth( m_tree, 0, part_head ) );

View File

@ -59,10 +59,10 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, LIB_TABLE* aLibTable, LIB_TREE_MODEL_ADAP
// Additional visual cue for GTK, which hides the placeholder text on focus
#ifdef __WXGTK__
auto bitmap = new wxStaticBitmap( this, wxID_ANY, wxArtProvider::GetBitmap( wxART_FIND, wxART_FRAME_ICON ) );
search_sizer->Add( bitmap, 0, wxALIGN_CENTER | wxALL, 5 );
search_sizer->Add( bitmap, 0, wxALIGN_CENTER | wxRIGHT, 5 );
#endif
search_sizer->Add( m_query_ctrl, 1, wxLEFT | wxTOP | wxEXPAND, 5 );
search_sizer->Add( m_query_ctrl, 1, wxEXPAND, 5 );
sizer->Add( search_sizer, 0, wxEXPAND, 5 );
m_query_ctrl->Bind( wxEVT_TEXT, &LIB_TREE::onQueryText, this );
@ -70,12 +70,12 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, LIB_TABLE* aLibTable, LIB_TREE_MODEL_ADAP
m_query_ctrl->Bind( wxEVT_CHAR_HOOK, &LIB_TREE::onQueryCharHook, this );
}
// Component tree
// Tree control
m_tree_ctrl = new wxDataViewCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxDV_SINGLE );
wxDV_SINGLE | wxDV_NO_HEADER );
m_adapter->AttachTo( m_tree_ctrl );
sizer->Add( m_tree_ctrl, 5, wxLEFT | wxTOP | wxEXPAND, 5 );
sizer->Add( m_tree_ctrl, 5, wxEXPAND | wxRIGHT | wxBOTTOM, 1 );
// Description panel
if( aWidgets & DETAILS )
@ -110,7 +110,7 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, LIB_TABLE* aLibTable, LIB_TREE_MODEL_ADAP
// handler will intermittently fire.
if( m_query_ctrl )
{
m_query_ctrl->SetHint( _( "Search" ) );
m_query_ctrl->SetHint( _( "Filter" ) );
m_query_ctrl->SetFocus();
m_query_ctrl->SetValue( wxEmptyString );
}

View File

@ -301,8 +301,9 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg ).Name( "MsgPanel" ).Bottom().Layer( 10 ) );
m_auimgr.AddPane( m_treePane, wxAuiPaneInfo().Name( "ComponentTree" ).Left().Row( 1 )
.Resizable().MinSize( 250, 400 ).Dock().CloseButton( false ) );
m_auimgr.AddPane( m_treePane,
wxAuiPaneInfo().Name( "ComponentTree" ).Caption( _( "Libraries" ) ).Left()
.Row( 1 ).Resizable().MinSize( 250, 400 ).Dock().CloseButton( false ) );
m_auimgr.Update();

View File

@ -325,8 +325,9 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_auimgr.AddPane( m_messagePanel,
wxAuiPaneInfo( mesg_pane ).Name( "MsgPanel" ).Bottom().Layer(10) );
m_auimgr.AddPane( m_treePane, wxAuiPaneInfo().Name( "FootprintTree" ).Left().Row( 1 )
.Resizable().MinSize( 250, 400 ).Dock().CloseButton( false ) );
m_auimgr.AddPane( m_treePane,
wxAuiPaneInfo().Name( "FootprintTree" ).Caption( _( "Libraries" ) ).Left()
.Row( 1 ).Resizable().MinSize( 250, 400 ).Dock().CloseButton( false ) );
// Create the manager and dispatcher & route draw panel events to the dispatcher
setupTools();
@ -673,6 +674,53 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard( wxUpdateUIEvent& aEvent
}
void FOOTPRINT_EDIT_FRAME::ReFillLayerWidget()
{
m_Layers->ReFill();
wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_Layers );
wxSize bestz = m_Layers->GetBestSize();
lyrs.MinSize( bestz );
lyrs.BestSize( bestz );
lyrs.FloatingSize( bestz );
if( lyrs.IsDocked() )
m_auimgr.Update();
else
m_Layers->SetSize( bestz );
}
void FOOTPRINT_EDIT_FRAME::ShowChangedLanguage()
{
// call my base class
PCB_BASE_EDIT_FRAME::ShowChangedLanguage();
// update the layer manager
m_Layers->Freeze();
wxAuiPaneInfo& pane_info = m_auimgr.GetPane( m_Layers );
pane_info.Caption( _( "Visibles" ) );
pane_info = m_auimgr.GetPane( m_treePane );
pane_info.Caption( _( "Footprint Libraries" ) );
m_auimgr.Update();
m_Layers->SetLayersManagerTabsText();
ReFillLayerWidget();
m_Layers->ReFillRender();
// upate the layer widget to match board visibility states.
m_Layers->SyncLayerVisibilities();
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( m_Pcb );
m_Layers->SelectLayer( GetActiveLayer() );
m_Layers->OnLayerSelected();
m_Layers->Thaw();
}
void FOOTPRINT_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event )
{
bool forceRecreateIfNotOwner = true;
@ -725,7 +773,7 @@ void FOOTPRINT_EDIT_FRAME::OnModify()
void FOOTPRINT_EDIT_FRAME::updateTitle()
{
wxString title = _( "Footprint Editor" );
wxString title = _( "Footprint Library Editor" );
LIB_ID fpid = GetCurrentLibId();
bool writable = true;

View File

@ -468,6 +468,13 @@ public:
*/
void InstallPreferences( PAGED_DIALOG* aParent ) override;
void ReFillLayerWidget();
/**
* Update visible items after a language change.
*/
void ShowChangedLanguage() override;
/**
* Called after the preferences dialog is run.
*/

View File

@ -462,7 +462,7 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, wxWindowID
m_PointSize = pointSize;
wxBoxSizer* boxSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* mainSizer = new wxBoxSizer( wxVERTICAL );
m_notebook = new wxAuiNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP );
@ -477,8 +477,8 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, wxWindowID
m_LayerPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* layerPanelSizer;
layerPanelSizer = new wxBoxSizer( wxVERTICAL );
m_LayerScrolledWindow = new wxScrolledWindow( m_LayerPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER );
m_LayerScrolledWindow->SetScrollRate( 5, 5 );
@ -489,16 +489,16 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, wxWindowID
m_LayerScrolledWindow->SetSizer( m_LayersFlexGridSizer );
m_LayerScrolledWindow->Layout();
m_LayersFlexGridSizer->Fit( m_LayerScrolledWindow );
bSizer3->Add( m_LayerScrolledWindow, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 2 );
layerPanelSizer->Add( m_LayerScrolledWindow, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 2 );
m_LayerPanel->SetSizer( bSizer3 );
m_LayerPanel->SetSizer( layerPanelSizer );
m_LayerPanel->Layout();
bSizer3->Fit( m_LayerPanel );
layerPanelSizer->Fit( m_LayerPanel );
m_notebook->AddPage( m_LayerPanel, _( "Layers" ), true );
m_RenderingPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* renderPanelSizer;
renderPanelSizer = new wxBoxSizer( wxVERTICAL );
m_RenderScrolledWindow = new wxScrolledWindow( m_RenderingPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER );
m_RenderScrolledWindow->SetScrollRate( 5, 5 );
@ -509,16 +509,16 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, wxWindowID
m_RenderScrolledWindow->SetSizer( m_RenderFlexGridSizer );
m_RenderScrolledWindow->Layout();
m_RenderFlexGridSizer->Fit( m_RenderScrolledWindow );
bSizer4->Add( m_RenderScrolledWindow, 1, wxALL|wxEXPAND, 5 );
renderPanelSizer->Add( m_RenderScrolledWindow, 1, wxALL|wxEXPAND, 5 );
m_RenderingPanel->SetSizer( bSizer4 );
m_RenderingPanel->SetSizer( renderPanelSizer );
m_RenderingPanel->Layout();
bSizer4->Fit( m_RenderingPanel );
renderPanelSizer->Fit( m_RenderingPanel );
m_notebook->AddPage( m_RenderingPanel, _( "Items" ), false );
boxSizer->Add( m_notebook, 1, wxEXPAND | wxALL, 5 );
mainSizer->Add( m_notebook, 1, wxEXPAND, 5 );
SetSizer( boxSizer );
SetSizer( mainSizer );
m_FocusOwner = aFocusOwner;

View File

@ -992,7 +992,7 @@ void PCB_EDIT_FRAME::SetVisibleAlls()
void PCB_EDIT_FRAME::ShowChangedLanguage()
{
// call my base class
PCB_BASE_FRAME::ShowChangedLanguage();
PCB_BASE_EDIT_FRAME::ShowChangedLanguage();
// update the layer manager
m_Layers->Freeze();
@ -1003,7 +1003,7 @@ void PCB_EDIT_FRAME::ShowChangedLanguage()
m_Layers->SetLayersManagerTabsText();
ReFillLayerWidget();
m_Layers->ReFillRender();
// m_Layers->ReFillRender(); // syncRenderStates() does this
// upate the layer widget to match board visibility states, both layers and render columns.
syncLayerVisibilities();
@ -1092,7 +1092,7 @@ void PCB_EDIT_FRAME::UpdateUserInterface()
// Update the layer manager
m_Layers->Freeze();
ReFillLayerWidget();
m_Layers->ReFillRender();
// m_Layers->ReFillRender(); // syncRenderStates() does this
// upate the layer widget to match board visibility states, both layers and render columns.
syncLayerVisibilities();