Commit 7e1745da authored by Wayne Stambaugh's avatar Wayne Stambaugh

EESchema block object select improvements and other minor fixes.

* Move schematic select block from global variable to SCH_EDIT_FRAME.
* Remove redundant schematic drawing code for eeredraw.cpp.
* Move block select code into SCH_SCREEN object.
* Simpilify block item select code.
* Fix bug in SCH_LINE selection state test.
* Add test to schematic objects for connectability.
* Make copy block items function a private method in SCH_EDIT_FRAME.
parent 1e2e1442
This diff is collapsed.
......@@ -26,9 +26,6 @@
#include "build_version.h"
static EDA_ITEM* HighLightStruct = NULL;
void DrawDanglingSymbol( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& pos, int Color )
{
BASE_SCREEN* screen = panel->GetScreen();
......@@ -43,12 +40,6 @@ void DrawDanglingSymbol( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& pos,
}
void SetHighLightStruct( EDA_ITEM* HighLight )
{
HighLightStruct = HighLight;
}
/*
* Redraws only the active window which is assumed to be whole visible.
*/
......@@ -78,8 +69,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if( GetScreen()->m_FileName == m_DefaultSchematicFileName )
{
wxString msg = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
title.Printf( wxT( "%s [%s]" ), msg.GetData(),
GetScreen()->m_FileName.GetData() );
title.Printf( wxT( "%s [%s]" ), GetChars( msg), GetChars( GetScreen()->m_FileName ) );
SetTitle( title );
}
else
......@@ -149,7 +139,7 @@ void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC,
// EDA_ITEM::GetBoundingBox()
// if( panel->m_ClipBox.Intersects( Structs->GetBoundingBox()
// ) )
RedrawOneStruct( panel, DC, Structlist, DrawMode, Color );
Structlist->Draw( panel, DC, wxPoint( 0, 0 ), DrawMode, Color );
}
Structlist = Structlist->Next();
......@@ -157,152 +147,12 @@ void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC,
}
/*****************************************************************************
* Routine to redraw list of structs. *
*****************************************************************************/
/* Routine to redraw on schematic object. */
void RedrawOneStruct( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_ITEM* Struct, int DrawMode, int Color )
{
if( Struct == NULL )
return;
if( HighLightStruct == Struct )
Color = HIGHLIGHT_COLOR;
Struct->Draw( panel, DC, wxPoint( 0, 0 ), DrawMode, Color );
}
/* Routine for repainting item in ghost mode. Used in the block moves. */
void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
SCH_ITEM* aItem,
const wxPoint& aOffset )
{
int DrawMode = g_XorMode;
int width = g_DrawDefaultLineThickness;
GRSetDrawMode( aDC, DrawMode );
switch( aItem->Type() )
{
case SCH_POLYLINE_T:
{
SCH_POLYLINE* Struct = (SCH_POLYLINE*) aItem;
GRMoveTo( Struct->m_PolyPoints[0].x + aOffset.x, Struct->m_PolyPoints[0].y + aOffset.y );
for( unsigned ii = 1; ii < Struct->GetCornerCount(); ii++ )
GRLineTo( &aPanel->m_ClipBox,
aDC,
Struct->m_PolyPoints[ii].x + aOffset.x,
Struct->m_PolyPoints[ii].y + aOffset.y,
width,
g_GhostColor );
break;
}
case SCH_LINE_T:
{
SCH_LINE* Struct;
Struct = (SCH_LINE*) aItem;
if( (Struct->m_Flags & STARTPOINT) == 0 )
{
GRMoveTo( Struct->m_Start.x + aOffset.x, Struct->m_Start.y + aOffset.y );
}
else
{
GRMoveTo( Struct->m_Start.x, Struct->m_Start.y );
}
if( (Struct->m_Flags & ENDPOINT) == 0 )
{
GRLineTo( &aPanel->m_ClipBox, aDC, Struct->m_End.x + aOffset.x,
Struct->m_End.y + aOffset.y, width, g_GhostColor );
}
else
{
GRLineTo( &aPanel->m_ClipBox, aDC, Struct->m_End.x,
Struct->m_End.y, width, g_GhostColor );
}
break;
}
case SCH_BUS_ENTRY_T:
{
SCH_BUS_ENTRY* Struct = (SCH_BUS_ENTRY*) aItem;
wxPoint start = Struct->m_Pos + aOffset;
GRMoveTo( start.x, start.y );
GRLineTo( &aPanel->m_ClipBox, aDC, Struct->m_Size.x + start.x,
Struct->m_Size.y + start.y, width, g_GhostColor );
break;
}
case SCH_JUNCTION_T:
{
SCH_JUNCTION* Struct;
Struct = (SCH_JUNCTION*) aItem;
Struct->Draw( aPanel, aDC, aOffset, DrawMode, g_GhostColor );
break;
}
case SCH_TEXT_T:
{
SCH_TEXT* Struct;
Struct = (SCH_TEXT*) aItem;
Struct->Draw( aPanel, aDC, aOffset, DrawMode, g_GhostColor );
break;
}
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
{
SCH_LABEL* Struct;
Struct = (SCH_LABEL*) aItem;
Struct->Draw( aPanel, aDC, aOffset, DrawMode, g_GhostColor );
break;
}
case SCH_NO_CONNECT_T:
{
SCH_NO_CONNECT* Struct;
Struct = (SCH_NO_CONNECT*) aItem;
Struct->Draw( aPanel, aDC, aOffset, DrawMode, g_GhostColor );
break;
}
case SCH_COMPONENT_T:
{
SCH_COMPONENT* Component = (SCH_COMPONENT*) aItem;
if( Component == NULL )
break;
Component->Draw( aPanel, aDC, aOffset, g_XorMode, g_GhostColor, false );
break;
}
case SCH_SHEET_T:
{
SCH_SHEET* Struct = (SCH_SHEET*) aItem;
GRRect( &aPanel->m_ClipBox,
aDC,
Struct->m_Pos.x + aOffset.x,
Struct->m_Pos.y + aOffset.y,
Struct->m_Pos.x + Struct->m_Size.x + aOffset.x,
Struct->m_Pos.y + Struct->m_Size.y + aOffset.y,
width,
g_GhostColor );
break;
}
case SCH_SHEET_LABEL_T:
case SCH_MARKER_T:
break;
default:
break;
}
}
......@@ -37,10 +37,6 @@ SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item
* before it is modified (used for undo
* managing to restore old values ) */
/* Block operation (copy, paste) */
BLOCK_SELECTOR g_BlockSaveDataList; // List of items to paste
// (Created by Block Save)
bool g_HVLines = true; // Bool: force H or V
// directions (Wires, Bus ..)
......
......@@ -142,10 +142,6 @@ extern SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item
* before it is modified (used for undo
* managing to restore old values ) */
/* Block operation (copy, paste) */
extern BLOCK_SELECTOR g_BlockSaveDataList; /* List of items to paste (Created
* by Block Save) */
// Management options.
extern bool g_HVLines;
......
......@@ -212,8 +212,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
// Set the component value that can differ from component name in lib, for aliases
Component->GetField( VALUE )->m_Text = Name;
Component->DisplayInfo( this );
DrawStructsInGhost( DrawPanel, DC, Component, wxPoint( 0, 0 ) );
Component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
return Component;
}
......@@ -232,13 +231,12 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( erase )
{
DrawStructsInGhost( panel, DC, Component, wxPoint(0,0) );
Component->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
}
move_vector = screen->m_Curseur - Component->m_Pos;
Component->Move( move_vector );
DrawStructsInGhost( panel, DC, Component, wxPoint(0,0) );
Component->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
}
......@@ -258,7 +256,7 @@ void SCH_EDIT_FRAME::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, wxDC* DC,
DrawPanel->CursorOff( DC );
if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
else
{
DrawPanel->PostDirtyRect( DrawComponent->GetBoundingBox() );
......@@ -271,7 +269,7 @@ void SCH_EDIT_FRAME::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, wxDC* DC,
if( DC )
{
if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint(0,0) );
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC );
......@@ -342,7 +340,7 @@ void SCH_EDIT_FRAME::SelPartUnit( SCH_COMPONENT* DrawComponent, int unit, wxDC*
unit = m_UnitCount;
if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
......@@ -352,7 +350,7 @@ void SCH_EDIT_FRAME::SelPartUnit( SCH_COMPONENT* DrawComponent, int unit, wxDC*
/* Redraw the component in the new position. */
if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
......@@ -380,7 +378,7 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC )
}
if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
......@@ -397,7 +395,7 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC )
/* Redraw the component in the new position. */
if( DrawComponent->m_Flags & IS_MOVED )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
......@@ -444,11 +442,11 @@ void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* Component, wxDC* DC )
Component->m_Flags |= IS_MOVED; // omit redrawing the component, erase only
DrawPanel->PostDirtyRect( Component->GetBoundingBox() );
DrawStructsInGhost( DrawPanel, DC, Component, wxPoint(0,0) );
Component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
#else
RedrawOneStruct( DrawPanel, DC, Component, g_XorMode );
Component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
Component->m_Flags |= IS_MOVED;
......
......@@ -132,12 +132,6 @@ SCH_SHEET_PIN* LocateAnyPinSheet( const wxPoint& RefPos, SCH_ITEM* DrawList );
/* EEREDRAW.CPP */
/***************/
void DrawDanglingSymbol( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& pos, int Color );
void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
SCH_ITEM* aItem,
const wxPoint& aOffset );
void SetHighLightStruct( SCH_ITEM* HighLight );
void RedrawActiveWindow( WinEDA_DrawPanel* panel, wxDC* DC );
void RedrawStructList( WinEDA_DrawPanel* panel,
wxDC* DC,
......
......@@ -103,6 +103,8 @@ public:
virtual bool IsSelectStateChanged( const wxRect& aRect );
virtual bool IsConnectable() const { return true; }
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
private:
......
......@@ -42,8 +42,8 @@ class SCH_COMPONENT : public SCH_ITEM
SCH_FIELDS m_Fields; ///< Variable length list of fields.
/**
* Defines the hierarchical path and reference of the component. This allowa support
* for hierarchical sheets that reference the same schematic. The foramt for the path
* Defines the hierarchical path and reference of the component. This allows support
* for hierarchical sheets that reference the same schematic. The format for the path
* is /&ltsheet time stamp&gt/&ltsheet time stamp&gt/.../&lscomponent time stamp&gt.
* A single / denotes the root sheet.
*/
......@@ -282,7 +282,7 @@ public:
* adds a full hierarchical reference (path + local reference)
* @param aPath Hierarchical path (/&ltsheet timestamp&gt/&ltcomponent
* timestamp&gt like /05678E50/A23EF560)
* @param aRef :ocal reference like C45, R56
* @param aRef :local reference like C45, R56
* @param aMulti Part selection, used in multi part per package (0 or 1 for non multi)
*/
void AddHierarchicalReference( const wxString& aPath,
......@@ -349,6 +349,8 @@ public:
virtual bool IsSelectStateChanged( const wxRect& aRect );
virtual bool IsConnectable() const { return true; }
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
/**
......@@ -360,8 +362,6 @@ public:
* @return A pointer to the component library object if found, otherwise NULL.
*/
LIB_DRAW_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT );
#if defined(DEBUG)
/**
......
......@@ -87,6 +87,8 @@ public:
virtual bool IsSelectStateChanged( const wxRect& aRect );
virtual bool IsConnectable() const { return true; }
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
#if defined(DEBUG)
......
......@@ -201,14 +201,18 @@ void SCH_LINE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
GRSetDrawMode( DC, DrawMode );
wxPoint start = m_Start;
wxPoint end = m_End;
if( ( m_Flags & STARTPOINT ) == 0 )
start += offset;
if( ( m_Flags & ENDPOINT ) == 0 )
end += offset;
if( m_Layer == LAYER_NOTES )
GRDashedLine( &panel->m_ClipBox, DC, m_Start.x + offset.x,
m_Start.y + offset.y, m_End.x + offset.x,
m_End.y + offset.y, width, color );
GRDashedLine( &panel->m_ClipBox, DC, start.x, start.y, end.x, end.y, width, color );
else
GRLine( &panel->m_ClipBox, DC, m_Start.x + offset.x,
m_Start.y + offset.y, m_End.x + offset.x, m_End.y + offset.y,
width, color );
GRLine( &panel->m_ClipBox, DC, start.x, start.y, end.x, end.y, width, color );
if( m_StartIsDangling )
DrawDanglingSymbol( panel, DC, m_Start + offset, color );
......@@ -367,20 +371,38 @@ bool SCH_LINE::IsSelectStateChanged( const wxRect& aRect )
{
bool previousState = IsSelected();
if( aRect.Contains( m_Start ) )
m_Flags |= STARTPOINT | SELECTED;
else
m_Flags &= ~( STARTPOINT | SELECTED );
if( aRect.Contains( m_End ) )
m_Flags |= ENDPOINT | SELECTED;
if( aRect.Contains( m_Start ) && aRect.Contains( m_End ) )
{
m_Flags |= SELECTED;
}
else if( aRect.Contains( m_Start ) )
{
m_Flags &= ~STARTPOINT;
m_Flags |= ( SELECTED | ENDPOINT );
}
else if( aRect.Contains( m_End ) )
{
m_Flags &= ~ENDPOINT;
m_Flags |= ( SELECTED | STARTPOINT );
}
else
m_Flags &= ~( ENDPOINT | SELECTED );
{
m_Flags &= ~( SELECTED | STARTPOINT | ENDPOINT );
}
return previousState != IsSelected();
}
bool SCH_LINE::IsConnectable() const
{
if( m_Layer == LAYER_WIRE || m_Layer == LAYER_BUS )
return true;
return false;
}
void SCH_LINE::GetConnectionPoints( vector< wxPoint >& aPoints ) const
{
aPoints.push_back( m_Start );
......
......@@ -119,6 +119,12 @@ public:
virtual bool IsSelectStateChanged( const wxRect& aRect );
/**
* Function IsConnectable
* returns true if the schematic item can connect to another schematic item.
*/
virtual bool IsConnectable() const;
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
#if defined(DEBUG)
......
......@@ -90,6 +90,8 @@ public:
virtual bool IsSelectStateChanged( const wxRect& aRect );
virtual bool IsConnectable() const { return true; }
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
private:
......
......@@ -15,7 +15,10 @@
#include "netlist.h"
#include "class_library.h"
#include "sch_items.h"
#include "sch_bus_entry.h"
#include "sch_line.h"
#include "sch_marker.h"
#include "sch_no_connect.h"
#include "sch_sheet.h"
#include "sch_component.h"
......@@ -447,6 +450,80 @@ void SCH_SCREEN::GetHierarchicalItems( std::vector <SCH_ITEM*> aItems )
}
void SCH_SCREEN::SelectBlockItems()
{
SCH_ITEM* item;
PICKED_ITEMS_LIST* pickedlist = &m_BlockLocate.m_ItemsSelection;
if( pickedlist->GetCount() == 0 )
return;
ClearDrawingState();
for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
{
item = (SCH_ITEM*) pickedlist->GetPickedItem( ii );
item->m_Flags = SELECTED;
}
if( !m_BlockLocate.IsDragging() )
return;
// Select all the items in the screen connected to the items in the block.
for( unsigned ii = 0; ii < pickedlist->GetCount(); ii++ )
{
item = (SCH_ITEM*)pickedlist->GetPickedItem( ii );
if( item->Type() == SCH_LINE_T )
{
item->IsSelectStateChanged( m_BlockLocate );
pickedlist->SetPickerFlags( item->m_Flags, ii );
}
else if( item->IsConnectable() )
{
std::vector< wxPoint > connections;
item->GetConnectionPoints( connections );
for( size_t i = 0; i < connections.size(); i++ )
addConnectedItemsToBlock( connections[i] );
}
}
}
void SCH_SCREEN::addConnectedItemsToBlock( const wxPoint& position )
{
SCH_ITEM* item;
ITEM_PICKER picker;
for( item = GetDrawItems(); item != NULL; item = item = item->Next() )
{
picker.m_PickedItem = item;
picker.m_PickedItemType = item->Type();
if( item->IsSelected() || !item->IsConnectable() || !item->IsConnected( position ) )
continue;
item->m_Flags = SELECTED;
if( item->Type() == SCH_LINE_T )
{
SCH_LINE* line = (SCH_LINE*) item;
if( line->m_Start == position )
item->m_Flags |= ENDPOINT;
else if( line->m_End == position )
item->m_Flags |= STARTPOINT;
}
picker.m_PickerFlags = item->m_Flags;
m_BlockLocate.m_ItemsSelection.PushItem( picker );
}
}
/******************************************************************/
/* Class SCH_SCREENS to handle the list of screens in a hierarchy */
/******************************************************************/
......
......@@ -389,7 +389,7 @@ void SCH_SHEET::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
frame->GetScreen()->SetCurItem( NULL );
frame->DrawPanel->ManageCurseur = NULL;
frame->DrawPanel->ForceCloseManageCurseur = NULL;
RedrawOneStruct( frame->DrawPanel, DC, this, g_XorMode );
Draw( frame->DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
delete this;
return;
}
......
......@@ -187,6 +187,8 @@ public:
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList );
virtual bool IsConnectable() const { return true; }
};
......@@ -500,6 +502,8 @@ public:
virtual bool IsSelectStateChanged( const wxRect& aRect );
virtual bool IsConnectable() const { return true; }
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
#if defined(DEBUG)
......
......@@ -288,6 +288,8 @@ public:
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
virtual bool IsConnectable() const { return true; }
private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
virtual EDA_ITEM* doClone() const;
......@@ -385,6 +387,8 @@ public:
virtual void Rotate( wxPoint rotationPoint );
virtual bool IsConnectable() const { return true; }
private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
virtual EDA_ITEM* doClone() const;
......@@ -484,6 +488,8 @@ public:
virtual void Rotate( wxPoint rotationPoint );
virtual bool IsConnectable() const { return true; }
private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
virtual EDA_ITEM* doClone() const;
......
......@@ -497,8 +497,8 @@ void SCH_EDIT_FRAME::OnUpdateBlockSelected( wxUpdateUIEvent& event )
void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
{
event.Enable( g_BlockSaveDataList.GetCount() > 0 );
m_HToolBar->EnableTool( wxID_PASTE, g_BlockSaveDataList.GetCount() > 0 );
event.Enable( m_blockItems.GetCount() > 0 );
m_HToolBar->EnableTool( wxID_PASTE, m_blockItems.GetCount() > 0 );
}
......
......@@ -124,6 +124,12 @@ public:
{
m_BlockLastCursorPosition = aPosition;
}
/**
* Function IsDragging
* returns true if the current block command is a drag operation.
*/
bool IsDragging() const { return m_Command == BLOCK_DRAG; }
};
......
......@@ -20,6 +20,18 @@ class SCH_SHEET_PATH;
class SCH_SCREEN : public BASE_SCREEN
{
/**
* Function addConnectedItemsToBlock
* add items connected at \a aPosition to the block pick list.
* <p>
* This method tests all connectable unselected items in the screen that are connected to
* \a aPosition and adds them to the block selection pick list. This is used when a block
* drag is being performed to ensure connections to items in the block are not lost.
*</p>
* @param aPosition = The connection point to test.
*/
void addConnectedItemsToBlock( const wxPoint& aPosition );
public:
int m_RefCount; ///< Number of sheets referencing this screen.
///< Delete when it goes to zero.
......@@ -133,6 +145,14 @@ public:
*/
void GetHierarchicalItems( std::vector <SCH_ITEM*> aItems );
/**
* Function SelectBlockItems
* creates a list of items found when a block command is initiated. The items selected
* depend on the block commad. If the drag block command is issued, than any items
* connected to items in the block are also selected.
*/
void SelectBlockItems();
virtual void AddItem( SCH_ITEM* aItem ) { BASE_SCREEN::AddItem( (EDA_ITEM*) aItem ); }
virtual void InsertItem( EDA_ITEMS::iterator aIter, SCH_ITEM* aItem )
{
......
......@@ -247,6 +247,12 @@ public:
*/
virtual bool IsSelectStateChanged( const wxRect& aRect ) { return false; }
/**
* Function IsConnectable
* returns true if the schematic item can connect to another schematic item.
*/
virtual bool IsConnectable() const { return false; }
/**
* Function GetConnectionPoints
* add all the connection points for this item to \a aPoints.
......
......@@ -9,6 +9,7 @@
#include "param_config.h"
#include "class_undoredo_container.h"
#include "template_fieldnames.h"
#include "block_commande.h"
class LIB_EDIT_FRAME;
......@@ -91,6 +92,7 @@ private:
wxSize m_findDialogSize;
wxArrayString m_findStringHistoryList;
wxArrayString m_replaceStringHistoryList;
BLOCK_SELECTOR m_blockItems; ///< List of selected items.
public:
SCH_EDIT_FRAME( wxWindow* father,
......@@ -617,6 +619,13 @@ private:
*/
void GetSchematicFromUndoList( wxCommandEvent& event );
/**
* Function copyBlockItems
* copies the list of block item.
* @sa m_blockItems
* @param aItemList List to copy the block select items into.
*/
void copyBlockItems( PICKED_ITEMS_LIST& aItemsList );
public:
void Key( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment