Eeschema schematic item move code unification.

* Add get and set position methods to all schematic items.
* Encapsulate schematic item position members.
* Add swap data method to schematic items that lacked one.
* Remove global swap data function used by undo and redo functions.
* Unify as many schematic move methods as possible.
* Remove unnecessary place schematic item methods.
* All schematic items are now moved in the same event handler.
* Fixed bug in hierarchical sheet get menu item string method.
* Make no connect and junction items movable, fixes lp:804048
This commit is contained in:
Wayne Stambaugh 2011-10-19 16:32:21 -04:00
parent 341e3a507a
commit 6a4e8aa909
44 changed files with 1001 additions and 691 deletions

View File

@ -1,6 +1,31 @@
/************************/ /*
/* sch_item_struct.cpp */ * This program source code file is part of KiCad, a free EDA CAD application.
/************************/ *
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 Kicad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file sch_item_struct.cpp
*/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -52,12 +77,6 @@ SCH_ITEM::~SCH_ITEM()
} }
/**
* place the struct in m_drawList.
* if it is a new item, it it also put in undo list
* for an "old" item, saving it in undo list must be done before editing,
* and not here!
*/
void SCH_ITEM::Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC ) void SCH_ITEM::Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC )
{ {
SCH_SCREEN* screen = aFrame->GetScreen(); SCH_SCREEN* screen = aFrame->GetScreen();
@ -70,6 +89,10 @@ void SCH_ITEM::Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC )
aFrame->SetRepeatItem( this ); aFrame->SetRepeatItem( this );
aFrame->SaveCopyInUndoList( this, UR_NEW ); aFrame->SaveCopyInUndoList( this, UR_NEW );
} }
else
{
aFrame->SaveUndoItemInUndoList( this );
}
m_Flags = 0; m_Flags = 0;
screen->SetModify(); screen->SetModify();

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file backanno.cpp * @file backanno.cpp
* @brief Functions for backannotating footprint information. * @brief Functions for backannotating footprint information.
@ -64,11 +89,12 @@ bool SCH_EDIT_FRAME::ProcessStuffFile( FILE* aFile, bool aSetFieldAttributeToVis
* it is probably not yet initialized * it is probably not yet initialized
*/ */
if( fpfield->m_Text.IsEmpty() if( fpfield->m_Text.IsEmpty()
&& ( fpfield->m_Pos == component->m_Pos ) ) && ( fpfield->GetPosition() == component->GetPosition() ) )
{ {
fpfield->m_Orient = component->GetField( VALUE )->m_Orient; fpfield->m_Orient = component->GetField( VALUE )->m_Orient;
fpfield->m_Pos = component->GetField( VALUE )->m_Pos; fpfield->SetPosition( component->GetField( VALUE )->GetPosition() );
fpfield->m_Size = component->GetField( VALUE )->m_Size; fpfield->m_Size = component->GetField( VALUE )->m_Size;
if( fpfield->m_Orient == 0 ) if( fpfield->m_Orient == 0 )
fpfield->m_Pos.y += 100; fpfield->m_Pos.y += 100;
else else

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file bus-wire-junction.cpp * @file bus-wire-junction.cpp
* @brief Code for editing buses, wires, and junctions. * @brief Code for editing buses, wires, and junctions.
@ -436,6 +461,60 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
} }
static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_ITEM* item = screen->GetCurItem();
wxCHECK_RET( (item != NULL), wxT( "Cannot move invalid schematic item." ) );
// Erase the current item at its current position.
if( aErase )
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
item->SetPosition( screen->GetCrossHairPosition() );
// Draw the item item at it's new position.
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
}
static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_ITEM* item = screen->GetCurItem();
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) aPanel->GetParent();
parent->SetRepeatItem( NULL );
screen->SetCurItem( NULL );
if( item == NULL ) /* no current item */
return;
if( item->IsNew() )
{
delete item;
item = NULL;
}
else // Move command on an existing text item, restore the values of the original.
{
SCH_ITEM* olditem = parent->GetUndoItem();
screen->SetCurItem( item );
wxCHECK_RET( olditem != NULL && item->Type() == olditem->Type(),
wxT( "Cannot restore undefined or bad last schematic item." ) );
// Never delete existing item, because it can be referenced by an undo/redo command
// Just restore its data
item->SwapData( olditem );
item->ClearFlags();
}
aPanel->Refresh();
}
/* Routine to create new connection struct. /* Routine to create new connection struct.
*/ */
SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( wxDC* aDC, const wxPoint& aPosition, SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( wxDC* aDC, const wxPoint& aPosition,
@ -460,6 +539,29 @@ SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( wxDC* aDC, const wxPoint& aPosition,
} }
void SCH_EDIT_FRAME::MoveItem( SCH_ITEM* aItem, wxDC* aDC )
{
wxCHECK_RET( aItem != NULL, wxT( "Cannot move invalid schematic item" ) );
m_itemToRepeat = NULL;
if( !aItem->IsNew() )
SetUndoItem( aItem );
aItem->SetFlags( IS_MOVED );
DrawPanel->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( aItem->GetPosition() );
DrawPanel->MoveCursorToCrossHair();
OnModify();
DrawPanel->SetMouseCapture( moveItem, abortMoveItem );
GetScreen()->SetCurItem( aItem );
moveItem( DrawPanel, aDC, wxDefaultPosition, true );
DrawPanel->CrossHairOn( aDC );
}
SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( wxDC* aDC, const wxPoint& aPosition ) SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( wxDC* aDC, const wxPoint& aPosition )
{ {
SCH_NO_CONNECT* NewNoConnect; SCH_NO_CONNECT* NewNoConnect;
@ -517,12 +619,12 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
if( m_itemToRepeat->Type() == SCH_COMPONENT_T ) // If repeat component then put in move mode if( m_itemToRepeat->Type() == SCH_COMPONENT_T ) // If repeat component then put in move mode
{ {
wxPoint pos = GetScreen()->GetCrossHairPosition() - wxPoint pos = GetScreen()->GetCrossHairPosition() -
( (SCH_COMPONENT*) m_itemToRepeat )->m_Pos; ( (SCH_COMPONENT*) m_itemToRepeat )->GetPosition();
m_itemToRepeat->SetFlags( IS_NEW ); m_itemToRepeat->SetFlags( IS_NEW );
( (SCH_COMPONENT*) m_itemToRepeat )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) m_itemToRepeat )->m_TimeStamp = GetTimeStamp();
m_itemToRepeat->Move( pos ); m_itemToRepeat->Move( pos );
m_itemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); m_itemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
StartMovePart( (SCH_COMPONENT*) m_itemToRepeat, DC ); MoveItem( m_itemToRepeat, DC );
return; return;
} }
@ -541,4 +643,3 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
m_itemToRepeat->ClearFlags(); m_itemToRepeat->ClearFlags();
} }
} }

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file busentry.cpp * @file busentry.cpp
* @brief Code to handle manipulation of bus entry objects. * @brief Code to handle manipulation of bus entry objects.
@ -16,55 +41,6 @@
static int s_LastShape = '\\'; static int s_LastShape = '\\';
static wxPoint ItemInitialPosition;
static void ExitBusEntry( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
/* Exit bus entry mode. */
SCH_BUS_ENTRY* BusEntry = (SCH_BUS_ENTRY*) Panel->GetScreen()->GetCurItem();
if( BusEntry )
{
BusEntry->Draw( Panel, DC, wxPoint( 0, 0 ), g_XorMode );
if( BusEntry->IsNew() )
{
delete BusEntry;
Panel->GetScreen()->SetCurItem( NULL );
}
else
{
BusEntry->m_Pos = ItemInitialPosition;
BusEntry->Draw( Panel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
BusEntry->m_Flags = 0;
}
}
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent();
parent->SetRepeatItem( NULL );
}
static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
// Draws the bus entry while moving the cursor
BASE_SCREEN* screen = aPanel->GetScreen();
SCH_BUS_ENTRY* BusEntry = (SCH_BUS_ENTRY*) screen->GetCurItem();
if( BusEntry == NULL )
return;
/* Erase the last segment position. */
if( aErase )
BusEntry->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
/* Redraw at the new position. */
BusEntry->m_Pos = screen->GetCrossHairPosition();
BusEntry->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
}
SCH_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusEntry( wxDC* DC, int entry_type ) SCH_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusEntry( wxDC* DC, int entry_type )
@ -79,30 +55,6 @@ SCH_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusEntry( wxDC* DC, int entry_type )
} }
void SCH_EDIT_FRAME::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, wxDC* DC )
{
if( BusEntry == NULL )
return;
if( !BusEntry->IsNew() ) // not already in edit, save shape
SetUndoItem( BusEntry );
BusEntry->SetFlags( IS_MOVED );
ItemInitialPosition = BusEntry->m_Pos;
DrawPanel->CrossHairOff( DC );
GetScreen()->SetCrossHairPosition( BusEntry->m_Pos );
DrawPanel->MoveCursorToCrossHair();
GetScreen()->SetCurItem( BusEntry );
DrawPanel->m_mouseCaptureCallback = ShowWhileMoving;
DrawPanel->m_endMouseCaptureCallback = ExitBusEntry;
DrawPanel->CrossHairOn( DC );
}
/* set the shape of BusEntry (shape = / or \ ) /* set the shape of BusEntry (shape = / or \ )
*/ */
void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int entry_shape ) void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int entry_shape )
@ -147,5 +99,6 @@ int SCH_EDIT_FRAME::GetBusEntryShape( SCH_BUS_ENTRY* BusEntry )
if( BusEntry->m_Size.y < 0 ) if( BusEntry->m_Size.y < 0 )
entry_shape = '/'; entry_shape = '/';
return entry_shape; return entry_shape;
} }

View File

@ -669,7 +669,7 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_COMPONENT* aLibComp
m_IsNew = false; m_IsNew = false;
m_Flag = 0; m_Flag = 0;
m_TimeStamp = aComponent->m_TimeStamp; m_TimeStamp = aComponent->m_TimeStamp;
m_CmpPos = aComponent->m_Pos; m_CmpPos = aComponent->GetPosition();
m_SheetNum = 0; m_SheetNum = 0;
if( aComponent->GetRef( &aSheetPath ).IsEmpty() ) if( aComponent->GetRef( &aSheetPath ).IsEmpty() )

View File

@ -1,6 +1,31 @@
/****************/ /*
/* controle.cpp */ * This program source code file is part of KiCad, a free EDA CAD application.
/****************/ *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* eeschema/controle.cpp
*/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -106,7 +131,6 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF
else if( m_collectedItems.GetCount() == 1 ) else if( m_collectedItems.GetCount() == 1 )
{ {
item = m_collectedItems[0]; item = m_collectedItems[0];
GetScreen()->SetCurItem( item );
} }
else else
{ {
@ -121,7 +145,6 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF
|| m_collectedItems.IsDraggableJunction() ) || m_collectedItems.IsDraggableJunction() )
{ {
item = m_collectedItems[0]; item = m_collectedItems[0];
GetScreen()->SetCurItem( item );
} }
default: default:
; ;
@ -155,6 +178,8 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF
} }
} }
GetScreen()->SetCurItem( item );
if( item ) if( item )
item->DisplayInfo( this ); item->DisplayInfo( this );
else else

View File

