diff --git a/3d-viewer/3d_class.cpp b/3d-viewer/3d_class.cpp index 4fc931231c..44efd635f7 100644 --- a/3d-viewer/3d_class.cpp +++ b/3d-viewer/3d_class.cpp @@ -20,7 +20,7 @@ S3D_Vertex::S3D_Vertex() 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_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 ) : - EDA_BaseStruct( aParent, NOT_USED ) +S3D_MASTER::S3D_MASTER( EDA_ITEM* aParent ) : + EDA_ITEM( aParent, NOT_USED ) { m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0; m_3D_Drawings = NULL; @@ -85,8 +85,8 @@ S3D_MASTER:: ~S3D_MASTER() } -Struct3D_Shape::Struct3D_Shape( EDA_BaseStruct* aParent ) : - EDA_BaseStruct( aParent, NOT_USED ) +Struct3D_Shape::Struct3D_Shape( EDA_ITEM* aParent ) : + EDA_ITEM( aParent, NOT_USED ) { m_3D_Coord = NULL; m_3D_CoordIndex = NULL; diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index b64bfead66..e49bacda08 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -320,10 +320,9 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() } /* draw graphic items */ - EDA_BaseStruct* PtStruct; - for( PtStruct = pcb->m_Drawings; - PtStruct != NULL; - PtStruct = PtStruct->Next() ) + EDA_ITEM* PtStruct; + + for( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() ) { switch( PtStruct->Type() ) { @@ -691,8 +690,9 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) if( !As3dShape ) { // 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 + for( ; Struct != NULL; Struct = Struct->Next() ) { switch( Struct->Type() ) diff --git a/3d-viewer/3d_struct.h b/3d-viewer/3d_struct.h index aa8f226c1f..8bff84ba67 100644 --- a/3d-viewer/3d_struct.h +++ b/3d-viewer/3d_struct.h @@ -34,7 +34,7 @@ public: public: S3D_Vertex(); }; -class S3D_MATERIAL : public EDA_BaseStruct /* openGL "material" data*/ +class S3D_MATERIAL : public EDA_ITEM /* openGL "material" data*/ { public: wxString m_Name; @@ -55,7 +55,7 @@ public: S3D_MATERIAL( S3D_MASTER* father, const wxString& name ); /* Master structure for a 3D item description */ -class S3D_MASTER : public EDA_BaseStruct +class S3D_MASTER : public EDA_ITEM { public: wxString m_Shape3DName; /* 3D shape name in 3D library */ @@ -65,7 +65,7 @@ public: Struct3D_Shape* m_3D_Drawings; S3D_MATERIAL* m_Materials; -public: S3D_MASTER( EDA_BaseStruct* aParent ); +public: S3D_MASTER( EDA_ITEM* aParent ); ~S3D_MASTER(); S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; } @@ -90,14 +90,14 @@ public: S3D_MASTER( EDA_BaseStruct* aParent ); /* Describes a complex 3D */ -class Struct3D_Shape : public EDA_BaseStruct +class Struct3D_Shape : public EDA_ITEM { public: S3D_Vertex* m_3D_Coord; int* m_3D_CoordIndex; int m_3D_Points; -public: Struct3D_Shape( EDA_BaseStruct* aParent ); +public: Struct3D_Shape( EDA_ITEM* aParent ); ~Struct3D_Shape(); Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; } diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c901c3ea98..d100c410f5 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,19 @@ KiCad ChangeLog 2010 Please add newer entries at the top, list the date and your name with email address. +2010-dec-08 UPDATE Wayne Stambaugh +================================================================================ +++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 ================================================================================ ++EESchema diff --git a/common/base_screen.cpp b/common/base_screen.cpp index 12a2dc8a06..781bda8d6c 100644 --- a/common/base_screen.cpp +++ b/common/base_screen.cpp @@ -13,18 +13,15 @@ #include "class_base_screen.h" #include "id.h" -/* Implement wxSize array for grid list implementation. */ -#include -WX_DEFINE_OBJARRAY( GridArray ) BASE_SCREEN* ActiveScreen = NULL; #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 * reasonable value */ 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() ) - m_GridList.Clear(); + if( !m_grids.empty() ) + 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 ) { - wxASSERT( !m_GridList.IsEmpty() ); + wxASSERT( !m_grids.empty() ); 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; } // keep trace of the nearest grill size, if the exact size is not found - if ( size.x < m_GridList[i].m_Size.x ) - nearest_grid = m_GridList[i]; + if ( size.x < m_grids[i].m_Size.x ) + nearest_grid = m_grids[i]; } m_Grid = nearest_grid; @@ -382,20 +386,20 @@ void BASE_SCREEN::SetGrid( const wxRealPoint& size ) /* Set grid size from command ID. */ void BASE_SCREEN::SetGrid( int id ) { - wxASSERT( !m_GridList.IsEmpty() ); + wxASSERT( !m_grids.empty() ); 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; } } - m_Grid = m_GridList[0]; + m_Grid = m_grids[0]; wxLogWarning( wxT( "Grid ID %d not in grid list, falling back to " ) \ 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; - 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 - && grid.m_Id != ID_POPUP_GRID_USER ) + if( m_grids[i].m_Size == grid.m_Size && grid.m_Id != ID_POPUP_GRID_USER ) { wxLogDebug( wxT( "Discarding duplicate grid size( %g, %g )." ), grid.m_Size.x, grid.m_Size.y ); 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 " ) \ wxT( "size( %g, %g )." ), - grid.m_Id, m_GridList[i].m_Size.x, - m_GridList[i].m_Size.y, grid.m_Size.x, grid.m_Size.y ); - m_GridList[i].m_Size = grid.m_Size; + grid.m_Id, m_grids[i].m_Size.x, + m_grids[i].m_Size.y, grid.m_Size.x, grid.m_Size.y ); + m_grids[i].m_Size = grid.m_Size; 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_GridList.Add( grid ); + m_grids.push_back( 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() { return m_Grid; } -/*********************************/ + const wxPoint& BASE_SCREEN::GetGridOrigin() -/*********************************/ { return m_GridOrigin; } + wxRealPoint BASE_SCREEN::GetGridSize() { 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 */ int extraitems = GetUndoCommandCount() - m_UndoRedoCountMax; + if( extraitems > 0 ) // Delete the extra items ClearUndoORRedoList( m_UndoList, extraitems ); } @@ -526,6 +538,7 @@ void BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aNewitem ) /* Delete the extra items, if count max reached */ int extraitems = GetRedoCommandCount() - m_UndoRedoCountMax; + if( extraitems > 0 ) // Delete the extra items 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() + 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() + 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 ) { - SCH_ITEM* item = EEDrawList; + EDA_ITEM* item = m_drawList; // for now, make it look like XML, expand on this later. - NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << - ">\n"; + NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n"; for( ; item; item = item->Next() ) { diff --git a/common/base_struct.cpp b/common/base_struct.cpp index 9ee674f79f..9c5ab57b8b 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -1,6 +1,6 @@ /****************************************/ /* Basic classes for Kicad: */ -/* EDA_BaseStruct */ +/* EDA_ITEM */ /* 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(); 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(); 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_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; 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; @@ -74,12 +74,12 @@ void EDA_BaseStruct::SetModified() // see base_struct.h -SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart, - INSPECTOR* inspector, - const void* testData, - const KICAD_T scanTypes[] ) +SEARCH_RESULT EDA_ITEM::IterateForward( EDA_ITEM* listStart, + INSPECTOR* inspector, + const void* testData, + const KICAD_T scanTypes[] ) { - EDA_BaseStruct* p = listStart; + EDA_ITEM* p = listStart; for( ; p; p = p->Pnext ) { @@ -93,8 +93,8 @@ SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart, // see base_struct.h // many classes inherit this method, be careful: -SEARCH_RESULT EDA_BaseStruct::Visit( INSPECTOR* inspector, const void* testData, - const KICAD_T scanTypes[] ) +SEARCH_RESULT EDA_ITEM::Visit( INSPECTOR* inspector, const void* testData, + const KICAD_T scanTypes[] ) { 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. * @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: wxString s = GetClass(); @@ -161,7 +161,7 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& os ) * @param os The ostream&, where to output * @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; iNext(); + EDA_ITEM* nextitem = item->Next(); delete item; 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 * @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() ) 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 * @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() ) 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 * @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() ) { @@ -262,7 +263,7 @@ bool PICKED_ITEMS_LIST::SetPickedItem( EDA_BaseStruct* aItem, unsigned aIdx ) * @param aIdx = index of the picker in the picked list * @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() ) { @@ -281,9 +282,7 @@ bool PICKED_ITEMS_LIST::SetPickedItemLink( EDA_BaseStruct* aLink, unsigned aIdx * @param aIdx = index of the picker in the picked list * @return true if the picker exists, or false if does not exist */ -bool PICKED_ITEMS_LIST::SetPickedItem( EDA_BaseStruct* aItem, - UndoRedoOpType aStatus, - unsigned aIdx ) +bool PICKED_ITEMS_LIST::SetPickedItem( EDA_ITEM* aItem, UndoRedoOpType aStatus, unsigned aIdx ) { if( aIdx < m_ItemsList.size() ) { diff --git a/common/dlist.cpp b/common/dlist.cpp index fa1caa4c37..1b0025ddc0 100644 --- a/common/dlist.cpp +++ b/common/dlist.cpp @@ -40,8 +40,8 @@ DHEAD::~DHEAD() void DHEAD::DeleteAll() { - EDA_BaseStruct* next; - EDA_BaseStruct* item = first; + EDA_ITEM* next; + EDA_ITEM* item = first; while( item ) { @@ -56,7 +56,7 @@ void DHEAD::DeleteAll() } -void DHEAD::append( EDA_BaseStruct* aNewElement ) +void DHEAD::append( EDA_ITEM* aNewElement ) { 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 ); @@ -109,7 +109,7 @@ void DHEAD::insert( EDA_BaseStruct* aNewElement, EDA_BaseStruct* aAfterMe ) } else { - EDA_BaseStruct* oldBack = aAfterMe->Back(); + EDA_ITEM* oldBack = aAfterMe->Back(); 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->GetList() == this ); @@ -162,7 +162,7 @@ void DHEAD::remove( EDA_BaseStruct* aElement ) void DHEAD::VerifyListIntegrity() { - EDA_BaseStruct* item; + EDA_ITEM* item; unsigned i = 0; for( item = first; item && iNext() ) diff --git a/common/drawframe.cpp b/common/drawframe.cpp index 5eed65db97..16ceef9e03 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -174,8 +174,7 @@ void WinEDA_DrawFrame::ReCreateMenuBar() // Virtual function -void WinEDA_DrawFrame::OnHotKey( wxDC* DC, int hotkey, - EDA_BaseStruct* DrawStruct ) +void WinEDA_DrawFrame::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) { } @@ -192,9 +191,8 @@ void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event ) * because WinEDA_DrawFrame does not know how to print a page * This is the reason it is a virtual function */ -void WinEDA_DrawFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, - int aPrintMask, bool aPrintMirrorMode, - void * aData) +void WinEDA_DrawFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,int aPrintMask, + bool aPrintMirrorMode, void* aData ) { wxMessageBox( wxT("WinEDA_DrawFrame::PrintPage() error")); } diff --git a/common/sch_item_struct.cpp b/common/sch_item_struct.cpp index 3163c657ee..e7dd099e8e 100644 --- a/common/sch_item_struct.cpp +++ b/common/sch_item_struct.cpp @@ -22,8 +22,8 @@ * in debug mode */ -SCH_ITEM::SCH_ITEM( EDA_BaseStruct* aParent, KICAD_T aType ) : - EDA_BaseStruct( aParent, aType ) +SCH_ITEM::SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType ) : + EDA_ITEM( aParent, aType ) { 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 * for an "old" item, saving it in undo list must be done before editiing, * 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 ) { SCH_SCREEN* screen = frame->GetScreen(); + if( !screen->CheckIfOnDrawList( this ) ) //don't want a loop! screen->AddToDrawList( this ); + g_ItemToRepeat = this; frame->SaveCopyInUndoList( this, UR_NEW ); } diff --git a/common/zoom.cpp b/common/zoom.cpp index 0c889640c0..cca46116f9 100644 --- a/common/zoom.cpp +++ b/common/zoom.cpp @@ -228,19 +228,18 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu ) } /* Create grid submenu as required. */ - if( !screen->m_GridList.IsEmpty() ) + if( screen->GetGridCount() ) { wxMenu* gridMenu = new wxMenu; - ADD_MENUITEM_WITH_SUBMENU( MasterMenu, gridMenu, - ID_POPUP_GRID_SELECT, _( "Grid Select" ), - grid_select_xpm ); + ADD_MENUITEM_WITH_SUBMENU( MasterMenu, gridMenu, ID_POPUP_GRID_SELECT, + _( "Grid Select" ), grid_select_xpm ); GRID_TYPE tmp; 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 gridValue_mm = To_User_Unit( MILLIMETRES, tmp.m_Size.x, m_InternalUnits ); @@ -267,7 +266,9 @@ void WinEDA_DrawFrame::AddMenuZoomAndGrid( wxMenu* MasterMenu ) break; } } + gridMenu->Append( tmp.m_Id, msg, wxEmptyString, true ); + if( grid == tmp.m_Size ) gridMenu->Check( tmp.m_Id, true ); } diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index e3a626109c..f085e5a7be 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -35,7 +35,7 @@ static int ReplaceDuplicatedTimeStamps(); /* Set a sheet number, the sheet count for sheets in the whole schematic * and update the date in all screens */ -void WinEDA_SchematicFrame::UpdateSheetNumberAndDate() +void SCH_EDIT_FRAME::UpdateSheetNumberAndDate() { wxString date = GenDate(); SCH_SCREENS s_list; @@ -69,11 +69,13 @@ void ReAnnotatePowerSymbolsOnly( void ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) { - EDA_BaseStruct* DrawList = sheet->LastDrawList(); + EDA_ITEM* DrawList = sheet->LastDrawList(); + for( ; DrawList != NULL; DrawList = DrawList->Next() ) { if( DrawList->Type() != TYPE_SCH_COMPONENT ) continue; + SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) DrawList; LIB_COMPONENT* Entry = 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 * @param aRedraw : true to refresh display */ -void WinEDA_SchematicFrame::DeleteAnnotation( bool aCurrentSheetOnly, - bool aRedraw ) +void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw ) { SCH_ITEM* strct; SCH_SCREEN* screen; @@ -218,9 +219,11 @@ void WinEDA_SchematicFrame::DeleteAnnotation( bool aCurrentSheetOnly, if( screen == NULL ) return; + while( screen ) { - strct = screen->EEDrawList; + strct = screen->GetDrawItems(); + for( ; strct; strct = strct->Next() ) { if( strct->Type() == TYPE_SCH_COMPONENT ) @@ -267,11 +270,11 @@ void WinEDA_SchematicFrame::DeleteAnnotation( bool aCurrentSheetOnly, * stamps are used to handle annotation mainly in complex * hierarchies. */ -void AnnotateComponents( WinEDA_SchematicFrame* parent, - bool annotateSchematic, - int sortOption, - bool resetAnnotation, - bool repairsTimestamps ) +void AnnotateComponents( SCH_EDIT_FRAME* parent, + bool annotateSchematic, + int sortOption, + bool resetAnnotation, + bool repairsTimestamps ) { std::vector ComponentsList; @@ -358,18 +361,18 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent, int AddComponentsInSheetToList( std::vector & aComponentsList, SCH_SHEET_PATH* aSheet ) { - int NbrCmp = 0; - EDA_BaseStruct* DrawList = aSheet->LastDrawList(); - SCH_COMPONENT* DrawLibItem; - LIB_COMPONENT* Entry; + int NbrCmp = 0; + EDA_ITEM* DrawList = aSheet->LastDrawList(); + SCH_COMPONENT* DrawLibItem; + LIB_COMPONENT* Entry; for( ; DrawList != NULL; DrawList = DrawList->Next() ) { if( DrawList->Type() == TYPE_SCH_COMPONENT ) { DrawLibItem = (SCH_COMPONENT*) DrawList; - Entry = - CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName ); + Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName ); + if( Entry == NULL ) continue; @@ -707,8 +710,7 @@ static int ExistUnit( int aObjet, int Unit, * false = search in whole hierarchy (usual search). * @return errors count */ -int WinEDA_SchematicFrame::CheckAnnotate( wxArrayString* aMessageList, - bool aOneSheetOnly ) +int SCH_EDIT_FRAME::CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOnly ) { int error; wxString Buff; @@ -1005,10 +1007,11 @@ int ReplaceDuplicatedTimeStamps() std::vector itemlist; SCH_SCREEN* screen; 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 ) { if( ( item->Type() == DRAW_SHEET_STRUCT_TYPE ) diff --git a/eeschema/backanno.cpp b/eeschema/backanno.cpp index 61561ad9fb..ca53c22a2f 100644 --- a/eeschema/backanno.cpp +++ b/eeschema/backanno.cpp @@ -32,10 +32,9 @@ * the search is not stopped when a reference is found (all instances must be * found). */ -bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent( - const wxString& aReference, - const wxString& aFootPrint, - bool aSetVisible ) +bool SCH_EDIT_FRAME::FillFootprintFieldForAllInstancesofComponent( const wxString& aReference, + const wxString& aFootPrint, + bool aSetVisible ) { SCH_SHEET_PATH* sheet; SCH_ITEM* DrawList = NULL; @@ -101,8 +100,7 @@ bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent( * visible * @return true if OK. */ -bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool - aSetFielsAttributeToVisible ) +bool SCH_EDIT_FRAME::ProcessStuffFile( FILE* aStuffFile, bool aSetFielsAttributeToVisible ) { int LineNum = 0; char* cp, Ref[256], FootPrint[256], Line[1024]; @@ -134,7 +132,7 @@ bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* aStuffFile, bool /* Backann footprint info to schematic. */ -bool WinEDA_SchematicFrame::ReadInputStuffFile() +bool SCH_EDIT_FRAME::ReadInputStuffFile() { wxString Line, filename; FILE* StuffFile; diff --git a/eeschema/block.cpp b/eeschema/block.cpp index 1d0f14f6d4..00e1ec38be 100644 --- a/eeschema/block.cpp +++ b/eeschema/block.cpp @@ -47,7 +47,7 @@ static void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList ); /* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to * the key (ALT, SHIFT ALT ..) */ -int WinEDA_SchematicFrame::ReturnBlockCommand( int key ) +int SCH_EDIT_FRAME::ReturnBlockCommand( int key ) { int cmd; @@ -85,7 +85,7 @@ int WinEDA_SchematicFrame::ReturnBlockCommand( int key ) /* Init the parameters used by the block paste command */ -void WinEDA_SchematicFrame::InitBlockPasteInfos() +void SCH_EDIT_FRAME::InitBlockPasteInfos() { BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; @@ -99,7 +99,7 @@ void WinEDA_SchematicFrame::InitBlockPasteInfos() * - block move & drag * - block copy & paste */ -void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) +void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) { bool err = false; BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; @@ -181,7 +181,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) block->m_Command = BLOCK_IDLE; GetScreen()->SetCurItem( NULL ); - TestDanglingEnds( GetScreen()->EEDrawList, DC ); + TestDanglingEnds( GetScreen()->GetDrawItems(), DC ); if( block->GetCount() ) { @@ -204,7 +204,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) * @return false if no item selected, or command finished, * 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 zoom_command = false; @@ -269,7 +269,7 @@ bool WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) OnModify(); } block->ClearItemsList(); - TestDanglingEnds( GetScreen()->EEDrawList, DC ); + TestDanglingEnds( GetScreen()->GetDrawItems(), DC ); DrawPanel->Refresh(); break; @@ -334,7 +334,7 @@ bool WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) * a mirror/rotate command is immediatly executed and multible block commands * 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 * have a next step @@ -386,7 +386,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) DeleteItemsInList( DrawPanel, block->m_ItemsSelection ); OnModify(); } - TestDanglingEnds( GetScreen()->EEDrawList, DC ); + TestDanglingEnds( GetScreen()->GetDrawItems(), DC ); DrawPanel->Refresh(); break; @@ -421,7 +421,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) RotateListOfItems( block->m_ItemsSelection, rotationPoint ); OnModify(); } - TestDanglingEnds( GetScreen()->EEDrawList, DC ); + TestDanglingEnds( GetScreen()->GetDrawItems(), DC ); DrawPanel->Refresh(); // block->m_State = STATE_BLOCK_MOVE; // 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_Command = BLOCK_MOVE; //allows multiple mirrors } - TestDanglingEnds( GetScreen()->EEDrawList, DC ); + TestDanglingEnds( GetScreen()->GetDrawItems(), DC ); DrawPanel->Refresh(); break; @@ -461,7 +461,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) // block->m_State = STATE_BLOCK_MOVE; // block->m_Command = BLOCK_MOVE; //allows multiple mirrors } - TestDanglingEnds( GetScreen()->EEDrawList, DC ); + + TestDanglingEnds( GetScreen()->GetDrawItems(), DC ); DrawPanel->Refresh(); break; @@ -489,7 +490,6 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) { BLOCK_SELECTOR* block = &panel->GetScreen()->m_BlockLocate;; - BASE_SCREEN* screen = panel->GetScreen(); SCH_ITEM* schitem; @@ -497,6 +497,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool era if( erase ) { block->Draw( panel, DC, block->m_MoveVector, g_XorMode, block->m_Color ); + for( unsigned ii = 0; ii < block->GetCount(); 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. * 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; @@ -577,8 +578,8 @@ void WinEDA_SchematicFrame::PasteListOfItems( wxDC* DC ) } SetaParent( Struct, GetScreen() ); RedrawOneStruct( DrawPanel, DC, Struct, GR_DEFAULT_DRAWMODE ); - Struct->SetNext( GetScreen()->EEDrawList ); - GetScreen()->EEDrawList = Struct; + Struct->SetNext( GetScreen()->GetDrawItems() ); + GetScreen()->SetDrawItems( Struct ); } SaveCopyInUndoList( picklist, UR_NEW ); @@ -738,7 +739,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) /* Review the list of elements not selected. */ ITEM_PICKER picker; - Struct = screen->EEDrawList; + Struct = (SCH_ITEM*) screen->GetDrawItems(); + while( Struct ) { picker.m_PickedItem = Struct; diff --git a/eeschema/build_BOM.cpp b/eeschema/build_BOM.cpp index af5f52cd3f..f76698678e 100644 --- a/eeschema/build_BOM.cpp +++ b/eeschema/build_BOM.cpp @@ -41,7 +41,7 @@ void BuildComponentsListFromSchematic( std::vector & aList ) 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 ) continue; diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 8c4827d13e..ec2d9e603d 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -24,24 +24,23 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); -static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC ); 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 ); SCH_ITEM* s_OldWiresList; 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 ) { SCH_ITEM* 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(); @@ -62,13 +61,59 @@ static void RestoreOldWires( SCH_SCREEN* screen ) { next_item = s_OldWiresList->Next(); - s_OldWiresList->SetNext( screen->EEDrawList ); - screen->EEDrawList = s_OldWiresList; + s_OldWiresList->SetNext( screen->GetDrawItems() ); + screen->SetDrawItems( s_OldWiresList ); 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 ), * or terminates the current segment * 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 * 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; wxPoint cursorpos = GetScreen()->m_Curseur; @@ -124,26 +169,27 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) } 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->m_Flags = IS_NEW; newsegment->SetNext( nextsegment ); nextsegment->SetBack( newsegment ); } + GetScreen()->SetCurItem( newsegment ); - DrawPanel->ManageCurseur = Segment_in_Ghost; + DrawPanel->ManageCurseur = DrawSegment; DrawPanel->ForceCloseManageCurseur = AbortCreateNewLine; g_ItemToRepeat = NULL; } - else /* A segment is in progress: terminates the current segment and add - * a new segment */ + else // A segment is in progress: terminates the current segment and add a new segment. { 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() ) 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( IsTerminalPoint( GetScreen(), cursorpos, oldsegment->GetLayer() ) ) { - EndSegment( DC ); return; + EndSegment( DC ); + return; } - oldsegment->SetNext( GetScreen()->EEDrawList ); - GetScreen()->EEDrawList = oldsegment; + oldsegment->SetNext( GetScreen()->GetDrawItems() ); + GetScreen()->SetDrawItems( oldsegment ); DrawPanel->CursorOff( DC ); // Erase schematic cursor RedrawOneStruct( DrawPanel, DC, oldsegment, GR_DEFAULT_DRAWMODE ); DrawPanel->CursorOn( DC ); // Display schematic cursor @@ -185,6 +232,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) newsegment = oldsegment->GenCopy(); newsegment->m_Start = oldsegment->m_End; } + newsegment->m_End = cursorpos; oldsegment->m_Flags = SELECTED; 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 */ -void WinEDA_SchematicFrame::EndSegment( wxDC* DC ) +void SCH_EDIT_FRAME::EndSegment( wxDC* DC ) { SCH_LINE* firstsegment = (SCH_LINE*) GetScreen()->GetCurItem(); SCH_LINE* lastsegment = firstsegment; @@ -214,36 +262,45 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC ) if( firstsegment == NULL ) return; + if( ( firstsegment->m_Flags & IS_NEW ) == 0 ) return; /* Delete Null segments and Put line it in Drawlist */ lastsegment = firstsegment; + while( lastsegment ) { SCH_LINE* nextsegment = lastsegment->Next(); + if( lastsegment->IsNull() ) { SCH_LINE* previous_segment = lastsegment->Back(); + if( firstsegment == lastsegment ) firstsegment = nextsegment; + if( nextsegment ) nextsegment->SetBack( NULL ); + if( previous_segment ) previous_segment->SetNext( nextsegment ); + delete lastsegment; } + lastsegment = nextsegment; } /* put the segment list to the main linked list */ segment = lastsegment = firstsegment; + while( segment ) { lastsegment = segment; segment = segment->Next(); - lastsegment->SetNext( GetScreen()->EEDrawList ); - GetScreen()->EEDrawList = lastsegment; + lastsegment->SetNext( GetScreen()->GetDrawItems() ); + GetScreen()->SetDrawItems( lastsegment ); } DrawPanel->ManageCurseur = NULL; @@ -266,7 +323,8 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC ) ( (SCH_SCREEN*) GetScreen() )->SchematicCleanUp( NULL ); /* clear flags and find last segment entered, for repeat function */ - segment = (SCH_LINE*) GetScreen()->EEDrawList; + segment = (SCH_LINE*) GetScreen()->GetDrawItems(); + while( segment ) { if( segment->m_Flags ) @@ -283,7 +341,6 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC ) { if( IsJunctionNeeded( this, end_point ) ) CreateNewJunctionStruct( DC, end_point ); - else if( IsJunctionNeeded( this, alt_end_point ) ) CreateNewJunctionStruct( DC, alt_end_point ); } @@ -293,12 +350,12 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC ) if( IsJunctionNeeded( this, s_ConnexionStartPoint ) ) CreateNewJunctionStruct( DC, s_ConnexionStartPoint ); - TestDanglingEnds( GetScreen()->EEDrawList, DC ); - + TestDanglingEnds( GetScreen()->GetDrawItems(), DC ); /* Redraw wires and junctions which can be changed by TestDanglingEnds() */ DrawPanel->CursorOff( DC ); // Erase schematic cursor - EDA_BaseStruct* item = GetScreen()->EEDrawList; + EDA_ITEM* item = GetScreen()->GetDrawItems(); + while( item ) { 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 * new_pos * with the 2 segments kept H or V only @@ -389,13 +402,12 @@ static void ComputeBreakPoint( SCH_LINE* segment, const wxPoint& new_pos ) #else int iDx = segment->m_End.x - segment->m_Start.x; 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; } - else if( iDx != 0 ) // keep the first segment orientation (currently - // vertical) + else if( iDx != 0 ) // keep the first segment orientation (currently vertical) { 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 */ -static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, - wxDC* DC, - bool erase ) +static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) { SCH_POLYLINE* NewPoly = (SCH_POLYLINE*) panel->GetScreen()->GetCurItem(); 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. */ -void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC ) +void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC ) { g_ItemToRepeat = NULL; @@ -470,11 +480,10 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC ) } else { - Segment_in_Ghost( DrawPanel, DC, FALSE ); + DrawSegment( DrawPanel, DC, FALSE ); } - EraseStruct( (SCH_ITEM*) GetScreen()->GetCurItem(), - (SCH_SCREEN*) GetScreen() ); + EraseStruct( (SCH_ITEM*) GetScreen()->GetCurItem(), (SCH_SCREEN*) GetScreen() ); DrawPanel->ManageCurseur = NULL; GetScreen()->SetCurItem( NULL ); } @@ -482,8 +491,9 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC ) /* Routine to create new connection struct. */ -SCH_JUNCTION* WinEDA_SchematicFrame::CreateNewJunctionStruct( - wxDC* DC, const wxPoint& pos, bool PutInUndoList ) +SCH_JUNCTION* SCH_EDIT_FRAME::CreateNewJunctionStruct( wxDC* DC, + const wxPoint& pos, + bool PutInUndoList ) { SCH_JUNCTION* NewJunction; @@ -495,17 +505,19 @@ SCH_JUNCTION* WinEDA_SchematicFrame::CreateNewJunctionStruct( RedrawOneStruct( DrawPanel, DC, NewJunction, GR_DEFAULT_DRAWMODE ); DrawPanel->CursorOn( DC ); // Display schematic cursor - NewJunction->SetNext( GetScreen()->EEDrawList ); - GetScreen()->EEDrawList = NewJunction; - OnModify( ); + NewJunction->SetNext( GetScreen()->GetDrawItems() ); + GetScreen()->SetDrawItems( NewJunction ); + OnModify(); + if( PutInUndoList ) SaveCopyInUndoList( NewJunction, UR_NEW ); + return NewJunction; } /* 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; @@ -516,9 +528,9 @@ SCH_NO_CONNECT* WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC ) RedrawOneStruct( DrawPanel, DC, NewNoConnect, GR_DEFAULT_DRAWMODE ); DrawPanel->CursorOn( DC ); // Display schematic cursor - NewNoConnect->SetNext( GetScreen()->EEDrawList ); - GetScreen()->EEDrawList = NewNoConnect; - OnModify( ); + NewNoConnect->SetNext( GetScreen()->GetDrawItems() ); + GetScreen()->SetDrawItems( NewNoConnect ); + OnModify(); SaveCopyInUndoList( NewNoConnect, UR_NEW ); return NewNoConnect; } @@ -543,7 +555,8 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC ) g_ItemToRepeat = NULL; /* Clear m_Flags which is used in edit functions: */ - SCH_ITEM* item = Screen->EEDrawList; + SCH_ITEM* item = Screen->GetDrawItems(); + while( item ) { item->m_Flags = 0; @@ -556,7 +569,7 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC ) * Bus lines, text, labels * 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; @@ -667,9 +680,9 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC ) if( g_ItemToRepeat ) { - g_ItemToRepeat->SetNext( GetScreen()->EEDrawList ); - GetScreen()->EEDrawList = g_ItemToRepeat; - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + g_ItemToRepeat->SetNext( GetScreen()->GetDrawItems() ); + GetScreen()->SetDrawItems( g_ItemToRepeat ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, GR_DEFAULT_DRAWMODE ); SaveCopyInUndoList( g_ItemToRepeat, UR_NEW ); g_ItemToRepeat->m_Flags = 0; @@ -719,22 +732,26 @@ void IncrementLabelMember( wxString& name ) */ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) { - EDA_BaseStruct* item; - LIB_PIN* pin; - SCH_COMPONENT* LibItem = NULL; - SCH_SHEET_PIN* pinsheet; - wxPoint itempos; + EDA_ITEM* item; + LIB_PIN* pin; + SCH_COMPONENT* LibItem = NULL; + SCH_SHEET_PIN* pinsheet; + wxPoint itempos; switch( layer ) { case LAYER_BUS: item = PickStruct( pos, screen, BUSITEM ); + if( item ) return TRUE; - pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList ); + + pinsheet = LocateAnyPinSheet( pos, screen->GetDrawItems() ); + if( pinsheet && IsBusLabel( pinsheet->m_Text ) ) { itempos = pinsheet->m_Pos; + if( (itempos.x == pos.x) && (itempos.y == pos.y) ) return TRUE; } @@ -748,10 +765,12 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) case LAYER_WIRE: item = PickStruct( pos, screen, RACCORDITEM | JUNCTIONITEM ); + if( item ) return TRUE; - pin = LocateAnyPin( screen->EEDrawList, pos, &LibItem ); + pin = LocateAnyPin( screen->GetDrawItems(), pos, &LibItem ); + if( pin && LibItem ) { // 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 ) ) return TRUE; - pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList ); + pinsheet = LocateAnyPinSheet( pos, screen->GetDrawItems() ); + if( pinsheet && !IsBusLabel( pinsheet->m_Text ) ) { itempos = pinsheet->m_Pos; + if( ( itempos.x == pos.x ) && ( itempos.y == pos.y ) ) return TRUE; } @@ -799,18 +820,17 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) * or * - 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 ) ) return FALSE; - if( PickStruct( pos, frame->GetScreen(), WIREITEM | - EXCLUDE_WIRE_BUS_ENDPOINTS ) ) + if( PickStruct( pos, frame->GetScreen(), WIREITEM | EXCLUDE_WIRE_BUS_ENDPOINTS ) ) { - if( PickStruct( pos, frame->GetScreen(), WIREITEM | - WIRE_BUS_ENDPOINTS_ONLY ) ) + if( PickStruct( pos, frame->GetScreen(), WIREITEM | WIRE_BUS_ENDPOINTS_ONLY ) ) return TRUE; - if( frame->LocatePinEnd( frame->GetScreen()->EEDrawList, pos ) ) + + if( frame->LocatePinEnd( frame->GetScreen()->GetDrawItems(), pos ) ) return TRUE; } diff --git a/eeschema/busentry.cpp b/eeschema/busentry.cpp index b2202f8dfd..d254829627 100644 --- a/eeschema/busentry.cpp +++ b/eeschema/busentry.cpp @@ -66,21 +66,18 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) } -SCH_BUS_ENTRY* WinEDA_SchematicFrame::CreateBusEntry( wxDC* DC, - int entry_type ) +SCH_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusEntry( wxDC* DC, int entry_type ) { // Create and place a new bus entry at cursor position - SCH_BUS_ENTRY* BusEntry = new SCH_BUS_ENTRY( GetScreen()->m_Curseur, - s_LastShape, entry_type ); + SCH_BUS_ENTRY* BusEntry = new SCH_BUS_ENTRY( GetScreen()->m_Curseur, s_LastShape, entry_type ); BusEntry->m_Flags = IS_NEW; BusEntry->Place( this, DC );; - OnModify( ); + OnModify(); return BusEntry; } -void WinEDA_SchematicFrame::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, - wxDC* DC ) +void SCH_EDIT_FRAME::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, wxDC* DC ) { if( BusEntry == NULL ) return; @@ -109,9 +106,7 @@ void WinEDA_SchematicFrame::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, /* set the shape of BusEntry (shape = / or \ ) */ -void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC, - SCH_BUS_ENTRY* BusEntry, - int entry_shape ) +void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int entry_shape ) { if( BusEntry == NULL ) return; @@ -141,13 +136,13 @@ void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC, break; } - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); RedrawOneStruct( DrawPanel, DC, BusEntry, g_XorMode ); OnModify( ); } -int WinEDA_SchematicFrame::GetBusEntryShape( SCH_BUS_ENTRY* BusEntry ) +int SCH_EDIT_FRAME::GetBusEntryShape( SCH_BUS_ENTRY* BusEntry ) { int entry_shape = '\\'; diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index b3091ed6c6..db75c34b98 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -51,7 +51,7 @@ */ LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_COMPONENT* aRootComponent ): - EDA_BaseStruct( LIB_ALIAS_T ) + EDA_ITEM( LIB_ALIAS_T ) { root = aRootComponent; 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 ) : - EDA_BaseStruct( aAlias ) + EDA_ITEM( aAlias ) { name = aAlias.name; root = aRootComponent; @@ -158,7 +158,7 @@ int LibraryEntryCompare( const LIB_ALIAS* aItem1, const LIB_ALIAS* aItem2 ) * Library components are different from schematic components. */ LIB_COMPONENT::LIB_COMPONENT( const wxString& aName, CMP_LIBRARY* aLibrary ) : - EDA_BaseStruct( LIB_COMPONENT_T ) + EDA_ITEM( LIB_COMPONENT_T ) { m_name = aName; 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 ) : - EDA_BaseStruct( aComponent ) + EDA_ITEM( aComponent ) { LIB_DRAW_ITEM* newItem; diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index 81e345f635..c96529af94 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -48,7 +48,7 @@ enum LibrEntryOptions * Component aliases are not really components. They are references * to an actual component object. */ -class LIB_ALIAS : public EDA_BaseStruct +class LIB_ALIAS : public EDA_ITEM { /** * 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). * Library components are different from schematic components. */ -class LIB_COMPONENT : public EDA_BaseStruct +class LIB_COMPONENT : public EDA_ITEM { wxString m_name; int m_pinNameOffset; ///< The offset in mils to draw the pin name. Set to 0 diff --git a/eeschema/class_netlist_object.h b/eeschema/class_netlist_object.h index c42a20b6a3..7c384a2053 100644 --- a/eeschema/class_netlist_object.h +++ b/eeschema/class_netlist_object.h @@ -60,7 +60,7 @@ class NETLIST_OBJECT public: NetObjetType m_Type; /* Type of item (see NetObjetType * 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) */ SCH_ITEM* m_Link; /* For SCH_SHEET_PIN: diff --git a/eeschema/cleanup.cpp b/eeschema/cleanup.cpp index 5f66fd8b84..394217573a 100644 --- a/eeschema/cleanup.cpp +++ b/eeschema/cleanup.cpp @@ -28,7 +28,8 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen ) return; } - DrawList = Screen->EEDrawList; + DrawList = Screen->GetDrawItems(); + while( DrawList ) { switch( DrawList->Type() ) @@ -76,8 +77,7 @@ void BreakSegment( SCH_SCREEN* aScreen, wxPoint aBreakpoint ) { SCH_LINE* segment, * NewSegment; - for( SCH_ITEM* DrawList = aScreen->EEDrawList; DrawList; - DrawList = DrawList->Next() ) + for( SCH_ITEM* DrawList = aScreen->GetDrawItems(); DrawList; DrawList = DrawList->Next() ) { if( DrawList->Type() != DRAW_SEGMENT_STRUCT_TYPE ) continue; diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 1966a8efc1..2cc16cb594 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -34,12 +34,12 @@ * - label * - pin * - 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 * * 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; wxString msg; @@ -66,8 +66,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Include break; case TYPE_SCH_COMPONENT: - Pin = LocateAnyPin( GetScreen()->EEDrawList, GetScreen()->m_Curseur, - &LibItem ); + Pin = LocateAnyPin( GetScreen()->GetDrawItems(), GetScreen()->m_Curseur, &LibItem ); if( Pin ) break; // Priority is probing a pin first LibItem = (SCH_COMPONENT*) DrawStruct; @@ -75,8 +74,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Include break; default: - Pin = LocateAnyPin( GetScreen()->EEDrawList, GetScreen()->m_Curseur, - &LibItem ); + Pin = LocateAnyPin( GetScreen()->GetDrawItems(), GetScreen()->m_Curseur, &LibItem ); break; case COMPONENT_PIN_DRAW_TYPE: @@ -113,14 +111,14 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Include * - label * - pin * - 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 IncludePin = true to search for pins, false to ignore them * * For some items, characteristics are displayed on the screen. */ -SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, - bool IncludePin ) +SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, + bool IncludePin ) { SCH_ITEM* DrawStruct; LIB_PIN* Pin; @@ -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; SCH_SCREEN* screen = GetScreen(); diff --git a/eeschema/cross-probing.cpp b/eeschema/cross-probing.cpp index 6fd1f23557..4588bf44c6 100644 --- a/eeschema/cross-probing.cpp +++ b/eeschema/cross-probing.cpp @@ -38,9 +38,9 @@ void RemoteCommand( const char* cmdline ) char* idcmd; char* text; 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 ); @@ -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, * @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 @@ -97,6 +92,7 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync, * $PART: reference put cursor on footprint anchor * $PIN: number $PART: reference put cursor on the footprint pad */ +void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT* LibItem ) { if( objectToSync == NULL ) return; @@ -112,16 +108,15 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync, { if( LibItem == NULL ) 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 ); } break; case TYPE_SCH_COMPONENT: LibItem = (SCH_COMPONENT*) objectToSync; - 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 ); break; @@ -139,8 +134,9 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync, CONV_TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) ); } 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 ); break; diff --git a/eeschema/dangling_ends.cpp b/eeschema/dangling_ends.cpp index 3c2f12ca80..fb6ee08978 100644 --- a/eeschema/dangling_ends.cpp +++ b/eeschema/dangling_ends.cpp @@ -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; 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. * @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; LIB_PIN* Pin; diff --git a/eeschema/delete.cpp b/eeschema/delete.cpp index 5e53032339..e590659d49 100644 --- a/eeschema/delete.cpp +++ b/eeschema/delete.cpp @@ -17,7 +17,7 @@ // Imported function: -void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList ); +void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList ); /* @@ -25,10 +25,9 @@ void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList * pins, end wire or bus, and junctions if TstJunction == TRUE * Return this count * - * Used by WinEDA_SchematicFrame::DeleteConnection() + * Used by SCH_EDIT_FRAME::DeleteConnection() */ -static int CountConnectedItems( WinEDA_SchematicFrame* frame, - SCH_ITEM* ListStruct, wxPoint pos, +static int CountConnectedItems( SCH_EDIT_FRAME* frame, SCH_ITEM* ListStruct, wxPoint pos, bool TstJunction ) { SCH_ITEM* Struct; @@ -72,12 +71,11 @@ static int CountConnectedItems( WinEDA_SchematicFrame* frame, * "ListStruct" * 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, - SCH_LINE* segment ) +static bool MarkConnected( SCH_EDIT_FRAME* frame, SCH_ITEM* ListStruct, SCH_LINE* segment ) { - EDA_BaseStruct* Struct; + EDA_ITEM* Struct; 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 * 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; SCH_ITEM* DelStruct; PICKED_ITEMS_LIST pickList; /* Clear .m_Flags member for all items */ - for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; - DelStruct = DelStruct->Next() ) + for( DelStruct = GetScreen()->GetDrawItems(); DelStruct != NULL; DelStruct = DelStruct->Next() ) DelStruct->m_Flags = 0; BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() ); @@ -142,8 +139,9 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection ) ITEM_PICKER picker(NULL, UR_DELETED); SCH_SCREEN* screen = (SCH_SCREEN*) GetScreen(); // Save the list entry point of this screen - SCH_ITEM* savedEEDrawList = screen->EEDrawList; - DelStruct = GetScreen()->EEDrawList; + SCH_ITEM* savedItems = screen->GetDrawItems(); + DelStruct = GetScreen()->GetDrawItems(); + while( DelStruct && ( DelStruct = PickStruct( screen->m_Curseur, screen, JUNCTIONITEM | WIREITEM | BUSITEM ) ) != NULL ) @@ -156,31 +154,32 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection ) pickList.PushItem(picker); 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 */ if( DeleteFullConnection ) { - for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; + for( DelStruct = GetScreen()->GetDrawItems(); DelStruct != NULL; DelStruct = DelStruct->Next() ) { if( !(DelStruct->m_Flags & SELECTEDNODE) ) continue; #define SEGM ( (SCH_LINE*) DelStruct ) + if( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) continue; - MarkConnected( this, GetScreen()->EEDrawList, SEGM ); + MarkConnected( this, GetScreen()->GetDrawItems(), SEGM ); #undef SEGM } // 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() ) { 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 * an STRUCT_DELETED wire, and now is not connected, the wire can * be deleted */ - EDA_BaseStruct* removed_struct; - for( removed_struct = GetScreen()->EEDrawList; + EDA_ITEM* removed_struct; + for( removed_struct = GetScreen()->GetDrawItems(); removed_struct != NULL; removed_struct = removed_struct->Next() ) { @@ -216,14 +215,14 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection ) break; } - if( WIRE && !CountConnectedItems( this, GetScreen()->EEDrawList, + if( WIRE && !CountConnectedItems( this, GetScreen()->GetDrawItems(), SEGM->m_Start, TRUE ) ) noconnect = TRUE; /* Test the SEGM->m_End point: if this point was connected to * an STRUCT_DELETED wire, and now is not connected, the wire * can be deleted */ - for( removed_struct = GetScreen()->EEDrawList; + for( removed_struct = GetScreen()->GetDrawItems(); removed_struct != NULL; removed_struct = removed_struct->Next() ) { @@ -236,8 +235,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection ) } if( removed_struct && - !CountConnectedItems( this, GetScreen()->EEDrawList, - SEGM->m_End, TRUE ) ) + !CountConnectedItems( this, GetScreen()->GetDrawItems(), SEGM->m_End, TRUE ) ) noconnect = TRUE; DelStruct->m_Flags &= ~SKIP_STRUCT; @@ -250,14 +248,14 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection ) picker.m_PickedItemType = DelStruct->Type(); pickList.PushItem(picker); - DelStruct = GetScreen()->EEDrawList; + DelStruct = GetScreen()->GetDrawItems(); } #undef SEGM } // Delete redundant junctions (junctions which connect < 3 end wires // and no pin are removed) - for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; + for( DelStruct = GetScreen()->GetDrawItems(); DelStruct != NULL; DelStruct = DelStruct->Next() ) { int count; @@ -270,7 +268,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection ) if( DelStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE ) { #define JUNCTION ( (SCH_JUNCTION*) DelStruct ) - count = CountConnectedItems( this, GetScreen()->EEDrawList, + count = CountConnectedItems( this, GetScreen()->GetDrawItems(), JUNCTION->m_Pos, FALSE ); if( count <= 2 ) { @@ -287,7 +285,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection ) // Delete labels attached to wires wxPoint pos = GetScreen()->m_Curseur; - for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; + for( DelStruct = GetScreen()->GetDrawItems(); DelStruct != NULL; DelStruct = DelStruct->Next() ) { if( DelStruct->m_Flags & STRUCT_DELETED ) @@ -297,9 +295,8 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection ) continue; GetScreen()->m_Curseur = ( (SCH_TEXT*) DelStruct )->m_Pos; - EDA_BaseStruct* TstStruct = - PickStruct( GetScreen()->m_Curseur, GetScreen(), - WIREITEM | BUSITEM ); + EDA_ITEM* TstStruct = PickStruct( GetScreen()->m_Curseur, GetScreen(), + WIREITEM | BUSITEM ); if( TstStruct && TstStruct->m_Flags & STRUCT_DELETED ) { @@ -315,7 +312,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection ) GetScreen()->m_Curseur = pos; } - for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; + for( DelStruct = GetScreen()->GetDrawItems(); DelStruct != NULL; DelStruct = DelStruct->Next() ) DelStruct->m_Flags = 0; @@ -341,7 +338,7 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection ) * * 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_SCREEN* screen = (SCH_SCREEN*) ( frame->GetScreen() ); @@ -370,7 +367,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC ) { g_ItemToRepeat = NULL; DeleteStruct( frame->DrawPanel, DC, DelStruct ); - frame->TestDanglingEnds( frame->GetScreen()->EEDrawList, DC ); + frame->TestDanglingEnds( frame->GetScreen()->GetDrawItems(), DC ); frame->OnModify( ); item_deleted = TRUE; } @@ -392,7 +389,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC ) */ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen ) { - EDA_BaseStruct* DrawList; + EDA_ITEM* DrawList; if( DrawStruct == NULL ) return; @@ -414,14 +411,15 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen ) } else { - if( DrawStruct == Screen->EEDrawList ) + if( DrawStruct == Screen->GetDrawItems() ) { - Screen->EEDrawList = DrawStruct->Next(); + Screen->SetDrawItems( DrawStruct->Next() ); SAFE_DELETE( DrawStruct ); } else { - DrawList = Screen->EEDrawList; + DrawList = Screen->GetDrawItems(); + while( DrawList && DrawList->Next() ) { if( DrawList->Next() == DrawStruct ) @@ -444,17 +442,17 @@ void DeleteAllMarkers( int type ) SCH_MARKER* Marker; SCH_SCREENS ScreenList; - for( screen = ScreenList.GetFirst(); screen != NULL; - screen = ScreenList.GetNext() ) + for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) { - for( DrawStruct = screen->EEDrawList; DrawStruct != NULL; - DrawStruct = NextStruct ) + for( DrawStruct = screen->GetDrawItems(); DrawStruct != NULL; DrawStruct = NextStruct ) { NextStruct = DrawStruct->Next(); + if( DrawStruct->Type() != TYPE_SCH_MARKER ) continue; Marker = (SCH_MARKER*) DrawStruct; + if( Marker->GetMarkerType() != type ) continue; diff --git a/eeschema/delsheet.cpp b/eeschema/delsheet.cpp index 9fe864e090..d37a9f5ee5 100644 --- a/eeschema/delsheet.cpp +++ b/eeschema/delsheet.cpp @@ -14,29 +14,25 @@ #include "sch_sheet.h" -/**************************************************************************/ -void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion ) -/**************************************************************************/ - /* Free (delete) all schematic data (include the sub hierarchy sheets ) * for the hierarchical sheet FirstSheet * FirstSheet is not deleted. */ +void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion ) { - EDA_BaseStruct* DrawStruct; - EDA_BaseStruct* EEDrawList; - wxString msg; - WinEDA_SchematicFrame* frame; + EDA_ITEM* DrawStruct; + EDA_ITEM* EEDrawList; + wxString msg; + SCH_EDIT_FRAME* frame; - frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow(); + frame = (SCH_EDIT_FRAME*)wxGetApp().GetTopWindow(); if( FirstSheet == NULL ) return; if( FirstSheet->Type() != DRAW_SHEET_STRUCT_TYPE ) { - DisplayError( NULL, - wxT( "DeleteSubHierarchy error(): NOT a Sheet" ) ); + DisplayError( NULL, wxT( "DeleteSubHierarchy error(): NOT a Sheet" ) ); return; } @@ -45,6 +41,7 @@ void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion ) msg.Printf( _( "Sheet %s (file %s) modified. Save it?" ), FirstSheet->m_SheetName.GetData(), FirstSheet->GetFileName().GetData() ); + if( IsOK( NULL, msg ) ) { frame->SaveEEFile( FirstSheet->m_AssociatedScreen, FILE_SAVE_AS ); @@ -54,15 +51,16 @@ void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion ) /* free the sub hierarchy */ if( FirstSheet->m_AssociatedScreen ) { - EEDrawList = FirstSheet->m_AssociatedScreen->EEDrawList; + EEDrawList = FirstSheet->m_AssociatedScreen->GetDrawItems(); + while( EEDrawList != NULL ) { DrawStruct = EEDrawList; EEDrawList = EEDrawList->Next(); + if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) { - DeleteSubHierarchy( (SCH_SHEET*) DrawStruct, - confirm_deletion ); + DeleteSubHierarchy( (SCH_SHEET*) DrawStruct, 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 * clear the screen datas (filenames ..) */ +bool ClearProjectDrawList( SCH_SCREEN* screen, bool confirm_deletion ) { if( screen == NULL ) return TRUE; diff --git a/eeschema/dialogs/annotate_dialog.cpp b/eeschema/dialogs/annotate_dialog.cpp index 3d4e29fd70..150ac05a6e 100644 --- a/eeschema/dialogs/annotate_dialog.cpp +++ b/eeschema/dialogs/annotate_dialog.cpp @@ -14,14 +14,14 @@ #define KEY_ANNOTATE_SORT_OPTION wxT("AnnotateSortOption") -extern void AnnotateComponents( WinEDA_SchematicFrame* parent, +extern void AnnotateComponents( SCH_EDIT_FRAME* parent, bool annotateSchematic, int sortOption, bool resetAnnotation, bool repairsTimestamps ); -DIALOG_ANNOTATE::DIALOG_ANNOTATE( WinEDA_SchematicFrame* parent ) +DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent ) : DIALOG_ANNOTATE_BASE( parent ) { m_Parent = parent; diff --git a/eeschema/dialogs/annotate_dialog.h b/eeschema/dialogs/annotate_dialog.h index 4b4c6af63c..643c9fb117 100644 --- a/eeschema/dialogs/annotate_dialog.h +++ b/eeschema/dialogs/annotate_dialog.h @@ -27,7 +27,7 @@ #include "dialog_annotate_base.h" -class WinEDA_SchematicFrame; +class SCH_EDIT_FRAME; class wxConfig; @@ -38,11 +38,11 @@ class wxConfig; class DIALOG_ANNOTATE: public DIALOG_ANNOTATE_BASE { private: - WinEDA_SchematicFrame * m_Parent; + SCH_EDIT_FRAME * m_Parent; wxConfig* m_Config; public: - DIALOG_ANNOTATE( WinEDA_SchematicFrame* parent ); + DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent ); ~DIALOG_ANNOTATE(){}; /// Initialises member variables diff --git a/eeschema/dialogs/dialog_SVG_print.cpp b/eeschema/dialogs/dialog_SVG_print.cpp index ea3f397c31..5b3f72d8fe 100644 --- a/eeschema/dialogs/dialog_SVG_print.cpp +++ b/eeschema/dialogs/dialog_SVG_print.cpp @@ -107,13 +107,13 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref ) if( aPrintAll && m_Parent->m_Ident == SCHEMATIC_FRAME ) { - WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent; - SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet(); - SCH_SCREEN* schscreen = schframe->GetScreen(); + SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent; + SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet(); + SCH_SCREEN* schscreen = schframe->GetScreen(); oldscreen = schscreen; - SCH_SHEET_LIST SheetList( NULL ); + SCH_SHEET_LIST SheetList( NULL ); sheetpath = SheetList.GetFirst(); - SCH_SHEET_PATH list; + SCH_SHEET_PATH list; for( ; ; ) { diff --git a/eeschema/dialogs/dialog_build_BOM.cpp b/eeschema/dialogs/dialog_build_BOM.cpp index 3ab856cabb..edf94038e7 100644 --- a/eeschema/dialogs/dialog_build_BOM.cpp +++ b/eeschema/dialogs/dialog_build_BOM.cpp @@ -623,7 +623,8 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef( // Print list of items 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 ) continue; @@ -860,11 +861,11 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal( std::vector & aList, bool aIncludeSubComponents ) { - EDA_BaseStruct* schItem; - SCH_COMPONENT* DrawLibItem; - LIB_COMPONENT* entry; - std::string CmpName; - wxString msg; + EDA_ITEM* schItem; + SCH_COMPONENT* DrawLibItem; + LIB_COMPONENT* entry; + std::string CmpName; + wxString msg; msg = _( "\n#Cmp ( order = Value )" ); diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index 32c2e87c7f..83a6096ef2 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -26,8 +26,7 @@ int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_SelectedRow; wxSize DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = wxDefaultSize; -void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, - SCH_COMPONENT* aComponent ) +void InstallCmpeditFrame( SCH_EDIT_FRAME* parent, wxPoint& pos, SCH_COMPONENT* aComponent ) { if( aComponent == NULL ) // Null component not accepted 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_FBP( parent ) { - m_Parent = (WinEDA_SchematicFrame*) parent; + m_Parent = (SCH_EDIT_FRAME*) parent; m_LibEntry = NULL; m_skipCopyFromPanel = false; @@ -268,7 +267,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event m_Parent->OnModify(); - m_Parent->TestDanglingEnds( m_Parent->GetScreen()->EEDrawList, NULL ); + m_Parent->TestDanglingEnds( m_Parent->GetScreen()->GetDrawItems(), NULL ); m_Parent->DrawPanel->Refresh( TRUE ); diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.h b/eeschema/dialogs/dialog_edit_component_in_schematic.h index 868805a5a8..cdad4e46c9 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.h +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.h @@ -16,22 +16,22 @@ */ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP { - friend void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, - wxPoint& pos, - SCH_COMPONENT* aComponent ); + friend void InstallCmpeditFrame( SCH_EDIT_FRAME* parent, + wxPoint& pos, + SCH_COMPONENT* aComponent ); - WinEDA_SchematicFrame* m_Parent; - SCH_COMPONENT* m_Cmp; - LIB_COMPONENT* m_LibEntry; - bool m_skipCopyFromPanel; + SCH_EDIT_FRAME* m_Parent; + SCH_COMPONENT* m_Cmp; + LIB_COMPONENT* m_LibEntry; + bool m_skipCopyFromPanel; - static int s_SelectedRow; + static int s_SelectedRow; /// The size of the dialog window last time it was displayed; - static wxSize s_LastSize; + static wxSize s_LastSize; /// a copy of the edited component's SCH_FIELDs - SCH_FIELDS m_FieldsBuf; + SCH_FIELDS m_FieldsBuf; void setSelectedFieldNdx( int aFieldNdx ); diff --git a/eeschema/dialogs/dialog_edit_label.cpp b/eeschema/dialogs/dialog_edit_label.cpp index f754ed8879..3f551141b2 100644 --- a/eeschema/dialogs/dialog_edit_label.cpp +++ b/eeschema/dialogs/dialog_edit_label.cpp @@ -23,7 +23,7 @@ /* Edit the properties of the text (Label, Global label, graphic text).. ) * pointed by "aTextStruct" */ -void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* aTextItem ) +void SCH_EDIT_FRAME::EditSchematicText( SCH_TEXT* aTextItem ) { if( aTextItem == NULL ) 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 ) { m_Parent = aParent; diff --git a/eeschema/dialogs/dialog_edit_label.h b/eeschema/dialogs/dialog_edit_label.h index 3db275a0be..0e4f56bacc 100644 --- a/eeschema/dialogs/dialog_edit_label.h +++ b/eeschema/dialogs/dialog_edit_label.h @@ -11,19 +11,19 @@ #include "dialog_edit_label_base.h" -class WinEDA_SchematicFrame; +class SCH_EDIT_FRAME; class SCH_TEXT; class DialogLabelEditor : public DialogLabelEditor_Base { private: - WinEDA_SchematicFrame* m_Parent; - SCH_TEXT* m_CurrentText; - wxTextCtrl * m_textLabel; + SCH_EDIT_FRAME* m_Parent; + SCH_TEXT* m_CurrentText; + wxTextCtrl* m_textLabel; public: - DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* aTextItem ); + DialogLabelEditor( SCH_EDIT_FRAME* parent, SCH_TEXT* aTextItem ); ~DialogLabelEditor(){}; diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp index 000fe1e3d1..1124361e6e 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp @@ -283,8 +283,8 @@ An alias %s already exists!\nCannot update this component" ), void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::addFieldButtonHandler( wxCommandEvent& event ) /**************************************************************************************/ { - WinEDA_SchematicFrame* frame; - frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow(); + SCH_EDIT_FRAME* frame; + frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow(); // in case m_FieldsBuf[REFERENCE].m_Orient has changed on screen only, grab // 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 // template field editor UI. 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 ) { diff --git a/eeschema/dialogs/dialog_eeschema_config.cpp b/eeschema/dialogs/dialog_eeschema_config.cpp index d0ca11daec..18f6eb461a 100644 --- a/eeschema/dialogs/dialog_eeschema_config.cpp +++ b/eeschema/dialogs/dialog_eeschema_config.cpp @@ -25,8 +25,8 @@ #include "dialog_eeschema_config.h" -DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG( WinEDA_SchematicFrame* aSchFrame, - WinEDA_DrawFrame* aParent ) +DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG( SCH_EDIT_FRAME* aSchFrame, + WinEDA_DrawFrame* aParent ) : DIALOG_EESCHEMA_CONFIG_FBP( aParent ) { wxString msg; diff --git a/eeschema/dialogs/dialog_eeschema_config.h b/eeschema/dialogs/dialog_eeschema_config.h index 8c79f3ea57..6f1008a7cb 100644 --- a/eeschema/dialogs/dialog_eeschema_config.h +++ b/eeschema/dialogs/dialog_eeschema_config.h @@ -6,14 +6,14 @@ #include "dialog_eeschema_config_fbp.h" -class WinEDA_SchematicFrame; +class SCH_EDIT_FRAME; class WinEDA_DrawFrame; class DIALOG_EESCHEMA_CONFIG : public DIALOG_EESCHEMA_CONFIG_FBP { private: - WinEDA_SchematicFrame* m_Parent; + SCH_EDIT_FRAME* m_Parent; bool m_LibListChanged; bool m_LibPathChanged; wxString m_UserLibDirBufferImg; // Copy of original g_UserLibDirBuffer @@ -34,7 +34,7 @@ private: public: - DIALOG_EESCHEMA_CONFIG( WinEDA_SchematicFrame* parent, WinEDA_DrawFrame* activeWindow ); + DIALOG_EESCHEMA_CONFIG( SCH_EDIT_FRAME* parent, WinEDA_DrawFrame* activeWindow ); ~DIALOG_EESCHEMA_CONFIG() {}; }; diff --git a/eeschema/dialogs/dialog_eeschema_options.cpp b/eeschema/dialogs/dialog_eeschema_options.cpp index daff22c36d..31471e09a6 100644 --- a/eeschema/dialogs/dialog_eeschema_options.cpp +++ b/eeschema/dialogs/dialog_eeschema_options.cpp @@ -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; - for( size_t i = 0; i < grid_sizes.GetCount(); i++ ) + for( size_t i = 0; i < grid_sizes.size(); i++ ) { wxString tmp; tmp.Printf( wxT( "%0.1f" ), grid_sizes[i].m_Size.x ); diff --git a/eeschema/dialogs/dialog_eeschema_options.h b/eeschema/dialogs/dialog_eeschema_options.h index e8785b3c03..d2c15b24c9 100644 --- a/eeschema/dialogs/dialog_eeschema_options.h +++ b/eeschema/dialogs/dialog_eeschema_options.h @@ -21,7 +21,7 @@ public: m_choiceGridSize->SetSelection( select ); } 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 ) { diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index f85c043c21..b8c917001b 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -37,7 +37,7 @@ BEGIN_EVENT_TABLE( DIALOG_ERC, DIALOG_ERC_BASE ) DIALOG_ERC::ChangeErrorLevel ) END_EVENT_TABLE() -DIALOG_ERC::DIALOG_ERC( WinEDA_SchematicFrame* parent ) : +DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) : DIALOG_ERC_BASE( parent ) { m_Parent = parent; @@ -53,6 +53,7 @@ void DIALOG_ERC::Init() SetFocus(); m_Initialized = FALSE; + for( int ii = 0; ii < PIN_NMAX; ii++ ) for( int jj = 0; jj < PIN_NMAX; jj++ ) m_ButtonList[ii][jj] = NULL; diff --git a/eeschema/dialogs/dialog_erc.h b/eeschema/dialogs/dialog_erc.h index b6d2144163..2b678f959e 100644 --- a/eeschema/dialogs/dialog_erc.h +++ b/eeschema/dialogs/dialog_erc.h @@ -32,15 +32,15 @@ class DIALOG_ERC : public DIALOG_ERC_BASE DECLARE_EVENT_TABLE() private: - WinEDA_SchematicFrame* m_Parent; - wxBitmapButton* m_ButtonList[PIN_NMAX][PIN_NMAX]; - bool m_Initialized; - static bool m_writeErcFile; + SCH_EDIT_FRAME* m_Parent; + wxBitmapButton* m_ButtonList[PIN_NMAX][PIN_NMAX]; + bool m_Initialized; + static bool m_writeErcFile; public: /// Constructors - DIALOG_ERC( WinEDA_SchematicFrame* parent ); + DIALOG_ERC( SCH_EDIT_FRAME* parent ); void Init(); diff --git a/eeschema/dialogs/dialog_plot_schematic_DXF.cpp b/eeschema/dialogs/dialog_plot_schematic_DXF.cpp index c5a9969175..d8140ffa5d 100644 --- a/eeschema/dialogs/dialog_plot_schematic_DXF.cpp +++ b/eeschema/dialogs/dialog_plot_schematic_DXF.cpp @@ -44,12 +44,12 @@ class DIALOG_PLOT_SCHEMATIC_DXF : public DIALOG_PLOT_SCHEMATIC_DXF_BASE { private: - WinEDA_SchematicFrame* m_Parent; + SCH_EDIT_FRAME* m_Parent; public: /// Constructors - DIALOG_PLOT_SCHEMATIC_DXF( WinEDA_SchematicFrame* parent ); + DIALOG_PLOT_SCHEMATIC_DXF( SCH_EDIT_FRAME* parent ); private: 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 ); 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 ) { m_Parent = parent; @@ -143,13 +143,13 @@ void DIALOG_PLOT_SCHEMATIC_DXF::initOptVars() void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( ) { - WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent; - SCH_SCREEN* screen = schframe->GetScreen(); - SCH_SCREEN* oldscreen = screen; - SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet(); - wxString PlotFileName; - Ki_PageDescr* PlotSheet; - wxPoint plot_offset; + SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent; + SCH_SCREEN* screen = schframe->GetScreen(); + SCH_SCREEN* oldscreen = screen; + SCH_SHEET_PATH* sheetpath, * oldsheetpath = schframe->GetSheet(); + wxString PlotFileName; + Ki_PageDescr* PlotSheet; + wxPoint plot_offset; /* When printing all pages, the printed page is not the current page. * In complex hierarchies, we must setup references and others parameters @@ -241,7 +241,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName, m_Parent->PlotWorkSheet( plotter, screen ); } - PlotDrawlist( plotter, screen->EEDrawList ); + PlotDrawlist( plotter, screen->GetDrawItems() ); /* fin */ plotter->end_plot(); diff --git a/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp b/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp index 15326a7860..d2d3ca7c5a 100644 --- a/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp +++ b/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp @@ -75,10 +75,10 @@ static Ki_PageDescr* Plot_sheet_list[] = class DIALOG_PLOT_SCHEMATIC_HPGL : public DIALOG_PLOT_SCHEMATIC_HPGL_BASE { private: - WinEDA_SchematicFrame* m_Parent; + SCH_EDIT_FRAME* m_Parent; public: - DIALOG_PLOT_SCHEMATIC_HPGL( WinEDA_SchematicFrame* parent ); + DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent ); private: 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; -void WinEDA_SchematicFrame::ToPlot_HPGL( wxCommandEvent& event ) +void SCH_EDIT_FRAME::ToPlot_HPGL( wxCommandEvent& event ) { DIALOG_PLOT_SCHEMATIC_HPGL dlg( this ); 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) { m_Parent = parent; @@ -386,7 +386,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName, if( m_plot_Sheet_Ref ) m_Parent->PlotWorkSheet( plotter, screen ); - PlotDrawlist( plotter, screen->EEDrawList ); + PlotDrawlist( plotter, screen->GetDrawItems() ); plotter->end_plot(); delete plotter; diff --git a/eeschema/dialogs/dialog_plot_schematic_PS.cpp b/eeschema/dialogs/dialog_plot_schematic_PS.cpp index 98c8c6bf83..469a2075e1 100644 --- a/eeschema/dialogs/dialog_plot_schematic_PS.cpp +++ b/eeschema/dialogs/dialog_plot_schematic_PS.cpp @@ -50,12 +50,12 @@ enum PageFormatReq { class DIALOG_PLOT_SCHEMATIC_PS : public DIALOG_PLOT_SCHEMATIC_PS_BASE { private: - WinEDA_SchematicFrame* m_Parent; + SCH_EDIT_FRAME* m_Parent; public: /// Constructors - DIALOG_PLOT_SCHEMATIC_PS( WinEDA_SchematicFrame* parent ); + DIALOG_PLOT_SCHEMATIC_PS( SCH_EDIT_FRAME* parent ); private: 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; -void WinEDA_SchematicFrame::ToPlot_PS( wxCommandEvent& event ) +void SCH_EDIT_FRAME::ToPlot_PS( wxCommandEvent& event ) { 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 ) { m_Parent = parent; @@ -290,7 +290,7 @@ void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName, m_Parent->PlotWorkSheet( plotter, screen ); } - PlotDrawlist( plotter, screen->EEDrawList ); + PlotDrawlist( plotter, screen->GetDrawItems() ); plotter->end_plot(); delete plotter; diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index 7959b4426c..7647a6c9ef 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -87,7 +87,7 @@ BEGIN_EVENT_TABLE( SCH_PREVIEW_FRAME, wxPreviewFrame ) 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 ) { 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 ) { - WinEDA_SchematicFrame* parent = GetParent(); + SCH_EDIT_FRAME* parent = GetParent(); if ( GetSizer() ) GetSizer()->SetSizeHints( this ); @@ -129,7 +129,7 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event ) { - WinEDA_SchematicFrame* parent = GetParent(); + SCH_EDIT_FRAME* parent = GetParent(); if( !IsIconized() ) { @@ -148,7 +148,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event ) */ void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event ) { - WinEDA_SchematicFrame* parent = GetParent(); + SCH_EDIT_FRAME* parent = GetParent(); 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 ) { - WinEDA_SchematicFrame* parent = GetParent(); + SCH_EDIT_FRAME* parent = GetParent(); parent->SetPrintMonochrome( m_checkMonochrome->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 ) { - WinEDA_SchematicFrame* parent = GetParent(); + SCH_EDIT_FRAME* parent = GetParent(); parent->SetPrintMonochrome( m_checkMonochrome->IsChecked() ); parent->SetPrintSheetReference( m_checkReference->IsChecked() ); @@ -221,7 +221,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event ) bool SCH_PRINTOUT::OnPrintPage( int page ) { wxString msg; - WinEDA_SchematicFrame* parent = m_Parent->GetParent(); + SCH_EDIT_FRAME* parent = m_Parent->GetParent(); msg.Printf( _( "Print page %d" ), page ); parent->ClearMsgPanel(); parent->AppendMsgPanel( msg, wxEmptyString, CYAN ); @@ -285,7 +285,7 @@ bool SCH_PRINTOUT::OnBeginDocument( int startPage, int endPage ) return false; #ifdef __WXDEBUG__ - WinEDA_SchematicFrame* parent = m_Parent->GetParent(); + SCH_EDIT_FRAME* parent = m_Parent->GetParent(); wxLogDebug( wxT( "Printer name: " ) + parent->GetPageSetupData().GetPrintData().GetPrinterName() ); wxLogDebug( wxT( "Paper ID: %d" ), @@ -315,7 +315,7 @@ void SCH_PRINTOUT::DrawPage() EDA_Rect oldClipBox; wxRect fitRect; wxDC* dc = GetDC(); - WinEDA_SchematicFrame* parent = m_Parent->GetParent(); + SCH_EDIT_FRAME* parent = m_Parent->GetParent(); WinEDA_DrawPanel* panel = parent->DrawPanel; wxBusyCursor dummy; diff --git a/eeschema/dialogs/dialog_print_using_printer.h b/eeschema/dialogs/dialog_print_using_printer.h index b6bf77c7ea..ef0a7c4833 100644 --- a/eeschema/dialogs/dialog_print_using_printer.h +++ b/eeschema/dialogs/dialog_print_using_printer.h @@ -14,10 +14,10 @@ class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE { public: - DIALOG_PRINT_USING_PRINTER( WinEDA_SchematicFrame* aParent ); + DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent ); ~DIALOG_PRINT_USING_PRINTER() {}; - WinEDA_SchematicFrame* GetParent() const; + SCH_EDIT_FRAME* GetParent() const; private: void OnCloseWindow( wxCloseEvent& event ); diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index 25247fe5f9..38d487408f 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -24,7 +24,7 @@ static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); /* 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; @@ -86,7 +86,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC ) /******************************************************************************/ /* 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; LIB_COMPONENT* Entry; @@ -189,8 +189,8 @@ static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) wxPoint pos; int fieldNdx; - WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->GetParent(); - SCH_FIELD* currentField = frame->GetCurrentField(); + SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) panel->GetParent(); + SCH_FIELD* currentField = frame->GetCurrentField(); if( currentField == NULL ) return; @@ -220,8 +220,8 @@ static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC ) Panel->ForceCloseManageCurseur = NULL; Panel->ManageCurseur = NULL; - WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) Panel->GetParent(); - SCH_FIELD* currentField = frame->GetCurrentField(); + SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) Panel->GetParent(); + SCH_FIELD* currentField = frame->GetCurrentField(); 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; LIB_COMPONENT* Entry; @@ -284,7 +284,7 @@ void WinEDA_SchematicFrame::RotateCmpField( SCH_FIELD* Field, wxDC* DC ) /****************************************************************************/ /* 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; int flag = 0; @@ -331,7 +331,7 @@ void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC /*****************************************************************************/ /* 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; 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; LIB_COMPONENT* Entry; diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index 02b5a9a8e2..4516c3c8d1 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -31,7 +31,7 @@ static bool lastTextBold = 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 ) 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 ) 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). */ -SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) +SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type ) { SCH_TEXT* NewText = NULL; @@ -143,8 +143,7 @@ SCH_TEXT* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) break; default: - DisplayError( this, - wxT( "WinEDA_SchematicFrame::CreateNewText() Internal error" ) ); + DisplayError( this, wxT( "SCH_EDIT_FRAME::CreateNewText() Internal error" ) ); 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. * 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 ) return; @@ -315,9 +314,9 @@ void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newty /* add the new text in linked list if old text is in list */ if( (flags & IS_NEW) == 0 ) { - newtext->SetNext( GetScreen()->EEDrawList ); - GetScreen()->EEDrawList = newtext; - OnModify( ); + newtext->SetNext( GetScreen()->GetDrawItems() ); + GetScreen()->SetDrawItems( newtext ); + OnModify(); } /* now delete the old text diff --git a/eeschema/eelibs_read_libraryfiles.cpp b/eeschema/eelibs_read_libraryfiles.cpp index fa9b9d50e1..c02572e1a6 100644 --- a/eeschema/eelibs_read_libraryfiles.cpp +++ b/eeschema/eelibs_read_libraryfiles.cpp @@ -19,7 +19,7 @@ * * 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; wxFileName fn; diff --git a/eeschema/eeredraw.cpp b/eeschema/eeredraw.cpp index c8301b44a8..d847c2a299 100644 --- a/eeschema/eeredraw.cpp +++ b/eeschema/eeredraw.cpp @@ -22,11 +22,10 @@ #include "build_version.h" -static EDA_BaseStruct* HighLightStruct = NULL; +static EDA_ITEM* HighLightStruct = NULL; -void DrawDanglingSymbol( WinEDA_DrawPanel* panel, wxDC* DC, - const wxPoint& pos, int Color ) +void DrawDanglingSymbol( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& pos, int Color ) { 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; } @@ -49,7 +48,7 @@ void SetHighLightStruct( EDA_BaseStruct* HighLight ) /* * 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; @@ -60,8 +59,7 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) DrawPanel->DrawBackGround( DC ); - RedrawStructList( DrawPanel, DC, GetScreen()->EEDrawList, - GR_DEFAULT_DRAWMODE ); + RedrawStructList( DrawPanel, DC, GetScreen()->GetDrawItems(), GR_DEFAULT_DRAWMODE ); 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 aData = a pointer on an auxiliary data (not used here) */ -void WinEDA_SchematicFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, - int aPrintMask, bool aPrintMirrorMode, - void * aData) +void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMask, + bool aPrintMirrorMode, void* aData) { wxBeginBusyCursor(); - RedrawStructList( DrawPanel, aDC, ActiveScreen->EEDrawList, GR_COPY ); + RedrawStructList( DrawPanel, aDC, (SCH_ITEM*) ActiveScreen->GetDrawItems(), GR_COPY ); if( aPrint_Sheet_Ref ) TraceWorkSheet( aDC, ActiveScreen, g_DrawDefaultLineThickness ); @@ -145,7 +142,7 @@ void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC, if( !(Structlist->m_Flags & IS_MOVED) ) { // uncomment line below when there is a virtual -// EDA_BaseStruct::GetBoundingBox() +// EDA_ITEM::GetBoundingBox() // if( panel->m_ClipBox.Intersects( Structs->GetBoundingBox() // ) ) RedrawOneStruct( panel, DC, Structlist, DrawMode, Color ); diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 6b4f6c0d1f..b011ad0b81 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -105,8 +105,8 @@ IMPLEMENT_APP( WinEDA_App ) */ void WinEDA_App::MacOpenFile( const wxString &fileName ) { - wxFileName filename = fileName; - WinEDA_SchematicFrame * frame = ((WinEDA_SchematicFrame*) GetTopWindow()); + wxFileName filename = fileName; + SCH_EDIT_FRAME* frame = ((SCH_EDIT_FRAME*) GetTopWindow()); if( !frame ) return; @@ -127,8 +127,8 @@ bool WinEDA_App::OnInit() wxApp::s_macPreferencesMenuItemId = ID_OPTIONS_SETUP; #endif /* __WXMAC__ */ - wxFileName filename; - WinEDA_SchematicFrame* frame = NULL; + wxFileName filename; + SCH_EDIT_FRAME* frame = NULL; InitEDA_Appl( wxT( "EESchema" ), APP_TYPE_EESCHEMA ); @@ -154,8 +154,7 @@ bool WinEDA_App::OnInit() ReadHotkeyConfig( wxT("SchematicFrame"), s_Eeschema_Hokeys_Descr ); // Create main frame (schematic frame) : - frame = new WinEDA_SchematicFrame( NULL, wxT( "EESchema" ), - wxPoint( 0, 0 ), wxSize( 600, 400 ) ); + frame = new SCH_EDIT_FRAME( NULL, wxT( "EESchema" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) ); SetTopWindow( frame ); frame->Show( TRUE ); diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 63deb43b33..95aa596a7b 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -36,7 +36,7 @@ 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(); } @@ -54,7 +54,7 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) { int id = event.GetId(); wxFileName fn; - WinEDA_SchematicFrame * schFrame = ( WinEDA_SchematicFrame * ) GetParent(); + SCH_EDIT_FRAME* schFrame = ( SCH_EDIT_FRAME* ) GetParent(); 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 ); @@ -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 ); @@ -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(); wxFileName fn; @@ -166,21 +166,20 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event ) break; 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; - GridArray& grid_list = GetBaseScreen()->m_GridList; + GRIDS grid_list; + + GetBaseScreen()->GetGrids( grid_list ); DIALOG_EESCHEMA_OPTIONS dlg( this ); - wxLogDebug( wxT( "Current grid array index %d." ), - grid_list.Index( GetBaseScreen()->GetGrid() ) ); - units.Add( GetUnitsLabel( INCHES ) ); units.Add( GetUnitsLabel( MILLIMETRES ) ); @@ -204,8 +203,7 @@ void WinEDA_SchematicFrame::OnSetOptions( wxCommandEvent& event ) for( unsigned i=0; iSetGrid( - grid_list[ (size_t) dlg.GetGridSelection() ].m_Size ); + GetBaseScreen()->SetGrid( grid_list[ (size_t) dlg.GetGridSelection() ].m_Size ); g_DrawDefaultLineThickness = dlg.GetLineWidth(); 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 DeleteAllTemplateFieldNames(); + for( int i=0; i<8; ++i ) // no. fields in this dialog window { 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 * 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() ) return m_projectFileParams; @@ -349,8 +347,7 @@ PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetProjectFileParameters( void ) /* * Load the Kicad project file (*.pro) settings specific to EESchema. */ -bool WinEDA_SchematicFrame::LoadProjectFile( const wxString& CfgFileName, - bool ForceRereadConfig ) +bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& CfgFileName, bool ForceRereadConfig ) { wxFileName fn; bool IsRead = TRUE; @@ -396,7 +393,7 @@ bool WinEDA_SchematicFrame::LoadProjectFile( const wxString& CfgFileName, /* * 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; @@ -457,7 +454,7 @@ static const wxString SimulatorCommandEntry( wxT( "SimCmdLine" ) ); * global variables or move them to the object class where they are * used. */ -PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetConfigurationSettings( void ) +PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void ) { if( !m_configSettings.empty() ) return m_configSettings; @@ -549,7 +546,7 @@ PARAM_CFG_ARRAY& WinEDA_SchematicFrame::GetConfigurationSettings( void ) /* * Load the EESchema configuration parameters. */ -void WinEDA_SchematicFrame::LoadSettings() +void SCH_EDIT_FRAME::LoadSettings() { wxASSERT( wxGetApp().m_EDA_Config != NULL ); @@ -647,7 +644,7 @@ void WinEDA_SchematicFrame::LoadSettings() /* * Save the EESchema configuration parameters. */ -void WinEDA_SchematicFrame::SaveSettings() +void SCH_EDIT_FRAME::SaveSettings() { wxASSERT( wxGetApp().m_EDA_Config != NULL ); diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index c8480485e1..529995dc06 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -169,7 +169,7 @@ int TestDuplicateSheetNames( bool aCreateMarker ) Screen != NULL; Screen = ScreenList.GetNext() ) { - for( SCH_ITEM* ref_item = Screen->EEDrawList; + for( SCH_ITEM* ref_item = Screen->GetDrawItems(); ref_item != NULL; ref_item = ref_item->Next() ) { @@ -199,9 +199,10 @@ int TestDuplicateSheetNames( bool aCreateMarker ) ( (SCH_SHEET*) item_to_test )->m_Pos ); Marker->SetMarkerType( MARK_ERC ); Marker->SetErrorLevel( ERR ); - Marker->SetNext( Screen->EEDrawList ); - Screen->EEDrawList = Marker; + Marker->SetNext( Screen->GetDrawItems() ); + Screen->SetDrawItems( Marker ); } + err_count++; } } @@ -235,12 +236,13 @@ void Diagnose( WinEDA_DrawPanel* aPanel, Marker->SetMarkerType( MARK_ERC ); Marker->SetErrorLevel( WAR ); screen = aNetItemRef->m_SheetList.LastScreen(); - Marker->SetNext( screen->EEDrawList ); - screen->EEDrawList = Marker; + Marker->SetNext( screen->GetDrawItems() ); + screen->SetDrawItems( Marker ); g_EESchemaVar.NbErrorErc++; g_EESchemaVar.NbWarningErc++; wxString msg; + if( aMinConn < 0 ) { if( (aNetItemRef->m_Type == NET_HIERLABEL) @@ -271,6 +273,7 @@ void Diagnose( WinEDA_DrawPanel* aPanel, memcpy( ascii_buf, &aNetItemRef->m_PinNum, 4 ); string_pinnum = CONV_FROM_UTF8( ascii_buf ); cmp_ref = wxT( "?" ); + if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link ) cmp_ref = ( (SCH_COMPONENT*) aNetItemRef->m_Link )->GetRef( &aNetItemRef->m_SheetList ); diff --git a/eeschema/events_called_functions_for_edit.cpp b/eeschema/events_called_functions_for_edit.cpp index 0866e6c5cf..14a07f1f3d 100644 --- a/eeschema/events_called_functions_for_edit.cpp +++ b/eeschema/events_called_functions_for_edit.cpp @@ -17,10 +17,10 @@ #include "sch_text.h" -/** Event function WinEDA_SchematicFrame::OnCopySchematicItemRequest +/** Event function SCH_EDIT_FRAME::OnCopySchematicItemRequest * duplicate the current located item */ -void WinEDA_SchematicFrame::OnCopySchematicItemRequest( wxCommandEvent& event ) +void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event ) { SCH_ITEM * curr_item = GetScreen()->GetCurItem(); diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 3982dafae8..2d07651077 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -23,7 +23,7 @@ * FileSave controls how the file is to be saved - under what name. * * 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; wxFileName schematicFileName, backupFileName; @@ -100,7 +100,7 @@ bool WinEDA_SchematicFrame::SaveEEFile( SCH_SCREEN* screen, int FileSave ) /* 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(); @@ -119,7 +119,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event ) break; default: - DisplayError( this, wxT( "WinEDA_SchematicFrame::Save_File Internal Error" ) ); + DisplayError( this, wxT( "SCH_EDIT_FRAME::Save_File Internal Error" ) ); break; } } @@ -131,7 +131,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event ) * Schematic root file and its subhierarchies, the configuration and the libs * 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; wxString FullFileName, msg; @@ -308,14 +308,13 @@ bool WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsN * * The library archive name is -cache.lib */ -void WinEDA_SchematicFrame::SaveProject() +void SCH_EDIT_FRAME::SaveProject() { SCH_SCREEN* screen; wxFileName fn; SCH_SCREENS ScreenList; - for( screen = ScreenList.GetFirst(); screen != NULL; - screen = ScreenList.GetNext() ) + for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) { D( printf( "SaveEEFile, %s\n", CONV_TO_UTF8( screen->m_FileName ) ); ) SaveEEFile( screen, FILE_SAVE_AS ); diff --git a/eeschema/find.cpp b/eeschema/find.cpp index ba4dc2c9d6..a137ba8120 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -33,7 +33,7 @@ #include "dialogs/dialog_schematic_find.h" -void WinEDA_SchematicFrame::OnFindDrcMarker( wxFindDialogEvent& event ) +void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event ) { static SCH_MARKER* lastMarker = NULL; @@ -99,11 +99,11 @@ void WinEDA_SchematicFrame::OnFindDrcMarker( wxFindDialogEvent& event ) * >= 4 => unused (same as 0) * @param mouseWarp If true, then move the mouse cursor to the item. */ -SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem( const wxString& component_reference, - bool Find_in_hierarchy, - int SearchType, - const wxString& text_to_find, - bool mouseWarp ) +SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_reference, + bool Find_in_hierarchy, + int SearchType, + const wxString& text_to_find, + bool mouseWarp ) { SCH_SHEET_PATH* sheet, * SheetWithComponentFound = NULL; SCH_ITEM* DrawList = NULL; @@ -179,6 +179,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem( const wxString& component if( Component ) { sheet = SheetWithComponentFound; + if( sheet != GetSheet() ) { 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. */ -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 * note: the actual matched item can be a @@ -318,7 +319,8 @@ void WinEDA_SchematicFrame::OnFindSchematicItem( wxFindDialogEvent& event ) } else { - lastItem = schematic.MatchNextItem( searchCriteria, &sheetFoundIn, lastItem, &lastItemPosition ); + lastItem = schematic.MatchNextItem( searchCriteria, &sheetFoundIn, lastItem, + &lastItemPosition ); } if( lastItem != NULL ) diff --git a/eeschema/general.h b/eeschema/general.h index 9497d16e9d..509e3c1ebc 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -32,7 +32,7 @@ class TRANSFORM; #define HIGHLIGHT_COLOR WHITE -/* Used for EDA_BaseStruct, .m_Select member */ +/* Used for EDA_ITEM, .m_Select member */ #define IS_SELECTED 1 #define TEXT_NO_VISIBLE 1 diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index ffdad536f3..9a71850758 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -29,7 +29,7 @@ static TRANSFORM OldTransform; static wxPoint OldPos; -wxString WinEDA_SchematicFrame::SelectFromLibBrowser( void ) +wxString SCH_EDIT_FRAME::SelectFromLibBrowser( void ) { wxSemaphore semaphore( 0, 1 ); @@ -61,10 +61,10 @@ wxString WinEDA_SchematicFrame::SelectFromLibBrowser( void ) * if libname != "", search in lib "libname" * else search in all loaded libs */ -SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, - const wxString& libname, - wxArrayString& HistoryList, - bool UseLibBrowser ) +SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, + const wxString& libname, + wxArrayString& HistoryList, + bool UseLibBrowser ) { int CmpCount = 0; int unit = 1; @@ -98,7 +98,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, msg.Printf( _( "component selection (%d items loaded):" ), CmpCount ); DIALOG_GET_COMPONENT dlg( this, GetComponentDialogPosition(), HistoryList, - msg, UseLibBrowser ); + msg, UseLibBrowser ); dlg.SetComponentName( lastCommponentName ); if ( dlg.ShowModal() == wxID_CANCEL ) @@ -135,6 +135,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, AllowWildSeach = FALSE; keys = Name.AfterFirst( '=' ); Name = DataBaseGetName( this, keys, Name ); + if( Name.IsEmpty() ) { DrawPanel->m_IgnoreMouseEvents = FALSE; @@ -145,6 +146,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, else if( Name == wxT( "*" ) ) { AllowWildSeach = FALSE; + if( GetNameOfPartToLoad( this, Library, Name ) == 0 ) { DrawPanel->m_IgnoreMouseEvents = FALSE; @@ -186,6 +188,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->MouseToCursorSchema(); + if( Entry == NULL ) { 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 */ -void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, - wxDC* DC, int type_rotate ) +void SCH_EDIT_FRAME::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, wxDC* DC, int type_rotate ) { if( DrawComponent == NULL ) return; @@ -254,6 +256,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, if( DC ) { DrawPanel->CursorOff( DC ); + if( DrawComponent->m_Flags ) DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) ); else @@ -270,12 +273,11 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, if( DrawComponent->m_Flags ) DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint(0,0) ); else - DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), - GR_DEFAULT_DRAWMODE ); + DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); DrawPanel->CursorOn( DC ); } - TestDanglingEnds( GetScreen()->EEDrawList, DC ); + TestDanglingEnds( GetScreen()->GetDrawItems(), DC ); OnModify( ); } @@ -312,8 +314,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC ) /* * Handle select part in multi-part component. */ -void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent, - int unit, wxDC* DC ) +void SCH_EDIT_FRAME::SelPartUnit( SCH_COMPONENT* DrawComponent, int unit, wxDC* DC ) { int m_UnitCount; LIB_COMPONENT* LibEntry; @@ -333,8 +334,10 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent, if( DrawComponent->m_Multi == unit ) return; + if( unit < 1 ) unit = 1; + if( unit > m_UnitCount ) unit = m_UnitCount; @@ -351,16 +354,14 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent, if( DrawComponent->m_Flags ) DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) ); else - DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), - GR_DEFAULT_DRAWMODE ); + DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); - TestDanglingEnds( GetScreen()->EEDrawList, DC ); + TestDanglingEnds( GetScreen()->GetDrawItems(), DC ); OnModify( ); } -void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent, - wxDC* DC ) +void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC ) { LIB_COMPONENT* LibEntry; @@ -400,15 +401,16 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent, DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); - TestDanglingEnds( GetScreen()->EEDrawList, DC ); + TestDanglingEnds( GetScreen()->GetDrawItems(), DC ); OnModify( ); } -void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component, wxDC* DC ) +void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* Component, wxDC* DC ) { if( Component == NULL ) return; + if( Component->Type() != TYPE_SCH_COMPONENT ) return; diff --git a/eeschema/hierarch.cpp b/eeschema/hierarch.cpp index 008778777c..58992f13d9 100644 --- a/eeschema/hierarch.cpp +++ b/eeschema/hierarch.cpp @@ -19,7 +19,7 @@ #include "wx/treectrl.h" -static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame ); +static bool UpdateScreenFromSheet( SCH_EDIT_FRAME* frame ); enum { @@ -79,17 +79,17 @@ WinEDA_Tree::WinEDA_Tree( WinEDA_HierFrame* parent ) : class WinEDA_HierFrame : public wxDialog { public: - WinEDA_SchematicFrame* m_Parent; - WinEDA_Tree* m_Tree; - int m_nbsheets; - wxDC* m_DC; + SCH_EDIT_FRAME* m_Parent; + WinEDA_Tree* m_Tree; + int m_nbsheets; + wxDC* m_DC; private: wxSize m_TreeSize; int maxposx; 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 ); ~WinEDA_HierFrame(); @@ -108,7 +108,7 @@ BEGIN_EVENT_TABLE( WinEDA_HierFrame, wxDialog ) 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 ); @@ -117,10 +117,8 @@ void WinEDA_SchematicFrame::InstallHierarchyFrame( wxDC* DC, wxPoint& pos ) } -WinEDA_HierFrame::WinEDA_HierFrame( WinEDA_SchematicFrame* parent, wxDC* DC, - const wxPoint& pos ) : - wxDialog( parent, -1, _( "Navigator" ), pos, wxSize( 110, 50 ), - DIALOG_STYLE ) +WinEDA_HierFrame::WinEDA_HierFrame( SCH_EDIT_FRAME* parent, wxDC* DC, const wxPoint& pos ) : + wxDialog( parent, -1, _( "Navigator" ), pos, wxSize( 110, 50 ), DIALOG_STYLE ) { wxTreeItemId cellule; @@ -253,7 +251,7 @@ void WinEDA_HierFrame::OnSelect( wxTreeEvent& event ) /* Set the current screen to display the parent sheet of the current * displayed sheet */ -void WinEDA_SchematicFrame::InstallPreviousSheet() +void SCH_EDIT_FRAME::InstallPreviousSheet() { if( m_CurrentSheet->Last() == g_RootSheet ) return; @@ -264,24 +262,25 @@ void WinEDA_SchematicFrame::InstallPreviousSheet() //make a copy for testing purposes. SCH_SHEET_PATH listtemp = *m_CurrentSheet; listtemp.Pop(); + if( listtemp.LastScreen() == NULL ) { - DisplayError( this, - wxT( "InstallPreviousScreen() Error: Sheet not found" ) ); + DisplayError( this, wxT( "InstallPreviousScreen() Error: Sheet not found" ) ); return; } + m_CurrentSheet->Pop(); UpdateScreenFromSheet( this ); } /* 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 * m_SubSheet hierarchy to maintain path info (well, this is but one way to * maintain path info..) */ -void WinEDA_SchematicFrame::InstallNextScreen( SCH_SHEET* Sheet ) +void SCH_EDIT_FRAME::InstallNextScreen( SCH_SHEET* Sheet ) { if( Sheet == NULL ) { @@ -297,7 +296,7 @@ void WinEDA_SchematicFrame::InstallNextScreen( SCH_SHEET* Sheet ) /* Find and install the screen on the sheet symbol Sheet. * 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; diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index 2308c303fa..3d223ca2e6 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -256,8 +256,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Viewlib_Hokeys_Descr[] = * Hot keys. Some commands are relative to the item under the mouse cursor * Commands are case insensitive */ -void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, - EDA_BaseStruct* DrawStruct ) +void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) { wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); @@ -346,7 +345,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, RefreshToolBar = LocateAndDeleteItem( this, DC ); OnModify(); GetScreen()->SetCurItem( NULL ); - TestDanglingEnds( GetScreen()->EEDrawList, DC ); + TestDanglingEnds( GetScreen()->GetDrawItems(), DC ); } break; @@ -659,7 +658,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, RefreshToolBar = TRUE; } CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_NORMAL ); - TestDanglingEnds( GetScreen()->EEDrawList, DC ); + TestDanglingEnds( GetScreen()->GetDrawItems(), DC ); } break; @@ -837,7 +836,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, * under the mouse cursor * 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 toolCmd( wxEVT_COMMAND_TOOL_CLICKED ); diff --git a/eeschema/lib_draw_item.cpp b/eeschema/lib_draw_item.cpp index 34af6a2255..9d25e3ad07 100644 --- a/eeschema/lib_draw_item.cpp +++ b/eeschema/lib_draw_item.cpp @@ -22,12 +22,12 @@ LIB_DRAW_ITEM::LIB_DRAW_ITEM( KICAD_T aType, int aUnit, int aConvert, FILL_T aFillType ) : - EDA_BaseStruct( aType ) + EDA_ITEM( aType ) { m_Unit = aUnit; m_Convert = aConvert; m_Fill = aFillType; - m_Parent = (EDA_BaseStruct*) aComponent; + m_Parent = (EDA_ITEM*) aComponent; m_typeName = _( "Undefined" ); m_isFillable = 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 ) : - EDA_BaseStruct( aItem ) + EDA_ITEM( aItem ) { m_Unit = aItem.m_Unit; m_Convert = aItem.m_Convert; diff --git a/eeschema/lib_draw_item.h b/eeschema/lib_draw_item.h index 48156c8121..a16ce9f2ae 100644 --- a/eeschema/lib_draw_item.h +++ b/eeschema/lib_draw_item.h @@ -50,7 +50,7 @@ typedef std::vector< LIB_PIN* > LIB_PIN_LIST; * Base class for drawable items used in library components. * (graphic shapes, texts, fields, pins) */ -class LIB_DRAW_ITEM : public EDA_BaseStruct +class LIB_DRAW_ITEM : public EDA_ITEM { /** * Draws the item. @@ -229,7 +229,7 @@ public: */ virtual EDA_Rect GetBoundingBox() { - return EDA_BaseStruct::GetBoundingBox(); + return EDA_ITEM::GetBoundingBox(); } /** diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 69b58b7d2f..5e13d34240 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -806,7 +806,7 @@ void LIB_PIN::drawGraphic( WinEDA_DrawPanel* aPanel, { // Invisible pins are only drawn on request. In libedit they are drawn // 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 ) { diff --git a/eeschema/libarch.cpp b/eeschema/libarch.cpp index 62e3418634..69a3e4f264 100644 --- a/eeschema/libarch.cpp +++ b/eeschema/libarch.cpp @@ -38,8 +38,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName ) for( SCH_SCREEN* screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() ) { - for( SCH_ITEM* SchItem = screen->EEDrawList; SchItem; - SchItem = SchItem->Next() ) + for( SCH_ITEM* SchItem = screen->GetDrawItems(); SchItem; SchItem = SchItem->Next() ) { if( SchItem->Type() != TYPE_SCH_COMPONENT ) continue; diff --git a/eeschema/libedit_undo_redo.cpp b/eeschema/libedit_undo_redo.cpp index 6f5715b441..3944d36334 100644 --- a/eeschema/libedit_undo_redo.cpp +++ b/eeschema/libedit_undo_redo.cpp @@ -12,7 +12,7 @@ #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; PICKED_ITEMS_LIST* lastcmd; diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 442ba51785..88cce4fab1 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -163,7 +163,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, WinEDA_DrawFrame ) 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 wxPoint& pos, const wxSize& size, @@ -247,7 +247,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( WinEDA_SchematicFrame* aParent, 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; m_drawItem = m_lastDrawItem = NULL; @@ -958,7 +958,7 @@ void LIB_EDIT_FRAME::EnsureActiveLibExists() void LIB_EDIT_FRAME::SetLanguage( wxCommandEvent& event ) { WinEDA_BasicFrame::SetLanguage( event ); - WinEDA_SchematicFrame *parent = (WinEDA_SchematicFrame *)GetParent(); + SCH_EDIT_FRAME *parent = (SCH_EDIT_FRAME *)GetParent(); parent->WinEDA_BasicFrame::SetLanguage( event ); } diff --git a/eeschema/libeditframe.h b/eeschema/libeditframe.h index d7c91b93ce..f56bb709db 100644 --- a/eeschema/libeditframe.h +++ b/eeschema/libeditframe.h @@ -12,7 +12,7 @@ #include "lib_draw_item.h" -class WinEDA_SchematicFrame; +class SCH_EDIT_FRAME; class CMP_LIBRARY; class LIB_COMPONENT; class LIB_ALIAS; @@ -32,7 +32,7 @@ public: WinEDAChoiceBox* m_SelAliasBox; // a box to select the alias to edit (if any) 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, long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); @@ -100,7 +100,7 @@ public: void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); 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 ); @@ -223,7 +223,7 @@ private: // General editing public: - void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 ); + void SaveCopyInUndoList( EDA_ITEM* ItemToCopy, int flag_type_command = 0 ); private: void GetComponentFromUndoList( wxCommandEvent& event ); diff --git a/eeschema/load_one_schematic_file.cpp b/eeschema/load_one_schematic_file.cpp index ca7c1ce857..16a94e0db8 100644 --- a/eeschema/load_one_schematic_file.cpp +++ b/eeschema/load_one_schematic_file.cpp @@ -27,7 +27,7 @@ static void LoadLayers( LINE_READER* aLine ); * Routine to load an EESchema file. * 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]; bool itemLoaded = false; @@ -188,8 +188,8 @@ again." ); } else { - item->SetNext( screen->EEDrawList ); - screen->EEDrawList = item; + item->SetNext( screen->GetDrawItems() ); + 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; - while( screen->EEDrawList ) + + while( screen->GetDrawItems() ) { - Pnext = screen->EEDrawList; - screen->EEDrawList = screen->EEDrawList->Next(); + Pnext = screen->GetDrawItems(); + screen->SetDrawItems( screen->GetDrawItems()->Next() ); Pnext->SetNext( Phead ); Phead = Pnext; } - screen->EEDrawList = Phead; + screen->SetDrawItems( Phead ); #if 0 && defined (DEBUG) screen->Show( 0, std::cout ); #endif - TestDanglingEnds( screen->EEDrawList, NULL ); + TestDanglingEnds( screen->GetDrawItems(), NULL ); MsgDiag = _( "Done Loading " ) + screen->m_FileName; PrintMsg( MsgDiag ); @@ -257,7 +258,7 @@ static void LoadLayers( LINE_READER* aLine ) /* 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]; 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 ); wxString pagename = CONV_FROM_UTF8( Text ); + for( ii = 0; SheetFormatList[ii] != NULL; ii++ ) { wsheet = SheetFormatList[ii]; + if( wsheet->m_Name.CmpNoCase( pagename ) == 0 ) /* Descr found ! */ { // 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; } + break; } } @@ -295,7 +299,7 @@ line %d, \aAbort reading file.\n" ), aMsgDiag << CONV_FROM_UTF8( ((char*)(*aLine)) ); } - Window->m_CurrentSheetDesc = wsheet; + aScreen->m_CurrentSheetDesc = wsheet; for( ; ; ) { @@ -307,61 +311,61 @@ line %d, \aAbort reading file.\n" ), if( strnicmp( ((char*)(*aLine)), "Sheet", 2 ) == 0 ) 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 ) { ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); - Window->m_Title = CONV_FROM_UTF8( buf ); + aScreen->m_Title = CONV_FROM_UTF8( buf ); continue; } if( strnicmp( ((char*)(*aLine)), "Date", 2 ) == 0 ) { ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); - Window->m_Date = CONV_FROM_UTF8( buf ); + aScreen->m_Date = CONV_FROM_UTF8( buf ); continue; } if( strnicmp( ((char*)(*aLine)), "Rev", 2 ) == 0 ) { ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); - Window->m_Revision = CONV_FROM_UTF8( buf ); + aScreen->m_Revision = CONV_FROM_UTF8( buf ); continue; } if( strnicmp( ((char*)(*aLine)), "Comp", 4 ) == 0 ) { ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); - Window->m_Company = CONV_FROM_UTF8( buf ); + aScreen->m_Company = CONV_FROM_UTF8( buf ); continue; } if( strnicmp( ((char*)(*aLine)), "Comment1", 8 ) == 0 ) { ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); - Window->m_Commentaire1 = CONV_FROM_UTF8( buf ); + aScreen->m_Commentaire1 = CONV_FROM_UTF8( buf ); continue; } if( strnicmp( ((char*)(*aLine)), "Comment2", 8 ) == 0 ) { ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); - Window->m_Commentaire2 = CONV_FROM_UTF8( buf ); + aScreen->m_Commentaire2 = CONV_FROM_UTF8( buf ); continue; } if( strnicmp( ((char*)(*aLine)), "Comment3", 8 ) == 0 ) { ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); - Window->m_Commentaire3 = CONV_FROM_UTF8( buf ); + aScreen->m_Commentaire3 = CONV_FROM_UTF8( buf ); continue; } if( strnicmp( ((char*)(*aLine)), "Comment4", 8 ) == 0 ) { ReadDelimitedText( buf, ((char*)(*aLine)), 256 ); - Window->m_Commentaire4 = CONV_FROM_UTF8( buf ); + aScreen->m_Commentaire4 = CONV_FROM_UTF8( buf ); continue; } } diff --git a/eeschema/locate.cpp b/eeschema/locate.cpp index d363ca8fb7..1d8419550f 100644 --- a/eeschema/locate.cpp +++ b/eeschema/locate.cpp @@ -40,31 +40,30 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen ) EDA_Rect BoundaryBox; float sizeref = 0, sizecurr; - DrawList = Screen->EEDrawList; + DrawList = Screen->GetDrawItems(); while( DrawList ) { - if( ( SnapPoint2( Screen->m_MousePosition, LIBITEM, - DrawList, Screen->GetZoom() ) ) == FALSE ) + if( !SnapPoint2( Screen->m_MousePosition, LIBITEM, DrawList, Screen->GetZoom() ) ) { - if( ( SnapPoint2( Screen->m_Curseur, LIBITEM, - DrawList, Screen->GetScalingFactor() ) ) == FALSE ) + if( !SnapPoint2( Screen->m_Curseur, LIBITEM, DrawList, Screen->GetScalingFactor() ) ) break; } + component = (SCH_COMPONENT*) LastSnappedStruct; DrawList = component->Next(); + if( lastcomponent == NULL ) // First time a component is located { lastcomponent = component; BoundaryBox = lastcomponent->GetBoundaryBox(); - sizeref = ABS( (float) BoundaryBox.GetWidth() * - BoundaryBox.GetHeight() ); + sizeref = ABS( (float) BoundaryBox.GetWidth() * BoundaryBox.GetHeight() ); } else { BoundaryBox = component->GetBoundaryBox(); - sizecurr = ABS( (float) BoundaryBox.GetWidth() * - BoundaryBox.GetHeight() ); + sizecurr = ABS( (float) BoundaryBox.GetWidth() * BoundaryBox.GetHeight() ); + if( sizeref > sizecurr ) // a smallest component is found { sizeref = sizecurr; @@ -104,21 +103,16 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen ) * pointer on item found or NULL * */ -SCH_ITEM* PickStruct( const wxPoint& refpos, - BASE_SCREEN* screen, - int SearchMask ) +SCH_ITEM* PickStruct( const wxPoint& refpos, SCH_SCREEN* screen, int SearchMask ) { - bool Snapped; - - if( screen == NULL || screen->EEDrawList == NULL ) + if( screen == NULL || screen->GetDrawItems() == NULL ) return NULL; - if( ( Snapped = SnapPoint2( refpos, SearchMask, - screen->EEDrawList, - screen->GetScalingFactor() ) ) != FALSE ) + if( SnapPoint2( refpos, SearchMask, screen->GetDrawItems(), screen->GetScalingFactor() ) ) { return LastSnappedStruct; } + return NULL; } @@ -130,7 +124,7 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, * @param aBlock a BLOCK_SELECTOR that gives the search area boundary * 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; @@ -144,7 +138,8 @@ int PickItemsInBlock( BLOCK_SELECTOR& aBlock, BASE_SCREEN* aScreen ) area.Normalize(); ITEM_PICKER picker; - SCH_ITEM* DrawStruct = aScreen->EEDrawList; + SCH_ITEM* DrawStruct = aScreen->GetDrawItems(); + for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) { 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). * * The routine returns true if point was snapped. * *****************************************************************************/ -bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, - SCH_ITEM* DrawList, double aScaleFactor ) +bool SnapPoint2( const wxPoint& aPosRef, int SearchMask, SCH_ITEM* DrawList, double aScaleFactor ) { for( ; DrawList != NULL; DrawList = DrawList->Next() ) { int hitminDist = MAX( g_DrawDefaultLineThickness, 3 ); + switch( DrawList->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; LIB_PIN* Pin = NULL; - for( DrawStruct = DrawList; DrawStruct != NULL; - DrawStruct = DrawStruct->Next() ) + for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) { if( DrawStruct->Type() != TYPE_SCH_COMPONENT ) continue; + schItem = (SCH_COMPONENT*) DrawStruct; Entry = CMP_LIBRARY::FindLibraryComponent( schItem->m_ChipName ); @@ -503,6 +498,7 @@ LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, SCH_COMPONENT* if( libpart ) *libpart = schItem; + return Pin; } @@ -512,13 +508,13 @@ SCH_SHEET_PIN* LocateAnyPinSheet( const wxPoint& RefPos, SCH_ITEM* DrawList ) SCH_ITEM* DrawStruct; SCH_SHEET_PIN* PinSheet = NULL; - for( DrawStruct = DrawList; DrawStruct != NULL; - DrawStruct = DrawStruct->Next() ) + for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) { if( DrawStruct->Type() != DRAW_SHEET_STRUCT_TYPE ) continue; PinSheet = LocateSheetLabel( (SCH_SHEET*) DrawStruct, RefPos ); + if( PinSheet ) break; } diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index c6440a83ee..0c78c9ffcd 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -22,7 +22,7 @@ /** * @brief Create or update the menubar for the schematic frame */ -void WinEDA_SchematicFrame::ReCreateMenuBar() +void SCH_EDIT_FRAME::ReCreateMenuBar() { wxString text; wxMenuItem* item; diff --git a/eeschema/netform.cpp b/eeschema/netform.cpp index fd100528d3..d55c7c5e24 100644 --- a/eeschema/netform.cpp +++ b/eeschema/netform.cpp @@ -137,9 +137,9 @@ class EXPORT_HELP * A suitable component is a "new" real component (power symbols are not * 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 @@ -242,7 +242,7 @@ public: * creates a generic netlist, now in XML. * @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 @@ -251,8 +251,7 @@ public: * @param with_pcbnew if true, then format Pcbnew (OrcadPcb2 + reviews and lists of net),

* else output ORCADPCB2 strict format. */ - bool WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, - bool with_pcbnew ); + bool WriteNetListPCBNEW( SCH_EDIT_FRAME* frame, FILE* f, bool with_pcbnew ); /** * Function WriteNetListCADSTAR @@ -282,7 +281,7 @@ public: * .. B * T3 1 *U1 * 14 */ - void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f ); + void WriteNetListCADSTAR( SCH_EDIT_FRAME* frame, FILE* f ); /** * Function WriteNetListPspice @@ -295,8 +294,7 @@ public: * @param use_netnames if true, then nodes are identified by the netname, * else by net number. */ - bool WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, - bool use_netnames ); + bool WriteNetListPspice( SCH_EDIT_FRAME* frame, FILE* f, bool use_netnames ); /** * Function MakeCommandLine @@ -357,8 +355,8 @@ wxString EXPORT_HELP::MakeCommandLine( const wxString& aFormatString, * bool aUse_netnames is used only for Spice netlist * @return true if success. */ -bool WinEDA_SchematicFrame::WriteNetListFile( int aFormat, const wxString& aFullFileName, - bool aUse_netnames ) +bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileName, + bool aUse_netnames ) { bool ret = true; FILE* f = NULL; @@ -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; @@ -536,8 +534,8 @@ SCH_COMPONENT* EXPORT_HELP::findNextComponent( EDA_BaseStruct* aItem, SCH_SHEET_ } -SCH_COMPONENT* EXPORT_HELP::findNextComponentAndCreatPinList( - EDA_BaseStruct* aItem, SCH_SHEET_PATH* aSheetPath ) +SCH_COMPONENT* EXPORT_HELP::findNextComponentAndCreatPinList( EDA_ITEM* aItem, + SCH_SHEET_PATH* aSheetPath ) { wxString ref; @@ -555,6 +553,7 @@ SCH_COMPONENT* EXPORT_HELP::findNextComponentAndCreatPinList( // Power symbols and other components which have the reference starting // with "#" are not included in netlist (pseudo or virtual components) ref = comp->GetRef( aSheetPath ); + if( ref[0] == wxChar( '#' ) ) continue; @@ -565,6 +564,7 @@ SCH_COMPONENT* EXPORT_HELP::findNextComponentAndCreatPinList( // toggled. LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( comp->m_ChipName ); + if( !entry ) continue; @@ -942,7 +942,7 @@ XNODE* EXPORT_HELP::makeGenericComponents() 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 ); if( !comp ) @@ -1036,7 +1036,7 @@ XNODE* EXPORT_HELP::makeGenericComponents() #include // wxFFileOutputStream -bool EXPORT_HELP::WriteGENERICNetList( WinEDA_SchematicFrame* frame, const wxString& aOutFileName ) +bool EXPORT_HELP::WriteGENERICNetList( SCH_EDIT_FRAME* frame, const wxString& aOutFileName ) { #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( 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 ); 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; char Line[1024]; @@ -1190,8 +1190,7 @@ bool EXPORT_HELP::WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, boo DateAndTime( Line ); - ret |= fprintf( f, "* %s (Spice format) creation date: %s\n\n", - NETLIST_HEAD_STRING, Line ); + ret |= fprintf( f, "* %s (Spice format) creation date: %s\n\n", NETLIST_HEAD_STRING, Line ); // Create text list starting by [.-]pspice , or [.-]gnucap (simulator // 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( EDA_BaseStruct* item = sheet->LastDrawList(); item; item = item->Next() ) + for( EDA_ITEM* item = sheet->LastDrawList(); item; item = item->Next() ) { wxChar ident; 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( 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 ); 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 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( 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 ); 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( 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 ) continue; @@ -1690,14 +1689,14 @@ bool EXPORT_HELP::writeGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjects 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 msg; wxString footprint; char Line[1024]; SCH_SHEET_PATH* sheet; - EDA_BaseStruct* DrawList; + EDA_ITEM* DrawList; SCH_COMPONENT* Component; wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion(); diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp index bcf29f1ea6..fe893db02a 100644 --- a/eeschema/netlist.cpp +++ b/eeschema/netlist.cpp @@ -82,7 +82,7 @@ void FreeNetObjectsList( NETLIST_OBJECT_LIST& aNetObjectsBuffer ) * Updates: * g_NetObjectslist */ -void WinEDA_SchematicFrame::BuildNetListBase() +void SCH_EDIT_FRAME::BuildNetListBase() { int NetNumber; int NetCode; @@ -509,7 +509,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist, LIB_COMPONENT* Entry; SCH_SHEET_PATH list; - DrawList = sheetlist->LastScreen()->EEDrawList; + DrawList = sheetlist->LastScreen()->GetDrawItems(); for( ; DrawList; DrawList = DrawList->Next() ) { switch( DrawList->Type() ) diff --git a/eeschema/netlist_control.cpp b/eeschema/netlist_control.cpp index 92d401f6ad..5c8f9ac70c 100644 --- a/eeschema/netlist_control.cpp +++ b/eeschema/netlist_control.cpp @@ -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, wxDefaultSize, DIALOG_STYLE | MAYBE_RESIZE_BORDER ) /*************************************************************************************/ @@ -525,8 +525,8 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event ) * bool aUse_netnames is used only for Spice netlist * @return true if success. */ -bool WinEDA_SchematicFrame::CreateNetlist( int aFormat, const wxString& aFullFileName, - bool aUse_netnames ) +bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName, + bool aUse_netnames ) { ReAnnotatePowerSymbolsOnly(); diff --git a/eeschema/netlist_control.h b/eeschema/netlist_control.h index 39b9e02643..e61b4a43c5 100644 --- a/eeschema/netlist_control.h +++ b/eeschema/netlist_control.h @@ -61,16 +61,15 @@ public: class WinEDA_NetlistFrame : public wxDialog { public: - WinEDA_SchematicFrame* m_Parent; - wxNotebook* m_NoteBook; - EDA_NoteBookPage* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX]; - - wxRadioBox* m_UseNetNamesInNetlist; + SCH_EDIT_FRAME* m_Parent; + wxNotebook* m_NoteBook; + EDA_NoteBookPage* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX]; + wxRadioBox* m_UseNetNamesInNetlist; public: // Constructor and destructor - WinEDA_NetlistFrame( WinEDA_SchematicFrame* parent ); + WinEDA_NetlistFrame( SCH_EDIT_FRAME* parent ); ~WinEDA_NetlistFrame() { }; private: diff --git a/eeschema/onleftclick.cpp b/eeschema/onleftclick.cpp index 18ee72d8b6..8b54d4d023 100644 --- a/eeschema/onleftclick.cpp +++ b/eeschema/onleftclick.cpp @@ -26,7 +26,7 @@ static wxArrayString s_PowerNameList; /* Process the command triggers by the left button of the mouse when a tool * 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(); @@ -51,7 +51,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) case DRAW_PART_TEXT_STRUCT_TYPE: DrawStruct->Place( this, DC ); GetScreen()->SetCurItem( NULL ); - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); DrawPanel->Refresh( TRUE ); return; @@ -67,7 +67,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) default: { 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()); DisplayError( this, msg ); DrawStruct->m_Flags = 0; @@ -113,7 +113,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) DrawStruct->Place( this, DC ); DrawPanel->m_AutoPAN_Request = FALSE; } - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); DrawPanel->Refresh( TRUE ); break; @@ -131,7 +131,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) DrawStruct->Place( this, DC ); DrawPanel->m_AutoPAN_Request = FALSE; } - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); DrawPanel->Refresh( TRUE ); break; @@ -150,7 +150,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { DrawStruct->Place( this, DC ); GetScreen()->SetCurItem( NULL ); - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); DrawPanel->Refresh( TRUE ); DrawPanel->m_AutoPAN_Request = FALSE; } @@ -160,7 +160,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) LocateAndDeleteItem( this, DC ); OnModify( ); GetScreen()->SetCurItem( NULL ); - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); DrawPanel->Refresh( TRUE ); break; @@ -202,7 +202,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { DrawStruct->Place( this, DC ); DrawPanel->m_AutoPAN_Request = FALSE; - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); DrawPanel->Refresh( TRUE ); } break; @@ -221,7 +221,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { DrawStruct->Place( this, DC ); DrawPanel->m_AutoPAN_Request = FALSE; - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); DrawPanel->Refresh( TRUE ); } break; @@ -236,7 +236,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { DrawStruct->Place( this, DC ); DrawPanel->m_AutoPAN_Request = FALSE; - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); DrawPanel->Refresh( TRUE ); } break; @@ -263,7 +263,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) && (DrawStruct->m_Flags != 0) ) { DrawStruct->Place( this, DC ); - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); DrawPanel->Refresh( TRUE ); } break; @@ -279,7 +279,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { DrawStruct->Place( this, DC ); DrawPanel->m_AutoPAN_Request = FALSE; - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); DrawPanel->Refresh( TRUE ); } break; @@ -295,7 +295,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { DrawStruct->Place( this, DC ); DrawPanel->m_AutoPAN_Request = FALSE; - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); DrawPanel->Refresh( TRUE ); } break; @@ -303,7 +303,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) default: { 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; DisplayError( this, msg ); @@ -321,11 +321,11 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) * Id a create command is in progress: * 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(); - wxPoint pos = GetPosition(); + EDA_ITEM* DrawStruct = GetScreen()->GetCurItem(); + wxPoint pos = GetPosition(); switch( m_ID_current_state ) { diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index 52162a5f59..2c8ec20232 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -26,9 +26,9 @@ using namespace std; -static void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame ); -static void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, WinEDA_SchematicFrame* frame ); -static void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, WinEDA_SchematicFrame* frame ); +static void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame ); +static void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame ); +static void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame ); static void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet ); static void AddMenusForPinSheet( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet ); 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 AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component ); static void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field ); -static void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, - WinEDA_SchematicFrame* frame ); -static void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, - WinEDA_SchematicFrame* aFrame ); +static void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAME* frame ); +static void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame ); /* Prepare context menu when a click on the right mouse button occurs. * * 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(); bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE); @@ -214,8 +212,8 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMe default: wxString msg; - msg.Printf( wxT( "WinEDA_SchematicFrame::OnRightClick Error: unknown DrawType %d" ), - DrawStruct->Type() ); + msg.Printf( wxT( "SCH_EDIT_FRAME::OnRightClick Error: unknown DrawType %d" ), + DrawStruct->Type() ); DisplayError( this, msg ); 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; 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; 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; 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; @@ -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_GETINFO_MARKER, _( "Marker Error Info" ), info_xpm ); diff --git a/eeschema/operations_on_items_lists.cpp b/eeschema/operations_on_items_lists.cpp index f6266b15e9..ddd78565e9 100644 --- a/eeschema/operations_on_items_lists.cpp +++ b/eeschema/operations_on_items_lists.cpp @@ -81,22 +81,22 @@ void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector ) */ void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList ) { - SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen(); - WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->GetParent(); - PICKED_ITEMS_LIST itemsList; - ITEM_PICKER itemWrapper; + SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen(); + SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) panel->GetParent(); + PICKED_ITEMS_LIST itemsList; + ITEM_PICKER itemWrapper; for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ ) { SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii ); itemWrapper.m_PickedItem = item; itemWrapper.m_UndoRedoStatus = UR_DELETED; + if( item->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) { /* this item is depending on a sheet, and is not in global list */ - wxMessageBox( wxT( - "DeleteItemsInList() err: unexpected \ -DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE" ) ); + wxMessageBox( wxT("DeleteItemsInList() err: unexpected \ +DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE" ) ); } else { @@ -118,8 +118,8 @@ DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE" */ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct ) { - SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen(); - WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->GetParent(); + SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen(); + SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) panel->GetParent(); if( !DrawStruct ) 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 * the global list directly. */ - frame->SaveCopyInUndoList( - (SCH_ITEM*)( (SCH_SHEET_PIN*) DrawStruct )->GetParent(), - UR_CHANGED ); - frame->DeleteSheetLabel( DC ? true : false, - (SCH_SHEET_PIN*) DrawStruct ); + frame->SaveCopyInUndoList( (SCH_ITEM*)( (SCH_SHEET_PIN*) DrawStruct )->GetParent(), + UR_CHANGED ); + frame->DeleteSheetLabel( DC ? true : false, (SCH_SHEET_PIN*) DrawStruct ); return; } else @@ -199,8 +197,8 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, } SetaParent( newitem, screen ); - newitem->SetNext( screen->EEDrawList ); - screen->EEDrawList = newitem; + newitem->SetNext( screen->GetDrawItems() ); + screen->SetDrawItems( newitem ); } } diff --git a/eeschema/protos.h b/eeschema/protos.h index bab205d2ab..9006c30a47 100644 --- a/eeschema/protos.h +++ b/eeschema/protos.h @@ -9,16 +9,15 @@ #include -class EDA_BaseStruct; +class EDA_ITEM; class WinEDA_DrawPanel; class WinEDA_DrawFrame; -class WinEDA_SchematicFrame; +class SCH_EDIT_FRAME; class LIB_EDIT_FRAME; class CMP_LIBRARY; class LIB_COMPONENT; class LIB_DRAW_ITEM; class SCH_COMPONENT; -class BASE_SCREEN; class SCH_SCREEN; class SCH_ITEM; class SCH_SHEET_PIN; @@ -51,7 +50,7 @@ void IncrementLabelMember( wxString& name ); /****************/ /* 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, int OrigY, @@ -118,7 +117,7 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct, bool aClone = false ); SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen ); /* Find the item within block selection. */ -int PickItemsInBlock( BLOCK_SELECTOR& aBlock, BASE_SCREEN* screen ); +int PickItemsInBlock( BLOCK_SELECTOR& aBlock, SCH_SCREEN* screen ); /* function PickStruct: * 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. * 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 ); @@ -212,7 +211,7 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* drawlist ); void DeleteSubHierarchy( SCH_SHEET* Sheet, 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 ..) */ @@ -220,7 +219,7 @@ bool ClearProjectDrawList( SCH_SCREEN* FirstWindow, bool confirm_deletion ); /* 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 DeleteAllMarkers( int type ); @@ -301,12 +300,12 @@ void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint ); /* EECLASS.CPP */ /**************/ -void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ); +void SetaParent( SCH_ITEM* Struct, SCH_SCREEN* Screen ); /***************/ /* OPTIONS.CPP */ /***************/ -void DisplayOptionFrame( WinEDA_SchematicFrame* parent, const wxPoint& framepos ); +void DisplayOptionFrame( SCH_EDIT_FRAME* parent, const wxPoint& framepos ); /****************/ /* CONTROLE.CPP */ diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index c0a40639c9..0c03c5cc38 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -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 */ if( g_ItemToUndoCopy @@ -1458,8 +1458,7 @@ void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame ) frame->ClearMsgPanel(); - frame->AppendMsgPanel( _( "Reference" ), - GetRef( ( (WinEDA_SchematicFrame*) frame )->GetSheet() ), + frame->AppendMsgPanel( _( "Reference" ), GetRef( ( (SCH_EDIT_FRAME*) frame )->GetSheet() ), DARKCYAN ); if( root_component->IsPower() ) diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index 7ec964cd3d..bf491f2c34 100644 --- a/eeschema/sch_component.h +++ b/eeschema/sch_component.h @@ -293,7 +293,7 @@ public: 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. wxString GetPath( SCH_SHEET_PATH* sheet ); diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 22f619ffa5..094d8ce13c 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -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; LIB_COMPONENT* Entry; diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h index 6a9407119e..dfb4b3f4a1 100644 --- a/eeschema/sch_field.h +++ b/eeschema/sch_field.h @@ -19,7 +19,7 @@ #include "general.h" -class WinEDA_SchematicFrame; +class SCH_EDIT_FRAME; class SCH_COMPONENT; 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; diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index f817276c14..715c320ecc 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -19,7 +19,7 @@ #include -void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) +void SetaParent( SCH_ITEM* Struct, SCH_SCREEN* Screen ) { switch( Struct->Type() ) { @@ -85,7 +85,7 @@ SCH_SCREEN::SCH_SCREEN( KICAD_T type ) : BASE_SCREEN( type ) { size_t i; - EEDrawList = NULL; /* Schematic items list */ + SetDrawItems( NULL ); /* Schematic items list */ m_Zoom = 32; for( i = 0; i < SCHEMATIC_ZOOM_LIST_CNT; i++ ) @@ -114,27 +114,30 @@ void SCH_SCREEN::FreeDrawList() { SCH_ITEM* DrawStruct; - while( EEDrawList != NULL ) + while( GetDrawItems() != NULL ) { - DrawStruct = EEDrawList; - EEDrawList = EEDrawList->Next(); + DrawStruct = GetDrawItems(); + SetDrawItems( GetDrawItems()->Next() ); 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 */ void SCH_SCREEN::RemoveFromDrawList( SCH_ITEM * DrawStruct ) { - if( DrawStruct == EEDrawList ) - EEDrawList = EEDrawList->Next(); + if( DrawStruct == GetDrawItems() ) + { + SetDrawItems( GetDrawItems()->Next() ); + } else { - EDA_BaseStruct* DrawList = EEDrawList; + EDA_ITEM* DrawList = GetDrawItems(); + while( DrawList && DrawList->Next() ) { if( DrawList->Next() == DrawStruct ) @@ -150,7 +153,7 @@ void SCH_SCREEN::RemoveFromDrawList( SCH_ITEM * DrawStruct ) bool SCH_SCREEN::CheckIfOnDrawList( SCH_ITEM* st ) { - SCH_ITEM * DrawList = EEDrawList; + SCH_ITEM * DrawList = GetDrawItems(); while( DrawList ) { @@ -165,15 +168,15 @@ bool SCH_SCREEN::CheckIfOnDrawList( SCH_ITEM* st ) void SCH_SCREEN::AddToDrawList( SCH_ITEM* st ) { - st->SetNext( EEDrawList ); - EEDrawList = st; + st->SetNext( GetDrawItems() ); + SetDrawItems( st ); } /* 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 * 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 * can handle pointers on wires or bus, and we do not delete wires or bus, * 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; - for( item = EEDrawList; item != NULL; item = next_item ) + for( item = GetDrawItems(); item != NULL; item = next_item ) { next_item = item->Next(); @@ -196,14 +199,16 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy ) RemoveFromDrawList( item ); item->SetNext( List ); List = item; + if( CreateCopy ) { if( item->Type() == DRAW_JUNCTION_STRUCT_TYPE ) new_item = ( (SCH_JUNCTION*) item )->GenCopy(); else new_item = ( (SCH_LINE*) item )->GenCopy(); - new_item->SetNext( EEDrawList ); - EEDrawList = new_item; + + new_item->SetNext( GetDrawItems() ); + SetDrawItems( new_item ); } break; @@ -225,12 +230,14 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC ) SCH_ITEM* DrawList, * TstDrawList; bool Modify = FALSE; - DrawList = EEDrawList; + DrawList = GetDrawItems(); + for( ; DrawList != NULL; DrawList = DrawList->Next() ) { if( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE ) { TstDrawList = DrawList->Next(); + while( TstDrawList ) { if( TstDrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE ) @@ -244,7 +251,7 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC ) DrawList->m_Flags |= TstDrawList->m_Flags; EraseStruct( TstDrawList, this ); SetRefreshReq(); - TstDrawList = EEDrawList; + TstDrawList = GetDrawItems(); Modify = TRUE; } else @@ -260,9 +267,9 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC ) } } - WinEDA_SchematicFrame* frame; - frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow(); - frame->TestDanglingEnds( EEDrawList, DC ); + SCH_EDIT_FRAME* frame; + frame = (SCH_EDIT_FRAME*) wxGetApp().GetTopWindow(); + frame->TestDanglingEnds( GetDrawItems(), DC ); return Modify; } @@ -313,7 +320,7 @@ bool SCH_SCREEN::Save( FILE* aFile ) const || fprintf( aFile, "$EndDescr\n" ) < 0 ) return FALSE; - for( SCH_ITEM* item = EEDrawList; item; item = item->Next() ) + for( SCH_ITEM* item = GetDrawItems(); item; item = item->Next() ) { if( !item->Save( aFile ) ) return FALSE; @@ -344,8 +351,10 @@ void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount return; unsigned icnt = aList.m_CommandsList.size(); + if( aItemCount > 0 ) icnt = aItemCount; + for( unsigned ii = 0; ii < icnt; ii++ ) { if( aList.m_CommandsList.size() == 0 ) @@ -362,7 +371,7 @@ void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount 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; } @@ -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 ) { SCH_SHEET* ds = (SCH_SHEET*) aItem; aItem = ds->m_AssociatedScreen; } + if( aItem && aItem->Type() == SCREEN_STRUCT_TYPE ) { SCH_SCREEN* screen = (SCH_SCREEN*) aItem; AddScreenToList( screen ); - EDA_BaseStruct* strct = screen->EEDrawList; + EDA_ITEM* strct = screen->GetDrawItems(); + while( strct ) { if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) { BuildScreenList( strct ); } + strct = strct->Next(); } } diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index bf28709725..5482ab9787 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -111,7 +111,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg ) 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), // a duplicate of the sheet is added to m_SubSheet array. // 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 - * The linked data itself (EEDrawList) is not duplicated + * The linked data itself (GetDrawItems()) is not duplicated */ SCH_SHEET* SCH_SHEET::GenCopy() { @@ -372,8 +372,8 @@ bool SCH_SHEET::HasUndefinedLabels() BOOST_FOREACH( SCH_SHEET_PIN label, m_labels ) { /* Search the schematic for a hierarchical label corresponding to this sheet label. */ - EDA_BaseStruct* DrawStruct = m_AssociatedScreen->EEDrawList; - SCH_HIERLABEL* HLabel = NULL; + EDA_ITEM* DrawStruct = m_AssociatedScreen->GetDrawItems(); + SCH_HIERLABEL* HLabel = NULL; 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. */ 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 ) { frame->SetSheetNumberAndCount(); @@ -448,8 +449,8 @@ void SCH_SHEET::CleanupSheet() while( i != m_labels.end() ) { /* Search the schematic for a hierarchical label corresponding to this sheet label. */ - EDA_BaseStruct* DrawStruct = m_AssociatedScreen->EEDrawList; - SCH_HIERLABEL* HLabel = NULL; + EDA_ITEM* DrawStruct = m_AssociatedScreen->GetDrawItems(); + SCH_HIERLABEL* HLabel = NULL; for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() ) { @@ -656,12 +657,14 @@ int SCH_SHEET::ComponentCount() if( m_AssociatedScreen ) { - EDA_BaseStruct* bs; - for( bs = m_AssociatedScreen->EEDrawList; bs != NULL; bs = bs->Next() ) + EDA_ITEM* bs; + + for( bs = m_AssociatedScreen->GetDrawItems(); bs != NULL; bs = bs->Next() ) { if( bs->Type() == TYPE_SCH_COMPONENT ) { SCH_COMPONENT* Cmp = (SCH_COMPONENT*) bs; + if( Cmp->GetField( VALUE )->m_Text.GetChar( 0 ) != '#' ) n++; } @@ -688,7 +691,8 @@ bool SCH_SHEET::SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen ) { if( m_AssociatedScreen ) { - EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList; + EDA_ITEM* strct = m_AssociatedScreen->GetDrawItems(); + while( strct ) { 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 ) { aList->Push( this ); + if( m_AssociatedScreen == aScreen ) return true; - EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList; + + EDA_ITEM* strct = m_AssociatedScreen->GetDrawItems(); + while( strct ) { if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) { SCH_SHEET* ss = (SCH_SHEET*) strct; + if( ss->LocatePathOfScreen( aScreen, aList ) ) return true; } + 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. * m_AssociatedScreen point on the screen, and its m_RefCount is incremented * 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 */ -bool SCH_SHEET::Load( WinEDA_SchematicFrame* aFrame ) +bool SCH_SHEET::Load( SCH_EDIT_FRAME* aFrame ) { bool success = true; @@ -777,17 +786,21 @@ bool SCH_SHEET::Load( WinEDA_SchematicFrame* aFrame ) m_AssociatedScreen = new SCH_SCREEN(); m_AssociatedScreen->m_RefCount++; success = aFrame->LoadOneEEFile( m_AssociatedScreen, m_FileName ); + if( success ) { - EDA_BaseStruct* bs = m_AssociatedScreen->EEDrawList; + EDA_ITEM* bs = m_AssociatedScreen->GetDrawItems(); + while( bs ) { if( bs->Type() == DRAW_SHEET_STRUCT_TYPE ) { SCH_SHEET* sheetstruct = (SCH_SHEET*) bs; + if( !sheetstruct->Load( aFrame ) ) success = false; } + bs = bs->Next(); } } @@ -810,7 +823,8 @@ int SCH_SHEET::CountSheets() if( m_AssociatedScreen ) { - EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList; + EDA_ITEM* strct = m_AssociatedScreen->GetDrawItems(); + for( ; strct; strct = strct->Next() ) { if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) @@ -841,8 +855,7 @@ wxString SCH_SHEET::GetFileName( void ) * @param aFileName = the new filename * @param aFrame = the schematic frame */ -bool SCH_SHEET::ChangeFileName( WinEDA_SchematicFrame* aFrame, - const wxString& aFileName ) +bool SCH_SHEET::ChangeFileName( SCH_EDIT_FRAME* aFrame, const wxString& aFileName ) { if( ( GetFileName() == aFileName ) && m_AssociatedScreen ) return true; diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index 7e00c4c68b..f1c375024a 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -16,7 +16,7 @@ class SCH_SHEET; class SCH_SHEET_PIN; class SCH_SHEET_PATH; 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; } - 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 * as this shape is already handled as HIERLABEL ... @@ -259,7 +259,7 @@ public: */ 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(); void DisplayInfo( WinEDA_DrawFrame* frame ); @@ -379,11 +379,11 @@ public: * m_AssociatedScreen point on the screen, and its m_RefCount is * incremented * 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 * @return true if OK */ - bool Load( WinEDA_SchematicFrame* aFrame ); + bool Load( SCH_EDIT_FRAME* aFrame ); /** * Function SearchHierarchy @@ -442,8 +442,7 @@ public: * @param aFileName = the new filename * @param aFrame = the schematic frame */ - bool ChangeFileName( WinEDA_SchematicFrame* aFrame, - const wxString& aFileName ); + bool ChangeFileName( SCH_EDIT_FRAME* aFrame, const wxString& aFileName ); //void RemoveSheet(SCH_SHEET* sheet); //to remove a sheet, just delete it diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp index b90bbb4742..260e99c004 100644 --- a/eeschema/sch_sheet_path.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -136,8 +136,10 @@ SCH_SCREEN* SCH_SHEET_PATH::LastScreen() SCH_ITEM* SCH_SHEET_PATH::LastDrawList() { SCH_SHEET* lastSheet = Last(); + if( lastSheet && lastSheet->m_AssociatedScreen ) - return lastSheet->m_AssociatedScreen->EEDrawList; + return lastSheet->m_AssociatedScreen->GetDrawItems(); + return NULL; } @@ -147,10 +149,10 @@ SCH_ITEM* SCH_SHEET_PATH::FirstDrawList() SCH_ITEM* item = NULL; 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 - * 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. */ SCH_ITEM* lastItem = NULL; @@ -253,7 +255,7 @@ wxString SCH_SHEET_PATH::PathHumanReadable() const void SCH_SHEET_PATH::UpdateAllScreenReferences() { - EDA_BaseStruct* t = LastDrawList(); + EDA_ITEM* t = LastDrawList(); while( t ) { @@ -530,7 +532,8 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet ) if( aSheet->m_AssociatedScreen != NULL ) { - EDA_BaseStruct* strct = m_currList.LastDrawList(); + EDA_ITEM* strct = m_currList.LastDrawList(); + while( strct ) { if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 1b7855abdc..adc0fd53ef 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -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 */ if( g_ItemToUndoCopy && ( (m_Flags & IS_NEW) == 0 ) ) diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index eb6cbdd951..20c2794238 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -114,7 +114,7 @@ public: } void SwapData( SCH_TEXT* copyitem ); - void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); + void Place( SCH_EDIT_FRAME* frame, wxDC* DC ); /** * Function HitTest diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index 00fee893fe..b095c7976b 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -23,7 +23,7 @@ #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(); wxPoint pos; @@ -125,8 +125,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_CANCEL_CURRENT_COMMAND: if( screen->m_BlockLocate.m_Command != BLOCK_IDLE ) DrawPanel->SetCursor( wxCursor( DrawPanel->m_PanelCursor = - DrawPanel-> - m_PanelDefaultCursor ) ); + DrawPanel->m_PanelDefaultCursor ) ); // Stop the current command (if any) but keep the current tool DrawPanel->UnManageCursor(); @@ -150,8 +149,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) default: // Stop the current command and deselect the current tool - DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor = - wxCURSOR_ARROW; + DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor = wxCURSOR_ARROW; DrawPanel->UnManageCursor( 0, DrawPanel->m_PanelCursor ); break; } @@ -279,26 +277,22 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL: DrawPanel->MouseToCursorSchema(); - ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), - &dc, TYPE_SCH_LABEL ); + ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_LABEL ); break; case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL: DrawPanel->MouseToCursorSchema(); - ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), - &dc, TYPE_SCH_GLOBALLABEL ); + ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_GLOBALLABEL ); break; case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL: DrawPanel->MouseToCursorSchema(); - ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), - &dc, TYPE_SCH_HIERLABEL ); + ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_HIERLABEL ); break; case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT: DrawPanel->MouseToCursorSchema(); - ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), - &dc, TYPE_SCH_TEXT ); + ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, TYPE_SCH_TEXT ); break; 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 ); screen->SetCurItem( NULL ); g_ItemToRepeat = NULL; - TestDanglingEnds( screen->EEDrawList, &dc ); + TestDanglingEnds( screen->GetDrawItems(), &dc ); DrawPanel->Refresh(); break; @@ -330,9 +324,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) DrawPanel->MouseToCursorSchema(); SCH_ITEM* oldWiresList = screen->ExtractWires( true ); BreakSegment( screen, screen->m_Curseur ); + if( oldWiresList ) SaveCopyInUndoList( oldWiresList, UR_WIRE_IMAGE ); - TestDanglingEnds( screen->EEDrawList, &dc ); + + TestDanglingEnds( screen->GetDrawItems(), &dc ); } break; @@ -348,13 +344,14 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_DELETE: { SCH_ITEM* item = screen->GetCurItem(); + if( item == NULL ) break; DeleteStruct( DrawPanel, &dc, item ); screen->SetCurItem( NULL ); g_ItemToRepeat = NULL; - TestDanglingEnds( screen->EEDrawList, &dc ); + TestDanglingEnds( screen->GetDrawItems(), &dc ); SetSheetNumberAndCount(); OnModify(); } @@ -372,7 +369,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_RESIZE_SHEET: DrawPanel->MouseToCursorSchema(); ReSizeSheet( (SCH_SHEET*) screen->GetCurItem(), &dc ); - TestDanglingEnds( screen->EEDrawList, &dc ); + TestDanglingEnds( screen->GetDrawItems(), &dc ); break; case ID_POPUP_SCH_EDIT_SHEET: @@ -393,7 +390,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) if( !sheet->HasUndefinedLabels() ) { DisplayInfoMessage( this, - _( "There are no undefined labels in this sheet to clean up." ) ); + _( "There are no undefined labels in this sheet to clean up." ) ); return; } @@ -429,20 +426,21 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) && (screen->GetCurItem()->Type() != TYPE_SCH_HIERLABEL) && (screen->GetCurItem()->Type() != DRAW_SHEET_STRUCT_TYPE) ) screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; // fall through case ID_POPUP_SCH_MOVE_ITEM_REQUEST: DrawPanel->MouseToCursorSchema(); + if( id == ID_POPUP_SCH_DRAG_CMP_REQUEST ) { // The easiest way to handle a drag component or sheet command // is to simulate a block drag command if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK ) { - if( !HandleBlockBegin( &dc, BLOCK_DRAG, - screen->m_Curseur ) ) + if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->m_Curseur ) ) break; // Give a non null size to the search block: @@ -461,8 +459,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) // block drag command if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK ) { - if( !HandleBlockBegin( &dc, BLOCK_DRAG, - screen->m_Curseur ) ) + if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->m_Curseur ) ) break; // 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 // TODO: a better way to drag only wires SCH_LINE* segm = (SCH_LINE*) screen->GetCurItem(); + if( !screen->m_BlockLocate.Inside( segm->m_Start ) && !screen->m_BlockLocate.Inside( segm->m_End ) ) { screen->m_BlockLocate.SetOrigin( segm->m_Start ); screen->m_BlockLocate.SetEnd( segm->m_End ); } + HandleBlockEnd( &dc ); } break; @@ -490,10 +489,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) // component, like Field, text..) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; - InstallCmpeditFrame( this, pos, - (SCH_COMPONENT*) screen->GetCurItem() ); + + InstallCmpeditFrame( this, pos, (SCH_COMPONENT*) screen->GetCurItem() ); break; case ID_POPUP_SCH_MIROR_X_CMP: @@ -506,6 +506,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) // component, like Field, text..) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; { @@ -531,12 +532,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) } DrawPanel->MouseToCursorSchema(); - if( screen->GetCurItem()->m_Flags == 0 ) - SaveCopyInUndoList( (SCH_ITEM*) screen->GetCurItem(), - UR_CHANGED ); - CmpRotationMiroir( (SCH_COMPONENT*) screen->GetCurItem(), - &dc, option ); + if( screen->GetCurItem()->m_Flags == 0 ) + SaveCopyInUndoList( (SCH_ITEM*) screen->GetCurItem(), UR_CHANGED ); + + CmpRotationMiroir( (SCH_COMPONENT*) screen->GetCurItem(), &dc, option ); break; } @@ -550,11 +550,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) // component, like Field, text..) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; - EditComponentValue( - (SCH_COMPONENT*) screen->GetCurItem(), &dc ); + EditComponentValue( (SCH_COMPONENT*) screen->GetCurItem(), &dc ); break; case ID_POPUP_SCH_EDIT_REF_CMP: @@ -563,6 +563,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) // component, like Field, text..) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; @@ -575,8 +576,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) // component, like Field, text..) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; + EditComponentFootprint( (SCH_COMPONENT*) screen->GetCurItem(), &dc ); break; @@ -587,12 +590,12 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) // component, like Field, text..) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; + DrawPanel->MouseToCursorSchema(); - ConvertPart( - (SCH_COMPONENT*) screen->GetCurItem(), - &dc ); + ConvertPart( (SCH_COMPONENT*) screen->GetCurItem(), &dc ); break; case ID_POPUP_SCH_SELECT_UNIT1: @@ -626,11 +629,13 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) // component, like Field, text..) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; + DrawPanel->MouseToCursorSchema(); SelPartUnit( (SCH_COMPONENT*) screen->GetCurItem(), - id + 1 - ID_POPUP_SCH_SELECT_UNIT1, &dc ); + id + 1 - ID_POPUP_SCH_SELECT_UNIT1, &dc ); break; case ID_POPUP_SCH_DISPLAYDOC_CMP: @@ -639,6 +644,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) // component, like Field, text..) if( screen->GetCurItem()->Type() != TYPE_SCH_COMPONENT ) screen->SetCurItem( LocateSmallestComponent( screen ) ); + if( screen->GetCurItem() == NULL ) break; { @@ -656,7 +662,8 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_ENTER_SHEET: { - EDA_BaseStruct* DrawStruct = screen->GetCurItem(); + EDA_ITEM* DrawStruct = screen->GetCurItem(); + if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) ) { InstallNextScreen( (SCH_SHEET*) DrawStruct ); @@ -719,35 +726,31 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_ADD_JUNCTION: DrawPanel->MouseToCursorSchema(); - screen->SetCurItem( CreateNewJunctionStruct( &dc, screen->m_Curseur, - true ) ); - TestDanglingEnds( screen->EEDrawList, &dc ); + screen->SetCurItem( CreateNewJunctionStruct( &dc, screen->m_Curseur, true ) ); + TestDanglingEnds( screen->GetDrawItems(), &dc ); screen->SetCurItem( NULL ); break; case ID_POPUP_SCH_ADD_LABEL: case ID_POPUP_SCH_ADD_GLABEL: - screen->SetCurItem( - CreateNewText( &dc, - id == ID_POPUP_SCH_ADD_LABEL ? - LAYER_LOCLABEL : LAYER_GLOBLABEL ) ); + screen->SetCurItem( CreateNewText( &dc, id == ID_POPUP_SCH_ADD_LABEL ? + LAYER_LOCLABEL : LAYER_GLOBLABEL ) ); if( screen->GetCurItem() ) { ( (SCH_ITEM*) screen->GetCurItem() )->Place( this, &dc ); - TestDanglingEnds( screen->EEDrawList, &dc ); + TestDanglingEnds( screen->GetDrawItems(), &dc ); screen->SetCurItem( NULL ); } break; case ID_POPUP_SCH_GETINFO_MARKER: - if( screen->GetCurItem() - && screen->GetCurItem()->Type() == TYPE_SCH_MARKER ) + if( screen->GetCurItem() && screen->GetCurItem()->Type() == TYPE_SCH_MARKER ) ( (SCH_MARKER*) screen->GetCurItem() )->DisplayMarkerInfo( this ); + break; default: // Log error: - DisplayError( this, - wxT( "WinEDA_SchematicFrame::Process_Special_Functions error" ) ); + DisplayError( this, wxT( "SCH_EDIT_FRAME::Process_Special_Functions error" ) ); break; } @@ -755,11 +758,12 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) if( m_ID_current_state == 0 ) g_ItemToRepeat = NULL; + 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 ) return; @@ -804,9 +808,8 @@ void WinEDA_SchematicFrame::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC ) case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: default: wxString msg; - msg.Printf( - wxT( "WinEDA_SchematicFrame::Move_Item Error: Bad DrawType %d" ), - DrawStruct->Type() ); + msg.Printf( wxT( "SCH_EDIT_FRAME::Move_Item Error: Bad DrawType %d" ), + DrawStruct->Type() ); DisplayError( this, msg ); break; } diff --git a/eeschema/schematic_undo_redo.cpp b/eeschema/schematic_undo_redo.cpp index 605d617dd5..de1ce2e724 100644 --- a/eeschema/schematic_undo_redo.cpp +++ b/eeschema/schematic_undo_redo.cpp @@ -52,7 +52,7 @@ * * Redo 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 * => 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 * 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 ) { @@ -195,8 +195,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage ) * UR_MOVED * * 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 - * sub-hierarchy will be deleted. If it is only a copy, 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 GetDrawItems() and the * sub-hierarchy must NOT be deleted. * * Note: @@ -207,9 +207,9 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage ) * wires saved in Undo List (for Undo or Redo commands, saved wires will be * exchanged with current wire list */ -void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* aItem, - UndoRedoOpType aCommandType, - const wxPoint& aTransformPoint ) +void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem, + UndoRedoOpType aCommandType, + const wxPoint& aTransformPoint ) { /* Does not save a null item. * but if aCommandType == UR_WIRE_IMAGE, we must save null item. @@ -225,6 +225,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* aItem, commandToUndo->m_TransformPoint = aTransformPoint; ITEM_PICKER itemWrapper( aItem, aCommandType ); + if( aItem ) { itemWrapper.m_PickedItemType = aItem->Type(); @@ -275,9 +276,9 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* aItem, * @param aItemsList = a PICKED_ITEMS_LIST of items to save * @param aTypeCommand = type of command ( UR_CHANGED, UR_NEW, UR_DELETED ... */ -void WinEDA_SchematicFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, - UndoRedoOpType aTypeCommand, - const wxPoint& aTransformPoint ) +void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, + UndoRedoOpType aTypeCommand, + const wxPoint& aTransformPoint ) { PICKED_ITEMS_LIST* commandToUndo = new PICKED_ITEMS_LIST(); @@ -323,8 +324,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, default: { wxString msg; - msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), - command ); + msg.Printf( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), command ); wxMessageBox( msg ); } 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 aRedoCommand = a bool: true for redo, false for undo */ -void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, - bool aRedoCommand ) +void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand ) { SCH_ITEM* 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 */ aList->SetPickedItemStatus( UR_NEW, ii ); - item->SetNext( GetScreen()->EEDrawList ); - GetScreen()->EEDrawList = item; + item->SetNext( GetScreen()->GetDrawItems() ); + GetScreen()->SetDrawItems( item ); break; case UR_MOVED: @@ -422,8 +421,8 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, while( item ) { SCH_ITEM* nextitem = item->Next(); - item->SetNext( GetScreen()->EEDrawList ); - GetScreen()->EEDrawList = item; + item->SetNext( GetScreen()->GetDrawItems() ); + GetScreen()->SetDrawItems( item ); item->m_Flags = 0; item = nextitem; } @@ -450,7 +449,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, * - Get the previous version of the schematic from undo list * @return none */ -void WinEDA_SchematicFrame::GetSchematicFromUndoList( wxCommandEvent& event ) +void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event ) { if( GetScreen()->GetUndoCommandCount() <= 0 ) return; @@ -471,7 +470,7 @@ void WinEDA_SchematicFrame::GetSchematicFromUndoList( wxCommandEvent& event ) ReCreateHToolbar(); SetToolbars(); - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); DrawPanel->Refresh(); } @@ -483,7 +482,7 @@ void WinEDA_SchematicFrame::GetSchematicFromUndoList( wxCommandEvent& event ) * - Get the previous version from Redo list * @return none */ -void WinEDA_SchematicFrame::GetSchematicFromRedoList( wxCommandEvent& event ) +void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event ) { if( GetScreen()->GetRedoCommandCount() == 0 ) return; @@ -505,6 +504,6 @@ void WinEDA_SchematicFrame::GetSchematicFromRedoList( wxCommandEvent& event ) ReCreateHToolbar(); SetToolbars(); - TestDanglingEnds( GetScreen()->EEDrawList, NULL ); + TestDanglingEnds( GetScreen()->GetDrawItems(), NULL ); DrawPanel->Refresh(); } diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 3946216700..82316c3025 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -38,119 +38,118 @@ #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, WinEDA_DrawFrame::OnSockRequest ) - EVT_CLOSE( WinEDA_SchematicFrame::OnCloseWindow ) - EVT_SIZE( WinEDA_SchematicFrame::OnSize ) + EVT_CLOSE( SCH_EDIT_FRAME::OnCloseWindow ) + EVT_SIZE( SCH_EDIT_FRAME::OnSize ) - EVT_MENU( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject ) - EVT_MENU( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject ) + EVT_MENU( ID_NEW_PROJECT, SCH_EDIT_FRAME::OnNewProject ) + 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_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject ) + EVT_TOOL( ID_NEW_PROJECT, SCH_EDIT_FRAME::OnNewProject ) + EVT_TOOL( ID_LOAD_PROJECT, SCH_EDIT_FRAME::OnLoadProject ) - EVT_MENU( ID_SAVE_PROJECT, WinEDA_SchematicFrame::Save_File ) - EVT_MENU( ID_SAVE_ONE_SHEET, WinEDA_SchematicFrame::Save_File ) - EVT_MENU( ID_SAVE_ONE_SHEET_AS, WinEDA_SchematicFrame::Save_File ) - EVT_TOOL( ID_SAVE_PROJECT, WinEDA_SchematicFrame::Save_File ) - EVT_MENU( wxID_PRINT, WinEDA_SchematicFrame::OnPrint ) - EVT_MENU( ID_GEN_PLOT_PS, WinEDA_SchematicFrame::ToPlot_PS ) - EVT_MENU( ID_GEN_PLOT_HPGL, WinEDA_SchematicFrame::ToPlot_HPGL ) - EVT_MENU( ID_GEN_PLOT_SVG, WinEDA_SchematicFrame::SVG_Print ) - EVT_MENU( ID_GEN_PLOT_DXF, WinEDA_SchematicFrame::ToPlot_DXF ) + EVT_MENU( ID_SAVE_PROJECT, SCH_EDIT_FRAME::Save_File ) + EVT_MENU( ID_SAVE_ONE_SHEET, SCH_EDIT_FRAME::Save_File ) + EVT_MENU( ID_SAVE_ONE_SHEET_AS, SCH_EDIT_FRAME::Save_File ) + EVT_TOOL( ID_SAVE_PROJECT, SCH_EDIT_FRAME::Save_File ) + EVT_MENU( wxID_PRINT, SCH_EDIT_FRAME::OnPrint ) + EVT_MENU( ID_GEN_PLOT_PS, SCH_EDIT_FRAME::ToPlot_PS ) + EVT_MENU( ID_GEN_PLOT_HPGL, SCH_EDIT_FRAME::ToPlot_HPGL ) + EVT_MENU( ID_GEN_PLOT_SVG, SCH_EDIT_FRAME::SVG_Print ) + 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_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_SAVE, WinEDA_SchematicFrame::Process_Config ) - EVT_MENU( ID_CONFIG_READ, WinEDA_SchematicFrame::Process_Config ) + EVT_MENU( ID_CONFIG_REQ, SCH_EDIT_FRAME::InstallConfigFrame ) + EVT_MENU( ID_CONFIG_SAVE, SCH_EDIT_FRAME::Process_Config ) + EVT_MENU( ID_CONFIG_READ, SCH_EDIT_FRAME::Process_Config ) EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, - WinEDA_SchematicFrame::Process_Config ) + SCH_EDIT_FRAME::Process_Config ) - EVT_MENU( ID_COLORS_SETUP, WinEDA_SchematicFrame::OnColorConfig ) - EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_SchematicFrame::OnSetOptions ) + EVT_MENU( ID_COLORS_SETUP, SCH_EDIT_FRAME::OnColorConfig ) + EVT_TOOL( ID_OPTIONS_SETUP, SCH_EDIT_FRAME::OnSetOptions ) - EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, - WinEDA_SchematicFrame::SetLanguage ) + EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, SCH_EDIT_FRAME::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_LIBVIEW, WinEDA_SchematicFrame::OnOpenLibraryViewer ) + EVT_TOOL( ID_TO_LIBRARY, SCH_EDIT_FRAME::OnOpenLibraryEditor ) + EVT_TOOL( ID_TO_LIBVIEW, SCH_EDIT_FRAME::OnOpenLibraryViewer ) - EVT_TOOL( ID_TO_PCB, WinEDA_SchematicFrame::OnOpenPcbnew ) - EVT_TOOL( ID_TO_CVPCB, WinEDA_SchematicFrame::OnOpenCvpcb ) + EVT_TOOL( ID_TO_PCB, SCH_EDIT_FRAME::OnOpenPcbnew ) + EVT_TOOL( ID_TO_CVPCB, SCH_EDIT_FRAME::OnOpenCvpcb ) EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings ) - EVT_TOOL( ID_HIERARCHY, WinEDA_SchematicFrame::Process_Special_Functions ) - EVT_TOOL( wxID_CUT, WinEDA_SchematicFrame::Process_Special_Functions ) - EVT_TOOL( wxID_COPY, WinEDA_SchematicFrame::Process_Special_Functions ) - EVT_TOOL( wxID_PASTE, WinEDA_SchematicFrame::Process_Special_Functions ) - EVT_TOOL( wxID_UNDO, WinEDA_SchematicFrame::GetSchematicFromUndoList ) - EVT_TOOL( wxID_REDO, WinEDA_SchematicFrame::GetSchematicFromRedoList ) - EVT_TOOL( ID_GET_ANNOTATE, WinEDA_SchematicFrame::OnAnnotate ) - EVT_TOOL( wxID_PRINT, WinEDA_SchematicFrame::OnPrint ) - EVT_TOOL( ID_GET_ERC, WinEDA_SchematicFrame::OnErc ) - EVT_TOOL( ID_GET_NETLIST, WinEDA_SchematicFrame::OnCreateNetlist ) - EVT_TOOL( ID_GET_TOOLS, WinEDA_SchematicFrame::OnCreateBillOfMaterials ) - EVT_TOOL( ID_FIND_ITEMS, WinEDA_SchematicFrame::OnFindItems ) - EVT_TOOL( ID_BACKANNO_ITEMS, WinEDA_SchematicFrame::OnLoadStuffFile ) - EVT_TOOL( ID_COMPONENT_BUTT, WinEDA_SchematicFrame::Process_Special_Functions ) + EVT_TOOL( ID_HIERARCHY, SCH_EDIT_FRAME::Process_Special_Functions ) + EVT_TOOL( wxID_CUT, SCH_EDIT_FRAME::Process_Special_Functions ) + EVT_TOOL( wxID_COPY, SCH_EDIT_FRAME::Process_Special_Functions ) + EVT_TOOL( wxID_PASTE, SCH_EDIT_FRAME::Process_Special_Functions ) + EVT_TOOL( wxID_UNDO, SCH_EDIT_FRAME::GetSchematicFromUndoList ) + EVT_TOOL( wxID_REDO, SCH_EDIT_FRAME::GetSchematicFromRedoList ) + EVT_TOOL( ID_GET_ANNOTATE, SCH_EDIT_FRAME::OnAnnotate ) + EVT_TOOL( wxID_PRINT, SCH_EDIT_FRAME::OnPrint ) + EVT_TOOL( ID_GET_ERC, SCH_EDIT_FRAME::OnErc ) + EVT_TOOL( ID_GET_NETLIST, SCH_EDIT_FRAME::OnCreateNetlist ) + EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials ) + EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems ) + EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadStuffFile ) + EVT_TOOL( ID_COMPONENT_BUTT, SCH_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp ) EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout ) // 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, 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, - WinEDA_SchematicFrame::Process_Special_Functions ) + SCH_EDIT_FRAME::Process_Special_Functions ) // Tools and buttons options toolbar 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, - WinEDA_SchematicFrame::Process_Special_Functions ) + SCH_EDIT_FRAME::Process_Special_Functions ) /* Handle user interface update events. */ - EVT_UPDATE_UI( wxID_CUT, WinEDA_SchematicFrame::OnUpdateBlockSelected ) - EVT_UPDATE_UI( wxID_COPY, WinEDA_SchematicFrame::OnUpdateBlockSelected ) - EVT_UPDATE_UI( wxID_PASTE, WinEDA_SchematicFrame::OnUpdatePaste ) - EVT_UPDATE_UI( wxID_UNDO, WinEDA_SchematicFrame::OnUpdateSchematicUndo ) - EVT_UPDATE_UI( wxID_REDO, WinEDA_SchematicFrame::OnUpdateSchematicRedo ) - EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRID, WinEDA_SchematicFrame::OnUpdateGrid ) - EVT_UPDATE_UI( ID_TB_OPTIONS_SELECT_CURSOR, WinEDA_SchematicFrame::OnUpdateSelectCursor ) - EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, WinEDA_SchematicFrame::OnUpdateHiddenPins ) - EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, WinEDA_SchematicFrame::OnUpdateBusOrientation ) + EVT_UPDATE_UI( wxID_CUT, SCH_EDIT_FRAME::OnUpdateBlockSelected ) + EVT_UPDATE_UI( wxID_COPY, SCH_EDIT_FRAME::OnUpdateBlockSelected ) + EVT_UPDATE_UI( wxID_PASTE, SCH_EDIT_FRAME::OnUpdatePaste ) + EVT_UPDATE_UI( wxID_UNDO, SCH_EDIT_FRAME::OnUpdateSchematicUndo ) + EVT_UPDATE_UI( wxID_REDO, SCH_EDIT_FRAME::OnUpdateSchematicRedo ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRID, SCH_EDIT_FRAME::OnUpdateGrid ) + EVT_UPDATE_UI( ID_TB_OPTIONS_SELECT_CURSOR, SCH_EDIT_FRAME::OnUpdateSelectCursor ) + EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS, SCH_EDIT_FRAME::OnUpdateHiddenPins ) + EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT, SCH_EDIT_FRAME::OnUpdateBusOrientation ) EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH, - WinEDA_SchematicFrame::OnUpdateUnits ) + SCH_EDIT_FRAME::OnUpdateUnits ) /* Search dialog events. */ - EVT_FIND_CLOSE( wxID_ANY, WinEDA_SchematicFrame::OnFindDialogClose ) - EVT_FIND_DRC_MARKER( wxID_ANY, WinEDA_SchematicFrame::OnFindDrcMarker ) - EVT_FIND( wxID_ANY, WinEDA_SchematicFrame::OnFindSchematicItem ) + EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose ) + EVT_FIND_DRC_MARKER( wxID_ANY, SCH_EDIT_FRAME::OnFindDrcMarker ) + EVT_FIND( wxID_ANY, SCH_EDIT_FRAME::OnFindSchematicItem ) END_EVENT_TABLE() -WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - long style ) : +SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style ) : WinEDA_DrawFrame( father, SCHEMATIC_FRAME, title, pos, size, style ) { m_FrameName = wxT( "SchematicFrame" ); @@ -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( 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(); } -SCH_SHEET_PATH* WinEDA_SchematicFrame::GetSheet() +SCH_SHEET_PATH* SCH_EDIT_FRAME::GetSheet() { 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 * sheet */ -void WinEDA_SchematicFrame::SetSheetNumberAndCount() +void SCH_EDIT_FRAME::SetSheetNumberAndCount() { SCH_SCREEN* screen = GetScreen(); 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(); } -wxString WinEDA_SchematicFrame::GetScreenDesc() +wxString SCH_EDIT_FRAME::GetScreenDesc() { 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 ) { @@ -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; @@ -393,7 +392,7 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event ) } 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 ); 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; wxSize size; @@ -437,7 +436,7 @@ int WinEDA_SchematicFrame::BestZoom() * and has no extension. * However if filename is too long name is - */ -wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet() +wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet() { wxFileName fn = g_RootSheet->GetFileName(); @@ -472,7 +471,7 @@ wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet() * in order to set the "modify" flag of the current screen * and update the date in frame reference */ -void WinEDA_SchematicFrame::OnModify( ) +void SCH_EDIT_FRAME::OnModify( ) { GetScreen()->SetModify(); @@ -494,7 +493,7 @@ void WinEDA_SchematicFrame::OnModify( ) * conditions. *****************************************************************************/ -void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event ) +void SCH_EDIT_FRAME::OnUpdateBlockSelected( wxUpdateUIEvent& event ) { 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 ); m_HToolBar->EnableTool( wxID_PASTE, g_BlockSaveDataList.GetCount() > 0 ); } -void WinEDA_SchematicFrame::OnUpdateSchematicUndo( wxUpdateUIEvent& event ) +void SCH_EDIT_FRAME::OnUpdateSchematicUndo( wxUpdateUIEvent& event ) { if( GetScreen() ) event.Enable( GetScreen()->GetUndoCommandCount() > 0 ); } -void WinEDA_SchematicFrame::OnUpdateSchematicRedo( wxUpdateUIEvent& event ) +void SCH_EDIT_FRAME::OnUpdateSchematicRedo( wxUpdateUIEvent& event ) { if( GetScreen() ) event.Enable( GetScreen()->GetRedoCommandCount() > 0 ); } -void WinEDA_SchematicFrame::OnUpdateBusOrientation( wxUpdateUIEvent& event ) +void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& event ) { wxString tool_tip = g_HVLines ? _( "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" ) : _( "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 ); } -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_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" ); @@ -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 ); @@ -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 ); @@ -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; @@ -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 ); @@ -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, 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 ) { @@ -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; @@ -666,26 +665,26 @@ void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event ) } -void WinEDA_SchematicFrame::OnLoadStuffFile( wxCommandEvent& event ) +void SCH_EDIT_FRAME::OnLoadStuffFile( wxCommandEvent& event ) { ReadInputStuffFile(); DrawPanel->Refresh(); } -void WinEDA_SchematicFrame::OnNewProject( wxCommandEvent& event ) +void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event ) { LoadOneEEProject( wxEmptyString, true ); } -void WinEDA_SchematicFrame::OnLoadProject( wxCommandEvent& event ) +void SCH_EDIT_FRAME::OnLoadProject( wxCommandEvent& event ) { LoadOneEEProject( wxEmptyString, false ); } -void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event ) +void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event ) { 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; @@ -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 ) { @@ -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 ) { @@ -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 ); } @@ -758,7 +757,7 @@ void WinEDA_SchematicFrame::OnExit( wxCommandEvent& event ) * Function SetLanguage * called on a language menu selection */ -void WinEDA_SchematicFrame::SetLanguage( wxCommandEvent& event ) +void SCH_EDIT_FRAME::SetLanguage( wxCommandEvent& 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; 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. */ -void WinEDA_SchematicFrame::SVG_Print( wxCommandEvent& event ) +void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event ) { DIALOG_SVG_PRINT frame( this ); diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 03b226081c..896bc4a34b 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -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" */ -bool WinEDA_SchematicFrame::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) +bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) { bool edit = true; @@ -211,7 +211,7 @@ static void ExitSheet( WinEDA_DrawPanel* aPanel, wxDC* aDC ) /* Create hierarchy sheet. */ -SCH_SHEET* WinEDA_SchematicFrame::CreateSheet( wxDC* aDC ) +SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC ) { g_ItemToRepeat = NULL; SAFE_DELETE( g_ItemToUndoCopy ); @@ -225,7 +225,7 @@ SCH_SHEET* WinEDA_SchematicFrame::CreateSheet( wxDC* aDC ) s_PreviousSheetWidth = SHEET_MIN_WIDTH; 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 // a sheet to a screen that already has multiple instances (!) 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 ) return; if( aSheet->Type() != DRAW_SHEET_STRUCT_TYPE ) { - DisplayError( this, - wxT( "WinEDA_SchematicFrame::ReSizeSheet: Bad SructType" ) ); + DisplayError( this, wxT( "SCH_EDIT_FRAME::ReSizeSheet: Bad SructType" ) ); 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 ) ) return; diff --git a/eeschema/sheetlab.cpp b/eeschema/sheetlab.cpp index 66a192882b..10b7b21f0b 100644 --- a/eeschema/sheetlab.cpp +++ b/eeschema/sheetlab.cpp @@ -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(); @@ -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; 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 ) 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. */ -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; 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 * 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; - SCH_SHEET_PIN* NewSheetLabel; - SCH_HIERLABEL* HLabel = NULL; + EDA_ITEM* DrawStruct; + SCH_SHEET_PIN* NewSheetLabel; + SCH_HIERLABEL* HLabel = NULL; if( !Sheet->m_AssociatedScreen ) return NULL; - DrawStruct = Sheet->m_AssociatedScreen->EEDrawList; + DrawStruct = Sheet->m_AssociatedScreen->GetDrawItems(); HLabel = NULL; 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 * 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(); diff --git a/eeschema/tool_sch.cpp b/eeschema/tool_sch.cpp index 547f4e4d8c..ef5e78aca7 100644 --- a/eeschema/tool_sch.cpp +++ b/eeschema/tool_sch.cpp @@ -19,7 +19,7 @@ /* Create the main Horizontal Toolbar for the schematic editor */ -void WinEDA_SchematicFrame::ReCreateHToolbar() +void SCH_EDIT_FRAME::ReCreateHToolbar() { if( m_HToolBar != NULL ) return; @@ -141,7 +141,7 @@ void WinEDA_SchematicFrame::ReCreateHToolbar() /* Create Vertical Right Toolbar */ -void WinEDA_SchematicFrame::ReCreateVToolbar() +void SCH_EDIT_FRAME::ReCreateVToolbar() { if( m_VToolBar ) return; @@ -238,7 +238,7 @@ void WinEDA_SchematicFrame::ReCreateVToolbar() /* Create Vertical Left Toolbar (Option Toolbar) */ -void WinEDA_SchematicFrame::ReCreateOptToolbar() +void SCH_EDIT_FRAME::ReCreateOptToolbar() { if( m_OptionsToolBar ) 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 ) return; diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 96e94d18f3..6f5798ed6c 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -240,7 +240,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph 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; } diff --git a/gerbview/class_gerber_draw_item.cpp b/gerbview/class_gerber_draw_item.cpp index d5d0d7d89e..410abbc44b 100644 --- a/gerbview/class_gerber_draw_item.cpp +++ b/gerbview/class_gerber_draw_item.cpp @@ -336,11 +336,11 @@ void GERBER_DRAW_ITEM::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, int aDrawMode, if( aDrawMode & GR_SURBRILL ) { if( aDrawMode & GR_AND ) - color &= ~HIGHT_LIGHT_FLAG; + color &= ~HIGHLIGHT_FLAG; else - color |= HIGHT_LIGHT_FLAG; + color |= HIGHLIGHT_FLAG; } - if( color & HIGHT_LIGHT_FLAG ) + if( color & HIGHLIGHT_FLAG ) color = ColorRefs[color & MASKCOLOR].m_LightColor; alt_color = g_DrawBgColor; diff --git a/gerbview/class_gerber_draw_item.h b/gerbview/class_gerber_draw_item.h index 3035cde51c..b7d0c76edf 100644 --- a/gerbview/class_gerber_draw_item.h +++ b/gerbview/class_gerber_draw_item.h @@ -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. // list management is done on GERBER_DRAW_ITEMs using DLIST only. private: - void SetNext( EDA_BaseStruct* aNext ) { Pnext = aNext; } - void SetBack( EDA_BaseStruct* aBack ) { Pback = aBack; } + void SetNext( EDA_ITEM* aNext ) { Pnext = aNext; } + void SetBack( EDA_ITEM* aBack ) { Pback = aBack; } public: @@ -218,7 +218,7 @@ public: * Function DisplayInfo * has knowledge about the frame and how and where to put status information * 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 * @param frame A WinEDA_DrawFrame in which to print status information. */ diff --git a/gerbview/gerberframe.cpp b/gerbview/gerberframe.cpp index 3d2661eb18..896bccef79 100644 --- a/gerbview/gerberframe.cpp +++ b/gerbview/gerberframe.cpp @@ -158,8 +158,10 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father, wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); int pointSize = font.GetPointSize(); int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ); + if( screenHeight <= 900 ) pointSize = (pointSize * 8) / 10; + m_LayersManager = new GERBER_LAYER_WIDGET( this, DrawPanel, pointSize ); // LoadSettings() *after* creating m_LayersManager, because LoadSettings() @@ -202,7 +204,8 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father, m_auimgr.AddPane( m_VToolBar, 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 ) m_auimgr.AddPane( m_OptionsToolBar, @@ -249,12 +252,15 @@ int WinEDA_GerberFrame::BestZoom() EDA_Rect bbox; BOARD_ITEM* item = GetBoard()->m_Drawings; + for( ; item; item = item->Next() ) { GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item; 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(); x = bbox.GetWidth() / (double) size.x; y = bbox.GetHeight() / (double) size.y; @@ -264,9 +270,8 @@ int WinEDA_GerberFrame::BestZoom() return best_zoom; } -/**************************************/ + void WinEDA_GerberFrame::LoadSettings() -/**************************************/ { wxConfig* config = wxGetApp().m_EDA_Config; @@ -277,10 +282,14 @@ void WinEDA_GerberFrame::LoadSettings() long pageSize_opt; config->Read( GerbviewShowPageSizeOption, &pageSize_opt, 0l ); int imax = 0; + for( ; g_GerberPageSizeList[imax] != NULL; imax++ ); + if( pageSize_opt < 0 || pageSize_opt >= imax ) pageSize_opt = 0; + GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[pageSize_opt]; + if ( pageSize_opt > 0 ) { m_Draw_Sheet_Ref = true; @@ -291,9 +300,8 @@ void WinEDA_GerberFrame::LoadSettings() SetElementVisibility( DCODES_VISIBLE, tmp ); } -/**************************************/ + void WinEDA_GerberFrame::SaveSettings() -/**************************************/ { wxConfig* config = wxGetApp().m_EDA_Config; @@ -305,6 +313,7 @@ void WinEDA_GerberFrame::SaveSettings() wxRealPoint GridSize = GetScreen()->GetGridSize(); long pageSize_opt = 0; + if( m_Draw_Sheet_Ref ) { for( int ii = 1; g_GerberPageSizeList[ii] != NULL; ii++ ) @@ -341,6 +350,7 @@ void WinEDA_GerberFrame::ReFillLayerWidget() syncLayerWidget(); } + /** * Function IsGridVisible() , virtual * @return true if the grid must be shown @@ -350,17 +360,19 @@ bool WinEDA_GerberFrame::IsGridVisible() return IsElementVisible( GERBER_GRID_VISIBLE ); } + /** * Function SetGridVisibility() , virtual * It may be overloaded by derived classes * if you want to store/retrieve the grid visiblity in configuration. * @param aVisible = true if the grid must be shown */ -void WinEDA_GerberFrame::SetGridVisibility(bool aVisible) +void WinEDA_GerberFrame::SetGridVisibility( bool aVisible ) { - SetElementVisibility(GERBER_GRID_VISIBLE, aVisible); + SetElementVisibility( GERBER_GRID_VISIBLE, aVisible ); } + /** * Function GetGridColor() , virtual * @return the color of the grid @@ -370,6 +382,7 @@ int WinEDA_GerberFrame::GetGridColor() return GetBoard()->GetVisibleElementColor( GERBER_GRID_VISIBLE ); } + /** * Function SetGridColor() , virtual * @param aColor = the new color of the grid @@ -412,6 +425,7 @@ void WinEDA_GerberFrame::syncLayerBox() UpdateTitleAndInfo(); } + /** * Function SetLanguage * called on a language menu selection @@ -443,6 +457,7 @@ void WinEDA_GerberFrame::Liste_D_Codes( ) for( int layer = 0; layer < 32; layer++ ) { GERBER_IMAGE* gerber = g_GERBER_List[layer]; + if( gerber == NULL ) continue; @@ -453,19 +468,20 @@ void WinEDA_GerberFrame::Liste_D_Codes( ) Line.Printf( wxT( "*** Active layer (%2.2d) ***" ), layer + 1 ); else Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 ); + List->Append( Line ); for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ ) { pt_D_code = gerber->GetDCODE( ii + FIRST_DCODE, false ); + if( pt_D_code == NULL ) continue; if( !pt_D_code->m_InUse && !pt_D_code->m_Defined ) continue; - Line.Printf( wxT( - "tool %2.2d: D%2.2d V %2.4f H %2.4f %s" ), + Line.Printf( wxT( "tool %2.2d: D%2.2d V %2.4f H %2.4f %s" ), jj, pt_D_code->m_Num_Dcode, (float) pt_D_code->m_Size.y / scale, @@ -486,10 +502,12 @@ void WinEDA_GerberFrame::Liste_D_Codes( ) ii = List->ShowModal(); List->Destroy(); + if( ii < 0 ) return; } + /** * Function UpdateTitleAndInfo * displays the short filename (if exists) of the selected layer @@ -501,8 +519,9 @@ void WinEDA_GerberFrame::Liste_D_Codes( ) */ 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; + // Display the gerber filename if( gerber == NULL ) { @@ -518,19 +537,20 @@ void WinEDA_GerberFrame::UpdateTitleAndInfo() text << wxT( " " ) << gerber->m_FileName; SetTitle( text ); - gerber->DisplayImageInfo( ); + gerber->DisplayImageInfo(); // Display Image Name and Layer Name (from the current gerber data): - text.Printf( _("Image name: \"%s\" Layer name: \"%s\""), - GetChars(gerber->m_ImageName), GetChars(gerber->GetLayerParams( ).m_LayerName) ); + text.Printf( _( "Image name: \"%s\" Layer name: \"%s\"" ), + GetChars( gerber->m_ImageName ), + GetChars( gerber->GetLayerParams().m_LayerName ) ); 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 - text.Printf(wxT("fmt: %s X%d.%d Y%d.%d no %cZ"), - gerber->m_GerbMetric ? wxT("mm") : wxT("in"), - gerber->m_FmtLen.x - gerber->m_FmtScale.x, gerber->m_FmtScale.x, - gerber->m_FmtLen.y - gerber->m_FmtScale.y, gerber->m_FmtScale.y, - gerber->m_NoTrailingZeros ? 'T' : 'L'); + text.Printf( wxT("fmt: %s X%d.%d Y%d.%d no %cZ"), + gerber->m_GerbMetric ? wxT( "mm" ) : wxT( "in" ), + gerber->m_FmtLen.x - gerber->m_FmtScale.x, gerber->m_FmtScale.x, + gerber->m_FmtLen.y - gerber->m_FmtScale.y, gerber->m_FmtScale.y, + gerber->m_NoTrailingZeros ? 'T' : 'L' ); m_TextInfo->SetValue( text ); } diff --git a/gerbview/hotkeys.cpp b/gerbview/hotkeys.cpp index c58101ae29..f84e6b278d 100644 --- a/gerbview/hotkeys.cpp +++ b/gerbview/hotkeys.cpp @@ -69,15 +69,14 @@ struct Ki_HotkeyInfoSectionDescriptor s_Gerbview_Hokeys_Descr[] = /***********************************************************/ -void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey, - EDA_BaseStruct* DrawStruct ) +void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) /***********************************************************/ /* Hot keys. Some commands are relatives to the item under the mouse cursor * Commands are case insensitive * @param DC = current device context * @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 */ { diff --git a/gerbview/wxGerberFrame.h b/gerbview/wxGerberFrame.h index 4f9bbe56f4..0a6a6a56d2 100644 --- a/gerbview/wxGerberFrame.h +++ b/gerbview/wxGerberFrame.h @@ -234,7 +234,7 @@ public: bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); int BestZoom(); void OnSelectOptionToolbar( wxCommandEvent& event ); - void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); + void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ); GERBER_DRAW_ITEM* GerberGeneralLocateAndDisplay(); GERBER_DRAW_ITEM* Locate( int typeloc ); diff --git a/include/base_struct.h b/include/base_struct.h index cdf8191a67..3a36bffadd 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -104,7 +104,7 @@ enum SEARCH_RESULT { }; -class EDA_BaseStruct; +class EDA_ITEM; class WinEDA_DrawFrame; class BOARD; class EDA_Rect; @@ -133,14 +133,13 @@ public: *to * that. It can also collect or modify the scanned objects. * - * @param testItem An EDA_BaseStruct to examine. + * @param testItem An EDA_ITEM to examine. * @param testData is arbitrary data needed by the inspector to determine * if the BOARD_ITEM under test meets its match criteria. * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan, * else SCAN_CONTINUE; */ - SEARCH_RESULT virtual Inspect( EDA_BaseStruct* testItem, - const void* testData ) = 0; + SEARCH_RESULT virtual Inspect( EDA_ITEM* testItem, const void* testData ) = 0; }; @@ -261,13 +260,13 @@ public: class DHEAD; /** - * Class EDA_BaseStruct + * Class EDA_ITEM * is a base class for most all the kicad significant classes, used in * schematics and boards. */ // These define are used for the .m_Flags and .m_UndoRedoStatus member of the -// class EDA_BaseStruct +// class EDA_ITEM #define IS_CHANGED (1 << 0) #define IS_LINKED (1 << 1) #define IN_EDIT (1 << 2) @@ -288,49 +287,44 @@ class DHEAD; #define IS_CANCELLED (1 << 17) ///< flag set when edit dialogs are canceled when editing a ///< new object -class EDA_BaseStruct +class EDA_ITEM { private: /** * Run time identification, _keep private_ so it can never be changed after * a constructor sets it. See comment near SetType() regarding virtual - *functions. + * functions. */ - KICAD_T m_StructType; + KICAD_T m_StructType; + int m_Status; protected: - EDA_BaseStruct* Pnext; /* Linked list: Link (next struct) */ - EDA_BaseStruct* Pback; /* Linked list: Link (previous struct) */ - EDA_BaseStruct* m_Parent; /* Linked list: Link (parent struct) */ - EDA_BaseStruct* m_Son; /* Linked list: Link (son struct) */ - DHEAD* m_List; ///< which DLIST I am on. - + EDA_ITEM* Pnext; /* Linked list: Link (next struct) */ + EDA_ITEM* Pback; /* Linked list: Link (previous struct) */ + EDA_ITEM* m_Parent; /* Linked list: Link (parent struct) */ + EDA_ITEM* m_Son; /* Linked list: Link (son struct) */ + DHEAD* m_List; ///< which DLIST I am on. public: - int m_Flags; // flags for editing and other uses. + int m_Flags; // flags for editing and other uses. - unsigned long m_TimeStamp; // Time stamp used for logical links - int m_Selected; /* Used by block commands, and selective + unsigned long m_TimeStamp; // Time stamp used for logical links + int m_Selected; /* Used by block commands, and selective * editing */ // member used in undo/redo function - EDA_BaseStruct* m_Image; // Link to an image copy to save a copy of + EDA_ITEM* m_Image; // Link to an image copy to save a copy of // old parameters values - -private: - int m_Status; - private: void InitVars(); - public: - EDA_BaseStruct( EDA_BaseStruct* parent, KICAD_T idType ); - EDA_BaseStruct( KICAD_T idType ); - EDA_BaseStruct( const EDA_BaseStruct& base ); - virtual ~EDA_BaseStruct() { }; + EDA_ITEM( EDA_ITEM* parent, KICAD_T idType ); + EDA_ITEM( KICAD_T idType ); + EDA_ITEM( const EDA_ITEM& base ); + virtual ~EDA_ITEM() { }; /** * Function Type @@ -341,17 +335,17 @@ public: KICAD_T Type() const { return m_StructType; } - EDA_BaseStruct* Next() const { return (EDA_BaseStruct*) Pnext; } - EDA_BaseStruct* Back() const { return (EDA_BaseStruct*) Pback; } - EDA_BaseStruct* GetParent() const { return m_Parent; } - EDA_BaseStruct* GetSon() const { return m_Son; } + EDA_ITEM* Next() const { return (EDA_ITEM*) Pnext; } + EDA_ITEM* Back() const { return (EDA_ITEM*) Pback; } + EDA_ITEM* GetParent() const { return m_Parent; } + EDA_ITEM* GetSon() const { return m_Son; } DHEAD* GetList() const { return m_List; } - void SetNext( EDA_BaseStruct* aNext ) { Pnext = aNext; } - void SetBack( EDA_BaseStruct* aBack ) { Pback = aBack; } - void SetParent( EDA_BaseStruct* aParent ) { m_Parent = aParent; } - void SetSon( EDA_BaseStruct* aSon ) { m_Son = aSon; } - void SetList( DHEAD* aList ) { m_List = aList; } + void SetNext( EDA_ITEM* aNext ) { Pnext = aNext; } + void SetBack( EDA_ITEM* aBack ) { Pback = aBack; } + void SetParent( EDA_ITEM* aParent ) { m_Parent = aParent; } + void SetSon( EDA_ITEM* aSon ) { m_Son = aSon; } + void SetList( DHEAD* aList ) { m_List = aList; } inline bool IsNew() const { return m_Flags & IS_NEW; } inline bool IsModified() const { return m_Flags & IS_CHANGED; } @@ -452,7 +446,7 @@ public: * walks through the object tree calling the inspector() on each object * type requested in scanTypes. * - * @param listStart The first in a list of EDA_BaseStructs to iterate over. + * @param listStart The first in a list of EDA_ITEMs to iterate over. * @param inspector Is an INSPECTOR to call on each object that is one of * the requested scanTypes. * @param testData Is an aid to testFunc, and should be sufficient to @@ -464,10 +458,10 @@ public: * @return SEARCH_RESULT - SEARCH_QUIT if the called INSPECTOR returned * SEARCH_QUIT, else SCAN_CONTINUE; */ - static SEARCH_RESULT IterateForward( EDA_BaseStruct* listStart, - INSPECTOR* inspector, - const void* testData, - const KICAD_T scanTypes[] ); + static SEARCH_RESULT IterateForward( EDA_ITEM* listStart, + INSPECTOR* inspector, + const void* testData, + const KICAD_T scanTypes[] ); /** @@ -495,7 +489,7 @@ public: */ virtual wxString GetClass() const { - return wxT( "EDA_BaseStruct" ); + return wxT( "EDA_ITEM" ); } @@ -569,7 +563,7 @@ enum FILL_T { * Class EDA_TextStruct * is a basic class to handle texts (labels, texts on components or footprints * ..) not used directly. - * The text classes are derived from EDA_BaseStruct and EDA_TextStruct + * The text classes are derived from EDA_ITEM and EDA_TextStruct */ class EDA_TextStruct { diff --git a/include/block_commande.h b/include/block_commande.h index f83e817034..c55fa8ac35 100644 --- a/include/block_commande.h +++ b/include/block_commande.h @@ -53,7 +53,7 @@ typedef enum { } CmdBlockType; -class BLOCK_SELECTOR : public EDA_BaseStruct, public EDA_Rect +class BLOCK_SELECTOR : public EDA_ITEM, public EDA_Rect { public: BlockState m_State; /* State (enum BlockState) @@ -103,7 +103,7 @@ public: /** * Function ClearListAndDeleteItems - * deletes only the list of EDA_BaseStruct * pointers, AND the data printed + * deletes only the list of EDA_ITEM * pointers, AND the data printed * by m_Item */ void ClearListAndDeleteItems(); diff --git a/include/class_base_screen.h b/include/class_base_screen.h index 3ee6043c8e..682a9bd6e3 100644 --- a/include/class_base_screen.h +++ b/include/class_base_screen.h @@ -18,7 +18,6 @@ // Forward declarations: -class SCH_ITEM; class Ki_PageDescr; @@ -28,7 +27,7 @@ class Ki_PageDescr; * The Boost containter was choosen over the statand C++ contain because you can detach * the pointer from a list with the release method. */ -typedef boost::ptr_vector< EDA_BaseStruct > EDA_ITEMS; +typedef boost::ptr_vector< EDA_ITEM > EDA_ITEMS; /* Simple class for handling grid arrays. */ @@ -57,17 +56,17 @@ public: }; -/* Declare array of wxSize for grid list implementation. */ -#include -WX_DECLARE_OBJARRAY( GRID_TYPE, GridArray ); +typedef std::vector< GRID_TYPE > GRIDS; /*******************************************************************/ /* Class to handle how to draw a screen (a board, a schematic ...) */ /*******************************************************************/ -class BASE_SCREEN : public EDA_BaseStruct +class BASE_SCREEN : public EDA_ITEM { EDA_ITEMS m_items; ///< The drawing items associated with this screen. + GRIDS m_grids; ///< List of valid grid sizes. + EDA_ITEM* m_drawList; ///< Object list for the screen. public: wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */ @@ -101,8 +100,6 @@ public: * Schematic */ bool m_FirstRedraw; - SCH_ITEM* EEDrawList; /* Object list (main data) for schematic */ - // Undo/redo list of commands UNDO_REDO_CONTAINER m_UndoList; /* Objects list for the undo * command (old data) */ @@ -135,13 +132,12 @@ private: char m_FlagModified; // indicates current drawing has // been modified char m_FlagSave; // Perform automatica file save. - EDA_BaseStruct* m_CurrentItem; ///< Currently selected object + EDA_ITEM* m_CurrentItem; ///< Currently selected object GRID_TYPE m_Grid; ///< Current grid selection. /* Grid and zoom values. */ public: wxPoint m_GridOrigin; - GridArray m_GridList; wxArrayInt m_ZoomList; /* Array of standard zoom coefficients. */ int m_Zoom; /* Current zoom coefficient. */ @@ -156,10 +152,19 @@ public: /** * Function setCurItem * sets the currently selected object, m_CurrentItem. - * @param current Any object derived from EDA_BaseStruct + * @param current Any object derived from EDA_ITEM */ - void SetCurItem( EDA_BaseStruct* current ) { m_CurrentItem = current; } - EDA_BaseStruct* GetCurItem() const { return m_CurrentItem; } + void SetCurItem( EDA_ITEM* current ) { m_CurrentItem = current; } + EDA_ITEM* GetCurItem() const { return m_CurrentItem; } + + /** + * Function GetDrawItems(). + * + * @return - A pointer to the first item in the linked list of draw items. + */ + virtual EDA_ITEM* GetDrawItems() const { return m_drawList; } + + virtual void SetDrawItems( EDA_ITEM* aItem ) { m_drawList = aItem; } void InitDatas(); @@ -340,14 +345,38 @@ public: */ GRID_TYPE GetGrid(); - const wxPoint &GetGridOrigin(); + const wxPoint& GetGridOrigin(); void SetGrid( const wxRealPoint& size ); void SetGrid( int id ); - void SetGridList( GridArray& sizelist ); + void SetGridList( GRIDS& sizelist ); void AddGrid( const GRID_TYPE& grid ); void AddGrid( const wxRealPoint& size, int id ); void AddGrid( const wxRealPoint& size, UserUnitType aUnit, int id ); + /** + * Function GetGridCount(). + * Return the size of the grid list. + * + * @returns - The size of the grid list. + */ + size_t GetGridCount() const { return m_grids.size(); } + + /** + * Function GetGrid() + * Returns the grid object at \a aIndex. + * + * @param aIndex - The grid list index. + * @return - The grid object at \a aIndex or the current grid if the grid list is empty. + */ + GRID_TYPE& GetGrid( size_t aIndex ); + + /** + * Function GetGrids(). + * Copy the grid list to \a aList. + * + * @param aList - List to copy to. + */ + void GetGrids( GRIDS& aList ); /** * Function RefPos @@ -380,8 +409,8 @@ public: */ EDA_ITEMS::iterator Begin() { return m_items.begin(); } EDA_ITEMS::iterator End() { return m_items.end(); } - virtual void AddItem( EDA_BaseStruct* aItem ); - virtual void InsertItem( EDA_ITEMS::iterator aIter, EDA_BaseStruct* aItem ); + virtual void AddItem( EDA_ITEM* aItem ); + virtual void InsertItem( EDA_ITEMS::iterator aIter, EDA_ITEM* aItem ); #if defined(DEBUG) diff --git a/include/class_board_item.h b/include/class_board_item.h index 0b3a4587f3..ad1cedf149 100644 --- a/include/class_board_item.h +++ b/include/class_board_item.h @@ -28,13 +28,13 @@ enum Track_Shapes { * found in PCBNEW or other programs that use class BOARD and its contents. * The corresponding class in EESCHEMA is SCH_ITEM. */ -class BOARD_ITEM : public EDA_BaseStruct +class BOARD_ITEM : public EDA_ITEM { // These are made private here so they may not be used. // Instead everything derived from BOARD_ITEM is handled via DLIST<>'s // use of DHEAD's member functions. - void SetNext( EDA_BaseStruct* aNext ) { Pnext = aNext; } - void SetBack( EDA_BaseStruct* aBack ) { Pback = aBack; } + void SetNext( EDA_ITEM* aNext ) { Pnext = aNext; } + void SetBack( EDA_ITEM* aBack ) { Pback = aBack; } protected: @@ -43,14 +43,14 @@ protected: public: BOARD_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) : - EDA_BaseStruct( aParent, idtype ) + EDA_ITEM( aParent, idtype ) , m_Layer( 0 ) { } BOARD_ITEM( const BOARD_ITEM& src ) : - EDA_BaseStruct( src.m_Parent, src.Type() ) + EDA_ITEM( src.m_Parent, src.Type() ) , m_Layer( src.m_Layer ) { m_Flags = src.m_Flags; diff --git a/include/class_collector.h b/include/class_collector.h index 2423258eb8..1aa2f27e22 100644 --- a/include/class_collector.h +++ b/include/class_collector.h @@ -32,7 +32,7 @@ #include "common.h" // GetTimeStamp() -class EDA_BaseStruct; +class EDA_ITEM; /** @@ -54,7 +54,7 @@ protected: const KICAD_T* m_ScanTypes; /// A place to hold collected objects without taking ownership of their memory. - std::vector m_List; + std::vector m_List; /// A point to test against, andt that was used to make the collection. wxPoint m_RefPos; @@ -101,9 +101,9 @@ public: /** * Function Append * adds an item to the end of the list. - * @param item An EDA_BaseStruct* to add. + * @param item An EDA_ITEM* to add. */ - void Append( EDA_BaseStruct* item ) + void Append( EDA_ITEM* item ) { m_List.push_back( item ); } @@ -122,9 +122,9 @@ public: * Function operator[int] * is used for read only access and returns the object at index ndx. * @param ndx The index into the list. - * @return EDA_BaseStruct* - or something derived from it, or NULL. + * @return EDA_ITEM* - or something derived from it, or NULL. */ - EDA_BaseStruct* operator[]( int ndx ) const + EDA_ITEM* operator[]( int ndx ) const { if( (unsigned)ndx < (unsigned)GetCount() ) // (unsigned) excludes ndx<0 also return m_List[ ndx ]; @@ -137,7 +137,7 @@ public: * if there is at least one element in the vector m_List, otherwise a * C++ exception should get thrown. */ - EDA_BaseStruct* const* BasePtr() const + EDA_ITEM* const* BasePtr() const { return &m_List[0]; } @@ -202,28 +202,28 @@ public: * Iterate function. It is used primarily for searching, but not limited to * that. It can also collect or modify the scanned objects. * - * @param testItem An EDA_BaseStruct to examine. + * @param testItem An EDA_ITEM to examine. * @param testData is arbitrary data needed by the inspector to determine - * if the EDA_BaseStruct under test meets its match criteria. + * if the EDA_ITEM under test meets its match criteria. * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan, * else SCAN_CONTINUE; * * implement in derived class: - SEARCH_RESULT virtual Inspect( EDA_BaseStruct* testItem, + SEARCH_RESULT virtual Inspect( EDA_ITEM* testItem, const void* testData ) = 0; */ /** * Function Collect - * scans an EDA_BaseStruct using this class's Inspector method, which does + * scans an EDA_ITEM using this class's Inspector method, which does * the collection. - * @param container An EDA_BaseStruct to scan, including those items it contains. + * @param container An EDA_ITEM to scan, including those items it contains. * @param aRefPos A wxPoint to use in hit-testing. * * example implementation, in derived class: * - virtual void Collect( EDA_BaseStruct* container, const wxPoint& aRefPos ) + virtual void Collect( EDA_ITEM* container, const wxPoint& aRefPos ) { example implementation: diff --git a/include/class_sch_screen.h b/include/class_sch_screen.h index 41f43e2ea3..2f856753ca 100644 --- a/include/class_sch_screen.h +++ b/include/class_sch_screen.h @@ -23,6 +23,15 @@ public: SCH_SCREEN( KICAD_T aType = SCREEN_STRUCT_TYPE ); ~SCH_SCREEN(); + /** + * Function GetDrawItems(). + * + * @return - A pointer to the first item in the linked list of draw items. + */ + virtual SCH_ITEM* GetDrawItems() const { return (SCH_ITEM*) BASE_SCREEN::GetDrawItems(); } + + virtual void SetDrawItems( SCH_ITEM* aItem ) { BASE_SCREEN::SetDrawItems( aItem ); } + /** * Function GetCurItem * returns the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem(). @@ -53,7 +62,7 @@ public: */ void FreeDrawList(); - void Place( WinEDA_SchematicFrame* frame, wxDC* DC ) { }; + void Place( SCH_EDIT_FRAME* frame, wxDC* DC ) { }; /** * Remove \a aItem from the schematic associated with this screen. @@ -62,7 +71,7 @@ public: */ void RemoveFromDrawList( SCH_ITEM* DrawStruct ); bool CheckIfOnDrawList( SCH_ITEM* st ); - void AddToDrawList( SCH_ITEM* DrawStruct ); + void AddToDrawList( SCH_ITEM* st ); bool SchematicCleanUp( wxDC* DC = NULL ); SCH_ITEM* ExtractWires( bool CreateCopy ); @@ -98,10 +107,10 @@ public: */ void ClearDrawingState(); - virtual void AddItem( SCH_ITEM* aItem ) { BASE_SCREEN::AddItem( (EDA_BaseStruct*) aItem ); } + virtual void AddItem( SCH_ITEM* aItem ) { BASE_SCREEN::AddItem( (EDA_ITEM*) aItem ); } virtual void InsertItem( EDA_ITEMS::iterator aIter, SCH_ITEM* aItem ) { - BASE_SCREEN::InsertItem( aIter, (EDA_BaseStruct*) aItem ); + BASE_SCREEN::InsertItem( aIter, (EDA_ITEM*) aItem ); } }; @@ -127,7 +136,7 @@ public: private: void AddScreenToList( SCH_SCREEN* aScreen ); - void BuildScreenList( EDA_BaseStruct* aItem ); + void BuildScreenList( EDA_ITEM* aItem ); }; #endif /* CLASS_SCREEN_H */ diff --git a/include/class_undoredo_container.h b/include/class_undoredo_container.h index 232ea06005..f8b4b8055f 100644 --- a/include/class_undoredo_container.h +++ b/include/class_undoredo_container.h @@ -69,14 +69,14 @@ enum UndoRedoOpType { class ITEM_PICKER { public: - UndoRedoOpType m_UndoRedoStatus; /* type of operation to undo/redo for this item */ - EDA_BaseStruct* m_PickedItem; /* Pointer on the schematic or board item that is concerned (picked), + UndoRedoOpType m_UndoRedoStatus; /* type of operation to undo/redo for this item */ + EDA_ITEM* m_PickedItem; /* Pointer on the schematic or board item that is concerned (picked), * or in undo redo commands, the copy of an edited item. */ - KICAD_T m_PickedItemType; /* type of schematic or board item that is concerned + KICAD_T m_PickedItemType; /* type of schematic or board item that is concerned */ - int m_PickerFlags; /* a copy of m_Flags member. usefull in mode/drag undo/redo commands */ - EDA_BaseStruct* m_Link; /* Pointer on an other item. Used in undo redo command + int m_PickerFlags; /* a copy of m_Flags member. usefull in mode/drag undo/redo commands */ + EDA_ITEM* m_Link; /* Pointer on an other item. Used in undo redo command * used when a duplicate exists i.e. when an item is modified, * and the copy of initial item exists (the duplicate) * m_Item points the duplicate (i.e the old copy of an active item) @@ -84,8 +84,7 @@ public: */ public: - ITEM_PICKER( EDA_BaseStruct* aItem = NULL, - UndoRedoOpType aUndoRedoStatus = UR_UNSPECIFIED ); + ITEM_PICKER( EDA_ITEM* aItem = NULL, UndoRedoOpType aUndoRedoStatus = UR_UNSPECIFIED ); }; /* Class PICKED_ITEMS_LIST @@ -166,14 +165,14 @@ public: * @return a pointer to the picked item * @param aIdx = index of the picked item in the picked list */ - EDA_BaseStruct* GetPickedItem( unsigned int aIdx ); + EDA_ITEM* GetPickedItem( unsigned int aIdx ); /** * Function GetPickedItemLink * @return link of the picked item, or null if does not exist * @param aIdx = index of the picked item in the picked list */ - EDA_BaseStruct* GetPickedItemLink( unsigned int aIdx ); + EDA_ITEM* GetPickedItemLink( unsigned int aIdx ); /** * Function GetPickedItemStatus @@ -197,7 +196,7 @@ public: * @param aIdx = index of the picker in the picked list * @return true if the pixker exists, or false if does not exist */ - bool SetPickedItem( EDA_BaseStruct* aItem, unsigned aIdx ); + bool SetPickedItem( EDA_ITEM* aItem, unsigned aIdx ); /** * Function SetPickedItem @@ -206,7 +205,7 @@ public: * @param aIdx = index of the picker in the picked list * @return true if the pixker exists, or false if does not exist */ - bool SetPickedItem( EDA_BaseStruct* aItem, UndoRedoOpType aStatus, unsigned aIdx ); + bool SetPickedItem( EDA_ITEM* aItem, UndoRedoOpType aStatus, unsigned aIdx ); /** * Function SetPickedItemLink @@ -215,7 +214,7 @@ public: * @param aIdx = index of the picker in the picked list * @return true if the pixker exists, or false if does not exist */ - bool SetPickedItemLink( EDA_BaseStruct* aLink, unsigned aIdx ); + bool SetPickedItemLink( EDA_ITEM* aLink, unsigned aIdx ); /** * Function SetPickedItemStatus diff --git a/include/colors.h b/include/colors.h index 5ef7b0f27e..e1dfc5e99c 100644 --- a/include/colors.h +++ b/include/colors.h @@ -15,7 +15,7 @@ /// Flag bit display (seen / not seen) items: (defined in the color values //IMB: Not used anymore #define ITEM_NOT_SHOW (1<<18) // 0x40000 -#define HIGHT_LIGHT_FLAG ( 1<<19 ) // 0x80000 +#define HIGHLIGHT_FLAG ( 1<<19 ) // 0x80000 /** diff --git a/include/dlist.h b/include/dlist.h index 35b14b0fe6..c85167000f 100644 --- a/include/dlist.h +++ b/include/dlist.h @@ -27,7 +27,7 @@ #define DLIST_H_ -class EDA_BaseStruct; +class EDA_ITEM; /** @@ -37,10 +37,10 @@ class EDA_BaseStruct; class DHEAD { protected: - EDA_BaseStruct* first; ///< first element in list, or NULL if list empty - EDA_BaseStruct* last; ///< last elment in list, or NULL if empty - unsigned count; ///< how many elements are in the list, automatically maintained. - bool meOwner; ///< I must delete the objects I hold in my destructor + EDA_ITEM* first; ///< first element in list, or NULL if list empty + EDA_ITEM* last; ///< last elment in list, or NULL if empty + unsigned count; ///< how many elements are in the list, automatically maintained. + bool meOwner; ///< I must delete the objects I hold in my destructor /** * Constructor DHEAD @@ -61,7 +61,7 @@ protected: * Function append * adds \a aNewElement to the end of the list. */ - void append( EDA_BaseStruct* aNewElement ); + void append( EDA_ITEM* aNewElement ); /** * Function insert @@ -71,13 +71,13 @@ protected: * @param aElementAfterMe The element to insert \a aNewElement before, * if NULL then append aNewElement onto end of list. */ - void insert( EDA_BaseStruct* aNewElement, EDA_BaseStruct* aElementAfterMe ); + void insert( EDA_ITEM* aNewElement, EDA_ITEM* aElementAfterMe ); /** * Function insert * puts aNewElement in front of list sequence. */ - void insert( EDA_BaseStruct* aNewElement ) + void insert( EDA_ITEM* aNewElement ) { insert( aNewElement, first ); } @@ -86,7 +86,7 @@ protected: * Function remove * removes \a aElement from the list, but does not delete it. */ - void remove( EDA_BaseStruct* aElement ); + void remove( EDA_ITEM* aElement ); public: @@ -122,7 +122,7 @@ public: * Class DLIST * is the head of a doubly linked list. It contains pointers to the first * and last elements in a doubly linked list. The elements in the list must - * be of class T or derived from T, and T must be derived from EDA_BaseStruct. + * be of class T or derived from T, and T must be derived from EDA_ITEM. * @see DHEAD for additional public functions. */ template diff --git a/include/kicad_msvc.h b/include/kicad_msvc.h index 398be30d65..5d01947834 100644 --- a/include/kicad_msvc.h +++ b/include/kicad_msvc.h @@ -26,8 +26,8 @@ BOOST_TYPEOF_REGISTER_TYPE(wxString) ; class DrawSheetLabelStruct; BOOST_TYPEOF_REGISTER_TYPE(DrawSheetLabelStruct *); - class EDA_BaseStruct; - BOOST_TYPEOF_REGISTER_TYPE(EDA_BaseStruct *); + class EDA_ITEM; + BOOST_TYPEOF_REGISTER_TYPE(EDA_ITEM *); class D_PAD; BOOST_TYPEOF_REGISTER_TYPE(D_PAD *); BOOST_TYPEOF_REGISTER_TYPE(const D_PAD *); diff --git a/include/macros.h b/include/macros.h index ead43473dd..0c20bc12c0 100644 --- a/include/macros.h +++ b/include/macros.h @@ -110,8 +110,8 @@ BOOST_TYPEOF_REGISTER_TYPE( wxSize ) BOOST_TYPEOF_REGISTER_TYPE( wxString ) class DrawSheetLabelStruct; BOOST_TYPEOF_REGISTER_TYPE( DrawSheetLabelStruct* ) -class EDA_BaseStruct; -BOOST_TYPEOF_REGISTER_TYPE( EDA_BaseStruct* ) +class EDA_ITEM; +BOOST_TYPEOF_REGISTER_TYPE( EDA_ITEM* ) class D_PAD; BOOST_TYPEOF_REGISTER_TYPE( D_PAD* ) BOOST_TYPEOF_REGISTER_TYPE( const D_PAD* ) diff --git a/include/sch_item_struct.h b/include/sch_item_struct.h index 2d60c508ac..abec56fe9f 100644 --- a/include/sch_item_struct.h +++ b/include/sch_item_struct.h @@ -13,7 +13,7 @@ using namespace std; class SCH_ITEM; class LINE_READER; -class WinEDA_SchematicFrame; +class SCH_EDIT_FRAME; class wxFindReplaceData; @@ -53,14 +53,14 @@ public: * found in EESCHEMA or other programs that use class SCHEMATIC and its contents. * The corresponding class in PCBNEW is BOARD_ITEM. */ -class SCH_ITEM : public EDA_BaseStruct +class SCH_ITEM : public EDA_ITEM { protected: int m_Layer; EDA_ITEMS m_connections; ///< List of items connected to this item. public: - SCH_ITEM( EDA_BaseStruct* aParent, KICAD_T aType ); + SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType ); ~SCH_ITEM(); @@ -102,7 +102,7 @@ public: /* Place function */ - virtual void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); + virtual void Place( SCH_EDIT_FRAME* frame, wxDC* DC ); // Geometric transforms (used in block operations): /** virtual function Move @@ -144,9 +144,9 @@ public: * The base class returns false since many of the objects derived from * SCH_ITEM do not have any text to search. * - * @todo - This should probably be pushed down to EDA_BaseStruct so that + * @todo - This should probably be pushed down to EDA_ITEM so that * searches can be done on all of the Kicad applications that use - * objects derived from EDA_BaseStruct. + * objects derived from EDA_ITEM. * * @param aSearchData - The search criteria. * @param aAuxData - a pointer on auxiliary data, if needed (NULL if not used). diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 0294adfe3d..d18cf64c30 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -121,7 +121,7 @@ public: public: // Read/write functions: - EDA_BaseStruct* ReadDrawSegmentDescr( FILE* File, int* LineNum ); + EDA_ITEM* ReadDrawSegmentDescr( FILE* File, int* LineNum ); int ReadListeSegmentDescr( FILE* File, TRACK* PtSegm, int StructType, diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index 6476a3e760..83fe70fb25 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -21,7 +21,7 @@ class SCH_NO_CONNECT; class CMP_LIBRARY; class LIB_COMPONENT; class LIB_DRAW_ITEM; -class EDA_BaseStruct; +class EDA_ITEM; class SCH_BUS_ENTRY; class SCH_GLOBALLABEL; class SCH_TEXT; @@ -54,7 +54,7 @@ enum fl_rot_cmp { /** * Schematic editor (EESchema) main window. */ -class WinEDA_SchematicFrame : public WinEDA_DrawFrame +class SCH_EDIT_FRAME : public WinEDA_DrawFrame { public: WinEDAChoiceBox* m_SelPartBox; @@ -93,12 +93,12 @@ private: wxArrayString m_replaceStringHistoryList; public: - WinEDA_SchematicFrame( wxWindow* father, - const wxString& title, - const wxPoint& pos, const wxSize& size, - long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); + SCH_EDIT_FRAME( wxWindow* father, + const wxString& title, + const wxPoint& pos, const wxSize& size, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); - ~WinEDA_SchematicFrame(); + ~SCH_EDIT_FRAME(); void OnCloseWindow( wxCloseEvent& Event ); void Process_Special_Functions( wxCommandEvent& event ); @@ -168,9 +168,7 @@ public: void ReCreateVToolbar(); void ReCreateOptToolbar(); void ReCreateMenuBar(); - void OnHotKey( wxDC* DC, - int hotkey, - EDA_BaseStruct* DrawStruct ); + void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ); SCH_FIELD* GetCurrentField() { return m_CurrentField; } @@ -234,8 +232,7 @@ public: bool mouseWarp ); /* Cross probing with pcbnew */ - void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync, - SCH_COMPONENT* LibItem ); + void SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT* LibItem ); /* netlist generation */ void BuildNetListBase(); @@ -580,7 +577,7 @@ private: public: - void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); + void Key( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ); /* Block operations. */ void InitBlockPasteInfos(); diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 82016d7694..e058627d72 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -269,11 +269,9 @@ public: * Some commands are relatives to the item under the mouse cursor * @param aDC = current device context * @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys) - * @param aItem = NULL or pointer on a EDA_BaseStruct under the mouse cursor + * @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor */ - void OnHotKey( wxDC* aDC, - int aHotkeyCode, - EDA_BaseStruct* aItem ); + void OnHotKey( wxDC* aDC, int aHotkeyCode, EDA_ITEM* aItem ); /** * Function OnHotkeyDeleteItem @@ -1129,7 +1127,7 @@ public: void ReadAutoroutedTracks( wxDC* DC ); void GlobalRoute( wxDC* DC ); - void Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ); + void Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC ); void Clean_Pcb( wxDC* DC ); void InstallFindFrame( const wxPoint& pos, wxDC* DC ); diff --git a/include/wxstruct.h b/include/wxstruct.h index 2c37ed0329..e3c292e418 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -33,7 +33,7 @@ #define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS -class EDA_BaseStruct; +class EDA_ITEM; class EDA_Rect; class WinEDA_DrawPanel; class WinEDA_MsgPanel; @@ -269,8 +269,7 @@ public: void OnMenuOpen( wxMenuEvent& event ); void OnMouseEvent( wxMouseEvent& event ); - virtual void OnHotKey( wxDC* DC, int hotkey, - EDA_BaseStruct* DrawStruct ); + virtual void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ); /** * Function AddMenuZoomAndGrid (virtual) diff --git a/pcbnew/autoplac.cpp b/pcbnew/autoplac.cpp index 3c2848a4f1..6d6a602ce4 100644 --- a/pcbnew/autoplac.cpp +++ b/pcbnew/autoplac.cpp @@ -375,10 +375,10 @@ void WinEDA_PcbFrame::DrawInfoPlace( wxDC* DC ) */ int WinEDA_PcbFrame::GenPlaceBoard() { - int jj, ii; - int NbCells; - EDA_BaseStruct* PtStruct; - wxString msg; + int jj, ii; + int NbCells; + EDA_ITEM* PtStruct; + wxString msg; Board.UnInitBoard(); diff --git a/pcbnew/block_module_editor.cpp b/pcbnew/block_module_editor.cpp index fec12017cc..50a9b5a5a2 100644 --- a/pcbnew/block_module_editor.cpp +++ b/pcbnew/block_module_editor.cpp @@ -24,11 +24,8 @@ #define IS_SELECTED 1 -static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, - wxDC* DC, - bool erase ); -static int MarkItemsInBloc( MODULE* module, - EDA_Rect& Rect ); +static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); +static int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect ); static void ClearMarkItems( MODULE* module ); static void CopyMarkedItems( MODULE* module, wxPoint offset ); @@ -439,7 +436,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset ) */ void MoveMarkedItems( MODULE* module, wxPoint offset ) { - EDA_BaseStruct* item; + EDA_ITEM* item; if( module == NULL ) return; @@ -520,7 +517,7 @@ void DeleteMarkedItems( MODULE* module ) void MirrorMarkedItems( MODULE* module, wxPoint offset ) { #define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x; - EDA_BaseStruct* item; + EDA_ITEM* item; if( module == NULL ) return; @@ -577,7 +574,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) void RotateMarkedItems( MODULE* module, wxPoint offset ) { #define ROTATE( z ) RotatePoint( (&z), offset, 900 ) - EDA_BaseStruct* item; + EDA_ITEM* item; if( module == NULL ) return; @@ -627,7 +624,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) void ClearMarkItems( MODULE* module ) { - EDA_BaseStruct* item; + EDA_ITEM* item; if( module == NULL ) return; @@ -647,10 +644,10 @@ void ClearMarkItems( MODULE* module ) */ int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect ) { - EDA_BaseStruct* item; - int ItemsCount = 0; - wxPoint pos; - D_PAD* pad; + EDA_ITEM* item; + int ItemsCount = 0; + wxPoint pos; + D_PAD* pad; if( module == NULL ) return 0; diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 95fa46e4ae..97c9679246 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -22,7 +22,7 @@ BOARD_DESIGN_SETTINGS boardDesignSettings; /* Class BOARD: */ /*****************/ -BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) : +BOARD::BOARD( EDA_ITEM* parent, WinEDA_BasePcbFrame* frame ) : BOARD_ITEM( (BOARD_ITEM*)parent, TYPE_PCB ), m_NetClasses( this ) { @@ -751,10 +751,10 @@ unsigned BOARD::GetNodesCount() */ bool BOARD::ComputeBoundaryBox() { - int rayon, cx, cy, d, xmin, ymin, xmax, ymax; - bool hasItems = FALSE; - EDA_BaseStruct* PtStruct; - DRAWSEGMENT* ptr; + int rayon, cx, cy, d, xmin, ymin, xmax, ymax; + bool hasItems = FALSE; + EDA_ITEM* PtStruct; + DRAWSEGMENT* ptr; xmin = ymin = 0x7FFFFFFFl; xmax = ymax = -0x7FFFFFFFl; @@ -1113,7 +1113,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData, * found(0), layer(alayer), layer_mask( g_TabOneLayerMask[alayer] ) * {} * - * SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData + * SEARCH_RESULT Inspect( EDA_ITEM* testItem, const void* testData * ) * { * BOARD_ITEM* item = (BOARD_ITEM*) testItem; @@ -1287,7 +1287,7 @@ MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const FindModule() : found( 0 ) {} // implement interface INSPECTOR - SEARCH_RESULT Inspect( EDA_BaseStruct* item, const void* data ) + SEARCH_RESULT Inspect( EDA_ITEM* item, const void* data ) { MODULE* module = (MODULE*) item; const wxString& ref = *(const wxString*) data; diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 00b34f4904..a8c02939ac 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -153,7 +153,7 @@ private: /**********************************/ public: - BOARD( EDA_BaseStruct* aParent, WinEDA_BasePcbFrame* frame ); + BOARD( EDA_ITEM* aParent, WinEDA_BasePcbFrame* frame ); ~BOARD(); /** @@ -507,7 +507,7 @@ public: * Function DisplayInfo * has knowledge about the frame and how and where to put status information * about this object into the frame's message panel. - * Is virtual from EDA_BaseStruct. + * Is virtual from EDA_ITEM. * @param frame A WinEDA_DrawFrame in which to print status information. */ void DisplayInfo( WinEDA_DrawFrame* frame ); diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index aea6a8a9b6..3133b56ead 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -99,7 +99,7 @@ public: * Function DisplayInfo * has knowledge about the frame and how and where to put status information * about this object into the frame's message panel. - * Is virtual from EDA_BaseStruct. + * Is virtual from EDA_ITEM. * @param frame A WinEDA_DrawFrame in which to print status information. */ void DisplayInfo( WinEDA_DrawFrame* frame ); diff --git a/pcbnew/class_drawsegment.h b/pcbnew/class_drawsegment.h index db12c2a666..08d390f6a1 100644 --- a/pcbnew/class_drawsegment.h +++ b/pcbnew/class_drawsegment.h @@ -71,7 +71,7 @@ public: * Function DisplayInfo * has knowledge about the frame and how and where to put status information * about this object into the frame's message panel. - * Is virtual from EDA_BaseStruct. + * Is virtual from EDA_ITEM. * @param frame A WinEDA_BasePcbFrame in which to print status information. */ virtual void DisplayInfo( WinEDA_DrawFrame* frame ); diff --git a/pcbnew/class_edge_mod.h b/pcbnew/class_edge_mod.h index 214bfea4c9..70d4156f4f 100644 --- a/pcbnew/class_edge_mod.h +++ b/pcbnew/class_edge_mod.h @@ -67,7 +67,7 @@ public: * Function DisplayInfo * has knowledge about the frame and how and where to put status information * about this object into the frame's message panel. - * Is virtual from EDA_BaseStruct. + * Is virtual from EDA_ITEM. * @param frame A WinEDA_DrawFrame in which to print status information. */ void DisplayInfo( WinEDA_DrawFrame* frame ); diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index a701e3bf91..9f5e9aed43 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -785,7 +785,7 @@ EDA_Rect MODULE::GetBoundingBox() } -/* Virtual function, from EDA_BaseStruct. +/* Virtual function, from EDA_ITEM. * display module info on MsgPanel */ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) @@ -823,8 +823,9 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) frame->AppendMsgPanel( _( "Layer" ), board->GetLayerName( m_Layer ), RED ); - EDA_BaseStruct* PtStruct = m_Pads; + EDA_ITEM* PtStruct = m_Pads; nbpad = 0; + while( PtStruct ) { nbpad++; @@ -835,10 +836,13 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) frame->AppendMsgPanel( _( "Pads" ), msg, BLUE ); msg = wxT( ".." ); + if( IsLocked() ) msg[0] = 'L'; + if( m_ModuleStatus & MODULE_is_PLACED ) msg[1] = 'P'; + frame->AppendMsgPanel( _( "Stat" ), msg, MAGENTA ); msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 ); @@ -850,6 +854,7 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) msg = m_3D_Drawings->m_Shape3DName; else msg = _( "No 3D shape" ); + frame->AppendMsgPanel( _( "3D-Shape" ), msg, RED ); wxString doc = _( "Doc: " ) + m_Doc; @@ -1027,7 +1032,7 @@ void MODULE::Show( int nestLevel, std::ostream& os ) NestedSpace( nestLevel + 1, os ) << "\n"; - EDA_BaseStruct* p; + EDA_ITEM* p; NestedSpace( nestLevel + 1, os ) << "\n"; p = m_Pads; diff --git a/pcbnew/class_module_transform_functions.cpp b/pcbnew/class_module_transform_functions.cpp index 3efc6c3de4..12ab27d18c 100644 --- a/pcbnew/class_module_transform_functions.cpp +++ b/pcbnew/class_module_transform_functions.cpp @@ -153,10 +153,10 @@ void MODULE::Rotate(const wxPoint& aRotCentre, int aAngle) */ void MODULE::Flip(const wxPoint& aCentre ) { - D_PAD* pt_pad; - TEXTE_MODULE* pt_texte; - EDGE_MODULE* pt_edgmod; - EDA_BaseStruct* PtStruct; + D_PAD* pt_pad; + TEXTE_MODULE* pt_texte; + EDGE_MODULE* pt_edgmod; + EDA_ITEM* PtStruct; // Move module to its final position: wxPoint finalPos = m_Pos; @@ -309,7 +309,8 @@ void MODULE::SetPosition( const wxPoint& newpos ) pad->m_Pos.y += deltaY; } - EDA_BaseStruct* PtStruct = m_Drawings; + EDA_ITEM* PtStruct = m_Drawings; + for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { switch( PtStruct->Type() ) diff --git a/pcbnew/class_netinfo.h b/pcbnew/class_netinfo.h index 58b78d23f9..00c45a97c4 100644 --- a/pcbnew/class_netinfo.h +++ b/pcbnew/class_netinfo.h @@ -370,7 +370,7 @@ public: * Function DisplayInfo * has knowledge about the frame and how and where to put status information * about this object into the frame's message panel. - * Is virtual from EDA_BaseStruct. + * Is virtual from EDA_ITEM. * @param frame A WinEDA_DrawFrame in which to print status information. */ void DisplayInfo( WinEDA_DrawFrame* frame ); diff --git a/pcbnew/class_netinfo_item.cpp b/pcbnew/class_netinfo_item.cpp index 9cbe6a1023..bddd46bbbd 100644 --- a/pcbnew/class_netinfo_item.cpp +++ b/pcbnew/class_netinfo_item.cpp @@ -117,17 +117,17 @@ void NETINFO_ITEM::Draw( WinEDA_DrawPanel* panel, * Function DisplayInfo * has knowledge about the frame and how and where to put status information * about this object into the frame's message panel. - * Is virtual from EDA_BaseStruct. + * Is virtual from EDA_ITEM. * @param frame A WinEDA_DrawFrame in which to print status information. */ void NETINFO_ITEM::DisplayInfo( WinEDA_DrawFrame* frame ) { - int count; - EDA_BaseStruct* Struct; - wxString txt; - MODULE* module; - D_PAD* pad; - double lengthnet = 0; + int count; + EDA_ITEM* Struct; + wxString txt; + MODULE* module; + D_PAD* pad; + double lengthnet = 0; frame->ClearMsgPanel(); diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index f73fff14f1..fddb06929a 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -286,7 +286,7 @@ public: * Function DisplayInfo * has knowledge about the frame and how and where to put status information * about this object into the frame's message panel. - * Is virtual from EDA_BaseStruct. + * Is virtual from EDA_ITEM. * @param frame A WinEDA_DrawFrame in which to print status information. */ void DisplayInfo( WinEDA_DrawFrame* frame ); diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index e281a9c528..c1d3d39c0b 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -301,12 +301,12 @@ void D_PAD::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, int aDraw_mode, if( aDraw_mode & GR_SURBRILL ) { if( aDraw_mode & GR_AND ) - color &= ~HIGHT_LIGHT_FLAG; + color &= ~HIGHLIGHT_FLAG; else - color |= HIGHT_LIGHT_FLAG; + color |= HIGHLIGHT_FLAG; } - if( color & HIGHT_LIGHT_FLAG ) + if( color & HIGHLIGHT_FLAG ) color = ColorRefs[color & MASKCOLOR].m_LightColor; bool DisplayIsol = DisplayOpt.DisplayPadIsol; diff --git a/pcbnew/class_pcb_text.h b/pcbnew/class_pcb_text.h index 7a0bd5c389..81a88dcae7 100644 --- a/pcbnew/class_pcb_text.h +++ b/pcbnew/class_pcb_text.h @@ -72,7 +72,7 @@ public: * Function DisplayInfo * has knowledge about the frame and how and where to put status information * about this object into the frame's message panel. - * Is virtual from EDA_BaseStruct. + * Is virtual from EDA_ITEM. * @param frame A WinEDA_DrawFrame in which to print status information. */ void DisplayInfo( WinEDA_DrawFrame* frame ); diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index e0f2ee869f..5da2a1a549 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -113,7 +113,7 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); * Function DisplayInfo * has knowledge about the frame and how and where to put status * information about this object into the frame's message panel. - * Is virtual from EDA_BaseStruct. + * Is virtual from EDA_ITEM. * @param frame A WinEDA_DrawFrame in which to print status information. */ void DisplayInfo( WinEDA_DrawFrame* frame ); diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 749530f803..93b2e77ba4 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -570,8 +570,8 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, BOARD * brd = GetBoard( ); color = brd->GetLayerColor(m_Layer); - if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHT_LIGHT_FLAG ) != - HIGHT_LIGHT_FLAG ) + if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != + HIGHLIGHT_FLAG ) return; if( DisplayOpt.ContrastModeDisplay ) @@ -586,12 +586,12 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, if( draw_mode & GR_SURBRILL ) { if( draw_mode & GR_AND ) - color &= ~HIGHT_LIGHT_FLAG; + color &= ~HIGHLIGHT_FLAG; else - color |= HIGHT_LIGHT_FLAG; + color |= HIGHLIGHT_FLAG; } - if( color & HIGHT_LIGHT_FLAG ) + if( color & HIGHLIGHT_FLAG ) color = ColorRefs[color & MASKCOLOR].m_LightColor; SetAlpha( &color, 150 ); @@ -772,7 +772,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, color = brd->GetVisibleElementColor(VIAS_VISIBLE + m_Shape); if( brd->IsElementVisible( PCB_VISIBLE(VIAS_VISIBLE + m_Shape) ) == false - && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG ) + && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG ) return; if( DisplayOpt.ContrastModeDisplay ) @@ -787,12 +787,12 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, if( draw_mode & GR_SURBRILL ) { if( draw_mode & GR_AND ) - color &= ~HIGHT_LIGHT_FLAG; + color &= ~HIGHLIGHT_FLAG; else - color |= HIGHT_LIGHT_FLAG; + color |= HIGHLIGHT_FLAG; } - if( color & HIGHT_LIGHT_FLAG ) + if( color & HIGHLIGHT_FLAG ) color = ColorRefs[color & MASKCOLOR].m_LightColor; SetAlpha( &color, 150 ); diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 94faf2d8c8..017bf841bb 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -22,8 +22,8 @@ class TRACK : public BOARD_CONNECTED_ITEM // make SetNext() and SetBack() private so that they may not be called from anywhere. // list management is done on TRACKs using DLIST only. private: - void SetNext( EDA_BaseStruct* aNext ) { Pnext = aNext; } - void SetBack( EDA_BaseStruct* aBack ) { Pback = aBack; } + void SetNext( EDA_ITEM* aNext ) { Pnext = aNext; } + void SetBack( EDA_ITEM* aBack ) { Pback = aBack; } public: @@ -211,7 +211,7 @@ public: * Function DisplayInfo * has knowledge about the frame and how and where to put status information * about this object into the frame's message panel. - * Is virtual from EDA_BaseStruct. + * Is virtual from EDA_ITEM. * Display info about the track segment and the full track length * @param frame A WinEDA_DrawFrame in which to print status information. */ @@ -236,7 +236,7 @@ public: * Function Visit * is re-implemented here because TRACKs and SEGVIAs are in the same list * within BOARD. If that were not true, then we could inherit the - * version from EDA_BaseStruct. This one does not iterate through scanTypes + * version from EDA_ITEM. This one does not iterate through scanTypes * but only looks at the first item in the list. * @param inspector An INSPECTOR instance to use in the inspection. * @param testData Arbitrary data used by the inspector. diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 313d3c43a1..93dc609d54 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -452,7 +452,7 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con int color = brd->GetLayerColor(m_Layer); if( brd->IsLayerVisible( m_Layer ) == false && - ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG ) + ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG ) return; GRSetDrawMode( DC, draw_mode ); @@ -469,11 +469,11 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con if( draw_mode & GR_SURBRILL ) { if( draw_mode & GR_AND ) - color &= ~HIGHT_LIGHT_FLAG; + color &= ~HIGHLIGHT_FLAG; else - color |= HIGHT_LIGHT_FLAG; + color |= HIGHLIGHT_FLAG; } - if( color & HIGHT_LIGHT_FLAG ) + if( color & HIGHLIGHT_FLAG ) color = ColorRefs[color & MASKCOLOR].m_LightColor; SetAlpha( &color, 150 ); @@ -549,7 +549,7 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; int color = brd->GetLayerColor(m_Layer); - if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHT_LIGHT_FLAG ) != HIGHT_LIGHT_FLAG ) + if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG ) return; GRSetDrawMode( DC, aDrawMode ); @@ -566,11 +566,11 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, if( aDrawMode & GR_SURBRILL ) { if( aDrawMode & GR_AND ) - color &= ~HIGHT_LIGHT_FLAG; + color &= ~HIGHLIGHT_FLAG; else - color |= HIGHT_LIGHT_FLAG; + color |= HIGHLIGHT_FLAG; } - if( color & HIGHT_LIGHT_FLAG ) + if( color & HIGHLIGHT_FLAG ) color = ColorRefs[color & MASKCOLOR].m_LightColor; SetAlpha( &color, 150 ); diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index cc702a4cad..6d0caaf499 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -127,12 +127,12 @@ const KICAD_T GENERAL_COLLECTOR::Tracks[] = { * function PcbGeneralLocateAndDisplay() would find, except that it keeps all * that it finds and does not do any displaying. * - * @param testItem An EDA_BaseStruct to examine. + * @param testItem An EDA_ITEM to examine. * @param notUsed The const void* testData. * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan, * else SCAN_CONTINUE; */ -SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* notUsed ) +SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* notUsed ) { BOARD_ITEM* item = (BOARD_ITEM*) testItem; MODULE* module = NULL; @@ -390,7 +390,7 @@ void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const KICAD_T aScanList[], // see collectors.h -SEARCH_RESULT TYPE_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* testData ) +SEARCH_RESULT TYPE_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testData ) { // The Vist() function only visits the testItem if its type was in the // the scanList, so therefore we can collect anything given to us here. diff --git a/pcbnew/collectors.h b/pcbnew/collectors.h index 906676e81a..6207ab429b 100644 --- a/pcbnew/collectors.h +++ b/pcbnew/collectors.h @@ -294,7 +294,7 @@ public: /** * Function operator[int] * overloads COLLECTOR::operator[](int) to return a BOARD_ITEM* instead of - * an EDA_BaseStruct* type. + * an EDA_ITEM* type. * @param ndx The index into the list. * @return BOARD_ITEM* - or something derived from it, or NULL. */ @@ -318,12 +318,12 @@ public: * is the examining function within the INSPECTOR which is passed to the * Iterate function. * - * @param testItem An EDA_BaseStruct to examine. + * @param testItem An EDA_ITEM to examine. * @param testData is not used in this class. * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan, * else SCAN_CONTINUE; */ - SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData ); + SEARCH_RESULT Inspect( EDA_ITEM* testItem, const void* testData ); /** @@ -553,7 +553,7 @@ public: /** * Function operator[int] * overloads COLLECTOR::operator[](int) to return a BOARD_ITEM* instead of - * an EDA_BaseStruct* type. + * an EDA_ITEM* type. * @param ndx The index into the list. * @return BOARD_ITEM* - or something derived from it, or NULL. */ @@ -570,12 +570,12 @@ public: * is the examining function within the INSPECTOR which is passed to the * Iterate function. * - * @param testItem An EDA_BaseStruct to examine. + * @param testItem An EDA_ITEM to examine. * @param testData is not used in this class. * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan, * else SCAN_CONTINUE; */ - SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData ); + SEARCH_RESULT Inspect( EDA_ITEM* testItem, const void* testData ); /** diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index a04d7c12a6..d830df5007 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -320,7 +320,8 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) if( GetScreen()->m_BlockLocate.m_State != STATE_NO_BLOCK ) keep_on_grid = TRUE; - EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); + EDA_ITEM* DrawStruct = GetScreen()->GetCurItem(); + if( DrawStruct && DrawStruct->m_Flags ) keep_on_grid = TRUE; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 6b556fe266..ee669c802a 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -25,9 +25,7 @@ // Uncomment following line to enable wxBell() command (which beeps speaker) // #include -static void Process_Move_Item( WinEDA_PcbFrame* frame, - EDA_BaseStruct* DrawStruct, wxDC* DC ); - +static void Process_Move_Item( WinEDA_PcbFrame* frame, EDA_ITEM* DrawStruct, wxDC* DC ); /* Handles the selection of command events. */ @@ -1050,8 +1048,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) } -static void Process_Move_Item( WinEDA_PcbFrame* frame, - EDA_BaseStruct* DrawStruct, wxDC* DC ) +static void Process_Move_Item( WinEDA_PcbFrame* frame, EDA_ITEM* DrawStruct, wxDC* DC ) { if( DrawStruct == NULL ) return; @@ -1202,7 +1199,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer ) } } - EDA_BaseStruct* current = GetScreen()->GetCurItem(); + EDA_ITEM* current = GetScreen()->GetCurItem(); // See if we are drawing a segment; if so, add a via? if( m_ID_current_state == ID_TRACK_BUTT && current != NULL ) diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index c6fb628acc..8d4ea9e163 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -85,8 +85,8 @@ static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) void WinEDA_PcbFrame::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) { - EDA_BaseStruct* PtStruct; - int track_fill_copy = DisplayOpt.DisplayDrawItems; + EDA_ITEM* PtStruct; + int track_fill_copy = DisplayOpt.DisplayDrawItems; if( Segment == NULL ) return; diff --git a/pcbnew/editmod.cpp b/pcbnew/editmod.cpp index 075c139b3a..01ff075746 100644 --- a/pcbnew/editmod.cpp +++ b/pcbnew/editmod.cpp @@ -59,9 +59,9 @@ void WinEDA_PcbFrame::InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ) */ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod ) { - wxPoint moveVector; - EDA_BaseStruct* PtStruct; - D_PAD* pt_pad; + wxPoint moveVector; + EDA_ITEM* PtStruct; + D_PAD* pt_pad; if( pt_mod == NULL ) return; @@ -77,6 +77,7 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod ) /* Update the pad coordinates. */ pt_pad = (D_PAD*) pt_mod->m_Pads; + for( ; pt_pad != NULL; pt_pad = pt_pad->Next() ) { pt_pad->m_Pos0 += moveVector; @@ -84,6 +85,7 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod ) /* Update the draw element coordinates. */ PtStruct = pt_mod->m_Drawings; + for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { switch( PtStruct->Type() ) @@ -110,7 +112,7 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod ) } -void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item ) +void WinEDA_ModuleEditFrame::RemoveStruct( EDA_ITEM* Item ) { if( Item == NULL ) return; diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index 3ab32f5b5b..5f05d17d6e 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -286,7 +286,7 @@ void WinEDA_PcbFrame::Affiche_Status_Net( wxDC* DC ) * The net edge pad with mouse or module locates the mouse. * Delete if the ratsnest if no module or pad is selected. */ -void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ) +void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC ) { D_PAD* pt_pad = NULL; MODULE* Module = NULL; diff --git a/pcbnew/export_gencad.cpp b/pcbnew/export_gencad.cpp index 783f16654e..fb8da56b14 100644 --- a/pcbnew/export_gencad.cpp +++ b/pcbnew/export_gencad.cpp @@ -818,10 +818,10 @@ void CreateTracksInfoData( FILE* file, BOARD* pcb ) */ void FootprintWriteShape( FILE* file, MODULE* module ) { - EDGE_MODULE* edge; - EDA_BaseStruct* item; - int y_axis_sign = -1; // Control Y axis change sign (as normal - // module / mirror axis and conventions) + EDGE_MODULE* edge; + EDA_ITEM* item; + int y_axis_sign = -1; // Control Y axis change sign (as normal + // module / mirror axis and conventions) /* creates header: */ fprintf( file, "SHAPE %s\n", CONV_TO_UTF8( module->m_Reference->m_Text ) ); diff --git a/pcbnew/export_vrml.cpp b/pcbnew/export_vrml.cpp index 5fa5b93e17..de413ba8a5 100644 --- a/pcbnew/export_vrml.cpp +++ b/pcbnew/export_vrml.cpp @@ -688,9 +688,7 @@ static void export_vrml_pcbtext( TEXTE_PCB* text ) /*{{{*/ static void export_vrml_drawings( BOARD* pcb ) /*{{{*/ { /* draw graphic items */ - for( EDA_BaseStruct* drawing = pcb->m_Drawings; - drawing != 0; - drawing = drawing->Next() ) + for( EDA_ITEM* drawing = pcb->m_Drawings; drawing != 0; drawing = drawing->Next() ) { switch( drawing->Type() ) { @@ -995,10 +993,9 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule, /* Reference and value */ export_vrml_text_module( aModule->m_Reference ); export_vrml_text_module( aModule->m_Value ); + /* Export module edges */ - for( EDA_BaseStruct* item = aModule->m_Drawings; - item != NULL; - item = item->Next() ) + for( EDA_ITEM* item = aModule->m_Drawings; item != NULL; item = item->Next() ) { switch( item->Type() ) { diff --git a/pcbnew/gen_drill_report_files.cpp b/pcbnew/gen_drill_report_files.cpp index 0fd9d56c52..8a304150b5 100644 --- a/pcbnew/gen_drill_report_files.cpp +++ b/pcbnew/gen_drill_report_files.cpp @@ -29,18 +29,17 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, bool aUnit_Drill_is_Inch, int format, const wxPoint& auxoffset ) { - int x, y; - int plotX, plotY, TextWidth; - double scale = 1.0; - int intervalle = 0, CharSize = 0; - EDA_BaseStruct* PtStruct; - char line[1024]; - int dX, dY; - wxPoint BoardCentre; - wxPoint offset; - wxString msg; - PLOTTER* plotter = NULL; - + int x, y; + int plotX, plotY, TextWidth; + double scale = 1.0; + int intervalle = 0, CharSize = 0; + EDA_ITEM* PtStruct; + char line[1024]; + int dX, dY; + wxPoint BoardCentre; + wxPoint offset; + wxString msg; + PLOTTER* plotter = NULL; SetLocaleTo_C_standard(); // Use the standard notation for float numbers /* Calculate dimensions and center of PCB */ diff --git a/pcbnew/gen_modules_placefile.cpp b/pcbnew/gen_modules_placefile.cpp index ea88262ea4..1dd478dc5f 100644 --- a/pcbnew/gen_modules_placefile.cpp +++ b/pcbnew/gen_modules_placefile.cpp @@ -451,11 +451,13 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event ) } /* Write board Edges */ - EDA_BaseStruct* PtStruct; + EDA_ITEM* PtStruct; + for( PtStruct = GetBoard()->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() ) { if( PtStruct->Type() != TYPE_DRAWSEGMENT ) continue; + if( ( (DRAWSEGMENT*) PtStruct )->GetLayer() != EDGE_N ) continue; WriteDrawSegmentPcb( (DRAWSEGMENT*) PtStruct, rptfile ); diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 468e67ef4c..bbf1cc5521 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -25,9 +25,9 @@ * Some commands are relatives to the item under the mouse cursor * @param aDC = current device context * @param hotkey = hotkey code (ascii or wxWidget code for special keys) - * @param aItem = NULL or pointer on a EDA_BaseStruct under the mouse cursor + * @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor */ -void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, EDA_BaseStruct* aItem ) +void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, EDA_ITEM* aItem ) { if( aHotkeyCode == 0 ) return; diff --git a/pcbnew/hotkeys_module_editor.cpp b/pcbnew/hotkeys_module_editor.cpp index e78179221d..506edf4199 100644 --- a/pcbnew/hotkeys_module_editor.cpp +++ b/pcbnew/hotkeys_module_editor.cpp @@ -21,7 +21,7 @@ /*****************************************************************************************/ -void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey, EDA_BaseStruct* DrawStruct ) +void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int hotkey, EDA_ITEM* DrawStruct ) /*****************************************************************************************/ /* Hot keys. Some commands are relative to the item under the mouse cursor diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index 7961b4e2a8..174f09b426 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -702,8 +702,8 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard ) bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File ) { - EDA_BaseStruct* PtStruct = GetBoard()->m_Modules; - int NbModules, NbDrawItem, NbLayers; + EDA_ITEM* PtStruct = GetBoard()->m_Modules; + int NbModules, NbDrawItem, NbLayers; /* Write copper layer count */ NbLayers = GetBoard()->GetCopperLayerCount(); diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index 5cd9b1b1c4..4c18143282 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -31,6 +31,7 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode ) if( GetBoard()->m_Modules == NULL ) return NULL; + GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide(); // Assign to scanList the proper item types desired based on tool type @@ -704,6 +705,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) } SetToolbars(); + if( redraw ) DrawPanel->Refresh(); } @@ -717,11 +719,11 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) */ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform ) { - D_PAD* pad = module->m_Pads; - EDA_BaseStruct* PtStruct = module->m_Drawings; - TEXTE_MODULE* textmod; - EDGE_MODULE* edgemod; - int angle = 900; // Necessary +- 900 (+- 90 degrees) ) + D_PAD* pad = module->m_Pads; + EDA_ITEM* PtStruct = module->m_Drawings; + TEXTE_MODULE* textmod; + EDGE_MODULE* edgemod; + int angle = 900; // Necessary +- 900 (+- 90 degrees) ) switch( transform ) { diff --git a/pcbnew/modedit_undo_redo.cpp b/pcbnew/modedit_undo_redo.cpp index 0a1189ba04..f1e90f267a 100644 --- a/pcbnew/modedit_undo_redo.cpp +++ b/pcbnew/modedit_undo_redo.cpp @@ -25,7 +25,7 @@ void WinEDA_ModuleEditFrame::SaveCopyInUndoList( BOARD_ITEM* aItem, UndoRedoOpType aTypeCommand, const wxPoint& aTransformPoint ) { - EDA_BaseStruct* item; + EDA_ITEM* item; MODULE* CopyItem; PICKED_ITEMS_LIST* lastcmd; diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h index 4d37ebfd25..7d6e00576c 100644 --- a/pcbnew/module_editor_frame.h +++ b/pcbnew/module_editor_frame.h @@ -40,7 +40,7 @@ public: void ReCreateMenuBar(); void ToolOnRightClick( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event ); - void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); + void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ); bool OnHotkeyEditItem( int aIdCommand ); bool OnHotkeyDeleteItem( int aIdCommand ); bool OnHotkeyMoveItem( int aIdCommand ); @@ -138,7 +138,7 @@ public: // Footprint edition void Place_Ancre( MODULE* module ); - void RemoveStruct( EDA_BaseStruct* Item ); + void RemoveStruct( EDA_ITEM* Item ); void Transform( MODULE* module, int transform ); // importing / exporting Footprint diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 6847e15fc8..c57c852b2d 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -63,6 +63,7 @@ extern int g_DrawDefaultLineThickness; #define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" ) #define SHOW_LAYER_MANAGER_TOOLS wxT( "ShowLayerManagerTools" ) + BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, WinEDA_PcbFrame::OnSockRequestServer ) EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_PcbFrame::OnSockRequest ) @@ -80,8 +81,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) EVT_TOOL( ID_MENU_RECOVER_BOARD, WinEDA_PcbFrame::Files_io ) EVT_TOOL( ID_NEW_BOARD, WinEDA_PcbFrame::Files_io ) EVT_TOOL( ID_SAVE_BOARD, WinEDA_PcbFrame::Files_io ) - EVT_TOOL( ID_OPEN_MODULE_EDITOR, - WinEDA_PcbFrame::Process_Special_Functions ) + EVT_TOOL( ID_OPEN_MODULE_EDITOR, WinEDA_PcbFrame::Process_Special_Functions ) // Menu Files: EVT_MENU( ID_MAIN_MENUBAR, WinEDA_PcbFrame::Process_Special_Functions ) @@ -97,19 +97,14 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) EVT_MENU( ID_GEN_EXPORT_SPECCTRA, WinEDA_PcbFrame::ExportToSpecctra ) EVT_MENU( ID_GEN_EXPORT_FILE_GENCADFORMAT, WinEDA_PcbFrame::ExportToGenCAD ) - EVT_MENU( ID_GEN_EXPORT_FILE_MODULE_REPORT, - WinEDA_PcbFrame::GenModuleReport ) + EVT_MENU( ID_GEN_EXPORT_FILE_MODULE_REPORT, WinEDA_PcbFrame::GenModuleReport ) EVT_MENU( ID_GEN_EXPORT_FILE_VRML, WinEDA_PcbFrame::OnExportVRML ) - EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION, - WinEDA_PcbFrame::ImportSpecctraSession ) - EVT_MENU( ID_GEN_IMPORT_SPECCTRA_DESIGN, - WinEDA_PcbFrame::ImportSpecctraDesign ) + EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION,WinEDA_PcbFrame::ImportSpecctraSession ) + EVT_MENU( ID_GEN_IMPORT_SPECCTRA_DESIGN, WinEDA_PcbFrame::ImportSpecctraDesign ) - EVT_MENU( ID_MENU_ARCHIVE_NEW_MODULES, - WinEDA_PcbFrame::Process_Special_Functions ) - EVT_MENU( ID_MENU_ARCHIVE_ALL_MODULES, - WinEDA_PcbFrame::Process_Special_Functions ) + EVT_MENU( ID_MENU_ARCHIVE_NEW_MODULES, WinEDA_PcbFrame::Process_Special_Functions ) + EVT_MENU( ID_MENU_ARCHIVE_ALL_MODULES, WinEDA_PcbFrame::Process_Special_Functions ) EVT_MENU( wxID_EXIT, WinEDA_PcbFrame::OnQuit ) @@ -121,34 +116,29 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, WinEDA_PcbFrame::Process_Config ) - EVT_MENU( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, - WinEDA_PcbFrame::Process_Config ) + EVT_MENU( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_LAYERS_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_MASK_CLEARANCE, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_CONFIG_SAVE, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_CONFIG_READ, WinEDA_PcbFrame::Process_Config ) - EVT_MENU( ID_PCB_DISPLAY_OPTIONS_SETUP, - WinEDA_PcbFrame::InstallDisplayOptionsDialog ) + EVT_MENU( ID_PCB_DISPLAY_OPTIONS_SETUP, WinEDA_PcbFrame::InstallDisplayOptionsDialog ) EVT_MENU( ID_PCB_USER_GRID_SETUP, WinEDA_PcbFrame::Process_Special_Functions ) - EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, - WinEDA_PcbFrame::SetLanguage ) + EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, WinEDA_PcbFrame::SetLanguage ) // menu Postprocess EVT_MENU( ID_PCB_GEN_POS_MODULES_FILE, WinEDA_PcbFrame::GenModulesPosition ) EVT_MENU( ID_PCB_GEN_DRILL_FILE, WinEDA_PcbFrame::InstallDrillFrame ) EVT_MENU( ID_PCB_GEN_CMP_FILE, WinEDA_PcbFrame::RecreateCmpFileFromBoard ) - EVT_MENU( ID_PCB_GEN_BOM_FILE_FROM_BOARD, - WinEDA_PcbFrame::RecreateBOMFileFromBoard ) + EVT_MENU( ID_PCB_GEN_BOM_FILE_FROM_BOARD, WinEDA_PcbFrame::RecreateBOMFileFromBoard ) // menu Miscellaneous EVT_MENU( ID_MENU_LIST_NETS, WinEDA_PcbFrame::ListNetsAndSelect ) EVT_MENU( ID_PCB_GLOBAL_DELETE, WinEDA_PcbFrame::Process_Special_Functions ) EVT_MENU( ID_MENU_PCB_CLEAN, WinEDA_PcbFrame::Process_Special_Functions ) - EVT_MENU( ID_MENU_PCB_SWAP_LAYERS, - WinEDA_PcbFrame::Process_Special_Functions ) + EVT_MENU( ID_MENU_PCB_SWAP_LAYERS, WinEDA_PcbFrame::Process_Special_Functions ) // Menu Help EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp ) @@ -158,8 +148,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_PcbFrame::Show3D_Frame ) // Menu Get Design Rules Editor - EVT_MENU( ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, - WinEDA_PcbFrame::ShowDesignRulesEditor ) + EVT_MENU( ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, WinEDA_PcbFrame::ShowDesignRulesEditor ) // Horizontal toolbar EVT_TOOL( ID_TO_LIBRARY, WinEDA_PcbFrame::Process_Special_Functions ) @@ -175,20 +164,15 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) EVT_TOOL( ID_FIND_ITEMS, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_GET_NETLIST, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_DRC_CONTROL, WinEDA_PcbFrame::Process_Special_Functions ) - EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, - WinEDA_PcbFrame::Process_Special_Functions ) - EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, - WinEDA_PcbFrame::Tracks_and_Vias_Size_Event ) - EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER, - WinEDA_PcbFrame::Process_Special_Functions ) + EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, WinEDA_PcbFrame::Process_Special_Functions ) + EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, WinEDA_PcbFrame::Tracks_and_Vias_Size_Event ) + EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER, WinEDA_PcbFrame::Process_Special_Functions ) EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, WinEDA_PcbFrame::Tracks_and_Vias_Size_Event ) - EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE, - WinEDA_PcbFrame::Tracks_and_Vias_Size_Event ) + EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE, WinEDA_PcbFrame::Tracks_and_Vias_Size_Event ) EVT_TOOL( ID_TOOLBARH_PCB_MODE_MODULE, WinEDA_PcbFrame::AutoPlace ) EVT_TOOL( ID_TOOLBARH_PCB_MODE_TRACKS, WinEDA_PcbFrame::AutoPlace ) - EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, - WinEDA_PcbFrame::Access_to_External_Tool ) + EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, WinEDA_PcbFrame::Access_to_External_Tool ) // Option toolbar EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END, @@ -198,8 +182,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) // Vertical toolbar: EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) - EVT_TOOL( ID_PCB_HIGHLIGHT_BUTT, - WinEDA_PcbFrame::Process_Special_Functions ) + EVT_TOOL( ID_PCB_HIGHLIGHT_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_COMPONENT_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_TRACK_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_PCB_ZONES_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) @@ -209,17 +192,13 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) EVT_TOOL( ID_PCB_ADD_TEXT_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_PCB_ADD_LINE_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_PCB_DIMENSION_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) - EVT_TOOL( ID_PCB_DELETE_ITEM_BUTT, - WinEDA_PcbFrame::Process_Special_Functions ) - EVT_TOOL( ID_PCB_SHOW_1_RATSNEST_BUTT, - WinEDA_PcbFrame::Process_Special_Functions ) - EVT_TOOL( ID_PCB_PLACE_OFFSET_COORD_BUTT, - WinEDA_PcbFrame::Process_Special_Functions ) + EVT_TOOL( ID_PCB_DELETE_ITEM_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) + EVT_TOOL( ID_PCB_SHOW_1_RATSNEST_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) + EVT_TOOL( ID_PCB_PLACE_OFFSET_COORD_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD, WinEDA_PcbFrame::ProcessMuWaveFunctions ) - EVT_TOOL( ID_PCB_PLACE_GRID_COORD_BUTT, - WinEDA_PcbFrame::Process_Special_Functions ) + EVT_TOOL( ID_PCB_PLACE_GRID_COORD_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL_RCLICKED( ID_TRACK_BUTT, WinEDA_PcbFrame::ToolOnRightClick ) EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::ToolOnRightClick ) @@ -233,9 +212,8 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) ID_POPUP_PCB_AUTOPLACE_END_RANGE, WinEDA_PcbFrame::AutoPlace ) - EVT_MENU( ID_POPUP_PCB_REORIENT_ALL_MODULES, - WinEDA_PcbFrame::OnOrientFootprints ) - + EVT_MENU( ID_POPUP_PCB_REORIENT_ALL_MODULES, WinEDA_PcbFrame::OnOrientFootprints ) + EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE, WinEDA_PcbFrame::Process_Special_Functions ) @@ -245,8 +223,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) WinEDA_PcbFrame::Tracks_and_Vias_Size_Event ) // popup menus - EVT_MENU( ID_POPUP_PCB_DELETE_TRACKSEG, - WinEDA_PcbFrame::Process_Special_Functions ) + EVT_MENU( ID_POPUP_PCB_DELETE_TRACKSEG, WinEDA_PcbFrame::Process_Special_Functions ) EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, WinEDA_PcbFrame::Process_Special_Functions ) diff --git a/pcbnew/plot_rtn.cpp b/pcbnew/plot_rtn.cpp index b476a97efc..2553653385 100644 --- a/pcbnew/plot_rtn.cpp +++ b/pcbnew/plot_rtn.cpp @@ -26,9 +26,9 @@ void WinEDA_BasePcbFrame::Plot_Serigraphie( PLOTTER* plotter, int masque_layer, GRTraceMode trace_mode ) { - bool trace_val, trace_ref; - TEXTE_MODULE* pt_texte; - EDA_BaseStruct* PtStruct; + bool trace_val, trace_ref; + TEXTE_MODULE* pt_texte; + EDA_ITEM* PtStruct; /* Plot edge layer and graphic items */ diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index b6ef466414..b67a59182f 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -320,10 +320,10 @@ static void Print_Module( WinEDA_DrawPanel* aPanel, wxDC* aDC, MODULE* aModule, int aDraw_mode, int aMasklayer, PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt ) { - D_PAD* pt_pad; - EDA_BaseStruct* PtStruct; - TEXTE_MODULE* TextMod; - int mlayer; + D_PAD* pt_pad; + EDA_ITEM* PtStruct; + TEXTE_MODULE* TextMod; + int mlayer; /* Print pads */ pt_pad = aModule->m_Pads; diff --git a/pcbnew/protos.h b/pcbnew/protos.h index d60eaeb49e..f6e19ed1eb 100644 --- a/pcbnew/protos.h +++ b/pcbnew/protos.h @@ -262,11 +262,10 @@ TRACK* Marque_Une_Piste( BOARD* aPcb, * And EndTrack-> fx, fy if OK * The segments are drawn consecutively. */ -int ReturnEndsTrack( TRACK* RefTrack, int NbSegm, - TRACK** StartTrack, TRACK** EndTrack ); +int ReturnEndsTrack( TRACK* RefTrack, int NbSegm, TRACK** StartTrack, TRACK** EndTrack ); /* Update the state of a list of structures. */ -void ListSetState( EDA_BaseStruct* Start, int Nbitem, int State, int onoff ); +void ListSetState( EDA_ITEM* Start, int Nbitem, int State, int onoff ); /************/ diff --git a/pcbnew/swap_layers.cpp b/pcbnew/swap_layers.cpp index f084125f7e..fcd0931001 100644 --- a/pcbnew/swap_layers.cpp +++ b/pcbnew/swap_layers.cpp @@ -337,10 +337,10 @@ void WinEDA_SwapLayerFrame::OnOkClick( wxCommandEvent& event ) void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event ) { - int ii, jj; - TRACK* pt_segm; - DRAWSEGMENT* pt_drawsegm; - EDA_BaseStruct* PtStruct; + int ii, jj; + TRACK* pt_segm; + DRAWSEGMENT* pt_drawsegm; + EDA_ITEM* PtStruct; /* Init default values */ for( ii = 0; ii < NB_LAYERS; ii++ ) diff --git a/pcbnew/tool_modedit.cpp b/pcbnew/tool_modedit.cpp index e459cccc08..37e78d7365 100644 --- a/pcbnew/tool_modedit.cpp +++ b/pcbnew/tool_modedit.cpp @@ -266,9 +266,11 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar() wxSize( LISTBOX_WIDTH, -1 ) ); msg = _( "Auto" ); m_SelZoomBox->Append( msg ); + for( int i = 0; i < (int)GetScreen()->m_ZoomList.GetCount(); i++ ) { msg = _( "Zoom " ); + if ( GetScreen()->m_ZoomList[i] % GetScreen()->m_ZoomScalar == 0 ) msg << GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar; else @@ -279,24 +281,26 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar() GetScreen()->m_ZoomScalar ); msg += value; } + m_SelZoomBox->Append( msg ); } m_AuxiliaryToolBar->AddControl( m_SelZoomBox ); - // after adding the buttons to the toolbar, must call Realize() to - // reflect the changes + // after adding the buttons to the toolbar, must call Realize() to reflect the changes m_AuxiliaryToolBar->Realize(); } // Update tool bar to reflect setting. m_SelGridBox->Clear(); - for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ ) + + for( i = 0; i < GetScreen()->GetGridCount(); i++ ) { double value = To_User_Unit( g_UserUnit, - GetScreen()->m_GridList[i].m_Size.x, + GetScreen()->GetGrid( i ).m_Size.x, PCB_INTERNAL_UNIT ); - if( GetScreen()->m_GridList[i].m_Id != ID_POPUP_GRID_USER ) + + if( GetScreen()->GetGrid( i ).m_Id != ID_POPUP_GRID_USER ) { switch( g_UserUnit ) { @@ -318,9 +322,9 @@ void WinEDA_ModuleEditFrame::ReCreateAuxiliaryToolbar() msg = _( "User Grid" ); } - m_SelGridBox->Append( msg, (void*) &GetScreen()->m_GridList[i].m_Id ); + m_SelGridBox->Append( msg, (void*) &GetScreen()->GetGrid( i ).m_Id ); - if( m_LastGridSizeId == GetScreen()->m_GridList[i].m_Id ) + if( m_LastGridSizeId == GetScreen()->GetGrid( i ).m_Id ) m_SelGridBox->SetSelection( i ); } } diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 61704ae5e8..a217f18b63 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -652,11 +652,11 @@ an existing track use its width\notherwise, use current width setting" ), break; } - for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ ) + for( i = 0; i < GetScreen()->GetGridCount(); i++ ) { - GRID_TYPE grid = GetScreen()->m_GridList[i]; - double value = To_User_Unit( g_UserUnit, grid.m_Size.x, - m_InternalUnits ); + GRID_TYPE& grid = GetScreen()->GetGrid( i ); + double value = To_User_Unit( g_UserUnit, grid.m_Size.x, m_InternalUnits ); + if( grid.m_Id != ID_POPUP_GRID_USER ) { switch( g_UserUnit ) @@ -674,13 +674,13 @@ an existing track use its width\notherwise, use current width setting" ), else msg = _( "User Grid" ); - m_SelGridBox->Append( msg, (void*) &GetScreen()->m_GridList[i].m_Id ); + m_SelGridBox->Append( msg, (void*) &grid.m_Id ); - if( m_LastGridSizeId == GetScreen()->m_GridList[i].m_Id ) + if( m_LastGridSizeId == GetScreen()->GetGrid( i ).m_Id ) m_SelGridBox->SetSelection( i ); } - m_TrackAndViasSizesList_Changed = true; + m_TrackAndViasSizesList_Changed = true; m_AuxiliaryToolBar->AddSeparator(); } diff --git a/pcbnew/track.cpp b/pcbnew/track.cpp index 93a3d81ac1..280b396a12 100644 --- a/pcbnew/track.cpp +++ b/pcbnew/track.cpp @@ -533,7 +533,7 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm, /* Set to onoff the .m_State member, bit mask State of a list of items */ -void ListSetState( EDA_BaseStruct* Start, int NbItem, int State, int onoff ) +void ListSetState( EDA_ITEM* Start, int NbItem, int State, int onoff ) { if( Start == NULL ) return;