Commit a3a73ef5 authored by Wayne Stambaugh's avatar Wayne Stambaugh

EESchema block code cleaning and other minor fixes.

* Move update block pick list code to SCH_SCREEN object.
* Remove redundant drawing function RedrawOneStruct().
* Change context menu text "Noconn" to "No Connect".
* Change context menu text "GLabel" to "Global Label".
parent cfeb55a2
...@@ -74,7 +74,7 @@ void SCH_ITEM::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) ...@@ -74,7 +74,7 @@ void SCH_ITEM::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
if( DC ) if( DC )
{ {
frame->DrawPanel->CursorOff( DC ); // Erase schematic cursor frame->DrawPanel->CursorOff( DC ); // Erase schematic cursor
RedrawOneStruct( frame->DrawPanel, DC, this, GR_DEFAULT_DRAWMODE ); Draw( frame->DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
frame->DrawPanel->CursorOn( DC ); // Display schematic cursor frame->DrawPanel->CursorOn( DC ); // Display schematic cursor
} }
} }
......
...@@ -240,7 +240,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -240,7 +240,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
PickItemsInBlock( GetScreen()->m_BlockLocate, GetScreen() ); GetScreen()->UpdatePickList();
// fall through // fall through
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( block->GetCount() ) if( block->GetCount() )
...@@ -261,7 +261,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -261,7 +261,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
PickItemsInBlock( GetScreen()->m_BlockLocate, GetScreen() ); GetScreen()->UpdatePickList();
DrawAndSizingBlockOutlines( DrawPanel, DC, false ); DrawAndSizingBlockOutlines( DrawPanel, DC, false );
if( block->GetCount() ) if( block->GetCount() )
...@@ -276,7 +276,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -276,7 +276,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
break; break;
case BLOCK_SAVE: /* Save */ case BLOCK_SAVE: /* Save */
PickItemsInBlock( GetScreen()->m_BlockLocate, GetScreen() ); GetScreen()->UpdatePickList();
DrawAndSizingBlockOutlines( DrawPanel, DC, false ); DrawAndSizingBlockOutlines( DrawPanel, DC, false );
if( block->GetCount() ) if( block->GetCount() )
...@@ -374,7 +374,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -374,7 +374,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
BreakSegmentOnJunction( GetScreen() ); BreakSegmentOnJunction( GetScreen() );
PickItemsInBlock( GetScreen()->m_BlockLocate, GetScreen() ); GetScreen()->UpdatePickList();
if( block->GetCount() ) if( block->GetCount() )
{ {
......
...@@ -91,7 +91,7 @@ static void DrawSegment( WinEDA_DrawPanel* aPanel, wxDC* aDC, bool aErase ) ...@@ -91,7 +91,7 @@ static void DrawSegment( WinEDA_DrawPanel* aPanel, wxDC* aDC, bool aErase )
while( segment ) while( segment )
{ {
if( !segment->IsNull() ) // Redraw if segment length != 0 if( !segment->IsNull() ) // Redraw if segment length != 0
RedrawOneStruct( aPanel, aDC, segment, g_XorMode, color ); segment->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, color );
segment = segment->Next(); segment = segment->Next();
} }
...@@ -109,7 +109,7 @@ static void DrawSegment( WinEDA_DrawPanel* aPanel, wxDC* aDC, bool aErase ) ...@@ -109,7 +109,7 @@ static void DrawSegment( WinEDA_DrawPanel* aPanel, wxDC* aDC, bool aErase )
while( segment ) while( segment )
{ {
if( !segment->IsNull() ) // Redraw if segment length != 0 if( !segment->IsNull() ) // Redraw if segment length != 0
RedrawOneStruct( aPanel, aDC, segment, g_XorMode, color ); segment->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, color );
segment = segment->Next(); segment = segment->Next();
} }
...@@ -216,7 +216,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) ...@@ -216,7 +216,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
oldsegment->SetNext( GetScreen()->GetDrawItems() ); oldsegment->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->SetDrawItems( oldsegment ); GetScreen()->SetDrawItems( oldsegment );
DrawPanel->CursorOff( DC ); // Erase schematic cursor DrawPanel->CursorOff( DC ); // Erase schematic cursor
RedrawOneStruct( DrawPanel, DC, oldsegment, GR_DEFAULT_DRAWMODE ); oldsegment->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // Display schematic cursor DrawPanel->CursorOn( DC ); // Display schematic cursor
/* Create a new segment, and chain it after the current new segment */ /* Create a new segment, and chain it after the current new segment */
...@@ -456,10 +456,10 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool eras ...@@ -456,10 +456,10 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool eras
} }
if( erase ) if( erase )
RedrawOneStruct( panel, DC, NewPoly, g_XorMode, color ); NewPoly->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, color );
NewPoly->m_PolyPoints[idx] = endpos; NewPoly->m_PolyPoints[idx] = endpos;
RedrawOneStruct( panel, DC, NewPoly, g_XorMode, color ); NewPoly->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, color );
} }
...@@ -505,7 +505,7 @@ SCH_JUNCTION* SCH_EDIT_FRAME::CreateNewJunctionStruct( wxDC* DC, ...@@ -505,7 +505,7 @@ SCH_JUNCTION* SCH_EDIT_FRAME::CreateNewJunctionStruct( wxDC* DC,
g_ItemToRepeat = NewJunction; g_ItemToRepeat = NewJunction;
DrawPanel->CursorOff( DC ); // Erase schematic cursor DrawPanel->CursorOff( DC ); // Erase schematic cursor
RedrawOneStruct( DrawPanel, DC, NewJunction, GR_DEFAULT_DRAWMODE ); NewJunction->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // Display schematic cursor DrawPanel->CursorOn( DC ); // Display schematic cursor
NewJunction->SetNext( GetScreen()->GetDrawItems() ); NewJunction->SetNext( GetScreen()->GetDrawItems() );
...@@ -528,7 +528,7 @@ SCH_NO_CONNECT* SCH_EDIT_FRAME::CreateNewNoConnectStruct( wxDC* DC ) ...@@ -528,7 +528,7 @@ SCH_NO_CONNECT* SCH_EDIT_FRAME::CreateNewNoConnectStruct( wxDC* DC )
g_ItemToRepeat = NewNoConnect; g_ItemToRepeat = NewNoConnect;
DrawPanel->CursorOff( DC ); // Erase schematic cursor DrawPanel->CursorOff( DC ); // Erase schematic cursor
RedrawOneStruct( DrawPanel, DC, NewNoConnect, GR_DEFAULT_DRAWMODE ); NewNoConnect->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // Display schematic cursor DrawPanel->CursorOn( DC ); // Display schematic cursor
NewNoConnect->SetNext( GetScreen()->GetDrawItems() ); NewNoConnect->SetNext( GetScreen()->GetDrawItems() );
...@@ -585,7 +585,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) ...@@ -585,7 +585,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
g_ItemToRepeat->m_Flags = IS_NEW; g_ItemToRepeat->m_Flags = IS_NEW;
( (SCH_COMPONENT*) g_ItemToRepeat )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) g_ItemToRepeat )->m_TimeStamp = GetTimeStamp();
g_ItemToRepeat->Move( pos ); g_ItemToRepeat->Move( pos );
RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, g_XorMode ); g_ItemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
StartMovePart( (SCH_COMPONENT*) g_ItemToRepeat, DC ); StartMovePart( (SCH_COMPONENT*) g_ItemToRepeat, DC );
return; return;
} }
...@@ -605,7 +605,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC ) ...@@ -605,7 +605,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
g_ItemToRepeat->SetNext( GetScreen()->GetDrawItems() ); g_ItemToRepeat->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->SetDrawItems( g_ItemToRepeat ); GetScreen()->SetDrawItems( g_ItemToRepeat );
TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, GR_DEFAULT_DRAWMODE ); g_ItemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
SaveCopyInUndoList( g_ItemToRepeat, UR_NEW ); SaveCopyInUndoList( g_ItemToRepeat, UR_NEW );
g_ItemToRepeat->m_Flags = 0; g_ItemToRepeat->m_Flags = 0;
} }
......
...@@ -27,7 +27,8 @@ static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -27,7 +27,8 @@ static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC )
if( BusEntry ) if( BusEntry )
{ {
RedrawOneStruct( Panel, DC, BusEntry, g_XorMode ); BusEntry->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
if( BusEntry->m_Flags & IS_NEW ) if( BusEntry->m_Flags & IS_NEW )
{ {
delete BusEntry; delete BusEntry;
...@@ -36,7 +37,7 @@ static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -36,7 +37,7 @@ static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC )
else else
{ {
BusEntry->m_Pos = ItemInitialPosition; BusEntry->m_Pos = ItemInitialPosition;
RedrawOneStruct( Panel, DC, BusEntry, GR_DEFAULT_DRAWMODE ); BusEntry->Draw( Panel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
BusEntry->m_Flags = 0; BusEntry->m_Flags = 0;
} }
} }
...@@ -58,11 +59,11 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -58,11 +59,11 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/* Erase the last segment position. */ /* Erase the last segment position. */
if( erase ) if( erase )
RedrawOneStruct( panel, DC, BusEntry, g_XorMode ); BusEntry->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode );
/* Redraw at the new position. */ /* Redraw at the new position. */
BusEntry->m_Pos = screen->m_Curseur; BusEntry->m_Pos = screen->m_Curseur;
RedrawOneStruct( panel, DC, BusEntry, g_XorMode ); BusEntry->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode );
} }
...@@ -121,7 +122,7 @@ void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int en ...@@ -121,7 +122,7 @@ void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int en
if( BusEntry->m_Flags == 0 ) if( BusEntry->m_Flags == 0 )
SaveCopyInUndoList( BusEntry, UR_CHANGED ); SaveCopyInUndoList( BusEntry, UR_CHANGED );
RedrawOneStruct( DrawPanel, DC, BusEntry, g_XorMode ); BusEntry->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
switch( entry_shape ) switch( entry_shape )
{ {
...@@ -137,7 +138,7 @@ void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int en ...@@ -137,7 +138,7 @@ void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int en
} }
TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
RedrawOneStruct( DrawPanel, DC, BusEntry, g_XorMode ); BusEntry->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
OnModify( ); OnModify( );
} }
......
...@@ -44,8 +44,8 @@ void SCH_EDIT_FRAME::TestDanglingEnds( SCH_ITEM* aDrawList, wxDC* aDC ) ...@@ -44,8 +44,8 @@ void SCH_EDIT_FRAME::TestDanglingEnds( SCH_ITEM* aDrawList, wxDC* aDC )
{ {
if( item->IsDanglingStateChanged( endPoints ) && aDC != NULL ) if( item->IsDanglingStateChanged( endPoints ) && aDC != NULL )
{ {
RedrawOneStruct( DrawPanel, aDC, item, g_XorMode ); item->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
RedrawOneStruct( DrawPanel, aDC, item, GR_DEFAULT_DRAWMODE ); item->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
} }
} }
} }
......
...@@ -823,7 +823,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event ) ...@@ -823,7 +823,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
INSTALL_DC( dc, m_Parent->DrawPanel ); INSTALL_DC( dc, m_Parent->DrawPanel );
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, g_XorMode ); m_Cmp->Draw( m_Parent->DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode );
// Initialize field values to default values found in library: // Initialize field values to default values found in library:
LIB_FIELD& refField = entry->GetReferenceField(); LIB_FIELD& refField = entry->GetReferenceField();
...@@ -838,6 +838,6 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event ) ...@@ -838,6 +838,6 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
m_Parent->OnModify( ); m_Parent->OnModify( );
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE ); m_Cmp->Draw( m_Parent->DrawPanel, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
EndModal( 1 ); EndModal( 1 );
} }
...@@ -89,7 +89,7 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ) ...@@ -89,7 +89,7 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
/* Erase old text */ /* Erase old text */
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode ); TextStruct->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
int orient; int orient;
...@@ -109,7 +109,7 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ) ...@@ -109,7 +109,7 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
} }
OnModify( ); OnModify( );
RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode ); TextStruct->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
} }
...@@ -153,7 +153,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type ) ...@@ -153,7 +153,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type )
NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize; NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize;
NewText->m_Flags = IS_NEW | IS_MOVED; NewText->m_Flags = IS_NEW | IS_MOVED;
RedrawOneStruct( DrawPanel, DC, NewText, g_XorMode ); NewText->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
EditSchematicText( NewText ); EditSchematicText( NewText );
if( NewText->m_Text.IsEmpty() ) if( NewText->m_Text.IsEmpty() )
...@@ -171,7 +171,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type ) ...@@ -171,7 +171,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type )
lastGlobalLabelShape = NewText->m_Shape; lastGlobalLabelShape = NewText->m_Shape;
} }
RedrawOneStruct( DrawPanel, DC, NewText, GR_DEFAULT_DRAWMODE ); NewText->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitMoveTexte; DrawPanel->ForceCloseManageCurseur = ExitMoveTexte;
...@@ -190,7 +190,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -190,7 +190,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/* "Undraw" the current text at its old position*/ /* "Undraw" the current text at its old position*/
if( erase ) if( erase )
RedrawOneStruct( panel, DC, TextStruct, g_XorMode ); TextStruct->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode );
/* redraw the text */ /* redraw the text */
switch( TextStruct->Type() ) switch( TextStruct->Type() )
...@@ -206,7 +206,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -206,7 +206,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
break; break;
} }
RedrawOneStruct( panel, DC, TextStruct, g_XorMode ); TextStruct->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode );
} }
...@@ -227,7 +227,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -227,7 +227,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
/* "Undraw" the text, and delete it if new (i.e. it was being just /* "Undraw" the text, and delete it if new (i.e. it was being just
* created)*/ * created)*/
RedrawOneStruct( Panel, DC, Struct, g_XorMode ); Struct->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
if( Struct->m_Flags & IS_NEW ) if( Struct->m_Flags & IS_NEW )
{ {
...@@ -254,7 +254,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -254,7 +254,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
break; break;
} }
RedrawOneStruct( Panel, DC, Struct, GR_DEFAULT_DRAWMODE ); Struct->Draw( Panel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
Struct->m_Flags = 0; Struct->m_Flags = 0;
} }
} }
...@@ -367,6 +367,6 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype ) ...@@ -367,6 +367,6 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
StartMoveTexte( newtext, DC ); StartMoveTexte( newtext, DC );
} }
RedrawOneStruct( DrawPanel, DC, newtext, GR_DEFAULT_DRAWMODE ); newtext->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // redraw schematic cursor DrawPanel->CursorOn( DC ); // redraw schematic cursor
} }
...@@ -145,14 +145,3 @@ void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -145,14 +145,3 @@ void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC,
Structlist = Structlist->Next(); Structlist = Structlist->Next();
} }
} }
/* Routine to redraw on schematic object. */
void RedrawOneStruct( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_ITEM* Struct, int DrawMode, int Color )
{
if( Struct == NULL )
return;
Struct->Draw( panel, DC, wxPoint( 0, 0 ), DrawMode, Color );
}
...@@ -42,7 +42,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event ) ...@@ -42,7 +42,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
/* Redraw the original part, because StartMovePart() erased /* Redraw the original part, because StartMovePart() erased
* it from screen */ * it from screen */
RedrawOneStruct( DrawPanel, &dc, curr_item, GR_DEFAULT_DRAWMODE ); curr_item->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
} }
break; break;
...@@ -55,7 +55,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event ) ...@@ -55,7 +55,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
newitem->m_Flags = IS_NEW; newitem->m_Flags = IS_NEW;
StartMoveTexte( newitem, &dc ); StartMoveTexte( newitem, &dc );
/* Redraw the original part in XOR mode */ /* Redraw the original part in XOR mode */
RedrawOneStruct( DrawPanel, &dc, curr_item, g_XorMode ); curr_item->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode );
} }
break; break;
......
...@@ -118,46 +118,6 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, SCH_SCREEN* screen, int SearchMask ...@@ -118,46 +118,6 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, SCH_SCREEN* screen, int SearchMask
} }
/**
* Function PickStruct
* Search items in a block
* @return items count
* @param aBlock a BLOCK_SELECTOR that gives the search area boundary
* @param aScreen - The screen to pick items from.
* list of items is stored in aBlock
*/
int PickItemsInBlock( BLOCK_SELECTOR& aBlock, SCH_SCREEN* aScreen )
{
int itemcount = 0;
if( aScreen == NULL )
return itemcount;
EDA_Rect area;
area.SetOrigin( aBlock.GetOrigin());
area.SetSize( aBlock.GetSize() );
area.Normalize();
ITEM_PICKER picker;
SCH_ITEM* item = aScreen->GetDrawItems();
for( ; item != NULL; item = item->Next() )
{
// an item is picked if its bounding box intersects the reference area
if( item->HitTest( area ) )
{
/* Put this structure in the picked list: */
picker.m_PickedItem = item;
picker.m_PickedItemType = item->Type();
aBlock.PushItem( picker );
itemcount++;
}
}
return itemcount;
}
/***************************************************************************** /*****************************************************************************
* Routine to search all objects for the closest point to a given point, in * * Routine to search all objects for the closest point to a given point, in *
* drawing space, and snap it to that points if closer than SnapDistance. * * drawing space, and snap it to that points if closer than SnapDistance. *
......
...@@ -118,7 +118,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -118,7 +118,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
{ {
case SCH_NO_CONNECT_T: case SCH_NO_CONNECT_T:
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Noconn" ), delete_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete No Connect" ), delete_xpm );
break; break;
case SCH_JUNCTION_T: case SCH_JUNCTION_T:
...@@ -477,7 +477,7 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text ) ...@@ -477,7 +477,7 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL, ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL,
_( "Change to Hierarchical Label" ), label2glabel_xpm ); _( "Change to Hierarchical Label" ), label2glabel_xpm );
ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL, ADD_MENUITEM( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL,
_( "Change to Glabel" ), label2glabel_xpm ); _( "Change to Global Label" ), label2glabel_xpm );
ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT, ADD_MENUITEM_WITH_SUBMENU( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
_( "Change Type" ), gl_change_xpm ); _( "Change Type" ), gl_change_xpm );
} }
......
...@@ -84,9 +84,6 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct, bool aClone = false ); ...@@ -84,9 +84,6 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct, bool aClone = false );
SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen ); SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen );
/* Find the item within block selection. */
int PickItemsInBlock( BLOCK_SELECTOR& aBlock, SCH_SCREEN* screen );
/* function PickStruct: /* function PickStruct:
* Search at location pos * Search at location pos
* *
...@@ -119,7 +116,6 @@ int PickItemsInBlock( BLOCK_SELECTOR& aBlock, SCH_SCREEN* screen ); ...@@ -119,7 +116,6 @@ int PickItemsInBlock( BLOCK_SELECTOR& aBlock, SCH_SCREEN* screen );
*/ */
SCH_ITEM* PickStruct( const wxPoint& refpos, SCH_SCREEN* screen, int SearchMask ); SCH_ITEM* PickStruct( const wxPoint& refpos, SCH_SCREEN* screen, int SearchMask );
SCH_SHEET_PIN* LocateSheetLabel( SCH_SHEET* Sheet, const wxPoint& pos ); SCH_SHEET_PIN* LocateSheetLabel( SCH_SHEET* Sheet, const wxPoint& pos );
LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList,
const wxPoint& RefPos, const wxPoint& RefPos,
...@@ -138,11 +134,6 @@ void RedrawStructList( WinEDA_DrawPanel* panel, ...@@ -138,11 +134,6 @@ void RedrawStructList( WinEDA_DrawPanel* panel,
SCH_ITEM* Structs, SCH_ITEM* Structs,
int DrawMode, int DrawMode,
int Color = -1 ); int Color = -1 );
void RedrawOneStruct( WinEDA_DrawPanel* panel,
wxDC* DC,
SCH_ITEM* Struct,
int DrawMode,
int Color = -1 );
/**************/ /**************/
/* EELAYER.CPP */ /* EELAYER.CPP */
......
...@@ -524,6 +524,29 @@ void SCH_SCREEN::addConnectedItemsToBlock( const wxPoint& position ) ...@@ -524,6 +524,29 @@ void SCH_SCREEN::addConnectedItemsToBlock( const wxPoint& position )
} }
int SCH_SCREEN::UpdatePickList()
{
ITEM_PICKER picker;
EDA_Rect area;
area.SetOrigin( m_BlockLocate.GetOrigin());
area.SetSize( m_BlockLocate.GetSize() );
area.Normalize();
for( SCH_ITEM* item = GetDrawItems(); item != NULL; item = item->Next() )
{
// An item is picked if its bounding box intersects the reference area.
if( item->HitTest( area ) )
{
picker.m_PickedItem = item;
picker.m_PickedItemType = item->Type();
m_BlockLocate.PushItem( picker );
}
}
return m_BlockLocate.GetCount();
}
/******************************************************************/ /******************************************************************/
/* Class SCH_SCREENS to handle the list of screens in a hierarchy */ /* Class SCH_SCREENS to handle the list of screens in a hierarchy */
/******************************************************************/ /******************************************************************/
......
...@@ -42,7 +42,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -42,7 +42,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
return false; return false;
/* Get the new texts */ /* Get the new texts */
RedrawOneStruct( DrawPanel, aDC, aSheet, g_XorMode ); aSheet->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
DrawPanel->m_IgnoreMouseEvents = true; DrawPanel->m_IgnoreMouseEvents = true;
...@@ -137,7 +137,7 @@ structures and cannot be undone.\nOk to continue renaming?" ); ...@@ -137,7 +137,7 @@ structures and cannot be undone.\nOk to continue renaming?" );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = false; DrawPanel->m_IgnoreMouseEvents = false;
RedrawOneStruct( DrawPanel, aDC, aSheet, GR_DEFAULT_DRAWMODE ); aSheet->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
return edit; return edit;
} }
...@@ -153,7 +153,7 @@ static void MoveOrResizeSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC, bool aErase ...@@ -153,7 +153,7 @@ static void MoveOrResizeSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC, bool aErase
SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem(); SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem();
if( aErase ) if( aErase )
RedrawOneStruct( aPanel, aDC, sheet, g_XorMode ); sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
if( sheet->m_Flags & IS_RESIZED ) if( sheet->m_Flags & IS_RESIZED )
{ {
...@@ -167,7 +167,7 @@ static void MoveOrResizeSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC, bool aErase ...@@ -167,7 +167,7 @@ static void MoveOrResizeSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC, bool aErase
sheet->Move( moveVector ); sheet->Move( moveVector );
} }
RedrawOneStruct( aPanel, aDC, sheet, g_XorMode ); sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
} }
...@@ -182,7 +182,7 @@ static void ExitSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC ) ...@@ -182,7 +182,7 @@ static void ExitSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC )
if( sheet->m_Flags & IS_NEW ) if( sheet->m_Flags & IS_NEW )
{ {
RedrawOneStruct( aPanel, aDC, sheet, g_XorMode ); sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
SAFE_DELETE( sheet ); SAFE_DELETE( sheet );
} }
else if( (sheet->m_Flags & (IS_RESIZED|IS_MOVED)) ) else if( (sheet->m_Flags & (IS_RESIZED|IS_MOVED)) )
...@@ -190,7 +190,7 @@ static void ExitSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC ) ...@@ -190,7 +190,7 @@ static void ExitSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC )
wxPoint curspos = screen->m_Curseur; wxPoint curspos = screen->m_Curseur;
aPanel->GetScreen()->m_Curseur = s_OldPos; aPanel->GetScreen()->m_Curseur = s_OldPos;
MoveOrResizeSheet( aPanel, aDC, true ); MoveOrResizeSheet( aPanel, aDC, true );
RedrawOneStruct( aPanel, aDC, sheet, GR_DEFAULT_DRAWMODE ); sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
sheet->m_Flags = 0; sheet->m_Flags = 0;
screen->m_Curseur = curspos; screen->m_Curseur = curspos;
} }
......
...@@ -41,17 +41,17 @@ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -41,17 +41,17 @@ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
if( SheetLabel->m_Flags & IS_NEW ) if( SheetLabel->m_Flags & IS_NEW )
{ {
RedrawOneStruct( Panel, DC, SheetLabel, g_XorMode ); SheetLabel->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
SAFE_DELETE( SheetLabel ); SAFE_DELETE( SheetLabel );
} }
else else
{ {
RedrawOneStruct( Panel, DC, SheetLabel, g_XorMode ); SheetLabel->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
SheetLabel->m_Pos = s_InitialPosition; SheetLabel->m_Pos = s_InitialPosition;
// Restore edge position: // Restore edge position:
SheetLabel->SetEdge( s_InitialEdge ); SheetLabel->SetEdge( s_InitialEdge );
RedrawOneStruct( Panel, DC, SheetLabel, GR_DEFAULT_DRAWMODE ); SheetLabel->Draw( Panel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
SheetLabel->m_Flags = 0; SheetLabel->m_Flags = 0;
} }
...@@ -87,7 +87,7 @@ void SCH_SHEET_PIN::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) ...@@ -87,7 +87,7 @@ void SCH_SHEET_PIN::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
ConstraintOnEdge( frame->GetScreen()->m_Curseur ); ConstraintOnEdge( frame->GetScreen()->m_Curseur );
RedrawOneStruct( frame->DrawPanel, DC, Sheet, GR_DEFAULT_DRAWMODE ); Sheet->Draw( frame->DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
frame->DrawPanel->ManageCurseur = NULL; frame->DrawPanel->ManageCurseur = NULL;
frame->DrawPanel->ForceCloseManageCurseur = NULL; frame->DrawPanel->ForceCloseManageCurseur = NULL;
} }
...@@ -115,11 +115,11 @@ static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -115,11 +115,11 @@ static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
return; return;
if( erase ) if( erase )
RedrawOneStruct( panel, DC, SheetLabel, g_XorMode ); SheetLabel->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode );
SheetLabel->ConstraintOnEdge( panel->GetScreen()->m_Curseur ); SheetLabel->ConstraintOnEdge( panel->GetScreen()->m_Curseur );
RedrawOneStruct( panel, DC, SheetLabel, g_XorMode ); SheetLabel->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode );
} }
...@@ -129,7 +129,7 @@ int SCH_EDIT_FRAME::Edit_PinSheet( SCH_SHEET_PIN* aLabel, wxDC* aDC ) ...@@ -129,7 +129,7 @@ int SCH_EDIT_FRAME::Edit_PinSheet( SCH_SHEET_PIN* aLabel, wxDC* aDC )
return wxID_CANCEL; return wxID_CANCEL;
if( aDC ) if( aDC )
RedrawOneStruct( DrawPanel, aDC, aLabel, g_XorMode ); aLabel->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
DIALOG_SCH_EDIT_SHEET_PIN dlg( this ); DIALOG_SCH_EDIT_SHEET_PIN dlg( this );
...@@ -158,7 +158,7 @@ int SCH_EDIT_FRAME::Edit_PinSheet( SCH_SHEET_PIN* aLabel, wxDC* aDC ) ...@@ -158,7 +158,7 @@ int SCH_EDIT_FRAME::Edit_PinSheet( SCH_SHEET_PIN* aLabel, wxDC* aDC )
aLabel->m_Shape = dlg.GetConnectionType(); aLabel->m_Shape = dlg.GetConnectionType();
if( aDC ) if( aDC )
RedrawOneStruct( DrawPanel, aDC, aLabel, GR_DEFAULT_DRAWMODE ); aLabel->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
return wxID_OK; return wxID_OK;
} }
......
...@@ -153,6 +153,13 @@ public: ...@@ -153,6 +153,13 @@ public:
*/ */
void SelectBlockItems(); void SelectBlockItems();
/**
* Function UpdatePickList
* adds all the items in the screen within the block selection rectangle to the pick list.
* @return The number of items in the pick list.
*/
int UpdatePickList();
virtual void AddItem( SCH_ITEM* aItem ) { BASE_SCREEN::AddItem( (EDA_ITEM*) aItem ); } virtual void AddItem( SCH_ITEM* aItem ) { BASE_SCREEN::AddItem( (EDA_ITEM*) aItem ); }
virtual void InsertItem( EDA_ITEMS::iterator aIter, SCH_ITEM* aItem ) virtual void InsertItem( EDA_ITEMS::iterator aIter, SCH_ITEM* aItem )
{ {
......
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