@ -730,11 +730,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
{ {
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
strCur.Printf( wxT( "%c%s" ), s_ExportSeparatorSymbol, GetChars( msg ) ); strCur.Printf( wxT( "%c%s" ), s_ExportSeparatorSymbol, GetChars( msg ) );
msg = m_Parent->GetXYSheetReferences( screen, comp->m_Pos ); msg = m_Parent->GetXYSheetReferences( screen, comp->GetPosition() );
strCur.Printf( wxT( "%c%s)" ), s_ExportSeparatorSymbol, GetChars( msg ) ); strCur.Printf( wxT( "%c%s)" ), s_ExportSeparatorSymbol, GetChars( msg ) );
#else #else
fprintf( f, "%c%s", s_ExportSeparatorSymbol, TO_UTF8( msg ) ); fprintf( f, "%c%s", s_ExportSeparatorSymbol, TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( screen, comp->m_Pos ); msg = m_Parent->GetXYSheetReferences( screen, comp->GetPosition() );
fprintf( f, "%c%s)", s_ExportSeparatorSymbol, fprintf( f, "%c%s)", s_ExportSeparatorSymbol,
TO_UTF8( msg ) ); TO_UTF8( msg ) );
#endif #endif
@ -742,7 +742,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( FILE* f,
else else
{ {
fprintf( f, " (Sheet %s)", TO_UTF8( msg ) ); fprintf( f, " (Sheet %s)", TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( screen, comp->m_Pos ); msg = m_Parent->GetXYSheetReferences( screen, comp->GetPosition() );
fprintf( f, " (loc %s)", TO_UTF8( msg ) ); fprintf( f, " (loc %s)", TO_UTF8( msg ) );
} }
} }
@ -1017,7 +1017,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( FILE* f,
{ {
msg = aList[ii].GetSheetPath().PathHumanReadable(); msg = aList[ii].GetSheetPath().PathHumanReadable();
fprintf( f, " (Sheet %s)", TO_UTF8( msg ) ); fprintf( f, " (Sheet %s)", TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( screen, DrawLibItem->m_Pos ); msg = m_Parent->GetXYSheetReferences( screen, DrawLibItem->GetPosition() );
fprintf( f, " (loc %s)", TO_UTF8( msg ) ); fprintf( f, " (loc %s)", TO_UTF8( msg ) );
} }
} }

View File

@ -67,7 +67,7 @@ static void abortMoveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
// Never delete existing item, because it can be referenced by an undo/redo command // Never delete existing item, because it can be referenced by an undo/redo command
// Just restore its data // Just restore its data
item->SwapData(olditem); item->SwapData( olditem );
} }
screen->SetCurItem( item ); screen->SetCurItem( item );
@ -97,7 +97,7 @@ static void moveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosit
} }
// Draw the bitmap at it's new position. // Draw the bitmap at it's new position.
image->m_Pos = screen->GetCrossHairPosition(); image->SetPosition( screen->GetCrossHairPosition() );
image->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); image->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
} }
@ -123,6 +123,7 @@ SCH_BITMAP* SCH_EDIT_FRAME::CreateNewImage( wxDC* aDC )
wxPoint pos = GetScreen()->GetCrossHairPosition(); wxPoint pos = GetScreen()->GetCrossHairPosition();
SCH_BITMAP* image = new SCH_BITMAP( pos ); SCH_BITMAP* image = new SCH_BITMAP( pos );
if( !image->ReadImageFile( fullFilename ) ) if( !image->ReadImageFile( fullFilename ) )
{ {
wxMessageBox( _( "Couldn't load image from <%s>" ), GetChars( fullFilename ) ); wxMessageBox( _( "Couldn't load image from <%s>" ), GetChars( fullFilename ) );
@ -152,7 +153,7 @@ void SCH_EDIT_FRAME::MoveImage( SCH_BITMAP* aImageItem, wxDC* aDC )
SetUndoItem( aImageItem ); SetUndoItem( aImageItem );
DrawPanel->CrossHairOff( aDC ); DrawPanel->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( aImageItem->m_Pos ); GetScreen()->SetCrossHairPosition( aImageItem->GetPosition() );
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->CrossHairOn( aDC ); DrawPanel->CrossHairOn( aDC );
@ -162,9 +163,9 @@ void SCH_EDIT_FRAME::MoveImage( SCH_BITMAP* aImageItem, wxDC* aDC )
void SCH_EDIT_FRAME::RotateImage( SCH_BITMAP* aItem ) void SCH_EDIT_FRAME::RotateImage( SCH_BITMAP* aItem )
{ {
if( aItem->GetFlags( ) == 0 ) if( aItem->GetFlags( ) == 0 )
SaveCopyInUndoList( aItem, UR_ROTATED, aItem->m_Pos ); SaveCopyInUndoList( aItem, UR_ROTATED, aItem->GetPosition() );
aItem->Rotate( aItem->m_Pos ); aItem->Rotate( aItem->GetPosition() );
OnModify(); OnModify();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
@ -175,9 +176,9 @@ void SCH_EDIT_FRAME::MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis )
SaveCopyInUndoList( aItem, UR_CHANGED ); SaveCopyInUndoList( aItem, UR_CHANGED );
if( Is_X_axis ) if( Is_X_axis )
aItem->Mirror_X( aItem->m_Pos.y ); aItem->Mirror_X( aItem->GetPosition().y );
else else
aItem->Mirror_Y( aItem->m_Pos.x ); aItem->Mirror_Y( aItem->GetPosition().x );
OnModify(); OnModify();
DrawPanel->Refresh(); DrawPanel->Refresh();
@ -192,6 +193,7 @@ void SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem )
if( aItem->GetFlags( ) == 0 ) if( aItem->GetFlags( ) == 0 )
SaveCopyInUndoList( aItem, UR_CHANGED ); SaveCopyInUndoList( aItem, UR_CHANGED );
dlg.TransfertToImage(aItem->m_Image); dlg.TransfertToImage(aItem->m_Image);
OnModify(); OnModify();
DrawPanel->Refresh(); DrawPanel->Refresh();

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file edit_component_in_schematic.cpp * @file edit_component_in_schematic.cpp
* @brief Schematic component editing code. * @brief Schematic component editing code.
@ -38,7 +63,7 @@ static void moveField( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositi
currentField->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); currentField->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
} }
pos = ( (SCH_COMPONENT*) currentField->GetParent() )->m_Pos; pos = ( (SCH_COMPONENT*) currentField->GetParent() )->GetPosition();
// Actual positions are calculated by the rotation/mirror transform // Actual positions are calculated by the rotation/mirror transform
// But here we want the relative position of the moved field // But here we want the relative position of the moved field
@ -47,7 +72,7 @@ static void moveField( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositi
wxPoint pt( screen->GetCrossHairPosition() - pos ); wxPoint pt( screen->GetCrossHairPosition() - pos );
TRANSFORM itrsfm = component->GetTransform().InverseTransform(); TRANSFORM itrsfm = component->GetTransform().InverseTransform();
currentField->m_Pos = pos + itrsfm.TransformCoordinate( pt ); currentField->SetPosition( pos + itrsfm.TransformCoordinate( pt ) );
currentField->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); currentField->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
} }
@ -84,7 +109,7 @@ void SCH_EDIT_FRAME::MoveField( SCH_FIELD* aField, wxDC* aDC )
GetScreen()->SetCurItem( aField ); GetScreen()->SetCurItem( aField );
SetUndoItem( comp ); SetUndoItem( comp );
pos = comp->m_Pos; pos = comp->GetPosition();
/* Positions are computed by the rotation/mirror transform. */ /* Positions are computed by the rotation/mirror transform. */
newpos = aField->m_Pos - pos; newpos = aField->m_Pos - pos;
@ -174,7 +199,7 @@ create a new power component with the new value." ), GetChars( entry->GetName()
{ {
if( aField->m_Text.IsEmpty() ) // Means the field was not already in use if( aField->m_Text.IsEmpty() ) // Means the field was not already in use
{ {
aField->m_Pos = component->m_Pos; aField->m_Pos = component->GetPosition();
aField->m_Size.x = aField->m_Size.y = m_TextFieldSize; aField->m_Size.x = aField->m_Size.y = m_TextFieldSize;
} }

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file edit_label.cpp * @file edit_label.cpp
* @brief Label, global label and text creation and editing. * @brief Label, global label and text creation and editing.
@ -24,83 +49,6 @@ static bool lastTextBold = false;
static bool lastTextItalic = false; static bool lastTextItalic = false;
static void moveText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_TEXT* textItem = (SCH_TEXT*) screen->GetCurItem();
wxCHECK_RET( (textItem != NULL) && textItem->CanIncrementLabel(),
wxT( "Cannot move invalid text type." ) );
// Erase the current text at its current position.
if( aErase )
textItem->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
textItem->m_Pos = screen->GetCrossHairPosition();
// Draw the text item at it's new position.
textItem->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
}
static void abortMoveText( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_TEXT* item = (SCH_TEXT*)screen->GetCurItem();
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) aPanel->GetParent();
parent->SetRepeatItem( NULL );
screen->SetCurItem( NULL );
if( item == NULL ) /* no current item */
return;
if( item->IsNew() )
{
delete item;
item = NULL;
}
else // Move command on an existing text item, restore the values of the original.
{
SCH_TEXT* olditem = (SCH_TEXT* )parent->GetUndoItem();
screen->SetCurItem( item );
wxCHECK_RET( olditem != NULL && item->Type() == olditem->Type(),
wxT( "Cannot restore undefined or bad last text item." ) );
// Never delete existing item, because it can be referenced by an undo/redo command
// Just restore its data
item->SwapData(olditem);
item->ClearFlags();
}
aPanel->Refresh();
}
void SCH_EDIT_FRAME::MoveText( SCH_TEXT* aTextItem, wxDC* aDC )
{
wxCHECK_RET( (aTextItem != NULL) && aTextItem->CanIncrementLabel(),
wxT( "Cannot move invalid text item" ) );
m_itemToRepeat = NULL;
aTextItem->SetFlags( IS_MOVED );
SetUndoItem( aTextItem );
DrawPanel->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( aTextItem->m_Pos );
DrawPanel->MoveCursorToCrossHair();
OnModify();
DrawPanel->SetMouseCapture( moveText, abortMoveText );
GetScreen()->SetCurItem( aTextItem );
moveText( DrawPanel, aDC, wxDefaultPosition, true );
DrawPanel->CrossHairOn( aDC );
}
void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* aTextItem, wxDC* aDC ) void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* aTextItem, wxDC* aDC )
{ {
wxCHECK_RET( (aTextItem != NULL) && aTextItem->CanIncrementLabel(), wxCHECK_RET( (aTextItem != NULL) && aTextItem->CanIncrementLabel(),
@ -177,12 +125,12 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
} }
textItem->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); textItem->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->SetMouseCapture( moveText, abortMoveText ); MoveItem( (SCH_ITEM*) textItem, aDC );
GetScreen()->SetCurItem( textItem );
return textItem; return textItem;
} }
/* /*
* OnConvertTextType is a command event handler to change a text type to an other one. * OnConvertTextType is a command event handler to change a text type to an other one.
* The new text, label, hierarchical label, or global label is created from the old text * The new text, label, hierarchical label, or global label is created from the old text
@ -300,13 +248,16 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
// and replace text with newtext // and replace text with newtext
PICKED_ITEMS_LIST pickList; PICKED_ITEMS_LIST pickList;
ITEM_PICKER picker( text, UR_CHANGED ); ITEM_PICKER picker( text, UR_CHANGED );
if( text->GetFlags() ) if( text->GetFlags() )
{ {
// text is being edited, save initial text for undo command // text is being edited, save initial text for undo command
picker.SetLink( GetUndoItem() ); picker.SetLink( GetUndoItem() );
pickList.PushItem( picker ); pickList.PushItem( picker );
// the owner of undoItem is no more "this", it is now "picker": // the owner of undoItem is no more "this", it is now "picker":
SetUndoItem( NULL ); SetUndoItem( NULL );
// save current newtext copy for undo/abort current command // save current newtext copy for undo/abort current command
SetUndoItem( newtext ); SetUndoItem( newtext );
} }

View File

@ -1,3 +1,31 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file eeschema_id.h
*/
#ifndef __EESCHEMA_ID_H__ #ifndef __EESCHEMA_ID_H__
#define __EESCHEMA_ID_H__ #define __EESCHEMA_ID_H__
@ -84,7 +112,6 @@ enum id_eeschema_frm
ID_POPUP_SCH_RESIZE_SHEET, ID_POPUP_SCH_RESIZE_SHEET,
ID_POPUP_SCH_CLEANUP_SHEET, ID_POPUP_SCH_CLEANUP_SHEET,
ID_POPUP_SCH_EDIT_SHEET_PIN, ID_POPUP_SCH_EDIT_SHEET_PIN,
ID_POPUP_SCH_MOVE_SHEET_PIN,
ID_POPUP_IMPORT_GLABEL, ID_POPUP_IMPORT_GLABEL,
ID_POPUP_SCH_GENERIC_ORIENT_CMP, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
ID_POPUP_SCH_GENERIC_EDIT_CMP, ID_POPUP_SCH_GENERIC_EDIT_CMP,

View File

@ -14,9 +14,6 @@
#include "sch_text.h" #include "sch_text.h"
/** Event function SCH_EDIT_FRAME::OnCopySchematicItemRequest
* duplicate the current located item
*/
void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
{ {
SCH_ITEM * curr_item = GetScreen()->GetCurItem(); SCH_ITEM * curr_item = GetScreen()->GetCurItem();
@ -35,7 +32,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
newitem->m_TimeStamp = GetTimeStamp(); newitem->m_TimeStamp = GetTimeStamp();
newitem->ClearAnnotation( NULL ); newitem->ClearAnnotation( NULL );
newitem->m_Flags = IS_NEW; newitem->m_Flags = IS_NEW;
StartMovePart( newitem, &dc ); MoveItem( (SCH_ITEM*) newitem, &dc );
/* Redraw the original part, because StartMovePart() erased /* Redraw the original part, because StartMovePart() erased
* it from screen */ * it from screen */
@ -50,7 +47,8 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
{ {
SCH_TEXT* newitem = (SCH_TEXT*) curr_item->Clone(); SCH_TEXT* newitem = (SCH_TEXT*) curr_item->Clone();
newitem->SetFlags( IS_NEW ); newitem->SetFlags( IS_NEW );
MoveText( newitem, &dc ); MoveItem( (SCH_ITEM*) newitem, &dc );
/* Redraw the original part in XOR mode */ /* Redraw the original part in XOR mode */
curr_item->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode ); curr_item->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), g_XorMode );
} }

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file eeschema/find.cpp * @file eeschema/find.cpp
* @brief Functions for searching for a schematic item. * @brief Functions for searching for a schematic item.
@ -64,14 +89,16 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
m_CurrentSheet->UpdateAllScreenReferences(); m_CurrentSheet->UpdateAllScreenReferences();
} }
sheetFoundIn->LastScreen()->SetCrossHairPosition( lastMarker->m_Pos ); sheetFoundIn->LastScreen()->SetCrossHairPosition( lastMarker->GetPosition() );
RedrawScreen( lastMarker->m_Pos, warpCursor ); RedrawScreen( lastMarker->GetPosition(), warpCursor );
wxString path = sheetFoundIn->Path(); wxString path = sheetFoundIn->Path();
wxString units = GetAbbreviatedUnitsLabel(); wxString units = GetAbbreviatedUnitsLabel();
double x = To_User_Unit( g_UserUnit, (double) lastMarker->m_Pos.x, m_InternalUnits ); double x = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().x,
double y = To_User_Unit( g_UserUnit, (double) lastMarker->m_Pos.y, m_InternalUnits ); m_InternalUnits );
double y = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().y,
m_InternalUnits );
msg.Printf( _( "Design rule check marker found in sheet %s at %0.3f%s, %0.3f%s" ), msg.Printf( _( "Design rule check marker found in sheet %s at %0.3f%s, %0.3f%s" ),
GetChars( path ), x, GetChars( units ), y, GetChars( units) ); GetChars( path ), x, GetChars( units ), y, GetChars( units) );
SetStatusText( msg ); SetStatusText( msg );
@ -83,21 +110,6 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
} }
/**
* Function FindComponentAndItem
* finds a Component in the schematic, and an item in this component.
* @param component_reference The component reference to find.
* @param text_to_find - The text to search for, either in value, reference
* or elsewhere.
* @param Find_in_hierarchy: false => Search is made in current sheet
* true => the whole hierarchy
* @param SearchType: 0 => find component
* 1 => find pin
* 2 => find ref
* 3 => find value
* >= 4 => unused (same as 0)
* @param mouseWarp If true, then move the mouse cursor to the item.
*/
SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_reference, SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_reference,
bool Find_in_hierarchy, bool Find_in_hierarchy,
int SearchType, int SearchType,
@ -141,11 +153,11 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
default: default:
case 0: // Find component only case 0: // Find component only
NotFound = false; NotFound = false;
pos = pSch->m_Pos; pos = pSch->GetPosition();
break; break;
case 1: // find a pin case 1: // find a pin
pos = pSch->m_Pos; /* temporary: will be changed if the pin is found */ pos = pSch->GetPosition(); // temporary: will be changed if the pin is found.
pin = pSch->GetPin( text_to_find ); pin = pSch->GetPin( text_to_find );
if( pin == NULL ) if( pin == NULL )
@ -157,17 +169,17 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
case 2: // find reference case 2: // find reference
NotFound = false; NotFound = false;
pos = pSch->GetField( REFERENCE )->m_Pos; pos = pSch->GetField( REFERENCE )->GetPosition();
break; break;
case 3: // find value case 3: // find value
pos = pSch->m_Pos; pos = pSch->GetPosition();
if( text_to_find.CmpNoCase( pSch->GetField( VALUE )->m_Text ) != 0 ) if( text_to_find.CmpNoCase( pSch->GetField( VALUE )->m_Text ) != 0 )
break; break;
NotFound = false; NotFound = false;
pos = pSch->GetField( VALUE )->m_Pos; pos = pSch->GetField( VALUE )->GetPosition();
break; break;
} }
} }
@ -189,9 +201,9 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
} }
wxPoint delta; wxPoint delta;
pos -= Component->m_Pos; pos -= Component->GetPosition();
delta = Component->GetTransform().TransformCoordinate( pos ); delta = Component->GetTransform().TransformCoordinate( pos );
pos = delta + Component->m_Pos; pos = delta + Component->GetPosition();
/* There may be need to reframe the drawing */ /* There may be need to reframe the drawing */
@ -279,12 +291,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
} }
/** void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& aEvent )
* Finds an item in the schematic matching the search string.
*
* @param event - Find dialog event containing the find parameters.
*/
void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& event )
{ {
static SCH_ITEM* lastItem = NULL; /* last item found when searching a match static SCH_ITEM* lastItem = NULL; /* last item found when searching a match
* note: the actual matched item can be a * note: the actual matched item can be a
@ -296,18 +303,18 @@ void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& event )
wxString msg; wxString msg;
SCH_SHEET_PATH* sheetFoundIn = NULL; SCH_SHEET_PATH* sheetFoundIn = NULL;
wxFindReplaceData searchCriteria; wxFindReplaceData searchCriteria;
bool warpCursor = !( event.GetFlags() & FR_NO_WARP_CURSOR ); bool warpCursor = !( aEvent.GetFlags() & FR_NO_WARP_CURSOR );
searchCriteria.SetFlags( event.GetFlags() ); searchCriteria.SetFlags( aEvent.GetFlags() );
searchCriteria.SetFindString( event.GetFindString() ); searchCriteria.SetFindString( aEvent.GetFindString() );
searchCriteria.SetReplaceString( event.GetReplaceString() ); searchCriteria.SetReplaceString( aEvent.GetReplaceString() );
if( event.GetEventType() == wxEVT_COMMAND_FIND_CLOSE ) if( aEvent.GetEventType() == wxEVT_COMMAND_FIND_CLOSE )
{ {
sheetFoundIn = m_CurrentSheet; sheetFoundIn = m_CurrentSheet;
warpCursor = true; warpCursor = true;
} }
else if( event.GetFlags() & FR_CURRENT_SHEET_ONLY && g_RootSheet->CountSheets() > 1 ) else if( aEvent.GetFlags() & FR_CURRENT_SHEET_ONLY && g_RootSheet->CountSheets() > 1 )
{ {
sheetFoundIn = m_CurrentSheet; sheetFoundIn = m_CurrentSheet;
lastItem = m_CurrentSheet->MatchNextItem( searchCriteria, lastItem, &lastItemPosition ); lastItem = m_CurrentSheet->MatchNextItem( searchCriteria, lastItem, &lastItemPosition );
@ -331,12 +338,12 @@ void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& event )
RedrawScreen( lastItemPosition, warpCursor ); RedrawScreen( lastItemPosition, warpCursor );
msg = event.GetFindString() + _( " found in " ) + sheetFoundIn->PathHumanReadable(); msg = aEvent.GetFindString() + _( " found in " ) + sheetFoundIn->PathHumanReadable();
SetStatusText( msg ); SetStatusText( msg );
} }
else else
{ {
msg.Printf( _( "No item found matching %s." ), GetChars( event.GetFindString() ) ); msg.Printf( _( "No item found matching %s." ), GetChars( aEvent.GetFindString() ) );
SetStatusText( msg ); SetStatusText( msg );
} }
} }

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file getpart.cpp * @file getpart.cpp
* @brief Cod to handle get & place library component. * @brief Cod to handle get & place library component.
@ -23,49 +48,6 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
/**
* Move a component.
*/
static void moveComponent( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_COMPONENT* component = (SCH_COMPONENT*) screen->GetCurItem();
if( aErase )
{
component->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
}
component->Move( screen->GetCrossHairPosition() - component->m_Pos );
component->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
}
/*
* Abort a place component command in progress.
*/
static void abortMoveComponent( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) aPanel->GetParent();
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_COMPONENT* component = (SCH_COMPONENT*) screen->GetCurItem();
if( component->IsNew() )
{
SAFE_DELETE( component );
}
else
{
component->SwapData( (SCH_COMPONENT*) frame->GetUndoItem() );
component->ClearFlags();
}
aPanel->Refresh( true );
screen->SetCurItem( NULL );
}
wxString SCH_EDIT_FRAME::SelectFromLibBrowser( void ) wxString SCH_EDIT_FRAME::SelectFromLibBrowser( void )
{ {
wxSemaphore semaphore( 0, 1 ); wxSemaphore semaphore( 0, 1 );
@ -93,7 +75,6 @@ wxString SCH_EDIT_FRAME::SelectFromLibBrowser( void )
} }
/* /*
* load from a library and place a component * load from a library and place a component
* if libname != "", search in lib "libname" * if libname != "", search in lib "libname"
@ -108,7 +89,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
int unit = 1; int unit = 1;
int convert = 1; int convert = 1;
LIB_COMPONENT* Entry = NULL; LIB_COMPONENT* Entry = NULL;
SCH_COMPONENT* Component = NULL; SCH_COMPONENT* component = NULL;
CMP_LIBRARY* Library = NULL; CMP_LIBRARY* Library = NULL;
wxString Name, keys, msg; wxString Name, keys, msg;
bool AllowWildSeach = true; bool AllowWildSeach = true;
@ -196,6 +177,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
{ {
AllowWildSeach = false; AllowWildSeach = false;
Name = DataBaseGetName( this, keys, Name ); Name = DataBaseGetName( this, keys, Name );
if( Name.IsEmpty() ) if( Name.IsEmpty() )
{ {
DrawPanel->m_IgnoreMouseEvents = false; DrawPanel->m_IgnoreMouseEvents = false;
@ -236,21 +218,24 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
lastCommponentName = Name; lastCommponentName = Name;
AddHistoryComponentName( HistoryList, Name ); AddHistoryComponentName( HistoryList, Name );
DrawPanel->SetMouseCapture( moveComponent, abortMoveComponent );
Component = new SCH_COMPONENT( *Entry, GetSheet(), unit, convert, component = new SCH_COMPONENT( *Entry, GetSheet(), unit, convert,
GetScreen()->GetCrossHairPosition(), true ); GetScreen()->GetCrossHairPosition(), true );
// Set the m_ChipName value, from component name in lib, for aliases // Set the m_ChipName value, from component name in lib, for aliases
// Note if Entry is found, and if Name is an alias of a component, // Note if Entry is found, and if Name is an alias of a component,
// alias exists because its root component was found // alias exists because its root component was found
Component->SetLibName( Name ); component->SetLibName( Name );
// Set the component value that can differ from component name in lib, for aliases // Set the component value that can differ from component name in lib, for aliases
Component->GetField( VALUE )->m_Text = Name; component->GetField( VALUE )->m_Text = Name;
Component->DisplayInfo( this ); component->DisplayInfo( this );
Component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
component->SetFlags( IS_NEW );
return Component; MoveItem( (SCH_ITEM*) component, DC );
return component;
} }
@ -435,45 +420,3 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC )
GetScreen()->TestDanglingEnds( DrawPanel, DC ); GetScreen()->TestDanglingEnds( DrawPanel, DC );
OnModify( ); OnModify( );
} }
void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* aComponent, wxDC* aDC )
{
wxCHECK_RET( (aComponent != NULL) && (aComponent->Type() == SCH_COMPONENT_T),
wxT( "Cannot move invalid component. Bad Programmer!" ) );
if( aComponent->GetFlags() == 0 )
SetUndoItem( aComponent );
DrawPanel->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( aComponent->m_Pos );
DrawPanel->MoveCursorToCrossHair();
DrawPanel->SetMouseCapture( moveComponent, abortMoveComponent );
GetScreen()->SetCurItem( aComponent );
#if 1
// switch from normal mode to xor mode for the duration of the move, first
// by erasing fully any "normal drawing mode" primitives with the
// RefreshDrawingRect(), then by drawing the first time in xor mode so that
// subsequent xor drawing modes will fully erase this first copy.
aComponent->SetFlags( IS_MOVED ); // omit redrawing the component, erase only
DrawPanel->RefreshDrawingRect( aComponent->GetBoundingBox() );
aComponent->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
#else
aComponent->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
aComponent->SetFlags( IS_MOVED );
moveComponent( DrawPanel, aDC, false );
#endif
DrawPanel->m_AutoPAN_Request = true;
DrawPanel->CrossHairOn( aDC );
}

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file eeschema/hotkeys.cpp * @file eeschema/hotkeys.cpp
*/ */
@ -718,7 +743,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_MOVE_COMPONENT_OR_ITEM: // Start move component or other schematic item case HK_MOVE_COMPONENT_OR_ITEM: // Start move schematic item.
if( itemInEdit ) if( itemInEdit )
break; break;
@ -731,47 +756,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
} }
if( aItem->GetFlags() == 0 ) cmd.SetId( HK_Descr->m_IdMenuEvent );
{ wxPostEvent( this, cmd );
switch( aItem->Type() )
{
// select the correct event for moving an schematic object
// and add it to the event queue
case SCH_SHEET_T:
case SCH_COMPONENT_T:
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
case SCH_TEXT_T:
case SCH_FIELD_T:
case SCH_BUS_ENTRY_T:
case SCH_BITMAP_T:
cmd.SetId( HK_Descr->m_IdMenuEvent );
wxPostEvent( this, cmd );
break;
case SCH_SHEET_PIN_T:
cmd.SetId( ID_POPUP_SCH_MOVE_SHEET_PIN );
wxPostEvent( this, cmd );
break;
case SCH_LINE_T:
/**
* @todo Determine why moving bus lines are not handled here.
*/
if( ((SCH_ITEM*) aItem )->GetLayer() != LAYER_BUS )
{
cmd.SetId( ID_POPUP_SCH_MOVE_ITEM );
wxPostEvent( this, cmd );
}
break;
default:
;
}
}
break; break;
case HK_EDIT: case HK_EDIT:

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file eeschema/onleftclick.cpp * @file eeschema/onleftclick.cpp
*/ */
@ -50,6 +75,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case SCH_COMPONENT_T: case SCH_COMPONENT_T:
case SCH_FIELD_T: case SCH_FIELD_T:
case SCH_BITMAP_T: case SCH_BITMAP_T:
case SCH_NO_CONNECT_T:
item->Place( this, aDC ); item->Place( this, aDC );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file eeschema/onrightclick.cpp * @file eeschema/onrightclick.cpp
*/ */
@ -77,11 +102,13 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{ {
if( item && item->GetFlags() ) if( item && item->GetFlags() )
{ {
AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ), KiBitmap( cancel_xpm ) ); AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
KiBitmap( cancel_xpm ) );
} }
else else
{ {
AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "End Tool" ), KiBitmap( cancel_tool_xpm ) ); AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "End Tool" ),
KiBitmap( cancel_tool_xpm ) );
} }
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
@ -90,7 +117,8 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{ {
if( item && item->GetFlags() ) if( item && item->GetFlags() )
{ {
AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ), KiBitmap( cancel_xpm ) ); AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
KiBitmap( cancel_xpm ) );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
} }
} }
@ -98,7 +126,8 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
if( item == NULL ) if( item == NULL )
{ {
if( GetSheet()->Last() != g_RootSheet ) if( GetSheet()->Last() != g_RootSheet )
AddMenuItem( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, _( "Leave Sheet" ), KiBitmap( leave_sheet_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, _( "Leave Sheet" ),
KiBitmap( leave_sheet_xpm ) );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
return true; return true;
@ -111,7 +140,8 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{ {
case SCH_NO_CONNECT_T: case SCH_NO_CONNECT_T:
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete No Connect" ), KiBitmap( delete_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete No Connect" ),
KiBitmap( delete_xpm ) );
break; break;
case SCH_JUNCTION_T: case SCH_JUNCTION_T:
@ -131,7 +161,8 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
else else
PopMenu->Append( ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH, _( "Set Bus Entry \\" ) ); PopMenu->Append( ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH, _( "Set Bus Entry \\" ) );
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Bus Entry" ), KiBitmap( delete_bus_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Bus Entry" ),
KiBitmap( delete_bus_xpm ) );
break; break;
case SCH_MARKER_T: case SCH_MARKER_T:
@ -179,9 +210,11 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
default: default:
if( is_new ) if( is_new )
AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ), KiBitmap( apply_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ),
KiBitmap( apply_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Drawing" ), KiBitmap( delete_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Drawing" ),
KiBitmap( delete_xpm ) );
break; break;
} }
break; break;
@ -252,8 +285,10 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
wxMenu* orientmenu = new wxMenu; wxMenu* orientmenu = new wxMenu;
msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
AddMenuItem( orientmenu, ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) ); AddMenuItem( orientmenu, ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE, msg,
AddMenuItem( orientmenu, ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE, _( "Rotate -" ), KiBitmap( rotate_cw_xpm ) ); KiBitmap( rotate_ccw_xpm ) );
AddMenuItem( orientmenu, ID_POPUP_SCH_ROTATE_CMP_CLOCKWISE, _( "Rotate -" ),
KiBitmap( rotate_cw_xpm ) );
msg = AddHotkeyName( _( "Mirror --" ), s_Schematic_Hokeys_Descr, HK_MIRROR_X_COMPONENT ); msg = AddHotkeyName( _( "Mirror --" ), s_Schematic_Hokeys_Descr, HK_MIRROR_X_COMPONENT );
AddMenuItem( orientmenu, ID_POPUP_SCH_MIRROR_X_CMP, msg, KiBitmap( mirror_v_xpm ) ); AddMenuItem( orientmenu, ID_POPUP_SCH_MIRROR_X_CMP, msg, KiBitmap( mirror_v_xpm ) );
msg = AddHotkeyName( _( "Mirror ||" ), s_Schematic_Hokeys_Descr, HK_MIRROR_Y_COMPONENT ); msg = AddHotkeyName( _( "Mirror ||" ), s_Schematic_Hokeys_Descr, HK_MIRROR_Y_COMPONENT );
@ -272,11 +307,13 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
msg = AddHotkeyName( _( "Value " ), s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_VALUE ); msg = AddHotkeyName( _( "Value " ), s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT_VALUE );
AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_VALUE_CMP, msg, KiBitmap( edit_comp_value_xpm ) ); AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_VALUE_CMP, msg, KiBitmap( edit_comp_value_xpm ) );
AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_REF_CMP, _( "Reference" ), KiBitmap( edit_comp_ref_xpm ) ); AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_REF_CMP, _( "Reference" ),
KiBitmap( edit_comp_ref_xpm ) );
msg = AddHotkeyName( _( "Footprint " ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Footprint " ), s_Schematic_Hokeys_Descr,
HK_EDIT_COMPONENT_FOOTPRINT ); HK_EDIT_COMPONENT_FOOTPRINT );
AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_FOOTPRINT_CMP, msg, KiBitmap( edit_comp_footprint_xpm ) ); AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_FOOTPRINT_CMP, msg,
KiBitmap( edit_comp_footprint_xpm ) );
} }
if( libComponent && libComponent->HasConversion() ) if( libComponent && libComponent->HasConversion() )
@ -487,15 +524,18 @@ void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunct
if( !aJunction->IsNew() ) if( !aJunction->IsNew() )
{ {
if( m_collectedItems.IsDraggableJunction() ) if( m_collectedItems.IsDraggableJunction() )
AddMenuItem( aMenu, ID_POPUP_SCH_DRAG_WIRE_REQUEST, _( "Drag Junction" ), KiBitmap( move_xpm ) ); AddMenuItem( aMenu, ID_POPUP_SCH_DRAG_WIRE_REQUEST, _( "Drag Junction" ),
KiBitmap( move_xpm ) );
if( screen->GetWire( aJunction->m_Pos, EXCLUDE_END_POINTS_T ) ) if( screen->GetWire( aJunction->GetPosition(), EXCLUDE_END_POINTS_T ) )
AddMenuItem( aMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), KiBitmap( break_line_xpm ) ); AddMenuItem( aMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
KiBitmap( break_line_xpm ) );
} }
if( screen->GetWireOrBus( aJunction->m_Pos ) ) if( screen->GetWireOrBus( aJunction->GetPosition() ) )
{ {
AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), KiBitmap( delete_node_xpm ) ); AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
KiBitmap( delete_node_xpm ) );
AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ), AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
KiBitmap( delete_connection_xpm ) ); KiBitmap( delete_connection_xpm ) );
} }
@ -520,14 +560,16 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
msg = AddHotkeyName( _( "Delete Wire" ), s_Schematic_Hokeys_Descr, HK_DELETE ); msg = AddHotkeyName( _( "Delete Wire" ), s_Schematic_Hokeys_Descr, HK_DELETE );
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), KiBitmap( delete_node_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
KiBitmap( delete_node_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ), AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
KiBitmap( delete_connection_xpm ) ); KiBitmap( delete_connection_xpm ) );
SCH_LINE* line = screen->GetWireOrBus( screen->GetCrossHairPosition() ); SCH_LINE* line = screen->GetWireOrBus( screen->GetCrossHairPosition() );
if( line && !line->IsEndPoint( screen->GetCrossHairPosition() ) ) if( line && !line->IsEndPoint( screen->GetCrossHairPosition() ) )
AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), KiBitmap( break_line_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
KiBitmap( break_line_xpm ) );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
@ -538,7 +580,8 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
// Add global label command only if the cursor is over one end of the wire. // Add global label command only if the cursor is over one end of the wire.
if( ( pos == Wire->m_Start ) || ( pos == Wire->m_End ) ) if( ( pos == Wire->m_Start ) || ( pos == Wire->m_End ) )
AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), KiBitmap( add_glabel_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ),
KiBitmap( add_glabel_xpm ) );
} }
@ -567,7 +610,8 @@ void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
// Add global label command only if the cursor is over one end of the bus. // Add global label command only if the cursor is over one end of the bus.
if( ( pos == Bus->m_Start ) || ( pos == Bus->m_End ) ) if( ( pos == Bus->m_Start ) || ( pos == Bus->m_End ) )
AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ), KiBitmap( add_glabel_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ),
KiBitmap( add_glabel_xpm ) );
} }
@ -577,7 +621,8 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
if( !Sheet->GetFlags() ) if( !Sheet->GetFlags() )
{ {
AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ), KiBitmap( enter_sheet_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ),
KiBitmap( enter_sheet_xpm ) );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
msg = AddHotkeyName( _( "Move Sheet" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Move Sheet" ), s_Schematic_Hokeys_Descr,
HK_MOVE_COMPONENT_OR_ITEM ); HK_MOVE_COMPONENT_OR_ITEM );
@ -597,7 +642,7 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
AddMenuItem( PopMenu, ID_POPUP_SCH_EDIT_SHEET, msg, KiBitmap( edit_sheet_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_EDIT_SHEET, msg, KiBitmap( edit_sheet_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize Sheet" ), AddMenuItem( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize Sheet" ),
KiBitmap( resize_sheet_xpm ) ); KiBitmap( resize_sheet_xpm ) );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
AddMenuItem( PopMenu, ID_POPUP_IMPORT_GLABEL, _( "Import Sheet Pins" ), AddMenuItem( PopMenu, ID_POPUP_IMPORT_GLABEL, _( "Import Sheet Pins" ),
KiBitmap( import_hierarchical_label_xpm ) ); KiBitmap( import_hierarchical_label_xpm ) );
@ -621,13 +666,15 @@ void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet )
{ {
msg = AddHotkeyName( _( "Move Sheet Pin" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Move Sheet Pin" ), s_Schematic_Hokeys_Descr,
HK_MOVE_COMPONENT_OR_ITEM ); HK_MOVE_COMPONENT_OR_ITEM );
AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_SHEET_PIN, msg, KiBitmap( move_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
} }
AddMenuItem( PopMenu, ID_POPUP_SCH_EDIT_SHEET_PIN, _( "Edit Sheet Pin" ), KiBitmap( edit_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_EDIT_SHEET_PIN, _( "Edit Sheet Pin" ),
KiBitmap( edit_xpm ) );
if( !PinSheet->GetFlags() ) if( !PinSheet->GetFlags() )
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Sheet Pin" ), KiBitmap( delete_pinsheet_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Sheet Pin" ),
KiBitmap( delete_pinsheet_xpm ) );
} }
@ -635,7 +682,8 @@ void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
{ {
wxString msg; wxString msg;
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ), KiBitmap( cancel_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ),
KiBitmap( cancel_xpm ) );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
@ -654,9 +702,12 @@ void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
HK_MOVEBLOCK_TO_DRAGBLOCK ); HK_MOVEBLOCK_TO_DRAGBLOCK );
AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( move_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( move_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), KiBitmap( delete_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), KiBitmap( delete_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ), KiBitmap( mirror_h_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ),
AddMenuItem( PopMenu, ID_POPUP_MIRROR_X_BLOCK, _( "Mirror Block --" ), KiBitmap( mirror_v_xpm ) ); KiBitmap( mirror_h_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ), KiBitmap( rotate_ccw_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_MIRROR_X_BLOCK, _( "Mirror Block --" ),
KiBitmap( mirror_v_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ),
KiBitmap( rotate_ccw_xpm ) );
#if 0 #if 0
#ifdef __WINDOWS__ #ifdef __WINDOWS__
@ -671,7 +722,8 @@ void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame ) void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame )
{ {
AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), KiBitmap( delete_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), KiBitmap( delete_xpm ) );
AddMenuItem( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ), KiBitmap( info_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ),
KiBitmap( info_xpm ) );
} }
void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap ) void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap )
@ -680,16 +732,16 @@ void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap )
if( aBitmap->GetFlags() == 0 ) if( aBitmap->GetFlags() == 0 )
{ {
msg = AddHotkeyName( _( "Move Image" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Move Image" ), s_Schematic_Hokeys_Descr,
HK_MOVE_COMPONENT_OR_ITEM ); HK_MOVE_COMPONENT_OR_ITEM );
AddMenuItem( aPopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
} }
msg = AddHotkeyName( _( "Rotate Image" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); msg = AddHotkeyName( _( "Rotate Image" ), s_Schematic_Hokeys_Descr, HK_ROTATE );
AddMenuItem( aPopMenu, ID_POPUP_SCH_ROTATE_IMAGE, msg, KiBitmap( rotate_ccw_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_SCH_ROTATE_IMAGE, msg, KiBitmap( rotate_ccw_xpm ) );
AddMenuItem( aPopMenu, ID_POPUP_SCH_MIRROR_X_IMAGE, AddMenuItem( aPopMenu, ID_POPUP_SCH_MIRROR_X_IMAGE,
_( "Mirror --" ), KiBitmap( mirror_v_xpm ) ); _( "Mirror --" ), KiBitmap( mirror_v_xpm ) );
AddMenuItem( aPopMenu, ID_POPUP_SCH_MIRROR_Y_IMAGE, AddMenuItem( aPopMenu, ID_POPUP_SCH_MIRROR_Y_IMAGE,
_( "Mirror ||" ), KiBitmap( mirror_h_xpm ) ); _( "Mirror ||" ), KiBitmap( mirror_h_xpm ) );
if( aBitmap->GetFlags() == 0 ) if( aBitmap->GetFlags() == 0 )
{ {

View File

@ -1,7 +1,3 @@
/**
* @file sch_bitmap.cpp
*/
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
@ -26,6 +22,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file sch_bitmap.cpp
*/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "macros.h" #include "macros.h"
@ -101,33 +101,6 @@ bool SCH_BITMAP::Save( FILE* aFile ) const
} }
void SCH_BITMAP::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{
if( !IsNew() )
{
// save old bitmap in undo list
ClearFlags();
SCH_ITEM* undoItem = frame->GetUndoItem();
wxCHECK_RET( undoItem != NULL && undoItem->Type() == Type(),
wxT( "Invalid bitmap undo item." ) );
undoItem->ClearFlags();
PICKED_ITEMS_LIST pickList;
ITEM_PICKER picker( this, UR_CHANGED );
picker.SetLink( undoItem );
// the owner of undoItem is no more frame, this is picker:
frame->SetUndoItem( NULL );
pickList.PushItem( picker );
frame->SaveCopyInUndoList( pickList, UR_CHANGED );
}
SCH_ITEM::Place( frame, DC ); // For new items insert in draw list and in undo list
}
EDA_ITEM* SCH_BITMAP::doClone() const EDA_ITEM* SCH_BITMAP::doClone() const
{ {
return new SCH_BITMAP( *this ); return new SCH_BITMAP( *this );
@ -137,8 +110,8 @@ EDA_ITEM* SCH_BITMAP::doClone() const
void SCH_BITMAP::SwapData( SCH_ITEM* aItem ) void SCH_BITMAP::SwapData( SCH_ITEM* aItem )
{ {
wxCHECK_RET( aItem->Type() == SCH_BITMAP_T, wxCHECK_RET( aItem->Type() == SCH_BITMAP_T,
wxString::Format( wxT( "SCH_BITMAP object cannot swap data with %s object." ), wxString::Format( wxT( "SCH_BITMAP object cannot swap data with %s object." ),
GetChars( aItem->GetClass() ) ) ); GetChars( aItem->GetClass() ) ) );
SCH_BITMAP* item = (SCH_BITMAP*) aItem; SCH_BITMAP* item = (SCH_BITMAP*) aItem;
EXCHG( m_Pos, item->m_Pos ); EXCHG( m_Pos, item->m_Pos );
@ -153,7 +126,7 @@ bool SCH_BITMAP::Load( LINE_READER& aLine, wxString& aErrorMsg )
if( strnicmp( line, "$Bitmap", 7 ) != 0 ) if( strnicmp( line, "$Bitmap", 7 ) != 0 )
{ {
aErrorMsg.Printf( wxT( "Eeschema file bitmap image load error at line %d, aborted" ), aErrorMsg.Printf( wxT( "Eeschema file bitmap image load error at line %d, aborted" ),
aLine.LineNumber() ); aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine ); aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine );
return false; return false;
} }

View File

@ -1,8 +1,3 @@
/**
* @file sch_bitmap.h
*
*/
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
@ -27,6 +22,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file sch_bitmap.h
*
*/
#ifndef _SCH_BITMAP_H_ #ifndef _SCH_BITMAP_H_
#define _SCH_BITMAP_H_ #define _SCH_BITMAP_H_
@ -37,12 +37,14 @@
class SCH_BITMAP : public SCH_ITEM class SCH_BITMAP : public SCH_ITEM
{ {
public:
wxPoint m_Pos; // XY coordinates of center of the bitmap wxPoint m_Pos; // XY coordinates of center of the bitmap
public:
BITMAP_BASE* m_Image; // the BITMAP_BASE item BITMAP_BASE* m_Image; // the BITMAP_BASE item
public: SCH_BITMAP( const wxPoint& pos = wxPoint( 0, 0 ) ); public:
SCH_BITMAP( const wxPoint& pos = wxPoint( 0, 0 ) );
SCH_BITMAP( const SCH_BITMAP& aSchBitmap ); SCH_BITMAP( const SCH_BITMAP& aSchBitmap );
@ -102,8 +104,6 @@ public: SCH_BITMAP( const wxPoint& pos = wxPoint( 0, 0 ) );
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor = -1 ); int aDrawMode, int aColor = -1 );
virtual void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
/** /**
* Function ReadImageFile * Function ReadImageFile
* Reads and stores an image file. Init the bitmap used to draw this item * Reads and stores an image file. Init the bitmap used to draw this item
@ -166,9 +166,8 @@ public: SCH_BITMAP( const wxPoint& pos = wxPoint( 0, 0 ) );
virtual BITMAP_DEF GetMenuImage() const { return image_xpm; } virtual BITMAP_DEF GetMenuImage() const { return image_xpm; }
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
#endif #endif
private: private:
@ -177,6 +176,8 @@ private:
virtual bool doIsConnected( const wxPoint& aPosition ) const; virtual bool doIsConnected( const wxPoint& aPosition ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter ); virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
}; };

View File

@ -56,6 +56,18 @@ wxPoint SCH_BUS_ENTRY::m_End() const
} }
void SCH_BUS_ENTRY::SwapData( SCH_ITEM* aItem )
{
wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_BUS_ENTRY_T),
wxT( "Cannot swap bus entry data with invalid item." ) );
SCH_BUS_ENTRY* item = (SCH_BUS_ENTRY*)aItem;
EXCHG( m_Pos, item->m_Pos );
EXCHG( m_Size, item->m_Size );
EXCHG( m_Width, item->m_Width );
}
bool SCH_BUS_ENTRY::Save( FILE* aFile ) const bool SCH_BUS_ENTRY::Save( FILE* aFile ) const
{ {
bool success = true; bool success = true;

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file sch_bus_entry.h * @file sch_bus_entry.h
* *
@ -21,9 +46,10 @@
*/ */
class SCH_BUS_ENTRY : public SCH_ITEM class SCH_BUS_ENTRY : public SCH_ITEM
{ {
wxPoint m_Pos;
public: public:
int m_Width; int m_Width;
wxPoint m_Pos;
wxSize m_Size; wxSize m_Size;
public: public:
@ -40,6 +66,8 @@ public:
wxPoint m_End() const; wxPoint m_End() const;
virtual void SwapData( SCH_ITEM* aItem );
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor = -1 ); int aDrawMode, int aColor = -1 );
@ -116,6 +144,8 @@ private:
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const; virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter ); virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
}; };

View File

@ -90,7 +90,7 @@ const KICAD_T SCH_COLLECTOR::EditableItems[] = {
const KICAD_T SCH_COLLECTOR::MovableItems[] = { const KICAD_T SCH_COLLECTOR::MovableItems[] = {
SCH_MARKER_T, SCH_MARKER_T,
// SCH_JUNCTION_T, SCH_JUNCTION_T,
SCH_NO_CONNECT_T, SCH_NO_CONNECT_T,
SCH_BUS_ENTRY_T, SCH_BUS_ENTRY_T,
// SCH_LINE_T, // SCH_LINE_T,
@ -188,7 +188,7 @@ SEARCH_RESULT SCH_COLLECTOR::Inspect( EDA_ITEM* aItem, const void* aTestData )
// schematic. The hit test position must be converted to library coordinates. // schematic. The hit test position must be converted to library coordinates.
SCH_COMPONENT* component = (SCH_COMPONENT*) aTestData; SCH_COMPONENT* component = (SCH_COMPONENT*) aTestData;
TRANSFORM transform = component->GetTransform().InverseTransform(); TRANSFORM transform = component->GetTransform().InverseTransform();
wxPoint position = transform.TransformCoordinate( m_RefPos - component->m_Pos ); wxPoint position = transform.TransformCoordinate( m_RefPos - component->GetPosition() );
position.y *= -1; // Y axis polarity in schematic is inverted from library. position.y *= -1; // Y axis polarity in schematic is inverted from library.

View File

@ -681,16 +681,6 @@ void SCH_COMPONENT::SwapData( SCH_ITEM* aItem )
} }
void SCH_COMPONENT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{
/* save old text in undo list */
if( !IsNew() )
frame->SaveUndoItemInUndoList( this );
SCH_ITEM::Place( frame, DC );
}
void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath ) void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
{ {
bool keepMulti = false; bool keepMulti = false;

View File

@ -55,6 +55,7 @@ class SCH_COMPONENT : public SCH_ITEM
{ {
friend class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC; friend class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC;
wxPoint m_Pos;
wxString m_ChipName; ///< Name to look for in the library, i.e. "74LS00". wxString m_ChipName; ///< Name to look for in the library, i.e. "74LS00".
int m_unit; ///< The unit for multiple part per package components. int m_unit; ///< The unit for multiple part per package components.
int m_convert; ///< The alternate body style for components that have more than int m_convert; ///< The alternate body style for components that have more than
@ -75,11 +76,6 @@ class SCH_COMPONENT : public SCH_ITEM
*/ */
wxArrayString m_PathsAndReferences; wxArrayString m_PathsAndReferences;
public:
wxPoint m_Pos;
private:
void Init( const wxPoint& pos = wxPoint( 0, 0 ) ); void Init( const wxPoint& pos = wxPoint( 0, 0 ) );
EDA_RECT GetBodyBoundingBox() const; EDA_RECT GetBodyBoundingBox() const;
@ -290,8 +286,6 @@ public:
virtual void SwapData( SCH_ITEM* aItem ); virtual void SwapData( SCH_ITEM* aItem );
void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
// returns a unique ID, in the form of a path. // returns a unique ID, in the form of a path.
wxString GetPath( SCH_SHEET_PATH* sheet ); wxString GetPath( SCH_SHEET_PATH* sheet );
@ -433,6 +427,8 @@ private:
virtual bool doIsConnected( const wxPoint& aPosition ) const; virtual bool doIsConnected( const wxPoint& aPosition ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter ); virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
}; };

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file sch_field.cpp * @file sch_field.cpp
* @brief Implementation of the SCH_FIELD class. * @brief Implementation of the SCH_FIELD class.
@ -175,9 +200,9 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
/* Calculate the text position, according to the component /* Calculate the text position, according to the component
* orientation/mirror */ * orientation/mirror */
textpos = m_Pos - parentComponent->m_Pos; textpos = m_Pos - parentComponent->GetPosition();
textpos = parentComponent->GetScreenCoord( textpos ); textpos = parentComponent->GetScreenCoord( textpos );
textpos += parentComponent->m_Pos; textpos += parentComponent->GetPosition();
x1 = textpos.x; x1 = textpos.x;
y1 = textpos.y; y1 = textpos.y;
int len = 10; int len = 10;
@ -201,20 +226,25 @@ void SCH_FIELD::ImportValues( const LIB_FIELD& aSource )
} }
void SCH_FIELD::SwapData( SCH_FIELD* aField ) void SCH_FIELD::SwapData( SCH_ITEM* aItem )
{ {
EXCHG( m_Text, aField->m_Text ); wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_FIELD_T),
EXCHG( m_Layer, aField->m_Layer ); wxT( "Cannot swap field data with invalid item." ) );
EXCHG( m_Pos, aField->m_Pos );
EXCHG( m_Size, aField->m_Size ); SCH_FIELD* item = (SCH_FIELD*) aItem;
EXCHG( m_Thickness, aField->m_Thickness );
EXCHG( m_Orient, aField->m_Orient ); EXCHG( m_Text, item->m_Text );
EXCHG( m_Mirror, aField->m_Mirror ); EXCHG( m_Layer, item->m_Layer );
EXCHG( m_Attributs, aField->m_Attributs ); EXCHG( m_Pos, item->m_Pos );
EXCHG( m_Italic, aField->m_Italic ); EXCHG( m_Size, item->m_Size );
EXCHG( m_Bold, aField->m_Bold ); EXCHG( m_Thickness, item->m_Thickness );
EXCHG( m_HJustify, aField->m_HJustify ); EXCHG( m_Orient, item->m_Orient );
EXCHG( m_VJustify, aField->m_VJustify ); EXCHG( m_Mirror, item->m_Mirror );
EXCHG( m_Attributs, item->m_Attributs );
EXCHG( m_Italic, item->m_Italic );
EXCHG( m_Bold, item->m_Bold );
EXCHG( m_HJustify, item->m_HJustify );
EXCHG( m_VJustify, item->m_VJustify );
} }
@ -229,7 +259,7 @@ EDA_RECT SCH_FIELD::GetBoundingBox() const
SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) m_Parent; SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) m_Parent;
orient = m_Orient; orient = m_Orient;
wxPoint pos = parentComponent->m_Pos; wxPoint pos = parentComponent->GetPosition();
pos1 = m_Pos - pos; pos1 = m_Pos - pos;
size.x = LenSize( m_Text ); size.x = LenSize( m_Text );

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file sch_field.h * @file sch_field.h
* @brief Definition of the SCH_FIELD class for Eeschema. * @brief Definition of the SCH_FIELD class for Eeschema.
@ -80,9 +105,9 @@ public:
* Function SwapData * Function SwapData
* exchanges the date between the field and \a aField. * exchanges the date between the field and \a aField.
* *
* @param aField The field to exchange data with. * @param aItem The field to exchange data with.
*/ */
void SwapData( SCH_FIELD* aField ); virtual void SwapData( SCH_ITEM* aItem );
/** /**
* Function ImportValues * Function ImportValues
@ -183,6 +208,8 @@ private:
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const; virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter ); virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
}; };

View File

@ -80,6 +80,17 @@ EDA_ITEM* SCH_JUNCTION::doClone() const
} }
void SCH_JUNCTION::SwapData( SCH_ITEM* aItem )
{
wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_JUNCTION_T),
wxT( "Cannot swap junction data with invalid item." ) );
SCH_JUNCTION* item = (SCH_JUNCTION*) aItem;
EXCHG( m_Pos, item->m_Pos );
EXCHG( m_Size, item->m_Size );
}
bool SCH_JUNCTION::Load( LINE_READER& aLine, wxString& aErrorMsg ) bool SCH_JUNCTION::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
char name[256]; char name[256];

View File

@ -36,8 +36,9 @@
class SCH_JUNCTION : public SCH_ITEM class SCH_JUNCTION : public SCH_ITEM
{ {
public:
wxPoint m_Pos; /* XY coordinates of connection. */ wxPoint m_Pos; /* XY coordinates of connection. */
public:
wxSize m_Size; wxSize m_Size;
public: public:
@ -52,6 +53,8 @@ public:
return wxT( "SCH_JUNCTION" ); return wxT( "SCH_JUNCTION" );
} }
virtual void SwapData( SCH_ITEM* aItem );
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display * returns the orthogonal, bounding box of this object for display
@ -130,6 +133,8 @@ private:
virtual bool doIsConnected( const wxPoint& aPosition ) const; virtual bool doIsConnected( const wxPoint& aPosition ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter ); virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
}; };

View File

@ -582,3 +582,10 @@ void SCH_LINE::doPlot( PLOTTER* aPlotter )
if( m_Layer == LAYER_NOTES ) if( m_Layer == LAYER_NOTES )
aPlotter->set_dash( false ); aPlotter->set_dash( false );
} }
void SCH_LINE::doSetPosition( const wxPoint& aPosition )
{
m_End = m_End - ( m_Start - aPosition );
m_Start = aPosition;
}

View File

@ -176,6 +176,8 @@ private:
virtual bool doIsConnected( const wxPoint& aPosition ) const; virtual bool doIsConnected( const wxPoint& aPosition ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter ); virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Start; }
virtual void doSetPosition( const wxPoint& aPosition );
}; };

View File

@ -1,6 +1,32 @@
/***************************************************/ /*
/* classes to handle markers used in schematic ... */ * This program source code file is part of KiCad, a free EDA CAD application.
/***************************************************/ *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* @file sch_marker.h
* @brief SCH_MARKER class definition.
*/
#ifndef _TYPE_SCH_MARKER_H_ #ifndef _TYPE_SCH_MARKER_H_
#define _TYPE_SCH_MARKER_H_ #define _TYPE_SCH_MARKER_H_
@ -108,6 +134,8 @@ public:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const; virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
}; };
#endif /* _TYPE_SCH_MARKER_H_ */ #endif /* _TYPE_SCH_MARKER_H_ */

View File

@ -69,6 +69,17 @@ EDA_ITEM* SCH_NO_CONNECT::doClone() const
} }
void SCH_NO_CONNECT::SwapData( SCH_ITEM* aItem )
{
wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_NO_CONNECT_T),
wxT( "Cannot swap no connect data with invalid item." ) );
SCH_NO_CONNECT* item = (SCH_NO_CONNECT*)aItem;
EXCHG( m_Pos, item->m_Pos );
EXCHG( m_Size, item->m_Size );
}
EDA_RECT SCH_NO_CONNECT::GetBoundingBox() const EDA_RECT SCH_NO_CONNECT::GetBoundingBox() const
{ {
int delta = ( GetPenSize() + m_Size.x ) / 2; int delta = ( GetPenSize() + m_Size.x ) / 2;

View File

@ -36,8 +36,9 @@
class SCH_NO_CONNECT : public SCH_ITEM class SCH_NO_CONNECT : public SCH_ITEM
{ {
public:
wxPoint m_Pos; /* XY coordinates of NoConnect. */ wxPoint m_Pos; /* XY coordinates of NoConnect. */
public:
wxSize m_Size; // size of this symbol wxSize m_Size; // size of this symbol
public: public:
@ -58,6 +59,8 @@ public:
*/ */
virtual int GetPenSize() const; virtual int GetPenSize() const;
virtual void SwapData( SCH_ITEM* aItem );
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor = -1 ); int aDrawMode, int aColor = -1 );
@ -131,6 +134,8 @@ private:
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const; virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter ); virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
}; };

View File

@ -267,3 +267,13 @@ bool SCH_POLYLINE::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccur
return rect.Intersects( GetBoundingBox() ); return rect.Intersects( GetBoundingBox() );
} }
void SCH_POLYLINE::doSetPosition( const wxPoint& aPosition )
{
wxPoint offset = m_PolyPoints[0] - aPosition;
for( size_t i = 0; i < m_PolyPoints.size(); i++ )
m_PolyPoints[i] = m_PolyPoints[i] - offset;
}

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file sch_polyline.h * @file sch_polyline.h
* *
@ -102,6 +127,8 @@ private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const; virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const; virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual wxPoint doGetPosition() const { return m_PolyPoints[0]; }
virtual void doSetPosition( const wxPoint& aPosition );
}; };

View File

@ -382,7 +382,7 @@ void SCH_SCREEN::MarkConnections( SCH_LINE* aSegment )
{ {
SCH_JUNCTION* junction = (SCH_JUNCTION*) item; SCH_JUNCTION* junction = (SCH_JUNCTION*) item;
if( aSegment->IsEndPoint( junction->m_Pos ) ) if( aSegment->IsEndPoint( junction->GetPosition() ) )
item->SetFlags( CANDIDATE ); item->SetFlags( CANDIDATE );
continue; continue;
@ -984,14 +984,14 @@ bool SCH_SCREEN::BreakSegmentsOnJunctions()
{ {
SCH_JUNCTION* junction = ( SCH_JUNCTION* ) item; SCH_JUNCTION* junction = ( SCH_JUNCTION* ) item;
if( BreakSegment( junction->m_Pos ) ) if( BreakSegment( junction->GetPosition() ) )
brokenSegments = true; brokenSegments = true;
} }
else if( item->Type() == SCH_BUS_ENTRY_T ) else if( item->Type() == SCH_BUS_ENTRY_T )
{ {
SCH_BUS_ENTRY* busEntry = ( SCH_BUS_ENTRY* ) item; SCH_BUS_ENTRY* busEntry = ( SCH_BUS_ENTRY* ) item;
if( BreakSegment( busEntry->m_Pos ) || BreakSegment( busEntry->m_End() ) ) if( BreakSegment( busEntry->GetPosition() ) || BreakSegment( busEntry->m_End() ) )
brokenSegments = true; brokenSegments = true;
} }
} }
@ -1112,7 +1112,7 @@ bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxStri
*/ */
SCH_FIELD * fpfield = component->GetField( FOOTPRINT ); SCH_FIELD * fpfield = component->GetField( FOOTPRINT );
if( fpfield->m_Text.IsEmpty() if( fpfield->m_Text.IsEmpty()
&& ( fpfield->m_Pos == component->m_Pos ) ) && ( fpfield->m_Pos == component->GetPosition() ) )
{ {
fpfield->m_Orient = component->GetField( VALUE )->m_Orient; fpfield->m_Orient = component->GetField( VALUE )->m_Orient;
fpfield->m_Pos = component->GetField( VALUE )->m_Pos; fpfield->m_Pos = component->GetField( VALUE )->m_Pos;
@ -1272,7 +1272,7 @@ int SCH_SCREEN::GetConnection( const wxPoint& aPosition, PICKED_ITEMS_LIST& aLis
SCH_JUNCTION* junction = (SCH_JUNCTION*) item; SCH_JUNCTION* junction = (SCH_JUNCTION*) item;
if( CountConnectedItems( junction->m_Pos, false ) <= 2 ) if( CountConnectedItems( junction->GetPosition(), false ) <= 2 )
{ {
item->SetFlags( STRUCT_DELETED ); item->SetFlags( STRUCT_DELETED );
@ -1289,7 +1289,7 @@ int SCH_SCREEN::GetConnection( const wxPoint& aPosition, PICKED_ITEMS_LIST& aLis
if( item->Type() != SCH_LABEL_T ) if( item->Type() != SCH_LABEL_T )
continue; continue;
tmp = GetWireOrBus( ( (SCH_TEXT*) item )->m_Pos ); tmp = GetWireOrBus( ( (SCH_TEXT*) item )->GetPosition() );
if( tmp && tmp->GetFlags() & STRUCT_DELETED ) if( tmp && tmp->GetFlags() & STRUCT_DELETED )
{ {

View File

@ -491,18 +491,11 @@ void SCH_SHEET::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
delete this; delete this;
return; return;
} }
}
else /* save old text in undo list */ frame->SetSheetNumberAndCount();
{
frame->SaveUndoItemInUndoList( this );
} }
SCH_ITEM::Place( frame, DC ); //puts it on the GetDrawItems(). SCH_ITEM::Place( frame, DC ); //puts it on the GetDrawItems().
if( IsNew() )
{
frame->SetSheetNumberAndCount();
}
} }
@ -1061,7 +1054,7 @@ SEARCH_RESULT SCH_SHEET::Visit( INSPECTOR* aInspector, const void* aTestData,
wxString SCH_SHEET::GetSelectMenuText() const wxString SCH_SHEET::GetSelectMenuText() const
{ {
wxString tmp; wxString tmp;
tmp.Printf( _( "Hierarchical Sheet " ), GetChars( m_SheetName ) ); tmp.Printf( _( "Hierarchical Sheet %s" ), GetChars( m_SheetName ) );
return tmp; return tmp;
} }

View File

@ -616,6 +616,8 @@ private:
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const; virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter ); virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
}; };

View File

@ -331,46 +331,22 @@ void SCH_TEXT::SetOrientation( int aOrientation )
} }
void SCH_TEXT::SwapData( SCH_TEXT* copyitem ) void SCH_TEXT::SwapData( SCH_ITEM* aItem )
{ {
EXCHG( m_Text, copyitem->m_Text ); SCH_TEXT* item = (SCH_TEXT*) aItem;
EXCHG( m_Pos, copyitem->m_Pos );
EXCHG( m_Size, copyitem->m_Size );
EXCHG( m_Thickness, copyitem->m_Thickness );
EXCHG( m_Shape, copyitem->m_Shape );
EXCHG( m_Orient, copyitem->m_Orient );
EXCHG( m_Layer, copyitem->m_Layer ); EXCHG( m_Text, item->m_Text );
EXCHG( m_HJustify, copyitem->m_HJustify ); EXCHG( m_Pos, item->m_Pos );
EXCHG( m_VJustify, copyitem->m_VJustify ); EXCHG( m_Size, item->m_Size );
EXCHG( m_IsDangling, copyitem->m_IsDangling ); EXCHG( m_Thickness, item->m_Thickness );
EXCHG( m_SchematicOrientation, copyitem->m_SchematicOrientation ); EXCHG( m_Shape, item->m_Shape );
} EXCHG( m_Orient, item->m_Orient );
EXCHG( m_Layer, item->m_Layer );
void SCH_TEXT::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) EXCHG( m_HJustify, item->m_HJustify );
{ EXCHG( m_VJustify, item->m_VJustify );
if( !IsNew() ) EXCHG( m_IsDangling, item->m_IsDangling );
{ EXCHG( m_SchematicOrientation, item->m_SchematicOrientation );
// For existing (not new texts: save in undo list the old text:
ClearFlags();
PICKED_ITEMS_LIST pickList;
ITEM_PICKER picker( this, UR_CHANGED); //UR_EXCHANGE_T );
SCH_ITEM* undoItem = frame->GetUndoItem();
wxCHECK_RET( undoItem != NULL && undoItem->Type() == Type(),
wxT( "Invalid text undo item." ) );
undoItem->ClearFlags();
picker.SetLink( undoItem );
// the owner of undoItem is no more frame, this is picker:
frame->SetUndoItem( NULL );
pickList.PushItem( picker );
frame->SaveCopyInUndoList( pickList, UR_CHANGED ); //UR_EXCHANGE_T );
}
SCH_ITEM::Place( frame, DC );
} }

View File

