Add show/hide search tree to modedit, and fix it in libedit.

Fixes: lp:1801531
* https://bugs.launchpad.net/kicad/+bug/1801531
This commit is contained in:
Jeff Young 2018-11-04 00:58:28 +00:00
parent 6e810a00e4
commit 68b07d1aff
7 changed files with 40 additions and 5 deletions

View File

@ -428,8 +428,7 @@ void LIB_EDIT_FRAME::OnUpdateElectricalType( wxUpdateUIEvent& aEvent )
void LIB_EDIT_FRAME::OnUpdateSearchTreeTool( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetEventObject() == m_optionsToolBar )
aEvent.Check( IsSearchTreeShown() );
aEvent.Check( IsSearchTreeShown() );
}

View File

@ -225,7 +225,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
ID_LIBEDIT_SHOW_HIDE_SEARCH_TREE,
_( "&Search Tree" ),
_( "Toggles the search tree visibility" ),
KiBitmap( search_tree_xpm ) );
KiBitmap( search_tree_xpm ), wxITEM_CHECK );
// Menu Place:
wxMenu* placeMenu = new wxMenu;

View File

@ -133,6 +133,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
// ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH id is managed in PCB_BASE_FRAME
// ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH id is managed in PCB_BASE_FRAME
EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_MODEDIT_SHOW_HIDE_SEARCH_TREE, FOOTPRINT_EDIT_FRAME::OnToggleSearchTree )
// Preferences and option menus
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
@ -200,6 +201,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
// Option toolbar:
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar )
EVT_UPDATE_UI( ID_MODEDIT_SHOW_HIDE_SEARCH_TREE,
FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar )
EVT_UPDATE_UI( ID_GEN_IMPORT_DXF_FILE, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
@ -345,6 +348,21 @@ void FOOTPRINT_EDIT_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent )
UpdateUserInterface();
}
void FOOTPRINT_EDIT_FRAME::OnToggleSearchTree( wxCommandEvent& event )
{
auto& treePane = m_auimgr.GetPane( m_treePane );
treePane.Show( !IsSearchTreeShown() );
m_auimgr.Update();
}
bool FOOTPRINT_EDIT_FRAME::IsSearchTreeShown()
{
return m_auimgr.GetPane( m_treePane ).IsShown();
}
BOARD_ITEM_CONTAINER* FOOTPRINT_EDIT_FRAME::GetModel() const
{
return GetBoard()->m_Modules;
@ -577,6 +595,10 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent )
state = displ_opts->m_ContrastModeDisplay;
break;
case ID_MODEDIT_SHOW_HIDE_SEARCH_TREE:
state = IsSearchTreeShown();
break;
default:
wxMessageBox( "FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar error" );
break;

View File

@ -153,6 +153,9 @@ public:
void ToolOnRightClick( wxCommandEvent& event ) override;
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnConfigurePaths( wxCommandEvent& aEvent );
void OnToggleSearchTree( wxCommandEvent& event );
bool IsSearchTreeShown();
/**
* Function SaveLibraryAs

View File

@ -315,9 +315,14 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
_( "Select how items are displayed" ),
KiBitmap( contrast_mode_xpm ) );
#ifdef __APPLE__
// Separator
viewMenu->AppendSeparator();
#endif
AddMenuItem( viewMenu,
ID_MODEDIT_SHOW_HIDE_SEARCH_TREE,
_( "&Search Tree" ),
_( "Toggles the search tree visibility" ),
KiBitmap( search_tree_xpm ), wxITEM_CHECK );
//-------- Place menu --------------------

View File

@ -369,6 +369,7 @@ enum pcbnew_ids
ID_MODEDIT_MODULE_MOVE_EXACT,
ID_MODEDIT_IMPORT_PART,
ID_MODEDIT_EXPORT_PART,
ID_MODEDIT_SHOW_HIDE_SEARCH_TREE,
ID_POPUP_MODEDIT_EDIT_BODY_ITEM,
ID_MODVIEW_LIB_LIST,

View File

@ -234,6 +234,11 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
_( "Enable high contrast display mode" ),
wxITEM_CHECK );
KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_MODEDIT_SHOW_HIDE_SEARCH_TREE, wxEmptyString,
KiScaledBitmap( search_tree_xpm, this ),
_( "Toggles the search tree" ), wxITEM_CHECK );
m_optionsToolBar->Realize();
}