Fix gcc issue with temp variable and move some collection specs.
Having the collection specs localized with their code improves encapsulation. (Thanks to crasic for the original patch.)
This commit is contained in:
parent
35e8a340ca
commit
588d13a912
|
@ -88,42 +88,6 @@ const KICAD_T SCH_COLLECTOR::EditableItems[] = {
|
|||
EOT
|
||||
};
|
||||
|
||||
const KICAD_T SCH_COLLECTOR::MovableItems[] = {
|
||||
SCH_MARKER_T,
|
||||
SCH_JUNCTION_T,
|
||||
SCH_NO_CONNECT_T,
|
||||
SCH_BUS_BUS_ENTRY_T,
|
||||
SCH_BUS_WIRE_ENTRY_T,
|
||||
SCH_LINE_T,
|
||||
SCH_BITMAP_T,
|
||||
SCH_TEXT_T,
|
||||
SCH_LABEL_T,
|
||||
SCH_GLOBAL_LABEL_T,
|
||||
SCH_HIER_LABEL_T,
|
||||
SCH_FIELD_T,
|
||||
SCH_COMPONENT_T,
|
||||
SCH_SHEET_PIN_T,
|
||||
SCH_SHEET_T,
|
||||
EOT
|
||||
};
|
||||
|
||||
|
||||
const KICAD_T SCH_COLLECTOR::DraggableItems[] = {
|
||||
SCH_JUNCTION_T,
|
||||
SCH_NO_CONNECT_T,
|
||||
SCH_BUS_BUS_ENTRY_T,
|
||||
SCH_BUS_WIRE_ENTRY_T,
|
||||
SCH_LINE_T,
|
||||
SCH_LABEL_T,
|
||||
SCH_GLOBAL_LABEL_T,
|
||||
SCH_HIER_LABEL_T,
|
||||
SCH_COMPONENT_T,
|
||||
SCH_SHEET_T,
|
||||
SCH_TEXT_T,
|
||||
EOT
|
||||
};
|
||||
|
||||
|
||||
const KICAD_T SCH_COLLECTOR::RotatableItems[] = {
|
||||
SCH_TEXT_T,
|
||||
SCH_LABEL_T,
|
||||
|
@ -158,40 +122,6 @@ const KICAD_T SCH_COLLECTOR::SheetsAndSheetLabels[] = {
|
|||
};
|
||||
|
||||
|
||||
const KICAD_T SCH_COLLECTOR::OrientableItems[] = {
|
||||
SCH_BUS_BUS_ENTRY_T,
|
||||
SCH_BUS_WIRE_ENTRY_T,
|
||||
SCH_COMPONENT_T,
|
||||
SCH_BITMAP_T,
|
||||
SCH_SHEET_T,
|
||||
EOT
|
||||
};
|
||||
|
||||
|
||||
const KICAD_T SCH_COLLECTOR::CopyableItems[] = {
|
||||
SCH_TEXT_T,
|
||||
SCH_LABEL_T,
|
||||
SCH_GLOBAL_LABEL_T,
|
||||
SCH_HIER_LABEL_T,
|
||||
SCH_COMPONENT_T,
|
||||
EOT
|
||||
};
|
||||
|
||||
|
||||
const KICAD_T SCH_COLLECTOR::DoubleClickItems[] = {
|
||||
SCH_TEXT_T,
|
||||
SCH_LABEL_T,
|
||||
SCH_GLOBAL_LABEL_T,
|
||||
SCH_HIER_LABEL_T,
|
||||
SCH_COMPONENT_T,
|
||||
SCH_SHEET_T,
|
||||
SCH_BITMAP_T,
|
||||
SCH_FIELD_T,
|
||||
SCH_MARKER_T,
|
||||
EOT
|
||||
};
|
||||
|
||||
|
||||
SEARCH_RESULT SCH_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData )
|
||||
{
|
||||
if( aItem->HitTest( m_RefPos ) )
|
||||
|
|
|
@ -40,16 +40,11 @@ class SCH_COLLECTOR : public COLLECTOR
|
|||
public:
|
||||
static const KICAD_T AllItems[];
|
||||
static const KICAD_T EditableItems[];
|
||||
static const KICAD_T MovableItems[];
|
||||
static const KICAD_T DraggableItems[];
|
||||
static const KICAD_T RotatableItems[];
|
||||
static const KICAD_T AllItemsButPins[];
|
||||
static const KICAD_T ComponentsOnly[];
|
||||
static const KICAD_T SheetsOnly[];
|
||||
static const KICAD_T SheetsAndSheetLabels[];
|
||||
static const KICAD_T OrientableItems[];
|
||||
static const KICAD_T CopyableItems[];
|
||||
static const KICAD_T DoubleClickItems[];
|
||||
|
||||
/**
|
||||
* Constructor SCH_COLLECTOR
|
||||
|
|
|
@ -416,6 +416,26 @@ void SCH_EDIT_TOOL::Reset( RESET_REASON aReason )
|
|||
|
||||
int SCH_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
const KICAD_T movableItems[] =
|
||||
{
|
||||
SCH_MARKER_T,
|
||||
SCH_JUNCTION_T,
|
||||
SCH_NO_CONNECT_T,
|
||||
SCH_BUS_BUS_ENTRY_T,
|
||||
SCH_BUS_WIRE_ENTRY_T,
|
||||
SCH_LINE_T,
|
||||
SCH_BITMAP_T,
|
||||
SCH_TEXT_T,
|
||||
SCH_LABEL_T,
|
||||
SCH_GLOBAL_LABEL_T,
|
||||
SCH_HIER_LABEL_T,
|
||||
SCH_FIELD_T,
|
||||
SCH_COMPONENT_T,
|
||||
SCH_SHEET_PIN_T,
|
||||
SCH_SHEET_T,
|
||||
EOT
|
||||
};
|
||||
|
||||
KIGFX::VIEW_CONTROLS* controls = getViewControls();
|
||||
|
||||
controls->SetSnapping( true );
|
||||
|
@ -423,7 +443,7 @@ int SCH_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|
||||
// Be sure that there is at least one item that we can modify. If nothing was selected before,
|
||||
// try looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection)
|
||||
SELECTION& selection = m_selectionTool->RequestSelection( SCH_COLLECTOR::MovableItems );
|
||||
SELECTION& selection = m_selectionTool->RequestSelection( movableItems );
|
||||
bool unselect = selection.IsHover();
|
||||
|
||||
if( selection.Empty() )
|
||||
|
@ -1068,7 +1088,23 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SCH_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SELECTION& selection = m_selectionTool->RequestSelection( SCH_COLLECTOR::DraggableItems );
|
||||
static KICAD_T duplicatableItems[] =
|
||||
{
|
||||
SCH_JUNCTION_T,
|
||||
SCH_LINE_T,
|
||||
SCH_BUS_BUS_ENTRY_T,
|
||||
SCH_BUS_WIRE_ENTRY_T,
|
||||
SCH_TEXT_T,
|
||||
SCH_LABEL_T,
|
||||
SCH_GLOBAL_LABEL_T,
|
||||
SCH_HIER_LABEL_T,
|
||||
SCH_NO_CONNECT_T,
|
||||
SCH_SHEET_T,
|
||||
SCH_COMPONENT_T,
|
||||
EOT
|
||||
};
|
||||
|
||||
SELECTION& selection = m_selectionTool->RequestSelection( duplicatableItems );
|
||||
|
||||
if( selection.GetSize() == 0 )
|
||||
return 0;
|
||||
|
@ -1097,7 +1133,6 @@ int SCH_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|||
case SCH_LABEL_T:
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
case SCH_HIER_LABEL_T:
|
||||
case SCH_MARKER_T:
|
||||
case SCH_NO_CONNECT_T:
|
||||
newItem->SetParent( m_frame->GetScreen() );
|
||||
m_frame->AddToScreen( newItem );
|
||||
|
|
|
@ -701,7 +701,7 @@ int SCH_EDITOR_CONTROL::EditWithSymbolEditor( const TOOL_EVENT& aEvent )
|
|||
int SCH_EDITOR_CONTROL::EnterSheet( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
|
||||
const SELECTION& selection = selTool->RequestSelection( (KICAD_T[]) { SCH_SHEET_T, EOT } );
|
||||
const SELECTION& selection = selTool->RequestSelection( SCH_COLLECTOR::SheetsOnly );
|
||||
|
||||
if( selection.GetSize() == 1 )
|
||||
{
|
||||
|
|
|
@ -513,7 +513,9 @@ int SCH_SELECTION_TOOL::SelectNode( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SCH_SELECTION_TOOL::SelectConnection( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
RequestSelection( (KICAD_T[]) { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT } );
|
||||
static KICAD_T wiresAndBusses[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT };
|
||||
|
||||
RequestSelection( wiresAndBusses );
|
||||
|
||||
if( m_selection.Empty() )
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue