Migrate eeschema, libview and libedit to the UI condition framework
Also, fix some issues in other frames identified along the way.
This commit is contained in:
parent
75bc1ef6a7
commit
fd4388710d
|
@ -94,7 +94,7 @@ SELECTION_CONDITION EDITOR_CONDITIONS::FullscreenCursor()
|
||||||
|
|
||||||
wxASSERT( drwFrame );
|
wxASSERT( drwFrame );
|
||||||
|
|
||||||
return std::bind( &EDITOR_CONDITIONS::gridFunc, _1, drwFrame );
|
return std::bind( &EDITOR_CONDITIONS::cursorFunc, _1, drwFrame );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME()
|
||||||
|
|
||||||
void DISPLAY_FOOTPRINTS_FRAME::setupUIConditions()
|
void DISPLAY_FOOTPRINTS_FRAME::setupUIConditions()
|
||||||
{
|
{
|
||||||
EDA_BASE_FRAME::setupUIConditions();
|
PCB_BASE_FRAME::setupUIConditions();
|
||||||
|
|
||||||
ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
|
ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
|
||||||
EDITOR_CONDITIONS cond( this );
|
EDITOR_CONDITIONS cond( this );
|
||||||
|
|
|
@ -42,11 +42,13 @@
|
||||||
#include <symbol_tree_model_adapter.h>
|
#include <symbol_tree_model_adapter.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <settings/settings_manager.h>
|
#include <settings/settings_manager.h>
|
||||||
#include <tool/tool_manager.h>
|
|
||||||
#include <tool/action_toolbar.h>
|
#include <tool/action_toolbar.h>
|
||||||
#include <tool/tool_dispatcher.h>
|
|
||||||
#include <tool/common_tools.h>
|
|
||||||
#include <tool/common_control.h>
|
#include <tool/common_control.h>
|
||||||
|
#include <tool/common_tools.h>
|
||||||
|
#include <tool/editor_conditions.h>
|
||||||
|
#include <tool/selection.h>
|
||||||
|
#include <tool/tool_dispatcher.h>
|
||||||
|
#include <tool/tool_manager.h>
|
||||||
#include <tool/zoom_tool.h>
|
#include <tool/zoom_tool.h>
|
||||||
#include <tools/ee_actions.h>
|
#include <tools/ee_actions.h>
|
||||||
#include <tools/lib_control.h>
|
#include <tools/lib_control.h>
|
||||||
|
@ -140,6 +142,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
||||||
GetRenderSettings()->SetDefaultPenWidth( DEFAULT_LINE_THICKNESS * IU_PER_MILS );
|
GetRenderSettings()->SetDefaultPenWidth( DEFAULT_LINE_THICKNESS * IU_PER_MILS );
|
||||||
|
|
||||||
setupTools();
|
setupTools();
|
||||||
|
setupUIConditions();
|
||||||
|
|
||||||
ReCreateHToolbar();
|
ReCreateHToolbar();
|
||||||
ReCreateVToolbar();
|
ReCreateVToolbar();
|
||||||
|
@ -244,6 +247,67 @@ void LIB_VIEW_FRAME::setupTools()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LIB_VIEW_FRAME::setupUIConditions()
|
||||||
|
{
|
||||||
|
SCH_BASE_FRAME::setupUIConditions();
|
||||||
|
|
||||||
|
ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
|
||||||
|
EDITOR_CONDITIONS cond( this );
|
||||||
|
|
||||||
|
wxASSERT( mgr );
|
||||||
|
|
||||||
|
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
|
||||||
|
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
|
||||||
|
|
||||||
|
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
|
||||||
|
|
||||||
|
auto electricalTypesShownCondition =
|
||||||
|
[this] ( const SELECTION& aSel )
|
||||||
|
{
|
||||||
|
return GetRenderSettings()->m_ShowPinsElectricalType;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto demorganCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
LIB_PART* symbol = GetSelectedSymbol();
|
||||||
|
|
||||||
|
return symbol && symbol->HasConversion();
|
||||||
|
};
|
||||||
|
|
||||||
|
auto demorganStandardCond =
|
||||||
|
[] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
return m_convert == LIB_ITEM::LIB_CONVERT::BASE;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto demorganAlternateCond =
|
||||||
|
[] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
return m_convert == LIB_ITEM::LIB_CONVERT::DEMORGAN;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto haveDatasheetCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
LIB_PART* symbol = GetSelectedSymbol();
|
||||||
|
|
||||||
|
return symbol && !symbol->GetDatasheetField().GetText().IsEmpty();
|
||||||
|
};
|
||||||
|
|
||||||
|
mgr->SetConditions( EE_ACTIONS::showDatasheet, ENABLE( haveDatasheetCond ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::showElectricalTypes, CHECK( electricalTypesShownCondition ) );
|
||||||
|
|
||||||
|
mgr->SetConditions( EE_ACTIONS::showDeMorganStandard,
|
||||||
|
ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganStandardCond ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::showDeMorganAlternate,
|
||||||
|
ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganAlternateCond ) );
|
||||||
|
|
||||||
|
#undef CHECK
|
||||||
|
#undef ENABLE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_VIEW_FRAME::SetUnitAndConvert( int aUnit, int aConvert )
|
void LIB_VIEW_FRAME::SetUnitAndConvert( int aUnit, int aConvert )
|
||||||
{
|
{
|
||||||
m_unit = aUnit > 0 ? aUnit : 1;
|
m_unit = aUnit > 0 ? aUnit : 1;
|
||||||
|
@ -836,3 +900,8 @@ void LIB_VIEW_FRAME::DisplayLibInfos()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SELECTION& LIB_VIEW_FRAME::GetCurrentSelection()
|
||||||
|
{
|
||||||
|
return m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include <sch_base_frame.h>
|
#include <sch_base_frame.h>
|
||||||
#include <sch_screen.h>
|
#include <sch_screen.h>
|
||||||
|
#include <tool/selection.h>
|
||||||
|
|
||||||
class wxListBox;
|
class wxListBox;
|
||||||
class SCHLIB_FILTER;
|
class SCHLIB_FILTER;
|
||||||
|
@ -144,7 +145,10 @@ public:
|
||||||
|
|
||||||
const BOX2I GetDocumentExtents() const override;
|
const BOX2I GetDocumentExtents() const override;
|
||||||
|
|
||||||
void SyncToolbars() override;
|
SELECTION& GetCurrentSelection() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void setupUIConditions() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Sets up the tool framework
|
// Sets up the tool framework
|
||||||
|
|
|
@ -42,10 +42,13 @@
|
||||||
#include <sch_view.h>
|
#include <sch_view.h>
|
||||||
#include <settings/settings_manager.h>
|
#include <settings/settings_manager.h>
|
||||||
#include <symbol_lib_table.h>
|
#include <symbol_lib_table.h>
|
||||||
|
#include <tool/action_manager.h>
|
||||||
#include <tool/action_toolbar.h>
|
#include <tool/action_toolbar.h>
|
||||||
#include <tool/common_control.h>
|
#include <tool/common_control.h>
|
||||||
#include <tool/common_tools.h>
|
#include <tool/common_tools.h>
|
||||||
|
#include <tool/editor_conditions.h>
|
||||||
#include <tool/picker_tool.h>
|
#include <tool/picker_tool.h>
|
||||||
|
#include <tool/selection.h>
|
||||||
#include <tool/tool_dispatcher.h>
|
#include <tool/tool_dispatcher.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tool/zoom_tool.h>
|
#include <tool/zoom_tool.h>
|
||||||
|
@ -123,6 +126,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
GetRenderSettings()->LoadColors( GetColorSettings() );
|
GetRenderSettings()->LoadColors( GetColorSettings() );
|
||||||
|
|
||||||
setupTools();
|
setupTools();
|
||||||
|
setupUIConditions();
|
||||||
|
|
||||||
m_libMgr = new LIB_MANAGER( *this );
|
m_libMgr = new LIB_MANAGER( *this );
|
||||||
SyncLibraries( true );
|
SyncLibraries( true );
|
||||||
|
@ -274,6 +278,158 @@ void LIB_EDIT_FRAME::setupTools()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LIB_EDIT_FRAME::setupUIConditions()
|
||||||
|
{
|
||||||
|
SCH_BASE_FRAME::setupUIConditions();
|
||||||
|
|
||||||
|
ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
|
||||||
|
EDITOR_CONDITIONS cond( this );
|
||||||
|
|
||||||
|
wxASSERT( mgr );
|
||||||
|
|
||||||
|
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
|
||||||
|
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
|
||||||
|
|
||||||
|
auto haveSymbolCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
return m_my_part;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto libMgrModifiedCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
return m_libMgr->HasModifications();
|
||||||
|
};
|
||||||
|
|
||||||
|
auto modifiedDocumentCondition =
|
||||||
|
[this] ( const SELECTION& sel )
|
||||||
|
{
|
||||||
|
LIB_ID libId = getTargetLibId();
|
||||||
|
const wxString& libName = libId.GetLibNickname();
|
||||||
|
const wxString& partName = libId.GetLibItemName();
|
||||||
|
|
||||||
|
bool readOnly = libName.IsEmpty() || m_libMgr->IsLibraryReadOnly( libName );
|
||||||
|
|
||||||
|
if( partName.IsEmpty() )
|
||||||
|
return ( !readOnly && m_libMgr->IsLibraryModified( libName ) );
|
||||||
|
else
|
||||||
|
return ( !readOnly && m_libMgr->IsPartModified( partName, libName ) );
|
||||||
|
};
|
||||||
|
|
||||||
|
mgr->SetConditions( ACTIONS::saveAll, ENABLE( libMgrModifiedCond ) );
|
||||||
|
mgr->SetConditions( ACTIONS::save, ENABLE( haveSymbolCond && modifiedDocumentCondition ) );
|
||||||
|
mgr->SetConditions( ACTIONS::undo, ENABLE( haveSymbolCond && cond.UndoAvailable() ) );
|
||||||
|
mgr->SetConditions( ACTIONS::redo, ENABLE( haveSymbolCond && cond.RedoAvailable() ) );
|
||||||
|
mgr->SetConditions( ACTIONS::revert, ENABLE( haveSymbolCond && modifiedDocumentCondition ) );
|
||||||
|
|
||||||
|
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
|
||||||
|
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
|
||||||
|
mgr->SetConditions( ACTIONS::metricUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
|
||||||
|
mgr->SetConditions( ACTIONS::imperialUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
|
||||||
|
mgr->SetConditions( ACTIONS::acceleratedGraphics, CHECK( cond.CanvasType( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) ) );
|
||||||
|
mgr->SetConditions( ACTIONS::standardGraphics, CHECK( cond.CanvasType( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ) ) );
|
||||||
|
|
||||||
|
mgr->SetConditions( ACTIONS::cut, ENABLE( haveSymbolCond && SELECTION_CONDITIONS::NotEmpty ) );
|
||||||
|
mgr->SetConditions( ACTIONS::copy, ENABLE( haveSymbolCond && SELECTION_CONDITIONS::NotEmpty ) );
|
||||||
|
mgr->SetConditions( ACTIONS::paste, ENABLE( haveSymbolCond && SELECTION_CONDITIONS::Idle ) );
|
||||||
|
mgr->SetConditions( ACTIONS::doDelete, ENABLE( haveSymbolCond && SELECTION_CONDITIONS::NotEmpty ) );
|
||||||
|
mgr->SetConditions( ACTIONS::duplicate, ENABLE( haveSymbolCond && SELECTION_CONDITIONS::NotEmpty ) );
|
||||||
|
|
||||||
|
mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
|
||||||
|
mgr->SetConditions( ACTIONS::selectionTool, CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
|
||||||
|
|
||||||
|
auto pinTypeCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
return GetRenderSettings()->m_ShowPinsElectricalType;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto showCompTreeCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
return IsSearchTreeShown();
|
||||||
|
};
|
||||||
|
|
||||||
|
mgr->SetConditions( EE_ACTIONS::showElectricalTypes, CHECK( pinTypeCond ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::showComponentTree, CHECK( showCompTreeCond ) );
|
||||||
|
|
||||||
|
auto isEditableCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
// Only root symbols are editable
|
||||||
|
return m_my_part && m_my_part->IsRoot();
|
||||||
|
};
|
||||||
|
|
||||||
|
auto demorganCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
return GetShowDeMorgan();
|
||||||
|
};
|
||||||
|
|
||||||
|
auto demorganStandardCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
return m_convert == LIB_ITEM::LIB_CONVERT::BASE;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto demorganAlternateCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
return m_convert == LIB_ITEM::LIB_CONVERT::DEMORGAN;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto multiUnitModeCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
return m_my_part && m_my_part->IsMulti() && !m_my_part->UnitsLocked();
|
||||||
|
};
|
||||||
|
|
||||||
|
auto syncedPinsModeCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
return m_SyncPinEdit;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto haveDatasheetCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
return m_my_part && !m_my_part->GetDatasheetField().GetText().IsEmpty();
|
||||||
|
};
|
||||||
|
|
||||||
|
mgr->SetConditions( EE_ACTIONS::showDatasheet, ENABLE( haveDatasheetCond ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::symbolProperties, ENABLE( haveSymbolCond ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::runERC, ENABLE( isEditableCond) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::pinTable, ENABLE( isEditableCond) );
|
||||||
|
|
||||||
|
mgr->SetConditions( EE_ACTIONS::showDeMorganStandard,
|
||||||
|
ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganStandardCond ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::showDeMorganAlternate,
|
||||||
|
ACTION_CONDITIONS().Enable( demorganCond ).Check( demorganAlternateCond ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::toggleSyncedPinsMode,
|
||||||
|
ACTION_CONDITIONS().Enable( multiUnitModeCond ).Check( syncedPinsModeCond ) );
|
||||||
|
|
||||||
|
// Only enable a tool if the part is edtable
|
||||||
|
#define EDIT_TOOL( tool ) ACTION_CONDITIONS().Enable( isEditableCond ).Check( cond.CurrentTool( tool ) )
|
||||||
|
|
||||||
|
mgr->SetConditions( ACTIONS::deleteTool, EDIT_TOOL( ACTIONS::deleteTool ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::placeSymbolPin, EDIT_TOOL( EE_ACTIONS::placeSymbolPin ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::placeSymbolText, EDIT_TOOL( EE_ACTIONS::placeSymbolText ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::drawSymbolRectangle, EDIT_TOOL( EE_ACTIONS::drawSymbolRectangle ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::drawSymbolCircle, EDIT_TOOL( EE_ACTIONS::drawSymbolCircle ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::drawSymbolArc, EDIT_TOOL( EE_ACTIONS::drawSymbolArc ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::drawSymbolLines, EDIT_TOOL( EE_ACTIONS::drawSymbolLines ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::placeSymbolAnchor, EDIT_TOOL( EE_ACTIONS::placeSymbolAnchor ) );
|
||||||
|
|
||||||
|
RegisterUIUpdateHandler( ID_LIBEDIT_IMPORT_BODY_BUTT, ENABLE( isEditableCond ) );
|
||||||
|
RegisterUIUpdateHandler( ID_LIBEDIT_EXPORT_BODY_BUTT, ENABLE( isEditableCond ) );
|
||||||
|
|
||||||
|
#undef CHECK
|
||||||
|
#undef ENABLE
|
||||||
|
#undef EDIT_TOOL
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
|
void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
|
||||||
{
|
{
|
||||||
// Shutdown blocks must be determined and vetoed as early as possible
|
// Shutdown blocks must be determined and vetoed as early as possible
|
||||||
|
@ -944,3 +1100,7 @@ void LIB_EDIT_FRAME::ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCou
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SELECTION& LIB_EDIT_FRAME::GetCurrentSelection()
|
||||||
|
{
|
||||||
|
return m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
|
||||||
|
}
|
||||||
|
|
|
@ -145,6 +145,8 @@ public:
|
||||||
|
|
||||||
LIB_MANAGER& GetLibManager();
|
LIB_MANAGER& GetLibManager();
|
||||||
|
|
||||||
|
SELECTION& GetCurrentSelection() override;
|
||||||
|
|
||||||
void ReCreateMenuBar() override;
|
void ReCreateMenuBar() override;
|
||||||
|
|
||||||
// See comments for m_SyncPinEdit.
|
// See comments for m_SyncPinEdit.
|
||||||
|
@ -256,6 +258,9 @@ public:
|
||||||
|
|
||||||
void ClearMsgPanel() override { DisplayCmpDoc(); }
|
void ClearMsgPanel() override { DisplayCmpDoc(); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void setupUIConditions() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Sets up the tool framework
|
// Sets up the tool framework
|
||||||
void setupTools();
|
void setupTools();
|
||||||
|
@ -421,8 +426,6 @@ public:
|
||||||
|
|
||||||
void ShowChangedLanguage() override;
|
void ShowChangedLanguage() override;
|
||||||
|
|
||||||
void SyncToolbars() override;
|
|
||||||
|
|
||||||
void SetScreen( BASE_SCREEN* aScreen ) override;
|
void SetScreen( BASE_SCREEN* aScreen ) override;
|
||||||
|
|
||||||
const BOX2I GetDocumentExtents() const override;
|
const BOX2I GetDocumentExtents() const override;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <menus_helpers.h>
|
#include <menus_helpers.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <tool/conditional_menu.h>
|
#include <tool/action_menu.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tools/ee_actions.h>
|
#include <tools/ee_actions.h>
|
||||||
#include <tools/ee_selection_tool.h>
|
#include <tools/ee_selection_tool.h>
|
||||||
|
@ -42,38 +42,22 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||||
|
|
||||||
auto modifiedDocumentCondition = [ this ] ( const SELECTION& sel ) {
|
|
||||||
LIB_ID libId = getTargetLibId();
|
|
||||||
const wxString& libName = libId.GetLibNickname();
|
|
||||||
const wxString& partName = libId.GetLibItemName();
|
|
||||||
bool readOnly = libName.IsEmpty() || m_libMgr->IsLibraryReadOnly( libName );
|
|
||||||
|
|
||||||
if( partName.IsEmpty() )
|
|
||||||
return ( !readOnly && m_libMgr->IsLibraryModified( libName ) );
|
|
||||||
else
|
|
||||||
return ( !readOnly && m_libMgr->IsPartModified( partName, libName ) );
|
|
||||||
};
|
|
||||||
|
|
||||||
auto saveAllEnableCondition = [this] ( const SELECTION& sel ) {
|
|
||||||
return m_libMgr->HasModifications();
|
|
||||||
};
|
|
||||||
|
|
||||||
//-- File menu -----------------------------------------------
|
//-- File menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* fileMenu = new ACTION_MENU( false, selTool );
|
||||||
|
|
||||||
fileMenu->AddItem( ACTIONS::newLibrary, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( ACTIONS::newLibrary );
|
||||||
fileMenu->AddItem( ACTIONS::addLibrary, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( ACTIONS::addLibrary );
|
||||||
fileMenu->AddItem( EE_ACTIONS::newSymbol, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( EE_ACTIONS::newSymbol );
|
||||||
|
|
||||||
fileMenu->AddSeparator();
|
fileMenu->AppendSeparator();
|
||||||
fileMenu->AddItem( ACTIONS::save, modifiedDocumentCondition );
|
fileMenu->Add( ACTIONS::save );
|
||||||
fileMenu->AddItem( ACTIONS::saveCopyAs, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( ACTIONS::saveCopyAs );
|
||||||
fileMenu->AddItem( ACTIONS::saveAll, saveAllEnableCondition );
|
fileMenu->Add( ACTIONS::saveAll );
|
||||||
fileMenu->AddItem( ACTIONS::revert, modifiedDocumentCondition );
|
fileMenu->Add( ACTIONS::revert );
|
||||||
|
|
||||||
fileMenu->AddSeparator();
|
fileMenu->AppendSeparator();
|
||||||
fileMenu->AddItem( EE_ACTIONS::importSymbol, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( EE_ACTIONS::importSymbol );
|
||||||
|
|
||||||
// Export submenu
|
// Export submenu
|
||||||
ACTION_MENU* submenuExport = new ACTION_MENU( false );
|
ACTION_MENU* submenuExport = new ACTION_MENU( false );
|
||||||
|
@ -83,142 +67,100 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
submenuExport->Add( EE_ACTIONS::exportSymbol );
|
submenuExport->Add( EE_ACTIONS::exportSymbol );
|
||||||
submenuExport->Add( EE_ACTIONS::exportSymbolView );
|
submenuExport->Add( EE_ACTIONS::exportSymbolView );
|
||||||
submenuExport->Add( EE_ACTIONS::exportSymbolAsSVG );
|
submenuExport->Add( EE_ACTIONS::exportSymbolAsSVG );
|
||||||
fileMenu->AddMenu( submenuExport, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( submenuExport );
|
||||||
|
|
||||||
fileMenu->AddSeparator();
|
fileMenu->AppendSeparator();
|
||||||
fileMenu->AddClose( _( "Library Editor" ) );
|
fileMenu->AddClose( _( "Library Editor" ) );
|
||||||
|
|
||||||
fileMenu->Resolve();
|
|
||||||
|
|
||||||
//-- Edit menu -----------------------------------------------
|
//-- Edit menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* editMenu = new ACTION_MENU( false, selTool );
|
||||||
|
|
||||||
auto enableUndoCondition = [ this ] ( const SELECTION& sel ) {
|
editMenu->Add( ACTIONS::undo );
|
||||||
return m_my_part && GetUndoCommandCount() != 0;
|
editMenu->Add( ACTIONS::redo );
|
||||||
};
|
|
||||||
auto enableRedoCondition = [ this ] ( const SELECTION& sel ) {
|
|
||||||
return m_my_part && GetRedoCommandCount() != 0;
|
|
||||||
};
|
|
||||||
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->AppendSeparator();
|
||||||
editMenu->AddItem( ACTIONS::redo, enableRedoCondition );
|
editMenu->Add( ACTIONS::cut );
|
||||||
|
editMenu->Add( ACTIONS::copy );
|
||||||
|
editMenu->Add( ACTIONS::paste );
|
||||||
|
editMenu->Add( ACTIONS::doDelete );
|
||||||
|
editMenu->Add( ACTIONS::duplicate );
|
||||||
|
|
||||||
editMenu->AddSeparator();
|
editMenu->AppendSeparator();
|
||||||
editMenu->AddItem( ACTIONS::cut, EE_CONDITIONS::NotEmpty );
|
editMenu->Add( EE_ACTIONS::symbolProperties );
|
||||||
editMenu->AddItem( ACTIONS::copy, EE_CONDITIONS::NotEmpty );
|
editMenu->Add( EE_ACTIONS::pinTable );
|
||||||
editMenu->AddItem( ACTIONS::paste, EE_CONDITIONS::Idle );
|
|
||||||
editMenu->AddItem( ACTIONS::doDelete, EE_CONDITIONS::NotEmpty );
|
|
||||||
editMenu->AddItem( ACTIONS::duplicate, EE_CONDITIONS::NotEmpty );
|
|
||||||
|
|
||||||
editMenu->AddSeparator();
|
|
||||||
editMenu->AddItem( EE_ACTIONS::symbolProperties, haveSymbolCondition );
|
|
||||||
editMenu->AddItem( EE_ACTIONS::pinTable, isRootSymbolCondition );
|
|
||||||
|
|
||||||
editMenu->Resolve();
|
|
||||||
|
|
||||||
//-- View menu -----------------------------------------------
|
//-- View menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* viewMenu = new ACTION_MENU( false, selTool );
|
||||||
|
|
||||||
auto gridShownCondition = [ this ] ( const SELECTION& aSel ) {
|
viewMenu->Add( ACTIONS::showSymbolBrowser );
|
||||||
return IsGridVisible();
|
|
||||||
};
|
|
||||||
auto imperialUnitsCondition = [this]( const SELECTION& aSel ) {
|
|
||||||
return GetUserUnits() == EDA_UNITS::INCHES;
|
|
||||||
};
|
|
||||||
auto metricUnitsCondition = [this]( const SELECTION& aSel ) {
|
|
||||||
return GetUserUnits() == EDA_UNITS::MILLIMETRES;
|
|
||||||
};
|
|
||||||
auto fullCrosshairCondition = [ this ] ( const SELECTION& aSel ) {
|
|
||||||
return GetGalDisplayOptions().m_fullscreenCursor;
|
|
||||||
};
|
|
||||||
auto compTreeShownCondition = [ this ] ( const SELECTION& aSel ) {
|
|
||||||
return IsSearchTreeShown();
|
|
||||||
};
|
|
||||||
|
|
||||||
viewMenu->AddItem( ACTIONS::showSymbolBrowser, EE_CONDITIONS::ShowAlways );
|
viewMenu->AppendSeparator();
|
||||||
|
viewMenu->Add( ACTIONS::zoomInCenter );
|
||||||
|
viewMenu->Add( ACTIONS::zoomOutCenter );
|
||||||
|
viewMenu->Add( ACTIONS::zoomFitScreen );
|
||||||
|
viewMenu->Add( ACTIONS::zoomTool );
|
||||||
|
viewMenu->Add( ACTIONS::zoomRedraw );
|
||||||
|
|
||||||
viewMenu->AddSeparator();
|
viewMenu->AppendSeparator();
|
||||||
viewMenu->AddItem( ACTIONS::zoomInCenter, EE_CONDITIONS::ShowAlways );
|
viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK );
|
||||||
viewMenu->AddItem( ACTIONS::zoomOutCenter, EE_CONDITIONS::ShowAlways );
|
viewMenu->Add( ACTIONS::gridProperties );
|
||||||
viewMenu->AddItem( ACTIONS::zoomFitScreen, EE_CONDITIONS::ShowAlways );
|
|
||||||
viewMenu->AddItem( ACTIONS::zoomTool, EE_CONDITIONS::ShowAlways );
|
|
||||||
viewMenu->AddItem( ACTIONS::zoomRedraw, EE_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
viewMenu->AddSeparator();
|
|
||||||
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
|
|
||||||
viewMenu->AddItem( ACTIONS::gridProperties, EE_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
// Units submenu
|
// Units submenu
|
||||||
CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* unitsSubMenu = new ACTION_MENU( false, selTool );
|
||||||
unitsSubMenu->SetTitle( _( "&Units" ) );
|
unitsSubMenu->SetTitle( _( "&Units" ) );
|
||||||
unitsSubMenu->SetIcon( unit_mm_xpm );
|
unitsSubMenu->SetIcon( unit_mm_xpm );
|
||||||
unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition );
|
unitsSubMenu->Add( ACTIONS::imperialUnits, ACTION_MENU::CHECK );
|
||||||
unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition );
|
unitsSubMenu->Add( ACTIONS::metricUnits, ACTION_MENU::CHECK );
|
||||||
viewMenu->AddMenu( unitsSubMenu );
|
viewMenu->Add( unitsSubMenu );
|
||||||
|
|
||||||
viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition );
|
viewMenu->Add( ACTIONS::toggleCursorStyle, ACTION_MENU::CHECK );
|
||||||
|
|
||||||
viewMenu->AddSeparator();
|
viewMenu->AppendSeparator();
|
||||||
viewMenu->AddCheckItem( EE_ACTIONS::showComponentTree, compTreeShownCondition );
|
viewMenu->Add( EE_ACTIONS::showComponentTree, ACTION_MENU::CHECK );
|
||||||
|
|
||||||
viewMenu->Resolve();
|
|
||||||
|
|
||||||
//-- Place menu -----------------------------------------------
|
//-- Place menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* placeMenu = new ACTION_MENU( false, selTool );
|
||||||
|
|
||||||
placeMenu->AddItem( EE_ACTIONS::placeSymbolPin, isRootSymbolCondition );
|
placeMenu->Add( EE_ACTIONS::placeSymbolPin );
|
||||||
placeMenu->AddItem( EE_ACTIONS::placeSymbolText, isRootSymbolCondition );
|
placeMenu->Add( EE_ACTIONS::placeSymbolText );
|
||||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolRectangle, isRootSymbolCondition );
|
placeMenu->Add( EE_ACTIONS::drawSymbolRectangle );
|
||||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolCircle, isRootSymbolCondition );
|
placeMenu->Add( EE_ACTIONS::drawSymbolCircle );
|
||||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolArc, isRootSymbolCondition );
|
placeMenu->Add( EE_ACTIONS::drawSymbolArc );
|
||||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolLines, isRootSymbolCondition );
|
placeMenu->Add( EE_ACTIONS::drawSymbolLines );
|
||||||
|
|
||||||
placeMenu->Resolve();
|
|
||||||
|
|
||||||
//-- Inspect menu -----------------------------------------------
|
//-- Inspect menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* inspectMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* inspectMenu = new ACTION_MENU( false, selTool );
|
||||||
|
|
||||||
inspectMenu->AddItem( EE_ACTIONS::showDatasheet, haveSymbolCondition );
|
inspectMenu->Add( EE_ACTIONS::showDatasheet );
|
||||||
inspectMenu->AddItem( EE_ACTIONS::runERC, isRootSymbolCondition );
|
inspectMenu->Add( EE_ACTIONS::runERC );
|
||||||
|
|
||||||
inspectMenu->Resolve();
|
|
||||||
|
|
||||||
//-- Preferences menu -----------------------------------------------
|
//-- Preferences menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* prefsMenu = new ACTION_MENU( false, selTool );
|
||||||
|
|
||||||
auto acceleratedGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
prefsMenu->Add( ACTIONS::configurePaths );
|
||||||
return GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
prefsMenu->Add( ACTIONS::showSymbolLibTable );
|
||||||
};
|
prefsMenu->Add( _( "Preferences...\tCTRL+," ),
|
||||||
auto standardGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
|
||||||
return GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
|
||||||
};
|
|
||||||
|
|
||||||
prefsMenu->AddItem( ACTIONS::configurePaths, EE_CONDITIONS::ShowAlways );
|
|
||||||
prefsMenu->AddItem( ACTIONS::showSymbolLibTable, EE_CONDITIONS::ShowAlways );
|
|
||||||
prefsMenu->AddItem( wxID_PREFERENCES,
|
|
||||||
_( "Preferences...\tCTRL+," ),
|
|
||||||
_( "Show preferences for all open tools" ),
|
_( "Show preferences for all open tools" ),
|
||||||
preference_xpm, EE_CONDITIONS::ShowAlways );
|
wxID_PREFERENCES,
|
||||||
|
preference_xpm );
|
||||||
|
|
||||||
prefsMenu->AddSeparator();
|
prefsMenu->AppendSeparator();
|
||||||
AddMenuLanguageList( prefsMenu, selTool );
|
AddMenuLanguageList( prefsMenu, selTool );
|
||||||
|
|
||||||
prefsMenu->AddSeparator();
|
prefsMenu->AppendSeparator();
|
||||||
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
prefsMenu->Add( ACTIONS::acceleratedGraphics, ACTION_MENU::CHECK );
|
||||||
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
prefsMenu->Add( ACTIONS::standardGraphics, ACTION_MENU::CHECK );
|
||||||
|
|
||||||
prefsMenu->Resolve();
|
|
||||||
|
|
||||||
//-- Menubar -------------------------------------------------------------
|
//-- Menubar -------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|
|
@ -148,56 +148,3 @@ void LIB_EDIT_FRAME::ReCreateOptToolbar()
|
||||||
|
|
||||||
m_optionsToolBar->Realize();
|
m_optionsToolBar->Realize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::SyncToolbars()
|
|
||||||
{
|
|
||||||
KIGFX::SCH_RENDER_SETTINGS* settings = GetRenderSettings();
|
|
||||||
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
|
|
||||||
|
|
||||||
bool isEditable = m_my_part && m_my_part->IsRoot();
|
|
||||||
|
|
||||||
m_mainToolBar->Toggle( ACTIONS::saveAll, m_libMgr->HasModifications() );
|
|
||||||
m_mainToolBar->Toggle( ACTIONS::undo, GetUndoCommandCount() > 0 );
|
|
||||||
m_mainToolBar->Toggle( ACTIONS::redo, 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 );
|
|
||||||
m_mainToolBar->Toggle( EE_ACTIONS::showDeMorganAlternate,
|
|
||||||
GetShowDeMorgan(),
|
|
||||||
m_convert == LIB_ITEM::LIB_CONVERT::DEMORGAN );
|
|
||||||
m_mainToolBar->Toggle( EE_ACTIONS::pinTable, isEditable );
|
|
||||||
m_mainToolBar->Toggle( EE_ACTIONS::toggleSyncedPinsMode,
|
|
||||||
m_my_part && m_my_part->IsMulti() && !m_my_part->UnitsLocked(),
|
|
||||||
m_SyncPinEdit );
|
|
||||||
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::toggleCursorStyle, galOpts.m_fullscreenCursor );
|
|
||||||
m_optionsToolBar->Toggle( EE_ACTIONS::showElectricalTypes, settings->m_ShowPinsElectricalType );
|
|
||||||
m_optionsToolBar->Toggle( EE_ACTIONS::showComponentTree, IsSearchTreeShown() );
|
|
||||||
m_optionsToolBar->Refresh();
|
|
||||||
|
|
||||||
#define TOGGLE_TOOL( toolbar, enable, tool ) toolbar->Toggle( tool, enable, IsCurrentTool( tool ) )
|
|
||||||
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, isEditable, ACTIONS::selectionTool );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, isEditable, EE_ACTIONS::placeSymbolPin );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, isEditable, EE_ACTIONS::placeSymbolText );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, isEditable, EE_ACTIONS::drawSymbolRectangle );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, isEditable, EE_ACTIONS::drawSymbolCircle );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, isEditable, EE_ACTIONS::drawSymbolArc );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, isEditable, EE_ACTIONS::drawSymbolLines );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, isEditable, EE_ACTIONS::placeSymbolAnchor );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, isEditable, ACTIONS::deleteTool );
|
|
||||||
m_drawToolBar->EnableTool( ID_LIBEDIT_IMPORT_BODY_BUTT, isEditable );
|
|
||||||
m_drawToolBar->EnableTool( ID_LIBEDIT_EXPORT_BODY_BUTT, isEditable );
|
|
||||||
|
|
||||||
m_drawToolBar->Refresh();
|
|
||||||
}
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <menus_helpers.h>
|
#include <menus_helpers.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <schematic.h>
|
#include <schematic.h>
|
||||||
#include <tool/conditional_menu.h>
|
#include <tool/action_menu.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tools/ee_selection_tool.h>
|
#include <tools/ee_selection_tool.h>
|
||||||
#include <tools/ee_actions.h>
|
#include <tools/ee_actions.h>
|
||||||
|
@ -46,14 +46,9 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||||
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
WX_MENUBAR* menuBar = new WX_MENUBAR();
|
||||||
|
|
||||||
auto modifiedDocumentCondition = [&]( const SELECTION& sel )
|
|
||||||
{
|
|
||||||
return Schematic().GetSheets().IsModified();
|
|
||||||
};
|
|
||||||
|
|
||||||
//-- File menu -----------------------------------------------------------
|
//-- File menu -----------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* fileMenu = new ACTION_MENU( false, selTool );
|
||||||
static ACTION_MENU* openRecentMenu;
|
static ACTION_MENU* openRecentMenu;
|
||||||
|
|
||||||
if( Kiface().IsSingle() ) // When not under a project mgr
|
if( Kiface().IsSingle() ) // When not under a project mgr
|
||||||
|
@ -73,22 +68,29 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
fileHistory.AddFilesToMenu( openRecentMenu );
|
fileHistory.AddFilesToMenu( openRecentMenu );
|
||||||
}
|
}
|
||||||
|
|
||||||
fileMenu->AddItem( ACTIONS::doNew, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( ACTIONS::doNew );
|
||||||
fileMenu->AddItem( ACTIONS::open, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( ACTIONS::open );
|
||||||
fileMenu->AddMenu( openRecentMenu, FILE_HISTORY::FileHistoryNotEmpty( fileHistory ) );
|
|
||||||
fileMenu->AddSeparator();
|
wxMenuItem* item = fileMenu->Add( openRecentMenu );
|
||||||
|
|
||||||
|
// Add the file menu condition here since it needs the item ID for the submenu
|
||||||
|
ACTION_CONDITIONS cond;
|
||||||
|
cond.Enable( FILE_HISTORY::FileHistoryNotEmpty( fileHistory ) );
|
||||||
|
RegisterUIUpdateHandler( item->GetId(), cond );
|
||||||
|
fileMenu->AppendSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
fileMenu->AddItem( ACTIONS::save, modifiedDocumentCondition );
|
fileMenu->Add( ACTIONS::save );
|
||||||
fileMenu->AddItem( ACTIONS::saveAs, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( ACTIONS::saveAs );
|
||||||
|
|
||||||
fileMenu->AddSeparator();
|
fileMenu->AppendSeparator();
|
||||||
|
|
||||||
fileMenu->AddItem( ID_APPEND_PROJECT, _( "Append Schematic Sheet Content..." ),
|
fileMenu->Add( _( "Append Schematic Sheet Content..." ),
|
||||||
_( "Append schematic sheet content from another project to the current sheet" ),
|
_( "Append schematic sheet content from another project to the current sheet" ),
|
||||||
add_document_xpm, EE_CONDITIONS::ShowAlways );
|
ID_APPEND_PROJECT,
|
||||||
|
add_document_xpm );
|
||||||
|
|
||||||
fileMenu->AddSeparator();
|
fileMenu->AppendSeparator();
|
||||||
|
|
||||||
// Import submenu
|
// Import submenu
|
||||||
ACTION_MENU* submenuImport = new ACTION_MENU( false );
|
ACTION_MENU* submenuImport = new ACTION_MENU( false );
|
||||||
|
@ -97,10 +99,11 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
submenuImport->SetIcon( import_xpm );
|
submenuImport->SetIcon( import_xpm );
|
||||||
submenuImport->Add( _( "Import Non KiCad Schematic..." ),
|
submenuImport->Add( _( "Import Non KiCad Schematic..." ),
|
||||||
_( "Replace current schematic sheet with one imported from another application" ),
|
_( "Replace current schematic sheet with one imported from another application" ),
|
||||||
ID_IMPORT_NON_KICAD_SCH, import_document_xpm );
|
ID_IMPORT_NON_KICAD_SCH,
|
||||||
|
import_document_xpm );
|
||||||
|
|
||||||
submenuImport->Add( EE_ACTIONS::importFPAssignments );
|
submenuImport->Add( EE_ACTIONS::importFPAssignments );
|
||||||
fileMenu->AddMenu( submenuImport, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( submenuImport );
|
||||||
|
|
||||||
|
|
||||||
// Export submenu
|
// Export submenu
|
||||||
|
@ -110,228 +113,162 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
submenuExport->SetIcon( export_xpm );
|
submenuExport->SetIcon( export_xpm );
|
||||||
submenuExport->Add( EE_ACTIONS::drawSheetOnClipboard );
|
submenuExport->Add( EE_ACTIONS::drawSheetOnClipboard );
|
||||||
submenuExport->Add( EE_ACTIONS::exportNetlist );
|
submenuExport->Add( EE_ACTIONS::exportNetlist );
|
||||||
fileMenu->AddMenu( submenuExport, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( submenuExport );
|
||||||
|
|
||||||
fileMenu->AddSeparator();
|
fileMenu->AppendSeparator();
|
||||||
fileMenu->AddItem( EE_ACTIONS::schematicSetup, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( EE_ACTIONS::schematicSetup );
|
||||||
|
|
||||||
fileMenu->AddSeparator();
|
fileMenu->AppendSeparator();
|
||||||
fileMenu->AddItem( ACTIONS::pageSettings, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( ACTIONS::pageSettings );
|
||||||
fileMenu->AddItem( ACTIONS::print, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( ACTIONS::print );
|
||||||
fileMenu->AddItem( ACTIONS::plot, EE_CONDITIONS::ShowAlways );
|
fileMenu->Add( ACTIONS::plot );
|
||||||
|
|
||||||
fileMenu->AddSeparator();
|
fileMenu->AppendSeparator();
|
||||||
fileMenu->AddQuitOrClose( &Kiface(), _( "Eeschema" ) );
|
fileMenu->AddQuitOrClose( &Kiface(), _( "Eeschema" ) );
|
||||||
|
|
||||||
fileMenu->Resolve();
|
|
||||||
|
|
||||||
//-- Edit menu -----------------------------------------------------------
|
//-- Edit menu -----------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* editMenu = new ACTION_MENU( false, selTool );
|
||||||
|
|
||||||
auto enableUndoCondition = [ this ] ( const SELECTION& sel ) {
|
editMenu->Add( ACTIONS::undo );
|
||||||
return GetUndoCommandCount() > 0;
|
editMenu->Add( ACTIONS::redo );
|
||||||
};
|
|
||||||
auto enableRedoCondition = [ this ] ( const SELECTION& sel ) {
|
|
||||||
return GetRedoCommandCount() > 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
editMenu->AddItem( ACTIONS::undo, enableUndoCondition );
|
editMenu->AppendSeparator();
|
||||||
editMenu->AddItem( ACTIONS::redo, enableRedoCondition );
|
editMenu->Add( ACTIONS::cut );
|
||||||
|
editMenu->Add( ACTIONS::copy );
|
||||||
|
editMenu->Add( ACTIONS::paste );
|
||||||
|
editMenu->Add( ACTIONS::pasteSpecial );
|
||||||
|
editMenu->Add( ACTIONS::doDelete );
|
||||||
|
editMenu->Add( ACTIONS::duplicate );
|
||||||
|
|
||||||
editMenu->AddSeparator();
|
editMenu->AppendSeparator();
|
||||||
editMenu->AddItem( ACTIONS::cut, EE_CONDITIONS::NotEmpty );
|
editMenu->Add( ACTIONS::find );
|
||||||
editMenu->AddItem( ACTIONS::copy, EE_CONDITIONS::NotEmpty );
|
editMenu->Add( ACTIONS::findAndReplace );
|
||||||
editMenu->AddItem( ACTIONS::paste, EE_CONDITIONS::Idle );
|
|
||||||
editMenu->AddItem( ACTIONS::pasteSpecial, EE_CONDITIONS::Idle );
|
|
||||||
editMenu->AddItem( ACTIONS::doDelete, EE_CONDITIONS::NotEmpty );
|
|
||||||
editMenu->AddItem( ACTIONS::duplicate, EE_CONDITIONS::NotEmpty );
|
|
||||||
|
|
||||||
editMenu->AddSeparator();
|
editMenu->AppendSeparator();
|
||||||
editMenu->AddItem( ACTIONS::find, EE_CONDITIONS::ShowAlways );
|
editMenu->Add( ACTIONS::deleteTool );
|
||||||
editMenu->AddItem( ACTIONS::findAndReplace, EE_CONDITIONS::ShowAlways );
|
editMenu->Add( EE_ACTIONS::editTextAndGraphics );
|
||||||
|
editMenu->Add( EE_ACTIONS::updateFieldsFromLibrary );
|
||||||
|
editMenu->Add( EE_ACTIONS::changeSymbols );
|
||||||
|
editMenu->Add( EE_ACTIONS::updateSymbols );
|
||||||
|
|
||||||
editMenu->AddSeparator();
|
|
||||||
editMenu->AddItem( ACTIONS::deleteTool, EE_CONDITIONS::ShowAlways );
|
|
||||||
editMenu->AddItem( EE_ACTIONS::editTextAndGraphics, EE_CONDITIONS::ShowAlways );
|
|
||||||
editMenu->AddItem( EE_ACTIONS::updateFieldsFromLibrary, EE_CONDITIONS::ShowAlways );
|
|
||||||
editMenu->AddItem( EE_ACTIONS::changeSymbols, EE_CONDITIONS::ShowAlways );
|
|
||||||
editMenu->AddItem( EE_ACTIONS::updateSymbols, EE_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
editMenu->Resolve();
|
|
||||||
|
|
||||||
//-- View menu -----------------------------------------------------------
|
//-- View menu -----------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* viewMenu = new ACTION_MENU( false, selTool );
|
||||||
|
|
||||||
auto belowRootSheetCondition =
|
viewMenu->Add( ACTIONS::showSymbolBrowser );
|
||||||
[this]( const SELECTION& aSel )
|
viewMenu->Add( EE_ACTIONS::navigateHierarchy );
|
||||||
{
|
viewMenu->Add( EE_ACTIONS::leaveSheet );
|
||||||
return GetCurrentSheet().Last() != &Schematic().Root();
|
|
||||||
};
|
|
||||||
|
|
||||||
auto gridShownCondition =
|
viewMenu->AppendSeparator();
|
||||||
[this]( const SELECTION& aSel )
|
viewMenu->Add( ACTIONS::zoomInCenter );
|
||||||
{
|
viewMenu->Add( ACTIONS::zoomOutCenter );
|
||||||
return IsGridVisible();
|
viewMenu->Add( ACTIONS::zoomFitScreen );
|
||||||
};
|
viewMenu->Add( ACTIONS::zoomTool );
|
||||||
|
viewMenu->Add( ACTIONS::zoomRedraw );
|
||||||
|
|
||||||
auto imperialUnitsCondition =
|
viewMenu->AppendSeparator();
|
||||||
[this]( const SELECTION& aSel )
|
viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK );
|
||||||
{
|
viewMenu->Add( ACTIONS::gridProperties );
|
||||||
return GetUserUnits() == EDA_UNITS::INCHES;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto metricUnitsCondition =
|
|
||||||
[this]( const SELECTION& aSel )
|
|
||||||
{
|
|
||||||
return GetUserUnits() == EDA_UNITS::MILLIMETRES;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto fullCrosshairCondition =
|
|
||||||
[this]( const SELECTION& aSel )
|
|
||||||
{
|
|
||||||
return GetGalDisplayOptions().m_fullscreenCursor;
|
|
||||||
};
|
|
||||||
auto hiddenPinsCondition =
|
|
||||||
[this]( const SELECTION& aSel )
|
|
||||||
{
|
|
||||||
return GetShowAllPins();
|
|
||||||
};
|
|
||||||
|
|
||||||
viewMenu->AddItem( ACTIONS::showSymbolBrowser, EE_CONDITIONS::ShowAlways );
|
|
||||||
viewMenu->AddItem( EE_ACTIONS::navigateHierarchy, EE_CONDITIONS::ShowAlways );
|
|
||||||
viewMenu->AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition );
|
|
||||||
|
|
||||||
viewMenu->AddSeparator();
|
|
||||||
viewMenu->AddItem( ACTIONS::zoomInCenter, EE_CONDITIONS::ShowAlways );
|
|
||||||
viewMenu->AddItem( ACTIONS::zoomOutCenter, EE_CONDITIONS::ShowAlways );
|
|
||||||
viewMenu->AddItem( ACTIONS::zoomFitScreen, EE_CONDITIONS::ShowAlways );
|
|
||||||
viewMenu->AddItem( ACTIONS::zoomTool, EE_CONDITIONS::ShowAlways );
|
|
||||||
viewMenu->AddItem( ACTIONS::zoomRedraw, EE_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
viewMenu->AddSeparator();
|
|
||||||
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
|
|
||||||
viewMenu->AddItem( ACTIONS::gridProperties, EE_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
// Units submenu
|
// Units submenu
|
||||||
CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* unitsSubMenu = new ACTION_MENU( false, selTool );
|
||||||
unitsSubMenu->SetTitle( _( "&Units" ) );
|
unitsSubMenu->SetTitle( _( "&Units" ) );
|
||||||
unitsSubMenu->SetIcon( unit_mm_xpm );
|
unitsSubMenu->SetIcon( unit_mm_xpm );
|
||||||
unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition );
|
unitsSubMenu->Add( ACTIONS::imperialUnits, ACTION_MENU::CHECK );
|
||||||
unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition );
|
unitsSubMenu->Add( ACTIONS::metricUnits, ACTION_MENU::CHECK );
|
||||||
viewMenu->AddMenu( unitsSubMenu );
|
viewMenu->Add( unitsSubMenu );
|
||||||
|
|
||||||
viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition );
|
viewMenu->Add( ACTIONS::toggleCursorStyle, ACTION_MENU::CHECK );
|
||||||
|
|
||||||
viewMenu->AddSeparator();
|
viewMenu->AppendSeparator();
|
||||||
viewMenu->AddCheckItem( EE_ACTIONS::toggleHiddenPins, hiddenPinsCondition );
|
viewMenu->Add( EE_ACTIONS::toggleHiddenPins, ACTION_MENU::CHECK );
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
viewMenu->AddSeparator();
|
viewMenu->AppendSeparator();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
viewMenu->Resolve();
|
|
||||||
|
|
||||||
//-- Place menu -----------------------------------------------------------
|
//-- Place menu -----------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* placeMenu = new ACTION_MENU( false, selTool );
|
||||||
|
|
||||||
placeMenu->AddItem( EE_ACTIONS::placeSymbol, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::placeSymbol );
|
||||||
placeMenu->AddItem( EE_ACTIONS::placePower, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::placePower );
|
||||||
placeMenu->AddItem( EE_ACTIONS::drawWire, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::drawWire );
|
||||||
placeMenu->AddItem( EE_ACTIONS::drawBus, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::drawBus );
|
||||||
placeMenu->AddItem( EE_ACTIONS::placeBusWireEntry, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::placeBusWireEntry );
|
||||||
placeMenu->AddItem( EE_ACTIONS::placeNoConnect, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::placeNoConnect );
|
||||||
placeMenu->AddItem( EE_ACTIONS::placeJunction, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::placeJunction );
|
||||||
placeMenu->AddItem( EE_ACTIONS::placeLabel, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::placeLabel );
|
||||||
placeMenu->AddItem( EE_ACTIONS::placeGlobalLabel, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::placeGlobalLabel );
|
||||||
|
|
||||||
placeMenu->AddSeparator();
|
placeMenu->AppendSeparator();
|
||||||
placeMenu->AddItem( EE_ACTIONS::placeHierLabel, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::placeHierLabel );
|
||||||
placeMenu->AddItem( EE_ACTIONS::drawSheet, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::drawSheet );
|
||||||
placeMenu->AddItem( EE_ACTIONS::importSheetPin, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::importSheetPin );
|
||||||
|
|
||||||
placeMenu->AddSeparator();
|
placeMenu->AppendSeparator();
|
||||||
placeMenu->AddItem( EE_ACTIONS::drawLines, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::drawLines );
|
||||||
placeMenu->AddItem( EE_ACTIONS::placeSchematicText, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::placeSchematicText );
|
||||||
placeMenu->AddItem( EE_ACTIONS::placeImage, EE_CONDITIONS::ShowAlways );
|
placeMenu->Add( EE_ACTIONS::placeImage );
|
||||||
|
|
||||||
placeMenu->Resolve();
|
|
||||||
|
|
||||||
//-- Inspect menu -----------------------------------------------
|
//-- Inspect menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* inspectMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* inspectMenu = new ACTION_MENU( false, selTool );
|
||||||
|
|
||||||
inspectMenu->AddItem( EE_ACTIONS::runERC, EE_CONDITIONS::ShowAlways );
|
inspectMenu->Add( EE_ACTIONS::runERC );
|
||||||
#ifdef KICAD_SPICE
|
#ifdef KICAD_SPICE
|
||||||
inspectMenu->AddItem( EE_ACTIONS::runSimulation, EE_CONDITIONS::ShowAlways );
|
inspectMenu->Add( EE_ACTIONS::runSimulation );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inspectMenu->Resolve();
|
|
||||||
|
|
||||||
//-- Tools menu -----------------------------------------------
|
//-- Tools menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* toolsMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* toolsMenu = new ACTION_MENU( false, selTool );
|
||||||
|
|
||||||
auto remapSymbolsCondition =
|
toolsMenu->Add( ACTIONS::updatePcbFromSchematic );
|
||||||
[&]( const SELECTION& aSel )
|
toolsMenu->Add( ACTIONS::updateSchematicFromPcb );
|
||||||
{
|
toolsMenu->Add( EE_ACTIONS::showPcbNew );
|
||||||
SCH_SCREENS schematic( Schematic().Root() );
|
|
||||||
|
|
||||||
// The remapping can only be performed on legacy projects.
|
toolsMenu->AppendSeparator();
|
||||||
return schematic.HasNoFullyDefinedLibIds();
|
toolsMenu->Add( ACTIONS::showSymbolEditor );
|
||||||
};
|
toolsMenu->Add( EE_ACTIONS::rescueSymbols );
|
||||||
|
toolsMenu->Add( EE_ACTIONS::remapSymbols );
|
||||||
|
|
||||||
toolsMenu->AddItem( ACTIONS::updatePcbFromSchematic, EE_CONDITIONS::ShowAlways );
|
toolsMenu->AppendSeparator();
|
||||||
toolsMenu->AddItem( ACTIONS::updateSchematicFromPcb, EE_CONDITIONS::ShowAlways );
|
toolsMenu->Add( EE_ACTIONS::editSymbolFields );
|
||||||
toolsMenu->AddItem( EE_ACTIONS::showPcbNew, EE_CONDITIONS::ShowAlways );
|
toolsMenu->Add( EE_ACTIONS::editSymbolLibraryLinks );
|
||||||
|
|
||||||
toolsMenu->AddSeparator();
|
toolsMenu->AppendSeparator();
|
||||||
toolsMenu->AddItem( ACTIONS::showSymbolEditor, EE_CONDITIONS::ShowAlways );
|
toolsMenu->Add( EE_ACTIONS::annotate );
|
||||||
toolsMenu->AddItem( EE_ACTIONS::rescueSymbols, EE_CONDITIONS::ShowAlways );
|
toolsMenu->Add( EE_ACTIONS::showBusManager );
|
||||||
toolsMenu->AddItem( EE_ACTIONS::remapSymbols, remapSymbolsCondition );
|
|
||||||
|
|
||||||
toolsMenu->AddSeparator();
|
toolsMenu->AppendSeparator();
|
||||||
toolsMenu->AddItem( EE_ACTIONS::editSymbolFields, EE_CONDITIONS::ShowAlways );
|
toolsMenu->Add( EE_ACTIONS::assignFootprints );
|
||||||
toolsMenu->AddItem( EE_ACTIONS::editSymbolLibraryLinks, EE_CONDITIONS::ShowAlways );
|
toolsMenu->Add( EE_ACTIONS::generateBOM );
|
||||||
|
|
||||||
toolsMenu->AddSeparator();
|
|
||||||
toolsMenu->AddItem( EE_ACTIONS::annotate, EE_CONDITIONS::ShowAlways );
|
|
||||||
toolsMenu->AddItem( EE_ACTIONS::showBusManager, EE_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
toolsMenu->AddSeparator();
|
|
||||||
toolsMenu->AddItem( EE_ACTIONS::assignFootprints, EE_CONDITIONS::ShowAlways );
|
|
||||||
toolsMenu->AddItem( EE_ACTIONS::generateBOM, EE_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
toolsMenu->Resolve();
|
|
||||||
|
|
||||||
//-- Preferences menu -----------------------------------------------
|
//-- Preferences menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
ACTION_MENU* prefsMenu = new ACTION_MENU( false, selTool );
|
||||||
|
|
||||||
auto acceleratedGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
prefsMenu->Add( ACTIONS::configurePaths );
|
||||||
return GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
prefsMenu->Add( ACTIONS::showSymbolLibTable );
|
||||||
};
|
prefsMenu->Add( _( "Preferences...\tCTRL+," ),
|
||||||
auto standardGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
|
||||||
return GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
|
||||||
};
|
|
||||||
|
|
||||||
prefsMenu->AddItem( ACTIONS::configurePaths, EE_CONDITIONS::ShowAlways );
|
|
||||||
prefsMenu->AddItem( ACTIONS::showSymbolLibTable, EE_CONDITIONS::ShowAlways );
|
|
||||||
prefsMenu->AddItem( wxID_PREFERENCES,
|
|
||||||
_( "Preferences...\tCTRL+," ),
|
|
||||||
_( "Show preferences for all open tools" ),
|
_( "Show preferences for all open tools" ),
|
||||||
preference_xpm, EE_CONDITIONS::ShowAlways );
|
wxID_PREFERENCES,
|
||||||
|
preference_xpm );
|
||||||
|
|
||||||
prefsMenu->AddSeparator();
|
prefsMenu->AppendSeparator();
|
||||||
AddMenuLanguageList( prefsMenu, selTool );
|
AddMenuLanguageList( prefsMenu, selTool );
|
||||||
|
|
||||||
prefsMenu->AddSeparator();
|
prefsMenu->AppendSeparator();
|
||||||
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
prefsMenu->Add( ACTIONS::acceleratedGraphics, ACTION_MENU::CHECK );
|
||||||
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
prefsMenu->Add( ACTIONS::standardGraphics, ACTION_MENU::CHECK );
|
||||||
|
|
||||||
prefsMenu->Resolve();
|
|
||||||
|
|
||||||
//-- Menubar -------------------------------------------------------------
|
//-- Menubar -------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|
|
@ -55,10 +55,13 @@
|
||||||
#include <advanced_config.h>
|
#include <advanced_config.h>
|
||||||
#include <sim/sim_plot_frame.h>
|
#include <sim/sim_plot_frame.h>
|
||||||
#include <symbol_lib_table.h>
|
#include <symbol_lib_table.h>
|
||||||
|
#include <tool/action_manager.h>
|
||||||
#include <tool/action_toolbar.h>
|
#include <tool/action_toolbar.h>
|
||||||
#include <tool/common_control.h>
|
#include <tool/common_control.h>
|
||||||
#include <tool/common_tools.h>
|
#include <tool/common_tools.h>
|
||||||
|
#include <tool/editor_conditions.h>
|
||||||
#include <tool/picker_tool.h>
|
#include <tool/picker_tool.h>
|
||||||
|
#include <tool/selection.h>
|
||||||
#include <tool/tool_dispatcher.h>
|
#include <tool/tool_dispatcher.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tool/zoom_tool.h>
|
#include <tool/zoom_tool.h>
|
||||||
|
@ -234,6 +237,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||||
LoadProjectSettings();
|
LoadProjectSettings();
|
||||||
|
|
||||||
setupTools();
|
setupTools();
|
||||||
|
setupUIConditions();
|
||||||
ReCreateMenuBar();
|
ReCreateMenuBar();
|
||||||
ReCreateHToolbar();
|
ReCreateHToolbar();
|
||||||
ReCreateVToolbar();
|
ReCreateVToolbar();
|
||||||
|
@ -345,6 +349,98 @@ void SCH_EDIT_FRAME::setupTools()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_EDIT_FRAME::setupUIConditions()
|
||||||
|
{
|
||||||
|
SCH_BASE_FRAME::setupUIConditions();
|
||||||
|
|
||||||
|
ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
|
||||||
|
EDITOR_CONDITIONS cond( this );
|
||||||
|
|
||||||
|
wxASSERT( mgr );
|
||||||
|
|
||||||
|
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
|
||||||
|
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
|
||||||
|
|
||||||
|
mgr->SetConditions( ACTIONS::save, ENABLE( cond.ContentModified() ) );
|
||||||
|
mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
|
||||||
|
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
|
||||||
|
|
||||||
|
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
|
||||||
|
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
|
||||||
|
mgr->SetConditions( ACTIONS::metricUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
|
||||||
|
mgr->SetConditions( ACTIONS::imperialUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
|
||||||
|
mgr->SetConditions( ACTIONS::acceleratedGraphics, CHECK( cond.CanvasType( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) ) );
|
||||||
|
mgr->SetConditions( ACTIONS::standardGraphics, CHECK( cond.CanvasType( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ) ) );
|
||||||
|
|
||||||
|
mgr->SetConditions( ACTIONS::cut, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
|
||||||
|
mgr->SetConditions( ACTIONS::copy, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
|
||||||
|
mgr->SetConditions( ACTIONS::paste, ENABLE( SELECTION_CONDITIONS::Idle ) );
|
||||||
|
mgr->SetConditions( ACTIONS::pasteSpecial, ENABLE( SELECTION_CONDITIONS::Idle ) );
|
||||||
|
mgr->SetConditions( ACTIONS::doDelete, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
|
||||||
|
mgr->SetConditions( ACTIONS::duplicate, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
|
||||||
|
|
||||||
|
mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
|
||||||
|
mgr->SetConditions( ACTIONS::selectionTool, CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
|
||||||
|
|
||||||
|
auto showHiddenPinsCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
return GetShowAllPins();
|
||||||
|
};
|
||||||
|
|
||||||
|
auto forceHVCond =
|
||||||
|
[this] ( const SELECTION& )
|
||||||
|
{
|
||||||
|
return eeconfig()->m_Drawing.hv_lines_only;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto remapSymbolsCondition =
|
||||||
|
[&]( const SELECTION& aSel )
|
||||||
|
{
|
||||||
|
SCH_SCREENS schematic( Schematic().Root() );
|
||||||
|
|
||||||
|
// The remapping can only be performed on legacy projects.
|
||||||
|
return schematic.HasNoFullyDefinedLibIds();
|
||||||
|
};
|
||||||
|
|
||||||
|
auto belowRootSheetCondition =
|
||||||
|
[this]( const SELECTION& aSel )
|
||||||
|
{
|
||||||
|
return GetCurrentSheet().Last() != &Schematic().Root();
|
||||||
|
};
|
||||||
|
|
||||||
|
mgr->SetConditions( EE_ACTIONS::leaveSheet, ENABLE( belowRootSheetCondition ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::remapSymbols, ENABLE( remapSymbolsCondition ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::toggleHiddenPins, CHECK( showHiddenPinsCond ) );
|
||||||
|
mgr->SetConditions( EE_ACTIONS::toggleForceHV, CHECK( forceHVCond ) );
|
||||||
|
|
||||||
|
|
||||||
|
#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
|
||||||
|
|
||||||
|
CURRENT_TOOL( ACTIONS::deleteTool );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::highlightNetTool );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::placeSymbol );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::placePower );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::drawWire );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::drawBus );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::placeBusWireEntry );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::placeNoConnect );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::placeJunction );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::placeLabel );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::placeGlobalLabel );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::placeHierLabel );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::drawSheet );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::importSheetPin );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::drawLines );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::placeSchematicText );
|
||||||
|
CURRENT_TOOL( EE_ACTIONS::placeImage );
|
||||||
|
|
||||||
|
#undef CURRENT_TOOL
|
||||||
|
#undef CHECK
|
||||||
|
#undef ENABLE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::SaveCopyForRepeatItem( SCH_ITEM* aItem )
|
void SCH_EDIT_FRAME::SaveCopyForRepeatItem( SCH_ITEM* aItem )
|
||||||
{
|
{
|
||||||
// we cannot store a pointer to an item in the display list here since
|
// we cannot store a pointer to an item in the display list here since
|
||||||
|
@ -1241,3 +1337,9 @@ wxString SCH_EDIT_FRAME::GetCurrentFileName() const
|
||||||
{
|
{
|
||||||
return Schematic().GetFileName();
|
return Schematic().GetFileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SELECTION& SCH_EDIT_FRAME::GetCurrentSelection()
|
||||||
|
{
|
||||||
|
return m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
|
||||||
|
}
|
||||||
|
|
|
@ -160,6 +160,8 @@ public:
|
||||||
|
|
||||||
SCH_SCREEN* GetScreen() const override;
|
SCH_SCREEN* GetScreen() const override;
|
||||||
|
|
||||||
|
SELECTION& GetCurrentSelection() override;
|
||||||
|
|
||||||
SCHEMATIC& Schematic() const;
|
SCHEMATIC& Schematic() const;
|
||||||
|
|
||||||
void OnCloseWindow( wxCloseEvent& Event );
|
void OnCloseWindow( wxCloseEvent& Event );
|
||||||
|
@ -215,6 +217,8 @@ public:
|
||||||
void ReCreateOptToolbar() override;
|
void ReCreateOptToolbar() override;
|
||||||
void ReCreateMenuBar() override;
|
void ReCreateMenuBar() override;
|
||||||
|
|
||||||
|
void setupUIConditions() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get if the current schematic has been modified but not saved.
|
* Get if the current schematic has been modified but not saved.
|
||||||
*
|
*
|
||||||
|
@ -943,8 +947,6 @@ public:
|
||||||
|
|
||||||
void ShowChangedLanguage() override;
|
void ShowChangedLanguage() override;
|
||||||
|
|
||||||
void SyncToolbars() override;
|
|
||||||
|
|
||||||
void SetScreen( BASE_SCREEN* aScreen ) override;
|
void SetScreen( BASE_SCREEN* aScreen ) override;
|
||||||
|
|
||||||
const BOX2I GetDocumentExtents() const override;
|
const BOX2I GetDocumentExtents() const override;
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
#include "lib_view_frame.h"
|
#include "lib_view_frame.h"
|
||||||
#include "sch_painter.h"
|
#include "sch_painter.h"
|
||||||
#include <symbol_lib_table.h>
|
#include <symbol_lib_table.h>
|
||||||
|
#include <tool/action_menu.h>
|
||||||
#include <tool/action_toolbar.h>
|
#include <tool/action_toolbar.h>
|
||||||
#include <tool/conditional_menu.h>
|
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tools/ee_actions.h>
|
#include <tools/ee_actions.h>
|
||||||
#include <tools/lib_control.h>
|
#include <tools/lib_control.h>
|
||||||
|
@ -101,37 +101,27 @@ void LIB_VIEW_FRAME::ReCreateMenuBar()
|
||||||
|
|
||||||
//-- File menu -----------------------------------------------------------
|
//-- File menu -----------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, libControl );
|
ACTION_MENU* fileMenu = new ACTION_MENU( false, libControl );
|
||||||
|
|
||||||
fileMenu->AddClose( _( "Footprint Viewer" ) );
|
fileMenu->AddClose( _( "Footprint Viewer" ) );
|
||||||
|
|
||||||
fileMenu->Resolve();
|
|
||||||
|
|
||||||
|
|
||||||
//-- View menu -----------------------------------------------------------
|
//-- View menu -----------------------------------------------------------
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, libControl );
|
ACTION_MENU* viewMenu = new ACTION_MENU( false, libControl );
|
||||||
|
|
||||||
auto gridShownCondition = [ this ] ( const SELECTION& aSel ) {
|
viewMenu->Add( ACTIONS::zoomInCenter );
|
||||||
return IsGridVisible();
|
viewMenu->Add( ACTIONS::zoomOutCenter );
|
||||||
};
|
viewMenu->Add( ACTIONS::zoomFitScreen );
|
||||||
auto electricalTypesShownCondition = [ this ] ( const SELECTION& aSel ) {
|
viewMenu->Add( ACTIONS::zoomRedraw );
|
||||||
return GetRenderSettings()->m_ShowPinsElectricalType;
|
|
||||||
};
|
|
||||||
|
|
||||||
viewMenu->AddItem( ACTIONS::zoomInCenter, EE_CONDITIONS::ShowAlways );
|
viewMenu->AppendSeparator();
|
||||||
viewMenu->AddItem( ACTIONS::zoomOutCenter, EE_CONDITIONS::ShowAlways );
|
viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK );
|
||||||
viewMenu->AddItem( ACTIONS::zoomFitScreen, EE_CONDITIONS::ShowAlways );
|
viewMenu->Add( ACTIONS::gridProperties );
|
||||||
viewMenu->AddItem( ACTIONS::zoomRedraw, EE_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
viewMenu->AddSeparator();
|
viewMenu->AppendSeparator();
|
||||||
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
|
viewMenu->Add( EE_ACTIONS::showElectricalTypes, ACTION_MENU::CHECK );
|
||||||
viewMenu->AddItem( ACTIONS::gridProperties, EE_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
viewMenu->AddSeparator();
|
|
||||||
viewMenu->AddCheckItem( EE_ACTIONS::showElectricalTypes, electricalTypesShownCondition );
|
|
||||||
|
|
||||||
viewMenu->Resolve();
|
|
||||||
|
|
||||||
//-- Menubar -------------------------------------------------------------
|
//-- Menubar -------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
@ -142,17 +132,3 @@ void LIB_VIEW_FRAME::ReCreateMenuBar()
|
||||||
SetMenuBar( menuBar );
|
SetMenuBar( menuBar );
|
||||||
delete oldMenuBar;
|
delete oldMenuBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_VIEW_FRAME::SyncToolbars()
|
|
||||||
{
|
|
||||||
LIB_PART* symbol = GetSelectedSymbol();
|
|
||||||
|
|
||||||
m_mainToolBar->Toggle( EE_ACTIONS::showDatasheet,
|
|
||||||
symbol && !symbol->GetDatasheetField().GetText().IsEmpty() );
|
|
||||||
m_mainToolBar->Toggle( EE_ACTIONS::showDeMorganStandard, symbol && symbol->HasConversion(),
|
|
||||||
m_convert == LIB_FIELD::LIB_CONVERT::BASE );
|
|
||||||
m_mainToolBar->Toggle( EE_ACTIONS::showDeMorganAlternate, symbol && symbol->HasConversion(),
|
|
||||||
m_convert == LIB_FIELD::LIB_CONVERT::DEMORGAN );
|
|
||||||
m_mainToolBar->Refresh();
|
|
||||||
}
|
|
||||||
|
|
|
@ -162,46 +162,3 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
|
||||||
|
|
||||||
m_optionsToolBar->Realize();
|
m_optionsToolBar->Realize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::SyncToolbars()
|
|
||||||
{
|
|
||||||
#define TOGGLE_TOOL( toolbar, tool ) toolbar->Toggle( tool, IsCurrentTool( tool ) )
|
|
||||||
|
|
||||||
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
|
|
||||||
|
|
||||||
|
|
||||||
m_mainToolBar->Toggle( ACTIONS::save, IsContentModified() );
|
|
||||||
m_mainToolBar->Toggle( ACTIONS::undo, GetUndoCommandCount() > 0 );
|
|
||||||
m_mainToolBar->Toggle( ACTIONS::redo, GetRedoCommandCount() > 0 );
|
|
||||||
TOGGLE_TOOL( m_mainToolBar, ACTIONS::zoomTool );
|
|
||||||
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::toggleCursorStyle, galOpts.m_fullscreenCursor );
|
|
||||||
m_optionsToolBar->Toggle( EE_ACTIONS::toggleHiddenPins, GetShowAllPins() );
|
|
||||||
m_optionsToolBar->Toggle( EE_ACTIONS::toggleForceHV, eeconfig()->m_Drawing.hv_lines_only );
|
|
||||||
m_optionsToolBar->Refresh();
|
|
||||||
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, ACTIONS::selectionTool );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::highlightNetTool );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::placeSymbol );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::placePower );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::drawWire );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::drawBus );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::placeBusWireEntry );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::placeNoConnect );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::placeJunction );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::placeLabel );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::placeGlobalLabel );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::placeHierLabel );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::drawSheet );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::importSheetPin );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::drawLines );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::placeSchematicText );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, EE_ACTIONS::placeImage );
|
|
||||||
TOGGLE_TOOL( m_drawToolBar, ACTIONS::deleteTool );
|
|
||||||
m_drawToolBar->Refresh();
|
|
||||||
}
|
|
||||||
|
|
|
@ -1175,7 +1175,7 @@ void GERBVIEW_FRAME::setupTools()
|
||||||
|
|
||||||
void GERBVIEW_FRAME::setupUIConditions()
|
void GERBVIEW_FRAME::setupUIConditions()
|
||||||
{
|
{
|
||||||
EDA_BASE_FRAME::setupUIConditions();
|
EDA_DRAW_FRAME::setupUIConditions();
|
||||||
|
|
||||||
ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
|
ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
|
||||||
EDITOR_CONDITIONS cond( this );
|
EDITOR_CONDITIONS cond( this );
|
||||||
|
|
|
@ -242,7 +242,7 @@ void PL_EDITOR_FRAME::setupTools()
|
||||||
|
|
||||||
void PL_EDITOR_FRAME::setupUIConditions()
|
void PL_EDITOR_FRAME::setupUIConditions()
|
||||||
{
|
{
|
||||||
EDA_BASE_FRAME::setupUIConditions();
|
EDA_DRAW_FRAME::setupUIConditions();
|
||||||
|
|
||||||
ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
|
ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
|
||||||
EDITOR_CONDITIONS cond( this );
|
EDITOR_CONDITIONS cond( this );
|
||||||
|
@ -259,10 +259,10 @@ void PL_EDITOR_FRAME::setupUIConditions()
|
||||||
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
|
mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) );
|
||||||
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
|
mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) );
|
||||||
|
|
||||||
mgr->SetConditions( ACTIONS::cut, ENABLE( SELECTION_CONDITIONS::MoreThan( 0 ) ) );
|
mgr->SetConditions( ACTIONS::cut, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
|
||||||
mgr->SetConditions( ACTIONS::copy, ENABLE( SELECTION_CONDITIONS::MoreThan( 0 ) ) );
|
mgr->SetConditions( ACTIONS::copy, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
|
||||||
mgr->SetConditions( ACTIONS::paste, ENABLE( SELECTION_CONDITIONS::Idle ) );
|
mgr->SetConditions( ACTIONS::paste, ENABLE( SELECTION_CONDITIONS::Idle ) );
|
||||||
mgr->SetConditions( ACTIONS::doDelete, ENABLE( SELECTION_CONDITIONS::MoreThan( 0 ) ) );
|
mgr->SetConditions( ACTIONS::doDelete, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
|
||||||
|
|
||||||
mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
|
mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
|
||||||
mgr->SetConditions( ACTIONS::selectionTool, CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
|
mgr->SetConditions( ACTIONS::selectionTool, CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
|
||||||
|
|
Loading…
Reference in New Issue