Minor fixes and lots of coding policy changes.

This commit is contained in:
Wayne Stambaugh 2010-12-08 15:12:46 -05:00
parent e6b2f3929f
commit c79077c9a2
160 changed files with 1456 additions and 1384 deletions

View File

@ -20,7 +20,7 @@ S3D_Vertex::S3D_Vertex()
S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) : S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) :
EDA_BaseStruct( father, NOT_USED ) EDA_ITEM( father, NOT_USED )
{ {
m_DiffuseColor.x = m_DiffuseColor.y = m_DiffuseColor.z = 1.0; m_DiffuseColor.x = m_DiffuseColor.y = m_DiffuseColor.z = 1.0;
m_SpecularColor.x = m_SpecularColor.y = m_SpecularColor.z = 1.0; m_SpecularColor.x = m_SpecularColor.y = m_SpecularColor.z = 1.0;
@ -57,8 +57,8 @@ void S3D_MASTER::Copy( S3D_MASTER* pattern )
} }
S3D_MASTER::S3D_MASTER( EDA_BaseStruct* aParent ) : S3D_MASTER::S3D_MASTER( EDA_ITEM* aParent ) :
EDA_BaseStruct( aParent, NOT_USED ) EDA_ITEM( aParent, NOT_USED )
{ {
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0; m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
m_3D_Drawings = NULL; m_3D_Drawings = NULL;
@ -85,8 +85,8 @@ S3D_MASTER:: ~S3D_MASTER()
} }
Struct3D_Shape::Struct3D_Shape( EDA_BaseStruct* aParent ) : Struct3D_Shape::Struct3D_Shape( EDA_ITEM* aParent ) :
EDA_BaseStruct( aParent, NOT_USED ) EDA_ITEM( aParent, NOT_USED )
{ {
m_3D_Coord = NULL; m_3D_Coord = NULL;
m_3D_CoordIndex = NULL; m_3D_CoordIndex = NULL;

View File

@ -320,10 +320,9 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
} }
/* draw graphic items */ /* draw graphic items */
EDA_BaseStruct* PtStruct; EDA_ITEM* PtStruct;
for( PtStruct = pcb->m_Drawings;
PtStruct != NULL; for( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
PtStruct = PtStruct->Next() )
{ {
switch( PtStruct->Type() ) switch( PtStruct->Type() )
{ {
@ -691,8 +690,9 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
if( !As3dShape ) if( !As3dShape )
{ {
// The footprint does not have a 3D shape, draw its 2D shape instead // The footprint does not have a 3D shape, draw its 2D shape instead
EDA_BaseStruct* Struct = m_Drawings; EDA_ITEM* Struct = m_Drawings;
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
for( ; Struct != NULL; Struct = Struct->Next() ) for( ; Struct != NULL; Struct = Struct->Next() )
{ {
switch( Struct->Type() ) switch( Struct->Type() )

View File

@ -34,7 +34,7 @@ public:
public: S3D_Vertex(); public: S3D_Vertex();
}; };
class S3D_MATERIAL : public EDA_BaseStruct /* openGL "material" data*/ class S3D_MATERIAL : public EDA_ITEM /* openGL "material" data*/
{ {
public: public:
wxString m_Name; wxString m_Name;
@ -55,7 +55,7 @@ public: S3D_MATERIAL( S3D_MASTER* father, const wxString& name );
/* Master structure for a 3D item description */ /* Master structure for a 3D item description */
class S3D_MASTER : public EDA_BaseStruct class S3D_MASTER : public EDA_ITEM
{ {
public: public:
wxString m_Shape3DName; /* 3D shape name in 3D library */ wxString m_Shape3DName; /* 3D shape name in 3D library */
@ -65,7 +65,7 @@ public:
Struct3D_Shape* m_3D_Drawings; Struct3D_Shape* m_3D_Drawings;
S3D_MATERIAL* m_Materials; S3D_MATERIAL* m_Materials;
public: S3D_MASTER( EDA_BaseStruct* aParent ); public: S3D_MASTER( EDA_ITEM* aParent );
~S3D_MASTER(); ~S3D_MASTER();
S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; } S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
@ -90,14 +90,14 @@ public: S3D_MASTER( EDA_BaseStruct* aParent );
/* Describes a complex 3D */ /* Describes a complex 3D */
class Struct3D_Shape : public EDA_BaseStruct class Struct3D_Shape : public EDA_ITEM
{ {
public: public:
S3D_Vertex* m_3D_Coord; S3D_Vertex* m_3D_Coord;
int* m_3D_CoordIndex; int* m_3D_CoordIndex;
int m_3D_Points; int m_3D_Points;
public: Struct3D_Shape( EDA_BaseStruct* aParent ); public: Struct3D_Shape( EDA_ITEM* aParent );
~Struct3D_Shape(); ~Struct3D_Shape();
Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; } Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; }

View File

@ -4,6 +4,19 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2010-dec-08 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++All
* Coding policy object naming and formating fixes.
++GerbView
* Fix compiler warnings.
++Common
* Change item list type from SCH_ITEM to EDA_BaseStruct in BASE_SCREEN
object.
* Encapsulate BASE_SCREEN drawing item list member.
* Change grid container from wxWidgets to standard C++ container.
2010-dec-07 UPDATE Wayne Stambaugh <stambaughw@verizon.net> 2010-dec-07 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================ ================================================================================
++EESchema ++EESchema

View File

@ -13,18 +13,15 @@
#include "class_base_screen.h" #include "class_base_screen.h"
#include "id.h" #include "id.h"
/* Implement wxSize array for grid list implementation. */
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY( GridArray )
BASE_SCREEN* ActiveScreen = NULL; BASE_SCREEN* ActiveScreen = NULL;
#define CURSOR_SIZE 12 /* size of the cross cursor. */ #define CURSOR_SIZE 12 /* size of the cross cursor. */
BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType ) BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_ITEM( aType )
{ {
EEDrawList = NULL; /* Schematic items list */ m_drawList = NULL; /* Draw items list */
m_UndoRedoCountMax = 10; /* undo/Redo command Max depth, 10 is a m_UndoRedoCountMax = 10; /* undo/Redo command Max depth, 10 is a
* reasonable value */ * reasonable value */
m_FirstRedraw = TRUE; m_FirstRedraw = TRUE;
@ -341,34 +338,41 @@ bool BASE_SCREEN::SetLastZoom()
} }
void BASE_SCREEN::SetGridList( GridArray& gridlist ) void BASE_SCREEN::SetGridList( GRIDS& gridlist )
{ {
if( !m_GridList.IsEmpty() ) if( !m_grids.empty() )
m_GridList.Clear(); m_grids.clear();
m_GridList = gridlist; m_grids = gridlist;
}
void BASE_SCREEN::GetGrids( GRIDS& aList )
{
for( size_t i = 0; i < m_grids.size(); i++ )
aList.push_back( m_grids[ i ] );
} }
void BASE_SCREEN::SetGrid( const wxRealPoint& size ) void BASE_SCREEN::SetGrid( const wxRealPoint& size )
{ {
wxASSERT( !m_GridList.IsEmpty() ); wxASSERT( !m_grids.empty() );
size_t i; size_t i;
GRID_TYPE nearest_grid = m_GridList[0]; GRID_TYPE nearest_grid = m_grids[0];
for( i = 0; i < m_GridList.GetCount(); i++ ) for( i = 0; i < m_grids.size(); i++ )
{ {
if( m_GridList[i].m_Size == size ) if( m_grids[i].m_Size == size )
{ {
m_Grid = m_GridList[i]; m_Grid = m_grids[i];
return; return;
} }
// keep trace of the nearest grill size, if the exact size is not found // keep trace of the nearest grill size, if the exact size is not found
if ( size.x < m_GridList[i].m_Size.x ) if ( size.x < m_grids[i].m_Size.x )
nearest_grid = m_GridList[i]; nearest_grid = m_grids[i];
} }
m_Grid = nearest_grid; m_Grid = nearest_grid;
@ -382,20 +386,20 @@ void BASE_SCREEN::SetGrid( const wxRealPoint& size )
/* Set grid size from command ID. */ /* Set grid size from command ID. */
void BASE_SCREEN::SetGrid( int id ) void BASE_SCREEN::SetGrid( int id )
{ {
wxASSERT( !m_GridList.IsEmpty() ); wxASSERT( !m_grids.empty() );
size_t i; size_t i;
for( i = 0; i < m_GridList.GetCount(); i++ ) for( i = 0; i < m_grids.size(); i++ )
{ {
if( m_GridList[i].m_Id == id ) if( m_grids[i].m_Id == id )
{ {
m_Grid = m_GridList[i]; m_Grid = m_grids[i];
return; return;
} }
} }
m_Grid = m_GridList[0]; m_Grid = m_grids[0];
wxLogWarning( wxT( "Grid ID %d not in grid list, falling back to " ) \ wxLogWarning( wxT( "Grid ID %d not in grid list, falling back to " ) \
wxT( "grid size( %g, %g )." ), id, m_Grid.m_Size.x, wxT( "grid size( %g, %g )." ), id, m_Grid.m_Size.x,
@ -407,29 +411,27 @@ void BASE_SCREEN::AddGrid( const GRID_TYPE& grid )
{ {
size_t i; size_t i;
for( i = 0; i < m_GridList.GetCount(); i++ ) for( i = 0; i < m_grids.size(); i++ )
{ {
if( m_GridList[i].m_Size == grid.m_Size if( m_grids[i].m_Size == grid.m_Size && grid.m_Id != ID_POPUP_GRID_USER )
&& grid.m_Id != ID_POPUP_GRID_USER )
{ {
wxLogDebug( wxT( "Discarding duplicate grid size( %g, %g )." ), wxLogDebug( wxT( "Discarding duplicate grid size( %g, %g )." ),
grid.m_Size.x, grid.m_Size.y ); grid.m_Size.x, grid.m_Size.y );
return; return;
} }
if( m_GridList[i].m_Id == grid.m_Id )
if( m_grids[i].m_Id == grid.m_Id )
{ {
wxLogDebug( wxT( "Changing grid ID %d from size( %g, %g ) to " ) \ wxLogDebug( wxT( "Changing grid ID %d from size( %g, %g ) to " ) \
wxT( "size( %g, %g )." ), wxT( "size( %g, %g )." ),
grid.m_Id, m_GridList[i].m_Size.x, grid.m_Id, m_grids[i].m_Size.x,
m_GridList[i].m_Size.y, grid.m_Size.x, grid.m_Size.y ); m_grids[i].m_Size.y, grid.m_Size.x, grid.m_Size.y );
m_GridList[i].m_Size = grid.m_Size; m_grids[i].m_Size = grid.m_Size;
return; return;
} }
} }
// wxLogDebug( wxT( "Adding grid ID %d size( %d, %d ) to grid list." ), grid.m_Id, grid.m_Size.x, grid.m_Size.y ); m_grids.push_back( grid );
m_GridList.Add( grid );
} }
@ -473,18 +475,27 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, UserUnitType aUnit, int id )
} }
GRID_TYPE& BASE_SCREEN::GetGrid( size_t aIndex )
{
wxCHECK_MSG( !m_grids.empty() && aIndex < m_grids.size(), m_Grid,
wxT( "Cannot get grid object outside the bounds of the grid list." ) );
return m_grids[ aIndex ];
}
GRID_TYPE BASE_SCREEN::GetGrid() GRID_TYPE BASE_SCREEN::GetGrid()
{ {
return m_Grid; return m_Grid;
} }
/*********************************/
const wxPoint& BASE_SCREEN::GetGridOrigin() const wxPoint& BASE_SCREEN::GetGridOrigin()
/*********************************/
{ {
return m_GridOrigin; return m_GridOrigin;
} }
wxRealPoint BASE_SCREEN::GetGridSize() wxRealPoint BASE_SCREEN::GetGridSize()
{ {
return m_Grid.m_Size; return m_Grid.m_Size;
@ -515,6 +526,7 @@ void BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aNewitem )
/* Delete the extra items, if count max reached */ /* Delete the extra items, if count max reached */
int extraitems = GetUndoCommandCount() - m_UndoRedoCountMax; int extraitems = GetUndoCommandCount() - m_UndoRedoCountMax;
if( extraitems > 0 ) // Delete the extra items if( extraitems > 0 ) // Delete the extra items
ClearUndoORRedoList( m_UndoList, extraitems ); ClearUndoORRedoList( m_UndoList, extraitems );
} }
@ -526,6 +538,7 @@ void BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aNewitem )
/* Delete the extra items, if count max reached */ /* Delete the extra items, if count max reached */
int extraitems = GetRedoCommandCount() - m_UndoRedoCountMax; int extraitems = GetRedoCommandCount() - m_UndoRedoCountMax;
if( extraitems > 0 ) // Delete the extra items if( extraitems > 0 ) // Delete the extra items
ClearUndoORRedoList( m_RedoList, extraitems ); ClearUndoORRedoList( m_RedoList, extraitems );
} }
@ -543,7 +556,7 @@ PICKED_ITEMS_LIST* BASE_SCREEN::PopCommandFromRedoList( )
} }
void BASE_SCREEN::AddItem( EDA_BaseStruct* aItem ) void BASE_SCREEN::AddItem( EDA_ITEM* aItem )
{ {
wxCHECK_RET( aItem != NULL, wxT( "Attempt to add NULL item pointer to " ) + GetClass() + wxCHECK_RET( aItem != NULL, wxT( "Attempt to add NULL item pointer to " ) + GetClass() +
wxT( "item list" ) ); wxT( "item list" ) );
@ -551,7 +564,7 @@ void BASE_SCREEN::AddItem( EDA_BaseStruct* aItem )
} }
void BASE_SCREEN::InsertItem( EDA_ITEMS::iterator aIter, EDA_BaseStruct* aItem ) void BASE_SCREEN::InsertItem( EDA_ITEMS::iterator aIter, EDA_ITEM* aItem )
{ {
wxCHECK_RET( aItem != NULL, wxT( "Attempt to insert NULL item pointer to " ) + GetClass() + wxCHECK_RET( aItem != NULL, wxT( "Attempt to insert NULL item pointer to " ) + GetClass() +
wxT( "item list" ) ); wxT( "item list" ) );
@ -569,11 +582,10 @@ void BASE_SCREEN::InsertItem( EDA_ITEMS::iterator aIter, EDA_BaseStruct* aItem )
*/ */
void BASE_SCREEN::Show( int nestLevel, std::ostream& os ) void BASE_SCREEN::Show( int nestLevel, std::ostream& os )
{ {
SCH_ITEM* item = EEDrawList; EDA_ITEM* item = m_drawList;
// for now, make it look like XML, expand on this later. // for now, make it look like XML, expand on this later.
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
">\n";
for( ; item; item = item->Next() ) for( ; item; item = item->Next() )
{ {

View File

@ -1,6 +1,6 @@
/****************************************/ /****************************************/
/* Basic classes for Kicad: */ /* Basic classes for Kicad: */
/* EDA_BaseStruct */ /* EDA_ITEM */
/* EDA_TextStruct */ /* EDA_TextStruct */
/****************************************/ /****************************************/
@ -20,7 +20,7 @@ enum textbox {
}; };
EDA_BaseStruct::EDA_BaseStruct( EDA_BaseStruct* parent, KICAD_T idType ) EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType )
{ {
InitVars(); InitVars();
m_StructType = idType; m_StructType = idType;
@ -28,14 +28,14 @@ EDA_BaseStruct::EDA_BaseStruct( EDA_BaseStruct* parent, KICAD_T idType )
} }
EDA_BaseStruct::EDA_BaseStruct( KICAD_T idType ) EDA_ITEM::EDA_ITEM( KICAD_T idType )
{ {
InitVars(); InitVars();
m_StructType = idType; m_StructType = idType;
} }
EDA_BaseStruct::EDA_BaseStruct( const EDA_BaseStruct& base ) EDA_ITEM::EDA_ITEM( const EDA_ITEM& base )
{ {
m_StructType = base.m_StructType; m_StructType = base.m_StructType;
m_Parent = base.m_Parent; m_Parent = base.m_Parent;
@ -47,7 +47,7 @@ EDA_BaseStruct::EDA_BaseStruct( const EDA_BaseStruct& base )
} }
void EDA_BaseStruct::InitVars() void EDA_ITEM::InitVars()
{ {
m_StructType = TYPE_NOT_INIT; m_StructType = TYPE_NOT_INIT;
Pnext = NULL; // Linked list: Link (next struct) Pnext = NULL; // Linked list: Link (next struct)
@ -63,7 +63,7 @@ void EDA_BaseStruct::InitVars()
} }
void EDA_BaseStruct::SetModified() void EDA_ITEM::SetModified()
{ {
m_Flags |= IS_CHANGED; m_Flags |= IS_CHANGED;
@ -74,12 +74,12 @@ void EDA_BaseStruct::SetModified()
// see base_struct.h // see base_struct.h
SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart, SEARCH_RESULT EDA_ITEM::IterateForward( EDA_ITEM* listStart,
INSPECTOR* inspector, INSPECTOR* inspector,
const void* testData, const void* testData,
const KICAD_T scanTypes[] ) const KICAD_T scanTypes[] )
{ {
EDA_BaseStruct* p = listStart; EDA_ITEM* p = listStart;
for( ; p; p = p->Pnext ) for( ; p; p = p->Pnext )
{ {
@ -93,7 +93,7 @@ SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart,
// see base_struct.h // see base_struct.h
// many classes inherit this method, be careful: // many classes inherit this method, be careful:
SEARCH_RESULT EDA_BaseStruct::Visit( INSPECTOR* inspector, const void* testData, SEARCH_RESULT EDA_ITEM::Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] ) const KICAD_T scanTypes[] )
{ {
KICAD_T stype; KICAD_T stype;
@ -143,7 +143,7 @@ std::ostream& operator<<( std::ostream& out, const wxPoint& pt )
* of nesting of this object within the overall tree. * of nesting of this object within the overall tree.
* @param os The ostream& to output to. * @param os The ostream& to output to.
*/ */
void EDA_BaseStruct::Show( int nestLevel, std::ostream& os ) void EDA_ITEM::Show( int nestLevel, std::ostream& os )
{ {
// XML output: // XML output:
wxString s = GetClass(); wxString s = GetClass();
@ -161,7 +161,7 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
* @param os The ostream&, where to output * @param os The ostream&, where to output
* @return std::ostream& - for continuation. * @return std::ostream& - for continuation.
**/ **/
std::ostream& EDA_BaseStruct::NestedSpace( int nestLevel, std::ostream& os ) std::ostream& EDA_ITEM::NestedSpace( int nestLevel, std::ostream& os )
{ {
for( int i = 0; i<nestLevel; ++i ) for( int i = 0; i<nestLevel; ++i )
os << " "; os << " ";

View File

@ -16,7 +16,7 @@
BLOCK_SELECTOR::BLOCK_SELECTOR() : BLOCK_SELECTOR::BLOCK_SELECTOR() :
EDA_BaseStruct( BLOCK_LOCATE_STRUCT_TYPE ), EDA_ITEM( BLOCK_LOCATE_STRUCT_TYPE ),
EDA_Rect() EDA_Rect()
{ {
m_State = STATE_NO_BLOCK; /* State (enum BlockState) of block. */ m_State = STATE_NO_BLOCK; /* State (enum BlockState) of block. */
@ -133,7 +133,7 @@ void BLOCK_SELECTOR::InitData( WinEDA_DrawPanel* aPanel,
/** /**
* Function ClearItemsList * Function ClearItemsList
* delete only the list of EDA_BaseStruct * pointers, NOT the pointed data * delete only the list of EDA_ITEM * pointers, NOT the pointed data
* itself * itself
*/ */
void BLOCK_SELECTOR::ClearItemsList() void BLOCK_SELECTOR::ClearItemsList()
@ -143,7 +143,7 @@ void BLOCK_SELECTOR::ClearItemsList()
/** /**
* Function ClearListAndDeleteItems * Function ClearListAndDeleteItems
* delete only the list of EDA_BaseStruct * pointers, AND the data pinted * delete only the list of EDA_ITEM * pointers, AND the data pinted
* by m_Item * by m_Item
*/ */
void BLOCK_SELECTOR::ClearListAndDeleteItems() void BLOCK_SELECTOR::ClearListAndDeleteItems()

View File

@ -31,7 +31,7 @@
#include "class_undoredo_container.h" #include "class_undoredo_container.h"
ITEM_PICKER::ITEM_PICKER( EDA_BaseStruct* aItem, UndoRedoOpType aUndoRedoStatus ) ITEM_PICKER::ITEM_PICKER( EDA_ITEM* aItem, UndoRedoOpType aUndoRedoStatus )
{ {
m_UndoRedoStatus = aUndoRedoStatus; m_UndoRedoStatus = aUndoRedoStatus;
m_PickedItem = aItem; m_PickedItem = aItem;
@ -115,11 +115,12 @@ void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
{ {
// Specific to eeschema: a linked list of wires is stored. // Specific to eeschema: a linked list of wires is stored.
// the wrapper picks only the first item (head of list), and is owner of all picked items // the wrapper picks only the first item (head of list), and is owner of all picked items
EDA_BaseStruct* item = wrapper.m_PickedItem; EDA_ITEM* item = wrapper.m_PickedItem;
while( item ) while( item )
{ {
// Delete old copy of wires // Delete old copy of wires
EDA_BaseStruct* nextitem = item->Next(); EDA_ITEM* nextitem = item->Next();
delete item; delete item;
item = nextitem; item = nextitem;
} }
@ -186,7 +187,7 @@ ITEM_PICKER PICKED_ITEMS_LIST::GetItemWrapper( unsigned int aIdx )
* @return a pointer to the picked item, or null if does not exist * @return a pointer to the picked item, or null if does not exist
* @param aIdx = index of the picked item in the picked list * @param aIdx = index of the picked item in the picked list
*/ */
EDA_BaseStruct* PICKED_ITEMS_LIST::GetPickedItem( unsigned int aIdx ) EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItem( unsigned int aIdx )
{ {
if( aIdx < m_ItemsList.size() ) if( aIdx < m_ItemsList.size() )
return m_ItemsList[aIdx].m_PickedItem; return m_ItemsList[aIdx].m_PickedItem;
@ -200,7 +201,7 @@ EDA_BaseStruct* PICKED_ITEMS_LIST::GetPickedItem( unsigned int aIdx )
* @return link of the picked item, or null if does not exist * @return link of the picked item, or null if does not exist
* @param aIdx = index of the picked item in the picked list * @param aIdx = index of the picked item in the picked list
*/ */
EDA_BaseStruct* PICKED_ITEMS_LIST::GetPickedItemLink( unsigned int aIdx ) EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItemLink( unsigned int aIdx )
{ {
if( aIdx < m_ItemsList.size() ) if( aIdx < m_ItemsList.size() )
return m_ItemsList[aIdx].m_Link; return m_ItemsList[aIdx].m_Link;
@ -243,7 +244,7 @@ int PICKED_ITEMS_LIST::GetPickerFlags( unsigned aIdx )
* @param aIdx = index of the picker in the picked list * @param aIdx = index of the picker in the picked list
* @return true if the picker exists, or false if does not exist * @return true if the picker exists, or false if does not exist
*/ */
bool PICKED_ITEMS_LIST::SetPickedItem( EDA_BaseStruct* aItem, unsigned aIdx ) bool PICKED_ITEMS_LIST::SetPickedItem( EDA_ITEM* aItem, unsigned aIdx )
{ {
if( aIdx < m_ItemsList.size() ) if( aIdx < m_ItemsList.size() )
{ {
@ -262,7 +263,7 @@ bool PICKED_ITEMS_LIST::SetPickedItem( EDA_BaseStruct* aItem, unsigned aIdx )
* @param aIdx = index of the picker in the picked list * @param aIdx = index of the picker in the picked list
* @return true if the picker exists, or false if does not exist * @return true if the picker exists, or false if does not exist
*/ */
bool PICKED_ITEMS_LIST::SetPickedItemLink( EDA_BaseStruct* aLink, unsigned aIdx ) bool PICKED_ITEMS_LIST::SetPickedItemLink( EDA_ITEM* aLink, unsigned aIdx )
{ {
if( aIdx < m_ItemsList.size() ) if( aIdx < m_ItemsList.size() )
{ {
@ -281,9 +282,7 @@ bool PICKED_ITEMS_LIST::SetPickedItemLink( EDA_BaseStruct* aLink, unsigned aIdx
* @param aIdx = index of the picker in the picked list * @param aIdx = index of the picker in the picked list
* @return true if the picker exists, or false if does not exist * @return true if the picker exists, or false if does not exist
*/ */
bool PICKED_ITEMS_LIST::SetPickedItem( EDA_BaseStruct* aItem, bool PICKED_ITEMS_LIST::SetPickedItem( EDA_ITEM* aItem, UndoRedoOpType aStatus, unsigned aIdx )
UndoRedoOpType aStatus,
unsigned aIdx )
{ {
if( aIdx < m_ItemsList.size() ) if( aIdx < m_ItemsList.size() )
{ {

View File

@ -40,8 +40,8 @@ DHEAD::~DHEAD()
void DHEAD::DeleteAll() void DHEAD::DeleteAll()
{ {
EDA_BaseStruct* next; EDA_ITEM* next;
EDA_BaseStruct* item = first; EDA_ITEM* item = first;
while( item ) while( item )
{ {
@ -56,7 +56,7 @@ void DHEAD::DeleteAll()
} }
void DHEAD::append( EDA_BaseStruct* aNewElement ) void DHEAD::append( EDA_ITEM* aNewElement )
{ {
wxASSERT( aNewElement != NULL ); wxASSERT( aNewElement != NULL );
@ -85,7 +85,7 @@ void DHEAD::append( EDA_BaseStruct* aNewElement )
} }
void DHEAD::insert( EDA_BaseStruct* aNewElement, EDA_BaseStruct* aAfterMe ) void DHEAD::insert( EDA_ITEM* aNewElement, EDA_ITEM* aAfterMe )
{ {
wxASSERT( aNewElement != NULL ); wxASSERT( aNewElement != NULL );
@ -109,7 +109,7 @@ void DHEAD::insert( EDA_BaseStruct* aNewElement, EDA_BaseStruct* aAfterMe )
} }
else else
{ {
EDA_BaseStruct* oldBack = aAfterMe->Back(); EDA_ITEM* oldBack = aAfterMe->Back();
aAfterMe->SetBack( aNewElement ); aAfterMe->SetBack( aNewElement );
@ -126,7 +126,7 @@ void DHEAD::insert( EDA_BaseStruct* aNewElement, EDA_BaseStruct* aAfterMe )
} }
void DHEAD::remove( EDA_BaseStruct* aElement ) void DHEAD::remove( EDA_ITEM* aElement )
{ {
wxASSERT( aElement ); wxASSERT( aElement );
wxASSERT( aElement->GetList() == this ); wxASSERT( aElement->GetList() == this );
@ -162,7 +162,7 @@ void DHEAD::remove( EDA_BaseStruct* aElement )
void DHEAD::VerifyListIntegrity() void DHEAD::VerifyListIntegrity()
{ {
EDA_BaseStruct* item; EDA_ITEM* item;
unsigned i = 0; unsigned i = 0;
for( item = first; item && i<count; ++i, item = item->Next() ) for( item = first; item && i<count; ++i, item = item->Next() )

View File

@ -174,8 +174,7 @@ void WinEDA_DrawFrame::ReCreateMenuBar()
// Virtual function // Virtual function
void WinEDA_DrawFrame::OnHotKey( wxDC* DC, int hotkey, void WinEDA_DrawFrame::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
EDA_BaseStruct* DrawStruct )
{ {
} }
@ -192,9 +191,8 @@ void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event )
* because WinEDA_DrawFrame does not know how to print a page * because WinEDA_DrawFrame does not know how to print a page
* This is the reason it is a virtual function * This is the reason it is a virtual function
*/ */
void WinEDA_DrawFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, void WinEDA_DrawFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,int aPrintMask,
int aPrintMask, bool aPrintMirrorMode, bool aPrintMirrorMode, void* aData )
void * aData)
{ {
wxMessageBox( wxT("WinEDA_DrawFrame::PrintPage() error")); wxMessageBox( wxT("WinEDA_DrawFrame::PrintPage() error"));
} }

View File

@ -22,8 +22,8 @@
* in debug mode * in debug mode
*/ */
SCH_ITEM::SCH_ITEM( EDA_BaseStruct* aParent, KICAD_T aType ) : SCH_ITEM::SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType ) :
EDA_BaseStruct( aParent, aType ) EDA_ITEM( aParent, aType )
{ {
m_Layer = 0; m_Layer = 0;
} }
@ -40,18 +40,20 @@ SCH_ITEM::~SCH_ITEM()
/** /**
* place the struct in EEDrawList. * place the struct in m_drawList.
* if it is a new item, it it also put in undo list * 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 editiing, * for an "old" item, saving it in undo list must be done before editiing,
* and not here! * and not here!
*/ */
void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) void SCH_ITEM::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{ {
if( m_Flags & IS_NEW ) if( m_Flags & IS_NEW )
{ {
SCH_SCREEN* screen = frame->GetScreen(); SCH_SCREEN* screen = frame->GetScreen();
if( !screen->CheckIfOnDrawList( this ) ) //don't want a loop! if( !screen->CheckIfOnDrawList( this ) ) //don't want a loop!
screen->AddToDrawList( this ); screen->AddToDrawList( this );
g_ItemToRepeat = this; g_ItemToRepeat = this;
frame->SaveCopyInUndoList( this, UR_NEW ); frame->SaveCopyInUndoList( this, UR_NEW );
} }

View File

@ -228,19 +228,18 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu )
} }
/* Create grid submenu as required. */ /* Create grid submenu as required. */
if( !screen->m_GridList.IsEmpty() ) if( screen->GetGridCount() )
{ {
wxMenu* gridMenu = new wxMenu; wxMenu* gridMenu = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( MasterMenu, gridMenu, ADD_MENUITEM_WITH_SUBMENU( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT,
ID_POPUP_GRID_SELECT, _( "Grid Select" ), _( "Grid Select" ), grid_select_xpm );
grid_select_xpm );
GRID_TYPE tmp; GRID_TYPE tmp;
wxRealPoint grid = screen->GetGridSize(); wxRealPoint grid = screen->GetGridSize();
for( unsigned i = 0; i < screen->m_GridList.GetCount(); i++ ) for( size_t i = 0; i < screen->GetGridCount(); i++ )
{ {
tmp = screen->m_GridList[i]; tmp = screen->GetGrid( i );
double gridValueInch = To_User_Unit( INCHES, tmp.m_Size.x, m_InternalUnits ); double gridValueInch = To_User_Unit( INCHES, tmp.m_Size.x, m_InternalUnits );
double gridValue_mm = To_User_Unit( MILLIMETRES, tmp.m_Size.x, m_InternalUnits ); double gridValue_mm = To_User_Unit( MILLIMETRES, tmp.m_Size.x, m_InternalUnits );
@ -267,7 +266,9 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu )
break; break;
} }
} }
gridMenu->Append( tmp.m_Id, msg, wxEmptyString, true ); gridMenu->Append( tmp.m_Id, msg, wxEmptyString, true );
if( grid == tmp.m_Size ) if( grid == tmp.m_Size )
gridMenu->Check( tmp.m_Id, true ); gridMenu->Check( tmp.m_Id, true );
} }

View File

@ -35,7 +35,7 @@ static int ReplaceDuplicatedTimeStamps();
/* Set a sheet number, the sheet count for sheets in the whole schematic /* Set a sheet number, the sheet count for sheets in the whole schematic
* and update the date in all screens * and update the date in all screens
*/ */
void WinEDA_SchematicFrame::UpdateSheetNumberAndDate() void SCH_EDIT_FRAME::UpdateSheetNumberAndDate()
{ {
wxString date = GenDate(); wxString date = GenDate();
SCH_SCREENS s_list; SCH_SCREENS s_list;
@ -69,11 +69,13 @@ void ReAnnotatePowerSymbolsOnly( void )
for( sheet = SheetList.GetFirst(); sheet != NULL; for( sheet = SheetList.GetFirst(); sheet != NULL;
sheet = SheetList.GetNext() ) sheet = SheetList.GetNext() )
{ {
EDA_BaseStruct* DrawList = sheet->LastDrawList(); EDA_ITEM* DrawList = sheet->LastDrawList();
for( ; DrawList != NULL; DrawList = DrawList->Next() ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
if( DrawList->Type() != TYPE_SCH_COMPONENT ) if( DrawList->Type() != TYPE_SCH_COMPONENT )
continue; continue;
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) DrawList; SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) DrawList;
LIB_COMPONENT* Entry = LIB_COMPONENT* Entry =
CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName ); CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
@ -204,8 +206,7 @@ static bool SortByTimeStamp( const OBJ_CMP_TO_LIST& item1,
* annotation relative to the current sheet only * annotation relative to the current sheet only
* @param aRedraw : true to refresh display * @param aRedraw : true to refresh display
*/ */
void WinEDA_SchematicFrame::DeleteAnnotation( bool aCurrentSheetOnly, void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw )
bool aRedraw )
{ {
SCH_ITEM* strct; SCH_ITEM* strct;
SCH_SCREEN* screen; SCH_SCREEN* screen;
@ -218,9 +219,11 @@ void WinEDA_SchematicFrame::DeleteAnnotation( bool aCurrentSheetOnly,
if( screen == NULL ) if( screen == NULL )
return; return;
while( screen ) while( screen )
{ {
strct = screen->EEDrawList; strct = screen->GetDrawItems();
for( ; strct; strct = strct->Next() ) for( ; strct; strct = strct->Next() )
{ {
if( strct->Type() == TYPE_SCH_COMPONENT ) if( strct->Type() == TYPE_SCH_COMPONENT )
@ -267,7 +270,7 @@ void WinEDA_SchematicFrame::DeleteAnnotation( bool aCurrentSheetOnly,
* stamps are used to handle annotation mainly in complex * stamps are used to handle annotation mainly in complex
* hierarchies. * hierarchies.
*/ */
void AnnotateComponents( WinEDA_SchematicFrame* parent, void AnnotateComponents( SCH_EDIT_FRAME* parent,
bool annotateSchematic, bool annotateSchematic,
int sortOption, int sortOption,
bool resetAnnotation, bool resetAnnotation,
@ -359,7 +362,7 @@ int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList,
SCH_SHEET_PATH* aSheet ) SCH_SHEET_PATH* aSheet )
{ {
int NbrCmp = 0; int NbrCmp = 0;
EDA_BaseStruct* DrawList = aSheet->LastDrawList(); EDA_ITEM* DrawList = aSheet->LastDrawList();
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
@ -368,8 +371,8 @@ int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList,
if( DrawList->Type() == TYPE_SCH_COMPONENT ) if( DrawList->Type() == TYPE_SCH_COMPONENT )
{ {
DrawLibItem = (SCH_COMPONENT*) DrawList; DrawLibItem = (SCH_COMPONENT*) DrawList;
Entry = Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
if( Entry == NULL ) if( Entry == NULL )
continue; continue;
@ -707,8 +710,7 @@ static int ExistUnit( int aObjet, int Unit,
* false = search in whole hierarchy (usual search). * false = search in whole hierarchy (usual search).
* @return errors count * @return errors count
*/ */
int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOnly )
bool aOneSheetOnly )
{ {
int error; int error;
wxString Buff; wxString Buff;
@ -1005,10 +1007,11 @@ int ReplaceDuplicatedTimeStamps()
std::vector <SCH_ITEM*> itemlist; std::vector <SCH_ITEM*> itemlist;
SCH_SCREEN* screen; SCH_SCREEN* screen;
SCH_ITEM* item; SCH_ITEM* item;
for( screen = ScreenList.GetFirst(); screen != NULL;
screen = ScreenList.GetNext() ) for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{ {
item = screen->EEDrawList; item = screen->GetDrawItems();
while( item ) while( item )
{ {
if( ( item->Type() == DRAW_SHEET_STRUCT_TYPE ) if( ( item->Type() == DRAW_SHEET_STRUCT_TYPE )

View File

@ -32,8 +32,7 @@
* the search is not stopped when a reference is found (all instances must be * the search is not stopped when a reference is found (all instances must be
* found). * found).
*/ */
bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent( bool SCH_EDIT_FRAME::FillFootprintFieldForAllInstancesofComponent( const wxString& aReference,
const wxString& aReference,
const wxString& aFootPrint, const wxString& aFootPrint,
bool aSetVisible ) bool aSetVisible )
{ {
@ -101,8 +100,7 @@ bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
* visible * visible
* @return true if OK. * @return true if OK.
*/ */
bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool bool SCH_EDIT_FRAME::ProcessStuffFile( FILE* aStuffFile, bool aSetFielsAttributeToVisible )
aSetFielsAttributeToVisible )
{ {
int LineNum = 0; int LineNum = 0;
char* cp, Ref[256], FootPrint[256], Line[1024]; char* cp, Ref[256], FootPrint[256], Line[1024];
@ -134,7 +132,7 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool
/* Backann footprint info to schematic. /* Backann footprint info to schematic.
*/ */
bool WinEDA_SchematicFrame::ReadInputStuffFile() bool SCH_EDIT_FRAME::ReadInputStuffFile()
{ {
wxString Line, filename; wxString Line, filename;
FILE* StuffFile; FILE* StuffFile;

View File

@ -47,7 +47,7 @@ static void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList );
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to /* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
* the key (ALT, SHIFT ALT ..) * the key (ALT, SHIFT ALT ..)
*/ */
int WinEDA_SchematicFrame::ReturnBlockCommand( int key ) int SCH_EDIT_FRAME::ReturnBlockCommand( int key )
{ {
int cmd; int cmd;
@ -85,7 +85,7 @@ int WinEDA_SchematicFrame::ReturnBlockCommand( int key )
/* Init the parameters used by the block paste command /* Init the parameters used by the block paste command
*/ */
void WinEDA_SchematicFrame::InitBlockPasteInfos() void SCH_EDIT_FRAME::InitBlockPasteInfos()
{ {
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
@ -99,7 +99,7 @@ void WinEDA_SchematicFrame::InitBlockPasteInfos()
* - block move & drag * - block move & drag
* - block copy & paste * - block copy & paste
*/ */
void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
{ {
bool err = false; bool err = false;
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
@ -181,7 +181,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
block->m_Command = BLOCK_IDLE; block->m_Command = BLOCK_IDLE;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->GetDrawItems(), DC );
if( block->GetCount() ) if( block->GetCount() )
{ {
@ -204,7 +204,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
* @return false if no item selected, or command finished, * @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later * true if some items found and HandleBlockPlace must be called later
*/ */
bool WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{ {
bool nextcmd = false; bool nextcmd = false;
bool zoom_command = false; bool zoom_command = false;
@ -269,7 +269,7 @@ bool WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
OnModify(); OnModify();
} }
block->ClearItemsList(); block->ClearItemsList();
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->GetDrawItems(), DC );
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
@ -334,7 +334,7 @@ bool WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
* a mirror/rotate command is immediatly executed and multible block commands * a mirror/rotate command is immediatly executed and multible block commands
* are not allowed (multiple commands are tricky to undo/redo in one time) * are not allowed (multiple commands are tricky to undo/redo in one time)
*/ */
void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
{ {
bool blockCmdFinished = true; /* set to false for block command which bool blockCmdFinished = true; /* set to false for block command which
* have a next step * have a next step
@ -386,7 +386,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
DeleteItemsInList( DrawPanel, block->m_ItemsSelection ); DeleteItemsInList( DrawPanel, block->m_ItemsSelection );
OnModify(); OnModify();
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->GetDrawItems(), DC );
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
@ -421,7 +421,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
RotateListOfItems( block->m_ItemsSelection, rotationPoint ); RotateListOfItems( block->m_ItemsSelection, rotationPoint );
OnModify(); OnModify();
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->GetDrawItems(), DC );
DrawPanel->Refresh(); DrawPanel->Refresh();
// block->m_State = STATE_BLOCK_MOVE; // block->m_State = STATE_BLOCK_MOVE;
// block->m_Command = BLOCK_MOVE; //allows multiple rotate // block->m_Command = BLOCK_MOVE; //allows multiple rotate
@ -442,7 +442,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
// block->m_State = STATE_BLOCK_MOVE; // block->m_State = STATE_BLOCK_MOVE;
// block->m_Command = BLOCK_MOVE; //allows multiple mirrors // block->m_Command = BLOCK_MOVE; //allows multiple mirrors
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->GetDrawItems(), DC );
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
@ -461,7 +461,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
// block->m_State = STATE_BLOCK_MOVE; // block->m_State = STATE_BLOCK_MOVE;
// block->m_Command = BLOCK_MOVE; //allows multiple mirrors // block->m_Command = BLOCK_MOVE; //allows multiple mirrors
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC );
TestDanglingEnds( GetScreen()->GetDrawItems(), DC );
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
@ -489,7 +490,6 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
BLOCK_SELECTOR* block = &panel->GetScreen()->m_BlockLocate;; BLOCK_SELECTOR* block = &panel->GetScreen()->m_BlockLocate;;
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
SCH_ITEM* schitem; SCH_ITEM* schitem;
@ -497,6 +497,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool era
if( erase ) if( erase )
{ {
block->Draw( panel, DC, block->m_MoveVector, g_XorMode, block->m_Color ); block->Draw( panel, DC, block->m_MoveVector, g_XorMode, block->m_Color );
for( unsigned ii = 0; ii < block->GetCount(); ii++ ) for( unsigned ii = 0; ii < block->GetCount(); ii++ )
{ {
schitem = (SCH_ITEM*) block->m_ItemsSelection.GetPickedItem( ii ); schitem = (SCH_ITEM*) block->m_ItemsSelection.GetPickedItem( ii );
@ -548,7 +549,7 @@ void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList )
* Routine to paste a structure from the g_BlockSaveDataList stack. * Routine to paste a structure from the g_BlockSaveDataList stack.
* This routine is the same as undelete but original list is NOT removed. * This routine is the same as undelete but original list is NOT removed.
*****************************************************************************/ *****************************************************************************/
void WinEDA_SchematicFrame::PasteListOfItems( wxDC* DC ) void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
{ {
SCH_ITEM* Struct; SCH_ITEM* Struct;
@ -577,8 +578,8 @@ void WinEDA_SchematicFrame::PasteListOfItems( wxDC* DC )
} }
SetaParent( Struct, GetScreen() ); SetaParent( Struct, GetScreen() );
RedrawOneStruct( DrawPanel, DC, Struct, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, Struct, GR_DEFAULT_DRAWMODE );
Struct->SetNext( GetScreen()->EEDrawList ); Struct->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->EEDrawList = Struct; GetScreen()->SetDrawItems( Struct );
} }
SaveCopyInUndoList( picklist, UR_NEW ); SaveCopyInUndoList( picklist, UR_NEW );
@ -738,7 +739,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
/* Review the list of elements not selected. */ /* Review the list of elements not selected. */
ITEM_PICKER picker; ITEM_PICKER picker;
Struct = screen->EEDrawList; Struct = (SCH_ITEM*) screen->GetDrawItems();
while( Struct ) while( Struct )
{ {
picker.m_PickedItem = Struct; picker.m_PickedItem = Struct;

View File

@ -41,7 +41,7 @@ void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() ) for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() )
{ {
for( EDA_BaseStruct* schItem = path->LastDrawList(); schItem; schItem = schItem->Next() ) for( EDA_ITEM* schItem = path->LastDrawList(); schItem; schItem = schItem->Next() )
{ {
if( schItem->Type() != TYPE_SCH_COMPONENT ) if( schItem->Type() != TYPE_SCH_COMPONENT )
continue; continue;

View File

@ -24,24 +24,23 @@
static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
bool erase ); bool erase );
static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC ); static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC );
static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ); static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer );
static bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos ); static bool IsJunctionNeeded( SCH_EDIT_FRAME* frame, wxPoint& pos );
static void ComputeBreakPoint( SCH_LINE* segment, const wxPoint& new_pos ); static void ComputeBreakPoint( SCH_LINE* segment, const wxPoint& new_pos );
SCH_ITEM* s_OldWiresList; SCH_ITEM* s_OldWiresList;
wxPoint s_ConnexionStartPoint; wxPoint s_ConnexionStartPoint;
/* Replace the wires in screen->EEDrawList by s_OldWiresList wires. /* Replace the wires in screen->GetDrawItems() by s_OldWiresList wires.
*/ */
static void RestoreOldWires( SCH_SCREEN* screen ) static void RestoreOldWires( SCH_SCREEN* screen )
{ {
SCH_ITEM* item; SCH_ITEM* item;
SCH_ITEM* next_item; SCH_ITEM* next_item;
for( item = screen->EEDrawList; item != NULL; item = next_item ) for( item = screen->GetDrawItems(); item != NULL; item = next_item )
{ {
next_item = item->Next(); next_item = item->Next();
@ -62,13 +61,59 @@ static void RestoreOldWires( SCH_SCREEN* screen )
{ {
next_item = s_OldWiresList->Next(); next_item = s_OldWiresList->Next();
s_OldWiresList->SetNext( screen->EEDrawList ); s_OldWiresList->SetNext( screen->GetDrawItems() );
screen->EEDrawList = s_OldWiresList; screen->SetDrawItems( s_OldWiresList );
s_OldWiresList = next_item; s_OldWiresList = next_item;
} }
} }
/**
* Mouse capture callback for drawing line segments.
*/
static void DrawSegment( WinEDA_DrawPanel* aPanel, wxDC* aDC, bool aErase )
{
SCH_LINE* CurrentLine = (SCH_LINE*) aPanel->GetScreen()->GetCurItem();
SCH_LINE* segment;
int color;
if( CurrentLine == NULL )
return;
color = ReturnLayerColor( CurrentLine->GetLayer() ) ^ HIGHLIGHT_FLAG;
if( aErase )
{
segment = CurrentLine;
while( segment )
{
if( !segment->IsNull() ) // Redraw if segment length != 0
RedrawOneStruct( aPanel, aDC, segment, g_XorMode, color );
segment = segment->Next();
}
}
wxPoint endpos = aPanel->GetScreen()->m_Curseur;
if( g_HVLines ) /* Coerce the line to vertical or horizontal one: */
ComputeBreakPoint( CurrentLine, endpos );
else
CurrentLine->m_End = endpos;
segment = CurrentLine;
while( segment )
{
if( !segment->IsNull() ) // Redraw if segment length != 0
RedrawOneStruct( aPanel, aDC, segment, g_XorMode, color );
segment = segment->Next();
}
}
/* Creates a new segment ( WIRE, BUS ), /* Creates a new segment ( WIRE, BUS ),
* or terminates the current segment * or terminates the current segment
* If the end of the current segment is on an other segment, place a junction * If the end of the current segment is on an other segment, place a junction
@ -76,7 +121,7 @@ static void RestoreOldWires( SCH_SCREEN* screen )
* If the end of the current segment is on a pin, terminates the command * If the end of the current segment is on a pin, terminates the command
* In others cases starts a new segment * In others cases starts a new segment
*/ */
void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
{ {
SCH_LINE* oldsegment, * newsegment, * nextsegment; SCH_LINE* oldsegment, * newsegment, * nextsegment;
wxPoint cursorpos = GetScreen()->m_Curseur; wxPoint cursorpos = GetScreen()->m_Curseur;
@ -124,26 +169,27 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
} }
newsegment->m_Flags = IS_NEW; newsegment->m_Flags = IS_NEW;
if( g_HVLines ) // We need 2 segments to go from a given start pin to
// an end point if( g_HVLines ) // We need 2 segments to go from a given start pin to an end point
{ {
nextsegment = newsegment->GenCopy(); nextsegment = newsegment->GenCopy();
nextsegment->m_Flags = IS_NEW; nextsegment->m_Flags = IS_NEW;
newsegment->SetNext( nextsegment ); newsegment->SetNext( nextsegment );
nextsegment->SetBack( newsegment ); nextsegment->SetBack( newsegment );
} }
GetScreen()->SetCurItem( newsegment ); GetScreen()->SetCurItem( newsegment );
DrawPanel->ManageCurseur = Segment_in_Ghost; DrawPanel->ManageCurseur = DrawSegment;
DrawPanel->ForceCloseManageCurseur = AbortCreateNewLine; DrawPanel->ForceCloseManageCurseur = AbortCreateNewLine;
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
} }
else /* A segment is in progress: terminates the current segment and add else // A segment is in progress: terminates the current segment and add a new segment.
* a new segment */
{ {
nextsegment = oldsegment->Next(); nextsegment = oldsegment->Next();
if( !g_HVLines ) /* if only one segment is needed and the current is
* has len = 0, do not create a new one */ if( !g_HVLines )
{ {
// if only one segment is needed and it has length = 0, do not create a new one.
if( oldsegment->IsNull() ) if( oldsegment->IsNull() )
return; return;
} }
@ -161,11 +207,12 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
* if the end point is on a pin, junction or an other wire or bus */ * if the end point is on a pin, junction or an other wire or bus */
if( IsTerminalPoint( GetScreen(), cursorpos, oldsegment->GetLayer() ) ) if( IsTerminalPoint( GetScreen(), cursorpos, oldsegment->GetLayer() ) )
{ {
EndSegment( DC ); return; EndSegment( DC );
return;
} }
oldsegment->SetNext( GetScreen()->EEDrawList ); oldsegment->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->EEDrawList = oldsegment; GetScreen()->SetDrawItems( oldsegment );
DrawPanel->CursorOff( DC ); // Erase schematic cursor DrawPanel->CursorOff( DC ); // Erase schematic cursor
RedrawOneStruct( DrawPanel, DC, oldsegment, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, oldsegment, GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // Display schematic cursor DrawPanel->CursorOn( DC ); // Display schematic cursor
@ -185,6 +232,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
newsegment = oldsegment->GenCopy(); newsegment = oldsegment->GenCopy();
newsegment->m_Start = oldsegment->m_End; newsegment->m_Start = oldsegment->m_End;
} }
newsegment->m_End = cursorpos; newsegment->m_End = cursorpos;
oldsegment->m_Flags = SELECTED; oldsegment->m_Flags = SELECTED;
newsegment->m_Flags = IS_NEW; newsegment->m_Flags = IS_NEW;
@ -206,7 +254,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
/* Called to terminate a bus, wire, or line creation /* Called to terminate a bus, wire, or line creation
*/ */
void WinEDA_SchematicFrame::EndSegment( wxDC* DC ) void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
{ {
SCH_LINE* firstsegment = (SCH_LINE*) GetScreen()->GetCurItem(); SCH_LINE* firstsegment = (SCH_LINE*) GetScreen()->GetCurItem();
SCH_LINE* lastsegment = firstsegment; SCH_LINE* lastsegment = firstsegment;
@ -214,36 +262,45 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
if( firstsegment == NULL ) if( firstsegment == NULL )
return; return;
if( ( firstsegment->m_Flags & IS_NEW ) == 0 ) if( ( firstsegment->m_Flags & IS_NEW ) == 0 )
return; return;
/* Delete Null segments and Put line it in Drawlist */ /* Delete Null segments and Put line it in Drawlist */
lastsegment = firstsegment; lastsegment = firstsegment;
while( lastsegment ) while( lastsegment )
{ {
SCH_LINE* nextsegment = lastsegment->Next(); SCH_LINE* nextsegment = lastsegment->Next();
if( lastsegment->IsNull() ) if( lastsegment->IsNull() )
{ {
SCH_LINE* previous_segment = lastsegment->Back(); SCH_LINE* previous_segment = lastsegment->Back();
if( firstsegment == lastsegment ) if( firstsegment == lastsegment )
firstsegment = nextsegment; firstsegment = nextsegment;
if( nextsegment ) if( nextsegment )
nextsegment->SetBack( NULL ); nextsegment->SetBack( NULL );
if( previous_segment ) if( previous_segment )
previous_segment->SetNext( nextsegment ); previous_segment->SetNext( nextsegment );
delete lastsegment; delete lastsegment;
} }
lastsegment = nextsegment; lastsegment = nextsegment;
} }
/* put the segment list to the main linked list */ /* put the segment list to the main linked list */
segment = lastsegment = firstsegment; segment = lastsegment = firstsegment;
while( segment ) while( segment )
{ {
lastsegment = segment; lastsegment = segment;
segment = segment->Next(); segment = segment->Next();
lastsegment->SetNext( GetScreen()->EEDrawList ); lastsegment->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->EEDrawList = lastsegment; GetScreen()->SetDrawItems( lastsegment );
} }
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
@ -266,7 +323,8 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
( (SCH_SCREEN*) GetScreen() )->SchematicCleanUp( NULL ); ( (SCH_SCREEN*) GetScreen() )->SchematicCleanUp( NULL );
/* clear flags and find last segment entered, for repeat function */ /* clear flags and find last segment entered, for repeat function */
segment = (SCH_LINE*) GetScreen()->EEDrawList; segment = (SCH_LINE*) GetScreen()->GetDrawItems();
while( segment ) while( segment )
{ {
if( segment->m_Flags ) if( segment->m_Flags )
@ -283,7 +341,6 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
{ {
if( IsJunctionNeeded( this, end_point ) ) if( IsJunctionNeeded( this, end_point ) )
CreateNewJunctionStruct( DC, end_point ); CreateNewJunctionStruct( DC, end_point );
else if( IsJunctionNeeded( this, alt_end_point ) ) else if( IsJunctionNeeded( this, alt_end_point ) )
CreateNewJunctionStruct( DC, alt_end_point ); CreateNewJunctionStruct( DC, alt_end_point );
} }
@ -293,12 +350,12 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
if( IsJunctionNeeded( this, s_ConnexionStartPoint ) ) if( IsJunctionNeeded( this, s_ConnexionStartPoint ) )
CreateNewJunctionStruct( DC, s_ConnexionStartPoint ); CreateNewJunctionStruct( DC, s_ConnexionStartPoint );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->GetDrawItems(), DC );
/* Redraw wires and junctions which can be changed by TestDanglingEnds() */ /* Redraw wires and junctions which can be changed by TestDanglingEnds() */
DrawPanel->CursorOff( DC ); // Erase schematic cursor DrawPanel->CursorOff( DC ); // Erase schematic cursor
EDA_BaseStruct* item = GetScreen()->EEDrawList; EDA_ITEM* item = GetScreen()->GetDrawItems();
while( item ) while( item )
{ {
switch( item->Type() ) switch( item->Type() )
@ -325,50 +382,6 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
} }
/* Redraw the segment (g_HVLines == FALSE ) or the two segments (g_HVLines ==
* TRUE )
* from the start point to the cursor, when moving the mouse
*/
static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
SCH_LINE* CurrentLine = (SCH_LINE*) panel->GetScreen()->GetCurItem();
SCH_LINE* segment;
int color;
if( CurrentLine == NULL )
return;
color = ReturnLayerColor( CurrentLine->GetLayer() ) ^ HIGHT_LIGHT_FLAG;
if( erase )
{
segment = CurrentLine;
while( segment )
{
if( !segment->IsNull() ) // Redraw if segment length != 0
RedrawOneStruct( panel, DC, segment, g_XorMode, color );
segment = segment->Next();
}
}
wxPoint endpos = panel->GetScreen()->m_Curseur;
if( g_HVLines ) /* Coerce the line to vertical or horizontal one: */
{
ComputeBreakPoint( CurrentLine, endpos );
}
else
CurrentLine->m_End = endpos;
segment = CurrentLine;
while( segment )
{
if( !segment->IsNull() ) // Redraw if segment length != 0
RedrawOneStruct( panel, DC, segment, g_XorMode, color );
segment = segment->Next();
}
}
/* compute the middle coordinate for 2 segments, from the start point to /* compute the middle coordinate for 2 segments, from the start point to
* new_pos * new_pos
* with the 2 segments kept H or V only * with the 2 segments kept H or V only
@ -389,13 +402,12 @@ static void ComputeBreakPoint( SCH_LINE* segment, const wxPoint& new_pos )
#else #else
int iDx = segment->m_End.x - segment->m_Start.x; int iDx = segment->m_End.x - segment->m_Start.x;
int iDy = segment->m_End.y - segment->m_Start.y; int iDy = segment->m_End.y - segment->m_Start.y;
if( iDy != 0 ) // keep the first segment orientation (currently
// horizontal) if( iDy != 0 ) // keep the first segment orientation (currently horizontal)
{ {
middle_position.x = segment->m_Start.x; middle_position.x = segment->m_Start.x;
} }
else if( iDx != 0 ) // keep the first segment orientation (currently else if( iDx != 0 ) // keep the first segment orientation (currently vertical)
// vertical)
{ {
middle_position.y = segment->m_Start.y; middle_position.y = segment->m_Start.y;
} }
@ -418,9 +430,7 @@ static void ComputeBreakPoint( SCH_LINE* segment, const wxPoint& new_pos )
/* Drawing Polyline phantom at the displacement of the cursor /* Drawing Polyline phantom at the displacement of the cursor
*/ */
static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
wxDC* DC,
bool erase )
{ {
SCH_POLYLINE* NewPoly = (SCH_POLYLINE*) panel->GetScreen()->GetCurItem(); SCH_POLYLINE* NewPoly = (SCH_POLYLINE*) panel->GetScreen()->GetCurItem();
int color; int color;
@ -453,7 +463,7 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel,
/* /*
* Erase the last trace or the element at the current mouse position. * Erase the last trace or the element at the current mouse position.
*/ */
void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC ) void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
{ {
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
@ -470,11 +480,10 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
} }
else else
{ {
Segment_in_Ghost( DrawPanel, DC, FALSE ); DrawSegment( DrawPanel, DC, FALSE );
} }
EraseStruct( (SCH_ITEM*) GetScreen()->GetCurItem(), EraseStruct( (SCH_ITEM*) GetScreen()->GetCurItem(), (SCH_SCREEN*) GetScreen() );
(SCH_SCREEN*) GetScreen() );
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
} }
@ -482,8 +491,9 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
/* Routine to create new connection struct. /* Routine to create new connection struct.
*/ */
SCH_JUNCTION* WinEDA_SchematicFrame::CreateNewJunctionStruct( SCH_JUNCTION* SCH_EDIT_FRAME::CreateNewJunctionStruct( wxDC* DC,
wxDC* DC, const wxPoint& pos, bool PutInUndoList ) const wxPoint& pos,
bool PutInUndoList )
{ {
SCH_JUNCTION* NewJunction; SCH_JUNCTION* NewJunction;
@ -495,17 +505,19 @@ SCH_JUNCTION* WinEDA_SchematicFrame::CreateNewJunctionStruct(
RedrawOneStruct( DrawPanel, DC, NewJunction, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, NewJunction, GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // Display schematic cursor DrawPanel->CursorOn( DC ); // Display schematic cursor
NewJunction->SetNext( GetScreen()->EEDrawList ); NewJunction->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->EEDrawList = NewJunction; GetScreen()->SetDrawItems( NewJunction );
OnModify(); OnModify();
if( PutInUndoList ) if( PutInUndoList )
SaveCopyInUndoList( NewJunction, UR_NEW ); SaveCopyInUndoList( NewJunction, UR_NEW );
return NewJunction; return NewJunction;
} }
/* Routine to create new NoConnect struct. */ /* Routine to create new NoConnect struct. */
SCH_NO_CONNECT* WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC ) SCH_NO_CONNECT* SCH_EDIT_FRAME::CreateNewNoConnectStruct( wxDC* DC )
{ {
SCH_NO_CONNECT* NewNoConnect; SCH_NO_CONNECT* NewNoConnect;
@ -516,8 +528,8 @@ SCH_NO_CONNECT* WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC )
RedrawOneStruct( DrawPanel, DC, NewNoConnect, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, NewNoConnect, GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // Display schematic cursor DrawPanel->CursorOn( DC ); // Display schematic cursor
NewNoConnect->SetNext( GetScreen()->EEDrawList ); NewNoConnect->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->EEDrawList = NewNoConnect; GetScreen()->SetDrawItems( NewNoConnect );
OnModify(); OnModify();
SaveCopyInUndoList( NewNoConnect, UR_NEW ); SaveCopyInUndoList( NewNoConnect, UR_NEW );
return NewNoConnect; return NewNoConnect;
@ -543,7 +555,8 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
/* Clear m_Flags which is used in edit functions: */ /* Clear m_Flags which is used in edit functions: */
SCH_ITEM* item = Screen->EEDrawList; SCH_ITEM* item = Screen->GetDrawItems();
while( item ) while( item )
{ {
item->m_Flags = 0; item->m_Flags = 0;
@ -556,7 +569,7 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
* Bus lines, text, labels * Bus lines, text, labels
* Labels that end with a number will be incremented. * Labels that end with a number will be incremented.
*/ */
void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC ) void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
{ {
wxPoint new_pos; wxPoint new_pos;
@ -667,9 +680,9 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
if( g_ItemToRepeat ) if( g_ItemToRepeat )
{ {
g_ItemToRepeat->SetNext( GetScreen()->EEDrawList ); g_ItemToRepeat->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->EEDrawList = g_ItemToRepeat; GetScreen()->SetDrawItems( g_ItemToRepeat );
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, GR_DEFAULT_DRAWMODE );
SaveCopyInUndoList( g_ItemToRepeat, UR_NEW ); SaveCopyInUndoList( g_ItemToRepeat, UR_NEW );
g_ItemToRepeat->m_Flags = 0; g_ItemToRepeat->m_Flags = 0;
@ -719,7 +732,7 @@ void IncrementLabelMember( wxString& name )
*/ */
static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
{ {
EDA_BaseStruct* item; EDA_ITEM* item;
LIB_PIN* pin; LIB_PIN* pin;
SCH_COMPONENT* LibItem = NULL; SCH_COMPONENT* LibItem = NULL;
SCH_SHEET_PIN* pinsheet; SCH_SHEET_PIN* pinsheet;
@ -729,12 +742,16 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
{ {
case LAYER_BUS: case LAYER_BUS:
item = PickStruct( pos, screen, BUSITEM ); item = PickStruct( pos, screen, BUSITEM );
if( item ) if( item )
return TRUE; return TRUE;
pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList );
pinsheet = LocateAnyPinSheet( pos, screen->GetDrawItems() );
if( pinsheet && IsBusLabel( pinsheet->m_Text ) ) if( pinsheet && IsBusLabel( pinsheet->m_Text ) )
{ {
itempos = pinsheet->m_Pos; itempos = pinsheet->m_Pos;
if( (itempos.x == pos.x) && (itempos.y == pos.y) ) if( (itempos.x == pos.x) && (itempos.y == pos.y) )
return TRUE; return TRUE;
} }
@ -748,10 +765,12 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
case LAYER_WIRE: case LAYER_WIRE:
item = PickStruct( pos, screen, RACCORDITEM | JUNCTIONITEM ); item = PickStruct( pos, screen, RACCORDITEM | JUNCTIONITEM );
if( item ) if( item )
return TRUE; return TRUE;
pin = LocateAnyPin( screen->EEDrawList, pos, &LibItem ); pin = LocateAnyPin( screen->GetDrawItems(), pos, &LibItem );
if( pin && LibItem ) if( pin && LibItem )
{ {
// Calculate the exact position of the connection point of the pin, // Calculate the exact position of the connection point of the pin,
@ -773,10 +792,12 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
&& ( ( (SCH_GLOBALLABEL*) item )->m_Pos.y == pos.y ) ) && ( ( (SCH_GLOBALLABEL*) item )->m_Pos.y == pos.y ) )
return TRUE; return TRUE;
pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList ); pinsheet = LocateAnyPinSheet( pos, screen->GetDrawItems() );
if( pinsheet && !IsBusLabel( pinsheet->m_Text ) ) if( pinsheet && !IsBusLabel( pinsheet->m_Text ) )
{ {
itempos = pinsheet->m_Pos; itempos = pinsheet->m_Pos;
if( ( itempos.x == pos.x ) && ( itempos.y == pos.y ) ) if( ( itempos.x == pos.x ) && ( itempos.y == pos.y ) )
return TRUE; return TRUE;
} }
@ -799,18 +820,17 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
* or * or
* - a pin is on location pos * - a pin is on location pos
*/ */
bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos ) bool IsJunctionNeeded( SCH_EDIT_FRAME* frame, wxPoint& pos )
{ {
if( PickStruct( pos, frame->GetScreen(), JUNCTIONITEM ) ) if( PickStruct( pos, frame->GetScreen(), JUNCTIONITEM ) )
return FALSE; return FALSE;
if( PickStruct( pos, frame->GetScreen(), WIREITEM | if( PickStruct( pos, frame->GetScreen(), WIREITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) )
EXCLUDE_WIRE_BUS_ENDPOINTS ) )
{ {
if( PickStruct( pos, frame->GetScreen(), WIREITEM | if( PickStruct( pos, frame->GetScreen(), WIREITEM | WIRE_BUS_ENDPOINTS_ONLY ) )
WIRE_BUS_ENDPOINTS_ONLY ) )
return TRUE; return TRUE;
if( frame->LocatePinEnd( frame->GetScreen()->EEDrawList, pos ) )
if( frame->LocatePinEnd( frame->GetScreen()->GetDrawItems(), pos ) )
return TRUE; return TRUE;
} }

View File

@ -66,12 +66,10 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
SCH_BUS_ENTRY* WinEDA_SchematicFrame::CreateBusEntry( wxDC* DC, SCH_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusEntry( wxDC* DC, int entry_type )
int entry_type )
{ {
// Create and place a new bus entry at cursor position // Create and place a new bus entry at cursor position
SCH_BUS_ENTRY* BusEntry = new SCH_BUS_ENTRY( GetScreen()->m_Curseur, SCH_BUS_ENTRY* BusEntry = new SCH_BUS_ENTRY( GetScreen()->m_Curseur, s_LastShape, entry_type );
s_LastShape, entry_type );
BusEntry->m_Flags = IS_NEW; BusEntry->m_Flags = IS_NEW;
BusEntry->Place( this, DC );; BusEntry->Place( this, DC );;
OnModify(); OnModify();
@ -79,8 +77,7 @@ SCH_BUS_ENTRY* WinEDA_SchematicFrame::CreateBusEntry( wxDC* DC,
} }
void WinEDA_SchematicFrame::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, void SCH_EDIT_FRAME::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, wxDC* DC )
wxDC* DC )
{ {
if( BusEntry == NULL ) if( BusEntry == NULL )
return; return;
@ -109,9 +106,7 @@ void WinEDA_SchematicFrame::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry,
/* set the shape of BusEntry (shape = / or \ ) /* set the shape of BusEntry (shape = / or \ )
*/ */
void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC, void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int entry_shape )
SCH_BUS_ENTRY* BusEntry,
int entry_shape )
{ {
if( BusEntry == NULL ) if( BusEntry == NULL )
return; return;
@ -141,13 +136,13 @@ void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC,
break; break;
} }
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
RedrawOneStruct( DrawPanel, DC, BusEntry, g_XorMode ); RedrawOneStruct( DrawPanel, DC, BusEntry, g_XorMode );
OnModify( ); OnModify( );
} }
int WinEDA_SchematicFrame::GetBusEntryShape( SCH_BUS_ENTRY* BusEntry ) int SCH_EDIT_FRAME::GetBusEntryShape( SCH_BUS_ENTRY* BusEntry )
{ {
int entry_shape = '\\'; int entry_shape = '\\';

View File

@ -51,7 +51,7 @@
*/ */
LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_COMPONENT* aRootComponent ): LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_COMPONENT* aRootComponent ):
EDA_BaseStruct( LIB_ALIAS_T ) EDA_ITEM( LIB_ALIAS_T )
{ {
root = aRootComponent; root = aRootComponent;
name = aName; name = aName;
@ -59,7 +59,7 @@ LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_COMPONENT* aRootComponent ):
LIB_ALIAS::LIB_ALIAS( const LIB_ALIAS& aAlias, LIB_COMPONENT* aRootComponent ) : LIB_ALIAS::LIB_ALIAS( const LIB_ALIAS& aAlias, LIB_COMPONENT* aRootComponent ) :
EDA_BaseStruct( aAlias ) EDA_ITEM( aAlias )
{ {
name = aAlias.name; name = aAlias.name;
root = aRootComponent; root = aRootComponent;
@ -158,7 +158,7 @@ int LibraryEntryCompare( const LIB_ALIAS* aItem1, const LIB_ALIAS* aItem2 )
* Library components are different from schematic components. * Library components are different from schematic components.
*/ */
LIB_COMPONENT::LIB_COMPONENT( const wxString& aName, CMP_LIBRARY* aLibrary ) : LIB_COMPONENT::LIB_COMPONENT( const wxString& aName, CMP_LIBRARY* aLibrary ) :
EDA_BaseStruct( LIB_COMPONENT_T ) EDA_ITEM( LIB_COMPONENT_T )
{ {
m_name = aName; m_name = aName;
m_library = aLibrary; m_library = aLibrary;
@ -187,7 +187,7 @@ LIB_COMPONENT::LIB_COMPONENT( const wxString& aName, CMP_LIBRARY* aLibrary ) :
LIB_COMPONENT::LIB_COMPONENT( LIB_COMPONENT& aComponent, CMP_LIBRARY* aLibrary ) : LIB_COMPONENT::LIB_COMPONENT( LIB_COMPONENT& aComponent, CMP_LIBRARY* aLibrary ) :
EDA_BaseStruct( aComponent ) EDA_ITEM( aComponent )
{ {
LIB_DRAW_ITEM* newItem; LIB_DRAW_ITEM* newItem;

View File

@ -48,7 +48,7 @@ enum LibrEntryOptions
* Component aliases are not really components. They are references * Component aliases are not really components. They are references
* to an actual component object. * to an actual component object.
*/ */
class LIB_ALIAS : public EDA_BaseStruct class LIB_ALIAS : public EDA_ITEM
{ {
/** /**
* The actual component of the alias. * The actual component of the alias.
@ -149,7 +149,7 @@ extern int LibraryEntryCompare( const LIB_ALIAS* aItem1, const LIB_ALIAS* aItem2
* A library component object is typically saved and loaded in a component library file (.lib). * A library component object is typically saved and loaded in a component library file (.lib).
* Library components are different from schematic components. * Library components are different from schematic components.
*/ */
class LIB_COMPONENT : public EDA_BaseStruct class LIB_COMPONENT : public EDA_ITEM
{ {
wxString m_name; wxString m_name;
int m_pinNameOffset; ///< The offset in mils to draw the pin name. Set to 0 int m_pinNameOffset; ///< The offset in mils to draw the pin name. Set to 0

View File

@ -60,7 +60,7 @@ class NETLIST_OBJECT
public: public:
NetObjetType m_Type; /* Type of item (see NetObjetType NetObjetType m_Type; /* Type of item (see NetObjetType
* enum) */ * enum) */
EDA_BaseStruct* m_Comp; /* Pointer on the library item that EDA_ITEM * m_Comp; /* Pointer on the library item that
* created this net object (the parent) * created this net object (the parent)
*/ */
SCH_ITEM* m_Link; /* For SCH_SHEET_PIN: SCH_ITEM* m_Link; /* For SCH_SHEET_PIN:

View File

@ -28,7 +28,8 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
return; return;
} }
DrawList = Screen->EEDrawList; DrawList = Screen->GetDrawItems();
while( DrawList ) while( DrawList )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
@ -76,8 +77,7 @@ void BreakSegment( SCH_SCREEN* aScreen, wxPoint aBreakpoint )
{ {
SCH_LINE* segment, * NewSegment; SCH_LINE* segment, * NewSegment;
for( SCH_ITEM* DrawList = aScreen->EEDrawList; DrawList; for( SCH_ITEM* DrawList = aScreen->GetDrawItems(); DrawList; DrawList = DrawList->Next() )
DrawList = DrawList->Next() )
{ {
if( DrawList->Type() != DRAW_SEGMENT_STRUCT_TYPE ) if( DrawList->Type() != DRAW_SEGMENT_STRUCT_TYPE )
continue; continue;

View File

@ -34,12 +34,12 @@
* - label * - label
* - pin * - pin
* - component * - component
* @return an EDA_BaseStruct pointer on the item or NULL if no item found * @return an EDA_ITEM pointer on the item or NULL if no item found
* @param IncludePin = true to search for pins, false to ignore them * @param IncludePin = true to search for pins, false to ignore them
* *
* For some items, characteristics are displayed on the screen. * For some items, characteristics are displayed on the screen.
*/ */
SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool IncludePin ) SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( bool IncludePin )
{ {
SCH_ITEM* DrawStruct; SCH_ITEM* DrawStruct;
wxString msg; wxString msg;
@ -66,8 +66,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Include
break; break;
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
Pin = LocateAnyPin( GetScreen()->EEDrawList, GetScreen()->m_Curseur, Pin = LocateAnyPin( GetScreen()->GetDrawItems(), GetScreen()->m_Curseur, &LibItem );
&LibItem );
if( Pin ) if( Pin )
break; // Priority is probing a pin first break; // Priority is probing a pin first
LibItem = (SCH_COMPONENT*) DrawStruct; LibItem = (SCH_COMPONENT*) DrawStruct;
@ -75,8 +74,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Include
break; break;
default: default:
Pin = LocateAnyPin( GetScreen()->EEDrawList, GetScreen()->m_Curseur, Pin = LocateAnyPin( GetScreen()->GetDrawItems(), GetScreen()->m_Curseur, &LibItem );
&LibItem );
break; break;
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
@ -113,13 +111,13 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Include
* - label * - label
* - pin * - pin
* - component * - component
* @return an EDA_BaseStruct pointer on the item or NULL if no item found * @return an EDA_ITEM pointer on the item or NULL if no item found
* @param refpoint = the wxPoint location where to search * @param refpoint = the wxPoint location where to search
* @param IncludePin = true to search for pins, false to ignore them * @param IncludePin = true to search for pins, false to ignore them
* *
* For some items, characteristics are displayed on the screen. * For some items, characteristics are displayed on the screen.
*/ */
SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
bool IncludePin ) bool IncludePin )
{ {
SCH_ITEM* DrawStruct; SCH_ITEM* DrawStruct;
@ -227,7 +225,7 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay( const wxPoint
} }
void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ) void SCH_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
{ {
wxRealPoint delta; wxRealPoint delta;
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();

View File

@ -38,9 +38,9 @@ void RemoteCommand( const char* cmdline )
char* idcmd; char* idcmd;
char* text; char* text;
wxString part_ref, msg; wxString part_ref, msg;
WinEDA_SchematicFrame* frame; SCH_EDIT_FRAME* frame;
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow(); frame = (SCH_EDIT_FRAME*)wxGetApp().GetTopWindow();
strncpy( line, cmdline, sizeof(line) - 1 ); strncpy( line, cmdline, sizeof(line) - 1 );
@ -85,11 +85,6 @@ void RemoteCommand( const char* cmdline )
} }
/*****************************************************************************/
void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
SCH_COMPONENT* LibItem )
/*****************************************************************************/
/** Send a remote command to eeschema via a socket, /** Send a remote command to eeschema via a socket,
* @param objectToSync = item to be located on board (footprint, pad or text) * @param objectToSync = item to be located on board (footprint, pad or text)
* @param LibItem = component in lib if objectToSync is a sub item of a component * @param LibItem = component in lib if objectToSync is a sub item of a component
@ -97,6 +92,7 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
* $PART: reference put cursor on footprint anchor * $PART: reference put cursor on footprint anchor
* $PIN: number $PART: reference put cursor on the footprint pad * $PIN: number $PART: reference put cursor on the footprint pad
*/ */
void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT* LibItem )
{ {
if( objectToSync == NULL ) if( objectToSync == NULL )
return; return;
@ -112,16 +108,15 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
{ {
if( LibItem == NULL ) if( LibItem == NULL )
break; break;
sprintf( Line, "$PART: %s",
CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) ); sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
SendCommand( MSG_TO_PCB, Line ); SendCommand( MSG_TO_PCB, Line );
} }
break; break;
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
LibItem = (SCH_COMPONENT*) objectToSync; LibItem = (SCH_COMPONENT*) objectToSync;
sprintf( Line, "$PART: %s", sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
SendCommand( MSG_TO_PCB, Line ); SendCommand( MSG_TO_PCB, Line );
break; break;
@ -139,8 +134,9 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) ); CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
} }
else else
sprintf( Line, "$PART: %s", {
CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) ); sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
}
SendCommand( MSG_TO_PCB, Line ); SendCommand( MSG_TO_PCB, Line );
break; break;

View File

@ -32,7 +32,7 @@ bool SegmentIntersect( wxPoint aSegStart, wxPoint aSegEnd, wxPoint aTestPoint )
} }
void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* aDrawList, wxDC* aDC ) void SCH_EDIT_FRAME::TestDanglingEnds( SCH_ITEM* aDrawList, wxDC* aDC )
{ {
SCH_ITEM* item; SCH_ITEM* item;
std::vector< DANGLING_END_ITEM > endPoints; std::vector< DANGLING_END_ITEM > endPoints;
@ -57,7 +57,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* aDrawList, wxDC* aDC )
* @param DrawList = List of SCH_ITEMs to check. * @param DrawList = List of SCH_ITEMs to check.
* @return a LIB_PIN pointer to the located pin or NULL if no pin was found. * @return a LIB_PIN pointer to the located pin or NULL if no pin was found.
*/ */
LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos ) LIB_PIN* SCH_EDIT_FRAME::LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos )
{ {
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
LIB_PIN* Pin; LIB_PIN* Pin;

View File

@ -25,10 +25,9 @@ void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList
* pins, end wire or bus, and junctions if TstJunction == TRUE * pins, end wire or bus, and junctions if TstJunction == TRUE
* Return this count * Return this count
* *
* Used by WinEDA_SchematicFrame::DeleteConnection() * Used by SCH_EDIT_FRAME::DeleteConnection()
*/ */
static int CountConnectedItems( WinEDA_SchematicFrame* frame, static int CountConnectedItems( SCH_EDIT_FRAME* frame, SCH_ITEM* ListStruct, wxPoint pos,
SCH_ITEM* ListStruct, wxPoint pos,
bool TstJunction ) bool TstJunction )
{ {
SCH_ITEM* Struct; SCH_ITEM* Struct;
@ -72,12 +71,11 @@ static int CountConnectedItems( WinEDA_SchematicFrame* frame,
* "ListStruct" * "ListStruct"
* Search wire stop at an any pin * Search wire stop at an any pin
* *
* Used by WinEDA_SchematicFrame::DeleteConnection() * Used by SCH_EDIT_FRAME::DeleteConnection()
*/ */
static bool MarkConnected( WinEDA_SchematicFrame* frame, SCH_ITEM* ListStruct, static bool MarkConnected( SCH_EDIT_FRAME* frame, SCH_ITEM* ListStruct, SCH_LINE* segment )
SCH_LINE* segment )
{ {
EDA_BaseStruct* Struct; EDA_ITEM* Struct;
for( Struct = ListStruct; Struct != NULL; Struct = Struct->Next() ) for( Struct = ListStruct; Struct != NULL; Struct = Struct->Next() )
{ {
@ -123,15 +121,14 @@ static bool MarkConnected( WinEDA_SchematicFrame* frame, SCH_ITEM* ListStruct,
* Delete a connection, i.e wires or bus connected * Delete a connection, i.e wires or bus connected
* stop on a node (more than 2 wires (bus) connected) * stop on a node (more than 2 wires (bus) connected)
*/ */
void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection ) void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
{ {
wxPoint refpos = GetScreen()->m_Curseur; wxPoint refpos = GetScreen()->m_Curseur;
SCH_ITEM* DelStruct; SCH_ITEM* DelStruct;
PICKED_ITEMS_LIST pickList; PICKED_ITEMS_LIST pickList;
/* Clear .m_Flags member for all items */ /* Clear .m_Flags member for all items */
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; for( DelStruct = GetScreen()->GetDrawItems(); DelStruct != NULL; DelStruct = DelStruct->Next() )
DelStruct = DelStruct->Next() )
DelStruct->m_Flags = 0; DelStruct->m_Flags = 0;
BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() ); BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() );
@ -142,8 +139,9 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
ITEM_PICKER picker(NULL, UR_DELETED); ITEM_PICKER picker(NULL, UR_DELETED);
SCH_SCREEN* screen = (SCH_SCREEN*) GetScreen(); SCH_SCREEN* screen = (SCH_SCREEN*) GetScreen();
// Save the list entry point of this screen // Save the list entry point of this screen
SCH_ITEM* savedEEDrawList = screen->EEDrawList; SCH_ITEM* savedItems = screen->GetDrawItems();
DelStruct = GetScreen()->EEDrawList; DelStruct = GetScreen()->GetDrawItems();
while( DelStruct while( DelStruct
&& ( DelStruct = PickStruct( screen->m_Curseur, screen, && ( DelStruct = PickStruct( screen->m_Curseur, screen,
JUNCTIONITEM | WIREITEM | BUSITEM ) ) != NULL ) JUNCTIONITEM | WIREITEM | BUSITEM ) ) != NULL )
@ -156,31 +154,32 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
pickList.PushItem(picker); pickList.PushItem(picker);
DelStruct = DelStruct->Next(); DelStruct = DelStruct->Next();
screen->EEDrawList = DelStruct; screen->SetDrawItems( DelStruct );
} }
GetScreen()->EEDrawList = savedEEDrawList; GetScreen()->SetDrawItems( savedItems );
/* Mark all wires, junctions, .. connected to one of the item to delete /* Mark all wires, junctions, .. connected to one of the item to delete
*/ */
if( DeleteFullConnection ) if( DeleteFullConnection )
{ {
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; for( DelStruct = GetScreen()->GetDrawItems(); DelStruct != NULL;
DelStruct = DelStruct->Next() ) DelStruct = DelStruct->Next() )
{ {
if( !(DelStruct->m_Flags & SELECTEDNODE) ) if( !(DelStruct->m_Flags & SELECTEDNODE) )
continue; continue;
#define SEGM ( (SCH_LINE*) DelStruct ) #define SEGM ( (SCH_LINE*) DelStruct )
if( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) if( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE )
continue; continue;
MarkConnected( this, GetScreen()->EEDrawList, SEGM ); MarkConnected( this, GetScreen()->GetDrawItems(), SEGM );
#undef SEGM #undef SEGM
} }
// Search all removable wires (i.e wire with one new dangling end ) // Search all removable wires (i.e wire with one new dangling end )
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; for( DelStruct = GetScreen()->GetDrawItems(); DelStruct != NULL;
DelStruct = DelStruct->Next() ) DelStruct = DelStruct->Next() )
{ {
bool noconnect = FALSE; bool noconnect = FALSE;
@ -200,8 +199,8 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
/* Test the SEGM->m_Start point: if this point was connected to /* Test the SEGM->m_Start point: if this point was connected to
* an STRUCT_DELETED wire, and now is not connected, the wire can * an STRUCT_DELETED wire, and now is not connected, the wire can
* be deleted */ * be deleted */
EDA_BaseStruct* removed_struct; EDA_ITEM* removed_struct;
for( removed_struct = GetScreen()->EEDrawList; for( removed_struct = GetScreen()->GetDrawItems();
removed_struct != NULL; removed_struct != NULL;
removed_struct = removed_struct->Next() ) removed_struct = removed_struct->Next() )
{ {
@ -216,14 +215,14 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
break; break;
} }
if( WIRE && !CountConnectedItems( this, GetScreen()->EEDrawList, if( WIRE && !CountConnectedItems( this, GetScreen()->GetDrawItems(),
SEGM->m_Start, TRUE ) ) SEGM->m_Start, TRUE ) )
noconnect = TRUE; noconnect = TRUE;
/* Test the SEGM->m_End point: if this point was connected to /* Test the SEGM->m_End point: if this point was connected to
* an STRUCT_DELETED wire, and now is not connected, the wire * an STRUCT_DELETED wire, and now is not connected, the wire
* can be deleted */ * can be deleted */
for( removed_struct = GetScreen()->EEDrawList; for( removed_struct = GetScreen()->GetDrawItems();
removed_struct != NULL; removed_struct != NULL;
removed_struct = removed_struct->Next() ) removed_struct = removed_struct->Next() )
{ {
@ -236,8 +235,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
} }
if( removed_struct && if( removed_struct &&
!CountConnectedItems( this, GetScreen()->EEDrawList, !CountConnectedItems( this, GetScreen()->GetDrawItems(), SEGM->m_End, TRUE ) )
SEGM->m_End, TRUE ) )
noconnect = TRUE; noconnect = TRUE;
DelStruct->m_Flags &= ~SKIP_STRUCT; DelStruct->m_Flags &= ~SKIP_STRUCT;
@ -250,14 +248,14 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
picker.m_PickedItemType = DelStruct->Type(); picker.m_PickedItemType = DelStruct->Type();
pickList.PushItem(picker); pickList.PushItem(picker);
DelStruct = GetScreen()->EEDrawList; DelStruct = GetScreen()->GetDrawItems();
} }
#undef SEGM #undef SEGM
} }
// Delete redundant junctions (junctions which connect < 3 end wires // Delete redundant junctions (junctions which connect < 3 end wires
// and no pin are removed) // and no pin are removed)
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; for( DelStruct = GetScreen()->GetDrawItems(); DelStruct != NULL;
DelStruct = DelStruct->Next() ) DelStruct = DelStruct->Next() )
{ {
int count; int count;
@ -270,7 +268,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
if( DelStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE ) if( DelStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE )
{ {
#define JUNCTION ( (SCH_JUNCTION*) DelStruct ) #define JUNCTION ( (SCH_JUNCTION*) DelStruct )
count = CountConnectedItems( this, GetScreen()->EEDrawList, count = CountConnectedItems( this, GetScreen()->GetDrawItems(),
JUNCTION->m_Pos, FALSE ); JUNCTION->m_Pos, FALSE );
if( count <= 2 ) if( count <= 2 )
{ {
@ -287,7 +285,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
// Delete labels attached to wires // Delete labels attached to wires
wxPoint pos = GetScreen()->m_Curseur; wxPoint pos = GetScreen()->m_Curseur;
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; for( DelStruct = GetScreen()->GetDrawItems(); DelStruct != NULL;
DelStruct = DelStruct->Next() ) DelStruct = DelStruct->Next() )
{ {
if( DelStruct->m_Flags & STRUCT_DELETED ) if( DelStruct->m_Flags & STRUCT_DELETED )
@ -297,8 +295,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
continue; continue;
GetScreen()->m_Curseur = ( (SCH_TEXT*) DelStruct )->m_Pos; GetScreen()->m_Curseur = ( (SCH_TEXT*) DelStruct )->m_Pos;
EDA_BaseStruct* TstStruct = EDA_ITEM* TstStruct = PickStruct( GetScreen()->m_Curseur, GetScreen(),
PickStruct( GetScreen()->m_Curseur, GetScreen(),
WIREITEM | BUSITEM ); WIREITEM | BUSITEM );
if( TstStruct && TstStruct->m_Flags & STRUCT_DELETED ) if( TstStruct && TstStruct->m_Flags & STRUCT_DELETED )
@ -315,7 +312,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
GetScreen()->m_Curseur = pos; GetScreen()->m_Curseur = pos;
} }
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; for( DelStruct = GetScreen()->GetDrawItems(); DelStruct != NULL;
DelStruct = DelStruct->Next() ) DelStruct = DelStruct->Next() )
DelStruct->m_Flags = 0; DelStruct->m_Flags = 0;
@ -341,7 +338,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
* *
* return TRUE if an item was deleted * return TRUE if an item was deleted
*/ */
bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC ) bool LocateAndDeleteItem( SCH_EDIT_FRAME* frame, wxDC* DC )
{ {
SCH_ITEM* DelStruct; SCH_ITEM* DelStruct;
SCH_SCREEN* screen = (SCH_SCREEN*) ( frame->GetScreen() ); SCH_SCREEN* screen = (SCH_SCREEN*) ( frame->GetScreen() );
@ -370,7 +367,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
{ {
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
DeleteStruct( frame->DrawPanel, DC, DelStruct ); DeleteStruct( frame->DrawPanel, DC, DelStruct );
frame->TestDanglingEnds( frame->GetScreen()->EEDrawList, DC ); frame->TestDanglingEnds( frame->GetScreen()->GetDrawItems(), DC );
frame->OnModify( ); frame->OnModify( );
item_deleted = TRUE; item_deleted = TRUE;
} }
@ -392,7 +389,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
*/ */
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen ) void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
{ {
EDA_BaseStruct* DrawList; EDA_ITEM* DrawList;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
return; return;
@ -414,14 +411,15 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
} }
else else
{ {
if( DrawStruct == Screen->EEDrawList ) if( DrawStruct == Screen->GetDrawItems() )
{ {
Screen->EEDrawList = DrawStruct->Next(); Screen->SetDrawItems( DrawStruct->Next() );
SAFE_DELETE( DrawStruct ); SAFE_DELETE( DrawStruct );
} }
else else
{ {
DrawList = Screen->EEDrawList; DrawList = Screen->GetDrawItems();
while( DrawList && DrawList->Next() ) while( DrawList && DrawList->Next() )
{ {
if( DrawList->Next() == DrawStruct ) if( DrawList->Next() == DrawStruct )
@ -444,17 +442,17 @@ void DeleteAllMarkers( int type )
SCH_MARKER* Marker; SCH_MARKER* Marker;
SCH_SCREENS ScreenList; SCH_SCREENS ScreenList;
for( screen = ScreenList.GetFirst(); screen != NULL; for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
screen = ScreenList.GetNext() )
{ {
for( DrawStruct = screen->EEDrawList; DrawStruct != NULL; for( DrawStruct = screen->GetDrawItems(); DrawStruct != NULL; DrawStruct = NextStruct )
DrawStruct = NextStruct )
{ {
NextStruct = DrawStruct->Next(); NextStruct = DrawStruct->Next();
if( DrawStruct->Type() != TYPE_SCH_MARKER ) if( DrawStruct->Type() != TYPE_SCH_MARKER )
continue; continue;
Marker = (SCH_MARKER*) DrawStruct; Marker = (SCH_MARKER*) DrawStruct;
if( Marker->GetMarkerType() != type ) if( Marker->GetMarkerType() != type )
continue; continue;

View File

@ -14,29 +14,25 @@
#include "sch_sheet.h" #include "sch_sheet.h"
/**************************************************************************/
void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion )
/**************************************************************************/
/* Free (delete) all schematic data (include the sub hierarchy sheets ) /* Free (delete) all schematic data (include the sub hierarchy sheets )
* for the hierarchical sheet FirstSheet * for the hierarchical sheet FirstSheet
* FirstSheet is not deleted. * FirstSheet is not deleted.
*/ */
void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion )
{ {
EDA_BaseStruct* DrawStruct; EDA_ITEM* DrawStruct;
EDA_BaseStruct* EEDrawList; EDA_ITEM* EEDrawList;
wxString msg; wxString msg;
WinEDA_SchematicFrame* frame; SCH_EDIT_FRAME* frame;
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow(); frame = (SCH_EDIT_FRAME*)wxGetApp().GetTopWindow();
if( FirstSheet == NULL ) if( FirstSheet == NULL )
return; return;
if( FirstSheet->Type() != DRAW_SHEET_STRUCT_TYPE ) if( FirstSheet->Type() != DRAW_SHEET_STRUCT_TYPE )
{ {
DisplayError( NULL, DisplayError( NULL, wxT( "DeleteSubHierarchy error(): NOT a Sheet" ) );
wxT( "DeleteSubHierarchy error(): NOT a Sheet" ) );
return; return;
} }
@ -45,6 +41,7 @@ void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion )
msg.Printf( _( "Sheet %s (file %s) modified. Save it?" ), msg.Printf( _( "Sheet %s (file %s) modified. Save it?" ),
FirstSheet->m_SheetName.GetData(), FirstSheet->m_SheetName.GetData(),
FirstSheet->GetFileName().GetData() ); FirstSheet->GetFileName().GetData() );
if( IsOK( NULL, msg ) ) if( IsOK( NULL, msg ) )
{ {
frame->SaveEEFile( FirstSheet->m_AssociatedScreen, FILE_SAVE_AS ); frame->SaveEEFile( FirstSheet->m_AssociatedScreen, FILE_SAVE_AS );
@ -54,15 +51,16 @@ void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion )
/* free the sub hierarchy */ /* free the sub hierarchy */
if( FirstSheet->m_AssociatedScreen ) if( FirstSheet->m_AssociatedScreen )
{ {
EEDrawList = FirstSheet->m_AssociatedScreen->EEDrawList; EEDrawList = FirstSheet->m_AssociatedScreen->GetDrawItems();
while( EEDrawList != NULL ) while( EEDrawList != NULL )
{ {
DrawStruct = EEDrawList; DrawStruct = EEDrawList;
EEDrawList = EEDrawList->Next(); EEDrawList = EEDrawList->Next();
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
DeleteSubHierarchy( (SCH_SHEET*) DrawStruct, DeleteSubHierarchy( (SCH_SHEET*) DrawStruct, confirm_deletion );
confirm_deletion );
} }
} }
@ -71,13 +69,10 @@ void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion )
} }
/********************************************************************/
bool ClearProjectDrawList( SCH_SCREEN* screen, bool confirm_deletion )
/********************************************************************/
/* free the draw list screen->EEDrawList and the subhierarchies /* free the draw list screen->EEDrawList and the subhierarchies
* clear the screen datas (filenames ..) * clear the screen datas (filenames ..)
*/ */
bool ClearProjectDrawList( SCH_SCREEN* screen, bool confirm_deletion )
{ {
if( screen == NULL ) if( screen == NULL )
return TRUE; return TRUE;

View File

@ -14,14 +14,14 @@
#define KEY_ANNOTATE_SORT_OPTION wxT("AnnotateSortOption") #define KEY_ANNOTATE_SORT_OPTION wxT("AnnotateSortOption")
extern void AnnotateComponents( WinEDA_SchematicFrame* parent, extern void AnnotateComponents( SCH_EDIT_FRAME* parent,
bool annotateSchematic, bool annotateSchematic,
int sortOption, int sortOption,
bool resetAnnotation, bool resetAnnotation,
bool repairsTimestamps ); bool repairsTimestamps );
DIALOG_ANNOTATE::DIALOG_ANNOTATE( WinEDA_SchematicFrame* parent ) DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent )
: DIALOG_ANNOTATE_BASE( parent ) : DIALOG_ANNOTATE_BASE( parent )
{ {
m_Parent = parent; m_Parent = parent;

View File

@ -27,7 +27,7 @@
#include "dialog_annotate_base.h" #include "dialog_annotate_base.h"
class WinEDA_SchematicFrame; class SCH_EDIT_FRAME;
class wxConfig; class wxConfig;
@ -38,11 +38,11 @@ class wxConfig;
class DIALOG_ANNOTATE: public DIALOG_ANNOTATE_BASE class DIALOG_ANNOTATE: public DIALOG_ANNOTATE_BASE
{ {
private: private:
WinEDA_SchematicFrame * m_Parent; SCH_EDIT_FRAME * m_Parent;
wxConfig* m_Config; wxConfig* m_Config;
public: public:
DIALOG_ANNOTATE( WinEDA_SchematicFrame* parent ); DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent );
~DIALOG_ANNOTATE(){}; ~DIALOG_ANNOTATE(){};
/// Initialises member variables /// Initialises member variables

View File

@ -107,7 +107,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
if( aPrintAll && m_Parent->m_Ident == SCHEMATIC_FRAME ) if( aPrintAll && m_Parent->m_Ident == SCHEMATIC_FRAME )
{ {
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent; SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent;
SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet(); SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet();
SCH_SCREEN* schscreen = schframe->GetScreen(); SCH_SCREEN* schscreen = schframe->GetScreen();
oldscreen = schscreen; oldscreen = schscreen;

View File

@ -623,7 +623,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(
// Print list of items // Print list of items
for( unsigned ii = 0; ii < aList.size(); ii++ ) for( unsigned ii = 0; ii < aList.size(); ii++ )
{ {
EDA_BaseStruct* item = aList[ii].m_RootCmp; EDA_ITEM* item = aList[ii].m_RootCmp;
if( item == NULL ) if( item == NULL )
continue; continue;
@ -860,7 +861,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(
std::vector <OBJ_CMP_TO_LIST>& aList, std::vector <OBJ_CMP_TO_LIST>& aList,
bool aIncludeSubComponents ) bool aIncludeSubComponents )
{ {
EDA_BaseStruct* schItem; EDA_ITEM* schItem;
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
LIB_COMPONENT* entry; LIB_COMPONENT* entry;
std::string CmpName; std::string CmpName;

View File

@ -26,8 +26,7 @@ int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_SelectedRow;
wxSize DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = wxDefaultSize; wxSize DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = wxDefaultSize;
void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, void InstallCmpeditFrame( SCH_EDIT_FRAME* parent, wxPoint& pos, SCH_COMPONENT* aComponent )
SCH_COMPONENT* aComponent )
{ {
if( aComponent == NULL ) // Null component not accepted if( aComponent == NULL ) // Null component not accepted
return; return;
@ -77,7 +76,7 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* parent ) : DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* parent ) :
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( parent ) DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( parent )
{ {
m_Parent = (WinEDA_SchematicFrame*) parent; m_Parent = (SCH_EDIT_FRAME*) parent;
m_LibEntry = NULL; m_LibEntry = NULL;
m_skipCopyFromPanel = false; m_skipCopyFromPanel = false;
@ -268,7 +267,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
m_Parent->OnModify(); m_Parent->OnModify();
m_Parent->TestDanglingEnds( m_Parent->GetScreen()->EEDrawList, NULL ); m_Parent->TestDanglingEnds( m_Parent->GetScreen()->GetDrawItems(), NULL );
m_Parent->DrawPanel->Refresh( TRUE ); m_Parent->DrawPanel->Refresh( TRUE );

View File

@ -16,11 +16,11 @@
*/ */
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
{ {
friend void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, friend void InstallCmpeditFrame( SCH_EDIT_FRAME* parent,
wxPoint& pos, wxPoint& pos,
SCH_COMPONENT* aComponent ); SCH_COMPONENT* aComponent );
WinEDA_SchematicFrame* m_Parent; SCH_EDIT_FRAME* m_Parent;
SCH_COMPONENT* m_Cmp; SCH_COMPONENT* m_Cmp;
LIB_COMPONENT* m_LibEntry; LIB_COMPONENT* m_LibEntry;
bool m_skipCopyFromPanel; bool m_skipCopyFromPanel;

View File

@ -23,7 +23,7 @@
/* Edit the properties of the text (Label, Global label, graphic text).. ) /* Edit the properties of the text (Label, Global label, graphic text).. )
* pointed by "aTextStruct" * pointed by "aTextStruct"
*/ */
void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* aTextItem ) void SCH_EDIT_FRAME::EditSchematicText( SCH_TEXT* aTextItem )
{ {
if( aTextItem == NULL ) if( aTextItem == NULL )
return; return;
@ -34,7 +34,7 @@ void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* aTextItem )
} }
DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* aParent, SCH_TEXT* aTextItem ) : DialogLabelEditor::DialogLabelEditor( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTextItem ) :
DialogLabelEditor_Base( aParent ) DialogLabelEditor_Base( aParent )
{ {
m_Parent = aParent; m_Parent = aParent;

View File

@ -11,19 +11,19 @@
#include "dialog_edit_label_base.h" #include "dialog_edit_label_base.h"
class WinEDA_SchematicFrame; class SCH_EDIT_FRAME;
class SCH_TEXT; class SCH_TEXT;
class DialogLabelEditor : public DialogLabelEditor_Base class DialogLabelEditor : public DialogLabelEditor_Base
{ {
private: private:
WinEDA_SchematicFrame* m_Parent; SCH_EDIT_FRAME* m_Parent;
SCH_TEXT* m_CurrentText; SCH_TEXT* m_CurrentText;
wxTextCtrl* m_textLabel; wxTextCtrl* m_textLabel;
public: public:
DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* aTextItem ); DialogLabelEditor( SCH_EDIT_FRAME* parent, SCH_TEXT* aTextItem );
~DialogLabelEditor(){}; ~DialogLabelEditor(){};

View File

@ -283,8 +283,8 @@ An alias %s already exists!\nCannot update this component" ),
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::addFieldButtonHandler( wxCommandEvent& event ) void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::addFieldButtonHandler( wxCommandEvent& event )
/**************************************************************************************/ /**************************************************************************************/
{ {
WinEDA_SchematicFrame* frame; SCH_EDIT_FRAME* frame;
frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow(); frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow();
// in case m_FieldsBuf[REFERENCE].m_Orient has changed on screen only, grab // in case m_FieldsBuf[REFERENCE].m_Orient has changed on screen only, grab
// screen contents. // screen contents.
@ -491,7 +491,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
// Now copy in the template fields, in the order that they are present in the // Now copy in the template fields, in the order that they are present in the
// template field editor UI. // template field editor UI.
const TEMPLATE_FIELDNAMES& tfnames = const TEMPLATE_FIELDNAMES& tfnames =
((WinEDA_SchematicFrame*)m_Parent->GetParent())->GetTemplateFieldNames(); ((SCH_EDIT_FRAME*)m_Parent->GetParent())->GetTemplateFieldNames();
for( TEMPLATE_FIELDNAMES::const_iterator it = tfnames.begin(); it!=tfnames.end(); ++it ) for( TEMPLATE_FIELDNAMES::const_iterator it = tfnames.begin(); it!=tfnames.end(); ++it )
{ {

View File

@ -25,7 +25,7 @@
#include "dialog_eeschema_config.h" #include "dialog_eeschema_config.h"
DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG( WinEDA_SchematicFrame* aSchFrame, DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG( SCH_EDIT_FRAME* aSchFrame,
WinEDA_DrawFrame* aParent ) WinEDA_DrawFrame* aParent )
: DIALOG_EESCHEMA_CONFIG_FBP( aParent ) : DIALOG_EESCHEMA_CONFIG_FBP( aParent )
{ {

View File

@ -6,14 +6,14 @@
#include "dialog_eeschema_config_fbp.h" #include "dialog_eeschema_config_fbp.h"
class WinEDA_SchematicFrame; class SCH_EDIT_FRAME;
class WinEDA_DrawFrame; class WinEDA_DrawFrame;
class DIALOG_EESCHEMA_CONFIG : public DIALOG_EESCHEMA_CONFIG_FBP class DIALOG_EESCHEMA_CONFIG : public DIALOG_EESCHEMA_CONFIG_FBP
{ {
private: private:
WinEDA_SchematicFrame* m_Parent; SCH_EDIT_FRAME* m_Parent;
bool m_LibListChanged; bool m_LibListChanged;
bool m_LibPathChanged; bool m_LibPathChanged;
wxString m_UserLibDirBufferImg; // Copy of original g_UserLibDirBuffer wxString m_UserLibDirBufferImg; // Copy of original g_UserLibDirBuffer
@ -34,7 +34,7 @@ private:
public: public:
DIALOG_EESCHEMA_CONFIG( WinEDA_SchematicFrame* parent, WinEDA_DrawFrame* activeWindow ); DIALOG_EESCHEMA_CONFIG( SCH_EDIT_FRAME* parent, WinEDA_DrawFrame* activeWindow );
~DIALOG_EESCHEMA_CONFIG() {}; ~DIALOG_EESCHEMA_CONFIG() {};
}; };

View File

@ -22,13 +22,13 @@ void DIALOG_EESCHEMA_OPTIONS::SetUnits( const wxArrayString& units, int select )
} }
void DIALOG_EESCHEMA_OPTIONS::SetGridSizes( const GridArray& grid_sizes, int grid_id ) void DIALOG_EESCHEMA_OPTIONS::SetGridSizes( const GRIDS& grid_sizes, int grid_id )
{ {
wxASSERT( grid_sizes.GetCount() > 0 ); wxASSERT( grid_sizes.size() > 0 );
int select = wxNOT_FOUND; int select = wxNOT_FOUND;
for( size_t i = 0; i < grid_sizes.GetCount(); i++ ) for( size_t i = 0; i < grid_sizes.size(); i++ )
{ {
wxString tmp; wxString tmp;
tmp.Printf( wxT( "%0.1f" ), grid_sizes[i].m_Size.x ); tmp.Printf( wxT( "%0.1f" ), grid_sizes[i].m_Size.x );

View File

@ -21,7 +21,7 @@ public:
m_choiceGridSize->SetSelection( select ); m_choiceGridSize->SetSelection( select );
} }
int GetGridSelection( void ) { return m_choiceGridSize->GetSelection(); } int GetGridSelection( void ) { return m_choiceGridSize->GetSelection(); }
void SetGridSizes( const GridArray& grid_sizes, int grid_id ); void SetGridSizes( const GRIDS& grid_sizes, int grid_id );
void SetLineWidth( int line_width ) void SetLineWidth( int line_width )
{ {

View File

@ -37,7 +37,7 @@ BEGIN_EVENT_TABLE( DIALOG_ERC, DIALOG_ERC_BASE )
DIALOG_ERC::ChangeErrorLevel ) DIALOG_ERC::ChangeErrorLevel )
END_EVENT_TABLE() END_EVENT_TABLE()
DIALOG_ERC::DIALOG_ERC( WinEDA_SchematicFrame* parent ) : DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
DIALOG_ERC_BASE( parent ) DIALOG_ERC_BASE( parent )
{ {
m_Parent = parent; m_Parent = parent;
@ -53,6 +53,7 @@ void DIALOG_ERC::Init()
SetFocus(); SetFocus();
m_Initialized = FALSE; m_Initialized = FALSE;
for( int ii = 0; ii < PIN_NMAX; ii++ ) for( int ii = 0; ii < PIN_NMAX; ii++ )
for( int jj = 0; jj < PIN_NMAX; jj++ ) for( int jj = 0; jj < PIN_NMAX; jj++ )
m_ButtonList[ii][jj] = NULL; m_ButtonList[ii][jj] = NULL;

View File

@ -32,7 +32,7 @@ class DIALOG_ERC : public DIALOG_ERC_BASE
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
private: private:
WinEDA_SchematicFrame* m_Parent; SCH_EDIT_FRAME* m_Parent;
wxBitmapButton* m_ButtonList[PIN_NMAX][PIN_NMAX]; wxBitmapButton* m_ButtonList[PIN_NMAX][PIN_NMAX];
bool m_Initialized; bool m_Initialized;
static bool m_writeErcFile; static bool m_writeErcFile;
@ -40,7 +40,7 @@ private:
public: public:
/// Constructors /// Constructors
DIALOG_ERC( WinEDA_SchematicFrame* parent ); DIALOG_ERC( SCH_EDIT_FRAME* parent );
void Init(); void Init();

View File

@ -44,12 +44,12 @@
class DIALOG_PLOT_SCHEMATIC_DXF : public DIALOG_PLOT_SCHEMATIC_DXF_BASE class DIALOG_PLOT_SCHEMATIC_DXF : public DIALOG_PLOT_SCHEMATIC_DXF_BASE
{ {
private: private:
WinEDA_SchematicFrame* m_Parent; SCH_EDIT_FRAME* m_Parent;
public: public:
/// Constructors /// Constructors
DIALOG_PLOT_SCHEMATIC_DXF( WinEDA_SchematicFrame* parent ); DIALOG_PLOT_SCHEMATIC_DXF( SCH_EDIT_FRAME* parent );
private: private:
static bool m_plotColorOpt; static bool m_plotColorOpt;
@ -74,14 +74,14 @@ bool DIALOG_PLOT_SCHEMATIC_DXF::m_plot_Sheet_Ref = true;
void WinEDA_SchematicFrame::ToPlot_DXF( wxCommandEvent& event ) void SCH_EDIT_FRAME::ToPlot_DXF( wxCommandEvent& event )
{ {
DIALOG_PLOT_SCHEMATIC_DXF DXF_frame( this ); DIALOG_PLOT_SCHEMATIC_DXF DXF_frame( this );
DXF_frame.ShowModal(); DXF_frame.ShowModal();
} }
DIALOG_PLOT_SCHEMATIC_DXF::DIALOG_PLOT_SCHEMATIC_DXF( WinEDA_SchematicFrame* parent ) DIALOG_PLOT_SCHEMATIC_DXF::DIALOG_PLOT_SCHEMATIC_DXF( SCH_EDIT_FRAME* parent )
: DIALOG_PLOT_SCHEMATIC_DXF_BASE( parent ) : DIALOG_PLOT_SCHEMATIC_DXF_BASE( parent )
{ {
m_Parent = parent; m_Parent = parent;
@ -143,7 +143,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::initOptVars()
void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( ) void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
{ {
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent; SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent;
SCH_SCREEN* screen = schframe->GetScreen(); SCH_SCREEN* screen = schframe->GetScreen();
SCH_SCREEN* oldscreen = screen; SCH_SCREEN* oldscreen = screen;
SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet(); SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet();
@ -241,7 +241,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
m_Parent->PlotWorkSheet( plotter, screen ); m_Parent->PlotWorkSheet( plotter, screen );
} }
PlotDrawlist( plotter, screen->EEDrawList ); PlotDrawlist( plotter, screen->GetDrawItems() );
/* fin */ /* fin */
plotter->end_plot(); plotter->end_plot();

View File

@ -75,10 +75,10 @@ static Ki_PageDescr* Plot_sheet_list[] =
class DIALOG_PLOT_SCHEMATIC_HPGL : public DIALOG_PLOT_SCHEMATIC_HPGL_BASE class DIALOG_PLOT_SCHEMATIC_HPGL : public DIALOG_PLOT_SCHEMATIC_HPGL_BASE
{ {
private: private:
WinEDA_SchematicFrame* m_Parent; SCH_EDIT_FRAME* m_Parent;
public: public:
DIALOG_PLOT_SCHEMATIC_HPGL( WinEDA_SchematicFrame* parent ); DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent );
private: private:
static PageFormatReq m_pageSizeSelect; static PageFormatReq m_pageSizeSelect;
@ -110,14 +110,14 @@ PageFormatReq DIALOG_PLOT_SCHEMATIC_HPGL:: m_pageSizeSelect = PAGE_DEFAULT;
bool DIALOG_PLOT_SCHEMATIC_HPGL::m_plot_Sheet_Ref = true; bool DIALOG_PLOT_SCHEMATIC_HPGL::m_plot_Sheet_Ref = true;
void WinEDA_SchematicFrame::ToPlot_HPGL( wxCommandEvent& event ) void SCH_EDIT_FRAME::ToPlot_HPGL( wxCommandEvent& event )
{ {
DIALOG_PLOT_SCHEMATIC_HPGL dlg( this ); DIALOG_PLOT_SCHEMATIC_HPGL dlg( this );
dlg.ShowModal(); dlg.ShowModal();
} }
DIALOG_PLOT_SCHEMATIC_HPGL::DIALOG_PLOT_SCHEMATIC_HPGL( WinEDA_SchematicFrame* parent ) DIALOG_PLOT_SCHEMATIC_HPGL::DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent )
:DIALOG_PLOT_SCHEMATIC_HPGL_BASE(parent) :DIALOG_PLOT_SCHEMATIC_HPGL_BASE(parent)
{ {
m_Parent = parent; m_Parent = parent;
@ -386,7 +386,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
if( m_plot_Sheet_Ref ) if( m_plot_Sheet_Ref )
m_Parent->PlotWorkSheet( plotter, screen ); m_Parent->PlotWorkSheet( plotter, screen );
PlotDrawlist( plotter, screen->EEDrawList ); PlotDrawlist( plotter, screen->GetDrawItems() );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;

View File

@ -50,12 +50,12 @@ enum PageFormatReq {
class DIALOG_PLOT_SCHEMATIC_PS : public DIALOG_PLOT_SCHEMATIC_PS_BASE class DIALOG_PLOT_SCHEMATIC_PS : public DIALOG_PLOT_SCHEMATIC_PS_BASE
{ {
private: private:
WinEDA_SchematicFrame* m_Parent; SCH_EDIT_FRAME* m_Parent;
public: public:
/// Constructors /// Constructors
DIALOG_PLOT_SCHEMATIC_PS( WinEDA_SchematicFrame* parent ); DIALOG_PLOT_SCHEMATIC_PS( SCH_EDIT_FRAME* parent );
private: private:
static bool m_plotColorOpt; static bool m_plotColorOpt;
@ -80,7 +80,7 @@ int DIALOG_PLOT_SCHEMATIC_PS:: m_pageSizeSelect = PAGE_SIZE_AUTO;
bool DIALOG_PLOT_SCHEMATIC_PS::m_plot_Sheet_Ref = true; bool DIALOG_PLOT_SCHEMATIC_PS::m_plot_Sheet_Ref = true;
void WinEDA_SchematicFrame::ToPlot_PS( wxCommandEvent& event ) void SCH_EDIT_FRAME::ToPlot_PS( wxCommandEvent& event )
{ {
DIALOG_PLOT_SCHEMATIC_PS dlg( this ); DIALOG_PLOT_SCHEMATIC_PS dlg( this );
@ -88,7 +88,7 @@ void WinEDA_SchematicFrame::ToPlot_PS( wxCommandEvent& event )
} }
DIALOG_PLOT_SCHEMATIC_PS::DIALOG_PLOT_SCHEMATIC_PS( WinEDA_SchematicFrame* parent ) : DIALOG_PLOT_SCHEMATIC_PS::DIALOG_PLOT_SCHEMATIC_PS( SCH_EDIT_FRAME* parent ) :
DIALOG_PLOT_SCHEMATIC_PS_BASE( parent ) DIALOG_PLOT_SCHEMATIC_PS_BASE( parent )
{ {
m_Parent = parent; m_Parent = parent;
@ -290,7 +290,7 @@ void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
m_Parent->PlotWorkSheet( plotter, screen ); m_Parent->PlotWorkSheet( plotter, screen );
} }
PlotDrawlist( plotter, screen->EEDrawList ); PlotDrawlist( plotter, screen->GetDrawItems() );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;

View File

@ -87,7 +87,7 @@ BEGIN_EVENT_TABLE( SCH_PREVIEW_FRAME, wxPreviewFrame )
END_EVENT_TABLE() END_EVENT_TABLE()
DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* aParent ) : DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent ) :
DIALOG_PRINT_USING_PRINTER_BASE( aParent ) DIALOG_PRINT_USING_PRINTER_BASE( aParent )
{ {
wxASSERT( aParent != NULL ); wxASSERT( aParent != NULL );
@ -97,15 +97,15 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* a
} }
WinEDA_SchematicFrame* DIALOG_PRINT_USING_PRINTER::GetParent() const SCH_EDIT_FRAME* DIALOG_PRINT_USING_PRINTER::GetParent() const
{ {
return ( WinEDA_SchematicFrame* ) wxWindow::GetParent(); return ( SCH_EDIT_FRAME* ) wxWindow::GetParent();
} }
void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
{ {
WinEDA_SchematicFrame* parent = GetParent(); SCH_EDIT_FRAME* parent = GetParent();
if ( GetSizer() ) if ( GetSizer() )
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
@ -129,7 +129,7 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
{ {
WinEDA_SchematicFrame* parent = GetParent(); SCH_EDIT_FRAME* parent = GetParent();
if( !IsIconized() ) if( !IsIconized() )
{ {
@ -148,7 +148,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event )
*/ */
void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
{ {
WinEDA_SchematicFrame* parent = GetParent(); SCH_EDIT_FRAME* parent = GetParent();
wxPageSetupDialog pageSetupDialog( this, &parent->GetPageSetupData() ); wxPageSetupDialog pageSetupDialog( this, &parent->GetPageSetupData() );
@ -162,7 +162,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
*/ */
void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
{ {
WinEDA_SchematicFrame* parent = GetParent(); SCH_EDIT_FRAME* parent = GetParent();
parent->SetPrintMonochrome( m_checkMonochrome->IsChecked() ); parent->SetPrintMonochrome( m_checkMonochrome->IsChecked() );
parent->SetPrintSheetReference( m_checkReference->IsChecked() ); parent->SetPrintSheetReference( m_checkReference->IsChecked() );
@ -191,7 +191,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
{ {
WinEDA_SchematicFrame* parent = GetParent(); SCH_EDIT_FRAME* parent = GetParent();
parent->SetPrintMonochrome( m_checkMonochrome->IsChecked() ); parent->SetPrintMonochrome( m_checkMonochrome->IsChecked() );
parent->SetPrintSheetReference( m_checkReference->IsChecked() ); parent->SetPrintSheetReference( m_checkReference->IsChecked() );
@ -221,7 +221,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
bool SCH_PRINTOUT::OnPrintPage( int page ) bool SCH_PRINTOUT::OnPrintPage( int page )
{ {
wxString msg; wxString msg;
WinEDA_SchematicFrame* parent = m_Parent->GetParent(); SCH_EDIT_FRAME* parent = m_Parent->GetParent();
msg.Printf( _( "Print page %d" ), page ); msg.Printf( _( "Print page %d" ), page );
parent->ClearMsgPanel(); parent->ClearMsgPanel();
parent->AppendMsgPanel( msg, wxEmptyString, CYAN ); parent->AppendMsgPanel( msg, wxEmptyString, CYAN );
@ -285,7 +285,7 @@ bool SCH_PRINTOUT::OnBeginDocument( int startPage, int endPage )
return false; return false;
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
WinEDA_SchematicFrame* parent = m_Parent->GetParent(); SCH_EDIT_FRAME* parent = m_Parent->GetParent();
wxLogDebug( wxT( "Printer name: " ) + wxLogDebug( wxT( "Printer name: " ) +
parent->GetPageSetupData().GetPrintData().GetPrinterName() ); parent->GetPageSetupData().GetPrintData().GetPrinterName() );
wxLogDebug( wxT( "Paper ID: %d" ), wxLogDebug( wxT( "Paper ID: %d" ),
@ -315,7 +315,7 @@ void SCH_PRINTOUT::DrawPage()
EDA_Rect oldClipBox; EDA_Rect oldClipBox;
wxRect fitRect; wxRect fitRect;
wxDC* dc = GetDC(); wxDC* dc = GetDC();
WinEDA_SchematicFrame* parent = m_Parent->GetParent(); SCH_EDIT_FRAME* parent = m_Parent->GetParent();
WinEDA_DrawPanel* panel = parent->DrawPanel; WinEDA_DrawPanel* panel = parent->DrawPanel;
wxBusyCursor dummy; wxBusyCursor dummy;

View File

@ -14,10 +14,10 @@
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE
{ {
public: public:
DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* aParent ); DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent );
~DIALOG_PRINT_USING_PRINTER() {}; ~DIALOG_PRINT_USING_PRINTER() {};
WinEDA_SchematicFrame* GetParent() const; SCH_EDIT_FRAME* GetParent() const;
private: private:
void OnCloseWindow( wxCloseEvent& event ); void OnCloseWindow( wxCloseEvent& event );

View File

@ -24,7 +24,7 @@ static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/* Prepare the displacement of the text being edited. /* Prepare the displacement of the text being edited.
*/ */
/******************************************************************************/ /******************************************************************************/
void WinEDA_SchematicFrame::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC ) void SCH_EDIT_FRAME::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC )
{ {
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
@ -86,7 +86,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC )
/******************************************************************************/ /******************************************************************************/
/* Edit the field Field (text, size) */ /* Edit the field Field (text, size) */
/******************************************************************************/ /******************************************************************************/
void WinEDA_SchematicFrame::EditCmpFieldText( SCH_FIELD* Field, wxDC* DC ) void SCH_EDIT_FRAME::EditCmpFieldText( SCH_FIELD* Field, wxDC* DC )
{ {
int fieldNdx, flag; int fieldNdx, flag;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
@ -189,7 +189,7 @@ static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
wxPoint pos; wxPoint pos;
int fieldNdx; int fieldNdx;
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->GetParent(); SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) panel->GetParent();
SCH_FIELD* currentField = frame->GetCurrentField(); SCH_FIELD* currentField = frame->GetCurrentField();
if( currentField == NULL ) if( currentField == NULL )
@ -220,7 +220,7 @@ static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) Panel->GetParent(); SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) Panel->GetParent();
SCH_FIELD* currentField = frame->GetCurrentField(); SCH_FIELD* currentField = frame->GetCurrentField();
if( currentField ) if( currentField )
@ -238,7 +238,7 @@ static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
void WinEDA_SchematicFrame::RotateCmpField( SCH_FIELD* Field, wxDC* DC ) void SCH_EDIT_FRAME::RotateCmpField( SCH_FIELD* Field, wxDC* DC )
{ {
int fieldNdx, flag; int fieldNdx, flag;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
@ -284,7 +284,7 @@ void WinEDA_SchematicFrame::RotateCmpField( SCH_FIELD* Field, wxDC* DC )
/****************************************************************************/ /****************************************************************************/
/* Edit the component text reference*/ /* Edit the component text reference*/
/****************************************************************************/ /****************************************************************************/
void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC ) void SCH_EDIT_FRAME::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC )
{ {
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
int flag = 0; int flag = 0;
@ -331,7 +331,7 @@ void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC
/*****************************************************************************/ /*****************************************************************************/
/* Routine to change the selected text */ /* Routine to change the selected text */
/*****************************************************************************/ /*****************************************************************************/
void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC ) void SCH_EDIT_FRAME::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
{ {
wxString message; wxString message;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
@ -373,7 +373,7 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
} }
void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC ) void SCH_EDIT_FRAME::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC )
{ {
wxString message; wxString message;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;

View File

@ -31,7 +31,7 @@ static bool lastTextBold = false;
static bool lastTextItalic = false; static bool lastTextItalic = false;
void WinEDA_SchematicFrame::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC ) void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
{ {
if( TextStruct == NULL ) if( TextStruct == NULL )
return; return;
@ -75,7 +75,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
} }
void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ) void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
{ {
if( TextStruct == NULL ) if( TextStruct == NULL )
TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->m_Curseur, TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->m_Curseur,
@ -116,7 +116,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
/* Routine to create new text struct (GraphicText, label or Glabel). /* Routine to create new text struct (GraphicText, label or Glabel).
*/ */
SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type )
{ {
SCH_TEXT* NewText = NULL; SCH_TEXT* NewText = NULL;
@ -143,8 +143,7 @@ SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
break; break;
default: default:
DisplayError( this, DisplayError( this, wxT( "SCH_EDIT_FRAME::CreateNewText() Internal error" ) );
wxT( "WinEDA_SchematicFrame::CreateNewText() Internal error" ) );
return NULL; return NULL;
} }
@ -265,7 +264,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
* A new test, label or hierarchical or global label is created from the old text. * A new test, label or hierarchical or global label is created from the old text.
* the old text is deleted * the old text is deleted
*/ */
void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype ) void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
{ {
if( Text == NULL ) if( Text == NULL )
return; return;
@ -315,8 +314,8 @@ void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newty
/* add the new text in linked list if old text is in list */ /* add the new text in linked list if old text is in list */
if( (flags & IS_NEW) == 0 ) if( (flags & IS_NEW) == 0 )
{ {
newtext->SetNext( GetScreen()->EEDrawList ); newtext->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->EEDrawList = newtext; GetScreen()->SetDrawItems( newtext );
OnModify(); OnModify();
} }

View File

@ -19,7 +19,7 @@
* *
* Clear all already loaded libraries and load all of the project libraries. * Clear all already loaded libraries and load all of the project libraries.
*/ */
void WinEDA_SchematicFrame::LoadLibraries( void ) void SCH_EDIT_FRAME::LoadLibraries( void )
{ {
size_t ii; size_t ii;
wxFileName fn; wxFileName fn;

View File

@ -22,11 +22,10 @@
#include "build_version.h" #include "build_version.h"
static EDA_BaseStruct* HighLightStruct = NULL; static EDA_ITEM* HighLightStruct = NULL;
void DrawDanglingSymbol( WinEDA_DrawPanel* panel, wxDC* DC, void DrawDanglingSymbol( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& pos, int Color )
const wxPoint& pos, int Color )
{ {
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
@ -40,7 +39,7 @@ void DrawDanglingSymbol( WinEDA_DrawPanel* panel, wxDC* DC,
} }
void SetHighLightStruct( EDA_BaseStruct* HighLight ) void SetHighLightStruct( EDA_ITEM* HighLight )
{ {
HighLightStruct = HighLight; HighLightStruct = HighLight;
} }
@ -49,7 +48,7 @@ void SetHighLightStruct( EDA_BaseStruct* HighLight )
/* /*
* Redraws only the active window which is assumed to be whole visible. * Redraws only the active window which is assumed to be whole visible.
*/ */
void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{ {
wxString title; wxString title;
@ -60,8 +59,7 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DrawPanel->DrawBackGround( DC ); DrawPanel->DrawBackGround( DC );
RedrawStructList( DrawPanel, DC, GetScreen()->EEDrawList, RedrawStructList( DrawPanel, DC, GetScreen()->GetDrawItems(), GR_DEFAULT_DRAWMODE );
GR_DEFAULT_DRAWMODE );
TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness ); TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness );
@ -118,13 +116,12 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not used here) * @param aData = a pointer on an auxiliary data (not used here)
*/ */
void WinEDA_SchematicFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMask,
int aPrintMask, bool aPrintMirrorMode, bool aPrintMirrorMode, void* aData)
void * aData)
{ {
wxBeginBusyCursor(); wxBeginBusyCursor();
RedrawStructList( DrawPanel, aDC, ActiveScreen->EEDrawList, GR_COPY ); RedrawStructList( DrawPanel, aDC, (SCH_ITEM*) ActiveScreen->GetDrawItems(), GR_COPY );
if( aPrint_Sheet_Ref ) if( aPrint_Sheet_Ref )
TraceWorkSheet( aDC, ActiveScreen, g_DrawDefaultLineThickness ); TraceWorkSheet( aDC, ActiveScreen, g_DrawDefaultLineThickness );
@ -145,7 +142,7 @@ void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC,
if( !(Structlist->m_Flags & IS_MOVED) ) if( !(Structlist->m_Flags & IS_MOVED) )
{ {
// uncomment line below when there is a virtual // uncomment line below when there is a virtual
// EDA_BaseStruct::GetBoundingBox() // EDA_ITEM::GetBoundingBox()
// if( panel->m_ClipBox.Intersects( Structs->GetBoundingBox() // if( panel->m_ClipBox.Intersects( Structs->GetBoundingBox()
// ) ) // ) )
RedrawOneStruct( panel, DC, Structlist, DrawMode, Color ); RedrawOneStruct( panel, DC, Structlist, DrawMode, Color );

View File

@ -106,7 +106,7 @@ IMPLEMENT_APP( WinEDA_App )
void WinEDA_App::MacOpenFile( const wxString &fileName ) void WinEDA_App::MacOpenFile( const wxString &fileName )
{ {
wxFileName filename = fileName; wxFileName filename = fileName;
WinEDA_SchematicFrame * frame = ((WinEDA_SchematicFrame*) GetTopWindow()); SCH_EDIT_FRAME* frame = ((SCH_EDIT_FRAME*) GetTopWindow());
if( !frame ) if( !frame )
return; return;
@ -128,7 +128,7 @@ bool WinEDA_App::OnInit()
#endif /* __WXMAC__ */ #endif /* __WXMAC__ */
wxFileName filename; wxFileName filename;
WinEDA_SchematicFrame* frame = NULL; SCH_EDIT_FRAME* frame = NULL;
InitEDA_Appl( wxT( "EESchema" ), APP_TYPE_EESCHEMA ); InitEDA_Appl( wxT( "EESchema" ), APP_TYPE_EESCHEMA );
@ -154,8 +154,7 @@ bool WinEDA_App::OnInit()
ReadHotkeyConfig( wxT("SchematicFrame"), s_Eeschema_Hokeys_Descr ); ReadHotkeyConfig( wxT("SchematicFrame"), s_Eeschema_Hokeys_Descr );
// Create main frame (schematic frame) : // Create main frame (schematic frame) :
frame = new WinEDA_SchematicFrame( NULL, wxT( "EESchema" ), frame = new SCH_EDIT_FRAME( NULL, wxT( "EESchema" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) );
wxPoint( 0, 0 ), wxSize( 600, 400 ) );
SetTopWindow( frame ); SetTopWindow( frame );
frame->Show( TRUE ); frame->Show( TRUE );

View File

@ -36,7 +36,7 @@
void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event ) void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
{ {
DIALOG_EESCHEMA_CONFIG CfgFrame( (WinEDA_SchematicFrame *)GetParent(), this ); DIALOG_EESCHEMA_CONFIG CfgFrame( (SCH_EDIT_FRAME *)GetParent(), this );
CfgFrame.ShowModal(); CfgFrame.ShowModal();
} }
@ -54,7 +54,7 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
wxFileName fn; wxFileName fn;
WinEDA_SchematicFrame * schFrame = ( WinEDA_SchematicFrame * ) GetParent(); SCH_EDIT_FRAME* schFrame = ( SCH_EDIT_FRAME* ) GetParent();
switch( id ) switch( id )
{ {
@ -103,7 +103,7 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
} }
void WinEDA_SchematicFrame::OnColorConfig( wxCommandEvent& aEvent ) void SCH_EDIT_FRAME::OnColorConfig( wxCommandEvent& aEvent )
{ {
DIALOG_COLOR_CONFIG dlg( this ); DIALOG_COLOR_CONFIG dlg( this );
@ -111,7 +111,7 @@ void WinEDA_SchematicFrame::OnColorConfig( wxCommandEvent& aEvent )
} }
void WinEDA_SchematicFrame::InstallConfigFrame( wxCommandEvent& event ) void SCH_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
{ {
DIALOG_EESCHEMA_CONFIG CfgFrame( this, this ); DIALOG_EESCHEMA_CONFIG CfgFrame( this, this );
@ -119,7 +119,7 @@ void WinEDA_SchematicFrame::InstallConfigFrame( wxCommandEvent& event )
} }
void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event ) void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
wxFileName fn; wxFileName fn;
@ -166,21 +166,20 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
break; break;
default: default:
DisplayError( this, wxT( "WinEDA_SchematicFrame::Process_Config error" ) ); DisplayError( this, wxT( "SCH_EDIT_FRAME::Process_Config error" ) );
} }
} }
void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
{ {
wxArrayString units; wxArrayString units;
GridArray& grid_list = GetBaseScreen()->m_GridList; GRIDS grid_list;
GetBaseScreen()->GetGrids( grid_list );
DIALOG_EESCHEMA_OPTIONS dlg( this ); DIALOG_EESCHEMA_OPTIONS dlg( this );
wxLogDebug( wxT( "Current grid array index %d." ),
grid_list.Index( GetBaseScreen()->GetGrid() ) );
units.Add( GetUnitsLabel( INCHES ) ); units.Add( GetUnitsLabel( INCHES ) );
units.Add( GetUnitsLabel( MILLIMETRES ) ); units.Add( GetUnitsLabel( MILLIMETRES ) );
@ -204,8 +203,7 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event )
for( unsigned i=0; i<tfnames.size(); ++i ) for( unsigned i=0; i<tfnames.size(); ++i )
{ {
D(printf("dlg.SetFieldName(%d, '%s')\n", D(printf("dlg.SetFieldName(%d, '%s')\n", i, CONV_TO_UTF8( tfnames[i].m_Name) );)
i, CONV_TO_UTF8( tfnames[i].m_Name) );)
dlg.SetFieldName( i, tfnames[i].m_Name ); dlg.SetFieldName( i, tfnames[i].m_Name );
} }
@ -215,8 +213,7 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event )
g_UserUnit = (UserUnitType)dlg.GetUnitsSelection(); g_UserUnit = (UserUnitType)dlg.GetUnitsSelection();
GetBaseScreen()->SetGrid( GetBaseScreen()->SetGrid( grid_list[ (size_t) dlg.GetGridSelection() ].m_Size );
grid_list[ (size_t) dlg.GetGridSelection() ].m_Size );
g_DrawDefaultLineThickness = dlg.GetLineWidth(); g_DrawDefaultLineThickness = dlg.GetLineWidth();
g_DefaultTextLabelSize = dlg.GetTextSize(); g_DefaultTextLabelSize = dlg.GetTextSize();
@ -235,6 +232,7 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event )
// look like the component field property editor, showing visibility and value also // look like the component field property editor, showing visibility and value also
DeleteAllTemplateFieldNames(); DeleteAllTemplateFieldNames();
for( int i=0; i<8; ++i ) // no. fields in this dialog window for( int i=0; i<8; ++i ) // no. fields in this dialog window
{ {
templateFieldName = dlg.GetFieldName( i ); templateFieldName = dlg.GetFieldName( i );
@ -262,7 +260,7 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event )
* to define local variables. The old method of statically building the array * to define local variables. The old method of statically building the array
* at compile time requiring global variable definitions. * at compile time requiring global variable definitions.
*/ */
PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetProjectFileParameters( void ) PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters( void )
{ {
if( !m_projectFileParams.empty() ) if( !m_projectFileParams.empty() )
return m_projectFileParams; return m_projectFileParams;
@ -349,8 +347,7 @@ PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetProjectFileParameters( void )
/* /*
* Load the Kicad project file (*.pro) settings specific to EESchema. * Load the Kicad project file (*.pro) settings specific to EESchema.
*/ */
bool WinEDA_SchematicFrame::LoadProjectFile( const wxString& CfgFileName, bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& CfgFileName, bool ForceRereadConfig )
bool ForceRereadConfig )
{ {
wxFileName fn; wxFileName fn;
bool IsRead = TRUE; bool IsRead = TRUE;
@ -396,7 +393,7 @@ bool WinEDA_SchematicFrame::LoadProjectFile( const wxString& CfgFileName,
/* /*
* Save the Kicad project file (*.pro) settings specific to EESchema. * Save the Kicad project file (*.pro) settings specific to EESchema.
*/ */
void WinEDA_SchematicFrame::SaveProjectFile( wxWindow* displayframe, bool askoverwrite ) void SCH_EDIT_FRAME::SaveProjectFile( wxWindow* displayframe, bool askoverwrite )
{ {
wxFileName fn; wxFileName fn;
@ -457,7 +454,7 @@ static const wxString SimulatorCommandEntry( wxT( "SimCmdLine" ) );
* global variables or move them to the object class where they are * global variables or move them to the object class where they are
* used. * used.
*/ */
PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetConfigurationSettings( void ) PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void )
{ {
if( !m_configSettings.empty() ) if( !m_configSettings.empty() )
return m_configSettings; return m_configSettings;
@ -549,7 +546,7 @@ PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetConfigurationSettings( void )
/* /*
* Load the EESchema configuration parameters. * Load the EESchema configuration parameters.
*/ */
void WinEDA_SchematicFrame::LoadSettings() void SCH_EDIT_FRAME::LoadSettings()
{ {
wxASSERT( wxGetApp().m_EDA_Config != NULL ); wxASSERT( wxGetApp().m_EDA_Config != NULL );
@ -647,7 +644,7 @@ void WinEDA_SchematicFrame::LoadSettings()
/* /*
* Save the EESchema configuration parameters. * Save the EESchema configuration parameters.
*/ */
void WinEDA_SchematicFrame::SaveSettings() void SCH_EDIT_FRAME::SaveSettings()
{ {
wxASSERT( wxGetApp().m_EDA_Config != NULL ); wxASSERT( wxGetApp().m_EDA_Config != NULL );

View File

@ -169,7 +169,7 @@ int TestDuplicateSheetNames( bool aCreateMarker )
Screen != NULL; Screen != NULL;
Screen = ScreenList.GetNext() ) Screen = ScreenList.GetNext() )
{ {
for( SCH_ITEM* ref_item = Screen->EEDrawList; for( SCH_ITEM* ref_item = Screen->GetDrawItems();
ref_item != NULL; ref_item != NULL;
ref_item = ref_item->Next() ) ref_item = ref_item->Next() )
{ {
@ -199,9 +199,10 @@ int TestDuplicateSheetNames( bool aCreateMarker )
( (SCH_SHEET*) item_to_test )->m_Pos ); ( (SCH_SHEET*) item_to_test )->m_Pos );
Marker->SetMarkerType( MARK_ERC ); Marker->SetMarkerType( MARK_ERC );
Marker->SetErrorLevel( ERR ); Marker->SetErrorLevel( ERR );
Marker->SetNext( Screen->EEDrawList ); Marker->SetNext( Screen->GetDrawItems() );
Screen->EEDrawList = Marker; Screen->SetDrawItems( Marker );
} }
err_count++; err_count++;
} }
} }
@ -235,12 +236,13 @@ void Diagnose( WinEDA_DrawPanel* aPanel,
Marker->SetMarkerType( MARK_ERC ); Marker->SetMarkerType( MARK_ERC );
Marker->SetErrorLevel( WAR ); Marker->SetErrorLevel( WAR );
screen = aNetItemRef->m_SheetList.LastScreen(); screen = aNetItemRef->m_SheetList.LastScreen();
Marker->SetNext( screen->EEDrawList ); Marker->SetNext( screen->GetDrawItems() );
screen->EEDrawList = Marker; screen->SetDrawItems( Marker );
g_EESchemaVar.NbErrorErc++; g_EESchemaVar.NbErrorErc++;
g_EESchemaVar.NbWarningErc++; g_EESchemaVar.NbWarningErc++;
wxString msg; wxString msg;
if( aMinConn < 0 ) if( aMinConn < 0 )
{ {
if( (aNetItemRef->m_Type == NET_HIERLABEL) if( (aNetItemRef->m_Type == NET_HIERLABEL)
@ -271,6 +273,7 @@ void Diagnose( WinEDA_DrawPanel* aPanel,
memcpy( ascii_buf, &aNetItemRef->m_PinNum, 4 ); memcpy( ascii_buf, &aNetItemRef->m_PinNum, 4 );
string_pinnum = CONV_FROM_UTF8( ascii_buf ); string_pinnum = CONV_FROM_UTF8( ascii_buf );
cmp_ref = wxT( "?" ); cmp_ref = wxT( "?" );
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link ) if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
cmp_ref = ( (SCH_COMPONENT*) aNetItemRef->m_Link )->GetRef( &aNetItemRef->m_SheetList ); cmp_ref = ( (SCH_COMPONENT*) aNetItemRef->m_Link )->GetRef( &aNetItemRef->m_SheetList );

View File

@ -17,10 +17,10 @@
#include "sch_text.h" #include "sch_text.h"
/** Event function WinEDA_SchematicFrame::OnCopySchematicItemRequest /** Event function SCH_EDIT_FRAME::OnCopySchematicItemRequest
* duplicate the current located item * duplicate the current located item
*/ */
void WinEDA_SchematicFrame::OnCopySchematicItemRequest( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
{ {
SCH_ITEM * curr_item = GetScreen()->GetCurItem(); SCH_ITEM * curr_item = GetScreen()->GetCurItem();

View File

@ -23,7 +23,7 @@
* FileSave controls how the file is to be saved - under what name. * * FileSave controls how the file is to be saved - under what name. *
* Returns TRUE if the file has been saved. * * Returns TRUE if the file has been saved. *
*****************************************************************************/ *****************************************************************************/
bool WinEDA_SchematicFrame::SaveEEFile( SCH_SCREEN* screen, int FileSave ) bool SCH_EDIT_FRAME::SaveEEFile( SCH_SCREEN* screen, int FileSave )
{ {
wxString msg; wxString msg;
wxFileName schematicFileName, backupFileName; wxFileName schematicFileName, backupFileName;
@ -100,7 +100,7 @@ bool WinEDA_SchematicFrame::SaveEEFile( SCH_SCREEN* screen, int FileSave )
/* Commands to save project or the current page. /* Commands to save project or the current page.
*/ */
void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event ) void SCH_EDIT_FRAME::Save_File( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
@ -119,7 +119,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
break; break;
default: default:
DisplayError( this, wxT( "WinEDA_SchematicFrame::Save_File Internal Error" ) ); DisplayError( this, wxT( "SCH_EDIT_FRAME::Save_File Internal Error" ) );
break; break;
} }
} }
@ -131,7 +131,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
* Schematic root file and its subhierarchies, the configuration and the libs * Schematic root file and its subhierarchies, the configuration and the libs
* which are not already loaded) * which are not already loaded)
*/ */
bool WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNew ) bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& FileName, bool IsNew )
{ {
SCH_SCREEN* screen; SCH_SCREEN* screen;
wxString FullFileName, msg; wxString FullFileName, msg;
@ -308,14 +308,13 @@ bool WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsN
* *
* The library archive name is <root_name>-cache.lib * The library archive name is <root_name>-cache.lib
*/ */
void WinEDA_SchematicFrame::SaveProject() void SCH_EDIT_FRAME::SaveProject()
{ {
SCH_SCREEN* screen; SCH_SCREEN* screen;
wxFileName fn; wxFileName fn;
SCH_SCREENS ScreenList; SCH_SCREENS ScreenList;
for( screen = ScreenList.GetFirst(); screen != NULL; for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
screen = ScreenList.GetNext() )
{ {
D( printf( "SaveEEFile, %s\n", CONV_TO_UTF8( screen->m_FileName ) ); ) D( printf( "SaveEEFile, %s\n", CONV_TO_UTF8( screen->m_FileName ) ); )
SaveEEFile( screen, FILE_SAVE_AS ); SaveEEFile( screen, FILE_SAVE_AS );

View File

@ -33,7 +33,7 @@
#include "dialogs/dialog_schematic_find.h" #include "dialogs/dialog_schematic_find.h"
void WinEDA_SchematicFrame::OnFindDrcMarker( wxFindDialogEvent& event ) void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
{ {
static SCH_MARKER* lastMarker = NULL; static SCH_MARKER* lastMarker = NULL;
@ -99,7 +99,7 @@ void WinEDA_SchematicFrame::OnFindDrcMarker( wxFindDialogEvent& event )
* >= 4 => unused (same as 0) * >= 4 => unused (same as 0)
* @param mouseWarp If true, then move the mouse cursor to the item. * @param mouseWarp If true, then move the mouse cursor to the item.
*/ */
SCH_ITEM* WinEDA_SchematicFrame::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,
const wxString& text_to_find, const wxString& text_to_find,
@ -179,6 +179,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem( const wxString& component
if( Component ) if( Component )
{ {
sheet = SheetWithComponentFound; sheet = SheetWithComponentFound;
if( sheet != GetSheet() ) if( sheet != GetSheet() )
{ {
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() ); sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
@ -294,7 +295,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem( const wxString& component
* *
* @param event - Find dialog event containing the find parameters. * @param event - Find dialog event containing the find parameters.
*/ */
void WinEDA_SchematicFrame::OnFindSchematicItem( wxFindDialogEvent& event ) 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
@ -318,7 +319,8 @@ void WinEDA_SchematicFrame::OnFindSchematicItem( wxFindDialogEvent& event )
} }
else else
{ {
lastItem = schematic.MatchNextItem( searchCriteria, &sheetFoundIn, lastItem, &lastItemPosition ); lastItem = schematic.MatchNextItem( searchCriteria, &sheetFoundIn, lastItem,
&lastItemPosition );
} }
if( lastItem != NULL ) if( lastItem != NULL )

View File

@ -32,7 +32,7 @@ class TRANSFORM;
#define HIGHLIGHT_COLOR WHITE #define HIGHLIGHT_COLOR WHITE
/* Used for EDA_BaseStruct, .m_Select member */ /* Used for EDA_ITEM, .m_Select member */
#define IS_SELECTED 1 #define IS_SELECTED 1
#define TEXT_NO_VISIBLE 1 #define TEXT_NO_VISIBLE 1

View File

@ -29,7 +29,7 @@ static TRANSFORM OldTransform;
static wxPoint OldPos; static wxPoint OldPos;
wxString WinEDA_SchematicFrame::SelectFromLibBrowser( void ) wxString SCH_EDIT_FRAME::SelectFromLibBrowser( void )
{ {
wxSemaphore semaphore( 0, 1 ); wxSemaphore semaphore( 0, 1 );
@ -61,7 +61,7 @@ wxString WinEDA_SchematicFrame::SelectFromLibBrowser( void )
* if libname != "", search in lib "libname" * if libname != "", search in lib "libname"
* else search in all loaded libs * else search in all loaded libs
*/ */
SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
const wxString& libname, const wxString& libname,
wxArrayString& HistoryList, wxArrayString& HistoryList,
bool UseLibBrowser ) bool UseLibBrowser )
@ -135,6 +135,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
AllowWildSeach = FALSE; AllowWildSeach = FALSE;
keys = Name.AfterFirst( '=' ); keys = Name.AfterFirst( '=' );
Name = DataBaseGetName( this, keys, Name ); Name = DataBaseGetName( this, keys, Name );
if( Name.IsEmpty() ) if( Name.IsEmpty() )
{ {
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
@ -145,6 +146,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
else if( Name == wxT( "*" ) ) else if( Name == wxT( "*" ) )
{ {
AllowWildSeach = FALSE; AllowWildSeach = FALSE;
if( GetNameOfPartToLoad( this, Library, Name ) == 0 ) if( GetNameOfPartToLoad( this, Library, Name ) == 0 )
{ {
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
@ -186,6 +188,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( Entry == NULL ) if( Entry == NULL )
{ {
msg = _( "Failed to find part " ) + Name + _( " in library" ); msg = _( "Failed to find part " ) + Name + _( " in library" );
@ -244,8 +247,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
* *
** If DC == NULL: no repaint ** If DC == NULL: no repaint
*/ */
void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, void SCH_EDIT_FRAME::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, wxDC* DC, int type_rotate )
wxDC* DC, int type_rotate )
{ {
if( DrawComponent == NULL ) if( DrawComponent == NULL )
return; return;
@ -254,6 +256,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
if( DC ) if( DC )
{ {
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
if( DrawComponent->m_Flags ) if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) ); DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
else else
@ -270,12 +273,11 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
if( DrawComponent->m_Flags ) if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint(0,0) ); DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint(0,0) );
else else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->GetDrawItems(), DC );
OnModify( ); OnModify( );
} }
@ -312,8 +314,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
/* /*
* Handle select part in multi-part component. * Handle select part in multi-part component.
*/ */
void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent, void SCH_EDIT_FRAME::SelPartUnit( SCH_COMPONENT* DrawComponent, int unit, wxDC* DC )
int unit, wxDC* DC )
{ {
int m_UnitCount; int m_UnitCount;
LIB_COMPONENT* LibEntry; LIB_COMPONENT* LibEntry;
@ -333,8 +334,10 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
if( DrawComponent->m_Multi == unit ) if( DrawComponent->m_Multi == unit )
return; return;
if( unit < 1 ) if( unit < 1 )
unit = 1; unit = 1;
if( unit > m_UnitCount ) if( unit > m_UnitCount )
unit = m_UnitCount; unit = m_UnitCount;
@ -351,16 +354,14 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
if( DrawComponent->m_Flags ) if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) ); DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
else else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
GR_DEFAULT_DRAWMODE );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->GetDrawItems(), DC );
OnModify( ); OnModify( );
} }
void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent, void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC )
wxDC* DC )
{ {
LIB_COMPONENT* LibEntry; LIB_COMPONENT* LibEntry;
@ -400,15 +401,16 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ),
GR_DEFAULT_DRAWMODE ); GR_DEFAULT_DRAWMODE );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->GetDrawItems(), DC );
OnModify( ); OnModify( );
} }
void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component, wxDC* DC ) void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* Component, wxDC* DC )
{ {
if( Component == NULL ) if( Component == NULL )
return; return;
if( Component->Type() != TYPE_SCH_COMPONENT ) if( Component->Type() != TYPE_SCH_COMPONENT )
return; return;

View File

@ -19,7 +19,7 @@
#include "wx/treectrl.h" #include "wx/treectrl.h"
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame ); static bool UpdateScreenFromSheet( SCH_EDIT_FRAME* frame );
enum enum
{ {
@ -79,7 +79,7 @@ WinEDA_Tree::WinEDA_Tree( WinEDA_HierFrame* parent ) :
class WinEDA_HierFrame : public wxDialog class WinEDA_HierFrame : public wxDialog
{ {
public: public:
WinEDA_SchematicFrame* m_Parent; SCH_EDIT_FRAME* m_Parent;
WinEDA_Tree* m_Tree; WinEDA_Tree* m_Tree;
int m_nbsheets; int m_nbsheets;
wxDC* m_DC; wxDC* m_DC;
@ -89,7 +89,7 @@ private:
int maxposx; int maxposx;
public: public:
WinEDA_HierFrame( WinEDA_SchematicFrame* parent, wxDC* DC, const wxPoint& pos ); WinEDA_HierFrame( SCH_EDIT_FRAME* parent, wxDC* DC, const wxPoint& pos );
void BuildSheetsTree( SCH_SHEET_PATH* list, wxTreeItemId* previousmenu ); void BuildSheetsTree( SCH_SHEET_PATH* list, wxTreeItemId* previousmenu );
~WinEDA_HierFrame(); ~WinEDA_HierFrame();
@ -108,7 +108,7 @@ BEGIN_EVENT_TABLE( WinEDA_HierFrame, wxDialog )
END_EVENT_TABLE() END_EVENT_TABLE()
void WinEDA_SchematicFrame::InstallHierarchyFrame( wxDC* DC, wxPoint& pos ) void SCH_EDIT_FRAME::InstallHierarchyFrame( wxDC* DC, wxPoint& pos )
{ {
WinEDA_HierFrame* treeframe = new WinEDA_HierFrame( this, DC, pos ); WinEDA_HierFrame* treeframe = new WinEDA_HierFrame( this, DC, pos );
@ -117,10 +117,8 @@ void WinEDA_SchematicFrame::InstallHierarchyFrame( wxDC* DC, wxPoint& pos )
} }
WinEDA_HierFrame::WinEDA_HierFrame( WinEDA_SchematicFrame* parent, wxDC* DC, WinEDA_HierFrame::WinEDA_HierFrame( SCH_EDIT_FRAME* parent, wxDC* DC, const wxPoint& pos ) :
const wxPoint& pos ) : wxDialog( parent, -1, _( "Navigator" ), pos, wxSize( 110, 50 ), DIALOG_STYLE )
wxDialog( parent, -1, _( "Navigator" ), pos, wxSize( 110, 50 ),
DIALOG_STYLE )
{ {
wxTreeItemId cellule; wxTreeItemId cellule;
@ -253,7 +251,7 @@ void WinEDA_HierFrame::OnSelect( wxTreeEvent& event )
/* Set the current screen to display the parent sheet of the current /* Set the current screen to display the parent sheet of the current
* displayed sheet * displayed sheet
*/ */
void WinEDA_SchematicFrame::InstallPreviousSheet() void SCH_EDIT_FRAME::InstallPreviousSheet()
{ {
if( m_CurrentSheet->Last() == g_RootSheet ) if( m_CurrentSheet->Last() == g_RootSheet )
return; return;
@ -264,24 +262,25 @@ void WinEDA_SchematicFrame::InstallPreviousSheet()
//make a copy for testing purposes. //make a copy for testing purposes.
SCH_SHEET_PATH listtemp = *m_CurrentSheet; SCH_SHEET_PATH listtemp = *m_CurrentSheet;
listtemp.Pop(); listtemp.Pop();
if( listtemp.LastScreen() == NULL ) if( listtemp.LastScreen() == NULL )
{ {
DisplayError( this, DisplayError( this, wxT( "InstallPreviousScreen() Error: Sheet not found" ) );
wxT( "InstallPreviousScreen() Error: Sheet not found" ) );
return; return;
} }
m_CurrentSheet->Pop(); m_CurrentSheet->Pop();
UpdateScreenFromSheet( this ); UpdateScreenFromSheet( this );
} }
/* Routine installation of the screen corresponding to the symbol edge Sheet /* Routine installation of the screen corresponding to the symbol edge Sheet
* Be careful here because the SCH_SHEETs within the EEDrawList * Be careful here because the SCH_SHEETs within the GetDrawItems()
* don't actually have a valid m_AssociatedScreen (on purpose -- you need the * don't actually have a valid m_AssociatedScreen (on purpose -- you need the
* m_SubSheet hierarchy to maintain path info (well, this is but one way to * m_SubSheet hierarchy to maintain path info (well, this is but one way to
* maintain path info..) * maintain path info..)
*/ */
void WinEDA_SchematicFrame::InstallNextScreen( SCH_SHEET* Sheet ) void SCH_EDIT_FRAME::InstallNextScreen( SCH_SHEET* Sheet )
{ {
if( Sheet == NULL ) if( Sheet == NULL )
{ {
@ -297,7 +296,7 @@ void WinEDA_SchematicFrame::InstallNextScreen( SCH_SHEET* Sheet )
/* Find and install the screen on the sheet symbol Sheet. /* Find and install the screen on the sheet symbol Sheet.
* If Sheet == NULL installation of the screen base (Root). * If Sheet == NULL installation of the screen base (Root).
*/ */
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame ) static bool UpdateScreenFromSheet( SCH_EDIT_FRAME* frame )
{ {
SCH_SCREEN* NewScreen; SCH_SCREEN* NewScreen;

View File

@ -256,8 +256,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Viewlib_Hokeys_Descr[] =
* Hot keys. Some commands are relative to the item under the mouse cursor * Hot keys. Some commands are relative to the item under the mouse cursor
* Commands are case insensitive * Commands are case insensitive
*/ */
void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
EDA_BaseStruct* DrawStruct )
{ {
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
@ -346,7 +345,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
RefreshToolBar = LocateAndDeleteItem( this, DC ); RefreshToolBar = LocateAndDeleteItem( this, DC );
OnModify(); OnModify();
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->GetDrawItems(), DC );
} }
break; break;
@ -659,7 +658,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
RefreshToolBar = TRUE; RefreshToolBar = TRUE;
} }
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_NORMAL ); CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_NORMAL );
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->GetDrawItems(), DC );
} }
break; break;
@ -837,7 +836,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
* under the mouse cursor * under the mouse cursor
* Commands are case insensitive * Commands are case insensitive
*/ */
void LIB_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ) void LIB_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
{ {
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
wxCommandEvent toolCmd( wxEVT_COMMAND_TOOL_CLICKED ); wxCommandEvent toolCmd( wxEVT_COMMAND_TOOL_CLICKED );

View File

@ -22,12 +22,12 @@ LIB_DRAW_ITEM::LIB_DRAW_ITEM( KICAD_T aType,
int aUnit, int aUnit,
int aConvert, int aConvert,
FILL_T aFillType ) : FILL_T aFillType ) :
EDA_BaseStruct( aType ) EDA_ITEM( aType )
{ {
m_Unit = aUnit; m_Unit = aUnit;
m_Convert = aConvert; m_Convert = aConvert;
m_Fill = aFillType; m_Fill = aFillType;
m_Parent = (EDA_BaseStruct*) aComponent; m_Parent = (EDA_ITEM*) aComponent;
m_typeName = _( "Undefined" ); m_typeName = _( "Undefined" );
m_isFillable = false; m_isFillable = false;
m_eraseLastDrawItem = false; m_eraseLastDrawItem = false;
@ -35,7 +35,7 @@ LIB_DRAW_ITEM::LIB_DRAW_ITEM( KICAD_T aType,
LIB_DRAW_ITEM::LIB_DRAW_ITEM( const LIB_DRAW_ITEM& aItem ) : LIB_DRAW_ITEM::LIB_DRAW_ITEM( const LIB_DRAW_ITEM& aItem ) :
EDA_BaseStruct( aItem ) EDA_ITEM( aItem )
{ {
m_Unit = aItem.m_Unit; m_Unit = aItem.m_Unit;
m_Convert = aItem.m_Convert; m_Convert = aItem.m_Convert;

View File

@ -50,7 +50,7 @@ typedef std::vector< LIB_PIN* > LIB_PIN_LIST;
* Base class for drawable items used in library components. * Base class for drawable items used in library components.
* (graphic shapes, texts, fields, pins) * (graphic shapes, texts, fields, pins)
*/ */
class LIB_DRAW_ITEM : public EDA_BaseStruct class LIB_DRAW_ITEM : public EDA_ITEM
{ {
/** /**
* Draws the item. * Draws the item.
@ -229,7 +229,7 @@ public:
*/ */
virtual EDA_Rect GetBoundingBox() virtual EDA_Rect GetBoundingBox()
{ {
return EDA_BaseStruct::GetBoundingBox(); return EDA_ITEM::GetBoundingBox();
} }
/** /**

View File

@ -806,7 +806,7 @@ void LIB_PIN::drawGraphic( WinEDA_DrawPanel* aPanel,
{ {
// Invisible pins are only drawn on request. In libedit they are drawn // Invisible pins are only drawn on request. In libedit they are drawn
// in g_InvisibleItemColor because we must see them. // in g_InvisibleItemColor because we must see them.
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow(); SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow();
if( m_attributes & PINNOTDRAW ) if( m_attributes & PINNOTDRAW )
{ {

View File

@ -38,8 +38,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
for( SCH_SCREEN* screen = ScreenList.GetFirst(); screen != NULL; for( SCH_SCREEN* screen = ScreenList.GetFirst(); screen != NULL;
screen = ScreenList.GetNext() ) screen = ScreenList.GetNext() )
{ {
for( SCH_ITEM* SchItem = screen->EEDrawList; SchItem; for( SCH_ITEM* SchItem = screen->GetDrawItems(); SchItem; SchItem = SchItem->Next() )
SchItem = SchItem->Next() )
{ {
if( SchItem->Type() != TYPE_SCH_COMPONENT ) if( SchItem->Type() != TYPE_SCH_COMPONENT )
continue; continue;

View File

@ -12,7 +12,7 @@
#include "class_libentry.h" #include "class_libentry.h"
void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int unused_flag ) void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, int unused_flag )
{ {
LIB_COMPONENT* CopyItem; LIB_COMPONENT* CopyItem;
PICKED_ITEMS_LIST* lastcmd; PICKED_ITEMS_LIST* lastcmd;

View File

@ -163,7 +163,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, WinEDA_DrawFrame )
END_EVENT_TABLE() END_EVENT_TABLE()
LIB_EDIT_FRAME::LIB_EDIT_FRAME( WinEDA_SchematicFrame* aParent, LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
@ -247,7 +247,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( WinEDA_SchematicFrame* aParent,
LIB_EDIT_FRAME::~LIB_EDIT_FRAME() LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
{ {
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow(); SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow();
frame->m_LibeditFrame = NULL; frame->m_LibeditFrame = NULL;
m_drawItem = m_lastDrawItem = NULL; m_drawItem = m_lastDrawItem = NULL;
@ -958,7 +958,7 @@ void LIB_EDIT_FRAME::EnsureActiveLibExists()
void LIB_EDIT_FRAME::SetLanguage( wxCommandEvent& event ) void LIB_EDIT_FRAME::SetLanguage( wxCommandEvent& event )
{ {
WinEDA_BasicFrame::SetLanguage( event ); WinEDA_BasicFrame::SetLanguage( event );
WinEDA_SchematicFrame *parent = (WinEDA_SchematicFrame *)GetParent(); SCH_EDIT_FRAME *parent = (SCH_EDIT_FRAME *)GetParent();
parent->WinEDA_BasicFrame::SetLanguage( event ); parent->WinEDA_BasicFrame::SetLanguage( event );
} }

View File

@ -12,7 +12,7 @@
#include "lib_draw_item.h" #include "lib_draw_item.h"
class WinEDA_SchematicFrame; class SCH_EDIT_FRAME;
class CMP_LIBRARY; class CMP_LIBRARY;
class LIB_COMPONENT; class LIB_COMPONENT;
class LIB_ALIAS; class LIB_ALIAS;
@ -32,7 +32,7 @@ public:
WinEDAChoiceBox* m_SelAliasBox; // a box to select the alias to edit (if any) WinEDAChoiceBox* m_SelAliasBox; // a box to select the alias to edit (if any)
public: public:
LIB_EDIT_FRAME( WinEDA_SchematicFrame* aParent, const wxString& title, LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
@ -100,7 +100,7 @@ public:
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); } SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ); void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
@ -223,7 +223,7 @@ private:
// General editing // General editing
public: public:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 ); void SaveCopyInUndoList( EDA_ITEM* ItemToCopy, int flag_type_command = 0 );
private: private:
void GetComponentFromUndoList( wxCommandEvent& event ); void GetComponentFromUndoList( wxCommandEvent& event );

View File

@ -27,7 +27,7 @@ static void LoadLayers( LINE_READER* aLine );
* Routine to load an EESchema file. * Routine to load an EESchema file.
* Returns true if file has been loaded (at least partially.) * Returns true if file has been loaded (at least partially.)
*/ */
bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFileName ) bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFileName )
{ {
char Name1[256]; char Name1[256];
bool itemLoaded = false; bool itemLoaded = false;
@ -188,8 +188,8 @@ again." );
} }
else else
{ {
item->SetNext( screen->EEDrawList ); item->SetNext( screen->GetDrawItems() );
screen->EEDrawList = item; screen->SetDrawItems( item );
} }
} }
@ -200,23 +200,24 @@ again." );
} }
} }
/* EEDrawList was constructed in reverse order - reverse it back: */ /* GetDrawItems() was constructed in reverse order - reverse it back: */
Phead = NULL; Phead = NULL;
while( screen->EEDrawList )
while( screen->GetDrawItems() )
{ {
Pnext = screen->EEDrawList; Pnext = screen->GetDrawItems();
screen->EEDrawList = screen->EEDrawList->Next(); screen->SetDrawItems( screen->GetDrawItems()->Next() );
Pnext->SetNext( Phead ); Pnext->SetNext( Phead );
Phead = Pnext; Phead = Pnext;
} }
screen->EEDrawList = Phead; screen->SetDrawItems( Phead );
#if 0 && defined (DEBUG) #if 0 && defined (DEBUG)
screen->Show( 0, std::cout ); screen->Show( 0, std::cout );
#endif #endif
TestDanglingEnds( screen->EEDrawList, NULL ); TestDanglingEnds( screen->GetDrawItems(), NULL );
MsgDiag = _( "Done Loading " ) + screen->m_FileName; MsgDiag = _( "Done Loading " ) + screen->m_FileName;
PrintMsg( MsgDiag ); PrintMsg( MsgDiag );
@ -257,7 +258,7 @@ static void LoadLayers( LINE_READER* aLine )
/* Read the schematic header. */ /* Read the schematic header. */
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window ) bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* aScreen )
{ {
char Text[256], buf[1024]; char Text[256], buf[1024];
int ii; int ii;
@ -273,9 +274,11 @@ bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Windo
sscanf( ((char*)(*aLine)), "%s %s %d %d", Text, Text, &PageSize.x, &PageSize.y ); sscanf( ((char*)(*aLine)), "%s %s %d %d", Text, Text, &PageSize.x, &PageSize.y );
wxString pagename = CONV_FROM_UTF8( Text ); wxString pagename = CONV_FROM_UTF8( Text );
for( ii = 0; SheetFormatList[ii] != NULL; ii++ ) for( ii = 0; SheetFormatList[ii] != NULL; ii++ )
{ {
wsheet = SheetFormatList[ii]; wsheet = SheetFormatList[ii];
if( wsheet->m_Name.CmpNoCase( pagename ) == 0 ) /* Descr found ! */ if( wsheet->m_Name.CmpNoCase( pagename ) == 0 ) /* Descr found ! */
{ {
// Get the user page size and make it the default // Get the user page size and make it the default
@ -283,6 +286,7 @@ bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Windo
{ {
g_Sheet_user.m_Size = PageSize; g_Sheet_user.m_Size = PageSize;
} }
break; break;
} }
} }
@ -295,7 +299,7 @@ line %d, \aAbort reading file.\n" ),
aMsgDiag << CONV_FROM_UTF8( ((char*)(*aLine)) ); aMsgDiag << CONV_FROM_UTF8( ((char*)(*aLine)) );
} }
Window->m_CurrentSheetDesc = wsheet; aScreen->m_CurrentSheetDesc = wsheet;
for( ; ; ) for( ; ; )
{ {
@ -307,61 +311,61 @@ line %d, \aAbort reading file.\n" ),
if( strnicmp( ((char*)(*aLine)), "Sheet", 2 ) == 0 ) if( strnicmp( ((char*)(*aLine)), "Sheet", 2 ) == 0 )
sscanf( ((char*)(*aLine)) + 5, " %d %d", sscanf( ((char*)(*aLine)) + 5, " %d %d",
&Window->m_ScreenNumber, &Window->m_NumberOfScreen ); &aScreen->m_ScreenNumber, &aScreen->m_NumberOfScreen );
if( strnicmp( ((char*)(*aLine)), "Title", 2 ) == 0 ) if( strnicmp( ((char*)(*aLine)), "Title", 2 ) == 0 )
{ {
ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Title = CONV_FROM_UTF8( buf ); aScreen->m_Title = CONV_FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( ((char*)(*aLine)), "Date", 2 ) == 0 ) if( strnicmp( ((char*)(*aLine)), "Date", 2 ) == 0 )
{ {
ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Date = CONV_FROM_UTF8( buf ); aScreen->m_Date = CONV_FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( ((char*)(*aLine)), "Rev", 2 ) == 0 ) if( strnicmp( ((char*)(*aLine)), "Rev", 2 ) == 0 )
{ {
ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Revision = CONV_FROM_UTF8( buf ); aScreen->m_Revision = CONV_FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( ((char*)(*aLine)), "Comp", 4 ) == 0 ) if( strnicmp( ((char*)(*aLine)), "Comp", 4 ) == 0 )
{ {
ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Company = CONV_FROM_UTF8( buf ); aScreen->m_Company = CONV_FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( ((char*)(*aLine)), "Comment1", 8 ) == 0 ) if( strnicmp( ((char*)(*aLine)), "Comment1", 8 ) == 0 )
{ {
ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Commentaire1 = CONV_FROM_UTF8( buf ); aScreen->m_Commentaire1 = CONV_FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( ((char*)(*aLine)), "Comment2", 8 ) == 0 ) if( strnicmp( ((char*)(*aLine)), "Comment2", 8 ) == 0 )
{ {
ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Commentaire2 = CONV_FROM_UTF8( buf ); aScreen->m_Commentaire2 = CONV_FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( ((char*)(*aLine)), "Comment3", 8 ) == 0 ) if( strnicmp( ((char*)(*aLine)), "Comment3", 8 ) == 0 )
{ {
ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Commentaire3 = CONV_FROM_UTF8( buf ); aScreen->m_Commentaire3 = CONV_FROM_UTF8( buf );
continue; continue;
} }
if( strnicmp( ((char*)(*aLine)), "Comment4", 8 ) == 0 ) if( strnicmp( ((char*)(*aLine)), "Comment4", 8 ) == 0 )
{ {
ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Commentaire4 = CONV_FROM_UTF8( buf ); aScreen->m_Commentaire4 = CONV_FROM_UTF8( buf );
continue; continue;
} }
} }

View File

@ -40,31 +40,30 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
EDA_Rect BoundaryBox; EDA_Rect BoundaryBox;
float sizeref = 0, sizecurr; float sizeref = 0, sizecurr;
DrawList = Screen->EEDrawList; DrawList = Screen->GetDrawItems();
while( DrawList ) while( DrawList )
{ {
if( ( SnapPoint2( Screen->m_MousePosition, LIBITEM, if( !SnapPoint2( Screen->m_MousePosition, LIBITEM, DrawList, Screen->GetZoom() ) )
DrawList, Screen->GetZoom() ) ) == FALSE )
{ {
if( ( SnapPoint2( Screen->m_Curseur, LIBITEM, if( !SnapPoint2( Screen->m_Curseur, LIBITEM, DrawList, Screen->GetScalingFactor() ) )
DrawList, Screen->GetScalingFactor() ) ) == FALSE )
break; break;
} }
component = (SCH_COMPONENT*) LastSnappedStruct; component = (SCH_COMPONENT*) LastSnappedStruct;
DrawList = component->Next(); DrawList = component->Next();
if( lastcomponent == NULL ) // First time a component is located if( lastcomponent == NULL ) // First time a component is located
{ {
lastcomponent = component; lastcomponent = component;
BoundaryBox = lastcomponent->GetBoundaryBox(); BoundaryBox = lastcomponent->GetBoundaryBox();
sizeref = ABS( (float) BoundaryBox.GetWidth() * sizeref = ABS( (float) BoundaryBox.GetWidth() * BoundaryBox.GetHeight() );
BoundaryBox.GetHeight() );
} }
else else
{ {
BoundaryBox = component->GetBoundaryBox(); BoundaryBox = component->GetBoundaryBox();
sizecurr = ABS( (float) BoundaryBox.GetWidth() * sizecurr = ABS( (float) BoundaryBox.GetWidth() * BoundaryBox.GetHeight() );
BoundaryBox.GetHeight() );
if( sizeref > sizecurr ) // a smallest component is found if( sizeref > sizecurr ) // a smallest component is found
{ {
sizeref = sizecurr; sizeref = sizecurr;
@ -104,21 +103,16 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
* pointer on item found or NULL * pointer on item found or NULL
* *
*/ */
SCH_ITEM* PickStruct( const wxPoint& refpos, SCH_ITEM* PickStruct( const wxPoint& refpos, SCH_SCREEN* screen, int SearchMask )
BASE_SCREEN* screen,
int SearchMask )
{ {
bool Snapped; if( screen == NULL || screen->GetDrawItems() == NULL )
if( screen == NULL || screen->EEDrawList == NULL )
return NULL; return NULL;
if( ( Snapped = SnapPoint2( refpos, SearchMask, if( SnapPoint2( refpos, SearchMask, screen->GetDrawItems(), screen->GetScalingFactor() ) )
screen->EEDrawList,
screen->GetScalingFactor() ) ) != FALSE )
{ {
return LastSnappedStruct; return LastSnappedStruct;
} }
return NULL; return NULL;
} }
@ -130,7 +124,7 @@ SCH_ITEM* PickStruct( const wxPoint& refpos,
* @param aBlock a BLOCK_SELECTOR that gives the search area boundary * @param aBlock a BLOCK_SELECTOR that gives the search area boundary
* list of items is stored in aBlock * list of items is stored in aBlock
*/ */
int PickItemsInBlock( BLOCK_SELECTOR& aBlock, BASE_SCREEN* aScreen ) int PickItemsInBlock( BLOCK_SELECTOR& aBlock, SCH_SCREEN* aScreen )
{ {
int itemcount = 0; int itemcount = 0;
@ -144,7 +138,8 @@ int PickItemsInBlock( BLOCK_SELECTOR& aBlock, BASE_SCREEN* aScreen )
area.Normalize(); area.Normalize();
ITEM_PICKER picker; ITEM_PICKER picker;
SCH_ITEM* DrawStruct = aScreen->EEDrawList; SCH_ITEM* DrawStruct = aScreen->GetDrawItems();
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( IsItemInBox( area, DrawStruct ) ) if( IsItemInBox( area, DrawStruct ) )
@ -169,12 +164,12 @@ int PickItemsInBlock( BLOCK_SELECTOR& aBlock, BASE_SCREEN* aScreen )
* a point. This variable is global to this module only (see above). * * a point. This variable is global to this module only (see above). *
* The routine returns true if point was snapped. * * The routine returns true if point was snapped. *
*****************************************************************************/ *****************************************************************************/
bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, double aScaleFactor )
SCH_ITEM* DrawList, double aScaleFactor )
{ {
for( ; DrawList != NULL; DrawList = DrawList->Next() ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
int hitminDist = MAX( g_DrawDefaultLineThickness, 3 ); int hitminDist = MAX( g_DrawDefaultLineThickness, 3 );
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
@ -476,11 +471,11 @@ LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, SCH_COMPONENT*
SCH_COMPONENT* schItem = NULL; SCH_COMPONENT* schItem = NULL;
LIB_PIN* Pin = NULL; LIB_PIN* Pin = NULL;
for( DrawStruct = DrawList; DrawStruct != NULL; for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
DrawStruct = DrawStruct->Next() )
{ {
if( DrawStruct->Type() != TYPE_SCH_COMPONENT ) if( DrawStruct->Type() != TYPE_SCH_COMPONENT )
continue; continue;
schItem = (SCH_COMPONENT*) DrawStruct; schItem = (SCH_COMPONENT*) DrawStruct;
Entry = CMP_LIBRARY::FindLibraryComponent( schItem->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( schItem->m_ChipName );
@ -503,6 +498,7 @@ LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, SCH_COMPONENT*
if( libpart ) if( libpart )
*libpart = schItem; *libpart = schItem;
return Pin; return Pin;
} }
@ -512,13 +508,13 @@ SCH_SHEET_PIN* LocateAnyPinSheet( const wxPoint& RefPos, SCH_ITEM* DrawList )
SCH_ITEM* DrawStruct; SCH_ITEM* DrawStruct;
SCH_SHEET_PIN* PinSheet = NULL; SCH_SHEET_PIN* PinSheet = NULL;
for( DrawStruct = DrawList; DrawStruct != NULL; for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
DrawStruct = DrawStruct->Next() )
{ {
if( DrawStruct->Type() != DRAW_SHEET_STRUCT_TYPE ) if( DrawStruct->Type() != DRAW_SHEET_STRUCT_TYPE )
continue; continue;
PinSheet = LocateSheetLabel( (SCH_SHEET*) DrawStruct, RefPos ); PinSheet = LocateSheetLabel( (SCH_SHEET*) DrawStruct, RefPos );
if( PinSheet ) if( PinSheet )
break; break;
} }

View File

@ -22,7 +22,7 @@
/** /**
* @brief Create or update the menubar for the schematic frame * @brief Create or update the menubar for the schematic frame
*/ */
void WinEDA_SchematicFrame::ReCreateMenuBar() void SCH_EDIT_FRAME::ReCreateMenuBar()
{ {
wxString text; wxString text;
wxMenuItem* item; wxMenuItem* item;

View File

@ -137,9 +137,9 @@ class EXPORT_HELP
* A suitable component is a "new" real component (power symbols are not * A suitable component is a "new" real component (power symbols are not
* considered). * considered).
*/ */
SCH_COMPONENT* findNextComponentAndCreatPinList( EDA_BaseStruct* aItem, SCH_SHEET_PATH* aSheetPath ); SCH_COMPONENT* findNextComponentAndCreatPinList( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheetPath );
SCH_COMPONENT* findNextComponent( EDA_BaseStruct* aItem, SCH_SHEET_PATH* aSheetPath ); SCH_COMPONENT* findNextComponent( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheetPath );
/** /**
* Function eraseDuplicatePins * Function eraseDuplicatePins
@ -242,7 +242,7 @@ public:
* creates a generic netlist, now in XML. * creates a generic netlist, now in XML.
* @return bool - true if there were no errors, else false. * @return bool - true if there were no errors, else false.
*/ */
bool WriteGENERICNetList( WinEDA_SchematicFrame* frame, const wxString& aOutFileName ); bool WriteGENERICNetList( SCH_EDIT_FRAME* frame, const wxString& aOutFileName );
/** /**
* Function WriteNetListPCBNEW * Function WriteNetListPCBNEW
@ -251,8 +251,7 @@ public:
* @param with_pcbnew if true, then format Pcbnew (OrcadPcb2 + reviews and lists of net),<p> * @param with_pcbnew if true, then format Pcbnew (OrcadPcb2 + reviews and lists of net),<p>
* else output ORCADPCB2 strict format. * else output ORCADPCB2 strict format.
*/ */
bool WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool WriteNetListPCBNEW( SCH_EDIT_FRAME* frame, FILE* f, bool with_pcbnew );
bool with_pcbnew );
/** /**
* Function WriteNetListCADSTAR * Function WriteNetListCADSTAR
@ -282,7 +281,7 @@ public:
* .. B * T3 1 * .. B * T3 1
*U1 * 14 *U1 * 14
*/ */
void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f ); void WriteNetListCADSTAR( SCH_EDIT_FRAME* frame, FILE* f );
/** /**
* Function WriteNetListPspice * Function WriteNetListPspice
@ -295,8 +294,7 @@ public:
* @param use_netnames if true, then nodes are identified by the netname, * @param use_netnames if true, then nodes are identified by the netname,
* else by net number. * else by net number.
*/ */
bool WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, bool WriteNetListPspice( SCH_EDIT_FRAME* frame, FILE* f, bool use_netnames );
bool use_netnames );
/** /**
* Function MakeCommandLine * Function MakeCommandLine
@ -357,7 +355,7 @@ wxString EXPORT_HELP::MakeCommandLine( const wxString& aFormatString,
* bool aUse_netnames is used only for Spice netlist * bool aUse_netnames is used only for Spice netlist
* @return true if success. * @return true if success.
*/ */
bool WinEDA_SchematicFrame::WriteNetListFile( int aFormat, const wxString& aFullFileName, bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileName,
bool aUse_netnames ) bool aUse_netnames )
{ {
bool ret = true; bool ret = true;
@ -489,7 +487,7 @@ void EXPORT_HELP::sprintPinNetName( wxString* aResult,
} }
SCH_COMPONENT* EXPORT_HELP::findNextComponent( EDA_BaseStruct* aItem, SCH_SHEET_PATH* aSheetPath ) SCH_COMPONENT* EXPORT_HELP::findNextComponent( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheetPath )
{ {
wxString ref; wxString ref;
@ -536,8 +534,8 @@ SCH_COMPONENT* EXPORT_HELP::findNextComponent( EDA_BaseStruct* aItem, SCH_SHEET_
} }
SCH_COMPONENT* EXPORT_HELP::findNextComponentAndCreatPinList( SCH_COMPONENT* EXPORT_HELP::findNextComponentAndCreatPinList( EDA_ITEM* aItem,
EDA_BaseStruct* aItem, SCH_SHEET_PATH* aSheetPath ) SCH_SHEET_PATH* aSheetPath )
{ {
wxString ref; wxString ref;
@ -555,6 +553,7 @@ SCH_COMPONENT* EXPORT_HELP::findNextComponentAndCreatPinList(
// Power symbols and other components which have the reference starting // Power symbols and other components which have the reference starting
// with "#" are not included in netlist (pseudo or virtual components) // with "#" are not included in netlist (pseudo or virtual components)
ref = comp->GetRef( aSheetPath ); ref = comp->GetRef( aSheetPath );
if( ref[0] == wxChar( '#' ) ) if( ref[0] == wxChar( '#' ) )
continue; continue;
@ -565,6 +564,7 @@ SCH_COMPONENT* EXPORT_HELP::findNextComponentAndCreatPinList(
// toggled. // toggled.
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( comp->m_ChipName ); LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( comp->m_ChipName );
if( !entry ) if( !entry )
continue; continue;
@ -942,7 +942,7 @@ XNODE* EXPORT_HELP::makeGenericComponents()
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() ) for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() )
{ {
for( EDA_BaseStruct* schItem = path->LastDrawList(); schItem; schItem = schItem->Next() ) for( EDA_ITEM* schItem = path->LastDrawList(); schItem; schItem = schItem->Next() )
{ {
SCH_COMPONENT* comp = findNextComponentAndCreatPinList( schItem, path ); SCH_COMPONENT* comp = findNextComponentAndCreatPinList( schItem, path );
if( !comp ) if( !comp )
@ -1036,7 +1036,7 @@ XNODE* EXPORT_HELP::makeGenericComponents()
#include <wx/wfstream.h> // wxFFileOutputStream #include <wx/wfstream.h> // wxFFileOutputStream
bool EXPORT_HELP::WriteGENERICNetList( WinEDA_SchematicFrame* frame, const wxString& aOutFileName ) bool EXPORT_HELP::WriteGENERICNetList( SCH_EDIT_FRAME* frame, const wxString& aOutFileName )
{ {
#if 0 #if 0
@ -1106,7 +1106,7 @@ bool EXPORT_HELP::WriteGENERICNetList( WinEDA_SchematicFrame* frame, const wxStr
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() ) for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() )
{ {
for( EDA_BaseStruct* schItem = path->LastDrawList(); schItem; schItem = schItem->Next() ) for( EDA_ITEM* schItem = path->LastDrawList(); schItem; schItem = schItem->Next() )
{ {
SCH_COMPONENT* comp = findNextComponentAndCreatPinList( schItem, path ); SCH_COMPONENT* comp = findNextComponentAndCreatPinList( schItem, path );
if( !comp ) if( !comp )
@ -1174,7 +1174,7 @@ bool EXPORT_HELP::WriteGENERICNetList( WinEDA_SchematicFrame* frame, const wxStr
} }
bool EXPORT_HELP::WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, bool use_netnames ) bool EXPORT_HELP::WriteNetListPspice( SCH_EDIT_FRAME* frame, FILE* f, bool use_netnames )
{ {
int ret = 0; int ret = 0;
char Line[1024]; char Line[1024];
@ -1190,8 +1190,7 @@ bool EXPORT_HELP::WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, boo
DateAndTime( Line ); DateAndTime( Line );
ret |= fprintf( f, "* %s (Spice format) creation date: %s\n\n", ret |= fprintf( f, "* %s (Spice format) creation date: %s\n\n", NETLIST_HEAD_STRING, Line );
NETLIST_HEAD_STRING, Line );
// Create text list starting by [.-]pspice , or [.-]gnucap (simulator // Create text list starting by [.-]pspice , or [.-]gnucap (simulator
// commands) and create text list starting by [+]pspice , or [+]gnucap // commands) and create text list starting by [+]pspice , or [+]gnucap
@ -1201,7 +1200,7 @@ bool EXPORT_HELP::WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, boo
for( SCH_SHEET_PATH* sheet = sheetList.GetFirst(); sheet; sheet = sheetList.GetNext() ) for( SCH_SHEET_PATH* sheet = sheetList.GetFirst(); sheet; sheet = sheetList.GetNext() )
{ {
for( EDA_BaseStruct* item = sheet->LastDrawList(); item; item = item->Next() ) for( EDA_ITEM* item = sheet->LastDrawList(); item; item = item->Next() )
{ {
wxChar ident; wxChar ident;
if( item->Type() != TYPE_SCH_TEXT ) if( item->Type() != TYPE_SCH_TEXT )
@ -1265,7 +1264,7 @@ bool EXPORT_HELP::WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, boo
for( SCH_SHEET_PATH* sheet = sheetList.GetFirst(); sheet; sheet = sheetList.GetNext() ) for( SCH_SHEET_PATH* sheet = sheetList.GetFirst(); sheet; sheet = sheetList.GetNext() )
{ {
for( EDA_BaseStruct* item = sheet->LastDrawList(); item; item = item->Next() ) for( EDA_ITEM* item = sheet->LastDrawList(); item; item = item->Next() )
{ {
SCH_COMPONENT* comp = findNextComponentAndCreatPinList( item, sheet ); SCH_COMPONENT* comp = findNextComponentAndCreatPinList( item, sheet );
if( !comp ) if( !comp )
@ -1328,7 +1327,7 @@ bool EXPORT_HELP::WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, boo
} }
bool EXPORT_HELP::WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with_pcbnew ) bool EXPORT_HELP::WriteNetListPCBNEW( SCH_EDIT_FRAME* frame, FILE* f, bool with_pcbnew )
{ {
wxString field; wxString field;
wxString footprint; wxString footprint;
@ -1353,7 +1352,7 @@ bool EXPORT_HELP::WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, boo
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() ) for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() )
{ {
for( EDA_BaseStruct* item = path->LastDrawList(); item; item = item->Next() ) for( EDA_ITEM* item = path->LastDrawList(); item; item = item->Next() )
{ {
SCH_COMPONENT* comp = findNextComponentAndCreatPinList( item, path ); SCH_COMPONENT* comp = findNextComponentAndCreatPinList( item, path );
if( !comp ) if( !comp )
@ -1569,7 +1568,7 @@ void EXPORT_HELP::findAllInstancesOfComponent( SCH_COMPONENT* aComponent,
for( SCH_SHEET_PATH* sheet = sheetList.GetFirst(); sheet; sheet = sheetList.GetNext() ) for( SCH_SHEET_PATH* sheet = sheetList.GetFirst(); sheet; sheet = sheetList.GetNext() )
{ {
for( EDA_BaseStruct* item = sheet->LastDrawList(); item; item = item->Next() ) for( EDA_ITEM* item = sheet->LastDrawList(); item; item = item->Next() )
{ {
if( item->Type() != TYPE_SCH_COMPONENT ) if( item->Type() != TYPE_SCH_COMPONENT )
continue; continue;
@ -1690,14 +1689,14 @@ bool EXPORT_HELP::writeGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjects
static wxString StartLine( wxT( "." ) ); static wxString StartLine( wxT( "." ) );
void EXPORT_HELP::WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f ) void EXPORT_HELP::WriteNetListCADSTAR( SCH_EDIT_FRAME* frame, FILE* f )
{ {
wxString StartCmpDesc = StartLine + wxT( "ADD_COM" ); wxString StartCmpDesc = StartLine + wxT( "ADD_COM" );
wxString msg; wxString msg;
wxString footprint; wxString footprint;
char Line[1024]; char Line[1024];
SCH_SHEET_PATH* sheet; SCH_SHEET_PATH* sheet;
EDA_BaseStruct* DrawList; EDA_ITEM* DrawList;
SCH_COMPONENT* Component; SCH_COMPONENT* Component;
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion(); wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();

View File

@ -82,7 +82,7 @@ void FreeNetObjectsList( NETLIST_OBJECT_LIST& aNetObjectsBuffer )
* Updates: * Updates:
* g_NetObjectslist * g_NetObjectslist
*/ */
void WinEDA_SchematicFrame::BuildNetListBase() void SCH_EDIT_FRAME::BuildNetListBase()
{ {
int NetNumber; int NetNumber;
int NetCode; int NetCode;
@ -509,7 +509,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
SCH_SHEET_PATH list; SCH_SHEET_PATH list;
DrawList = sheetlist->LastScreen()->EEDrawList; DrawList = sheetlist->LastScreen()->GetDrawItems();
for( ; DrawList; DrawList = DrawList->Next() ) for( ; DrawList; DrawList = DrawList->Next() )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )

View File

@ -173,7 +173,7 @@ EDA_NoteBookPage::EDA_NoteBookPage( wxNotebook* parent,
/*************************************************************************************/ /*************************************************************************************/
WinEDA_NetlistFrame::WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent ) : WinEDA_NetlistFrame::WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ) :
wxDialog( parent, -1, _( "Netlist" ), wxDefaultPosition, wxDialog( parent, -1, _( "Netlist" ), wxDefaultPosition,
wxDefaultSize, DIALOG_STYLE | MAYBE_RESIZE_BORDER ) wxDefaultSize, DIALOG_STYLE | MAYBE_RESIZE_BORDER )
/*************************************************************************************/ /*************************************************************************************/
@ -525,7 +525,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
* bool aUse_netnames is used only for Spice netlist * bool aUse_netnames is used only for Spice netlist
* @return true if success. * @return true if success.
*/ */
bool WinEDA_SchematicFrame::CreateNetlist( int aFormat, const wxString& aFullFileName, bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
bool aUse_netnames ) bool aUse_netnames )
{ {
ReAnnotatePowerSymbolsOnly(); ReAnnotatePowerSymbolsOnly();

View File

@ -61,16 +61,15 @@ public:
class WinEDA_NetlistFrame : public wxDialog class WinEDA_NetlistFrame : public wxDialog
{ {
public: public:
WinEDA_SchematicFrame* m_Parent; SCH_EDIT_FRAME* m_Parent;
wxNotebook* m_NoteBook; wxNotebook* m_NoteBook;
EDA_NoteBookPage* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX]; EDA_NoteBookPage* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
wxRadioBox* m_UseNetNamesInNetlist; wxRadioBox* m_UseNetNamesInNetlist;
public: public:
// Constructor and destructor // Constructor and destructor
WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent ); WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent );
~WinEDA_NetlistFrame() { }; ~WinEDA_NetlistFrame() { };
private: private:

View File

@ -26,7 +26,7 @@ static wxArrayString s_PowerNameList;
/* Process the command triggers by the left button of the mouse when a tool /* Process the command triggers by the left button of the mouse when a tool
* is already selected. * is already selected.
*/ */
void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void SCH_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
SCH_ITEM* DrawStruct = GetScreen()->GetCurItem(); SCH_ITEM* DrawStruct = GetScreen()->GetCurItem();
@ -51,7 +51,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case DRAW_PART_TEXT_STRUCT_TYPE: case DRAW_PART_TEXT_STRUCT_TYPE:
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
return; return;
@ -67,7 +67,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
default: default:
{ {
wxString msg; wxString msg;
msg.Printf(wxT( "WinEDA_SchematicFrame::OnLeftClick err: m_Flags != 0, itmetype %d" ), msg.Printf( wxT( "SCH_EDIT_FRAME::OnLeftClick err: m_Flags != 0, itmetype %d" ),
DrawStruct->Type()); DrawStruct->Type());
DisplayError( this, msg ); DisplayError( this, msg );
DrawStruct->m_Flags = 0; DrawStruct->m_Flags = 0;
@ -113,7 +113,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
} }
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
@ -131,7 +131,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
} }
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
@ -150,7 +150,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
} }
@ -160,7 +160,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
LocateAndDeleteItem( this, DC ); LocateAndDeleteItem( this, DC );
OnModify( ); OnModify( );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
@ -202,7 +202,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
break; break;
@ -221,7 +221,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
break; break;
@ -236,7 +236,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
break; break;
@ -263,7 +263,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
&& (DrawStruct->m_Flags != 0) ) && (DrawStruct->m_Flags != 0) )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
break; break;
@ -279,7 +279,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
break; break;
@ -295,7 +295,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
break; break;
@ -303,7 +303,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
default: default:
{ {
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
wxString msg( wxT( "WinEDA_SchematicFrame::OnLeftClick error state " ) ); wxString msg( wxT( "SCH_EDIT_FRAME::OnLeftClick error state " ) );
msg << m_ID_current_state; msg << m_ID_current_state;
DisplayError( this, msg ); DisplayError( this, msg );
@ -321,10 +321,10 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
* Id a create command is in progress: * Id a create command is in progress:
* validate and finish the command * validate and finish the command
*/ */
void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void SCH_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{ {
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); EDA_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxPoint pos = GetPosition(); wxPoint pos = GetPosition();
switch( m_ID_current_state ) switch( m_ID_current_state )

View File

@ -26,9 +26,9 @@
using namespace std; using namespace std;
static void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame ); static void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame );
static void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, WinEDA_SchematicFrame* frame ); static void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame );
static void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, WinEDA_SchematicFrame* frame ); static void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame );
static void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet ); static void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet );
static void AddMenusForPinSheet( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet ); static void AddMenusForPinSheet( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet );
static void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text ); static void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text );
@ -37,17 +37,15 @@ static void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel );
static void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* GLabel ); static void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* GLabel );
static void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component ); static void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component );
static void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field ); static void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field );
static void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, static void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAME* frame );
WinEDA_SchematicFrame* frame ); static void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame );
static void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker,
WinEDA_SchematicFrame* aFrame );
/* Prepare context menu when a click on the right mouse button occurs. /* Prepare context menu when a click on the right mouse button occurs.
* *
* This menu is then added to the list of zoom commands. * This menu is then added to the list of zoom commands.
*/ */
bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
{ {
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem(); SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
@ -214,7 +212,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMe
default: default:
wxString msg; wxString msg;
msg.Printf( wxT( "WinEDA_SchematicFrame::OnRightClick Error: unknown DrawType %d" ), msg.Printf( wxT( "SCH_EDIT_FRAME::OnRightClick Error: unknown DrawType %d" ),
DrawStruct->Type() ); DrawStruct->Type() );
DisplayError( this, msg ); DisplayError( this, msg );
break; break;
@ -483,7 +481,7 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
} }
void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, WinEDA_SchematicFrame* frame ) void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAME* frame )
{ {
bool is_new = (Junction->m_Flags & IS_NEW) ? TRUE : FALSE; bool is_new = (Junction->m_Flags & IS_NEW) ? TRUE : FALSE;
wxString msg; wxString msg;
@ -507,7 +505,7 @@ void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, WinEDA_Schema
} }
void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, WinEDA_SchematicFrame* frame ) void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
{ {
bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE; bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE;
wxPoint pos = frame->GetScreen()->m_Curseur; wxPoint pos = frame->GetScreen()->m_Curseur;
@ -545,7 +543,7 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, WinEDA_SchematicFrame* fr
} }
void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, WinEDA_SchematicFrame* frame ) void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
{ {
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE; bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE;
wxPoint pos = frame->GetScreen()->m_Curseur; wxPoint pos = frame->GetScreen()->m_Curseur;
@ -632,7 +630,7 @@ void AddMenusForPinSheet( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet )
} }
void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame ) void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
{ {
wxString msg; wxString msg;
@ -669,7 +667,7 @@ void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
} }
void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, WinEDA_SchematicFrame* aFrame ) void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame )
{ {
ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), delete_xpm ); ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), delete_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ), info_xpm ); ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ), info_xpm );

View File

@ -82,7 +82,7 @@ void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector )
void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList ) void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList )
{ {
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen(); SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->GetParent(); SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) panel->GetParent();
PICKED_ITEMS_LIST itemsList; PICKED_ITEMS_LIST itemsList;
ITEM_PICKER itemWrapper; ITEM_PICKER itemWrapper;
@ -91,11 +91,11 @@ void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList )
SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii ); SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii );
itemWrapper.m_PickedItem = item; itemWrapper.m_PickedItem = item;
itemWrapper.m_UndoRedoStatus = UR_DELETED; itemWrapper.m_UndoRedoStatus = UR_DELETED;
if( item->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) if( item->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
{ {
/* this item is depending on a sheet, and is not in global list */ /* this item is depending on a sheet, and is not in global list */
wxMessageBox( wxT( wxMessageBox( wxT("DeleteItemsInList() err: unexpected \
"DeleteItemsInList() err: unexpected \
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE" ) ); DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE" ) );
} }
else else
@ -119,7 +119,7 @@ DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE"
void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct ) void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
{ {
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen(); SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->GetParent(); SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) panel->GetParent();
if( !DrawStruct ) if( !DrawStruct )
return; return;
@ -128,11 +128,9 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
{ {
/* This structure is attached to a node, and is not accessible by /* This structure is attached to a node, and is not accessible by
* the global list directly. */ * the global list directly. */
frame->SaveCopyInUndoList( frame->SaveCopyInUndoList( (SCH_ITEM*)( (SCH_SHEET_PIN*) DrawStruct )->GetParent(),
(SCH_ITEM*)( (SCH_SHEET_PIN*) DrawStruct )->GetParent(),
UR_CHANGED ); UR_CHANGED );
frame->DeleteSheetLabel( DC ? true : false, frame->DeleteSheetLabel( DC ? true : false, (SCH_SHEET_PIN*) DrawStruct );
(SCH_SHEET_PIN*) DrawStruct );
return; return;
} }
else else
@ -199,8 +197,8 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
} }
SetaParent( newitem, screen ); SetaParent( newitem, screen );
newitem->SetNext( screen->EEDrawList ); newitem->SetNext( screen->GetDrawItems() );
screen->EEDrawList = newitem; screen->SetDrawItems( newitem );
} }
} }

View File

@ -9,16 +9,15 @@
#include <wx/wx.h> #include <wx/wx.h>
class EDA_BaseStruct; class EDA_ITEM;
class WinEDA_DrawPanel; class WinEDA_DrawPanel;
class WinEDA_DrawFrame; class WinEDA_DrawFrame;
class WinEDA_SchematicFrame; class SCH_EDIT_FRAME;
class LIB_EDIT_FRAME; class LIB_EDIT_FRAME;
class CMP_LIBRARY; class CMP_LIBRARY;
class LIB_COMPONENT; class LIB_COMPONENT;
class LIB_DRAW_ITEM; class LIB_DRAW_ITEM;
class SCH_COMPONENT; class SCH_COMPONENT;
class BASE_SCREEN;
class SCH_SCREEN; class SCH_SCREEN;
class SCH_ITEM; class SCH_ITEM;
class SCH_SHEET_PIN; class SCH_SHEET_PIN;
@ -51,7 +50,7 @@ void IncrementLabelMember( wxString& name );
/****************/ /****************/
/* EDITPART.CPP */ /* EDITPART.CPP */
/****************/ /****************/
void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, SCH_COMPONENT* m_Cmp ); void InstallCmpeditFrame( SCH_EDIT_FRAME* parent, wxPoint& pos, SCH_COMPONENT* m_Cmp );
void SnapLibItemPoint( int OrigX, void SnapLibItemPoint( int OrigX,
int OrigY, int OrigY,
@ -118,7 +117,7 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct, bool aClone = false );
SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen ); SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen );
/* Find the item within block selection. */ /* Find the item within block selection. */
int PickItemsInBlock( BLOCK_SELECTOR& aBlock, BASE_SCREEN* screen ); int PickItemsInBlock( BLOCK_SELECTOR& aBlock, SCH_SCREEN* screen );
/* function PickStruct: /* function PickStruct:
* Search at location pos * Search at location pos
@ -150,7 +149,7 @@ int PickItemsInBlock( BLOCK_SELECTOR& aBlock, BASE_SCREEN* screen );
* Pointer to the structure if only 1 item is selected. * Pointer to the structure if only 1 item is selected.
* NULL if no items are selects. * NULL if no items are selects.
*/ */
SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask ); SCH_ITEM* PickStruct( const wxPoint& refpos, SCH_SCREEN* screen, int SearchMask );
SCH_SHEET_PIN* LocateSheetLabel( SCH_SHEET* Sheet, const wxPoint& pos ); SCH_SHEET_PIN* LocateSheetLabel( SCH_SHEET* Sheet, const wxPoint& pos );
@ -212,7 +211,7 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* drawlist );
void DeleteSubHierarchy( SCH_SHEET* Sheet, bool confirm_deletion ); void DeleteSubHierarchy( SCH_SHEET* Sheet, bool confirm_deletion );
bool ClearProjectDrawList( SCH_SCREEN* FirstWindow, bool confirm_deletion ); bool ClearProjectDrawList( SCH_SCREEN* FirstWindow, bool confirm_deletion );
/* free the draw list screen->EEDrawList and the subhierarchies /* free the draw list screen->GetDrawItems() and the subhierarchies
* clear the screen datas (filenames ..) * clear the screen datas (filenames ..)
*/ */
@ -220,7 +219,7 @@ bool ClearProjectDrawList( SCH_SCREEN* FirstWindow, bool confirm_deletion );
/* DELETE.CPP */ /* DELETE.CPP */
/*************/ /*************/
bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC ); bool LocateAndDeleteItem( SCH_EDIT_FRAME* frame, wxDC* DC );
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Window ); void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Window );
void DeleteAllMarkers( int type ); void DeleteAllMarkers( int type );
@ -301,12 +300,12 @@ void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint );
/* EECLASS.CPP */ /* EECLASS.CPP */
/**************/ /**************/
void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ); void SetaParent( SCH_ITEM* Struct, SCH_SCREEN* Screen );
/***************/ /***************/
/* OPTIONS.CPP */ /* OPTIONS.CPP */
/***************/ /***************/
void DisplayOptionFrame( WinEDA_SchematicFrame* parent, const wxPoint& framepos ); void DisplayOptionFrame( SCH_EDIT_FRAME* parent, const wxPoint& framepos );
/****************/ /****************/
/* CONTROLE.CPP */ /* CONTROLE.CPP */

View File

@ -635,7 +635,7 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
} }
void SCH_COMPONENT::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) void SCH_COMPONENT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{ {
/* save old text in undo list */ /* save old text in undo list */
if( g_ItemToUndoCopy if( g_ItemToUndoCopy
@ -1458,8 +1458,7 @@ void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame )
frame->ClearMsgPanel(); frame->ClearMsgPanel();
frame->AppendMsgPanel( _( "Reference" ), frame->AppendMsgPanel( _( "Reference" ), GetRef( ( (SCH_EDIT_FRAME*) frame )->GetSheet() ),
GetRef( ( (WinEDA_SchematicFrame*) frame )->GetSheet() ),
DARKCYAN ); DARKCYAN );
if( root_component->IsPower() ) if( root_component->IsPower() )

View File

@ -293,7 +293,7 @@ public:
void SwapData( SCH_COMPONENT* copyitem ); void SwapData( SCH_COMPONENT* copyitem );
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); 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 );

View File

@ -371,7 +371,7 @@ bool SCH_FIELD::Save( FILE* aFile ) const
} }
void SCH_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{ {
int fieldNdx; int fieldNdx;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;

View File

@ -19,7 +19,7 @@
#include "general.h" #include "general.h"
class WinEDA_SchematicFrame; class SCH_EDIT_FRAME;
class SCH_COMPONENT; class SCH_COMPONENT;
class LIB_FIELD; class LIB_FIELD;
@ -54,7 +54,7 @@ public:
} }
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
EDA_Rect GetBoundaryBox() const; EDA_Rect GetBoundaryBox() const;

View File

@ -19,7 +19,7 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) void SetaParent( SCH_ITEM* Struct, SCH_SCREEN* Screen )
{ {
switch( Struct->Type() ) switch( Struct->Type() )
{ {
@ -85,7 +85,7 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type )
{ {
size_t i; size_t i;
EEDrawList = NULL; /* Schematic items list */ SetDrawItems( NULL ); /* Schematic items list */
m_Zoom = 32; m_Zoom = 32;
for( i = 0; i < SCHEMATIC_ZOOM_LIST_CNT; i++ ) for( i = 0; i < SCHEMATIC_ZOOM_LIST_CNT; i++ )
@ -114,27 +114,30 @@ void SCH_SCREEN::FreeDrawList()
{ {
SCH_ITEM* DrawStruct; SCH_ITEM* DrawStruct;
while( EEDrawList != NULL ) while( GetDrawItems() != NULL )
{ {
DrawStruct = EEDrawList; DrawStruct = GetDrawItems();
EEDrawList = EEDrawList->Next(); SetDrawItems( GetDrawItems()->Next() );
SAFE_DELETE( DrawStruct ); SAFE_DELETE( DrawStruct );
} }
EEDrawList = NULL; SetDrawItems( NULL );
} }
/* If found in EEDrawList, remove DrawStruct from EEDrawList. /* If found in GetDrawItems(), remove DrawStruct from GetDrawItems().
* DrawStruct is not deleted or modified * DrawStruct is not deleted or modified
*/ */
void SCH_SCREEN::RemoveFromDrawList( SCH_ITEM * DrawStruct ) void SCH_SCREEN::RemoveFromDrawList( SCH_ITEM * DrawStruct )
{ {
if( DrawStruct == EEDrawList ) if( DrawStruct == GetDrawItems() )
EEDrawList = EEDrawList->Next(); {
SetDrawItems( GetDrawItems()->Next() );
}
else else
{ {
EDA_BaseStruct* DrawList = EEDrawList; EDA_ITEM* DrawList = GetDrawItems();
while( DrawList && DrawList->Next() ) while( DrawList && DrawList->Next() )
{ {
if( DrawList->Next() == DrawStruct ) if( DrawList->Next() == DrawStruct )
@ -150,7 +153,7 @@ void SCH_SCREEN::RemoveFromDrawList( SCH_ITEM * DrawStruct )
bool SCH_SCREEN::CheckIfOnDrawList( SCH_ITEM* st ) bool SCH_SCREEN::CheckIfOnDrawList( SCH_ITEM* st )
{ {
SCH_ITEM * DrawList = EEDrawList; SCH_ITEM * DrawList = GetDrawItems();
while( DrawList ) while( DrawList )
{ {
@ -165,15 +168,15 @@ bool SCH_SCREEN::CheckIfOnDrawList( SCH_ITEM* st )
void SCH_SCREEN::AddToDrawList( SCH_ITEM* st ) void SCH_SCREEN::AddToDrawList( SCH_ITEM* st )
{ {
st->SetNext( EEDrawList ); st->SetNext( GetDrawItems() );
EEDrawList = st; SetDrawItems( st );
} }
/* Extract the old wires, junctions and buses, an if CreateCopy replace them /* Extract the old wires, junctions and buses, an if CreateCopy replace them
* by a copy. Old ones must be put in undo list, and the new ones can be * by a copy. Old ones must be put in undo list, and the new ones can be
* modified by clean up safely. * modified by clean up safely.
* If an abort command is made, old wires must be put in EEDrawList, and * If an abort command is made, old wires must be put in GetDrawItems(), and
* copies must be deleted. This is because previously stored undo commands * copies must be deleted. This is because previously stored undo commands
* can handle pointers on wires or bus, and we do not delete wires or bus, * can handle pointers on wires or bus, and we do not delete wires or bus,
* we must put they in undo list. * we must put they in undo list.
@ -185,7 +188,7 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
{ {
SCH_ITEM* item, * next_item, * new_item, * List = NULL; SCH_ITEM* item, * next_item, * new_item, * List = NULL;
for( item = EEDrawList; item != NULL; item = next_item ) for( item = GetDrawItems(); item != NULL; item = next_item )
{ {
next_item = item->Next(); next_item = item->Next();
@ -196,14 +199,16 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
RemoveFromDrawList( item ); RemoveFromDrawList( item );
item->SetNext( List ); item->SetNext( List );
List = item; List = item;
if( CreateCopy ) if( CreateCopy )
{ {
if( item->Type() == DRAW_JUNCTION_STRUCT_TYPE ) if( item->Type() == DRAW_JUNCTION_STRUCT_TYPE )
new_item = ( (SCH_JUNCTION*) item )->GenCopy(); new_item = ( (SCH_JUNCTION*) item )->GenCopy();
else else
new_item = ( (SCH_LINE*) item )->GenCopy(); new_item = ( (SCH_LINE*) item )->GenCopy();
new_item->SetNext( EEDrawList );
EEDrawList = new_item; new_item->SetNext( GetDrawItems() );
SetDrawItems( new_item );
} }
break; break;
@ -225,12 +230,14 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
SCH_ITEM* DrawList, * TstDrawList; SCH_ITEM* DrawList, * TstDrawList;
bool Modify = FALSE; bool Modify = FALSE;
DrawList = EEDrawList; DrawList = GetDrawItems();
for( ; DrawList != NULL; DrawList = DrawList->Next() ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
if( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{ {
TstDrawList = DrawList->Next(); TstDrawList = DrawList->Next();
while( TstDrawList ) while( TstDrawList )
{ {
if( TstDrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( TstDrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE )
@ -244,7 +251,7 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
DrawList->m_Flags |= TstDrawList->m_Flags; DrawList->m_Flags |= TstDrawList->m_Flags;
EraseStruct( TstDrawList, this ); EraseStruct( TstDrawList, this );
SetRefreshReq(); SetRefreshReq();
TstDrawList = EEDrawList; TstDrawList = GetDrawItems();
Modify = TRUE; Modify = TRUE;
} }
else else
@ -260,9 +267,9 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
} }
} }
WinEDA_SchematicFrame* frame; SCH_EDIT_FRAME* frame;
frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow(); frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow();
frame->TestDanglingEnds( EEDrawList, DC ); frame->TestDanglingEnds( GetDrawItems(), DC );
return Modify; return Modify;
} }
@ -313,7 +320,7 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
|| fprintf( aFile, "$EndDescr\n" ) < 0 ) || fprintf( aFile, "$EndDescr\n" ) < 0 )
return FALSE; return FALSE;
for( SCH_ITEM* item = EEDrawList; item; item = item->Next() ) for( SCH_ITEM* item = GetDrawItems(); item; item = item->Next() )
{ {
if( !item->Save( aFile ) ) if( !item->Save( aFile ) )
return FALSE; return FALSE;
@ -344,8 +351,10 @@ void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
return; return;
unsigned icnt = aList.m_CommandsList.size(); unsigned icnt = aList.m_CommandsList.size();
if( aItemCount > 0 ) if( aItemCount > 0 )
icnt = aItemCount; icnt = aItemCount;
for( unsigned ii = 0; ii < icnt; ii++ ) for( unsigned ii = 0; ii < icnt; ii++ )
{ {
if( aList.m_CommandsList.size() == 0 ) if( aList.m_CommandsList.size() == 0 )
@ -362,7 +371,7 @@ void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
void SCH_SCREEN::ClearDrawingState() void SCH_SCREEN::ClearDrawingState()
{ {
for( SCH_ITEM* item = EEDrawList; item != NULL; item = item->Next() ) for( SCH_ITEM* item = GetDrawItems(); item != NULL; item = item->Next() )
item->m_Flags = 0; item->m_Flags = 0;
} }
@ -427,24 +436,27 @@ void SCH_SCREENS::AddScreenToList( SCH_SCREEN* aScreen )
} }
void SCH_SCREENS::BuildScreenList( EDA_BaseStruct* aItem ) void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem )
{ {
if( aItem && aItem->Type() == DRAW_SHEET_STRUCT_TYPE ) if( aItem && aItem->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
SCH_SHEET* ds = (SCH_SHEET*) aItem; SCH_SHEET* ds = (SCH_SHEET*) aItem;
aItem = ds->m_AssociatedScreen; aItem = ds->m_AssociatedScreen;
} }
if( aItem && aItem->Type() == SCREEN_STRUCT_TYPE ) if( aItem && aItem->Type() == SCREEN_STRUCT_TYPE )
{ {
SCH_SCREEN* screen = (SCH_SCREEN*) aItem; SCH_SCREEN* screen = (SCH_SCREEN*) aItem;
AddScreenToList( screen ); AddScreenToList( screen );
EDA_BaseStruct* strct = screen->EEDrawList; EDA_ITEM* strct = screen->GetDrawItems();
while( strct ) while( strct )
{ {
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
BuildScreenList( strct ); BuildScreenList( strct );
} }
strct = strct->Next(); strct = strct->Next();
} }
} }

View File

@ -111,7 +111,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
m_TimeStamp = GetTimeStamp(); m_TimeStamp = GetTimeStamp();
// sheets are added to the EEDrawList like other schematic components. // sheets are added to the GetDrawItems() like other schematic components.
// however, in order to preserve the hierarchy (through m_Parent pointers), // however, in order to preserve the hierarchy (through m_Parent pointers),
// a duplicate of the sheet is added to m_SubSheet array. // a duplicate of the sheet is added to m_SubSheet array.
// must be a duplicate, references just work for a two-layer structure. // must be a duplicate, references just work for a two-layer structure.
@ -249,7 +249,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
/* creates a copy of a sheet /* creates a copy of a sheet
* The linked data itself (EEDrawList) is not duplicated * The linked data itself (GetDrawItems()) is not duplicated
*/ */
SCH_SHEET* SCH_SHEET::GenCopy() SCH_SHEET* SCH_SHEET::GenCopy()
{ {
@ -372,7 +372,7 @@ bool SCH_SHEET::HasUndefinedLabels()
BOOST_FOREACH( SCH_SHEET_PIN label, m_labels ) BOOST_FOREACH( SCH_SHEET_PIN label, m_labels )
{ {
/* Search the schematic for a hierarchical label corresponding to this sheet label. */ /* Search the schematic for a hierarchical label corresponding to this sheet label. */
EDA_BaseStruct* DrawStruct = m_AssociatedScreen->EEDrawList; EDA_ITEM* DrawStruct = m_AssociatedScreen->GetDrawItems();
SCH_HIERLABEL* HLabel = NULL; SCH_HIERLABEL* HLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
@ -396,7 +396,7 @@ bool SCH_SHEET::HasUndefinedLabels()
} }
void SCH_SHEET::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) void SCH_SHEET::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{ {
/* Place list structures for new sheet. */ /* Place list structures for new sheet. */
bool isnew = ( m_Flags & IS_NEW ) ? true : false; bool isnew = ( m_Flags & IS_NEW ) ? true : false;
@ -430,7 +430,8 @@ void SCH_SHEET::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
} }
} }
SCH_ITEM::Place( frame, DC ); //puts it on the EEDrawList. SCH_ITEM::Place( frame, DC ); //puts it on the GetDrawItems().
if( isnew ) if( isnew )
{ {
frame->SetSheetNumberAndCount(); frame->SetSheetNumberAndCount();
@ -448,7 +449,7 @@ void SCH_SHEET::CleanupSheet()
while( i != m_labels.end() ) while( i != m_labels.end() )
{ {
/* Search the schematic for a hierarchical label corresponding to this sheet label. */ /* Search the schematic for a hierarchical label corresponding to this sheet label. */
EDA_BaseStruct* DrawStruct = m_AssociatedScreen->EEDrawList; EDA_ITEM* DrawStruct = m_AssociatedScreen->GetDrawItems();
SCH_HIERLABEL* HLabel = NULL; SCH_HIERLABEL* HLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
@ -656,12 +657,14 @@ int SCH_SHEET::ComponentCount()
if( m_AssociatedScreen ) if( m_AssociatedScreen )
{ {
EDA_BaseStruct* bs; EDA_ITEM* bs;
for( bs = m_AssociatedScreen->EEDrawList; bs != NULL; bs = bs->Next() )
for( bs = m_AssociatedScreen->GetDrawItems(); bs != NULL; bs = bs->Next() )
{ {
if( bs->Type() == TYPE_SCH_COMPONENT ) if( bs->Type() == TYPE_SCH_COMPONENT )
{ {
SCH_COMPONENT* Cmp = (SCH_COMPONENT*) bs; SCH_COMPONENT* Cmp = (SCH_COMPONENT*) bs;
if( Cmp->GetField( VALUE )->m_Text.GetChar( 0 ) != '#' ) if( Cmp->GetField( VALUE )->m_Text.GetChar( 0 ) != '#' )
n++; n++;
} }
@ -688,7 +691,8 @@ bool SCH_SHEET::SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen )
{ {
if( m_AssociatedScreen ) if( m_AssociatedScreen )
{ {
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList; EDA_ITEM* strct = m_AssociatedScreen->GetDrawItems();
while( strct ) while( strct )
{ {
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
@ -728,17 +732,22 @@ bool SCH_SHEET::LocatePathOfScreen( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aList )
if( m_AssociatedScreen ) if( m_AssociatedScreen )
{ {
aList->Push( this ); aList->Push( this );
if( m_AssociatedScreen == aScreen ) if( m_AssociatedScreen == aScreen )
return true; return true;
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList;
EDA_ITEM* strct = m_AssociatedScreen->GetDrawItems();
while( strct ) while( strct )
{ {
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
SCH_SHEET* ss = (SCH_SHEET*) strct; SCH_SHEET* ss = (SCH_SHEET*) strct;
if( ss->LocatePathOfScreen( aScreen, aList ) ) if( ss->LocatePathOfScreen( aScreen, aList ) )
return true; return true;
} }
strct = strct->Next(); strct = strct->Next();
} }
@ -754,10 +763,10 @@ bool SCH_SHEET::LocatePathOfScreen( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aList )
* if a screen already exists, the file is already read. * if a screen already exists, the file is already read.
* m_AssociatedScreen point on the screen, and its m_RefCount is incremented * m_AssociatedScreen point on the screen, and its m_RefCount is incremented
* else creates a new associated screen and load the data file. * else creates a new associated screen and load the data file.
* @param aFrame = a WinEDA_SchematicFrame pointer to the maim schematic frame * @param aFrame = a SCH_EDIT_FRAME pointer to the maim schematic frame
* @return true if OK * @return true if OK
*/ */
bool SCH_SHEET::Load( WinEDA_SchematicFrame* aFrame ) bool SCH_SHEET::Load( SCH_EDIT_FRAME* aFrame )
{ {
bool success = true; bool success = true;
@ -777,17 +786,21 @@ bool SCH_SHEET::Load( WinEDA_SchematicFrame* aFrame )
m_AssociatedScreen = new SCH_SCREEN(); m_AssociatedScreen = new SCH_SCREEN();
m_AssociatedScreen->m_RefCount++; m_AssociatedScreen->m_RefCount++;
success = aFrame->LoadOneEEFile( m_AssociatedScreen, m_FileName ); success = aFrame->LoadOneEEFile( m_AssociatedScreen, m_FileName );
if( success ) if( success )
{ {
EDA_BaseStruct* bs = m_AssociatedScreen->EEDrawList; EDA_ITEM* bs = m_AssociatedScreen->GetDrawItems();
while( bs ) while( bs )
{ {
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE ) if( bs->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
SCH_SHEET* sheetstruct = (SCH_SHEET*) bs; SCH_SHEET* sheetstruct = (SCH_SHEET*) bs;
if( !sheetstruct->Load( aFrame ) ) if( !sheetstruct->Load( aFrame ) )
success = false; success = false;
} }
bs = bs->Next(); bs = bs->Next();
} }
} }
@ -810,7 +823,8 @@ int SCH_SHEET::CountSheets()
if( m_AssociatedScreen ) if( m_AssociatedScreen )
{ {
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList; EDA_ITEM* strct = m_AssociatedScreen->GetDrawItems();
for( ; strct; strct = strct->Next() ) for( ; strct; strct = strct->Next() )
{ {
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
@ -841,8 +855,7 @@ wxString SCH_SHEET::GetFileName( void )
* @param aFileName = the new filename * @param aFileName = the new filename
* @param aFrame = the schematic frame * @param aFrame = the schematic frame
*/ */
bool SCH_SHEET::ChangeFileName( WinEDA_SchematicFrame* aFrame, bool SCH_SHEET::ChangeFileName( SCH_EDIT_FRAME* aFrame, const wxString& aFileName )
const wxString& aFileName )
{ {
if( ( GetFileName() == aFileName ) && m_AssociatedScreen ) if( ( GetFileName() == aFileName ) && m_AssociatedScreen )
return true; return true;

View File

@ -16,7 +16,7 @@ class SCH_SHEET;
class SCH_SHEET_PIN; class SCH_SHEET_PIN;
class SCH_SHEET_PATH; class SCH_SHEET_PATH;
class DANGLING_END_ITEM; class DANGLING_END_ITEM;
class WinEDA_SchematicFrame; class SCH_EDIT_FRAME;
/** /**
@ -110,7 +110,7 @@ public:
*/ */
SCH_SHEET* GetParent() const { return (SCH_SHEET*) m_Parent; } SCH_SHEET* GetParent() const { return (SCH_SHEET*) m_Parent; }
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
/*the functions Draw, CreateGraphicShape and Plot are no removed as /*the functions Draw, CreateGraphicShape and Plot are no removed as
* as this shape is already handled as HIERLABEL ... * as this shape is already handled as HIERLABEL ...
@ -259,7 +259,7 @@ public:
*/ */
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
SCH_SHEET* GenCopy(); SCH_SHEET* GenCopy();
void DisplayInfo( WinEDA_DrawFrame* frame ); void DisplayInfo( WinEDA_DrawFrame* frame );
@ -379,11 +379,11 @@ public:
* m_AssociatedScreen point on the screen, and its m_RefCount is * m_AssociatedScreen point on the screen, and its m_RefCount is
* incremented * incremented
* else creates a new associated screen and load the data file. * else creates a new associated screen and load the data file.
* @param aFrame = a WinEDA_SchematicFrame pointer to the maim schematic * @param aFrame = a SCH_EDIT_FRAME pointer to the maim schematic
* frame * frame
* @return true if OK * @return true if OK
*/ */
bool Load( WinEDA_SchematicFrame* aFrame ); bool Load( SCH_EDIT_FRAME* aFrame );
/** /**
* Function SearchHierarchy * Function SearchHierarchy
@ -442,8 +442,7 @@ public:
* @param aFileName = the new filename * @param aFileName = the new filename
* @param aFrame = the schematic frame * @param aFrame = the schematic frame
*/ */
bool ChangeFileName( WinEDA_SchematicFrame* aFrame, bool ChangeFileName( SCH_EDIT_FRAME* aFrame, const wxString& aFileName );
const wxString& aFileName );
//void RemoveSheet(SCH_SHEET* sheet); //void RemoveSheet(SCH_SHEET* sheet);
//to remove a sheet, just delete it //to remove a sheet, just delete it

View File

@ -136,8 +136,10 @@ SCH_SCREEN* SCH_SHEET_PATH::LastScreen()
SCH_ITEM* SCH_SHEET_PATH::LastDrawList() SCH_ITEM* SCH_SHEET_PATH::LastDrawList()
{ {
SCH_SHEET* lastSheet = Last(); SCH_SHEET* lastSheet = Last();
if( lastSheet && lastSheet->m_AssociatedScreen ) if( lastSheet && lastSheet->m_AssociatedScreen )
return lastSheet->m_AssociatedScreen->EEDrawList; return lastSheet->m_AssociatedScreen->GetDrawItems();
return NULL; return NULL;
} }
@ -147,10 +149,10 @@ SCH_ITEM* SCH_SHEET_PATH::FirstDrawList()
SCH_ITEM* item = NULL; SCH_ITEM* item = NULL;
if( m_numSheets && m_sheets[0]->m_AssociatedScreen ) if( m_numSheets && m_sheets[0]->m_AssociatedScreen )
item = m_sheets[0]->m_AssociatedScreen->EEDrawList; item = m_sheets[0]->m_AssociatedScreen->GetDrawItems();
/* @fixme - These lists really should be one of the boost pointer containers. This /* @fixme - These lists really should be one of the boost pointer containers. This
* is a brain dead hack to allow reverse iteration of EDA_BaseStruct linked * is a brain dead hack to allow reverse iteration of EDA_ITEM linked
* list. * list.
*/ */
SCH_ITEM* lastItem = NULL; SCH_ITEM* lastItem = NULL;
@ -253,7 +255,7 @@ wxString SCH_SHEET_PATH::PathHumanReadable() const
void SCH_SHEET_PATH::UpdateAllScreenReferences() void SCH_SHEET_PATH::UpdateAllScreenReferences()
{ {
EDA_BaseStruct* t = LastDrawList(); EDA_ITEM* t = LastDrawList();
while( t ) while( t )
{ {
@ -530,7 +532,8 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
if( aSheet->m_AssociatedScreen != NULL ) if( aSheet->m_AssociatedScreen != NULL )
{ {
EDA_BaseStruct* strct = m_currList.LastDrawList(); EDA_ITEM* strct = m_currList.LastDrawList();
while( strct ) while( strct )
{ {
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )

View File

@ -378,7 +378,7 @@ void SCH_TEXT::SwapData( SCH_TEXT* copyitem )
} }
void SCH_TEXT::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) void SCH_TEXT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{ {
/* save old text in undo list */ /* save old text in undo list */
if( g_ItemToUndoCopy && ( (m_Flags & IS_NEW) == 0 ) ) if( g_ItemToUndoCopy && ( (m_Flags & IS_NEW) == 0 ) )

View File

@ -114,7 +114,7 @@ public:
} }
void SwapData( SCH_TEXT* copyitem ); void SwapData( SCH_TEXT* copyitem );
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
/** /**
* Function HitTest * Function HitTest

View File

@ -23,7 +23,7 @@
#include "sch_sheet.h" #include "sch_sheet.h"
void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
@ -125,8 +125,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
if( screen->m_BlockLocate.m_Command != BLOCK_IDLE ) if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor = DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor =
DrawPanel-> DrawPanel->m_PanelDefaultCursor ) );
m_PanelDefaultCursor ) );
// Stop the current command (if any) but keep the current tool // Stop the current command (if any) but keep the current tool
DrawPanel->UnManageCursor(); DrawPanel->UnManageCursor();
@ -150,8 +149,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
default: default:
// Stop the current command and deselect the current tool // Stop the current command and deselect the current tool
DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor = DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor = wxCURSOR_ARROW;
wxCURSOR_ARROW;
DrawPanel->UnManageCursor( 0, DrawPanel->m_PanelCursor ); DrawPanel->UnManageCursor( 0, DrawPanel->m_PanelCursor );
break; break;
} }
@ -279,26 +277,22 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_LABEL );
&dc, TYPE_SCH_LABEL );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_GLOBALLABEL );
&dc, TYPE_SCH_GLOBALLABEL );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_HIERLABEL );
&dc, TYPE_SCH_HIERLABEL );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_TEXT );
&dc, TYPE_SCH_TEXT );
break; break;
case ID_POPUP_SCH_SET_SHAPE_TEXT: case ID_POPUP_SCH_SET_SHAPE_TEXT:
@ -321,7 +315,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DeleteConnection( id == ID_POPUP_SCH_DELETE_CONNECTION ? TRUE : FALSE ); DeleteConnection( id == ID_POPUP_SCH_DELETE_CONNECTION ? TRUE : FALSE );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
TestDanglingEnds( screen->EEDrawList, &dc ); TestDanglingEnds( screen->GetDrawItems(), &dc );
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
@ -330,9 +324,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
SCH_ITEM* oldWiresList = screen->ExtractWires( true ); SCH_ITEM* oldWiresList = screen->ExtractWires( true );
BreakSegment( screen, screen->m_Curseur ); BreakSegment( screen, screen->m_Curseur );
if( oldWiresList ) if( oldWiresList )
SaveCopyInUndoList( oldWiresList, UR_WIRE_IMAGE ); SaveCopyInUndoList( oldWiresList, UR_WIRE_IMAGE );
TestDanglingEnds( screen->EEDrawList, &dc );
TestDanglingEnds( screen->GetDrawItems(), &dc );
} }
break; break;
@ -348,13 +344,14 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_DELETE: case ID_POPUP_SCH_DELETE:
{ {
SCH_ITEM* item = screen->GetCurItem(); SCH_ITEM* item = screen->GetCurItem();
if( item == NULL ) if( item == NULL )
break; break;
DeleteStruct( DrawPanel, &dc, item ); DeleteStruct( DrawPanel, &dc, item );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
TestDanglingEnds( screen->EEDrawList, &dc ); TestDanglingEnds( screen->GetDrawItems(), &dc );
SetSheetNumberAndCount(); SetSheetNumberAndCount();
OnModify(); OnModify();
} }
@ -372,7 +369,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_RESIZE_SHEET: case ID_POPUP_SCH_RESIZE_SHEET:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ReSizeSheet( (SCH_SHEET*) screen->GetCurItem(), &dc ); ReSizeSheet( (SCH_SHEET*) screen->GetCurItem(), &dc );
TestDanglingEnds( screen->EEDrawList, &dc ); TestDanglingEnds( screen->GetDrawItems(), &dc );
break; break;
case ID_POPUP_SCH_EDIT_SHEET: case ID_POPUP_SCH_EDIT_SHEET:
@ -429,20 +426,21 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
&& (screen->GetCurItem()->Type() != TYPE_SCH_HIERLABEL) && (screen->GetCurItem()->Type() != TYPE_SCH_HIERLABEL)
&& (screen->GetCurItem()->Type() != DRAW_SHEET_STRUCT_TYPE) ) && (screen->GetCurItem()->Type() != DRAW_SHEET_STRUCT_TYPE) )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
break; break;
// fall through // fall through
case ID_POPUP_SCH_MOVE_ITEM_REQUEST: case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( id == ID_POPUP_SCH_DRAG_CMP_REQUEST ) if( id == ID_POPUP_SCH_DRAG_CMP_REQUEST )
{ {
// The easiest way to handle a drag component or sheet command // The easiest way to handle a drag component or sheet command
// is to simulate a block drag command // is to simulate a block drag command
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK ) if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
{ {
if( !HandleBlockBegin( &dc, BLOCK_DRAG, if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->m_Curseur ) )
screen->m_Curseur ) )
break; break;
// Give a non null size to the search block: // Give a non null size to the search block:
@ -461,8 +459,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// block drag command // block drag command
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK ) if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
{ {
if( !HandleBlockBegin( &dc, BLOCK_DRAG, if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->m_Curseur ) )
screen->m_Curseur ) )
break; break;
// Ensure the block selection contains the segment, or one end of // Ensure the block selection contains the segment, or one end of
@ -474,12 +471,14 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// only if they do not cross a component // only if they do not cross a component
// TODO: a better way to drag only wires // TODO: a better way to drag only wires
SCH_LINE* segm = (SCH_LINE*) screen->GetCurItem(); SCH_LINE* segm = (SCH_LINE*) screen->GetCurItem();
if( !screen->m_BlockLocate.Inside( segm->m_Start ) if( !screen->m_BlockLocate.Inside( segm->m_Start )
&& !screen->m_BlockLocate.Inside( segm->m_End ) ) && !screen->m_BlockLocate.Inside( segm->m_End ) )
{ {
screen->m_BlockLocate.SetOrigin( segm->m_Start ); screen->m_BlockLocate.SetOrigin( segm->m_Start );
screen->m_BlockLocate.SetEnd( segm->m_End ); screen->m_BlockLocate.SetEnd( segm->m_End );
} }
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
} }
break; break;
@ -490,10 +489,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
break; break;
InstallCmpeditFrame( this, pos,
(SCH_COMPONENT*) screen->GetCurItem() ); InstallCmpeditFrame( this, pos, (SCH_COMPONENT*) screen->GetCurItem() );
break; break;
case ID_POPUP_SCH_MIROR_X_CMP: case ID_POPUP_SCH_MIROR_X_CMP:
@ -506,6 +506,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
break; break;
{ {
@ -531,12 +532,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
} }
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( screen->GetCurItem()->m_Flags == 0 )
SaveCopyInUndoList( (SCH_ITEM*) screen->GetCurItem(),
UR_CHANGED );
CmpRotationMiroir( (SCH_COMPONENT*) screen->GetCurItem(), if( screen->GetCurItem()->m_Flags == 0 )
&dc, option ); SaveCopyInUndoList( (SCH_ITEM*) screen->GetCurItem(), UR_CHANGED );
CmpRotationMiroir( (SCH_COMPONENT*) screen->GetCurItem(), &dc, option );
break; break;
} }
@ -550,11 +550,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
break; break;
EditComponentValue( EditComponentValue( (SCH_COMPONENT*) screen->GetCurItem(), &dc );
(SCH_COMPONENT*) screen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_EDIT_REF_CMP: case ID_POPUP_SCH_EDIT_REF_CMP:
@ -563,6 +563,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
break; break;
@ -575,8 +576,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
break; break;
EditComponentFootprint( (SCH_COMPONENT*) screen->GetCurItem(), &dc ); EditComponentFootprint( (SCH_COMPONENT*) screen->GetCurItem(), &dc );
break; break;
@ -587,12 +590,12 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ConvertPart( ConvertPart( (SCH_COMPONENT*) screen->GetCurItem(), &dc );
(SCH_COMPONENT*) screen->GetCurItem(),
&dc );
break; break;
case ID_POPUP_SCH_SELECT_UNIT1: case ID_POPUP_SCH_SELECT_UNIT1:
@ -626,8 +629,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
SelPartUnit( (SCH_COMPONENT*) screen->GetCurItem(), SelPartUnit( (SCH_COMPONENT*) screen->GetCurItem(),
id + 1 - ID_POPUP_SCH_SELECT_UNIT1, &dc ); id + 1 - ID_POPUP_SCH_SELECT_UNIT1, &dc );
@ -639,6 +644,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// component, like Field, text..) // component, like Field, text..)
if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT )
screen->SetCurItem( LocateSmallestComponent( screen ) ); screen->SetCurItem( LocateSmallestComponent( screen ) );
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
break; break;
{ {
@ -656,7 +662,8 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ENTER_SHEET: case ID_POPUP_SCH_ENTER_SHEET:
{ {
EDA_BaseStruct* DrawStruct = screen->GetCurItem(); EDA_ITEM* DrawStruct = screen->GetCurItem();
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) ) if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
{ {
InstallNextScreen( (SCH_SHEET*) DrawStruct ); InstallNextScreen( (SCH_SHEET*) DrawStruct );
@ -719,35 +726,31 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ADD_JUNCTION: case ID_POPUP_SCH_ADD_JUNCTION:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
screen->SetCurItem( CreateNewJunctionStruct( &dc, screen->m_Curseur, screen->SetCurItem( CreateNewJunctionStruct( &dc, screen->m_Curseur, true ) );
true ) ); TestDanglingEnds( screen->GetDrawItems(), &dc );
TestDanglingEnds( screen->EEDrawList, &dc );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
break; break;
case ID_POPUP_SCH_ADD_LABEL: case ID_POPUP_SCH_ADD_LABEL:
case ID_POPUP_SCH_ADD_GLABEL: case ID_POPUP_SCH_ADD_GLABEL:
screen->SetCurItem( screen->SetCurItem( CreateNewText( &dc, id == ID_POPUP_SCH_ADD_LABEL ?
CreateNewText( &dc,
id == ID_POPUP_SCH_ADD_LABEL ?
LAYER_LOCLABEL : LAYER_GLOBLABEL ) ); LAYER_LOCLABEL : LAYER_GLOBLABEL ) );
if( screen->GetCurItem() ) if( screen->GetCurItem() )
{ {
( (SCH_ITEM*) screen->GetCurItem() )->Place( this, &dc ); ( (SCH_ITEM*) screen->GetCurItem() )->Place( this, &dc );
TestDanglingEnds( screen->EEDrawList, &dc ); TestDanglingEnds( screen->GetDrawItems(), &dc );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
} }
break; break;
case ID_POPUP_SCH_GETINFO_MARKER: case ID_POPUP_SCH_GETINFO_MARKER:
if( screen->GetCurItem() if( screen->GetCurItem() && screen->GetCurItem()->Type() == TYPE_SCH_MARKER )
&& screen->GetCurItem()->Type() == TYPE_SCH_MARKER )
( (SCH_MARKER*) screen->GetCurItem() )->DisplayMarkerInfo( this ); ( (SCH_MARKER*) screen->GetCurItem() )->DisplayMarkerInfo( this );
break; break;
default: // Log error: default: // Log error:
DisplayError( this, DisplayError( this, wxT( "SCH_EDIT_FRAME::Process_Special_Functions error" ) );
wxT( "WinEDA_SchematicFrame::Process_Special_Functions error" ) );
break; break;
} }
@ -755,11 +758,12 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
SetToolbars(); SetToolbars();
} }
void WinEDA_SchematicFrame::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC ) void SCH_EDIT_FRAME::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC )
{ {
if( DrawStruct == NULL ) if( DrawStruct == NULL )
return; return;
@ -804,8 +808,7 @@ void WinEDA_SchematicFrame::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC )
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
default: default:
wxString msg; wxString msg;
msg.Printf( msg.Printf( wxT( "SCH_EDIT_FRAME::Move_Item Error: Bad DrawType %d" ),
wxT( "WinEDA_SchematicFrame::Move_Item Error: Bad DrawType %d" ),
DrawStruct->Type() ); DrawStruct->Type() );
DisplayError( this, msg ); DisplayError( this, msg );
break; break;

View File

@ -52,7 +52,7 @@
* *
* Redo command * Redo command
* - delete item(s) old command: * - delete item(s) old command:
* => deleted items are moved in EEDrawList list, and in * => deleted items are moved in GetDrawItems() list, and in
* *
* - change item(s) command * - change item(s) command
* => the copy of item(s) is moved in Undo list * => the copy of item(s) is moved in Undo list
@ -78,7 +78,7 @@
* 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_BaseStruct* aItem, EDA_BaseStruct* aImage ) void SwapData( EDA_ITEM* aItem, EDA_ITEM* aImage )
{ {
if( aItem == NULL || aImage == NULL ) if( aItem == NULL || aImage == NULL )
{ {
@ -195,8 +195,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
* UR_MOVED * UR_MOVED
* *
* If it is a delete command, items are put on list with the .Flags member * If it is a delete command, items are put on list with the .Flags member
* set to UR_DELETED. When it will be really deleted, the EEDrawList and the * set to UR_DELETED. When it will be really deleted, the GetDrawItems() and the
* sub-hierarchy will be deleted. If it is only a copy, the EEDrawList and the * sub-hierarchy will be deleted. If it is only a copy, the GetDrawItems() and the
* sub-hierarchy must NOT be deleted. * sub-hierarchy must NOT be deleted.
* *
* Note: * Note:
@ -207,7 +207,7 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
* wires saved in Undo List (for Undo or Redo commands, saved wires will be * wires saved in Undo List (for Undo or Redo commands, saved wires will be
* exchanged with current wire list * exchanged with current wire list
*/ */
void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* aItem, void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem,
UndoRedoOpType aCommandType, UndoRedoOpType aCommandType,
const wxPoint& aTransformPoint ) const wxPoint& aTransformPoint )
{ {
@ -225,6 +225,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* aItem,
commandToUndo->m_TransformPoint = aTransformPoint; commandToUndo->m_TransformPoint = aTransformPoint;
ITEM_PICKER itemWrapper( aItem, aCommandType ); ITEM_PICKER itemWrapper( aItem, aCommandType );
if( aItem ) if( aItem )
{ {
itemWrapper.m_PickedItemType = aItem->Type(); itemWrapper.m_PickedItemType = aItem->Type();
@ -275,7 +276,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* aItem,
* @param aItemsList = a PICKED_ITEMS_LIST of items to save * @param aItemsList = a PICKED_ITEMS_LIST of items to save
* @param aTypeCommand = type of command ( UR_CHANGED, UR_NEW, UR_DELETED ... * @param aTypeCommand = type of command ( UR_CHANGED, UR_NEW, UR_DELETED ...
*/ */
void WinEDA_SchematicFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UndoRedoOpType aTypeCommand, UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint ) const wxPoint& aTransformPoint )
{ {
@ -323,8 +324,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
default: default:
{ {
wxString msg; wxString msg;
msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), command );
command );
wxMessageBox( msg ); wxMessageBox( msg );
} }
break; break;
@ -352,8 +352,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo * @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
* @param aRedoCommand = a bool: true for redo, false for undo * @param aRedoCommand = a bool: true for redo, false for undo
*/ */
void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand )
bool aRedoCommand )
{ {
SCH_ITEM* item; SCH_ITEM* item;
SCH_ITEM* alt_item; SCH_ITEM* alt_item;
@ -381,8 +380,8 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList,
case UR_DELETED: /* deleted items are put in EEdrawList, as new items */ case UR_DELETED: /* deleted items are put in EEdrawList, as new items */
aList->SetPickedItemStatus( UR_NEW, ii ); aList->SetPickedItemStatus( UR_NEW, ii );
item->SetNext( GetScreen()->EEDrawList ); item->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->EEDrawList = item; GetScreen()->SetDrawItems( item );
break; break;
case UR_MOVED: case UR_MOVED:
@ -422,8 +421,8 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList,
while( item ) while( item )
{ {
SCH_ITEM* nextitem = item->Next(); SCH_ITEM* nextitem = item->Next();
item->SetNext( GetScreen()->EEDrawList ); item->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->EEDrawList = item; GetScreen()->SetDrawItems( item );
item->m_Flags = 0; item->m_Flags = 0;
item = nextitem; item = nextitem;
} }
@ -450,7 +449,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList,
* - Get the previous version of the schematic from undo list * - Get the previous version of the schematic from undo list
* @return none * @return none
*/ */
void WinEDA_SchematicFrame::GetSchematicFromUndoList( wxCommandEvent& event ) void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event )
{ {
if( GetScreen()->GetUndoCommandCount() <= 0 ) if( GetScreen()->GetUndoCommandCount() <= 0 )
return; return;
@ -471,7 +470,7 @@ void WinEDA_SchematicFrame::GetSchematicFromUndoList( wxCommandEvent& event )
ReCreateHToolbar(); ReCreateHToolbar();
SetToolbars(); SetToolbars();
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
@ -483,7 +482,7 @@ void WinEDA_SchematicFrame::GetSchematicFromUndoList( wxCommandEvent& event )
* - Get the previous version from Redo list * - Get the previous version from Redo list
* @return none * @return none
*/ */
void WinEDA_SchematicFrame::GetSchematicFromRedoList( wxCommandEvent& event ) void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event )
{ {
if( GetScreen()->GetRedoCommandCount() == 0 ) if( GetScreen()->GetRedoCommandCount() == 0 )
return; return;
@ -505,6 +504,6 @@ void WinEDA_SchematicFrame::GetSchematicFromRedoList( wxCommandEvent& event )
ReCreateHToolbar(); ReCreateHToolbar();
SetToolbars(); SetToolbars();
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->GetDrawItems(), NULL );
DrawPanel->Refresh(); DrawPanel->Refresh();
} }

View File

@ -38,115 +38,114 @@
#include "dialogs/dialog_SVG_print.h" #include "dialogs/dialog_SVG_print.h"
BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame ) BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, WinEDA_DrawFrame )
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, WinEDA_DrawFrame::OnSockRequestServer ) EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, WinEDA_DrawFrame::OnSockRequestServer )
EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_DrawFrame::OnSockRequest ) EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_DrawFrame::OnSockRequest )
EVT_CLOSE( WinEDA_SchematicFrame::OnCloseWindow ) EVT_CLOSE( SCH_EDIT_FRAME::OnCloseWindow )
EVT_SIZE( WinEDA_SchematicFrame::OnSize ) EVT_SIZE( SCH_EDIT_FRAME::OnSize )
EVT_MENU( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject ) EVT_MENU( ID_NEW_PROJECT, SCH_EDIT_FRAME::OnNewProject )
EVT_MENU( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject ) EVT_MENU( ID_LOAD_PROJECT, SCH_EDIT_FRAME::OnLoadProject )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_SchematicFrame::OnLoadFile ) EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, SCH_EDIT_FRAME::OnLoadFile )
EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject ) EVT_TOOL( ID_NEW_PROJECT, SCH_EDIT_FRAME::OnNewProject )
EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject ) EVT_TOOL( ID_LOAD_PROJECT, SCH_EDIT_FRAME::OnLoadProject )
EVT_MENU( ID_SAVE_PROJECT, WinEDA_SchematicFrame::Save_File ) EVT_MENU( ID_SAVE_PROJECT, SCH_EDIT_FRAME::Save_File )
EVT_MENU( ID_SAVE_ONE_SHEET, WinEDA_SchematicFrame::Save_File ) EVT_MENU( ID_SAVE_ONE_SHEET, SCH_EDIT_FRAME::Save_File )
EVT_MENU( ID_SAVE_ONE_SHEET_AS, WinEDA_SchematicFrame::Save_File ) EVT_MENU( ID_SAVE_ONE_SHEET_AS, SCH_EDIT_FRAME::Save_File )
EVT_TOOL( ID_SAVE_PROJECT, WinEDA_SchematicFrame::Save_File ) EVT_TOOL( ID_SAVE_PROJECT, SCH_EDIT_FRAME::Save_File )
EVT_MENU( wxID_PRINT, WinEDA_SchematicFrame::OnPrint ) EVT_MENU( wxID_PRINT, SCH_EDIT_FRAME::OnPrint )
EVT_MENU( ID_GEN_PLOT_PS, WinEDA_SchematicFrame::ToPlot_PS ) EVT_MENU( ID_GEN_PLOT_PS, SCH_EDIT_FRAME::ToPlot_PS )
EVT_MENU( ID_GEN_PLOT_HPGL, WinEDA_SchematicFrame::ToPlot_HPGL ) EVT_MENU( ID_GEN_PLOT_HPGL, SCH_EDIT_FRAME::ToPlot_HPGL )
EVT_MENU( ID_GEN_PLOT_SVG, WinEDA_SchematicFrame::SVG_Print ) EVT_MENU( ID_GEN_PLOT_SVG, SCH_EDIT_FRAME::SVG_Print )
EVT_MENU( ID_GEN_PLOT_DXF, WinEDA_SchematicFrame::ToPlot_DXF ) EVT_MENU( ID_GEN_PLOT_DXF, SCH_EDIT_FRAME::ToPlot_DXF )
EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard ) EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard )
EVT_MENU( ID_GEN_COPY_BLOCK_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard ) EVT_MENU( ID_GEN_COPY_BLOCK_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard )
EVT_MENU( wxID_EXIT, WinEDA_SchematicFrame::OnExit ) EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
EVT_MENU( ID_POPUP_SCH_COPY_ITEM, WinEDA_SchematicFrame::OnCopySchematicItemRequest ) EVT_MENU( ID_POPUP_SCH_COPY_ITEM, SCH_EDIT_FRAME::OnCopySchematicItemRequest )
EVT_MENU( ID_CONFIG_REQ, WinEDA_SchematicFrame::InstallConfigFrame ) EVT_MENU( ID_CONFIG_REQ, SCH_EDIT_FRAME::InstallConfigFrame )
EVT_MENU( ID_CONFIG_SAVE, WinEDA_SchematicFrame::Process_Config ) EVT_MENU( ID_CONFIG_SAVE, SCH_EDIT_FRAME::Process_Config )
EVT_MENU( ID_CONFIG_READ, WinEDA_SchematicFrame::Process_Config ) EVT_MENU( ID_CONFIG_READ, SCH_EDIT_FRAME::Process_Config )
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START,
ID_PREFERENCES_HOTKEY_END, ID_PREFERENCES_HOTKEY_END,
WinEDA_SchematicFrame::Process_Config ) SCH_EDIT_FRAME::Process_Config )
EVT_MENU( ID_COLORS_SETUP, WinEDA_SchematicFrame::OnColorConfig ) EVT_MENU( ID_COLORS_SETUP, SCH_EDIT_FRAME::OnColorConfig )
EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_SchematicFrame::OnSetOptions ) EVT_TOOL( ID_OPTIONS_SETUP, SCH_EDIT_FRAME::OnSetOptions )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, SCH_EDIT_FRAME::SetLanguage )
WinEDA_SchematicFrame::SetLanguage )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_SchematicFrame::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, SCH_EDIT_FRAME::OnZoom )
EVT_TOOL( ID_TO_LIBRARY, WinEDA_SchematicFrame::OnOpenLibraryEditor ) EVT_TOOL( ID_TO_LIBRARY, SCH_EDIT_FRAME::OnOpenLibraryEditor )
EVT_TOOL( ID_TO_LIBVIEW, WinEDA_SchematicFrame::OnOpenLibraryViewer ) EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer )
EVT_TOOL( ID_TO_PCB, WinEDA_SchematicFrame::OnOpenPcbnew ) EVT_TOOL( ID_TO_PCB, SCH_EDIT_FRAME::OnOpenPcbnew )
EVT_TOOL( ID_TO_CVPCB, WinEDA_SchematicFrame::OnOpenCvpcb ) EVT_TOOL( ID_TO_CVPCB, SCH_EDIT_FRAME::OnOpenCvpcb )
EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings ) EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
EVT_TOOL( ID_HIERARCHY, WinEDA_SchematicFrame::Process_Special_Functions ) EVT_TOOL( ID_HIERARCHY, SCH_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_CUT, WinEDA_SchematicFrame::Process_Special_Functions ) EVT_TOOL( wxID_CUT, SCH_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_COPY, WinEDA_SchematicFrame::Process_Special_Functions ) EVT_TOOL( wxID_COPY, SCH_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_PASTE, WinEDA_SchematicFrame::Process_Special_Functions ) EVT_TOOL( wxID_PASTE, SCH_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_UNDO, WinEDA_SchematicFrame::GetSchematicFromUndoList ) EVT_TOOL( wxID_UNDO, SCH_EDIT_FRAME::GetSchematicFromUndoList )
EVT_TOOL( wxID_REDO, WinEDA_SchematicFrame::GetSchematicFromRedoList ) EVT_TOOL( wxID_REDO, SCH_EDIT_FRAME::GetSchematicFromRedoList )
EVT_TOOL( ID_GET_ANNOTATE, WinEDA_SchematicFrame::OnAnnotate ) EVT_TOOL( ID_GET_ANNOTATE, SCH_EDIT_FRAME::OnAnnotate )
EVT_TOOL( wxID_PRINT, WinEDA_SchematicFrame::OnPrint ) EVT_TOOL( wxID_PRINT, SCH_EDIT_FRAME::OnPrint )
EVT_TOOL( ID_GET_ERC, WinEDA_SchematicFrame::OnErc ) EVT_TOOL( ID_GET_ERC, SCH_EDIT_FRAME::OnErc )
EVT_TOOL( ID_GET_NETLIST, WinEDA_SchematicFrame::OnCreateNetlist ) EVT_TOOL( ID_GET_NETLIST, SCH_EDIT_FRAME::OnCreateNetlist )
EVT_TOOL( ID_GET_TOOLS, WinEDA_SchematicFrame::OnCreateBillOfMaterials ) EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_SchematicFrame::OnFindItems ) EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems )
EVT_TOOL( ID_BACKANNO_ITEMS, WinEDA_SchematicFrame::OnLoadStuffFile ) EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadStuffFile )
EVT_TOOL( ID_COMPONENT_BUTT, WinEDA_SchematicFrame::Process_Special_Functions ) EVT_TOOL( ID_COMPONENT_BUTT, SCH_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp ) EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout ) EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
// Tools and buttons for vertical toolbar. // Tools and buttons for vertical toolbar.
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_SchematicFrame::Process_Special_Functions ) EVT_TOOL( ID_NO_SELECT_BUTT, SCH_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
ID_SCHEMATIC_VERTICAL_TOOLBAR_END, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
WinEDA_SchematicFrame::Process_Special_Functions ) SCH_EDIT_FRAME::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE, EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
WinEDA_SchematicFrame::Process_Special_Functions ) SCH_EDIT_FRAME::Process_Special_Functions )
// Tools and buttons options toolbar // Tools and buttons options toolbar
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END, EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_SchematicFrame::OnSelectOptionToolbar ) SCH_EDIT_FRAME::OnSelectOptionToolbar )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_SchematicFrame::Process_Special_Functions ) SCH_EDIT_FRAME::Process_Special_Functions )
/* Handle user interface update events. */ /* Handle user interface update events. */
EVT_UPDATE_UI( wxID_CUT, WinEDA_SchematicFrame::OnUpdateBlockSelected ) EVT_UPDATE_UI( wxID_CUT, SCH_EDIT_FRAME::OnUpdateBlockSelected )
EVT_UPDATE_UI( wxID_COPY, WinEDA_SchematicFrame::OnUpdateBlockSelected ) EVT_UPDATE_UI( wxID_COPY, SCH_EDIT_FRAME::OnUpdateBlockSelected )
EVT_UPDATE_UI( wxID_PASTE, WinEDA_SchematicFrame::OnUpdatePaste ) EVT_UPDATE_UI( wxID_PASTE, SCH_EDIT_FRAME::OnUpdatePaste )
EVT_UPDATE_UI( wxID_UNDO, WinEDA_SchematicFrame::OnUpdateSchematicUndo ) EVT_UPDATE_UI( wxID_UNDO, SCH_EDIT_FRAME::OnUpdateSchematicUndo )
EVT_UPDATE_UI( wxID_REDO, WinEDA_SchematicFrame::OnUpdateSchematicRedo ) EVT_UPDATE_UI( wxID_REDO, SCH_EDIT_FRAME::OnUpdateSchematicRedo )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRID, WinEDA_SchematicFrame::OnUpdateGrid ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRID, SCH_EDIT_FRAME::OnUpdateGrid )
EVT_UPDATE_UI( ID_TB_OPTIONS_SELECT_CURSOR, WinEDA_SchematicFrame::OnUpdateSelectCursor ) EVT_UPDATE_UI( ID_TB_OPTIONS_SELECT_CURSOR, SCH_EDIT_FRAME::OnUpdateSelectCursor )
EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, WinEDA_SchematicFrame::OnUpdateHiddenPins ) EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnUpdateHiddenPins )
EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, WinEDA_SchematicFrame::OnUpdateBusOrientation ) EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnUpdateBusOrientation )
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM,
ID_TB_OPTIONS_SELECT_UNIT_INCH, ID_TB_OPTIONS_SELECT_UNIT_INCH,
WinEDA_SchematicFrame::OnUpdateUnits ) SCH_EDIT_FRAME::OnUpdateUnits )
/* Search dialog events. */ /* Search dialog events. */
EVT_FIND_CLOSE( wxID_ANY, WinEDA_SchematicFrame::OnFindDialogClose ) EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose )
EVT_FIND_DRC_MARKER( wxID_ANY, WinEDA_SchematicFrame::OnFindDrcMarker ) EVT_FIND_DRC_MARKER( wxID_ANY, SCH_EDIT_FRAME::OnFindDrcMarker )
EVT_FIND( wxID_ANY, WinEDA_SchematicFrame::OnFindSchematicItem ) EVT_FIND( wxID_ANY, SCH_EDIT_FRAME::OnFindSchematicItem )
END_EVENT_TABLE() END_EVENT_TABLE()
WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father, SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
@ -242,7 +241,7 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
} }
WinEDA_SchematicFrame::~WinEDA_SchematicFrame() SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
{ {
SAFE_DELETE( g_RootSheet ); SAFE_DELETE( g_RootSheet );
SAFE_DELETE( m_CurrentSheet ); // a SCH_SHEET_PATH, on the heap. SAFE_DELETE( m_CurrentSheet ); // a SCH_SHEET_PATH, on the heap.
@ -251,13 +250,13 @@ WinEDA_SchematicFrame::~WinEDA_SchematicFrame()
} }
BASE_SCREEN* WinEDA_SchematicFrame::GetBaseScreen() const BASE_SCREEN* SCH_EDIT_FRAME::GetBaseScreen() const
{ {
return GetScreen(); return GetScreen();
} }
SCH_SHEET_PATH* WinEDA_SchematicFrame::GetSheet() SCH_SHEET_PATH* SCH_EDIT_FRAME::GetSheet()
{ {
return m_CurrentSheet; return m_CurrentSheet;
} }
@ -269,7 +268,7 @@ SCH_SHEET_PATH* WinEDA_SchematicFrame::GetSheet()
* must be called after a delete or add sheet command, and when entering a * must be called after a delete or add sheet command, and when entering a
* sheet * sheet
*/ */
void WinEDA_SchematicFrame::SetSheetNumberAndCount() void SCH_EDIT_FRAME::SetSheetNumberAndCount()
{ {
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
SCH_SCREENS s_list; SCH_SCREENS s_list;
@ -304,13 +303,13 @@ void WinEDA_SchematicFrame::SetSheetNumberAndCount()
} }
SCH_SCREEN* WinEDA_SchematicFrame::GetScreen() const SCH_SCREEN* SCH_EDIT_FRAME::GetScreen() const
{ {
return m_CurrentSheet->LastScreen(); return m_CurrentSheet->LastScreen();
} }
wxString WinEDA_SchematicFrame::GetScreenDesc() wxString SCH_EDIT_FRAME::GetScreenDesc()
{ {
wxString s = m_CurrentSheet->PathHumanReadable(); wxString s = m_CurrentSheet->PathHumanReadable();
@ -318,7 +317,7 @@ wxString WinEDA_SchematicFrame::GetScreenDesc()
} }
void WinEDA_SchematicFrame::CreateScreens() void SCH_EDIT_FRAME::CreateScreens()
{ {
if( g_RootSheet == NULL ) if( g_RootSheet == NULL )
{ {
@ -341,7 +340,7 @@ void WinEDA_SchematicFrame::CreateScreens()
} }
void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event ) void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{ {
SCH_SHEET_PATH* sheet; SCH_SHEET_PATH* sheet;
@ -393,7 +392,7 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
} }
if( !g_RootSheet->m_AssociatedScreen->m_FileName.IsEmpty() if( !g_RootSheet->m_AssociatedScreen->m_FileName.IsEmpty()
&& (g_RootSheet->m_AssociatedScreen->EEDrawList != NULL) ) && (g_RootSheet->m_AssociatedScreen->GetDrawItems() != NULL) )
SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName ); SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
ClearProjectDrawList( g_RootSheet->m_AssociatedScreen, TRUE ); ClearProjectDrawList( g_RootSheet->m_AssociatedScreen, TRUE );
@ -405,7 +404,7 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
} }
int WinEDA_SchematicFrame::BestZoom() int SCH_EDIT_FRAME::BestZoom()
{ {
int dx, dy; int dx, dy;
wxSize size; wxSize size;
@ -437,7 +436,7 @@ int WinEDA_SchematicFrame::BestZoom()
* and has no extension. * and has no extension.
* However if filename is too long name is <sheet filename>-<sheet number> * However if filename is too long name is <sheet filename>-<sheet number>
*/ */
wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet() wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet()
{ {
wxFileName fn = g_RootSheet->GetFileName(); wxFileName fn = g_RootSheet->GetFileName();
@ -472,7 +471,7 @@ wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet()
* in order to set the "modify" flag of the current screen * in order to set the "modify" flag of the current screen
* and update the date in frame reference * and update the date in frame reference
*/ */
void WinEDA_SchematicFrame::OnModify( ) void SCH_EDIT_FRAME::OnModify( )
{ {
GetScreen()->SetModify(); GetScreen()->SetModify();
@ -494,7 +493,7 @@ void WinEDA_SchematicFrame::OnModify( )
* conditions. * conditions.
*****************************************************************************/ *****************************************************************************/
void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdateBlockSelected( wxUpdateUIEvent& event )
{ {
bool enable = ( GetScreen() && GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ); bool enable = ( GetScreen() && GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE );
@ -504,28 +503,28 @@ void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event )
} }
void WinEDA_SchematicFrame::OnUpdatePaste( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
{ {
event.Enable( g_BlockSaveDataList.GetCount() > 0 ); event.Enable( g_BlockSaveDataList.GetCount() > 0 );
m_HToolBar->EnableTool( wxID_PASTE, g_BlockSaveDataList.GetCount() > 0 ); m_HToolBar->EnableTool( wxID_PASTE, g_BlockSaveDataList.GetCount() > 0 );
} }
void WinEDA_SchematicFrame::OnUpdateSchematicUndo( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdateSchematicUndo( wxUpdateUIEvent& event )
{ {
if( GetScreen() ) if( GetScreen() )
event.Enable( GetScreen()->GetUndoCommandCount() > 0 ); event.Enable( GetScreen()->GetUndoCommandCount() > 0 );
} }
void WinEDA_SchematicFrame::OnUpdateSchematicRedo( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdateSchematicRedo( wxUpdateUIEvent& event )
{ {
if( GetScreen() ) if( GetScreen() )
event.Enable( GetScreen()->GetRedoCommandCount() > 0 ); event.Enable( GetScreen()->GetRedoCommandCount() > 0 );
} }
void WinEDA_SchematicFrame::OnUpdateBusOrientation( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& event )
{ {
wxString tool_tip = g_HVLines ? wxString tool_tip = g_HVLines ?
_( "Draw wires and buses in any direction" ) : _( "Draw wires and buses in any direction" ) :
@ -536,7 +535,7 @@ void WinEDA_SchematicFrame::OnUpdateBusOrientation( wxUpdateUIEvent& event )
} }
void WinEDA_SchematicFrame::OnUpdateHiddenPins( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& event )
{ {
wxString tool_tip = m_ShowAllPins ? _( "Do not show hidden pins" ) : wxString tool_tip = m_ShowAllPins ? _( "Do not show hidden pins" ) :
_( "Show hidden pins" ); _( "Show hidden pins" );
@ -546,13 +545,13 @@ void WinEDA_SchematicFrame::OnUpdateHiddenPins( wxUpdateUIEvent& event )
} }
void WinEDA_SchematicFrame::OnUpdateSelectCursor( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdateSelectCursor( wxUpdateUIEvent& event )
{ {
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, m_CursorShape ); m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, m_CursorShape );
} }
void WinEDA_SchematicFrame::OnUpdateUnits( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdateUnits( wxUpdateUIEvent& event )
{ {
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, g_UserUnit == MILLIMETRES ); m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, g_UserUnit == MILLIMETRES );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, g_UserUnit == INCHES ); m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, g_UserUnit == INCHES );
@ -560,7 +559,7 @@ void WinEDA_SchematicFrame::OnUpdateUnits( wxUpdateUIEvent& event )
} }
void WinEDA_SchematicFrame::OnUpdateGrid( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdateGrid( wxUpdateUIEvent& event )
{ {
wxString tool_tip = IsGridVisible() ? _( "Hide grid" ) : _( "Show grid" ); wxString tool_tip = IsGridVisible() ? _( "Hide grid" ) : _( "Show grid" );
@ -569,7 +568,7 @@ void WinEDA_SchematicFrame::OnUpdateGrid( wxUpdateUIEvent& event )
} }
void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnAnnotate( wxCommandEvent& event )
{ {
DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this ); DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this );
@ -578,7 +577,7 @@ void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event )
} }
void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnErc( wxCommandEvent& event )
{ {
DIALOG_ERC* dlg = new DIALOG_ERC( this ); DIALOG_ERC* dlg = new DIALOG_ERC( this );
@ -587,7 +586,7 @@ void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event )
} }
void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event )
{ {
int i; int i;
@ -605,7 +604,7 @@ void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event )
} }
void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent& ) void SCH_EDIT_FRAME::OnCreateBillOfMaterials( wxCommandEvent& )
{ {
DIALOG_BUILD_BOM* dlg = new DIALOG_BUILD_BOM( this ); DIALOG_BUILD_BOM* dlg = new DIALOG_BUILD_BOM( this );
@ -614,7 +613,7 @@ void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent& )
} }
void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnFindItems( wxCommandEvent& event )
{ {
wxASSERT_MSG( m_findReplaceData != NULL, wxASSERT_MSG( m_findReplaceData != NULL,
wxT( "Forgot to create find/replace data. Bad Programmer!" ) ); wxT( "Forgot to create find/replace data. Bad Programmer!" ) );
@ -636,7 +635,7 @@ void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
} }
void WinEDA_SchematicFrame::OnFindDialogClose( wxFindDialogEvent& event ) void SCH_EDIT_FRAME::OnFindDialogClose( wxFindDialogEvent& event )
{ {
if( m_dlgFindReplace ) if( m_dlgFindReplace )
{ {
@ -652,7 +651,7 @@ void WinEDA_SchematicFrame::OnFindDialogClose( wxFindDialogEvent& event )
} }
void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
{ {
wxString fn; wxString fn;
@ -666,26 +665,26 @@ void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
} }
void WinEDA_SchematicFrame::OnLoadStuffFile( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnLoadStuffFile( wxCommandEvent& event )
{ {
ReadInputStuffFile(); ReadInputStuffFile();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
void WinEDA_SchematicFrame::OnNewProject( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event )
{ {
LoadOneEEProject( wxEmptyString, true ); LoadOneEEProject( wxEmptyString, true );
} }
void WinEDA_SchematicFrame::OnLoadProject( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnLoadProject( wxCommandEvent& event )
{ {
LoadOneEEProject( wxEmptyString, false ); LoadOneEEProject( wxEmptyString, false );
} }
void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
{ {
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName; wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
@ -702,7 +701,7 @@ void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event )
} }
void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
{ {
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName; wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
@ -717,7 +716,7 @@ void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event )
} }
void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnOpenLibraryViewer( wxCommandEvent& event )
{ {
if( m_ViewlibFrame ) if( m_ViewlibFrame )
{ {
@ -731,7 +730,7 @@ void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
} }
void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
{ {
if( m_LibeditFrame ) if( m_LibeditFrame )
{ {
@ -749,7 +748,7 @@ void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event )
} }
void WinEDA_SchematicFrame::OnExit( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
{ {
Close( true ); Close( true );
} }
@ -758,7 +757,7 @@ void WinEDA_SchematicFrame::OnExit( wxCommandEvent& event )
* Function SetLanguage * Function SetLanguage
* called on a language menu selection * called on a language menu selection
*/ */
void WinEDA_SchematicFrame::SetLanguage( wxCommandEvent& event ) void SCH_EDIT_FRAME::SetLanguage( wxCommandEvent& event )
{ {
WinEDA_BasicFrame::SetLanguage( event ); WinEDA_BasicFrame::SetLanguage( event );
@ -767,7 +766,7 @@ void WinEDA_SchematicFrame::SetLanguage( wxCommandEvent& event )
} }
void WinEDA_SchematicFrame::OnPrint( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
{ {
wxFileName fn; wxFileName fn;
DIALOG_PRINT_USING_PRINTER dlg( this ); DIALOG_PRINT_USING_PRINTER dlg( this );
@ -788,7 +787,7 @@ void WinEDA_SchematicFrame::OnPrint( wxCommandEvent& event )
/* Creates the SVG print file for the current edited component. /* Creates the SVG print file for the current edited component.
*/ */
void WinEDA_SchematicFrame::SVG_Print( wxCommandEvent& event ) void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event )
{ {
DIALOG_SVG_PRINT frame( this ); DIALOG_SVG_PRINT frame( this );

View File

@ -34,7 +34,7 @@ static wxPoint s_OldPos; /* Former position for cancellation or move ReSize */
/* Routine to edit the SheetName and the FileName for the sheet "Sheet" */ /* Routine to edit the SheetName and the FileName for the sheet "Sheet" */
bool WinEDA_SchematicFrame::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
{ {
bool edit = true; bool edit = true;
@ -211,7 +211,7 @@ static void ExitSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC )
/* Create hierarchy sheet. */ /* Create hierarchy sheet. */
SCH_SHEET* WinEDA_SchematicFrame::CreateSheet( wxDC* aDC ) SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
{ {
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
SAFE_DELETE( g_ItemToUndoCopy ); SAFE_DELETE( g_ItemToUndoCopy );
@ -225,7 +225,7 @@ SCH_SHEET* WinEDA_SchematicFrame::CreateSheet( wxDC* aDC )
s_PreviousSheetWidth = SHEET_MIN_WIDTH; s_PreviousSheetWidth = SHEET_MIN_WIDTH;
s_PreviousSheetHeight = SHEET_MIN_HEIGHT; s_PreviousSheetHeight = SHEET_MIN_HEIGHT;
// need to check if this is being added to the EEDrawList. // need to check if this is being added to the GetDrawItems().
// also need to update the hierarchy, if we are adding // also need to update the hierarchy, if we are adding
// a sheet to a screen that already has multiple instances (!) // a sheet to a screen that already has multiple instances (!)
GetScreen()->SetCurItem( sheet ); GetScreen()->SetCurItem( sheet );
@ -239,15 +239,14 @@ SCH_SHEET* WinEDA_SchematicFrame::CreateSheet( wxDC* aDC )
} }
void WinEDA_SchematicFrame::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC ) void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
{ {
if( aSheet == NULL || aSheet->m_Flags & IS_NEW ) if( aSheet == NULL || aSheet->m_Flags & IS_NEW )
return; return;
if( aSheet->Type() != DRAW_SHEET_STRUCT_TYPE ) if( aSheet->Type() != DRAW_SHEET_STRUCT_TYPE )
{ {
DisplayError( this, DisplayError( this, wxT( "SCH_EDIT_FRAME::ReSizeSheet: Bad SructType" ) );
wxT( "WinEDA_SchematicFrame::ReSizeSheet: Bad SructType" ) );
return; return;
} }
@ -279,7 +278,7 @@ void WinEDA_SchematicFrame::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
} }
void WinEDA_SchematicFrame::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC ) void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
{ {
if( ( aSheet == NULL ) || ( aSheet->Type() != DRAW_SHEET_STRUCT_TYPE ) ) if( ( aSheet == NULL ) || ( aSheet->Type() != DRAW_SHEET_STRUCT_TYPE ) )
return; return;

View File

@ -61,7 +61,7 @@ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
void SCH_SHEET_PIN::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) void SCH_SHEET_PIN::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
{ {
SCH_SHEET* Sheet = (SCH_SHEET*) GetParent(); SCH_SHEET* Sheet = (SCH_SHEET*) GetParent();
@ -93,7 +93,7 @@ void SCH_SHEET_PIN::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
} }
void WinEDA_SchematicFrame::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC ) void SCH_EDIT_FRAME::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC )
{ {
NetSheetTextSize = SheetLabel->m_Size; NetSheetTextSize = SheetLabel->m_Size;
s_CurrentTypeLabel = SheetLabel->m_Shape; s_CurrentTypeLabel = SheetLabel->m_Shape;
@ -123,7 +123,7 @@ static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
int WinEDA_SchematicFrame::Edit_PinSheet( SCH_SHEET_PIN* aLabel, wxDC* aDC ) int SCH_EDIT_FRAME::Edit_PinSheet( SCH_SHEET_PIN* aLabel, wxDC* aDC )
{ {
if( aLabel == NULL ) if( aLabel == NULL )
return wxID_CANCEL; return wxID_CANCEL;
@ -166,7 +166,7 @@ int WinEDA_SchematicFrame::Edit_PinSheet( SCH_SHEET_PIN* aLabel, wxDC* aDC )
/* Add a new sheet pin to the sheet at the current cursor position. /* Add a new sheet pin to the sheet at the current cursor position.
*/ */
SCH_SHEET_PIN* WinEDA_SchematicFrame::Create_PinSheet( SCH_SHEET* Sheet, wxDC* DC ) SCH_SHEET_PIN* SCH_EDIT_FRAME::Create_PinSheet( SCH_SHEET* Sheet, wxDC* DC )
{ {
wxString Line, Text; wxString Line, Text;
SCH_SHEET_PIN* NewSheetLabel; SCH_SHEET_PIN* NewSheetLabel;
@ -199,16 +199,16 @@ SCH_SHEET_PIN* WinEDA_SchematicFrame::Create_PinSheet( SCH_SHEET* Sheet, wxDC* D
/* Automatically create a sheet labels from global labels for each node in /* Automatically create a sheet labels from global labels for each node in
* the corresponding hierarchy. * the corresponding hierarchy.
*/ */
SCH_SHEET_PIN* WinEDA_SchematicFrame::Import_PinSheet( SCH_SHEET* Sheet, wxDC* DC ) SCH_SHEET_PIN* SCH_EDIT_FRAME::Import_PinSheet( SCH_SHEET* Sheet, wxDC* DC )
{ {
EDA_BaseStruct* DrawStruct; EDA_ITEM* DrawStruct;
SCH_SHEET_PIN* NewSheetLabel; SCH_SHEET_PIN* NewSheetLabel;
SCH_HIERLABEL* HLabel = NULL; SCH_HIERLABEL* HLabel = NULL;
if( !Sheet->m_AssociatedScreen ) if( !Sheet->m_AssociatedScreen )
return NULL; return NULL;
DrawStruct = Sheet->m_AssociatedScreen->EEDrawList; DrawStruct = Sheet->m_AssociatedScreen->GetDrawItems();
HLabel = NULL; HLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
@ -255,7 +255,7 @@ SCH_SHEET_PIN* WinEDA_SchematicFrame::Import_PinSheet( SCH_SHEET* Sheet, wxDC* D
* This sheet label can not be put in a pile "undelete" because it would not * This sheet label can not be put in a pile "undelete" because it would not
* Possible to link it back it's 'SCH_SHEET' parent. * Possible to link it back it's 'SCH_SHEET' parent.
*/ */
void WinEDA_SchematicFrame::DeleteSheetLabel( bool aRedraw, SCH_SHEET_PIN* aSheetLabelToDel ) void SCH_EDIT_FRAME::DeleteSheetLabel( bool aRedraw, SCH_SHEET_PIN* aSheetLabelToDel )
{ {
SCH_SHEET* parent = (SCH_SHEET*) aSheetLabelToDel->GetParent(); SCH_SHEET* parent = (SCH_SHEET*) aSheetLabelToDel->GetParent();

View File

@ -19,7 +19,7 @@
/* Create the main Horizontal Toolbar for the schematic editor /* Create the main Horizontal Toolbar for the schematic editor
*/ */
void WinEDA_SchematicFrame::ReCreateHToolbar() void SCH_EDIT_FRAME::ReCreateHToolbar()
{ {
if( m_HToolBar != NULL ) if( m_HToolBar != NULL )
return; return;
@ -141,7 +141,7 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
/* Create Vertical Right Toolbar /* Create Vertical Right Toolbar
*/ */
void WinEDA_SchematicFrame::ReCreateVToolbar() void SCH_EDIT_FRAME::ReCreateVToolbar()
{ {
if( m_VToolBar ) if( m_VToolBar )
return; return;
@ -238,7 +238,7 @@ void WinEDA_SchematicFrame::ReCreateVToolbar()
/* Create Vertical Left Toolbar (Option Toolbar) /* Create Vertical Left Toolbar (Option Toolbar)
*/ */
void WinEDA_SchematicFrame::ReCreateOptToolbar() void SCH_EDIT_FRAME::ReCreateOptToolbar()
{ {
if( m_OptionsToolBar ) if( m_OptionsToolBar )
return; return;
@ -279,7 +279,7 @@ void WinEDA_SchematicFrame::ReCreateOptToolbar()
} }
void WinEDA_SchematicFrame::OnSelectOptionToolbar( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{ {
if( DrawPanel == NULL ) if( DrawPanel == NULL )
return; return;

View File

@ -240,7 +240,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
LIB_VIEW_FRAME::~LIB_VIEW_FRAME() LIB_VIEW_FRAME::~LIB_VIEW_FRAME()
{ {
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow(); SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow();
frame->m_ViewlibFrame = NULL; frame->m_ViewlibFrame = NULL;
} }

View File

@ -336,11 +336,11 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, int aDrawMode,
if( aDrawMode & GR_SURBRILL ) if( aDrawMode & GR_SURBRILL )
{ {
if( aDrawMode & GR_AND ) if( aDrawMode & GR_AND )
color &= ~HIGHT_LIGHT_FLAG; color &= ~HIGHLIGHT_FLAG;
else else
color |= HIGHT_LIGHT_FLAG; color |= HIGHLIGHT_FLAG;
} }
if( color & HIGHT_LIGHT_FLAG ) if( color & HIGHLIGHT_FLAG )
color = ColorRefs[color & MASKCOLOR].m_LightColor; color = ColorRefs[color & MASKCOLOR].m_LightColor;
alt_color = g_DrawBgColor; alt_color = g_DrawBgColor;

View File

@ -54,8 +54,8 @@ class GERBER_DRAW_ITEM : public BOARD_ITEM
// make SetNext() and SetBack() private so that they may not be called from anywhere. // make SetNext() and SetBack() private so that they may not be called from anywhere.
// list management is done on GERBER_DRAW_ITEMs using DLIST<GERBER_DRAW_ITEM> only. // list management is done on GERBER_DRAW_ITEMs using DLIST<GERBER_DRAW_ITEM> only.
private: private:
void SetNext( EDA_BaseStruct* aNext ) { Pnext = aNext; } void SetNext( EDA_ITEM* aNext ) { Pnext = aNext; }
void SetBack( EDA_BaseStruct* aBack ) { Pback = aBack; } void SetBack( EDA_ITEM* aBack ) { Pback = aBack; }
public: public:
@ -218,7 +218,7 @@ public:
* Function DisplayInfo * Function DisplayInfo
* has knowledge about the frame and how and where to put status information * has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel. * about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct. * Is virtual from EDA_ITEM.
* Display info about this GERBER item * Display info about this GERBER item
* @param frame A WinEDA_DrawFrame in which to print status information. * @param frame A WinEDA_DrawFrame in which to print status information.
*/ */

View File

@ -158,8 +158,10 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
int pointSize = font.GetPointSize(); int pointSize = font.GetPointSize();
int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ); int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
if( screenHeight <= 900 ) if( screenHeight <= 900 )
pointSize = (pointSize * 8) / 10; pointSize = (pointSize * 8) / 10;
m_LayersManager = new GERBER_LAYER_WIDGET( this, DrawPanel, pointSize ); m_LayersManager = new GERBER_LAYER_WIDGET( this, DrawPanel, pointSize );
// LoadSettings() *after* creating m_LayersManager, because LoadSettings() // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
@ -202,7 +204,8 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
m_auimgr.AddPane( m_VToolBar, m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Row( 1 ) ); wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Row( 1 ) );
m_auimgr.AddPane( m_LayersManager, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Row( 0 ) ); m_auimgr.AddPane( m_LayersManager,
lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Row( 0 ) );
if( m_OptionsToolBar ) if( m_OptionsToolBar )
m_auimgr.AddPane( m_OptionsToolBar, m_auimgr.AddPane( m_OptionsToolBar,
@ -249,12 +252,15 @@ int WinEDA_GerberFrame::BestZoom()
EDA_Rect bbox; EDA_Rect bbox;
BOARD_ITEM* item = GetBoard()->m_Drawings; BOARD_ITEM* item = GetBoard()->m_Drawings;
for( ; item; item = item->Next() ) for( ; item; item = item->Next() )
{ {
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item; GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
bbox.Merge( gerb_item->GetBoundingBox() ); bbox.Merge( gerb_item->GetBoundingBox() );
} }
bbox.Inflate( GetScreen()->GetGridSize().x * 2, GetScreen()->GetGridSize().y * 2);
bbox.Inflate( wxRound( GetScreen()->GetGridSize().x * 2 ),
wxRound( GetScreen()->GetGridSize().y * 2 ) );
wxSize size = DrawPanel->GetClientSize(); wxSize size = DrawPanel->GetClientSize();
x = bbox.GetWidth() / (double) size.x; x = bbox.GetWidth() / (double) size.x;
y = bbox.GetHeight() / (double) size.y; y = bbox.GetHeight() / (double) size.y;
@ -264,9 +270,8 @@ int WinEDA_GerberFrame::BestZoom()
return best_zoom; return best_zoom;
} }
/**************************************/
void WinEDA_GerberFrame::LoadSettings() void WinEDA_GerberFrame::LoadSettings()
/**************************************/
{ {
wxConfig* config = wxGetApp().m_EDA_Config; wxConfig* config = wxGetApp().m_EDA_Config;
@ -277,10 +282,14 @@ void WinEDA_GerberFrame::LoadSettings()
long pageSize_opt; long pageSize_opt;
config->Read( GerbviewShowPageSizeOption, &pageSize_opt, 0l ); config->Read( GerbviewShowPageSizeOption, &pageSize_opt, 0l );
int imax = 0; int imax = 0;
for( ; g_GerberPageSizeList[imax] != NULL; imax++ ); for( ; g_GerberPageSizeList[imax] != NULL; imax++ );
if( pageSize_opt < 0 || pageSize_opt >= imax ) if( pageSize_opt < 0 || pageSize_opt >= imax )
pageSize_opt = 0; pageSize_opt = 0;
GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[pageSize_opt]; GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[pageSize_opt];
if ( pageSize_opt > 0 ) if ( pageSize_opt > 0 )
{ {
m_Draw_Sheet_Ref = true; m_Draw_Sheet_Ref = true;
@ -291,9 +300,8 @@ void WinEDA_GerberFrame::LoadSettings()
SetElementVisibility( DCODES_VISIBLE, tmp ); SetElementVisibility( DCODES_VISIBLE, tmp );
} }
/**************************************/
void WinEDA_GerberFrame::SaveSettings() void WinEDA_GerberFrame::SaveSettings()
/**************************************/
{ {
wxConfig* config = wxGetApp().m_EDA_Config; wxConfig* config = wxGetApp().m_EDA_Config;
@ -305,6 +313,7 @@ void WinEDA_GerberFrame::SaveSettings()
wxRealPoint GridSize = GetScreen()->GetGridSize(); wxRealPoint GridSize = GetScreen()->GetGridSize();
long pageSize_opt = 0; long pageSize_opt = 0;
if( m_Draw_Sheet_Ref ) if( m_Draw_Sheet_Ref )
{ {
for( int ii = 1; g_GerberPageSizeList[ii] != NULL; ii++ ) for( int ii = 1; g_GerberPageSizeList[ii] != NULL; ii++ )
@ -341,6 +350,7 @@ void WinEDA_GerberFrame::ReFillLayerWidget()
syncLayerWidget(); syncLayerWidget();
} }
/** /**
* Function IsGridVisible() , virtual * Function IsGridVisible() , virtual
* @return true if the grid must be shown * @return true if the grid must be shown
@ -350,6 +360,7 @@ bool WinEDA_GerberFrame::IsGridVisible()
return IsElementVisible( GERBER_GRID_VISIBLE ); return IsElementVisible( GERBER_GRID_VISIBLE );
} }
/** /**
* Function SetGridVisibility() , virtual * Function SetGridVisibility() , virtual
* It may be overloaded by derived classes * It may be overloaded by derived classes
@ -361,6 +372,7 @@ void WinEDA_GerberFrame::SetGridVisibility(bool aVisible)
SetElementVisibility( GERBER_GRID_VISIBLE, aVisible ); SetElementVisibility( GERBER_GRID_VISIBLE, aVisible );
} }
/** /**
* Function GetGridColor() , virtual * Function GetGridColor() , virtual
* @return the color of the grid * @return the color of the grid
@ -370,6 +382,7 @@ int WinEDA_GerberFrame::GetGridColor()
return GetBoard()->GetVisibleElementColor( GERBER_GRID_VISIBLE ); return GetBoard()->GetVisibleElementColor( GERBER_GRID_VISIBLE );
} }
/** /**
* Function SetGridColor() , virtual * Function SetGridColor() , virtual
* @param aColor = the new color of the grid * @param aColor = the new color of the grid
@ -412,6 +425,7 @@ void WinEDA_GerberFrame::syncLayerBox()
UpdateTitleAndInfo(); UpdateTitleAndInfo();
} }
/** /**
* Function SetLanguage * Function SetLanguage
* called on a language menu selection * called on a language menu selection
@ -443,6 +457,7 @@ void WinEDA_GerberFrame::Liste_D_Codes( )
for( int layer = 0; layer < 32; layer++ ) for( int layer = 0; layer < 32; layer++ )
{ {
GERBER_IMAGE* gerber = g_GERBER_List[layer]; GERBER_IMAGE* gerber = g_GERBER_List[layer];
if( gerber == NULL ) if( gerber == NULL )
continue; continue;
@ -453,19 +468,20 @@ void WinEDA_GerberFrame::Liste_D_Codes( )
Line.Printf( wxT( "*** Active layer (%2.2d) ***" ), layer + 1 ); Line.Printf( wxT( "*** Active layer (%2.2d) ***" ), layer + 1 );
else else
Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 ); Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 );
List->Append( Line ); List->Append( Line );
for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ ) for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
{ {
pt_D_code = gerber->GetDCODE( ii + FIRST_DCODE, false ); pt_D_code = gerber->GetDCODE( ii + FIRST_DCODE, false );
if( pt_D_code == NULL ) if( pt_D_code == NULL )
continue; continue;
if( !pt_D_code->m_InUse && !pt_D_code->m_Defined ) if( !pt_D_code->m_InUse && !pt_D_code->m_Defined )
continue; continue;
Line.Printf( wxT( Line.Printf( wxT( "tool %2.2d: D%2.2d V %2.4f H %2.4f %s" ),
"tool %2.2d: D%2.2d V %2.4f H %2.4f %s" ),
jj, jj,
pt_D_code->m_Num_Dcode, pt_D_code->m_Num_Dcode,
(float) pt_D_code->m_Size.y / scale, (float) pt_D_code->m_Size.y / scale,
@ -486,10 +502,12 @@ void WinEDA_GerberFrame::Liste_D_Codes( )
ii = List->ShowModal(); ii = List->ShowModal();
List->Destroy(); List->Destroy();
if( ii < 0 ) if( ii < 0 )
return; return;
} }
/** /**
* Function UpdateTitleAndInfo * Function UpdateTitleAndInfo
* displays the short filename (if exists) of the selected layer * displays the short filename (if exists) of the selected layer
@ -503,6 +521,7 @@ void WinEDA_GerberFrame::UpdateTitleAndInfo()
{ {
GERBER_IMAGE* gerber = g_GERBER_List[ GetScreen()->m_Active_Layer ]; GERBER_IMAGE* gerber = g_GERBER_List[ GetScreen()->m_Active_Layer ];
wxString text; wxString text;
// Display the gerber filename // Display the gerber filename
if( gerber == NULL ) if( gerber == NULL )
{ {
@ -522,7 +541,8 @@ void WinEDA_GerberFrame::UpdateTitleAndInfo()
// Display Image Name and Layer Name (from the current gerber data): // Display Image Name and Layer Name (from the current gerber data):
text.Printf( _( "Image name: \"%s\" Layer name: \"%s\"" ), text.Printf( _( "Image name: \"%s\" Layer name: \"%s\"" ),
GetChars(gerber->m_ImageName), GetChars(gerber->GetLayerParams( ).m_LayerName) ); GetChars( gerber->m_ImageName ),
GetChars( gerber->GetLayerParams().m_LayerName ) );
SetStatusText( text, 0 ); SetStatusText( text, 0 );
// Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar // Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar

View File

@ -69,15 +69,14 @@ struct Ki_HotkeyInfoSectionDescriptor s_Gerbview_Hokeys_Descr[] =
/***********************************************************/ /***********************************************************/
void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey, void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
EDA_BaseStruct* DrawStruct )
/***********************************************************/ /***********************************************************/
/* Hot keys. Some commands are relatives to the item under the mouse cursor /* Hot keys. Some commands are relatives to the item under the mouse cursor
* Commands are case insensitive * Commands are case insensitive
* @param DC = current device context * @param DC = current device context
* @param hotkey = hotkey code (ascii or wxWidget code for special keys) * @param hotkey = hotkey code (ascii or wxWidget code for special keys)
* @param DrawStruct = NULL or pointer on a EDA_BaseStruct under the mouse cursor * @param DrawStruct = NULL or pointer on a EDA_ITEM under the mouse cursor
*/ */
{ {

Some files were not shown because too many files have changed in this diff Show More