Don't allow moving markers. Do allow excluding them.

This commit is contained in:
Jeff Young 2021-02-19 14:51:18 +00:00
parent c2f68ca4da
commit 57e043e0e6
6 changed files with 30 additions and 9 deletions

View File

@ -577,7 +577,7 @@ TOOL_ACTION EE_ACTIONS::schematicSetup( "eeschema.EditorControl.schematicSetup",
TOOL_ACTION EE_ACTIONS::editPageNumber( "eeschema.EditorControl.editPageNumber", TOOL_ACTION EE_ACTIONS::editPageNumber( "eeschema.EditorControl.editPageNumber",
AS_GLOBAL, 0, "", AS_GLOBAL, 0, "",
_( "Edit Page Number..." ), _( "Edit Sheet Page Number..." ),
_( "Edit the page number of the current or selected sheet" ), _( "Edit the page number of the current or selected sheet" ),
nullptr ); nullptr );

View File

@ -37,7 +37,7 @@
#include <symbol_edit_frame.h> #include <symbol_edit_frame.h>
#include <symbol_viewer_frame.h> #include <symbol_viewer_frame.h>
#include <eda_doc.h> #include <eda_doc.h>
#include <invoke_sch_dialog.h> #include <sch_marker.h>
#include <project.h> #include <project.h>
#include <dialogs/dialog_display_info_HTML_base.h> #include <dialogs/dialog_display_info_HTML_base.h>
#include <dialogs/dialog_erc.h> #include <dialogs/dialog_erc.h>
@ -62,6 +62,8 @@ bool EE_INSPECTION_TOOL::Init()
// //
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu(); CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
selToolMenu.AddItem( EE_ACTIONS::excludeMarker, singleMarkerCondition, 100 );
selToolMenu.AddItem( EE_ACTIONS::showDatasheet, EE_CONDITIONS::SingleSymbol && EE_CONDITIONS::Idle, 220 ); selToolMenu.AddItem( EE_ACTIONS::showDatasheet, EE_CONDITIONS::SingleSymbol && EE_CONDITIONS::Idle, 220 );
return true; return true;
@ -154,7 +156,25 @@ int EE_INSPECTION_TOOL::NextMarker( const TOOL_EVENT& aEvent )
int EE_INSPECTION_TOOL::ExcludeMarker( const TOOL_EVENT& aEvent ) int EE_INSPECTION_TOOL::ExcludeMarker( const TOOL_EVENT& aEvent )
{ {
if( m_ercDialog ) if( m_ercDialog )
{
// Let the ERC dialog handle it since it has more update hassles to worry about
m_ercDialog->ExcludeMarker(); m_ercDialog->ExcludeMarker();
}
else
{
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = selTool->GetSelection();
if( selection.GetSize() == 1 && selection.Front()->Type() == SCH_MARKER_T )
{
SCH_MARKER* marker = static_cast<SCH_MARKER*>( selection.Front() );
marker->SetExcluded( true );
m_frame->GetCanvas()->GetView()->Update( marker );
m_frame->GetCanvas()->Refresh();
m_frame->OnModify();
}
}
return 0; return 0;
} }

View File

@ -168,11 +168,12 @@ bool EE_SELECTION_TOOL::Init()
auto sheetSelection = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T ); auto sheetSelection = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T );
auto schEditSheetPageNumberCondition = auto schEditSheetPageNumberCondition =
[this] ( const SELECTION& aSel ) [&] ( const SELECTION& aSel )
{ {
return !m_isSymbolEditor if( m_isSymbolEditor || m_isSymbolViewer )
&& !m_isSymbolViewer return false;
&& ( E_C::Empty || ( E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T ) ) );
return ( E_C::Empty( aSel ) || sheetSelection( aSel ) );
}; };
auto schEditCondition = auto schEditCondition =

View File

@ -261,6 +261,7 @@ bool SCH_EDIT_TOOL::Init()
auto singleSymbolCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_COMPONENT_T ); auto singleSymbolCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_COMPONENT_T );
auto singleSheetCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T ); auto singleSheetCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T );
// //
// Add edit actions to the move tool menu // Add edit actions to the move tool menu
// //
@ -1798,7 +1799,7 @@ int SCH_EDIT_TOOL::EditPageNumber( const TOOL_EVENT& aEvent )
msg.Printf( _( "Enter page number for sheet path%s" ), msg.Printf( _( "Enter page number for sheet path%s" ),
( sheetPath.Length() > 20 ) ? "\n" + sheetPath : " " + sheetPath ); ( sheetPath.Length() > 20 ) ? "\n" + sheetPath : " " + sheetPath );
wxTextEntryDialog dlg( m_frame, msg, _( "Edit Page Number" ), pageNumber ); wxTextEntryDialog dlg( m_frame, msg, _( "Edit Sheet Page Number" ), pageNumber );
dlg.SetTextValidator( wxFILTER_ALPHANUMERIC ); // No white space. dlg.SetTextValidator( wxFILTER_ALPHANUMERIC ); // No white space.

View File

@ -60,7 +60,7 @@ bool SCH_MOVE_TOOL::Init()
auto moveCondition = auto moveCondition =
[]( const SELECTION& aSel ) []( const SELECTION& aSel )
{ {
if( aSel.Empty() ) if( aSel.Empty() || SELECTION_CONDITIONS::OnlyType( SCH_MARKER_T )( aSel ) )
return false; return false;
if( SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( aSel ) ) if( SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( aSel ) )

View File

@ -41,7 +41,6 @@ SELECTION_CONDITION operator||( const SELECTION_CONDITION& aConditionA,
SELECTION_CONDITION operator&&( const SELECTION_CONDITION& aConditionA, SELECTION_CONDITION operator&&( const SELECTION_CONDITION& aConditionA,
const SELECTION_CONDITION& aConditionB ); const SELECTION_CONDITION& aConditionB );
SELECTION_CONDITION operator!( const SELECTION_CONDITION& aCondition );
/// Signature for a reference to a function that takes a SELECTION and returns /// Signature for a reference to a function that takes a SELECTION and returns