Naming conventions.

This commit is contained in:
Jeff Young 2021-03-18 11:46:07 +00:00
parent cc70a9fa98
commit e206a9d39a
13 changed files with 82 additions and 84 deletions

View File

@ -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() );

View File

@ -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

View File

@ -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.

View File

@ -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 -----------------------------------------------

View File

@ -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();

View File

@ -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();

View File

@ -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<EE_SELECTION_TOOL>();
std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );

View File

@ -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 );

View File

@ -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;

View File

@ -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*>();
SCH_COMPONENT* symbol = aEvent.Parameter<SCH_COMPONENT*>();
SCHLIB_FILTER filter;
std::vector<PICKED_SYMBOL>* 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<SCH_COMPONENT*>( component->Duplicate() );
next_comp->SetUnit( new_unit );
next_comp->SetUnitSelection( new_unit );
nextSymbol = static_cast<SCH_COMPONENT*>( 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() );

View File

@ -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 );

View File

@ -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<SYMBOL_EDIT_FRAME*>( m_frame )->OnToggleSearchTree( dummy );
static_cast<SYMBOL_EDIT_FRAME*>( 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() );
}

View File

@ -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: