Reimplement skip-parent-page to work with MacHack.
This prevents the "leaking" pages where the layers panel is shown in the background of all other panels. Fixes https://gitlab.com/kicad/code/kicad/issues/5182
This commit is contained in:
parent
12926723d7
commit
cc64709407
|
@ -36,48 +36,6 @@ std::map<wxString, wxString> g_lastPage;
|
|||
std::map<wxString, wxString> g_lastParentPage;
|
||||
|
||||
|
||||
PAGED_TREEBOOK::PAGED_TREEBOOK( wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
||||
const wxSize& size, long style, const wxString& name )
|
||||
: wxTreebook( parent, id, pos, size, style, name )
|
||||
{
|
||||
GetTreeCtrl()->Bind( wxEVT_TREE_SEL_CHANGING, &PAGED_TREEBOOK::OnTreeSelChanging, this );
|
||||
}
|
||||
|
||||
|
||||
void PAGED_TREEBOOK::OnTreeSelChanging( wxTreeEvent& aEvent )
|
||||
{
|
||||
wxTreeItemId pageId = aEvent.GetItem();
|
||||
|
||||
for( size_t i = 0; i < m_groupEntries.size(); ++i )
|
||||
{
|
||||
if( m_groupEntries[i] == pageId )
|
||||
{
|
||||
aEvent.Veto();
|
||||
|
||||
wxTreeItemIdValue cookie;
|
||||
wxTreeItemId firstSubPage = GetTreeCtrl()->GetFirstChild( pageId, cookie );
|
||||
|
||||
if( firstSubPage.IsOk() )
|
||||
{
|
||||
GetTreeCtrl()->SelectItem( firstSubPage, true );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool PAGED_TREEBOOK::AddGroupEntry( const wxString& text, int imageId )
|
||||
{
|
||||
bool add = AddPage( new wxPanel(this), text, false, imageId );
|
||||
|
||||
wxTreeItemId newId = m_treeIds.back();
|
||||
m_groupEntries.push_back(newId);
|
||||
|
||||
return add;
|
||||
}
|
||||
|
||||
|
||||
PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aUseReset,
|
||||
const wxString& aAuxiliaryAction ) :
|
||||
DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
|
||||
|
@ -95,7 +53,7 @@ PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aUse
|
|||
m_infoBar = new WX_INFOBAR( this );
|
||||
mainSizer->Add( m_infoBar, 0, wxEXPAND, 0 );
|
||||
|
||||
m_treebook = new PAGED_TREEBOOK( this, wxID_ANY );
|
||||
m_treebook = new wxTreebook( this, wxID_ANY );
|
||||
mainSizer->Add( m_treebook, 1, wxEXPAND|wxLEFT|wxTOP, 10 );
|
||||
|
||||
auto line = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
|
@ -355,12 +313,20 @@ void PAGED_DIALOG::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_treebook->GetCurrentPage()->GetChildren().IsEmpty() )
|
||||
{
|
||||
unsigned next = m_treebook->GetSelection() + 1;
|
||||
|
||||
if( next < m_treebook->GetPageCount() )
|
||||
m_treebook->SetSelection( next );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PAGED_DIALOG::OnPageChange( wxBookCtrlEvent& event )
|
||||
{
|
||||
int page = event.GetSelection();
|
||||
size_t page = event.GetSelection();
|
||||
|
||||
// Enable the reset button only if the page is resettable
|
||||
if( m_resetButton )
|
||||
|
|
|
@ -63,15 +63,15 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
|
|||
* WARNING: If you change page names you MUST update calls to ShowSchematicSetupDialog().
|
||||
*/
|
||||
|
||||
m_treebook->AddGroupEntry( _( "General" ) );
|
||||
m_treebook->AddPage( new wxPanel( this ), _( "General" ) );
|
||||
m_treebook->AddSubPage( m_formatting, _( "Formatting" ) );
|
||||
m_treebook->AddSubPage( m_fieldNameTemplates, _( "Field Name Templates" ) );
|
||||
|
||||
m_treebook->AddGroupEntry( _( "Electrical Rules" ) );
|
||||
m_treebook->AddPage( new wxPanel( this ), _( "Electrical Rules" ) );
|
||||
m_treebook->AddSubPage( m_severities, _( "Violation Severity" ) );
|
||||
m_treebook->AddSubPage( m_pinMap, _( "Pin Conflicts Map" ) );
|
||||
|
||||
m_treebook->AddGroupEntry( _( "Project" ) );
|
||||
m_treebook->AddPage( new wxPanel( this ), _( "Project" ) );
|
||||
m_treebook->AddSubPage( m_netclasses, _( "Net Classes" ) );
|
||||
m_treebook->AddSubPage( m_textVars, _( "Text Variables" ) );
|
||||
|
||||
|
|
|
@ -218,9 +218,9 @@ COLOR4D GetInvisibleItemColor()
|
|||
void SCH_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
||||
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
|
||||
{
|
||||
PAGED_TREEBOOK* book = aParent->GetTreebook();
|
||||
wxTreebook* book = aParent->GetTreebook();
|
||||
|
||||
book->AddGroupEntry( _( "Eeschema" ) );
|
||||
book->AddPage( new wxPanel( book ), _( "Eeschema" ) );
|
||||
book->AddSubPage( new PANEL_EESCHEMA_DISPLAY_OPTIONS( this, book ), _( "Display Options" ) );
|
||||
book->AddSubPage( new PANEL_EESCHEMA_SETTINGS( this, book ), _( "Editing Options" ) );
|
||||
book->AddSubPage( new PANEL_EESCHEMA_COLOR_SETTINGS( this, book ), _( "Colors" ) );
|
||||
|
@ -422,9 +422,9 @@ void SCH_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
void LIB_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
||||
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
|
||||
{
|
||||
PAGED_TREEBOOK* book = aParent->GetTreebook();
|
||||
wxTreebook* book = aParent->GetTreebook();
|
||||
|
||||
book->AddGroupEntry( _( "Symbol Editor" ) );
|
||||
book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) );
|
||||
book->AddSubPage( new PANEL_GAL_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
|
||||
book->AddSubPage( new PANEL_LIBEDIT_SETTINGS( this, book ), _( "Editing Options" ) );
|
||||
book->AddSubPage( new PANEL_LIBEDIT_COLOR_SETTINGS( this, book ), _( "Colors" ) );
|
||||
|
|
|
@ -1136,9 +1136,9 @@ void GERBVIEW_FRAME::ActivateGalCanvas()
|
|||
void GERBVIEW_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
||||
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
|
||||
{
|
||||
PAGED_TREEBOOK* book = aParent->GetTreebook();
|
||||
wxTreebook* book = aParent->GetTreebook();
|
||||
|
||||
book->AddGroupEntry( _( "Gerbview" ) );
|
||||
book->AddPage( new wxPanel( book ), _( "Gerbview" ) );
|
||||
book->AddSubPage( new PANEL_GERBVIEW_DISPLAY_OPTIONS( this, book ), _( "Display Options" ) );
|
||||
book->AddSubPage( new PANEL_GERBVIEW_SETTINGS( this, book ), _( "Editing Options" ) );
|
||||
|
||||
|
|
|
@ -28,22 +28,6 @@
|
|||
class WX_INFOBAR;
|
||||
|
||||
|
||||
class PAGED_TREEBOOK : public wxTreebook
|
||||
{
|
||||
public:
|
||||
PAGED_TREEBOOK( wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxBK_DEFAULT,
|
||||
const wxString& name = wxEmptyString );
|
||||
|
||||
bool AddGroupEntry( const wxString& text, int imageId = NO_IMAGE );
|
||||
|
||||
protected:
|
||||
void OnTreeSelChanging( wxTreeEvent& aEvent );
|
||||
|
||||
wxVector<wxTreeItemId> m_groupEntries;
|
||||
};
|
||||
|
||||
|
||||
class PAGED_DIALOG : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
@ -63,7 +47,7 @@ public:
|
|||
const wxString& aAuxiliaryAction = wxEmptyString );
|
||||
~PAGED_DIALOG() override;
|
||||
|
||||
PAGED_TREEBOOK* GetTreebook() { return m_treebook; }
|
||||
wxTreebook* GetTreebook() { return m_treebook; }
|
||||
|
||||
void SetInitialPage( const wxString& aPage, const wxString& aParentPage = wxEmptyString );
|
||||
|
||||
|
@ -88,7 +72,7 @@ protected:
|
|||
void OnUpdateUI( wxUpdateUIEvent& event );
|
||||
void OnPageChange( wxBookCtrlEvent& event );
|
||||
|
||||
PAGED_TREEBOOK* m_treebook;
|
||||
wxTreebook* m_treebook;
|
||||
wxButton* m_auxiliaryButton;
|
||||
wxButton* m_resetButton;
|
||||
wxButton* m_cancelButton;
|
||||
|
|
|
@ -68,23 +68,23 @@ DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
|
|||
* WARNING: If you change page names you MUST update calls to ShowBoardSetupDialog().
|
||||
*/
|
||||
|
||||
m_treebook->AddGroupEntry( _( "Board Stackup" ) );
|
||||
m_treebook->AddPage( new wxPanel( this ), _( "Board Stackup" ) );
|
||||
m_treebook->AddSubPage( m_layers, _( "Board Editor Layers" ) );
|
||||
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->AddGroupEntry( _( "Defaults" ) );
|
||||
m_treebook->AddPage( new wxPanel( this ), _( "Defaults" ) );
|
||||
m_treebook->AddSubPage( m_textAndGraphics, _( "Text & Graphics" ) );
|
||||
m_treebook->AddSubPage( m_tracksAndVias, _( "Tracks & Vias" ) );
|
||||
m_treebook->AddSubPage( m_maskAndPaste, _( "Solder Mask/Paste" ) );
|
||||
|
||||
m_treebook->AddGroupEntry( _( "Design Rules" ) );
|
||||
m_treebook->AddPage( new wxPanel( this ), _( "Design Rules" ) );
|
||||
m_treebook->AddSubPage( m_constraints, _( "Constraints" ) );
|
||||
m_treebook->AddSubPage( m_rules, _( "Rules" ) );
|
||||
m_treebook->AddSubPage( m_severities, _( "Violation Severity" ) );
|
||||
|
||||
m_treebook->AddGroupEntry( _( "Project" ) );
|
||||
m_treebook->AddPage( new wxPanel( this ), _( "Project" ) );
|
||||
m_treebook->AddSubPage( m_netclasses, _( "Net Classes" ) );
|
||||
m_treebook->AddSubPage( m_textVars, _( "Text Variables" ) );
|
||||
|
||||
|
|
|
@ -865,9 +865,9 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateLayerAlpha( wxUpdateUIEvent & )
|
|||
void FOOTPRINT_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
||||
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
|
||||
{
|
||||
PAGED_TREEBOOK* book = aParent->GetTreebook();
|
||||
wxTreebook* book = aParent->GetTreebook();
|
||||
|
||||
book->AddGroupEntry( _( "Footprint Editor" ) );
|
||||
book->AddPage( new wxPanel( book ), _( "Footprint Editor" ) );
|
||||
book->AddSubPage( new PANEL_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
|
||||
book->AddSubPage( new PANEL_MODEDIT_COLOR_SETTINGS( this, book ), _( "Colors" ) );
|
||||
book->AddSubPage( new PANEL_EDIT_OPTIONS( this, aParent ), _( "Editing Options" ) );
|
||||
|
|
|
@ -57,9 +57,9 @@ void PCB_EDIT_FRAME::On3DShapeLibWizard( wxCommandEvent& event )
|
|||
void PCB_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
||||
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
|
||||
{
|
||||
PAGED_TREEBOOK* book = aParent->GetTreebook();
|
||||
wxTreebook* book = aParent->GetTreebook();
|
||||
|
||||
book->AddGroupEntry( _( "Pcbnew" ) );
|
||||
book->AddPage( new wxPanel( book ), _( "Pcbnew" ) );
|
||||
book->AddSubPage( new PANEL_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
|
||||
book->AddSubPage( new PANEL_EDIT_OPTIONS( this, aParent ), _( "Editing Options" ) );
|
||||
book->AddSubPage( new PANEL_PCBNEW_COLOR_SETTINGS( this, book ), _( "Colors" ) );
|
||||
|
|
Loading…
Reference in New Issue