diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index 282f63da0a..4313ed1656 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -94,14 +94,14 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly, bool* aAppendUndo } -void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic, - ANNOTATE_ORDER_T aSortOption, - ANNOTATE_OPTION_T aAlgoOption, - int aStartNumber, - bool aResetAnnotation, - bool aRepairTimestamps, - bool aLockUnits, - REPORTER& aReporter ) +void SCH_EDIT_FRAME::AnnotateSymbols( bool aAnnotateSchematic, + ANNOTATE_ORDER_T aSortOption, + ANNOTATE_OPTION_T aAlgoOption, + int aStartNumber, + bool aResetAnnotation, + bool aRepairTimestamps, + bool aLockUnits, + REPORTER& aReporter ) { SCH_REFERENCE_LIST references; SCH_SCREENS screens( Schematic().Root() ); diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp index 44a1f2c76c..58e8613670 100644 --- a/eeschema/dialogs/dialog_annotate.cpp +++ b/eeschema/dialogs/dialog_annotate.cpp @@ -182,9 +182,9 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) REPORTER& reporter = m_MessageWindow->Reporter(); m_MessageWindow->SetLazyUpdate( true ); // Don't update after each message - m_Parent->AnnotateComponents( GetLevel(), (ANNOTATE_ORDER_T) GetSortOrder(), - (ANNOTATE_OPTION_T) GetAnnotateAlgo(), GetStartNumber(), - GetResetItems() , true, GetLockUnits(), reporter ); + m_Parent->AnnotateSymbols( GetLevel(), (ANNOTATE_ORDER_T) GetSortOrder(), + (ANNOTATE_OPTION_T) GetAnnotateAlgo(), GetStartNumber(), + GetResetItems(), true, GetLockUnits(), reporter ); m_MessageWindow->Flush( true ); // Now update to show all messages diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index dcd21a3a5a..60d6cc7f63 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -404,7 +404,7 @@ public: void DeleteAnnotation( bool aCurrentSheetOnly, bool* appendUndo ); /** - * Annotate the components in the schematic that are not currently annotated. + * Annotate the symbols in the schematic that are not currently annotated. * * @param aAnnotateSchematic Annotate the entire schematic if true. Otherwise annotate * the current sheet only. @@ -418,23 +418,21 @@ public: * could change previous annotation because time stamps are * used to handle annotation in complex hierarchies. * @param aLockUnits When both aLockUnits and aResetAnnotation are true, all unit - * associations should be kept when reannotating. That is, if - * two components were R8A and R8B, they may become R3A and R3B, - * but not R3A and R3C or R3C and R4D. - * When aResetAnnotation is true but aLockUnits is false, the - * usual behavior of annotating each part individually is - * performed. - * When aResetAnnotation is false, this option has no effect. + * associations should be kept when reannotating. That is, if two + * components were R8A and R8B, they may become R3A and R3B, but not + * R3A and R3C or R3C and R4D. + * When aResetAnnotation is true but aLockUnits is false, the usual + * behavior of annotating each part individually is performed. + * When aResetAnnotation is false, this option has no effect. * @param aReporter A sink for error messages. Use NULL_REPORTER if you don't need errors. * * When the sheet number is used in annotation, each sheet annotation starts from sheet * number * 100. In other words the first sheet uses 100 to 199, the second sheet uses * 200 to 299, and so on. */ - void AnnotateComponents( bool aAnnotateSchematic, ANNOTATE_ORDER_T aSortOption, - ANNOTATE_OPTION_T aAlgoOption, int aStartNumber, - bool aResetAnnotation, bool aRepairTimestamps, bool aLockUnits, - REPORTER& aReporter ); + void AnnotateSymbols( bool aAnnotateSchematic, ANNOTATE_ORDER_T aSortOption, + ANNOTATE_OPTION_T aAlgoOption, int aStartNumber, bool aResetAnnotation, + bool aRepairTimestamps, bool aLockUnits, REPORTER& aReporter ); /** * Check for annotation errors. diff --git a/eeschema/symbol_editor/menubar_symbol_editor.cpp b/eeschema/symbol_editor/menubar_symbol_editor.cpp index 51c4ce00cd..46c952e7cb 100644 --- a/eeschema/symbol_editor/menubar_symbol_editor.cpp +++ b/eeschema/symbol_editor/menubar_symbol_editor.cpp @@ -130,7 +130,7 @@ void SYMBOL_EDIT_FRAME::ReCreateMenuBar() viewMenu->Add( ACTIONS::toggleCursorStyle, ACTION_MENU::CHECK ); viewMenu->AppendSeparator(); - viewMenu->Add( EE_ACTIONS::showComponentTree, ACTION_MENU::CHECK ); + viewMenu->Add( EE_ACTIONS::showSymbolTree, ACTION_MENU::CHECK ); //-- Place menu ----------------------------------------------- diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index 6af27c3e68..96f71f7396 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -407,11 +407,11 @@ void SYMBOL_EDIT_FRAME::setupUIConditions() auto showCompTreeCond = [this] ( const SELECTION& ) { - return IsSearchTreeShown(); + return IsSymbolTreeShown(); }; mgr->SetConditions( EE_ACTIONS::showElectricalTypes, CHECK( pinTypeCond ) ); - mgr->SetConditions( EE_ACTIONS::showComponentTree, CHECK( showCompTreeCond ) ); + mgr->SetConditions( EE_ACTIONS::showSymbolTree, CHECK( showCompTreeCond ) ); auto demorganCond = [this] ( const SELECTION& ) @@ -555,15 +555,15 @@ void SYMBOL_EDIT_FRAME::RebuildSymbolUnitsList() } -void SYMBOL_EDIT_FRAME::OnToggleSearchTree( wxCommandEvent& event ) +void SYMBOL_EDIT_FRAME::OnToggleSymbolTree( wxCommandEvent& event ) { auto& treePane = m_auimgr.GetPane( m_treePane ); - treePane.Show( !IsSearchTreeShown() ); + treePane.Show( !IsSymbolTreeShown() ); m_auimgr.Update(); } -bool SYMBOL_EDIT_FRAME::IsSearchTreeShown() +bool SYMBOL_EDIT_FRAME::IsSymbolTreeShown() { return m_auimgr.GetPane( m_treePane ).IsShown(); } @@ -1300,10 +1300,10 @@ void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_COMPONENT* aSymbol ) ReCreateMenuBar(); ReCreateHToolbar(); - if( IsSearchTreeShown() ) + if( IsSymbolTreeShown() ) { wxCommandEvent evt; - OnToggleSearchTree( evt ); + OnToggleSymbolTree( evt ); } updateTitle(); diff --git a/eeschema/symbol_editor/symbol_edit_frame.h b/eeschema/symbol_editor/symbol_edit_frame.h index 432da7782a..4c4b606c39 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.h +++ b/eeschema/symbol_editor/symbol_edit_frame.h @@ -170,9 +170,9 @@ public: void OnSelectUnit( wxCommandEvent& event ); - void OnToggleSearchTree( wxCommandEvent& event ); + void OnToggleSymbolTree( wxCommandEvent& event ); - bool IsSearchTreeShown(); + bool IsSymbolTreeShown(); void FreezeLibraryTree(); void ThawLibraryTree(); diff --git a/eeschema/symbol_editor/toolbars_symbol_editor.cpp b/eeschema/symbol_editor/toolbars_symbol_editor.cpp index 2b43512e22..964c9bbc4c 100644 --- a/eeschema/symbol_editor/toolbars_symbol_editor.cpp +++ b/eeschema/symbol_editor/toolbars_symbol_editor.cpp @@ -160,7 +160,7 @@ void SYMBOL_EDIT_FRAME::ReCreateOptToolbar() m_optionsToolBar->Add( ACTIONS::millimetersUnits, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( EE_ACTIONS::showElectricalTypes, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( EE_ACTIONS::showComponentTree, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( EE_ACTIONS::showSymbolTree, ACTION_TOOLBAR::TOGGLE ); EE_SELECTION_TOOL* selTool = m_toolManager->GetTool(); std::unique_ptr gridMenu = std::make_unique( false, selTool ); diff --git a/eeschema/tools/ee_actions.cpp b/eeschema/tools/ee_actions.cpp index 2d482f01be..2b89f920dd 100644 --- a/eeschema/tools/ee_actions.cpp +++ b/eeschema/tools/ee_actions.cpp @@ -183,7 +183,7 @@ TOOL_ACTION EE_ACTIONS::showElectricalTypes( "eeschema.SymbolLibraryControl.show _( "Show Pin Electrical Types" ), _( "Annotate pins with their electrical types" ), BITMAPS::pin_show_etype ); -TOOL_ACTION EE_ACTIONS::showComponentTree( "eeschema.SymbolLibraryControl.showComponentTree", +TOOL_ACTION EE_ACTIONS::showSymbolTree( "eeschema.SymbolLibraryControl.showSymbolTree", AS_GLOBAL, 0, "", _( "Show Symbol Tree" ), "", BITMAPS::search_tree ); diff --git a/eeschema/tools/ee_actions.h b/eeschema/tools/ee_actions.h index 55f1937f21..e1b30bdd44 100644 --- a/eeschema/tools/ee_actions.h +++ b/eeschema/tools/ee_actions.h @@ -198,7 +198,7 @@ public: static TOOL_ACTION pushPinNameSize; static TOOL_ACTION pushPinNumSize; static TOOL_ACTION showElectricalTypes; - static TOOL_ACTION showComponentTree; + static TOOL_ACTION showSymbolTree; static TOOL_ACTION toggleForceHV; static TOOL_ACTION drawSheetOnClipboard; static TOOL_ACTION exportSymbolView; diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index 17dca15769..f3bd433d07 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -85,9 +85,9 @@ bool SCH_DRAWING_TOOLS::Init() } -int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent ) +int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent ) { - SCH_COMPONENT* component = aEvent.Parameter(); + SCH_COMPONENT* symbol = aEvent.Parameter(); SCHLIB_FILTER filter; std::vector* historyList = nullptr; @@ -107,7 +107,7 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent ) } else { - wxFAIL_MSG( "PlaceCompontent(): unexpected request" ); + wxFAIL_MSG( "PlaceSymbol(): unexpected request" ); } getViewControls()->ShowCursor( true ); @@ -134,8 +134,8 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent ) auto setCursor = [&]() { - m_frame->GetCanvas()->SetCurrentCursor( component ? KICURSOR::MOVING - : KICURSOR::COMPONENT ); + m_frame->GetCanvas()->SetCurrentCursor( symbol ? KICURSOR::MOVING + : KICURSOR::COMPONENT ); }; auto cleanup = @@ -143,13 +143,13 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent ) { m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_frame->RollbackSchematicFromUndo(); - component = nullptr; + symbol = nullptr; }; // Prime the pump - if( component ) + if( symbol ) { - addSymbol( component ); + addSymbol( symbol ); getViewControls()->WarpCursor( getViewControls()->GetMousePosition( false ) ); } else if( !aEvent.IsReactivate() ) @@ -168,7 +168,7 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent ) if( evt->IsCancelInteractive() ) { - if( component ) + if( symbol ) { cleanup(); } @@ -180,14 +180,14 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent ) } else if( evt->IsActivate() ) { - if( component && evt->IsMoveTool() ) + if( symbol && evt->IsMoveTool() ) { // we're already moving our own item; ignore the move tool evt->SetPassEvent( false ); continue; } - if( component ) + if( symbol ) cleanup(); if( evt->IsMoveTool() ) @@ -203,7 +203,7 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent ) } else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) ) { - if( !component ) + if( !symbol ) { m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); @@ -220,33 +220,33 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent ) if( !part ) continue; - component = new SCH_COMPONENT( *part, &m_frame->GetCurrentSheet(), sel, - (wxPoint) cursorPos ); - addSymbol( component ); + wxPoint pos( cursorPos ); + symbol = new SCH_COMPONENT( *part, &m_frame->GetCurrentSheet(), sel, pos ); + addSymbol( symbol ); - // Update cursor now that we have a component + // Update cursor now that we have a symbol setCursor(); } else { - SCH_COMPONENT* next_comp = nullptr; + SCH_COMPONENT* nextSymbol = nullptr; if( m_frame->eeconfig()->m_AutoplaceFields.enable ) - component->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false ); + symbol->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false ); m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &m_selectionTool->GetSelection() ); - m_view->Update( component ); + m_view->Update( symbol ); m_frame->OnModify(); if( m_frame->eeconfig()->m_SymChooserPanel.place_all_units || m_frame->eeconfig()->m_SymChooserPanel.keep_symbol ) { - int new_unit = component->GetUnit(); + int new_unit = symbol->GetUnit(); if( m_frame->eeconfig()->m_SymChooserPanel.place_all_units - && component->GetUnit() < component->GetUnitCount() ) + && symbol->GetUnit() < symbol->GetUnitCount() ) { new_unit++; } @@ -255,24 +255,24 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent ) new_unit = 1; } - // We are either stepping to the next unit or next component + // We are either stepping to the next unit or next symbol if( m_frame->eeconfig()->m_SymChooserPanel.keep_symbol || new_unit > 1 ) { - next_comp = static_cast( component->Duplicate() ); - next_comp->SetUnit( new_unit ); - next_comp->SetUnitSelection( new_unit ); + nextSymbol = static_cast( symbol->Duplicate() ); + nextSymbol->SetUnit( new_unit ); + nextSymbol->SetUnitSelection( new_unit ); - addSymbol( next_comp ); + addSymbol( nextSymbol ); } } - component = next_comp; + symbol = nextSymbol; } } else if( evt->IsClick( BUT_RIGHT ) ) { // Warp after context menu only if dragging... - if( !component ) + if( !symbol ) m_toolMgr->VetoContextMenuMouseWarp(); m_menu.ShowContextMenu( m_selectionTool->GetSelection() ); @@ -284,21 +284,21 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent ) { int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP; - if( component ) + if( symbol ) { - m_frame->SelectUnit( component, unit ); + m_frame->SelectUnit( symbol, unit ); m_toolMgr->RunAction( ACTIONS::refreshPreview ); } } } - else if( component && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) ) + else if( symbol && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) ) { - component->SetPosition( (wxPoint)cursorPos ); - m_view->Update( component ); + symbol->SetPosition( (wxPoint)cursorPos ); + m_view->Update( symbol ); } else if( evt->IsAction( &ACTIONS::doDelete ) ) { - if( component ) + if( symbol ) cleanup(); } else @@ -307,8 +307,8 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent ) } // Enable autopanning and cursor capture only when there is a footprint to be placed - getViewControls()->SetAutoPan( component != nullptr ); - getViewControls()->CaptureCursor( component != nullptr ); + getViewControls()->SetAutoPan( symbol != nullptr ); + getViewControls()->CaptureCursor( symbol != nullptr ); } m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW ); @@ -1317,8 +1317,8 @@ void SCH_DRAWING_TOOLS::sizeSheet( SCH_SHEET* aSheet, VECTOR2I aPos ) void SCH_DRAWING_TOOLS::setTransitions() { - Go( &SCH_DRAWING_TOOLS::PlaceComponent, EE_ACTIONS::placeSymbol.MakeEvent() ); - Go( &SCH_DRAWING_TOOLS::PlaceComponent, EE_ACTIONS::placePower.MakeEvent() ); + Go( &SCH_DRAWING_TOOLS::PlaceSymbol, EE_ACTIONS::placeSymbol.MakeEvent() ); + Go( &SCH_DRAWING_TOOLS::PlaceSymbol, EE_ACTIONS::placePower.MakeEvent() ); Go( &SCH_DRAWING_TOOLS::SingleClickPlace, EE_ACTIONS::placeNoConnect.MakeEvent() ); Go( &SCH_DRAWING_TOOLS::SingleClickPlace, EE_ACTIONS::placeJunction.MakeEvent() ); Go( &SCH_DRAWING_TOOLS::SingleClickPlace, EE_ACTIONS::placeBusWireEntry.MakeEvent() ); diff --git a/eeschema/tools/sch_drawing_tools.h b/eeschema/tools/sch_drawing_tools.h index ab6d7b1c35..ef6cba196d 100644 --- a/eeschema/tools/sch_drawing_tools.h +++ b/eeschema/tools/sch_drawing_tools.h @@ -50,7 +50,7 @@ public: /// @copydoc TOOL_INTERACTIVE::Init() bool Init() override; - int PlaceComponent( const TOOL_EVENT& aEvent ); + int PlaceSymbol( const TOOL_EVENT& aEvent ); int SingleClickPlace( const TOOL_EVENT& aEvent ); int TwoClickPlace( const TOOL_EVENT& aEvent ); int DrawSheet( const TOOL_EVENT& aEvent ); diff --git a/eeschema/tools/symbol_editor_control.cpp b/eeschema/tools/symbol_editor_control.cpp index 6558c44e2b..ce642a09d3 100644 --- a/eeschema/tools/symbol_editor_control.cpp +++ b/eeschema/tools/symbol_editor_control.cpp @@ -332,12 +332,12 @@ int SYMBOL_EDITOR_CONTROL::UnpinLibrary( const TOOL_EVENT& aEvent ) } -int SYMBOL_EDITOR_CONTROL::ShowComponentTree( const TOOL_EVENT& aEvent ) +int SYMBOL_EDITOR_CONTROL::ShowSymbolTree( const TOOL_EVENT& aEvent ) { if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) { wxCommandEvent dummy; - static_cast( m_frame )->OnToggleSearchTree( dummy ); + static_cast( m_frame )->OnToggleSymbolTree( dummy ); } return 0; @@ -438,12 +438,12 @@ int SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG( const TOOL_EVENT& aEvent ) PAGE_INFO pageSave = editFrame->GetScreen()->GetPageSettings(); PAGE_INFO pageTemp = pageSave; - wxSize componentSize = part->GetUnitBoundingBox( editFrame->GetUnit(), - editFrame->GetConvert() ).GetSize(); + wxSize symbolSize = part->GetUnitBoundingBox( editFrame->GetUnit(), + editFrame->GetConvert() ).GetSize(); // Add a small margin to the plot bounding box - pageTemp.SetWidthMils( int( componentSize.x * 1.2 ) ); - pageTemp.SetHeightMils( int( componentSize.y * 1.2 ) ); + pageTemp.SetWidthMils( int( symbolSize.x * 1.2 ) ); + pageTemp.SetHeightMils( int( symbolSize.y * 1.2 ) ); editFrame->GetScreen()->SetPageSettings( pageTemp ); editFrame->SVGPlotSymbol( fullFileName ); @@ -508,7 +508,7 @@ int SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent ) SCH_COMPONENT* symbol = new SCH_COMPONENT( *part, libId, &schframe->GetCurrentSheet(), unit, convert ); - symbol->SetParent( schframe->GetCurrentSheet().LastScreen() ); + symbol->SetParent( schframe->GetScreen() ); if( schframe->eeconfig()->m_AutoplaceFields.enable ) symbol->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false ); @@ -551,6 +551,6 @@ 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::ShowComponentTree, EE_ACTIONS::showComponentTree.MakeEvent() ); + Go( &SYMBOL_EDITOR_CONTROL::ShowSymbolTree, EE_ACTIONS::showSymbolTree.MakeEvent() ); Go( &SYMBOL_EDITOR_CONTROL::ToggleSyncedPinsMode, EE_ACTIONS::toggleSyncedPinsMode.MakeEvent() ); } diff --git a/eeschema/tools/symbol_editor_control.h b/eeschema/tools/symbol_editor_control.h index c6c555076d..30d94872e4 100644 --- a/eeschema/tools/symbol_editor_control.h +++ b/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 ShowComponentTree( const TOOL_EVENT& aEvent ); + int ShowSymbolTree( const TOOL_EVENT& aEvent ); int ToggleSyncedPinsMode( const TOOL_EVENT& aEvent ); private: