Browse Source

Add "Hide Tree" context menu options when tree has no selection.

Also cleans up some other code to be more consistent between symbol
editor and footprint editor.

Fixes https://gitlab.com/kicad/code/kicad/issues/8052
6.0.7
Jeff Young 5 years ago
parent
commit
f2e68e68d0
  1. 5
      eeschema/tools/ee_actions.cpp
  2. 1
      eeschema/tools/ee_actions.h
  3. 8
      eeschema/tools/symbol_editor_control.cpp
  4. 2
      eeschema/tools/symbol_editor_control.h
  5. 2
      pcbnew/footprint_edit_frame.cpp
  6. 2
      pcbnew/menubar_footprint_editor.cpp
  7. 2
      pcbnew/toolbars_footprint_editor.cpp
  8. 6
      pcbnew/tools/footprint_editor_control.cpp
  9. 9
      pcbnew/tools/pcb_actions.cpp
  10. 3
      pcbnew/tools/pcb_actions.h

5
eeschema/tools/ee_actions.cpp

@ -188,6 +188,11 @@ TOOL_ACTION EE_ACTIONS::showSymbolTree( "eeschema.SymbolLibraryControl.showSymbo
_( "Show Symbol Tree" ), "",
BITMAPS::search_tree );
TOOL_ACTION EE_ACTIONS::hideSymbolTree( "eeschema.SymbolLibraryControl.hideSymbolTree",
AS_GLOBAL, 0, "",
_( "Hide Symbol Tree" ), "",
BITMAPS::search_tree );
TOOL_ACTION EE_ACTIONS::exportSymbolView( "eeschema.SymbolLibraryControl.exportSymbolView",
AS_GLOBAL, 0, "",
_( "Export View as PNG..." ), _( "Create PNG file from the current view" ),

1
eeschema/tools/ee_actions.h

@ -199,6 +199,7 @@ public:
static TOOL_ACTION pushPinNumSize;
static TOOL_ACTION showElectricalTypes;
static TOOL_ACTION showSymbolTree;
static TOOL_ACTION hideSymbolTree;
static TOOL_ACTION toggleForceHV;
static TOOL_ACTION drawSheetOnClipboard;
static TOOL_ACTION exportSymbolView;

8
eeschema/tools/symbol_editor_control.cpp

@ -112,6 +112,9 @@ bool SYMBOL_EDITOR_CONTROL::Init()
ctxMenu.AddSeparator();
ctxMenu.AddItem( EE_ACTIONS::importSymbol, libInferredCondition );
ctxMenu.AddItem( EE_ACTIONS::exportSymbol, symbolSelectedCondition );
// If we've got nothing else to show, at least show a hide tree option
ctxMenu.AddItem( EE_ACTIONS::hideSymbolTree, !libInferredCondition );
}
return true;
@ -332,7 +335,7 @@ int SYMBOL_EDITOR_CONTROL::UnpinLibrary( const TOOL_EVENT& aEvent )
}
int SYMBOL_EDITOR_CONTROL::ShowSymbolTree( const TOOL_EVENT& aEvent )
int SYMBOL_EDITOR_CONTROL::ToggleSymbolTree( const TOOL_EVENT& aEvent )
{
if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
{
@ -551,6 +554,7 @@ void SYMBOL_EDITOR_CONTROL::setTransitions()
Go( &SYMBOL_EDITOR_CONTROL::ShowElectricalTypes, EE_ACTIONS::showElectricalTypes.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::PinLibrary, ACTIONS::pinLibrary.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::UnpinLibrary, ACTIONS::unpinLibrary.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ShowSymbolTree, EE_ACTIONS::showSymbolTree.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ToggleSymbolTree, EE_ACTIONS::showSymbolTree.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ToggleSymbolTree, EE_ACTIONS::hideSymbolTree.MakeEvent() );
Go( &SYMBOL_EDITOR_CONTROL::ToggleSyncedPinsMode, EE_ACTIONS::toggleSyncedPinsMode.MakeEvent() );
}

2
eeschema/tools/symbol_editor_control.h

@ -65,7 +65,7 @@ public:
int ShowElectricalTypes( const TOOL_EVENT& aEvent );
int PinLibrary( const TOOL_EVENT& aEvent );
int UnpinLibrary( const TOOL_EVENT& aEvent );
int ShowSymbolTree( const TOOL_EVENT& aEvent );
int ToggleSymbolTree( const TOOL_EVENT& aEvent );
int ToggleSyncedPinsMode( const TOOL_EVENT& aEvent );
private:

2
pcbnew/footprint_edit_frame.cpp

@ -1046,7 +1046,7 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) );
mgr->SetConditions( PCB_ACTIONS::toggleFootprintTree, CHECK( footprintTreeCond ) );
mgr->SetConditions( PCB_ACTIONS::showFootprintTree, CHECK( footprintTreeCond ) );
mgr->SetConditions( ACTIONS::print, ENABLE( haveFootprintCond ) );
mgr->SetConditions( PCB_ACTIONS::exportFootprint, ENABLE( haveFootprintCond ) );

