Make preference groups not selectable
This commit is contained in:
parent
20c1492b6a
commit
3b727b5d16
|
@ -35,6 +35,48 @@ 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,
|
||||
|
@ -49,7 +91,7 @@ PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aUse
|
|||
auto mainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
SetSizer( mainSizer );
|
||||
|
||||
m_treebook = new wxTreebook( this, wxID_ANY );
|
||||
m_treebook = new PAGED_TREEBOOK( this, wxID_ANY );
|
||||
mainSizer->Add( m_treebook, 1, wxEXPAND|wxLEFT|wxTOP, 10 );
|
||||
|
||||
auto line = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
|
|
|
@ -62,15 +62,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->AddPage( new wxPanel( this ), _( "General" ) );
|
||||
m_treebook->AddGroupEntry( _( "General" ) );
|
||||
m_treebook->AddSubPage( m_formatting, _( "Formatting" ) );
|
||||
m_treebook->AddSubPage( m_fieldNameTemplates, _( "Field Name Templates" ) );
|
||||
|
||||
m_treebook->AddPage( new wxPanel( this ), _( "Electrical Rules" ) );
|
||||
m_treebook->AddGroupEntry( _( "Electrical Rules" ) );
|
||||
m_treebook->AddSubPage( m_severities, _( "Violation Severity" ) );
|
||||
m_treebook->AddSubPage( m_pinMap, _( "Pin Conflicts Map" ) );
|
||||
|
||||
m_treebook->AddPage( new wxPanel( this ), _( "Project" ) );
|
||||
m_treebook->AddGroupEntry( _( "Project" ) );
|
||||
m_treebook->AddSubPage( m_netclasses, _( "Net Classes" ) );
|
||||
m_treebook->AddSubPage( m_textVars, _( "Text Variables" ) );
|
||||
|
||||
|
|
|
@ -219,9 +219,9 @@ COLOR4D GetInvisibleItemColor()
|
|||
void SCH_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
||||
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
|
||||
{
|
||||
wxTreebook* book = aParent->GetTreebook();
|
||||
PAGED_TREEBOOK* book = aParent->GetTreebook();
|
||||
|
||||
book->AddPage( new wxPanel( book ), _( "Eeschema" ) );
|
||||
book->AddGroupEntry( _( "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" ) );
|
||||
|
@ -425,9 +425,9 @@ void SCH_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
void LIB_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
||||
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
|
||||
{
|
||||
wxTreebook* book = aParent->GetTreebook();
|
||||
PAGED_TREEBOOK* book = aParent->GetTreebook();
|
||||
|
||||
book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) );
|
||||
book->AddGroupEntry( _( "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" ) );
|
||||
|
|
|
@ -1137,9 +1137,9 @@ void GERBVIEW_FRAME::ActivateGalCanvas()
|
|||
void GERBVIEW_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
||||
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
|
||||
{
|
||||
wxTreebook* book = aParent->GetTreebook();
|
||||
PAGED_TREEBOOK* book = aParent->GetTreebook();
|
||||
|
||||
book->AddPage( new wxPanel( book ), _( "Gerbview" ) );
|
||||
book->AddGroupEntry( _( "Gerbview" ) );
|
||||
book->AddSubPage( new PANEL_GERBVIEW_DISPLAY_OPTIONS( this, book ), _( "Display Options" ) );
|
||||
book->AddSubPage( new PANEL_GERBVIEW_SETTINGS( this, book ), _( "Editing Options" ) );
|
||||
|
||||
|
|
|
@ -25,6 +25,22 @@
|
|||
#include <wx/treebook.h>
|
||||
|
||||
|
||||
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:
|
||||
|
@ -42,7 +58,7 @@ public:
|
|||
const wxString& aAuxiliaryAction = wxEmptyString );
|
||||
~PAGED_DIALOG() override;
|
||||
|
||||
wxTreebook* GetTreebook() { return m_treebook; }
|
||||
PAGED_TREEBOOK* GetTreebook() { return m_treebook; }
|
||||
|
||||
void SetInitialPage( const wxString& aPage, const wxString& aParentPage = wxEmptyString );
|
||||
|
||||
|
@ -62,8 +78,9 @@ protected:
|
|||
void OnResetButton( wxCommandEvent& aEvent );
|
||||
void OnUpdateUI( wxUpdateUIEvent& event );
|
||||
void OnPageChange( wxBookCtrlEvent& event );
|
||||
void OnPageChanging( wxBookCtrlEvent& aEvent );
|
||||
|
||||
wxTreebook* m_treebook;
|
||||
PAGED_TREEBOOK* m_treebook;
|
||||
wxButton* m_auxiliaryButton;
|
||||
wxButton* m_resetButton;
|
||||
};
|
||||
|
|
|
@ -67,23 +67,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->AddPage( new wxPanel( this ), _( "Board Stackup" ) );
|
||||
m_treebook->AddGroupEntry( _( "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->AddPage( new wxPanel( this ), _( "Defaults" ) );
|
||||
m_treebook->AddGroupEntry( _( "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->AddPage( new wxPanel( this ), _( "Design Rules" ) );
|
||||
m_treebook->AddGroupEntry( _( "Design Rules" ) );
|
||||
m_treebook->AddSubPage( m_constraints, _( "Constraints" ) );
|
||||
m_treebook->AddSubPage( m_rules, _( "Rules" ) );
|
||||
m_treebook->AddSubPage( m_severities, _( "Violation Severity" ) );
|
||||
|
||||
m_treebook->AddPage( new wxPanel( this ), _( "Project" ) );
|
||||
m_treebook->AddGroupEntry( _( "Project" ) );
|
||||
m_treebook->AddSubPage( m_netclasses, _( "Net Classes" ) );
|
||||
m_treebook->AddSubPage( m_textVars, _( "Text Variables" ) );
|
||||
|
||||
|
|
|
@ -824,9 +824,9 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateLayerAlpha( wxUpdateUIEvent & )
|
|||
void FOOTPRINT_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
||||
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
|
||||
{
|
||||
wxTreebook* book = aParent->GetTreebook();
|
||||
PAGED_TREEBOOK* book = aParent->GetTreebook();
|
||||
|
||||
book->AddPage( new wxPanel( book ), _( "Footprint Editor" ) );
|
||||
book->AddGroupEntry( _( "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" ) );
|
||||
|
|
|
@ -66,9 +66,9 @@ void PCB_EDIT_FRAME::On3DShapeLibWizard( wxCommandEvent& event )
|
|||
void PCB_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
||||
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
|
||||
{
|
||||
wxTreebook* book = aParent->GetTreebook();
|
||||
PAGED_TREEBOOK* book = aParent->GetTreebook();
|
||||
|
||||
book->AddPage( new wxPanel( book ), _( "Pcbnew" ) );
|
||||
book->AddGroupEntry( _( "Pcbnew" ) );
|
||||
book->AddSubPage( new PANEL_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
|
||||
book->AddSubPage( new PANEL_PCBNEW_COLOR_SETTINGS( this, book ), _( "Colors" ) );
|
||||
book->AddSubPage( new PANEL_EDIT_OPTIONS( this, aParent ), _( "Editing Options" ) );
|
||||
|
|
Loading…
Reference in New Issue