Symbol editor: disable tools and menu entries for derived symbols.
This commit is contained in:
parent
616ac50cfb
commit
3fa2bad3c5
|
@ -53,10 +53,9 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
|||
return ( !readOnly && m_libMgr->IsPartModified( partName, libName ) );
|
||||
};
|
||||
|
||||
auto saveAllEnableCondition = [this] ( const SELECTION& sel )
|
||||
{
|
||||
return m_libMgr->HasModifications();
|
||||
};
|
||||
auto saveAllEnableCondition = [this] ( const SELECTION& sel ) {
|
||||
return m_libMgr->HasModifications();
|
||||
};
|
||||
|
||||
//-- File menu -----------------------------------------------
|
||||
//
|
||||
|
@ -100,9 +99,12 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
|||
auto enableRedoCondition = [ this ] ( const SELECTION& sel ) {
|
||||
return m_my_part && GetScreen() && GetScreen()->GetRedoCommandCount() != 0;
|
||||
};
|
||||
auto havePartCondition = [ this ] ( const SELECTION& sel ) {
|
||||
auto haveSymbolCondition = [ this ] ( const SELECTION& sel ) {
|
||||
return m_my_part != nullptr;
|
||||
};
|
||||
auto isRootSymbolCondition = [ this ] ( const SELECTION& sel ) {
|
||||
return m_my_part != nullptr && m_my_part->IsRoot();
|
||||
};
|
||||
|
||||
editMenu->AddItem( ACTIONS::undo, enableUndoCondition );
|
||||
editMenu->AddItem( ACTIONS::redo, enableRedoCondition );
|
||||
|
@ -115,8 +117,8 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
|||
editMenu->AddItem( ACTIONS::duplicate, EE_CONDITIONS::NotEmpty );
|
||||
|
||||
editMenu->AddSeparator();
|
||||
editMenu->AddItem( EE_ACTIONS::symbolProperties, havePartCondition );
|
||||
editMenu->AddItem( EE_ACTIONS::pinTable, havePartCondition );
|
||||
editMenu->AddItem( EE_ACTIONS::symbolProperties, haveSymbolCondition );
|
||||
editMenu->AddItem( EE_ACTIONS::pinTable, isRootSymbolCondition );
|
||||
|
||||
editMenu->Resolve();
|
||||
|
||||
|
@ -170,18 +172,14 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
|||
|
||||
//-- Place menu -----------------------------------------------
|
||||
//
|
||||
auto enableIsEditableCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return m_my_part && m_my_part->IsRoot();
|
||||
};
|
||||
|
||||
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
|
||||
placeMenu->AddItem( EE_ACTIONS::placeSymbolPin, enableIsEditableCondition );
|
||||
placeMenu->AddItem( EE_ACTIONS::placeSymbolText, enableIsEditableCondition );
|
||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolRectangle, enableIsEditableCondition );
|
||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolCircle, enableIsEditableCondition );
|
||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolArc, enableIsEditableCondition );
|
||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolLines, enableIsEditableCondition );
|
||||
placeMenu->AddItem( EE_ACTIONS::placeSymbolPin, isRootSymbolCondition );
|
||||
placeMenu->AddItem( EE_ACTIONS::placeSymbolText, isRootSymbolCondition );
|
||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolRectangle, isRootSymbolCondition );
|
||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolCircle, isRootSymbolCondition );
|
||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolArc, isRootSymbolCondition );
|
||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolLines, isRootSymbolCondition );
|
||||
|
||||
placeMenu->Resolve();
|
||||
|
||||
|
@ -189,12 +187,8 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
|||
//
|
||||
CONDITIONAL_MENU* inspectMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
|
||||
auto datasheetAvailableCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return GetCurPart() != nullptr;
|
||||
};
|
||||
|
||||
inspectMenu->AddItem( EE_ACTIONS::showDatasheet, datasheetAvailableCondition );
|
||||
inspectMenu->AddItem( EE_ACTIONS::runERC, EE_CONDITIONS::ShowAlways );
|
||||
inspectMenu->AddItem( EE_ACTIONS::showDatasheet, haveSymbolCondition );
|
||||
inspectMenu->AddItem( EE_ACTIONS::runERC, isRootSymbolCondition );
|
||||
|
||||
inspectMenu->Resolve();
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -114,9 +114,9 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
|
|||
KiScaledSeparator( m_mainToolBar, this );
|
||||
|
||||
if( m_unitSelectBox == nullptr )
|
||||
m_unitSelectBox = new wxComboBox( m_mainToolBar, ID_LIBEDIT_SELECT_PART_NUMBER, wxEmptyString,
|
||||
wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ), 0, nullptr,
|
||||
wxCB_READONLY );
|
||||
m_unitSelectBox = new wxComboBox( m_mainToolBar, ID_LIBEDIT_SELECT_PART_NUMBER,
|
||||
wxEmptyString, wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ), 0,
|
||||
nullptr, wxCB_READONLY );
|
||||
m_mainToolBar->AddControl( m_unitSelectBox );
|
||||
|
||||
KiScaledSeparator( m_mainToolBar, this );
|
||||
|
@ -160,10 +160,13 @@ void LIB_EDIT_FRAME::SyncToolbars()
|
|||
bool isEditable = m_my_part && m_my_part->IsRoot();
|
||||
|
||||
m_mainToolBar->Toggle( ACTIONS::saveAll, m_libMgr->HasModifications() );
|
||||
m_mainToolBar->Toggle( ACTIONS::undo, GetScreen() && GetScreen()->GetUndoCommandCount() > 0 );
|
||||
m_mainToolBar->Toggle( ACTIONS::redo, GetScreen() && GetScreen()->GetRedoCommandCount() > 0 );
|
||||
m_mainToolBar->Toggle( ACTIONS::undo,
|
||||
GetScreen() && GetScreen()->GetUndoCommandCount() > 0 );
|
||||
m_mainToolBar->Toggle( ACTIONS::redo,
|
||||
GetScreen() && GetScreen()->GetRedoCommandCount() > 0 );
|
||||
m_mainToolBar->Toggle( ACTIONS::zoomTool, IsCurrentTool( ACTIONS::zoomTool ) );
|
||||
m_mainToolBar->Toggle( EE_ACTIONS::showDatasheet, (bool) m_my_part );
|
||||
m_mainToolBar->Toggle( EE_ACTIONS::runERC, isEditable );
|
||||
m_mainToolBar->Toggle( EE_ACTIONS::showDeMorganStandard,
|
||||
GetShowDeMorgan(),
|
||||
m_convert == LIB_ITEM::LIB_CONVERT::BASE );
|
||||
|
@ -177,8 +180,10 @@ void LIB_EDIT_FRAME::SyncToolbars()
|
|||
m_mainToolBar->Refresh();
|
||||
|
||||
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
|
||||
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES );
|
||||
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES );
|
||||
m_optionsToolBar->Toggle( ACTIONS::metricUnits,
|
||||
GetUserUnits() != EDA_UNITS::INCHES );
|
||||
m_optionsToolBar->Toggle( ACTIONS::imperialUnits,
|
||||
GetUserUnits() == EDA_UNITS::INCHES );
|
||||
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor );
|
||||
m_optionsToolBar->Toggle( EE_ACTIONS::showElectricalTypes, settings->m_ShowPinsElectricalType );
|
||||
m_optionsToolBar->Toggle( EE_ACTIONS::showComponentTree, IsSearchTreeShown() );
|
||||
|
|
Loading…
Reference in New Issue