Fix library table dialog tab appearance in dark mode.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6236
This commit is contained in:
Wayne Stambaugh 2020-11-01 08:30:27 -05:00
parent 9659eef71d
commit cf59468de2
10 changed files with 82 additions and 73 deletions

View File

@ -287,6 +287,9 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
setupGrid( m_global_grid ); setupGrid( m_global_grid );
m_notebook->SetPageText( 0, _( "Global Libraries" ) );
m_notebook->SetPageText( 1, _( "Project Specific Libraries" ) );
if( aProject ) if( aProject )
{ {
m_PrjTableFilename->SetLabel( aProjectTablePath ); m_PrjTableFilename->SetLabel( aProjectTablePath );
@ -296,7 +299,7 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
else else
{ {
m_pageNdx = 0; m_pageNdx = 0;
m_auinotebook->DeletePage( 1 ); m_notebook->DeletePage( 1 );
m_project_grid = nullptr; m_project_grid = nullptr;
} }
@ -306,7 +309,7 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
populateEnvironReadOnlyTable(); populateEnvironReadOnlyTable();
// select the last selected page // select the last selected page
m_auinotebook->SetSelection( m_pageNdx ); m_notebook->SetSelection( m_pageNdx );
m_cur_grid = ( m_pageNdx == 0 ) ? m_global_grid : m_project_grid; m_cur_grid = ( m_pageNdx == 0 ) ? m_global_grid : m_project_grid;
m_path_subs_grid->SetColLabelValue( 0, _( "Name" ) ); m_path_subs_grid->SetColLabelValue( 0, _( "Name" ) );
@ -371,7 +374,7 @@ bool PANEL_SYM_LIB_TABLE::verifyTables()
// show the tabbed panel holding the grid we have flunked: // show the tabbed panel holding the grid we have flunked:
if( model != cur_model() ) if( model != cur_model() )
m_auinotebook->SetSelection( model == global_model() ? 0 : 1 ); m_notebook->SetSelection( model == global_model() ? 0 : 1 );
m_cur_grid->MakeCellVisible( r, 0 ); m_cur_grid->MakeCellVisible( r, 0 );
m_cur_grid->SetGridCursor( r, 1 ); m_cur_grid->SetGridCursor( r, 1 );
@ -410,7 +413,7 @@ bool PANEL_SYM_LIB_TABLE::verifyTables()
// show the tabbed panel holding the grid we have flunked: // show the tabbed panel holding the grid we have flunked:
if( model != cur_model() ) if( model != cur_model() )
m_auinotebook->SetSelection( model == global_model() ? 0 : 1 ); m_notebook->SetSelection( model == global_model() ? 0 : 1 );
// go to the lower of the two rows, it is technically the duplicate: // go to the lower of the two rows, it is technically the duplicate:
m_cur_grid->MakeCellVisible( r2, 0 ); m_cur_grid->MakeCellVisible( r2, 0 );
@ -465,9 +468,9 @@ bool PANEL_SYM_LIB_TABLE::verifyTables()
} }
void PANEL_SYM_LIB_TABLE::pageChangedHandler( wxAuiNotebookEvent& event ) void PANEL_SYM_LIB_TABLE::pageChangedHandler( wxNotebookEvent& event )
{ {
m_pageNdx = (unsigned) std::max( 0, m_auinotebook->GetSelection() ); m_pageNdx = (unsigned) std::max( 0, m_notebook->GetSelection() );
m_cur_grid = m_pageNdx == 0 ? m_global_grid : m_project_grid; m_cur_grid = m_pageNdx == 0 ? m_global_grid : m_project_grid;
} }
@ -479,7 +482,8 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
+ "|" + LegacySymbolLibFileWildcard(); + "|" + LegacySymbolLibFileWildcard();
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>(); EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
wxFileDialog dlg( this, _( "Select Library" ), cfg->m_lastSymbolLibDir, wxEmptyString, wildcards, wxFileDialog dlg( this, _( "Select Library" ),
cfg->m_lastSymbolLibDir, wxEmptyString, wildcards,
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE ); wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE );
auto result = dlg.ShowModal(); auto result = dlg.ShowModal();
@ -511,7 +515,8 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
if( !applyToAll ) if( !applyToAll )
{ {
// The cancel button adds the library to the table anyway // The cancel button adds the library to the table anyway
addDuplicates = ( OKOrCancelDialog( this, warning, wxString::Format( msg, nickname ), addDuplicates = ( OKOrCancelDialog( this, warning,
wxString::Format( msg, nickname ),
detailedMsg, _( "Skip" ), _( "Add Anyway" ), &applyToAll ) == wxID_CANCEL ); detailedMsg, _( "Skip" ), _( "Add Anyway" ), &applyToAll ) == wxID_CANCEL );
} }

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2017 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@ -49,7 +49,7 @@ private:
*/ */
bool verifyTables(); bool verifyTables();
void pageChangedHandler( wxAuiNotebookEvent& event ) override; void pageChangedHandler( wxNotebookEvent& event ) override;
void browseLibrariesHandler( wxCommandEvent& event ) override; void browseLibrariesHandler( wxCommandEvent& event ) override;
void appendRowHandler( wxCommandEvent& event ) override; void appendRowHandler( wxCommandEvent& event ) override;
void deleteRowHandler( wxCommandEvent& event ) override; void deleteRowHandler( wxCommandEvent& event ) override;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018) // C++ code generated with wxFormBuilder (version 3.9.0 Jun 18 2020)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -19,10 +19,8 @@ PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
wxStaticBoxSizer* m_top_sizer; wxStaticBoxSizer* m_top_sizer;
m_top_sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Libraries by Scope") ), wxVERTICAL ); m_top_sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Libraries by Scope") ), wxVERTICAL );
m_auinotebook = new wxAuiNotebook( m_top_sizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); m_notebook = new wxNotebook( m_top_sizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_auinotebook->SetMinSize( wxSize( 720,460 ) ); m_global_panel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_global_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_global_sizer; wxBoxSizer* m_global_sizer;
m_global_sizer = new wxBoxSizer( wxVERTICAL ); m_global_sizer = new wxBoxSizer( wxVERTICAL );
@ -74,8 +72,8 @@ PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
m_global_panel->SetSizer( m_global_sizer ); m_global_panel->SetSizer( m_global_sizer );
m_global_panel->Layout(); m_global_panel->Layout();
m_global_sizer->Fit( m_global_panel ); m_global_sizer->Fit( m_global_panel );
m_auinotebook->AddPage( m_global_panel, _("Global Libraries"), false, wxNullBitmap ); m_notebook->AddPage( m_global_panel, _("a page"), false );
m_project_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_project_panel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_project_sizer; wxBoxSizer* m_project_sizer;
m_project_sizer = new wxBoxSizer( wxVERTICAL ); m_project_sizer = new wxBoxSizer( wxVERTICAL );
@ -126,9 +124,9 @@ PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
m_project_panel->SetSizer( m_project_sizer ); m_project_panel->SetSizer( m_project_sizer );
m_project_panel->Layout(); m_project_panel->Layout();
m_project_sizer->Fit( m_project_panel ); m_project_sizer->Fit( m_project_panel );
m_auinotebook->AddPage( m_project_panel, _("Project Specific Libraries"), true, wxNullBitmap ); m_notebook->AddPage( m_project_panel, _("a page"), true );
m_top_sizer->Add( m_auinotebook, 1, wxEXPAND | wxALL, 5 ); m_top_sizer->Add( m_notebook, 1, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizer51; wxBoxSizer* bSizer51;
bSizer51 = new wxBoxSizer( wxHORIZONTAL ); bSizer51 = new wxBoxSizer( wxHORIZONTAL );
@ -210,7 +208,7 @@ PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
bSizer1->Fit( this ); bSizer1->Fit( this );
// Connect Events // Connect Events
m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( PANEL_SYM_LIB_TABLE_BASE::pageChangedHandler ), NULL, this ); m_notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PANEL_SYM_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_append_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::appendRowHandler ), NULL, this ); m_append_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_browse_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::browseLibrariesHandler ), NULL, this ); m_browse_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::browseLibrariesHandler ), NULL, this );
m_move_up_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::moveUpHandler ), NULL, this ); m_move_up_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
@ -222,7 +220,7 @@ PANEL_SYM_LIB_TABLE_BASE::PANEL_SYM_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
PANEL_SYM_LIB_TABLE_BASE::~PANEL_SYM_LIB_TABLE_BASE() PANEL_SYM_LIB_TABLE_BASE::~PANEL_SYM_LIB_TABLE_BASE()
{ {
// Disconnect Events // Disconnect Events
m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( PANEL_SYM_LIB_TABLE_BASE::pageChangedHandler ), NULL, this ); m_notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PANEL_SYM_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_append_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::appendRowHandler ), NULL, this ); m_append_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_browse_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::browseLibrariesHandler ), NULL, this ); m_browse_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::browseLibrariesHandler ), NULL, this );
m_move_up_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::moveUpHandler ), NULL, this ); m_move_up_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SYM_LIB_TABLE_BASE::moveUpHandler ), NULL, this );

View File

@ -14,6 +14,7 @@
<property name="file">panel_sym_lib_table_base</property> <property name="file">panel_sym_lib_table_base</property>
<property name="first_id">1000</property> <property name="first_id">1000</property>
<property name="help_provider">none</property> <property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property> <property name="indent_with_spaces"></property>
<property name="internationalize">1</property> <property name="internationalize">1</property>
<property name="name">sym_lib_table</property> <property name="name">sym_lib_table</property>
@ -25,6 +26,7 @@
<property name="skip_php_events">1</property> <property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="ui_table">UI</property> <property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property> <property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1"> <object class="Panel" expanded="1">
@ -70,7 +72,7 @@
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property> <property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxAuiNotebook" expanded="1"> <object class="wxNotebook" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -81,12 +83,13 @@
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmapsize"></property>
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">0</property> <property name="context_menu">1</property>
<property name="default_pane">0</property> <property name="default_pane">0</property>
<property name="dock">Dock</property> <property name="dock">Dock</property>
<property name="dock_fixed">0</property> <property name="dock_fixed">0</property>
@ -103,9 +106,9 @@
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property> <property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size">720,460</property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_auinotebook</property> <property name="name">m_notebook</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
@ -116,18 +119,16 @@
<property name="show">1</property> <property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass">; ; forward_declare</property>
<property name="tab_ctrl_height">-1</property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="uniform_bitmap_size"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnAuiNotebookPageChanged">pageChangedHandler</event> <event name="OnNotebookPageChanged">pageChangedHandler</event>
<object class="auinotebookpage" expanded="1"> <object class="notebookpage" expanded="1">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="label">Global Libraries</property> <property name="label">a page</property>
<property name="select">0</property> <property name="select">0</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -416,9 +417,9 @@
</object> </object>
</object> </object>
</object> </object>
<object class="auinotebookpage" expanded="1"> <object class="notebookpage" expanded="1">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="label">Project Specific Libraries</property> <property name="label">a page</property>
<property name="select">1</property> <property name="select">1</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -731,6 +732,7 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></property>
@ -804,6 +806,7 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></property>
@ -877,6 +880,7 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></property>
@ -950,6 +954,7 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></property>
@ -1033,6 +1038,7 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></property>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018) // C++ code generated with wxFormBuilder (version 3.9.0 Jun 18 2020)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -24,7 +24,7 @@ class WX_GRID;
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/image.h> #include <wx/image.h>
#include <wx/icon.h> #include <wx/icon.h>
#include <wx/aui/auibook.h> #include <wx/notebook.h>
#include <wx/bmpbuttn.h> #include <wx/bmpbuttn.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/statbox.h> #include <wx/statbox.h>
@ -40,7 +40,7 @@ class PANEL_SYM_LIB_TABLE_BASE : public wxPanel
private: private:
protected: protected:
wxAuiNotebook* m_auinotebook; wxNotebook* m_notebook;
wxPanel* m_global_panel; wxPanel* m_global_panel;
wxStaticText* m_staticText3; wxStaticText* m_staticText3;
wxStaticText* m_GblTableFilename; wxStaticText* m_GblTableFilename;
@ -57,7 +57,7 @@ class PANEL_SYM_LIB_TABLE_BASE : public wxPanel
WX_GRID* m_path_subs_grid; WX_GRID* m_path_subs_grid;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void pageChangedHandler( wxAuiNotebookEvent& event ) { event.Skip(); } virtual void pageChangedHandler( wxNotebookEvent& event ) { event.Skip(); }
virtual void appendRowHandler( wxCommandEvent& event ) { event.Skip(); } virtual void appendRowHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void browseLibrariesHandler( wxCommandEvent& event ) { event.Skip(); } virtual void browseLibrariesHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveUpHandler( wxCommandEvent& event ) { event.Skip(); } virtual void moveUpHandler( wxCommandEvent& event ) { event.Skip(); }

View File

@ -436,6 +436,9 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
populateEnvironReadOnlyTable(); populateEnvironReadOnlyTable();
m_notebook->SetPageText( 0, _( "Global Libraries" ) );
m_notebook->SetPageText( 1, _( "Project Specific Libraries" ) );
if( aProject ) if( aProject )
{ {
m_PrjTableFilename->SetLabel( aProjectTblPath ); m_PrjTableFilename->SetLabel( aProjectTblPath );
@ -445,7 +448,7 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
else else
{ {
m_pageNdx = 0; m_pageNdx = 0;
m_auinotebook->DeletePage( 1 ); m_notebook->DeletePage( 1 );
m_project_grid = nullptr; m_project_grid = nullptr;
} }
@ -453,7 +456,7 @@ PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent,
m_path_subs_grid->SetColLabelValue( 1, _( "Value" ) ); m_path_subs_grid->SetColLabelValue( 1, _( "Value" ) );
// select the last selected page // select the last selected page
m_auinotebook->SetSelection( m_pageNdx ); m_notebook->SetSelection( m_pageNdx );
m_cur_grid = ( m_pageNdx == 0 ) ? m_global_grid : m_project_grid; m_cur_grid = ( m_pageNdx == 0 ) ? m_global_grid : m_project_grid;
// for ALT+A handling, we want the initial focus to be on the first selected grid. // for ALT+A handling, we want the initial focus to be on the first selected grid.
@ -540,7 +543,7 @@ bool PANEL_FP_LIB_TABLE::verifyTables()
// show the tabbed panel holding the grid we have flunked: // show the tabbed panel holding the grid we have flunked:
if( model != cur_model() ) if( model != cur_model() )
m_auinotebook->SetSelection( model == global_model() ? 0 : 1 ); m_notebook->SetSelection( model == global_model() ? 0 : 1 );
m_cur_grid->MakeCellVisible( r, 0 ); m_cur_grid->MakeCellVisible( r, 0 );
m_cur_grid->SetGridCursor( r, 1 ); m_cur_grid->SetGridCursor( r, 1 );
@ -579,7 +582,7 @@ bool PANEL_FP_LIB_TABLE::verifyTables()
// show the tabbed panel holding the grid we have flunked: // show the tabbed panel holding the grid we have flunked:
if( model != cur_model() ) if( model != cur_model() )
m_auinotebook->SetSelection( model == global_model() ? 0 : 1 ); m_notebook->SetSelection( model == global_model() ? 0 : 1 );
// go to the lower of the two rows, it is technically the duplicate: // go to the lower of the two rows, it is technically the duplicate:
m_cur_grid->MakeCellVisible( r2, 0 ); m_cur_grid->MakeCellVisible( r2, 0 );
@ -599,9 +602,9 @@ bool PANEL_FP_LIB_TABLE::verifyTables()
//-----<event handlers>---------------------------------- //-----<event handlers>----------------------------------
void PANEL_FP_LIB_TABLE::pageChangedHandler( wxAuiNotebookEvent& event ) void PANEL_FP_LIB_TABLE::pageChangedHandler( wxNotebookEvent& event )
{ {
m_pageNdx = (unsigned) std::max( 0, m_auinotebook->GetSelection() ); m_pageNdx = (unsigned) std::max( 0, m_notebook->GetSelection() );
m_cur_grid = m_pageNdx == 0 ? m_global_grid : m_project_grid; m_cur_grid = m_pageNdx == 0 ? m_global_grid : m_project_grid;
} }

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2018-2020 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@ -50,7 +50,7 @@ private:
*/ */
bool verifyTables(); bool verifyTables();
void pageChangedHandler( wxAuiNotebookEvent& event ) override; void pageChangedHandler( wxNotebookEvent& event ) override;
void appendRowHandler( wxCommandEvent& event ) override; void appendRowHandler( wxCommandEvent& event ) override;
void browseLibrariesHandler( wxCommandEvent& event ); void browseLibrariesHandler( wxCommandEvent& event );
void deleteRowHandler( wxCommandEvent& event ) override; void deleteRowHandler( wxCommandEvent& event ) override;

View File

@ -19,10 +19,8 @@ PANEL_FP_LIB_TABLE_BASE::PANEL_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID i
wxStaticBoxSizer* m_top_sizer; wxStaticBoxSizer* m_top_sizer;
m_top_sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Libraries by Scope") ), wxVERTICAL ); m_top_sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Libraries by Scope") ), wxVERTICAL );
m_auinotebook = new wxAuiNotebook( m_top_sizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); m_notebook = new wxNotebook( m_top_sizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_auinotebook->SetMinSize( wxSize( 720,460 ) ); m_global_panel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_global_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_global_sizer; wxBoxSizer* m_global_sizer;
m_global_sizer = new wxBoxSizer( wxVERTICAL ); m_global_sizer = new wxBoxSizer( wxVERTICAL );
@ -73,8 +71,8 @@ PANEL_FP_LIB_TABLE_BASE::PANEL_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID i
m_global_panel->SetSizer( m_global_sizer ); m_global_panel->SetSizer( m_global_sizer );
m_global_panel->Layout(); m_global_panel->Layout();
m_global_sizer->Fit( m_global_panel ); m_global_sizer->Fit( m_global_panel );
m_auinotebook->AddPage( m_global_panel, _("Global Libraries"), true, wxNullBitmap ); m_notebook->AddPage( m_global_panel, _("a page"), false );
m_project_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_project_panel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_project_sizer; wxBoxSizer* m_project_sizer;
m_project_sizer = new wxBoxSizer( wxVERTICAL ); m_project_sizer = new wxBoxSizer( wxVERTICAL );
@ -125,9 +123,9 @@ PANEL_FP_LIB_TABLE_BASE::PANEL_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID i
m_project_panel->SetSizer( m_project_sizer ); m_project_panel->SetSizer( m_project_sizer );
m_project_panel->Layout(); m_project_panel->Layout();
m_project_sizer->Fit( m_project_panel ); m_project_sizer->Fit( m_project_panel );
m_auinotebook->AddPage( m_project_panel, _("Project Specific Libraries"), false, wxNullBitmap ); m_notebook->AddPage( m_project_panel, _("a page"), false );
m_top_sizer->Add( m_auinotebook, 6, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_top_sizer->Add( m_notebook, 1, wxEXPAND | wxALL, 5 );
wxBoxSizer* bButtonsSizer; wxBoxSizer* bButtonsSizer;
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL ); bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
@ -207,7 +205,7 @@ PANEL_FP_LIB_TABLE_BASE::PANEL_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID i
bMainSizer->Fit( this ); bMainSizer->Fit( this );
// Connect Events // Connect Events
m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( PANEL_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this ); m_notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PANEL_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_append_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this ); m_append_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_move_up_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this ); m_move_up_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this ); m_move_down_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
@ -218,7 +216,7 @@ PANEL_FP_LIB_TABLE_BASE::PANEL_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID i
PANEL_FP_LIB_TABLE_BASE::~PANEL_FP_LIB_TABLE_BASE() PANEL_FP_LIB_TABLE_BASE::~PANEL_FP_LIB_TABLE_BASE()
{ {
// Disconnect Events // Disconnect Events
m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( PANEL_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this ); m_notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( PANEL_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_append_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this ); m_append_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_move_up_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this ); m_move_up_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this ); m_move_down_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );

View File

@ -70,9 +70,9 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">6</property> <property name="proportion">1</property>
<object class="wxAuiNotebook" expanded="1"> <object class="wxNotebook" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -83,12 +83,13 @@
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmapsize"></property>
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">0</property> <property name="context_menu">1</property>
<property name="default_pane">0</property> <property name="default_pane">0</property>
<property name="dock">Dock</property> <property name="dock">Dock</property>
<property name="dock_fixed">0</property> <property name="dock_fixed">0</property>
@ -105,9 +106,9 @@
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property> <property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size">720,460</property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_auinotebook</property> <property name="name">m_notebook</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
<property name="pane_position"></property> <property name="pane_position"></property>
<property name="pane_size"></property> <property name="pane_size"></property>
@ -118,19 +119,17 @@
<property name="show">1</property> <property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass">; ; forward_declare</property>
<property name="tab_ctrl_height">-1</property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="uniform_bitmap_size"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnAuiNotebookPageChanged">pageChangedHandler</event> <event name="OnNotebookPageChanged">pageChangedHandler</event>
<object class="auinotebookpage" expanded="1"> <object class="notebookpage" expanded="1">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="label">Global Libraries</property> <property name="label">a page</property>
<property name="select">1</property> <property name="select">0</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
@ -418,9 +417,9 @@
</object> </object>
</object> </object>
</object> </object>
<object class="auinotebookpage" expanded="1"> <object class="notebookpage" expanded="1">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="label">Project Specific Libraries</property> <property name="label">a page</property>
<property name="select">0</property> <property name="select">0</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>

View File

@ -24,7 +24,7 @@ class WX_GRID;
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/image.h> #include <wx/image.h>
#include <wx/icon.h> #include <wx/icon.h>
#include <wx/aui/auibook.h> #include <wx/notebook.h>
#include <wx/bmpbuttn.h> #include <wx/bmpbuttn.h>
#include <wx/button.h> #include <wx/button.h>
#include <widgets/split_button.h> #include <widgets/split_button.h>
@ -41,7 +41,7 @@ class PANEL_FP_LIB_TABLE_BASE : public wxPanel
private: private:
protected: protected:
wxAuiNotebook* m_auinotebook; wxNotebook* m_notebook;
wxPanel* m_global_panel; wxPanel* m_global_panel;
wxStaticText* m_staticText3; wxStaticText* m_staticText3;
wxStaticText* m_GblTableFilename; wxStaticText* m_GblTableFilename;
@ -58,7 +58,7 @@ class PANEL_FP_LIB_TABLE_BASE : public wxPanel
WX_GRID* m_path_subs_grid; WX_GRID* m_path_subs_grid;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void pageChangedHandler( wxAuiNotebookEvent& event ) { event.Skip(); } virtual void pageChangedHandler( wxNotebookEvent& event ) { event.Skip(); }
virtual void appendRowHandler( wxCommandEvent& event ) { event.Skip(); } virtual void appendRowHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveUpHandler( wxCommandEvent& event ) { event.Skip(); } virtual void moveUpHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveDownHandler( wxCommandEvent& event ) { event.Skip(); } virtual void moveDownHandler( wxCommandEvent& event ) { event.Skip(); }