@ -144,9 +144,7 @@ public:
aPoints.clear(); aPoints.clear();
} }
void SwapData( SCH_TEXT* copyitem ); virtual void SwapData( SCH_ITEM* aItem );
void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
/** /**
* Function GetBoundingBox * Function GetBoundingBox
@ -242,6 +240,8 @@ private:
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const; virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter ); virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
}; };

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file schedit.cpp * @file schedit.cpp
*/ */
@ -52,7 +77,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_RESIZE_SHEET: case ID_POPUP_SCH_RESIZE_SHEET:
case ID_POPUP_IMPORT_GLABEL: case ID_POPUP_IMPORT_GLABEL:
case ID_POPUP_SCH_EDIT_SHEET_PIN: case ID_POPUP_SCH_EDIT_SHEET_PIN:
case ID_POPUP_SCH_MOVE_SHEET_PIN:
case ID_POPUP_SCH_DRAG_CMP_REQUEST: case ID_POPUP_SCH_DRAG_CMP_REQUEST:
case ID_POPUP_SCH_DRAG_WIRE_REQUEST: case ID_POPUP_SCH_DRAG_WIRE_REQUEST:
case ID_POPUP_SCH_EDIT_CMP: case ID_POPUP_SCH_EDIT_CMP:
@ -256,11 +280,6 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
EditSheetPin( (SCH_SHEET_PIN*) item, &dc ); EditSheetPin( (SCH_SHEET_PIN*) item, &dc );
break; break;
case ID_POPUP_SCH_MOVE_SHEET_PIN:
DrawPanel->MoveCursorToCrossHair();
MoveSheetPin( (SCH_SHEET_PIN*) item, &dc );
break;
case ID_POPUP_SCH_DRAG_CMP_REQUEST: case ID_POPUP_SCH_DRAG_CMP_REQUEST:
case ID_POPUP_SCH_DRAG_WIRE_REQUEST: case ID_POPUP_SCH_DRAG_WIRE_REQUEST:
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
@ -478,48 +497,39 @@ void SCH_EDIT_FRAME::OnMoveItem( wxCommandEvent& aEvent )
INSTALL_UNBUFFERED_DC( dc, DrawPanel ); INSTALL_UNBUFFERED_DC( dc, DrawPanel );
DrawPanel->MoveCursorToCrossHair();
switch( item->Type() ) switch( item->Type() )
{ {
case SCH_LINE_T:
break;
case SCH_JUNCTION_T: case SCH_JUNCTION_T:
break; case SCH_NO_CONNECT_T:
case SCH_BUS_ENTRY_T: case SCH_BUS_ENTRY_T:
StartMoveBusEntry( (SCH_BUS_ENTRY*) item, &dc );
break;
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T:
case SCH_TEXT_T: case SCH_TEXT_T:
MoveText( (SCH_TEXT*) item, &dc ); case SCH_COMPONENT_T:
MoveItem( item, &dc );
break; break;
case SCH_BITMAP_T: case SCH_BITMAP_T:
MoveImage( (SCH_BITMAP*) item, &dc ); MoveImage( (SCH_BITMAP*) item, &dc );
break; break;
case SCH_COMPONENT_T:
StartMovePart( (SCH_COMPONENT*) item, &dc );
break;
case SCH_LINE_T:
break;
case SCH_SHEET_T: case SCH_SHEET_T:
StartMoveSheet( (SCH_SHEET*) item, &dc ); StartMoveSheet( (SCH_SHEET*) item, &dc );
break; break;
case SCH_NO_CONNECT_T:
break;
case SCH_FIELD_T: case SCH_FIELD_T:
MoveField( (SCH_FIELD*) item, &dc ); MoveField( (SCH_FIELD*) item, &dc );
break; break;
case SCH_MARKER_T:
case SCH_SHEET_PIN_T: case SCH_SHEET_PIN_T:
MoveSheetPin( (SCH_SHEET_PIN*) item, &dc );
break;
case SCH_MARKER_T:
default: default:
wxFAIL_MSG( wxString::Format( wxT( "Cannot move item type %s" ), wxFAIL_MSG( wxString::Format( wxT( "Cannot move item type %s" ),
GetChars( item->GetClass() ) ) ); GetChars( item->GetClass() ) ) );

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file schematic_undo_redo.cpp * @file schematic_undo_redo.cpp
* @brief Eeschema undo and redo functions for schematic editor. * @brief Eeschema undo and redo functions for schematic editor.
@ -82,118 +107,6 @@
* swap data between Item and its copy, pointed by its .m_Image member * swap data between Item and its copy, pointed by its .m_Image member
* swapped data is data modified by edition, so not all values are swapped * swapped data is data modified by edition, so not all values are swapped
*/ */
void SwapData( EDA_ITEM* aItem, EDA_ITEM* aImage )
{
if( aItem == NULL || aImage == NULL )
{
wxMessageBox( wxT( "SwapData error: NULL pointer" ) );
return;
}
switch( aItem->Type() )
{
case SCH_POLYLINE_T:
#undef SOURCE
#undef DEST
#define SOURCE ( (SCH_POLYLINE*) aItem )
#define DEST ( (SCH_POLYLINE*) aImage )
break;
case SCH_JUNCTION_T:
#undef SOURCE
#undef DEST
#define SOURCE ( (SCH_JUNCTION*) aItem )
#define DEST ( (SCH_JUNCTION*) aImage )
EXCHG( SOURCE->m_Pos, DEST->m_Pos );
break;
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
case SCH_TEXT_T:
#undef SOURCE
#undef DEST
#define SOURCE ( (SCH_TEXT*) aItem )
#define DEST ( (SCH_TEXT*) aImage )
DEST->SwapData( SOURCE );
break;
case SCH_COMPONENT_T:
#undef SOURCE
#undef DEST
#define SOURCE ( (SCH_COMPONENT*) aItem )
#define DEST ( (SCH_COMPONENT*) aImage )
DEST->SwapData( SOURCE );
break;
case SCH_LINE_T:
#undef SOURCE
#undef DEST
#define SOURCE ( (SCH_LINE*) aItem )
#define DEST ( (SCH_LINE*) aImage )
EXCHG( SOURCE->m_Start, DEST->m_Start );
EXCHG( SOURCE->m_End, DEST->m_End );
break;
case SCH_BUS_ENTRY_T:
#undef SOURCE
#undef DEST
#define SOURCE ( (SCH_BUS_ENTRY*) aItem )
#define DEST ( (SCH_BUS_ENTRY*) aImage )
EXCHG( SOURCE->m_Pos, DEST->m_Pos );
EXCHG( SOURCE->m_Size, DEST->m_Size );
break;
case SCH_SHEET_T:
#undef SOURCE
#undef DEST
#define SOURCE ( (SCH_SHEET*) aItem )
#define DEST ( (SCH_SHEET*) aImage )
DEST->SwapData( SOURCE );
break;
case SCH_MARKER_T:
#undef SOURCE
#undef DEST
#define SOURCE ( (SCH_MARKER*) aItem )
#define DEST ( (SCH_MARKER*) aImage )
EXCHG( SOURCE->m_Pos, DEST->m_Pos );
break;
case SCH_SHEET_PIN_T:
#undef SOURCE
#undef DEST
#define SOURCE ( (SCH_SHEET_PIN*) aItem )
#define DEST ( (SCH_SHEET_PIN*) aImage )
DEST->SwapData( SOURCE );
break;
case SCH_NO_CONNECT_T:
#undef SOURCE
#undef DEST
#define SOURCE ( (SCH_NO_CONNECT*) aItem )
#define DEST ( (SCH_NO_CONNECT*) aImage )
EXCHG( SOURCE->m_Pos, DEST->m_Pos );
break;
case SCH_BITMAP_T:
#undef SOURCE
#undef DEST
#define SOURCE ( (SCH_BITMAP*) aItem )
#define DEST ( (SCH_BITMAP*) aImage )
DEST->SwapData( SOURCE );
break;
case SCH_FIELD_T:
break;
// not directly used in schematic:
default:
wxMessageBox( wxT( "SwapData() error: unexpected type" ) );
break;
}
}
void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem, void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem,
UNDO_REDO_T aCommandType, UNDO_REDO_T aCommandType,
@ -346,7 +259,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
switch( aList->GetPickedItemStatus( ii ) ) switch( aList->GetPickedItemStatus( ii ) )
{ {
case UR_CHANGED: /* Exchange old and new data for each item */ case UR_CHANGED: /* Exchange old and new data for each item */
SwapData( item, image ); item->SwapData( image );
break; break;
case UR_NEW: /* new items are deleted */ case UR_NEW: /* new items are deleted */

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file sch_item_struct.h * @file sch_item_struct.h
* @brief Base schematic object class definition. * @brief Base schematic object class definition.
@ -131,7 +156,13 @@ public:
int aDrawMode, int aDrawMode,
int aColor = -1 ) = 0; int aColor = -1 ) = 0;
/* Place function */ /**
* Function Place
* place the schematic item into the draw list.
* <p>
* If the schematic item is a new item or is modified, it is added to undo list.
* </p>
*/
virtual void Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC ); virtual void Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC );
/** /**
@ -321,6 +352,20 @@ public:
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath ) { } SCH_SHEET_PATH* aSheetPath ) { }
/**
* Function GetPosition
* @return the schematic item position.
*/
wxPoint GetPosition() const { return doGetPosition(); }
/**
* Function SetPosition
* set the schematic item position to \a aPosition.
*
* @param aPosition A reference to a wxPoint object containing the new position.
*/
void SetPosition( const wxPoint& aPosition ) { doSetPosition( aPosition ); }
virtual bool operator <( const SCH_ITEM& aItem ) const; virtual bool operator <( const SCH_ITEM& aItem ) const;
/** /**
@ -343,6 +388,10 @@ private:
virtual bool doIsConnected( const wxPoint& aPosition ) const { return false; } virtual bool doIsConnected( const wxPoint& aPosition ) const { return false; }
virtual void doPlot( PLOTTER* aPlotter ); virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const = 0;
virtual void doSetPosition( const wxPoint& aPosition ) = 0;
}; };

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* @file wxEeschemaStruct.h * @file wxEeschemaStruct.h
*/ */
@ -339,6 +364,21 @@ public:
*/ */
bool DeleteItemAtCrossHair( wxDC* aDC ); bool DeleteItemAtCrossHair( wxDC* aDC );
/**
* Function FindComponentAndItem
* finds a Component in the schematic, and an item in this component.
* @param component_reference The component reference to find.
* @param text_to_find - The text to search for, either in value, reference
* or elsewhere.
* @param Find_in_hierarchy: false => Search is made in current sheet
* true => the whole hierarchy
* @param SearchType: 0 => find component
* 1 => find pin
* 2 => find ref
* 3 => find value
* >= 4 => unused (same as 0)
* @param mouseWarp If true, then move the mouse cursor to the item.
*/
SCH_ITEM* FindComponentAndItem( const wxString& component_reference, SCH_ITEM* FindComponentAndItem( const wxString& component_reference,
bool Find_in_hierarchy, bool Find_in_hierarchy,
int SearchType, int SearchType,
@ -589,7 +629,15 @@ private:
void OnFindDialogClose( wxFindDialogEvent& event ); void OnFindDialogClose( wxFindDialogEvent& event );
void OnFindDrcMarker( wxFindDialogEvent& event ); void OnFindDrcMarker( wxFindDialogEvent& event );
void OnFindCompnentInLib( wxFindDialogEvent& event ); void OnFindCompnentInLib( wxFindDialogEvent& event );
void OnFindSchematicItem( wxFindDialogEvent& event );
/**
* Function OnFindSchematicItem
* finds an item in the schematic matching the search criteria in \a aEvent.
*
* @param aEvent - Find dialog event containing the find parameters.
*/
void OnFindSchematicItem( wxFindDialogEvent& aEvent );
void OnLoadFile( wxCommandEvent& event ); void OnLoadFile( wxCommandEvent& event );
void OnLoadStuffFile( wxCommandEvent& event ); void OnLoadStuffFile( wxCommandEvent& event );
void OnNewProject( wxCommandEvent& event ); void OnNewProject( wxCommandEvent& event );
@ -603,7 +651,10 @@ private:
void OnSelectItem( wxCommandEvent& aEvent ); void OnSelectItem( wxCommandEvent& aEvent );
/* edition events functions */ /**
* Function OnCopySchematicItemRequest
* is the command event handler for duplicating the item at the current location.
*/
void OnCopySchematicItemRequest( wxCommandEvent& event ); void OnCopySchematicItemRequest( wxCommandEvent& event );
/* User interface update event handlers. */ /* User interface update event handlers. */
@ -623,7 +674,6 @@ private:
SCH_BUS_ENTRY* CreateBusEntry( wxDC* DC, int entry_type ); SCH_BUS_ENTRY* CreateBusEntry( wxDC* DC, int entry_type );
void SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int entry_type ); void SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int entry_type );
int GetBusEntryShape( SCH_BUS_ENTRY* BusEntry ); int GetBusEntryShape( SCH_BUS_ENTRY* BusEntry );
void StartMoveBusEntry( SCH_BUS_ENTRY* DrawLibItem, wxDC* DC );
/** /**
* Function AddNoConnect * Function AddNoConnect
@ -637,11 +687,19 @@ private:
// Junction // Junction
SCH_JUNCTION* AddJunction( wxDC* aDC, const wxPoint& aPosition, bool aPutInUndoList = FALSE ); SCH_JUNCTION* AddJunction( wxDC* aDC, const wxPoint& aPosition, bool aPutInUndoList = FALSE );
/**
* Function MoveItem
* start moving \a aItem using the mouse.
*
* @param aItem A pointer to an SCH_ITEM to move.
* @param aDC The device context to draw \a aItem.
*/
void MoveItem( SCH_ITEM* aItem, wxDC* aDC );
// Text, label, glabel // Text, label, glabel
SCH_TEXT* CreateNewText( wxDC* aDC, int aType ); SCH_TEXT* CreateNewText( wxDC* aDC, int aType );
void EditSchematicText( SCH_TEXT* TextStruct ); void EditSchematicText( SCH_TEXT* TextStruct );
void ChangeTextOrient( SCH_TEXT* aTextItem, wxDC* aDC ); void ChangeTextOrient( SCH_TEXT* aTextItem, wxDC* aDC );
void MoveText( SCH_TEXT* aTextItem, wxDC* aDC );
/** /**
* Function OnCovertTextType * Function OnCovertTextType
@ -773,7 +831,6 @@ private:
const wxString& libname, const wxString& libname,
wxArrayString& List, wxArrayString& List,
bool UseLibBrowser ); bool UseLibBrowser );
void StartMovePart( SCH_COMPONENT* DrawLibItem, wxDC* DC );
/** /**
* Function EditComponent * Function EditComponent