Add missing view controls for FP Editor Appearance Manager.

This commit is contained in:
Jeff Young 2021-10-30 23:21:15 +01:00
parent b6c12b6b55
commit e3ef101ec9
9 changed files with 91 additions and 16 deletions

View File

@ -30,6 +30,13 @@
class FOOTPRINT_EDITOR_SETTINGS : public APP_SETTINGS_BASE
{
public:
struct AUI_PANELS
{
int appearance_panel_tab;
int right_panel_width;
bool show_layer_manager;
};
struct USER_GRID
{
double size_x;
@ -52,6 +59,8 @@ public:
PCB_DISPLAY_OPTIONS m_Display;
AUI_PANELS m_AuiPanels;
USER_GRID m_UserGrid;
bool m_PolarCoords;

View File

@ -79,7 +79,7 @@
#include <wildcards_and_files_ext.h>
#include <wx/filedlg.h>
#include <wx/treebook.h>
#include <widgets/wx_aui_utils.h>
BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU( wxID_CLOSE, FOOTPRINT_EDIT_FRAME::CloseFootprintEditor )
@ -112,7 +112,8 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend ) :
PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_FOOTPRINT_EDITOR, wxEmptyString,
wxDefaultPosition, wxDefaultSize,
KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() )
KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() ),
m_show_layer_manager_tools( true )
{
m_showBorderAndTitleBlock = false; // true to show the frame references
m_canvasType = aBackend;
@ -248,6 +249,9 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" )
.Center() );
m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
// The selection filter doesn't need to grow in the vertical direction when docked
m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
@ -279,6 +283,14 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_appearancePanel->SetUserLayerPresets( cfg->m_LayerPresets );
m_appearancePanel->ApplyLayerPreset( cfg->m_ActiveLayerPreset );
if( cfg->m_AuiPanels.right_panel_width > 0 )
{
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
}
m_appearancePanel->SetTabIndex( cfg->m_AuiPanels.appearance_panel_tab );
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false );
UpdateTitle();
setupUnits( GetSettings() );
@ -360,6 +372,29 @@ void FOOTPRINT_EDIT_FRAME::ToggleSearchTree()
}
void FOOTPRINT_EDIT_FRAME::ToggleLayersManager()
{
FOOTPRINT_EDITOR_SETTINGS* settings = GetSettings();
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
wxAuiPaneInfo& selectionFilter = m_auimgr.GetPane( "SelectionFilter" );
// show auxiliary Vertical layers and visibility manager toolbar
m_show_layer_manager_tools = !m_show_layer_manager_tools;
layersManager.Show( m_show_layer_manager_tools );
selectionFilter.Show( m_show_layer_manager_tools );
if( m_show_layer_manager_tools )
{
SetAuiPaneSize( m_auimgr, layersManager, settings->m_AuiPanels.right_panel_width, -1 );
}
else
{
settings->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
m_auimgr.Update();
}
}
bool FOOTPRINT_EDIT_FRAME::IsSearchTreeShown()
{
return m_auimgr.GetPane( m_treePane ).IsShown();
@ -531,7 +566,8 @@ void FOOTPRINT_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
GetDesignSettings() = cfg->m_DesignSettings;
m_displayOptions = cfg->m_Display;
m_displayOptions = cfg->m_Display;
m_show_layer_manager_tools = cfg->m_AuiPanels.show_layer_manager;
GetToolManager()->GetTool<PCB_SELECTION_TOOL>()->GetFilter() = cfg->m_SelectionFilter;
m_selectionFilterPanel->SetCheckboxesFromFilter( cfg->m_SelectionFilter );
@ -554,6 +590,10 @@ void FOOTPRINT_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
cfg->m_LayerPresets = m_appearancePanel->GetUserLayerPresets();
cfg->m_ActiveLayerPreset = m_appearancePanel->GetActiveLayerPreset();
cfg->m_AuiPanels.show_layer_manager = m_show_layer_manager_tools;
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
cfg->m_AuiPanels.appearance_panel_tab = m_appearancePanel->GetTabIndex();
GetSettingsManager()->SaveColorSettings( GetColorSettings(), "board" );
}
@ -998,7 +1038,7 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions()
};
auto footprintTargettedCond =
[this] ( const SELECTION& )
[this]( const SELECTION& )
{
return !GetTargetFPID().GetLibItemName().empty();
};
@ -1054,7 +1094,7 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions()
auto highContrastCond =
[this] ( const SELECTION& )
[this]( const SELECTION& )
{
return GetDisplayOptions().m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL;
};
@ -1066,14 +1106,21 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions()
};
auto footprintTreeCond =
[this] (const SELECTION& )
[this](const SELECTION& )
{
return IsSearchTreeShown();
};
auto layerManagerCond =
[this]( const SELECTION& )
{
return m_auimgr.GetPane( "LayersManager" ).IsShown();
};
mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) );
mgr->SetConditions( PCB_ACTIONS::showFootprintTree, CHECK( footprintTreeCond ) );
mgr->SetConditions( PCB_ACTIONS::showLayersManager, CHECK( layerManagerCond ) );
mgr->SetConditions( ACTIONS::print, ENABLE( haveFootprintCond ) );
mgr->SetConditions( PCB_ACTIONS::exportFootprint, ENABLE( haveFootprintCond ) );

View File

@ -135,6 +135,7 @@ public:
bool IsSearchTreeShown();
void ToggleSearchTree();
void ToggleLayersManager();
/**
* Save a library to a new name and/or library type.
@ -345,9 +346,10 @@ private:
FOOTPRINT_TREE_PANE* m_treePane;
LIB_ID m_centerItemOnIdle;
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> m_adapter;
bool m_show_layer_manager_tools;
std::unique_ptr<FOOTPRINT> m_revertModule;
wxString m_footprintNameWhenLoaded;
std::map<KIID, KIID> m_boardFootprintUuids;

View File

@ -56,6 +56,15 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
m_params.emplace_back( new PARAM<int>( "window.lib_width",
&m_LibWidth, 250 ) );
m_params.emplace_back( new PARAM<bool>( "aui.show_layer_manager",
&m_AuiPanels.show_layer_manager, true ) );
m_params.emplace_back( new PARAM<int>( "aui.right_panel_width",
&m_AuiPanels.right_panel_width, -1 ) );
m_params.emplace_back( new PARAM<int>( "aui.appearance_panel_tab",
&m_AuiPanels.appearance_panel_tab, 0, 0, 2 ) );
m_params.emplace_back( new PARAM<wxString>( "system.last_import_export_path",
&m_LastImportExportPath, "" ) );

View File

@ -169,6 +169,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
viewMenu->AppendSeparator();
viewMenu->Add( PCB_ACTIONS::showFootprintTree, ACTION_MENU::CHECK );
viewMenu->Add( PCB_ACTIONS::showLayersManager, ACTION_MENU::CHECK );
//-- Place menu -------------------------------------------------------

View File

@ -208,6 +208,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::showFootprintTree, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::showLayersManager, ACTION_TOOLBAR::TOGGLE );
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );

View File

@ -754,11 +754,12 @@ void PCB_EDIT_FRAME::ToggleLayersManager()
{
PCBNEW_SETTINGS* settings = GetPcbNewSettings();
wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
wxAuiPaneInfo& selectionFilter = m_auimgr.GetPane( "SelectionFilter" );
// show auxiliary Vertical layers and visibility manager toolbar
m_show_layer_manager_tools = !m_show_layer_manager_tools;
layersManager.Show( m_show_layer_manager_tools );
m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
selectionFilter.Show( m_show_layer_manager_tools );
if( m_show_layer_manager_tools )
{

View File

@ -455,6 +455,13 @@ int FOOTPRINT_EDITOR_CONTROL::ToggleFootprintTree( const TOOL_EVENT& aEvent )
}
int FOOTPRINT_EDITOR_CONTROL::ToggleLayersManager( const TOOL_EVENT& aEvent )
{
m_frame->ToggleLayersManager();
return 0;
}
int FOOTPRINT_EDITOR_CONTROL::Properties( const TOOL_EVENT& aEvent )
{
FOOTPRINT* footprint = m_frame->GetBoard()->GetFirstFootprint();
@ -613,12 +620,9 @@ void FOOTPRINT_EDITOR_CONTROL::setTransitions()
Go( &FOOTPRINT_EDITOR_CONTROL::PinLibrary, ACTIONS::pinLibrary.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::UnpinLibrary, ACTIONS::unpinLibrary.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::ToggleFootprintTree,
PCB_ACTIONS::showFootprintTree.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::ToggleFootprintTree,
PCB_ACTIONS::hideFootprintTree.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::Properties,
PCB_ACTIONS::footprintProperties.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::DefaultPadProperties,
PCB_ACTIONS::defaultPadProperties.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::ToggleFootprintTree, PCB_ACTIONS::showFootprintTree.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::ToggleFootprintTree, PCB_ACTIONS::hideFootprintTree.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::Properties, PCB_ACTIONS::footprintProperties.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::DefaultPadProperties, PCB_ACTIONS::defaultPadProperties.MakeEvent() );
Go( &FOOTPRINT_EDITOR_CONTROL::ToggleLayersManager, PCB_ACTIONS::showLayersManager.MakeEvent() );
}

View File

@ -65,6 +65,7 @@ public:
int PinLibrary( const TOOL_EVENT& aEvent );
int UnpinLibrary( const TOOL_EVENT& aEvent );
int ToggleFootprintTree( const TOOL_EVENT& aEvent );
int ToggleLayersManager( const TOOL_EVENT& aEvent );
int Properties( const TOOL_EVENT& aEvent );
int CleanupGraphics( const TOOL_EVENT& aEvent );