2
pcbnew/menubar_footprint_editor.cpp

@ -171,7 +171,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
viewMenu->Add( PCB_ACTIONS::flipBoard, ACTION_MENU::CHECK );
viewMenu->AppendSeparator();
viewMenu->Add( PCB_ACTIONS::toggleFootprintTree, ACTION_MENU::CHECK );
viewMenu->Add( PCB_ACTIONS::showFootprintTree, ACTION_MENU::CHECK );
//-- Place menu -------------------------------------------------------

2
pcbnew/toolbars_footprint_editor.cpp

@ -207,7 +207,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::toggleFootprintTree, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::showFootprintTree, 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 );

6
pcbnew/tools/footprint_editor_control.cpp

@ -129,6 +129,9 @@ bool FOOTPRINT_EDITOR_CONTROL::Init()
ctxMenu.AddItem( PCB_ACTIONS::importFootprint, libInferredCondition );
ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpSelectedCondition );
// If we've got nothing else to show, at least show a hide tree option
ctxMenu.AddItem( PCB_ACTIONS::hideFootprintTree, !libInferredCondition );
return true;
}
@ -524,7 +527,8 @@ 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::toggleFootprintTree.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() );
}

9
pcbnew/tools/pcb_actions.cpp

@ -335,9 +335,14 @@ TOOL_ACTION PCB_ACTIONS::properties( "pcbnew.InteractiveEdit.properties",
// FOOTPRINT_EDITOR_CONTROL
//
TOOL_ACTION PCB_ACTIONS::toggleFootprintTree( "pcbnew.ModuleEditor.toggleFootprintTree",
TOOL_ACTION PCB_ACTIONS::showFootprintTree( "pcbnew.ModuleEditor.showFootprintTree",
AS_GLOBAL, 0, "",
_( "Show Footprint Tree" ), _( "Toggles the footprint tree visibility" ),
_( "Show Footprint Tree" ), "",
BITMAPS::search_tree );
TOOL_ACTION PCB_ACTIONS::hideFootprintTree( "pcbnew.ModuleEditor.hideFootprintTree",
AS_GLOBAL, 0, "",
_( "Hide Footprint Tree" ), "",
BITMAPS::search_tree );
TOOL_ACTION PCB_ACTIONS::newFootprint( "pcbnew.ModuleEditor.newFootprint",

3
pcbnew/tools/pcb_actions.h

@ -350,7 +350,8 @@ public:
// Module editor tools
static TOOL_ACTION toggleFootprintTree;
static TOOL_ACTION showFootprintTree;
static TOOL_ACTION hideFootprintTree;
// We don't use ACTION::new here because we need to distinguish between New Library
// and New Footprint.

Loading…
Cancel
Save