Commit 1b5baa6b authored by charras's avatar charras

removed a minor bug in eeschema introduced in my recent commit. Added comments

parent 4a489895
...@@ -71,6 +71,10 @@ int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const ...@@ -71,6 +71,10 @@ int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
} }
/** Function Last
* returns a pointer to the last sheet of the list
* One can see the others sheet as the "path" to reach this last sheet
*/
DrawSheetStruct* DrawSheetPath::Last() DrawSheetStruct* DrawSheetPath::Last()
{ {
if( m_numSheets ) if( m_numSheets )
...@@ -79,6 +83,9 @@ DrawSheetStruct* DrawSheetPath::Last() ...@@ -79,6 +83,9 @@ DrawSheetStruct* DrawSheetPath::Last()
} }
/** Function LastScreen
* @return the SCH_SCREEN relative to the last sheet in list
*/
SCH_SCREEN* DrawSheetPath::LastScreen() SCH_SCREEN* DrawSheetPath::LastScreen()
{ {
if( m_numSheets ) if( m_numSheets )
...@@ -87,7 +94,11 @@ SCH_SCREEN* DrawSheetPath::LastScreen() ...@@ -87,7 +94,11 @@ SCH_SCREEN* DrawSheetPath::LastScreen()
} }
EDA_BaseStruct* DrawSheetPath::LastDrawList() /** Function LastScreen
* @return a pointer to the first schematic item handled by the
* SCH_SCREEN relative to the last sheet in list
*/
SCH_ITEM* DrawSheetPath::LastDrawList()
{ {
if( m_numSheets && m_sheets[m_numSheets - 1]->m_AssociatedScreen ) if( m_numSheets && m_sheets[m_numSheets - 1]->m_AssociatedScreen )
return m_sheets[m_numSheets - 1]->m_AssociatedScreen->EEDrawList; return m_sheets[m_numSheets - 1]->m_AssociatedScreen->EEDrawList;
......
...@@ -47,10 +47,17 @@ ...@@ -47,10 +47,17 @@
*/ */
/***************************************************/ /****************************************/
/* class to handle a and acces to series of sheets */ /* class to handle and acces to a sheet */
/* a 'path' so to speak.. **************************/ /* a 'path' so to speak.. */
/***************************************************/ /****************************************/
/*
* The member m_sheets stores the list of sheets from the first (usually g_RootSheet)
* to a given sheet in last position.
* The last sheet is usually the sheet we want to select or reach. So Last() return this last sheet
* Others sheets are the "path" from the first to the last sheet
*/
class DrawSheetPath class DrawSheetPath
{ {
public: public:
...@@ -59,6 +66,7 @@ public: ...@@ -59,6 +66,7 @@ public:
#define DSLSZ 32 // Max number of levels for a sheet path #define DSLSZ 32 // Max number of levels for a sheet path
DrawSheetStruct* m_sheets[DSLSZ]; DrawSheetStruct* m_sheets[DSLSZ];
public:
DrawSheetPath(); DrawSheetPath();
~DrawSheetPath() { }; ~DrawSheetPath() { };
void Clear() { m_numSheets = 0; } void Clear() { m_numSheets = 0; }
...@@ -69,19 +77,37 @@ public: ...@@ -69,19 +77,37 @@ public:
* @return -1 if differents, 0 if same * @return -1 if differents, 0 if same
*/ */
int Cmp( const DrawSheetPath& aSheetPathToTest ) const; int Cmp( const DrawSheetPath& aSheetPathToTest ) const;
/** Function Last
* returns a pointer to the last sheet of the list
* One can see the others sheet as the "path" to reach this last sheet
*/
DrawSheetStruct* Last(); DrawSheetStruct* Last();
/** Function LastScreen
* @return the SCH_SCREEN relative to the last sheet in list
*/
SCH_SCREEN* LastScreen(); SCH_SCREEN* LastScreen();
EDA_BaseStruct* LastDrawList();
/** Function LastScreen
* @return a pointer to the first schematic item handled by the
* SCH_SCREEN relative to the last sheet in list
*/
SCH_ITEM* LastDrawList();
/** Function Push /** Function Push
* store (push) aSheet in list * store (push) aSheet in list
* @param aSheet = pointer to the DrawSheetStruct to store in list * @param aSheet = pointer to the DrawSheetStruct to store in list
* Push is used when entered a sheet to select or analyse it
* This is like cd <directory> in directories navigation
*/ */
void Push( DrawSheetStruct* aSheet ); void Push( DrawSheetStruct* aSheet );
/** Function Pop /** Function Pop
* retrieves (pop) the last entered sheet and remove it from list * retrieves (pop) the last entered sheet and remove it from list
* @return a DrawSheetStruct* pointer to the removed sheet in list * @return a DrawSheetStruct* pointer to the removed sheet in list
* Pop is used when leaving a sheet after a selection or analyse
* This is like cd .. in directories navigation
*/ */
DrawSheetStruct* Pop(); DrawSheetStruct* Pop();
...@@ -103,7 +129,7 @@ public: ...@@ -103,7 +129,7 @@ public:
* updates the reference and the m_Multi parameter (part selection) for all * updates the reference and the m_Multi parameter (part selection) for all
* components on a screen depending on the actual sheet path. * components on a screen depending on the actual sheet path.
* Mandatory in complex hierarchies because sheets use the same screen (basic schematic) * Mandatory in complex hierarchies because sheets use the same screen (basic schematic)
* but with different references and part selection according to the displayed sheet * but with different references and part selections according to the displayed sheet
*/ */
void UpdateAllScreenReferences(); void UpdateAllScreenReferences();
...@@ -153,6 +179,7 @@ public: ...@@ -153,6 +179,7 @@ public:
m_List = NULL; m_List = NULL;
} }
/** Function GetCount() /** Function GetCount()
* @return the number of sheets in list: * @return the number of sheets in list:
* usually the number of sheets found in the whole hierarchy * usually the number of sheets found in the whole hierarchy
......
...@@ -289,7 +289,7 @@ wxPoint ReturnPinPhysicalPosition( LibDrawPin* Pin, ...@@ -289,7 +289,7 @@ wxPoint ReturnPinPhysicalPosition( LibDrawPin* Pin,
NEGATE( PinPos.y ); NEGATE( PinPos.y );
else else
PinPos = TransformCoordinate( DrawLibItem->m_Transform, Pin->m_Pos); PinPos = TransformCoordinate( DrawLibItem->m_Transform, Pin->m_Pos) + DrawLibItem->m_Pos;
return PinPos; return PinPos;
} }
......
...@@ -204,16 +204,15 @@ void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list, ...@@ -204,16 +204,15 @@ void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list,
} }
maxposx += m_Tree->GetIndent(); maxposx += m_Tree->GetIndent();
EDA_BaseStruct* bs = list->LastDrawList(); SCH_ITEM* schitem = list->LastDrawList();
while( bs && m_nbsheets < NB_MAX_SHEET ) while( schitem && m_nbsheets < NB_MAX_SHEET )
{ {
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE ) if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
DrawSheetStruct* ss = (DrawSheetStruct*) bs; DrawSheetStruct* sheet = (DrawSheetStruct*) schitem;
m_nbsheets++; m_nbsheets++;
menu = m_Tree->AppendItem( *previousmenu, menu = m_Tree->AppendItem( *previousmenu, sheet->m_SheetName, 0, 1 );
ss->m_SheetName, 0, 1 ); list->Push( sheet );
list->Push( ss );
m_Tree->SetItemData( menu, new TreeItemData( *list ) ); m_Tree->SetItemData( menu, new TreeItemData( *list ) );
int ll = m_Tree->GetItemText( menu ).Len(); int ll = m_Tree->GetItemText( menu ).Len();
#ifdef __WINDOWS__ #ifdef __WINDOWS__
...@@ -233,7 +232,7 @@ void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list, ...@@ -233,7 +232,7 @@ void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list,
m_Tree->Expand( menu ); m_Tree->Expand( menu );
list->Pop(); list->Pop();
} }
bs = bs->Next(); schitem = schitem->Next();
} }
maxposx -= m_Tree->GetIndent(); maxposx -= m_Tree->GetIndent();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment