Insta-prefs.

This commit is contained in:
Jeff Young 2023-05-10 18:13:52 +01:00
parent 6bf43588bb
commit 9ae8255202
33 changed files with 449 additions and 224 deletions

View File

@ -217,6 +217,7 @@ set( COMMON_WIDGET_SRCS
widgets/wx_panel.cpp widgets/wx_panel.cpp
widgets/wx_progress_reporters.cpp widgets/wx_progress_reporters.cpp
widgets/wx_splitter_window.cpp widgets/wx_splitter_window.cpp
widgets/wx_treebook.cpp
) )
set( COMMON_DRAWING_SHEET_SRCS set( COMMON_DRAWING_SHEET_SRCS

View File

@ -44,9 +44,8 @@
* Ugly as it all is, it does improve our usability on various platforms. * Ugly as it all is, it does improve our usability on various platforms.
*/ */
PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aParent ) PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( wxWindow* aParent )
: PANEL_COMMON_SETTINGS_BASE( aParent ), : PANEL_COMMON_SETTINGS_BASE( aParent ),
m_dialog( aDialog ),
m_iconScaleLabel( nullptr ), m_iconScaleLabel( nullptr ),
m_iconScaleSlider( nullptr ), m_iconScaleSlider( nullptr ),
m_iconScaleAuto( nullptr ), m_iconScaleAuto( nullptr ),

View File

@ -37,8 +37,8 @@
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
PANEL_DATA_COLLECTION::PANEL_DATA_COLLECTION( PAGED_DIALOG* aDialog, wxWindow* aParent ) : PANEL_DATA_COLLECTION::PANEL_DATA_COLLECTION( wxWindow* aParent ) :
PANEL_DATA_COLLECTION_BASE( aParent ), m_dialog( aDialog ) PANEL_DATA_COLLECTION_BASE( aParent )
{ {
} }

View File

@ -26,9 +26,8 @@
#include <wx/defs.h> #include <wx/defs.h>
PANEL_MOUSE_SETTINGS::PANEL_MOUSE_SETTINGS( PAGED_DIALOG* aDialog, wxWindow* aParent ) : PANEL_MOUSE_SETTINGS::PANEL_MOUSE_SETTINGS( wxWindow* aParent ) :
PANEL_MOUSE_SETTINGS_BASE( aParent ), PANEL_MOUSE_SETTINGS_BASE( aParent ),
m_dialog( aDialog ),
m_currentScrollMod( {} ) m_currentScrollMod( {} )
{ {
#ifdef __WXOSX_MAC__ #ifdef __WXOSX_MAC__
@ -82,7 +81,8 @@ bool PANEL_MOUSE_SETTINGS::TransferDataFromWindow()
if( !isScrollModSetValid( m_currentScrollMod ) ) if( !isScrollModSetValid( m_currentScrollMod ) )
{ {
m_dialog->SetError( _( "Only one action can be assigned to each vertical scroll setting" ), PAGED_DIALOG::GetDialog( this )->SetError( _( "Only one action can be assigned to each "
"vertical scroll setting" ),
this, nullptr ); this, nullptr );
return false; return false;
} }

View File

@ -39,7 +39,6 @@
#include <widgets/wx_html_report_box.h> #include <widgets/wx_html_report_box.h>
#include <widgets/wx_panel.h> #include <widgets/wx_panel.h>
#include <widgets/std_bitmap_button.h> #include <widgets/std_bitmap_button.h>
#include <wx/treebook.h>
#include <project/net_settings.h> #include <project/net_settings.h>
@ -70,13 +69,12 @@ std::vector<BITMAPS> g_lineStyleIcons;
wxArrayString g_lineStyleNames; wxArrayString g_lineStyleNames;
PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, EDA_DRAW_FRAME* aFrame, PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( wxWindow* aParentWindow, EDA_DRAW_FRAME* aFrame,
std::shared_ptr<NET_SETTINGS> aNetSettings, std::shared_ptr<NET_SETTINGS> aNetSettings,
const std::set<wxString>& aNetNames, const std::set<wxString>& aNetNames,
bool aIsEEschema ) : bool aIsEEschema ) :
PANEL_SETUP_NETCLASSES_BASE( aParent->GetTreebook() ), PANEL_SETUP_NETCLASSES_BASE( aParentWindow ),
m_frame( aFrame ), m_frame( aFrame ),
m_parent( aParent ),
m_isEEschema( aIsEEschema ), m_isEEschema( aIsEEschema ),
m_netSettings( aNetSettings ), m_netSettings( aNetSettings ),
m_netNames( aNetNames ), m_netNames( aNetNames ),
@ -158,8 +156,8 @@ PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, EDA_DRAW_
} }
wxGridCellAttr* attr = new wxGridCellAttr; wxGridCellAttr* attr = new wxGridCellAttr;
attr->SetRenderer( new GRID_CELL_COLOR_RENDERER( aParent ) ); attr->SetRenderer( new GRID_CELL_COLOR_RENDERER( PAGED_DIALOG::GetDialog( this ) ) );
attr->SetEditor( new GRID_CELL_COLOR_SELECTOR( aParent, m_netclassGrid ) ); attr->SetEditor( new GRID_CELL_COLOR_SELECTOR( PAGED_DIALOG::GetDialog( this ), m_netclassGrid ) );
m_netclassGrid->SetColAttr( GRID_SCHEMATIC_COLOR, attr ); m_netclassGrid->SetColAttr( GRID_SCHEMATIC_COLOR, attr );
attr = new wxGridCellAttr; attr = new wxGridCellAttr;
@ -427,7 +425,7 @@ bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, const wxString& aNa
if( tmp.IsEmpty() ) if( tmp.IsEmpty() )
{ {
wxString msg = _( "Netclass must have a name." ); wxString msg = _( "Netclass must have a name." );
m_parent->SetError( msg, this, m_netclassGrid, aRow, GRID_NAME ); PAGED_DIALOG::GetDialog( this )->SetError( msg, this, m_netclassGrid, aRow, GRID_NAME );
return false; return false;
} }
@ -436,7 +434,8 @@ bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, const wxString& aNa
if( ii != aRow && m_netclassGrid->GetCellValue( ii, GRID_NAME ).CmpNoCase( tmp ) == 0 ) if( ii != aRow && m_netclassGrid->GetCellValue( ii, GRID_NAME ).CmpNoCase( tmp ) == 0 )
{ {
wxString msg = _( "Netclass name already in use." ); wxString msg = _( "Netclass name already in use." );
m_parent->SetError( msg, this, m_netclassGrid, focusFirst ? aRow : ii, GRID_NAME ); PAGED_DIALOG::GetDialog( this )->SetError( msg, this, m_netclassGrid,
focusFirst ? aRow : ii, GRID_NAME );
return false; return false;
} }
} }

View File

@ -28,14 +28,13 @@
#include <wx/radiobut.h> #include <wx/radiobut.h>
#include <wx/scrolwin.h> #include <wx/scrolwin.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/treebook.h>
PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent, PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( wxWindow* aParentWindow,
std::vector<std::reference_wrapper<RC_ITEM>> aItems, std::vector<std::reference_wrapper<RC_ITEM>> aItems,
std::map<int, SEVERITY>& aSeverities, std::map<int, SEVERITY>& aSeverities,
RC_ITEM* aPinMapSpecialCase ) : RC_ITEM* aPinMapSpecialCase ) :
wxPanel( aParent->GetTreebook() ), wxPanel( aParentWindow ),
m_severities( aSeverities ), m_severities( aSeverities ),
m_items( aItems ), m_items( aItems ),
m_pinMapSpecialCase( aPinMapSpecialCase ) m_pinMapSpecialCase( aPinMapSpecialCase )

View File

@ -56,12 +56,12 @@
#include <widgets/wx_infobar.h> #include <widgets/wx_infobar.h>
#include <widgets/wx_aui_art_providers.h> #include <widgets/wx_aui_art_providers.h>
#include <widgets/wx_grid.h> #include <widgets/wx_grid.h>
#include <widgets/wx_treebook.h>
#include <wx/app.h> #include <wx/app.h>
#include <wx/config.h> #include <wx/config.h>
#include <wx/display.h> #include <wx/display.h>
#include <wx/stdpaths.h> #include <wx/stdpaths.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/treebook.h>
#include <kiplatform/app.h> #include <kiplatform/app.h>
#include <kiplatform/ui.h> #include <kiplatform/ui.h>
@ -1012,23 +1012,42 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
PAGED_DIALOG dlg( this, _( "Preferences" ), true ); PAGED_DIALOG dlg( this, _( "Preferences" ), true );
dlg.SetEvtHandlerEnabled( false ); dlg.SetEvtHandlerEnabled( false );
wxTreebook* book = dlg.GetTreebook();
WX_TREEBOOK* book = dlg.GetTreebook();
PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false ); PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false );
KIFACE* kiface = nullptr; KIFACE* kiface = nullptr;
std::vector<int> expand; std::vector<int> expand;
Kiway().GetActions( hotkeysPanel->ActionsList() ); Kiway().GetActions( hotkeysPanel->ActionsList() );
book->AddPage( new PANEL_COMMON_SETTINGS( &dlg, book ), _( "Common" ) ); book->AddLazyPage(
book->AddPage( new PANEL_MOUSE_SETTINGS( &dlg, book ), _( "Mouse and Touchpad" ) ); []( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_COMMON_SETTINGS( aParent );
},
_( "Common" ) );
book->AddLazyPage(
[]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_MOUSE_SETTINGS( aParent );
}, _( "Mouse and Touchpad" ) );
book->AddPage( hotkeysPanel, _( "Hotkeys" ) ); book->AddPage( hotkeysPanel, _( "Hotkeys" ) );
#ifdef KICAD_USE_SENTRY #ifdef KICAD_USE_SENTRY
book->AddPage( new PANEL_DATA_COLLECTION( &dlg, book ), _( "Data Collection" ) ); book->AddLazyPage(
[]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_DATA_COLLECTION( aParent );
}, _( "Data Collection" ) );
#endif #endif
#define CREATE_PANEL( key ) kiface->CreateKiWindow( book, key, &Kiway() ) #define LAZY_CTOR( key ) \
[=]( wxWindow* aParent ) \
{ \
return kiface->CreateKiWindow( aParent, key, &Kiway() ); \
}
// If a dll is not loaded, the loader will show an error message. // If a dll is not loaded, the loader will show an error message.
@ -1042,20 +1061,19 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
expand.push_back( book->GetPageCount() ); expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) ); book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SYM_DISP_OPTIONS ), _( "Display Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_DISP_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SYM_EDIT_OPTIONS ), _( "Editing Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SYM_COLORS ), _( "Colors" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SYM_COLORS ), _( "Colors" ) );
if( GetFrameType() == FRAME_SCH ) if( GetFrameType() == FRAME_SCH )
expand.push_back( book->GetPageCount() ); expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Schematic Editor" ) ); book->AddPage( new wxPanel( book ), _( "Schematic Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_DISP_OPTIONS ), _( "Display Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_DISP_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_ANNO_OPTIONS ), _( "Annotation Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_ANNO_OPTIONS ), _( "Annotation Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_COLORS ), _( "Colors" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_SCH_FIELD_NAME_TEMPLATES ), book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_FIELD_NAME_TEMPLATES ), _( "Field Name Templates" ) );
_( "Field Name Templates" ) );
} }
catch( ... ) catch( ... )
{ {
@ -1071,29 +1089,29 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
expand.push_back( book->GetPageCount() ); expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Footprint Editor" ) ); book->AddPage( new wxPanel( book ), _( "Footprint Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_DISPLAY_OPTIONS ), _( "Display Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_FP_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_COLORS ), _( "Colors" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_FP_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_FP_DEFAULT_VALUES ), _( "Default Values" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_FP_DEFAULT_VALUES ), _( "Default Values" ) );
if( GetFrameType() == FRAME_PCB_EDITOR ) if( GetFrameType() == FRAME_PCB_EDITOR )
expand.push_back( book->GetPageCount() ); expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "PCB Editor" ) ); book->AddPage( new wxPanel( book ), _( "PCB Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_DISPLAY_OPTIONS ), _( "Display Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_EDIT_OPTIONS ), _( "Editing Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_EDIT_OPTIONS ), _( "Editing Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_COLORS ), _( "Colors" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_ACTION_PLUGINS ), _( "Action Plugins" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ACTION_PLUGINS ), _( "Action Plugins" ) );
book->AddSubPage( CREATE_PANEL( PANEL_PCB_ORIGINS_AXES ), _( "Origins & Axes" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_PCB_ORIGINS_AXES ), _( "Origins & Axes" ) );
if( GetFrameType() == FRAME_PCB_DISPLAY3D ) if( GetFrameType() == FRAME_PCB_DISPLAY3D )
expand.push_back( book->GetPageCount() ); expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "3D Viewer" ) ); book->AddPage( new wxPanel( book ), _( "3D Viewer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_DISPLAY_OPTIONS ), _( "General" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_DISPLAY_OPTIONS ), _( "General" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_OPENGL ), _( "Realtime Renderer" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_OPENGL ), _( "Realtime Renderer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_RAYTRACING ), _( "Raytracing Renderer" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_RAYTRACING ), _( "Raytracing Renderer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_3DV_COLORS ), _( "Colors" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_3DV_COLORS ), _( "Colors" ) );
} }
catch( ... ) catch( ... )
{ {
@ -1109,9 +1127,9 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
expand.push_back( book->GetPageCount() ); expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Gerber Viewer" ) ); book->AddPage( new wxPanel( book ), _( "Gerber Viewer" ) );
book->AddSubPage( CREATE_PANEL( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_GBR_COLORS ), _( "Colors" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_COLORS ), _( "Colors" ) );
book->AddSubPage( CREATE_PANEL( PANEL_GBR_EXCELLON_OPTIONS ), _( "Excellon Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_EXCELLON_OPTIONS ), _( "Excellon Options" ) );
} }
catch( ... ) catch( ... )
{ {
@ -1126,10 +1144,14 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
expand.push_back( book->GetPageCount() ); expand.push_back( book->GetPageCount() );
book->AddPage( new wxPanel( book ), _( "Drawing Sheet Editor" ) ); book->AddPage( new wxPanel( book ), _( "Drawing Sheet Editor" ) );
book->AddSubPage( CREATE_PANEL( PANEL_DS_DISPLAY_OPTIONS ), _( "Display Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_DS_DISPLAY_OPTIONS ), _( "Display Options" ) );
book->AddSubPage( CREATE_PANEL( PANEL_DS_COLORS ), _( "Colors" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_DS_COLORS ), _( "Colors" ) );
book->AddPage( new PANEL_PCM_SETTINGS( book ), _( "Plugin and Content Manager" ) ); book->AddLazyPage(
[]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_PCM_SETTINGS( aParent );
}, _( "Plugin and Content Manager" ) );
} }
catch( ... ) catch( ... )
{ {
@ -1157,7 +1179,7 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
dlg.Kiway().CommonSettingsChanged( false, false ); dlg.Kiway().CommonSettingsChanged( false, false );
} }
#undef CREATE_PANEL #undef LAZY_CTOR
} }

View File

@ -19,19 +19,20 @@
#include <confirm.h> #include <confirm.h>
#include <widgets/resettable_panel.h> #include <widgets/resettable_panel.h>
#include <widgets/wx_infobar.h>
#include <widgets/wx_panel.h>
#include <widgets/paged_dialog.h>
#include <widgets/wx_treebook.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/grid.h> #include <wx/grid.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/treebook.h> #include <wx/treebook.h>
#include <wx/treectrl.h> #include <wx/treectrl.h>
#include <wx/listctrl.h>
#include <widgets/wx_infobar.h>
#include <widgets/paged_dialog.h>
#include <wx/stc/stc.h> #include <wx/stc/stc.h>
#include <algorithm> #include <algorithm>
#include "wx/listctrl.h"
#include "widgets/wx_panel.h"
// Maps from dialogTitle <-> pageTitle for keeping track of last-selected pages. // Maps from dialogTitle <-> pageTitle for keeping track of last-selected pages.
// This is not a simple page index because some dialogs have dynamic page sets. // This is not a simple page index because some dialogs have dynamic page sets.
@ -60,7 +61,7 @@ PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aSho
wxBoxSizer* treebookSizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* treebookSizer = new wxBoxSizer( wxVERTICAL );
treebookPanel->SetSizer( treebookSizer ); treebookPanel->SetSizer( treebookSizer );
m_treebook = new wxTreebook( treebookPanel, wxID_ANY ); m_treebook = new WX_TREEBOOK( treebookPanel, wxID_ANY );
m_treebook->SetFont( KIUI::GetControlFont( this ) ); m_treebook->SetFont( KIUI::GetControlFont( this ) );
long treeCtrlFlags = m_treebook->GetTreeCtrl()->GetWindowStyleFlag(); long treeCtrlFlags = m_treebook->GetTreeCtrl()->GetWindowStyleFlag();
@ -269,6 +270,20 @@ bool PAGED_DIALOG::TransferDataFromWindow()
} }
PAGED_DIALOG* PAGED_DIALOG::GetDialog( wxWindow* aParent )
{
while( aParent )
{
if( PAGED_DIALOG* parentDialog = dynamic_cast<PAGED_DIALOG*>( aParent ) )
return parentDialog;
aParent = aParent->GetParent();
}
return nullptr;
}
void PAGED_DIALOG::SetError( const wxString& aMessage, const wxString& aPageName, int aCtrlId, void PAGED_DIALOG::SetError( const wxString& aMessage, const wxString& aPageName, int aCtrlId,
int aRow, int aCol ) int aRow, int aCol )
{ {
@ -278,8 +293,6 @@ void PAGED_DIALOG::SetError( const wxString& aMessage, const wxString& aPageName
void PAGED_DIALOG::SetError( const wxString& aMessage, wxWindow* aPage, wxWindow* aCtrl, void PAGED_DIALOG::SetError( const wxString& aMessage, wxWindow* aPage, wxWindow* aCtrl,
int aRow, int aCol ) int aRow, int aCol )
{
if( aCtrl )
{ {
m_infoBar->ShowMessageFor( aMessage, 10000, wxICON_WARNING ); m_infoBar->ShowMessageFor( aMessage, 10000, wxICON_WARNING );
@ -313,7 +326,6 @@ void PAGED_DIALOG::SetError( const wxString& aMessage, wxWindow* aPage, wxWindow
return; return;
} }
} }
}
void PAGED_DIALOG::UpdateResetButton( int aPage ) void PAGED_DIALOG::UpdateResetButton( int aPage )

View File

@ -0,0 +1,101 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 KiCad Developers, see AUTHORS.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
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <widgets/wx_treebook.h>
#include <wx/panel.h>
#include <wx/sizer.h>
class LAZY_PAGE : public wxPanel
{
public:
LAZY_PAGE( wxWindow* aParent, std::function<wxWindow*( wxWindow* aParent )> aLazyCtor ) :
wxPanel( aParent, wxID_ANY ),
m_lazyCtor( std::move( aLazyCtor ) ),
m_mainSizer( nullptr ),
m_contents( nullptr )
{
m_mainSizer = new wxBoxSizer( wxVERTICAL );
SetSizer( m_mainSizer );
}
wxWindow* Resolve()
{
if( !m_contents )
{
m_contents = m_lazyCtor( this );
m_mainSizer->Add( m_contents, 1, wxEXPAND, 5 );
m_mainSizer->Layout();
m_contents->TransferDataToWindow();
}
return m_contents;
}
bool Show( bool show ) override
{
if( show )
Resolve();
return wxPanel::Show( show );
}
private:
std::function<wxWindow*( wxWindow* aParent )> m_lazyCtor;
wxSizer* m_mainSizer;
wxWindow* m_contents;
};
WX_TREEBOOK::WX_TREEBOOK( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style, const wxString& name ) :
wxTreebook( parent, id, pos, size, style, name )
{
}
bool WX_TREEBOOK::AddLazyPage( std::function<wxWindow*( wxWindow* aParent )> aLazyCtor,
const wxString& text, bool bSelect, int imageId )
{
return AddPage( new LAZY_PAGE( this, std::move( aLazyCtor ) ), text, bSelect, imageId );
}
bool WX_TREEBOOK::AddLazySubPage( std::function<wxWindow*( wxWindow* aParent )> aLazyCtor,
const wxString& text, bool bSelect, int imageId )
{
return AddSubPage( new LAZY_PAGE( this, std::move( aLazyCtor ) ), text, bSelect, imageId );
}
wxWindow* WX_TREEBOOK::ResolvePage( int aPage )
{
wxWindow* page = GetPage( aPage );
if( LAZY_PAGE* lazyPage = dynamic_cast<LAZY_PAGE*>( page ) )
return lazyPage->Resolve();
return page;
}

View File

@ -29,7 +29,7 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
bRightColumn->Add( m_appearanceLabel, 0, wxTOP|wxRIGHT|wxLEFT, 13 ); bRightColumn->Add( m_appearanceLabel, 0, wxTOP|wxRIGHT|wxLEFT, 13 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bRightColumn->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM, 5 ); bRightColumn->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM, 7 );
wxBoxSizer* bAppearanceSizer; wxBoxSizer* bAppearanceSizer;
bAppearanceSizer = new wxBoxSizer( wxVERTICAL ); bAppearanceSizer = new wxBoxSizer( wxVERTICAL );
@ -48,7 +48,7 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
bSizer4->Add( m_defaultFontCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 ); bSizer4->Add( m_defaultFontCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
bAppearanceSizer->Add( bSizer4, 1, wxEXPAND|wxTOP, 5 ); bAppearanceSizer->Add( bSizer4, 1, wxEXPAND, 5 );
m_checkShowHiddenPins = new wxCheckBox( this, wxID_ANY, _("S&how hidden pins"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkShowHiddenPins = new wxCheckBox( this, wxID_ANY, _("S&how hidden pins"), wxDefaultPosition, wxDefaultSize, 0 );
bAppearanceSizer->Add( m_checkShowHiddenPins, 0, wxEXPAND|wxALL, 5 ); bAppearanceSizer->Add( m_checkShowHiddenPins, 0, wxEXPAND|wxALL, 5 );
@ -79,20 +79,20 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
bRightColumn->Add( bAppearanceSizer, 0, wxEXPAND|wxTOP|wxLEFT, 5 ); bRightColumn->Add( bAppearanceSizer, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
bRightColumn->Add( 0, 15, 0, wxEXPAND, 5 ); bRightColumn->Add( 0, 7, 0, wxEXPAND, 5 );
m_selectionLabel = new wxStaticText( this, wxID_ANY, _("Selection && Highlighting"), wxDefaultPosition, wxDefaultSize, 0 ); m_selectionLabel = new wxStaticText( this, wxID_ANY, _("Selection && Highlighting"), wxDefaultPosition, wxDefaultSize, 0 );
m_selectionLabel->Wrap( -1 ); m_selectionLabel->Wrap( -1 );
bRightColumn->Add( m_selectionLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 ); bRightColumn->Add( m_selectionLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bRightColumn->Add( m_staticline2, 0, wxEXPAND|wxBOTTOM, 5 ); bRightColumn->Add( m_staticline2, 0, wxEXPAND|wxBOTTOM, 7 );
wxBoxSizer* bSelectionSizer; wxBoxSizer* bSelectionSizer;
bSelectionSizer = new wxBoxSizer( wxVERTICAL ); bSelectionSizer = new wxBoxSizer( wxVERTICAL );
m_checkSelDrawChildItems = new wxCheckBox( this, wxID_ANY, _("Draw selected child items"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkSelDrawChildItems = new wxCheckBox( this, wxID_ANY, _("Draw selected child items"), wxDefaultPosition, wxDefaultSize, 0 );
bSelectionSizer->Add( m_checkSelDrawChildItems, 0, wxEXPAND|wxALL, 5 ); bSelectionSizer->Add( m_checkSelDrawChildItems, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkSelFillShapes = new wxCheckBox( this, wxID_ANY, _("Fill selected shapes"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkSelFillShapes = new wxCheckBox( this, wxID_ANY, _("Fill selected shapes"), wxDefaultPosition, wxDefaultSize, 0 );
bSelectionSizer->Add( m_checkSelFillShapes, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSelectionSizer->Add( m_checkSelFillShapes, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
@ -130,14 +130,14 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
bRightColumn->Add( bSelectionSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); bRightColumn->Add( bSelectionSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bRightColumn->Add( 0, 15, 0, wxEXPAND, 5 ); bRightColumn->Add( 0, 7, 0, wxEXPAND, 5 );
m_crossprobeLabel = new wxStaticText( this, wxID_ANY, _("Cross-probing"), wxDefaultPosition, wxDefaultSize, 0 ); m_crossprobeLabel = new wxStaticText( this, wxID_ANY, _("Cross-probing"), wxDefaultPosition, wxDefaultSize, 0 );
m_crossprobeLabel->Wrap( -1 ); m_crossprobeLabel->Wrap( -1 );
bRightColumn->Add( m_crossprobeLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 ); bRightColumn->Add( m_crossprobeLabel, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 13 );
m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bRightColumn->Add( m_staticline3, 0, wxEXPAND|wxBOTTOM, 5 ); bRightColumn->Add( m_staticline3, 0, wxEXPAND|wxBOTTOM, 7 );
wxBoxSizer* bCrossProbingSizer; wxBoxSizer* bCrossProbingSizer;
bCrossProbingSizer = new wxBoxSizer( wxVERTICAL ); bCrossProbingSizer = new wxBoxSizer( wxVERTICAL );
@ -146,7 +146,7 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWind
m_checkCrossProbeOnSelection->SetValue(true); m_checkCrossProbeOnSelection->SetValue(true);
m_checkCrossProbeOnSelection->SetToolTip( _("Highlight symbols corresponding to selected footprints") ); m_checkCrossProbeOnSelection->SetToolTip( _("Highlight symbols corresponding to selected footprints") );
bCrossProbingSizer->Add( m_checkCrossProbeOnSelection, 0, wxALL, 5 ); bCrossProbingSizer->Add( m_checkCrossProbeOnSelection, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkCrossProbeCenter = new wxCheckBox( this, wxID_ANY, _("Center view on cross-probed items"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkCrossProbeCenter = new wxCheckBox( this, wxID_ANY, _("Center view on cross-probed items"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkCrossProbeCenter->SetValue(true); m_checkCrossProbeCenter->SetValue(true);

View File

@ -139,7 +139,7 @@
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">7</property>
<property name="flag">wxEXPAND|wxBOTTOM</property> <property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticLine" expanded="1"> <object class="wxStaticLine" expanded="1">
@ -207,7 +207,7 @@
<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|wxTOP</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -860,7 +860,7 @@
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="spacer" expanded="1"> <object class="spacer" expanded="1">
<property name="height">15</property> <property name="height">7</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="width">0</property> <property name="width">0</property>
</object> </object>
@ -927,7 +927,7 @@
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">7</property>
<property name="flag">wxEXPAND|wxBOTTOM</property> <property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticLine" expanded="1"> <object class="wxStaticLine" expanded="1">
@ -995,7 +995,7 @@
<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|wxALL</property> <property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxCheckBox" expanded="1"> <object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -1471,7 +1471,7 @@
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="spacer" expanded="1"> <object class="spacer" expanded="1">
<property name="height">15</property> <property name="height">7</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="width">0</property> <property name="width">0</property>
</object> </object>
@ -1538,7 +1538,7 @@
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">7</property>
<property name="flag">wxEXPAND|wxBOTTOM</property> <property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticLine" expanded="1"> <object class="wxStaticLine" expanded="1">
@ -1606,7 +1606,7 @@
<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">wxALL</property> <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxCheckBox" expanded="1"> <object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>

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-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -35,7 +35,7 @@ class STEPPED_SLIDER;
class PANEL_COMMON_SETTINGS : public PANEL_COMMON_SETTINGS_BASE class PANEL_COMMON_SETTINGS : public PANEL_COMMON_SETTINGS_BASE
{ {
public: public:
PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aParent ); PANEL_COMMON_SETTINGS( wxWindow* aParent );
~PANEL_COMMON_SETTINGS() override; ~PANEL_COMMON_SETTINGS() override;
void ResetPanel() override; void ResetPanel() override;
@ -66,8 +66,6 @@ private:
void setPdfViewerPathState(); void setPdfViewerPathState();
protected: protected:
DIALOG_SHIM* m_dialog;
wxStaticText* m_iconScaleLabel; wxStaticText* m_iconScaleLabel;
STEPPED_SLIDER* m_iconScaleSlider; STEPPED_SLIDER* m_iconScaleSlider;
wxCheckBox* m_iconScaleAuto; wxCheckBox* m_iconScaleAuto;

View File

@ -34,7 +34,7 @@ class PAGED_DIALOG;
class PANEL_DATA_COLLECTION : public PANEL_DATA_COLLECTION_BASE class PANEL_DATA_COLLECTION : public PANEL_DATA_COLLECTION_BASE
{ {
public: public:
PANEL_DATA_COLLECTION( PAGED_DIALOG* aDialog, wxWindow* aParent ); PANEL_DATA_COLLECTION( wxWindow* aParent );
void ResetPanel() override; void ResetPanel() override;
@ -46,9 +46,6 @@ protected:
private: private:
void applySettingsToPanel(); void applySettingsToPanel();
protected:
PAGED_DIALOG* m_dialog;
}; };
#endif //PANEL_DATA_COLLECTION_H #endif //PANEL_DATA_COLLECTION_H

View File

@ -39,7 +39,7 @@ struct SCROLL_MOD_SET
class PANEL_MOUSE_SETTINGS : public PANEL_MOUSE_SETTINGS_BASE class PANEL_MOUSE_SETTINGS : public PANEL_MOUSE_SETTINGS_BASE
{ {
public: public:
PANEL_MOUSE_SETTINGS( PAGED_DIALOG* aDialog, wxWindow* aParent ); PANEL_MOUSE_SETTINGS( wxWindow* aParent );
~PANEL_MOUSE_SETTINGS(); ~PANEL_MOUSE_SETTINGS();
@ -63,9 +63,6 @@ private:
bool isScrollModSetValid( const SCROLL_MOD_SET& aSet ); bool isScrollModSetValid( const SCROLL_MOD_SET& aSet );
protected:
PAGED_DIALOG* m_dialog;
private: private:
SCROLL_MOD_SET m_currentScrollMod; SCROLL_MOD_SET m_currentScrollMod;
}; };

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) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -35,7 +35,7 @@ class NET_SETTINGS;
class PANEL_SETUP_NETCLASSES : public PANEL_SETUP_NETCLASSES_BASE class PANEL_SETUP_NETCLASSES : public PANEL_SETUP_NETCLASSES_BASE
{ {
public: public:
PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, EDA_DRAW_FRAME* aFrame, PANEL_SETUP_NETCLASSES( wxWindow* aParentWindow, EDA_DRAW_FRAME* aFrame,
std::shared_ptr<NET_SETTINGS> aSettings, std::shared_ptr<NET_SETTINGS> aSettings,
const std::set<wxString>& aNetNames, bool isEEschema ); const std::set<wxString>& aNetNames, bool isEEschema );
~PANEL_SETUP_NETCLASSES( ) override; ~PANEL_SETUP_NETCLASSES( ) override;
@ -69,7 +69,6 @@ private:
private: private:
EDA_DRAW_FRAME* m_frame; EDA_DRAW_FRAME* m_frame;
PAGED_DIALOG* m_parent;
bool m_isEEschema; bool m_isEEschema;
std::shared_ptr<NET_SETTINGS> m_netSettings; std::shared_ptr<NET_SETTINGS> m_netSettings;
std::set<wxString> m_netNames; std::set<wxString> m_netNames;

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) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -50,12 +50,11 @@ private:
public: public:
/** /**
* Creates the severities setup panel * Creates the severities setup panel
* @param aParent is the dialog parent
* @param aItems is a list of error types that can have a severity. Must have one or more! * @param aItems is a list of error types that can have a severity. Must have one or more!
* @param aSeverities is a map of error code to severity * @param aSeverities is a map of error code to severity
* @param aPinMapSpecialCase is used to special-case the ERCE_PIN_TO_PIN_WARNING * @param aPinMapSpecialCase is used to special-case the ERCE_PIN_TO_PIN_WARNING
*/ */
PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent, PANEL_SETUP_SEVERITIES( wxWindow* aParentWindow,
std::vector<std::reference_wrapper<RC_ITEM>> aItems, std::vector<std::reference_wrapper<RC_ITEM>> aItems,
std::map<int, SEVERITY>& aSeverities, std::map<int, SEVERITY>& aSeverities,
RC_ITEM* aPinMapSpecialCase = nullptr ); RC_ITEM* aPinMapSpecialCase = nullptr );

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) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2023 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
@ -22,10 +22,11 @@
#define PAGED_DIALOG_H #define PAGED_DIALOG_H
#include <dialog_shim.h> #include <dialog_shim.h>
#include <widgets/wx_treebook.h>
class WX_INFOBAR; class WX_INFOBAR;
class wxTreebook; class WX_TREEBOOK;
class PAGED_DIALOG : public DIALOG_SHIM class PAGED_DIALOG : public DIALOG_SHIM
{ {
@ -34,7 +35,7 @@ public:
const wxString& aAuxiliaryAction = wxEmptyString ); const wxString& aAuxiliaryAction = wxEmptyString );
~PAGED_DIALOG() override; ~PAGED_DIALOG() override;
wxTreebook* GetTreebook() { return m_treebook; } WX_TREEBOOK* GetTreebook() { return m_treebook; }
void SetInitialPage( const wxString& aPage, const wxString& aParentPage = wxEmptyString ); void SetInitialPage( const wxString& aPage, const wxString& aParentPage = wxEmptyString );
@ -48,6 +49,8 @@ public:
void UpdateResetButton( int aPage ); void UpdateResetButton( int aPage );
static PAGED_DIALOG* GetDialog( wxWindow* aWindow );
protected: protected:
void finishInitialization(); void finishInitialization();
@ -60,7 +63,7 @@ protected:
virtual void onPageChanging( wxBookCtrlEvent& aEvent ); virtual void onPageChanging( wxBookCtrlEvent& aEvent );
virtual void onCharHook( wxKeyEvent& aEvent ); virtual void onCharHook( wxKeyEvent& aEvent );
wxTreebook* m_treebook; WX_TREEBOOK* m_treebook;
wxButton* m_auxiliaryButton; wxButton* m_auxiliaryButton;
wxButton* m_resetButton; wxButton* m_resetButton;
wxButton* m_cancelButton; wxButton* m_cancelButton;

View File

@ -0,0 +1,46 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2023 KiCad Developers, see AUTHORS.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
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef WX_TREEBOOK_H
#define WX_TREEBOOK_H
#include <wx/treebook.h>
class WX_TREEBOOK : public wxTreebook
{
public:
WX_TREEBOOK( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxBK_DEFAULT,
const wxString& name = wxEmptyString );
bool AddLazyPage( std::function<wxWindow*( wxWindow* aParent )> aLazyCtor,
const wxString& text, bool bSelect = false, int imageId = NO_IMAGE );
bool AddLazySubPage( std::function<wxWindow*( wxWindow* aParent )> aLazyCtor,
const wxString& text, bool bSelect = false, int imageId = NO_IMAGE );
wxWindow* ResolvePage( int aPage );
};
#endif // WX_TREEBOOK_H

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) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2023 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
@ -62,12 +62,14 @@ bool PANEL_PL_EDITOR_COLOR_SETTINGS::TransferDataToWindow()
bool PANEL_PL_EDITOR_COLOR_SETTINGS::TransferDataFromWindow() bool PANEL_PL_EDITOR_COLOR_SETTINGS::TransferDataFromWindow()
{ {
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
PL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<PL_EDITOR_SETTINGS>();
int sel = m_themes->GetSelection(); int sel = m_themes->GetSelection();
COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
cfg->m_ColorTheme = colors->GetFilename(); if( sel >= 0 )
{
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
COLOR_SETTINGS* colors = static_cast<COLOR_SETTINGS*>( m_themes->GetClientData( sel ) );
mgr.GetAppSettings<PL_EDITOR_SETTINGS>()->m_ColorTheme = colors->GetFilename();
}
return true; return true;
} }

View File

@ -38,12 +38,12 @@
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
#include <widgets/resettable_panel.h> #include <widgets/resettable_panel.h>
#include <widgets/wx_progress_reporters.h> #include <widgets/wx_progress_reporters.h>
#include <widgets/wx_treebook.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include "dialog_board_setup.h" #include "dialog_board_setup.h"
#include "panel_setup_rules.h" #include "panel_setup_rules.h"
#include <wx/treebook.h>
std::mutex DIALOG_BOARD_SETUP::g_Mutex; std::mutex DIALOG_BOARD_SETUP::g_Mutex;
@ -54,27 +54,12 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
m_frame( aFrame ) m_frame( aFrame )
{ {
SetEvtHandlerEnabled( false ); SetEvtHandlerEnabled( false );
PROJECT_FILE& project = aFrame->Prj().GetProjectFile();
BOARD* board = aFrame->GetBoard();
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
m_layers = new PANEL_SETUP_LAYERS( this, aFrame ); m_layers = new PANEL_SETUP_LAYERS( this, m_frame );
m_textAndGraphics = new PANEL_SETUP_TEXT_AND_GRAPHICS( this, aFrame ); m_physicalStackup = new PANEL_SETUP_BOARD_STACKUP( this, m_frame, m_layers );
m_formatting = new PANEL_SETUP_FORMATTING( this, aFrame ); m_boardFinish = new PANEL_SETUP_BOARD_FINISH( this, m_frame );
m_constraints = new PANEL_SETUP_CONSTRAINTS( this, aFrame );
m_rules = new PANEL_SETUP_RULES( this, aFrame );
m_tracksAndVias = new PANEL_SETUP_TRACKS_AND_VIAS( this, aFrame );
m_maskAndPaste = new PANEL_SETUP_MASK_AND_PASTE( this, aFrame );
m_physicalStackup = new PANEL_SETUP_BOARD_STACKUP( this, aFrame, m_layers );
m_boardFinish = new PANEL_SETUP_BOARD_FINISH( this, aFrame );
m_severities = new PANEL_SETUP_SEVERITIES( this, DRC_ITEM::GetItemsWithSeverities(), m_currentPage = -1;
bds.m_DRCSeverities );
m_netclasses = new PANEL_SETUP_NETCLASSES( this, aFrame, project.NetSettings(),
board->GetNetClassAssignmentCandidates(), false );
m_textVars = new PANEL_TEXT_VARIABLES( m_treebook, &Prj() );
/* /*
* WARNING: If you change page names you MUST update calls to ShowBoardSetupDialog(). * WARNING: If you change page names you MUST update calls to ShowBoardSetupDialog().
@ -82,8 +67,6 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
m_treebook->AddPage( new wxPanel( GetTreebook() ), _( "Board Stackup" ) ); m_treebook->AddPage( new wxPanel( GetTreebook() ), _( "Board Stackup" ) );
m_currentPage = -1;
/* /*
* WARNING: Code currently relies on the layers setup coming before the physical stackup panel, * WARNING: Code currently relies on the layers setup coming before the physical stackup panel,
* and thus transferring data to the board first. See comment in * and thus transferring data to the board first. See comment in
@ -91,27 +74,81 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
* that the order of these pages should be changed. * that the order of these pages should be changed.
*/ */
m_treebook->AddSubPage( m_layers, _( "Board Editor Layers" ) ); m_treebook->AddSubPage( m_layers, _( "Board Editor Layers" ) );
m_layerSetupPage = 1;
m_physicalStackupPage = m_treebook->GetPageCount();
m_treebook->AddSubPage( m_physicalStackup, _( "Physical Stackup" ) ); m_treebook->AddSubPage( m_physicalStackup, _( "Physical Stackup" ) );
// Change this value if m_physicalStackup is not the page 2 of m_treebook
m_physicalStackupPage = 2; // The page number (from 0) to select the m_physicalStackup panel
m_treebook->AddSubPage( m_boardFinish, _( "Board Finish" ) ); m_treebook->AddSubPage( m_boardFinish, _( "Board Finish" ) );
m_treebook->AddSubPage( m_maskAndPaste, _( "Solder Mask/Paste" ) );
m_maskAndPagePage = m_treebook->GetPageCount();
m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_SETUP_MASK_AND_PASTE( aParent, m_frame );
}, _( "Solder Mask/Paste" ) );
m_treebook->AddPage( new wxPanel( GetTreebook() ), _( "Text & Graphics" ) ); m_treebook->AddPage( new wxPanel( GetTreebook() ), _( "Text & Graphics" ) );
m_treebook->AddSubPage( m_textAndGraphics, _( "Defaults" ) );
m_treebook->AddSubPage( m_formatting, _( "Formatting" ) ); m_textAndGraphicsPage = m_treebook->GetPageCount();
m_treebook->AddSubPage( m_textVars, _( "Text Variables" ) ); m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_SETUP_TEXT_AND_GRAPHICS( aParent, m_frame );
}, _( "Defaults" ) );
m_formattingPage = m_treebook->GetPageCount();
m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_SETUP_FORMATTING( aParent, m_frame );
}, _( "Formatting" ) );
m_textVarsPage = m_treebook->GetPageCount();
m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_TEXT_VARIABLES( aParent, &Prj() );
}, _( "Text Variables" ) );
m_treebook->AddPage( new wxPanel( GetTreebook() ), _( "Design Rules" ) ); m_treebook->AddPage( new wxPanel( GetTreebook() ), _( "Design Rules" ) );
m_treebook->AddSubPage( m_constraints, _( "Constraints" ) );
m_treebook->AddSubPage( m_tracksAndVias, _( "Pre-defined Sizes" ) ); m_constraintsPage = m_treebook->GetPageCount();
m_treebook->AddSubPage( m_netclasses, _( "Net Classes" ) ); m_treebook->AddLazySubPage(
m_treebook->AddSubPage( m_rules, _( "Custom Rules" ) ); [this]( wxWindow* aParent ) -> wxWindow*
m_treebook->AddSubPage( m_severities, _( "Violation Severity" ) ); {
return new PANEL_SETUP_CONSTRAINTS( aParent, m_frame );
}, _( "Constraints" ) );
m_tracksAndViasPage = m_treebook->GetPageCount();
m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_SETUP_TRACKS_AND_VIAS( aParent, m_frame );
}, _( "Pre-defined Sizes" ) );
m_netclassesPage = m_treebook->GetPageCount();
m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_SETUP_NETCLASSES( aParent, m_frame,
m_frame->Prj().GetProjectFile().NetSettings(),
m_frame->GetBoard()->GetNetClassAssignmentCandidates(),
false );
}, _( "Net Classes" ) );
m_rulesPage = m_treebook->GetPageCount();
m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_SETUP_RULES( aParent, m_frame );
}, _( "Custom Rules" ) );
m_severitiesPage = m_treebook->GetPageCount();
m_treebook->AddLazySubPage(
[this]( wxWindow* aParent ) -> wxWindow*
{
return new PANEL_SETUP_SEVERITIES( aParent, DRC_ITEM::GetItemsWithSeverities(),
m_frame->GetBoard()->GetDesignSettings().m_DRCSeverities );
}, _( "Violation Severity" ) );
for( size_t i = 0; i < m_treebook->GetPageCount(); ++i ) for( size_t i = 0; i < m_treebook->GetPageCount(); ++i )
m_treebook->ExpandNode( i ); m_treebook->ExpandNode( i );
@ -245,25 +282,46 @@ void DIALOG_BOARD_SETUP::onAuxiliaryAction( wxCommandEvent& aEvent )
} }
if( importDlg.m_TextAndGraphicsOpt->GetValue() ) if( importDlg.m_TextAndGraphicsOpt->GetValue() )
m_textAndGraphics->ImportSettingsFrom( otherBoard ); {
static_cast<PANEL_SETUP_TEXT_AND_GRAPHICS*>( m_treebook->ResolvePage( m_textAndGraphicsPage ) )
->ImportSettingsFrom( otherBoard );
}
if( importDlg.m_FormattingOpt->GetValue() ) if( importDlg.m_FormattingOpt->GetValue() )
m_formatting->ImportSettingsFrom( otherBoard ); {
static_cast<PANEL_SETUP_FORMATTING*>( m_treebook->ResolvePage( m_formattingPage ) )
->ImportSettingsFrom( otherBoard );
}
if( importDlg.m_ConstraintsOpt->GetValue() ) if( importDlg.m_ConstraintsOpt->GetValue() )
m_constraints->ImportSettingsFrom( otherBoard ); {
static_cast<PANEL_SETUP_CONSTRAINTS*>( m_treebook->ResolvePage( m_constraintsPage ) )
->ImportSettingsFrom( otherBoard );
}
if( importDlg.m_NetclassesOpt->GetValue() ) if( importDlg.m_NetclassesOpt->GetValue() )
m_netclasses->ImportSettingsFrom( otherPrj->GetProjectFile().m_NetSettings ); {
static_cast<PANEL_SETUP_NETCLASSES*>( m_treebook->ResolvePage( m_netclassesPage ) )
->ImportSettingsFrom( otherPrj->GetProjectFile().m_NetSettings );
}
if( importDlg.m_TracksAndViasOpt->GetValue() ) if( importDlg.m_TracksAndViasOpt->GetValue() )
m_tracksAndVias->ImportSettingsFrom( otherBoard ); {
static_cast<PANEL_SETUP_TRACKS_AND_VIAS*>( m_treebook->ResolvePage( m_tracksAndViasPage ) )
->ImportSettingsFrom( otherBoard );
}
if( importDlg.m_MaskAndPasteOpt->GetValue() ) if( importDlg.m_MaskAndPasteOpt->GetValue() )
m_maskAndPaste->ImportSettingsFrom( otherBoard ); {
static_cast<PANEL_SETUP_MASK_AND_PASTE*>( m_treebook->ResolvePage( m_maskAndPagePage ) )
->ImportSettingsFrom( otherBoard );
}
if( importDlg.m_SeveritiesOpt->GetValue() ) if( importDlg.m_SeveritiesOpt->GetValue() )
m_severities->ImportSettingsFrom( otherBoard->GetDesignSettings().m_DRCSeverities ); {
static_cast<PANEL_SETUP_SEVERITIES*>( m_treebook->ResolvePage( m_severitiesPage ) )
->ImportSettingsFrom( otherBoard->GetDesignSettings().m_DRCSeverities );
}
if( otherPrj != &m_frame->Prj() ) if( otherPrj != &m_frame->Prj() )
otherBoard->ClearProject(); otherBoard->ClearProject();

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) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2023 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
@ -52,26 +52,25 @@ protected:
PCB_EDIT_FRAME* m_frame; PCB_EDIT_FRAME* m_frame;
PANEL_SETUP_CONSTRAINTS* m_constraints;
PANEL_SETUP_LAYERS* m_layers; PANEL_SETUP_LAYERS* m_layers;
PANEL_SETUP_TEXT_AND_GRAPHICS* m_textAndGraphics;
PANEL_SETUP_FORMATTING* m_formatting;
PANEL_SETUP_NETCLASSES* m_netclasses;
PANEL_SETUP_RULES* m_rules;
PANEL_SETUP_TRACKS_AND_VIAS* m_tracksAndVias;
PANEL_SETUP_MASK_AND_PASTE* m_maskAndPaste;
PANEL_SETUP_BOARD_STACKUP* m_physicalStackup; PANEL_SETUP_BOARD_STACKUP* m_physicalStackup;
PANEL_SETUP_BOARD_FINISH* m_boardFinish; PANEL_SETUP_BOARD_FINISH* m_boardFinish;
PANEL_SETUP_SEVERITIES* m_severities;
PANEL_TEXT_VARIABLES* m_textVars;
public: public:
static std::mutex g_Mutex; // Mutex to prevent multiple windows opening static std::mutex g_Mutex; // Mutex to prevent multiple windows opening
private: private:
int m_currentPage; // the current page index int m_currentPage; // the current page index
int m_physicalStackupPage; // the page index of the PANEL_SETUP_BOARD_STACKUP page int m_textAndGraphicsPage;
int m_layerSetupPage; // the page index of the PANEL_SETUP_LAYERS page int m_constraintsPage;
int m_formattingPage;
int m_physicalStackupPage;
int m_tracksAndViasPage;
int m_netclassesPage;
int m_maskAndPagePage;
int m_rulesPage;
int m_severitiesPage;
int m_textVarsPage;
}; };

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) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -32,8 +32,8 @@
#include <bitmaps.h> #include <bitmaps.h>
PANEL_SETUP_CONSTRAINTS::PANEL_SETUP_CONSTRAINTS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ) : PANEL_SETUP_CONSTRAINTS::PANEL_SETUP_CONSTRAINTS( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame ) :
PANEL_SETUP_CONSTRAINTS_BASE( aParent->GetTreebook() ), PANEL_SETUP_CONSTRAINTS_BASE( aParentWindow ),
m_minClearance( aFrame, m_clearanceTitle, m_clearanceCtrl, m_clearanceUnits ), m_minClearance( aFrame, m_clearanceTitle, m_clearanceCtrl, m_clearanceUnits ),
m_minConn( aFrame, m_MinConnTitle, m_MinConnCtrl, m_MinConnUnits ), m_minConn( aFrame, m_MinConnTitle, m_MinConnCtrl, m_MinConnUnits ),
m_trackMinWidth( aFrame, m_TrackMinWidthTitle, m_TrackMinWidthCtrl, m_TrackMinWidthUnits ), m_trackMinWidth( aFrame, m_TrackMinWidthTitle, m_TrackMinWidthCtrl, m_TrackMinWidthUnits ),

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) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -38,7 +38,7 @@ class wxCommandEvent;
class PANEL_SETUP_CONSTRAINTS : public PANEL_SETUP_CONSTRAINTS_BASE class PANEL_SETUP_CONSTRAINTS : public PANEL_SETUP_CONSTRAINTS_BASE
{ {
public: public:
PANEL_SETUP_CONSTRAINTS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ); PANEL_SETUP_CONSTRAINTS( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame );
~PANEL_SETUP_CONSTRAINTS( ) override { }; ~PANEL_SETUP_CONSTRAINTS( ) override { };
void ImportSettingsFrom( BOARD* aBoard ); void ImportSettingsFrom( BOARD* aBoard );

View File

@ -30,8 +30,8 @@
#include <wx/treebook.h> #include <wx/treebook.h>
PANEL_SETUP_FORMATTING::PANEL_SETUP_FORMATTING( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ) : PANEL_SETUP_FORMATTING::PANEL_SETUP_FORMATTING( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame ) :
PANEL_SETUP_FORMATTING_BASE( aParent->GetTreebook() ), PANEL_SETUP_FORMATTING_BASE( aParentWindow ),
m_frame( aFrame ) m_frame( aFrame )
{ {
wxSize minSize = m_dashLengthCtrl->GetMinSize(); wxSize minSize = m_dashLengthCtrl->GetMinSize();

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) 2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2021-2023 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
@ -31,7 +31,7 @@ class PAGED_DIALOG;
class PANEL_SETUP_FORMATTING : public PANEL_SETUP_FORMATTING_BASE class PANEL_SETUP_FORMATTING : public PANEL_SETUP_FORMATTING_BASE
{ {
public: public:
PANEL_SETUP_FORMATTING( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ); PANEL_SETUP_FORMATTING( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame );
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;

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) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -26,12 +26,11 @@
#include <board_design_settings.h> #include <board_design_settings.h>
#include <dialogs/dialog_text_entry.h> #include <dialogs/dialog_text_entry.h>
#include <panel_setup_mask_and_paste.h> #include <panel_setup_mask_and_paste.h>
#include <wx/treebook.h>
PANEL_SETUP_MASK_AND_PASTE::PANEL_SETUP_MASK_AND_PASTE( PAGED_DIALOG* aParent, PANEL_SETUP_MASK_AND_PASTE::PANEL_SETUP_MASK_AND_PASTE( wxWindow* aParentWindow,
PCB_EDIT_FRAME* aFrame ) : PCB_EDIT_FRAME* aFrame ) :
PANEL_SETUP_MASK_AND_PASTE_BASE( aParent->GetTreebook() ), PANEL_SETUP_MASK_AND_PASTE_BASE( aParentWindow ),
m_maskExpansion( aFrame, m_maskMarginLabel, m_maskMarginCtrl, m_maskMarginUnits ), m_maskExpansion( aFrame, m_maskMarginLabel, m_maskMarginCtrl, m_maskMarginUnits ),
m_maskMinWidth( aFrame, m_maskMinWidthLabel, m_maskMinWidthCtrl, m_maskMinWidthUnits ), m_maskMinWidth( aFrame, m_maskMinWidthLabel, m_maskMinWidthCtrl, m_maskMinWidthUnits ),
m_maskToCopperClearance( aFrame, m_maskToCopperClearanceLabel, m_maskToCopperClearanceCtrl, m_maskToCopperClearance( aFrame, m_maskToCopperClearanceLabel, m_maskToCopperClearanceCtrl,

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 change_log.txt for contributors. * Copyright (C) 2018-2023 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -48,7 +48,7 @@ private:
UNIT_BINDER m_pasteMarginRatio; UNIT_BINDER m_pasteMarginRatio;
public: public:
PANEL_SETUP_MASK_AND_PASTE( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ); PANEL_SETUP_MASK_AND_PASTE( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame );
~PANEL_SETUP_MASK_AND_PASTE( ) { }; ~PANEL_SETUP_MASK_AND_PASTE( ) { };
bool TransferDataToWindow() override; bool TransferDataToWindow() override;

View File

@ -33,16 +33,14 @@
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <panel_setup_rules.h> #include <panel_setup_rules.h>
#include <widgets/wx_html_report_box.h> #include <widgets/wx_html_report_box.h>
#include <wx/treebook.h>
#include <dialogs/html_message_box.h> #include <dialogs/html_message_box.h>
#include <scintilla_tricks.h> #include <scintilla_tricks.h>
#include <drc/drc_rule_parser.h> #include <drc/drc_rule_parser.h>
#include <tools/drc_tool.h> #include <tools/drc_tool.h>
#include <pgm_base.h> #include <pgm_base.h>
PANEL_SETUP_RULES::PANEL_SETUP_RULES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ) : PANEL_SETUP_RULES::PANEL_SETUP_RULES( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame ) :
PANEL_SETUP_RULES_BASE( aParent->GetTreebook() ), PANEL_SETUP_RULES_BASE( aParentWindow ),
m_Parent( aParent ),
m_frame( aFrame ), m_frame( aFrame ),
m_scintillaTricks( nullptr ), m_scintillaTricks( nullptr ),
m_helpWindow( nullptr ) m_helpWindow( nullptr )
@ -50,7 +48,8 @@ PANEL_SETUP_RULES::PANEL_SETUP_RULES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFr
m_scintillaTricks = new SCINTILLA_TRICKS( m_textEditor, wxT( "()" ), false, m_scintillaTricks = new SCINTILLA_TRICKS( m_textEditor, wxT( "()" ), false,
[this]() [this]()
{ {
wxPostEvent( m_Parent, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) ); wxPostEvent( PAGED_DIALOG::GetDialog( this ),
wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
} ); } );
m_textEditor->AutoCompSetSeparator( '|' ); m_textEditor->AutoCompSetSeparator( '|' );
@ -170,7 +169,7 @@ void PANEL_SETUP_RULES::OnContextMenu(wxMouseEvent &event)
void PANEL_SETUP_RULES::onScintillaCharAdded( wxStyledTextEvent &aEvent ) void PANEL_SETUP_RULES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
{ {
m_Parent->SetModified(); PAGED_DIALOG::GetDialog( this )->SetModified();
m_textEditor->SearchAnchor(); m_textEditor->SearchAnchor();
wxString rules = m_textEditor->GetText(); wxString rules = m_textEditor->GetText();

View File

@ -38,7 +38,7 @@ class HTML_MESSAGE_BOX;
class PANEL_SETUP_RULES : public PANEL_SETUP_RULES_BASE class PANEL_SETUP_RULES : public PANEL_SETUP_RULES_BASE
{ {
public: public:
PANEL_SETUP_RULES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ); PANEL_SETUP_RULES( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame );
~PANEL_SETUP_RULES( ) override; ~PANEL_SETUP_RULES( ) override;
private: private:
@ -53,7 +53,6 @@ private:
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
PAGED_DIALOG* m_Parent;
PCB_EDIT_FRAME* m_frame; PCB_EDIT_FRAME* m_frame;
SCINTILLA_TRICKS* m_scintillaTricks; SCINTILLA_TRICKS* m_scintillaTricks;
wxString m_originalText; wxString m_originalText;

View File

@ -54,9 +54,9 @@ enum
}; };
PANEL_SETUP_TEXT_AND_GRAPHICS::PANEL_SETUP_TEXT_AND_GRAPHICS( PAGED_DIALOG* aParent, PANEL_SETUP_TEXT_AND_GRAPHICS::PANEL_SETUP_TEXT_AND_GRAPHICS( wxWindow* aParentWindow,
PCB_EDIT_FRAME* aFrame ) : PCB_EDIT_FRAME* aFrame ) :
PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( aParent->GetTreebook() ), PANEL_SETUP_TEXT_AND_GRAPHICS_BASE( aParentWindow ),
m_arrowLength( aFrame, m_lblArrowLength, m_dimensionArrowLength, m_arrowLengthUnits ), m_arrowLength( aFrame, m_lblArrowLength, m_dimensionArrowLength, m_arrowLengthUnits ),
m_extensionOffset( aFrame, m_lblExtensionOffset, m_dimensionExtensionOffset, m_extensionOffset( aFrame, m_lblExtensionOffset, m_dimensionExtensionOffset,
m_dimensionExtensionOffsetUnits ) m_dimensionExtensionOffsetUnits )

View File

@ -38,7 +38,7 @@ class BOARD_DESIGN_SETTINGS;
class PANEL_SETUP_TEXT_AND_GRAPHICS : public PANEL_SETUP_TEXT_AND_GRAPHICS_BASE class PANEL_SETUP_TEXT_AND_GRAPHICS : public PANEL_SETUP_TEXT_AND_GRAPHICS_BASE
{ {
public: public:
PANEL_SETUP_TEXT_AND_GRAPHICS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ); PANEL_SETUP_TEXT_AND_GRAPHICS( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame );
~PANEL_SETUP_TEXT_AND_GRAPHICS( ) override; ~PANEL_SETUP_TEXT_AND_GRAPHICS( ) override;
bool TransferDataToWindow() override; bool TransferDataToWindow() override;

View File

@ -27,7 +27,6 @@
#include <bitmaps.h> #include <bitmaps.h>
#include <widgets/wx_grid.h> #include <widgets/wx_grid.h>
#include <widgets/std_bitmap_button.h> #include <widgets/std_bitmap_button.h>
#include <wx/treebook.h>
#include <grid_tricks.h> #include <grid_tricks.h>
#include <panel_setup_tracks_and_vias.h> #include <panel_setup_tracks_and_vias.h>
@ -52,11 +51,10 @@ enum DIFF_VAR_GRID_COLUMNS
}; };
PANEL_SETUP_TRACKS_AND_VIAS::PANEL_SETUP_TRACKS_AND_VIAS( PAGED_DIALOG* aParent, PANEL_SETUP_TRACKS_AND_VIAS::PANEL_SETUP_TRACKS_AND_VIAS( wxWindow* aParentWindow,
PCB_EDIT_FRAME* aFrame ) : PCB_EDIT_FRAME* aFrame ) :
PANEL_SETUP_TRACKS_AND_VIAS_BASE( aParent->GetTreebook() ) PANEL_SETUP_TRACKS_AND_VIAS_BASE( aParentWindow )
{ {
m_Parent = aParent;
m_Frame = aFrame; m_Frame = aFrame;
m_Pcb = m_Frame->GetBoard(); m_Pcb = m_Frame->GetBoard();
m_BrdSettings = &m_Pcb->GetDesignSettings(); m_BrdSettings = &m_Pcb->GetDesignSettings();
@ -369,7 +367,7 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::Validate()
if( !viaDia.IsEmpty() && viaDrill.IsEmpty() ) if( !viaDia.IsEmpty() && viaDrill.IsEmpty() )
{ {
msg = _( "No via hole size defined." ); msg = _( "No via hole size defined." );
m_Parent->SetError( msg, this, m_viaSizesGrid, row, VIA_DRILL_COL ); PAGED_DIALOG::GetDialog( this )->SetError( msg, this, m_viaSizesGrid, row, VIA_DRILL_COL );
return false; return false;
} }
} }
@ -383,7 +381,7 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::Validate()
if( !dpWidth.IsEmpty() && dpGap.IsEmpty() ) if( !dpWidth.IsEmpty() && dpGap.IsEmpty() )
{ {
msg = _( "No differential pair gap defined." ); msg = _( "No differential pair gap defined." );
m_Parent->SetError( msg, this, m_diffPairsGrid, row, 1 ); PAGED_DIALOG::GetDialog( this )->SetError( msg, this, m_diffPairsGrid, row, 1 );
return false; return false;
} }
} }

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-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -39,7 +39,7 @@ class BOARD_DESIGN_SETTINGS;
class PANEL_SETUP_TRACKS_AND_VIAS : public PANEL_SETUP_TRACKS_AND_VIAS_BASE class PANEL_SETUP_TRACKS_AND_VIAS : public PANEL_SETUP_TRACKS_AND_VIAS_BASE
{ {
public: public:
PANEL_SETUP_TRACKS_AND_VIAS( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame ); PANEL_SETUP_TRACKS_AND_VIAS( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame );
~PANEL_SETUP_TRACKS_AND_VIAS() override; ~PANEL_SETUP_TRACKS_AND_VIAS() override;
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
@ -67,7 +67,6 @@ protected:
void AppendDiffPairs( int aWidth, int aGap, int aViaGap ); void AppendDiffPairs( int aWidth, int aGap, int aViaGap );
private: private:
PAGED_DIALOG* m_Parent;
PCB_EDIT_FRAME* m_Frame; PCB_EDIT_FRAME* m_Frame;
BOARD* m_Pcb; BOARD* m_Pcb;
BOARD_DESIGN_SETTINGS* m_BrdSettings; BOARD_DESIGN_SETTINGS* m_BrdSettings;