2008-02-12 21:12:46 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2008-04-15 19:38:19 +00:00
|
|
|
// Name: class_drawsheet.cpp
|
2009-11-04 20:46:53 +00:00
|
|
|
// Purpose: member functions for SCH_SHEET
|
2009-11-03 13:26:31 +00:00
|
|
|
// header = class_drawsheet.h
|
2008-02-12 21:12:46 +00:00
|
|
|
// Author: jean-pierre Charras
|
|
|
|
// Modified by:
|
|
|
|
// Created: 08/02/2006 18:37:02
|
|
|
|
// RCS-ID:
|
2008-04-15 19:38:19 +00:00
|
|
|
// Copyright:
|
2009-11-03 13:26:31 +00:00
|
|
|
// License: License GNU
|
2008-02-12 21:12:46 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
2009-01-29 14:26:20 +00:00
|
|
|
#include "gr_basic.h"
|
2008-02-12 21:12:46 +00:00
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "drawtxt.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
#include "program.h"
|
|
|
|
#include "general.h"
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
|
2008-04-14 19:22:48 +00:00
|
|
|
SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE )
|
2008-02-12 21:12:46 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
m_Label = NULL;
|
|
|
|
m_NbLabel = 0;
|
|
|
|
m_Layer = LAYER_SHEET;
|
|
|
|
m_Pos = pos;
|
|
|
|
m_TimeStamp = GetTimeStamp();
|
2008-02-29 12:33:07 +00:00
|
|
|
m_SheetNameSize = m_FileNameSize = 60;
|
2008-02-26 19:19:54 +00:00
|
|
|
m_AssociatedScreen = NULL;
|
2008-02-29 12:33:07 +00:00
|
|
|
m_SheetName.Printf( wxT( "Sheet%8.8lX" ), m_TimeStamp );
|
|
|
|
m_FileName.Printf( wxT( "file%8.8lX.sch" ), m_TimeStamp );
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET::~SCH_SHEET()
|
2008-02-12 21:12:46 +00:00
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET_PIN* label = m_Label, * next_label;
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
while( label )
|
|
|
|
{
|
2008-04-15 19:38:19 +00:00
|
|
|
next_label = label->Next();
|
2008-02-12 21:12:46 +00:00
|
|
|
delete label;
|
|
|
|
label = next_label;
|
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
// also, look at the associated sheet & its reference count
|
|
|
|
// perhaps it should be deleted also.
|
2008-02-26 19:19:54 +00:00
|
|
|
if( m_AssociatedScreen )
|
|
|
|
{
|
|
|
|
m_AssociatedScreen->m_RefCount--;
|
|
|
|
if( m_AssociatedScreen->m_RefCount == 0 )
|
|
|
|
delete m_AssociatedScreen;
|
|
|
|
}
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
/** Function Save
|
|
|
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
2008-04-15 19:38:19 +00:00
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
bool SCH_SHEET::Save( FILE* aFile ) const
|
2008-04-12 18:39:20 +00:00
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET_PIN* SheetLabel;
|
2008-04-12 18:39:20 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
if( fprintf( aFile, "$Sheet\n" ) == EOF
|
|
|
|
|| fprintf( aFile, "S %-4d %-4d %-4d %-4d\n",
|
|
|
|
m_Pos.x, m_Pos.y, m_Size.x, m_Size.y ) == EOF )
|
|
|
|
return false;
|
2008-04-12 18:39:20 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
//save the unique timestamp, like other schematic parts.
|
2009-12-02 21:44:03 +00:00
|
|
|
if( fprintf( aFile, "U %8.8lX\n", m_TimeStamp ) == EOF )
|
|
|
|
return false;
|
2008-04-12 18:39:20 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
/* Save schematic sheetname and filename. */
|
2008-04-15 19:38:19 +00:00
|
|
|
if( !m_SheetName.IsEmpty() )
|
2008-04-12 18:39:20 +00:00
|
|
|
{
|
2009-01-04 18:52:57 +00:00
|
|
|
if( fprintf( aFile, "F0 \"%s\" %d\n", CONV_TO_UTF8( m_SheetName ),
|
2008-12-05 16:03:05 +00:00
|
|
|
m_SheetNameSize ) == EOF )
|
2009-12-02 21:44:03 +00:00
|
|
|
return false;
|
2008-04-12 18:39:20 +00:00
|
|
|
}
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
if( !m_FileName.IsEmpty() )
|
2008-04-12 18:39:20 +00:00
|
|
|
{
|
2009-01-04 18:52:57 +00:00
|
|
|
if( fprintf( aFile, "F1 \"%s\" %d\n", CONV_TO_UTF8( m_FileName ),
|
2008-12-05 16:03:05 +00:00
|
|
|
m_FileNameSize ) == EOF )
|
2009-12-02 21:44:03 +00:00
|
|
|
return false;
|
2008-04-12 18:39:20 +00:00
|
|
|
}
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
/* Create the list of labels in the sheet. */
|
2008-04-12 18:39:20 +00:00
|
|
|
SheetLabel = m_Label;
|
2008-04-15 19:38:19 +00:00
|
|
|
int l_id = 2;
|
2008-04-12 18:39:20 +00:00
|
|
|
while( SheetLabel != NULL )
|
|
|
|
{
|
2008-04-15 19:38:19 +00:00
|
|
|
SheetLabel->m_Number = l_id;
|
2009-01-04 18:52:57 +00:00
|
|
|
SheetLabel->Save( aFile );
|
2008-04-15 19:38:19 +00:00
|
|
|
l_id++;
|
|
|
|
SheetLabel = SheetLabel->Next();
|
2008-04-12 18:39:20 +00:00
|
|
|
}
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
if( fprintf( aFile, "$EndSheet\n" ) == EOF )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
2008-04-12 18:39:20 +00:00
|
|
|
}
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
/* creates a copy of a sheet
|
|
|
|
* The linked data itself (EEDrawList) is not duplicated
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET* SCH_SHEET::GenCopy()
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET* newitem = new SCH_SHEET( m_Pos );
|
2008-02-12 21:12:46 +00:00
|
|
|
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
newitem->m_Size = m_Size;
|
2008-11-24 06:53:43 +00:00
|
|
|
newitem->SetParent( m_Parent );
|
2008-02-12 21:12:46 +00:00
|
|
|
newitem->m_TimeStamp = GetTimeStamp();
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
newitem->m_FileName = m_FileName;
|
|
|
|
newitem->m_FileNameSize = m_FileNameSize;
|
|
|
|
|
|
|
|
/* newitem->m_SheetName = m_SheetName; m_SheetName must be unique for
|
|
|
|
* all sub sheets in a given sheet
|
|
|
|
* so we no not duplicate sheet
|
|
|
|
* name
|
|
|
|
*/
|
2008-02-12 21:12:46 +00:00
|
|
|
newitem->m_SheetNameSize = m_SheetNameSize;
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
newitem->m_Label = NULL;
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET_PIN* Slabel = NULL, * label = m_Label;
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
if( label )
|
|
|
|
{
|
|
|
|
Slabel = newitem->m_Label = label->GenCopy();
|
2008-11-24 06:53:43 +00:00
|
|
|
Slabel->SetParent( newitem );
|
2008-03-30 16:15:53 +00:00
|
|
|
label = label->Next();
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
while( label )
|
|
|
|
{
|
2008-11-24 06:53:43 +00:00
|
|
|
Slabel->SetNext( label->GenCopy() );
|
|
|
|
Slabel = Slabel->Next();
|
|
|
|
Slabel->SetParent( newitem );
|
2008-03-30 16:15:53 +00:00
|
|
|
label = label->Next();
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
/* don't copy screen data - just reference it. */
|
|
|
|
newitem->m_AssociatedScreen = m_AssociatedScreen;
|
|
|
|
if( m_AssociatedScreen )
|
|
|
|
m_AssociatedScreen->m_RefCount++;
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
return newitem;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Used if undo / redo command:
|
|
|
|
* swap data between this and copyitem
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
void SCH_SHEET::SwapData( SCH_SHEET* copyitem )
|
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
EXCHG( m_Pos, copyitem->m_Pos );
|
|
|
|
EXCHG( m_Size, copyitem->m_Size );
|
|
|
|
EXCHG( m_SheetName, copyitem->m_SheetName );
|
|
|
|
EXCHG( m_SheetNameSize, copyitem->m_SheetNameSize );
|
|
|
|
EXCHG( m_FileNameSize, copyitem->m_FileNameSize );
|
|
|
|
EXCHG( m_Label, copyitem->m_Label );
|
|
|
|
EXCHG( m_NbLabel, copyitem->m_NbLabel );
|
2008-03-30 16:15:53 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
// Ensure sheet labels have their .m_Parent member pointing really on their
|
2009-11-03 13:26:31 +00:00
|
|
|
// parent, after swapping.
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET_PIN* label = m_Label;
|
2008-03-30 16:15:53 +00:00
|
|
|
while( label )
|
|
|
|
{
|
2008-11-24 06:53:43 +00:00
|
|
|
label->SetParent( this );
|
2008-03-30 16:15:53 +00:00
|
|
|
label = label->Next();
|
|
|
|
}
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2008-03-30 16:15:53 +00:00
|
|
|
label = copyitem->m_Label;
|
|
|
|
while( label )
|
|
|
|
{
|
2008-11-24 06:53:43 +00:00
|
|
|
label->SetParent( copyitem );
|
2008-03-30 16:15:53 +00:00
|
|
|
label = label->Next();
|
|
|
|
}
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
void SCH_SHEET::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
2008-02-12 21:12:46 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
/* Place list structures for new sheet. */
|
2009-12-02 21:44:03 +00:00
|
|
|
bool isnew = ( m_Flags & IS_NEW ) ? true : false;
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2009-01-06 20:09:32 +00:00
|
|
|
if( isnew )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
if( !frame->EditSheet( this, DC ) )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
|
|
|
frame->GetScreen()->SetCurItem( NULL );
|
|
|
|
frame->DrawPanel->ManageCurseur = NULL;
|
|
|
|
frame->DrawPanel->ForceCloseManageCurseur = NULL;
|
|
|
|
RedrawOneStruct( frame->DrawPanel, DC, this, g_XorMode );
|
|
|
|
delete this;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2010-03-24 18:26:04 +00:00
|
|
|
else /* save old text in undo list */
|
|
|
|
{
|
|
|
|
if( g_ItemToUndoCopy && ( g_ItemToUndoCopy->Type() == Type() ) )
|
|
|
|
{
|
|
|
|
/* restore old values and save new ones */
|
|
|
|
SwapData( (SCH_SHEET*) g_ItemToUndoCopy );
|
|
|
|
|
|
|
|
/* save in undo list */
|
|
|
|
frame->SaveCopyInUndoList( this, UR_CHANGED );
|
|
|
|
|
|
|
|
/* restore new values */
|
|
|
|
SwapData( (SCH_SHEET*) g_ItemToUndoCopy );
|
|
|
|
|
|
|
|
SAFE_DELETE( g_ItemToUndoCopy );
|
|
|
|
}
|
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
SCH_ITEM::Place( frame, DC ); //puts it on the EEDrawList.
|
2009-11-03 13:26:31 +00:00
|
|
|
if( isnew )
|
2009-01-06 20:09:32 +00:00
|
|
|
{
|
|
|
|
frame->SetSheetNumberAndCount();
|
|
|
|
}
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
/** Function CleanupSheet
|
2009-11-03 13:26:31 +00:00
|
|
|
* Delete pinsheets which are not corresponding to a hierarchical label
|
2009-01-04 18:52:57 +00:00
|
|
|
* @param aRedraw = true to redraw Sheet
|
|
|
|
* @param aFrame = the schematic frame
|
2008-02-12 21:12:46 +00:00
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
void SCH_SHEET::CleanupSheet( WinEDA_SchematicFrame* aFrame,
|
|
|
|
bool aRedraw )
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET_PIN* Pinsheet, * NextPinsheet;
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2008-04-25 07:33:45 +00:00
|
|
|
if( !IsOK( aFrame, _( "Ok to cleanup this sheet" ) ) )
|
2008-02-26 19:19:54 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
Pinsheet = m_Label;
|
|
|
|
while( Pinsheet )
|
|
|
|
{
|
|
|
|
/* Search Hlabel corresponding to this Pinsheet */
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
EDA_BaseStruct* DrawStruct = m_AssociatedScreen->EEDrawList;
|
2009-01-04 18:52:57 +00:00
|
|
|
SCH_HIERLABEL* HLabel = NULL;
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
if( DrawStruct->Type() != TYPE_SCH_HIERLABEL )
|
2008-02-26 19:19:54 +00:00
|
|
|
continue;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
HLabel = (SCH_HIERLABEL*) DrawStruct;
|
2008-02-26 19:19:54 +00:00
|
|
|
if( Pinsheet->m_Text.CmpNoCase( HLabel->m_Text ) == 0 )
|
2009-11-03 13:26:31 +00:00
|
|
|
break; // Found!
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
HLabel = NULL;
|
|
|
|
}
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
NextPinsheet = Pinsheet->Next();
|
2008-02-26 19:19:54 +00:00
|
|
|
if( HLabel == NULL ) // Hlabel not found: delete pinsheet
|
|
|
|
{
|
2010-02-18 20:07:29 +00:00
|
|
|
aFrame->OnModify( );
|
2008-04-25 07:33:45 +00:00
|
|
|
aFrame->DeleteSheetLabel( false, Pinsheet );
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
|
|
|
Pinsheet = NextPinsheet;
|
|
|
|
}
|
2008-04-30 17:04:22 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
if( aRedraw )
|
|
|
|
aFrame->DrawPanel->PostDirtyRect( GetBoundingBox() );
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2009-06-30 19:21:41 +00:00
|
|
|
/** Function GetPenSize
|
|
|
|
* @return the size of the "pen" that be used to draw or plot this item
|
|
|
|
*/
|
2009-11-04 20:46:53 +00:00
|
|
|
int SCH_SHEET::GetPenSize()
|
2009-06-30 19:21:41 +00:00
|
|
|
{
|
|
|
|
return g_DrawDefaultLineThickness;
|
|
|
|
}
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
/** Function Draw
|
|
|
|
* Draw the hierarchical sheet shape
|
|
|
|
* @param aPanel = the current DrawPanel
|
|
|
|
* @param aDc = the current Device Context
|
|
|
|
* @param aOffset = draw offset (usually wxPoint(0,0))
|
|
|
|
* @param aDrawMode = draw mode
|
2009-11-03 13:26:31 +00:00
|
|
|
* @param aColor = color used to draw sheet. Usually -1 to use the normal
|
|
|
|
* color for sheet items
|
2009-01-04 18:52:57 +00:00
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
void SCH_SHEET::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
|
|
|
const wxPoint& aOffset, int aDrawMode, int aColor )
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET_PIN* SheetLabelStruct;
|
2008-02-12 21:12:46 +00:00
|
|
|
int txtcolor;
|
|
|
|
wxString Text;
|
|
|
|
int color;
|
2009-01-04 18:52:57 +00:00
|
|
|
wxPoint pos = m_Pos + aOffset;
|
2009-06-02 07:26:49 +00:00
|
|
|
int LineWidth = g_DrawDefaultLineThickness;
|
2008-02-12 21:12:46 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
if( aColor >= 0 )
|
|
|
|
color = aColor;
|
2008-02-12 21:12:46 +00:00
|
|
|
else
|
|
|
|
color = ReturnLayerColor( m_Layer );
|
2009-01-04 18:52:57 +00:00
|
|
|
GRSetDrawMode( aDC, aDrawMode );
|
2008-02-12 21:12:46 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
GRRect( &aPanel->m_ClipBox, aDC, pos.x, pos.y,
|
|
|
|
pos.x + m_Size.x, pos.y + m_Size.y, LineWidth, color );
|
2008-02-12 21:12:46 +00:00
|
|
|
|
|
|
|
/* Draw text : SheetName */
|
2009-01-04 18:52:57 +00:00
|
|
|
if( aColor > 0 )
|
|
|
|
txtcolor = aColor;
|
2008-02-12 21:12:46 +00:00
|
|
|
else
|
|
|
|
txtcolor = ReturnLayerColor( LAYER_SHEETNAME );
|
|
|
|
|
|
|
|
Text = wxT( "Sheet: " ) + m_SheetName;
|
2009-11-03 13:26:31 +00:00
|
|
|
DrawGraphicText( aPanel, aDC, wxPoint( pos.x, pos.y - 8 ),
|
|
|
|
(EDA_Colors) txtcolor, Text, TEXT_ORIENT_HORIZ,
|
|
|
|
wxSize( m_SheetNameSize, m_SheetNameSize ),
|
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth,
|
|
|
|
false, false, false );
|
2008-02-12 21:12:46 +00:00
|
|
|
|
|
|
|
/* Draw text : FileName */
|
2009-01-04 18:52:57 +00:00
|
|
|
if( aColor >= 0 )
|
|
|
|
txtcolor = aColor;
|
2008-02-12 21:12:46 +00:00
|
|
|
else
|
|
|
|
txtcolor = ReturnLayerColor( LAYER_SHEETFILENAME );
|
|
|
|
Text = wxT( "File: " ) + m_FileName;
|
2009-11-03 13:26:31 +00:00
|
|
|
DrawGraphicText( aPanel, aDC, wxPoint( pos.x, pos.y + m_Size.y + 4 ),
|
|
|
|
(EDA_Colors) txtcolor, Text, TEXT_ORIENT_HORIZ,
|
|
|
|
wxSize( m_FileNameSize, m_FileNameSize ),
|
|
|
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, LineWidth,
|
|
|
|
false, false, false );
|
2008-02-12 21:12:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Draw text : SheetLabel */
|
|
|
|
SheetLabelStruct = m_Label;
|
|
|
|
while( SheetLabelStruct != NULL )
|
|
|
|
{
|
2008-12-05 16:03:05 +00:00
|
|
|
if( !( SheetLabelStruct->m_Flags & IS_MOVED ) )
|
2009-01-04 18:52:57 +00:00
|
|
|
SheetLabelStruct->Draw( aPanel, aDC, aOffset, aDrawMode, aColor );
|
2008-04-15 19:38:19 +00:00
|
|
|
SheetLabelStruct = SheetLabelStruct->Next();
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
/** Function GetBoundingBox
|
2009-11-03 13:26:31 +00:00
|
|
|
* @return an EDA_Rect giving the bounding box of the sheet
|
2009-01-04 18:52:57 +00:00
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
EDA_Rect SCH_SHEET::GetBoundingBox()
|
|
|
|
{
|
2008-04-15 19:38:19 +00:00
|
|
|
int dx, dy;
|
|
|
|
|
2008-03-30 10:14:37 +00:00
|
|
|
// Determine length of texts
|
2008-04-15 19:38:19 +00:00
|
|
|
wxString Text1 = wxT( "Sheet: " ) + m_SheetName;
|
|
|
|
wxString Text2 = wxT( "File: " ) + m_FileName;
|
|
|
|
int textlen1 = 10 * Text1.Len() * m_SheetNameSize / 9;
|
|
|
|
int textlen2 = 10 * Text2.Len() * m_FileNameSize / 9;
|
|
|
|
|
|
|
|
textlen1 = MAX( textlen1, textlen2 );
|
|
|
|
dx = MAX( m_Size.x, textlen1 );
|
|
|
|
dy = m_Size.y + m_SheetNameSize + m_FileNameSize + 16;
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
EDA_Rect box( wxPoint( m_Pos.x, m_Pos.y - m_SheetNameSize - 8 ),
|
|
|
|
wxSize( dx, dy ) );
|
2008-03-30 10:14:37 +00:00
|
|
|
return box;
|
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2009-01-31 18:08:47 +00:00
|
|
|
/** Function HitTest
|
|
|
|
* @return true if the point aPosRef is within item area
|
|
|
|
* @param aPosRef = a wxPoint to test
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
bool SCH_SHEET::HitTest( const wxPoint& aPosRef )
|
|
|
|
{
|
2009-01-31 18:08:47 +00:00
|
|
|
EDA_Rect rect = GetBoundingBox();
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2009-01-31 18:08:47 +00:00
|
|
|
return rect.Inside( aPosRef );
|
|
|
|
}
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
/** Function ComponentCount
|
|
|
|
* count our own components, without the power components.
|
2009-11-03 13:26:31 +00:00
|
|
|
* @return the component count.
|
2009-01-04 18:52:57 +00:00
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
int SCH_SHEET::ComponentCount()
|
|
|
|
{
|
2008-02-26 19:19:54 +00:00
|
|
|
int n = 0;
|
|
|
|
|
|
|
|
if( m_AssociatedScreen )
|
|
|
|
{
|
|
|
|
EDA_BaseStruct* bs;
|
2008-11-24 06:53:43 +00:00
|
|
|
for( bs = m_AssociatedScreen->EEDrawList; bs != NULL; bs = bs->Next() )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
if( bs->Type() == TYPE_SCH_COMPONENT )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
SCH_COMPONENT* Cmp = (SCH_COMPONENT*) bs;
|
2009-01-04 18:52:57 +00:00
|
|
|
if( Cmp->GetField( VALUE )->m_Text.GetChar( 0 ) != '#' )
|
2008-02-26 19:19:54 +00:00
|
|
|
n++;
|
|
|
|
}
|
|
|
|
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE )
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET* sheet = (SCH_SHEET*) bs;
|
2008-02-26 19:19:54 +00:00
|
|
|
n += sheet->ComponentCount();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-12-02 21:44:03 +00:00
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
return n;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
/** Function SearchHierarchy
|
|
|
|
* search the existing hierarchy for an instance of screen "FileName".
|
|
|
|
* @param aFilename = the filename to find
|
|
|
|
* @param aFilename = a location to return a pointer to the screen (if found)
|
|
|
|
* @return bool if found, and a pointer to the screen
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
bool SCH_SHEET::SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen )
|
|
|
|
{
|
2008-02-26 19:19:54 +00:00
|
|
|
if( m_AssociatedScreen )
|
|
|
|
{
|
|
|
|
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList;
|
|
|
|
while( strct )
|
|
|
|
{
|
|
|
|
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET* ss = (SCH_SHEET*) strct;
|
2008-04-15 19:38:19 +00:00
|
|
|
if( ss->m_AssociatedScreen
|
2009-01-04 18:52:57 +00:00
|
|
|
&& ss->m_AssociatedScreen->m_FileName.CmpNoCase( aFilename ) == 0 )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
2009-01-04 18:52:57 +00:00
|
|
|
*aScreen = ss->m_AssociatedScreen;
|
2008-02-26 19:19:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
2009-12-02 21:44:03 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
if( ss->SearchHierarchy( aFilename, aScreen ) )
|
2008-02-26 19:19:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
2008-11-24 06:53:43 +00:00
|
|
|
strct = strct->Next();
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
|
|
|
}
|
2009-12-02 21:44:03 +00:00
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
return false;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
/** Function LocatePathOfScreen
|
|
|
|
* search the existing hierarchy for an instance of screen "FileName".
|
|
|
|
* don't bother looking at the root sheet - it must be unique,
|
2009-11-03 13:26:31 +00:00
|
|
|
* no other references to its m_AssociatedScreen otherwise there would be
|
|
|
|
* loops
|
2009-01-04 18:52:57 +00:00
|
|
|
* in the hierarchy.
|
|
|
|
* @param aScreen = the SCH_SCREEN* screen that we search for
|
2009-12-02 21:44:03 +00:00
|
|
|
* @param aList = the SCH_SHEET_PATH* that must be used
|
2009-01-04 18:52:57 +00:00
|
|
|
* @return true if found
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
bool SCH_SHEET::LocatePathOfScreen( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aList )
|
|
|
|
{
|
2008-02-26 19:19:54 +00:00
|
|
|
if( m_AssociatedScreen )
|
|
|
|
{
|
2009-01-04 18:52:57 +00:00
|
|
|
aList->Push( this );
|
|
|
|
if( m_AssociatedScreen == aScreen )
|
2008-02-26 19:19:54 +00:00
|
|
|
return true;
|
|
|
|
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList;
|
|
|
|
while( strct )
|
|
|
|
{
|
|
|
|
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET* ss = (SCH_SHEET*) strct;
|
2009-01-04 18:52:57 +00:00
|
|
|
if( ss->LocatePathOfScreen( aScreen, aList ) )
|
2008-02-26 19:19:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
2008-11-24 06:53:43 +00:00
|
|
|
strct = strct->Next();
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
aList->Pop();
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
|
|
|
return false;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
/** Function Load.
|
|
|
|
* for the sheet: load the file m_FileName
|
|
|
|
* 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
|
|
|
|
* @return true if OK
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
bool SCH_SHEET::Load( WinEDA_SchematicFrame* aFrame )
|
|
|
|
{
|
2008-02-29 12:33:07 +00:00
|
|
|
bool success = true;
|
2008-02-28 19:27:25 +00:00
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
if( !m_AssociatedScreen )
|
|
|
|
{
|
|
|
|
SCH_SCREEN* screen = NULL;
|
|
|
|
g_RootSheet->SearchHierarchy( m_FileName, &screen );
|
|
|
|
if( screen )
|
|
|
|
{
|
|
|
|
m_AssociatedScreen = screen;
|
|
|
|
m_AssociatedScreen->m_RefCount++;
|
|
|
|
|
|
|
|
//do not need to load the sub-sheets - this has already been done.
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-12-05 16:03:05 +00:00
|
|
|
m_AssociatedScreen = new SCH_SCREEN();
|
2008-02-26 19:19:54 +00:00
|
|
|
m_AssociatedScreen->m_RefCount++;
|
2009-01-04 18:52:57 +00:00
|
|
|
success = aFrame->LoadOneEEFile( m_AssociatedScreen, m_FileName );
|
2008-02-29 12:33:07 +00:00
|
|
|
if( success )
|
|
|
|
{
|
|
|
|
EDA_BaseStruct* bs = m_AssociatedScreen->EEDrawList;
|
|
|
|
while( bs )
|
|
|
|
{
|
|
|
|
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE )
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET* sheetstruct = (SCH_SHEET*) bs;
|
2009-01-04 18:52:57 +00:00
|
|
|
if( !sheetstruct->Load( aFrame ) )
|
2008-02-29 12:33:07 +00:00
|
|
|
success = false;
|
|
|
|
}
|
2008-11-24 06:53:43 +00:00
|
|
|
bs = bs->Next();
|
2008-02-29 12:33:07 +00:00
|
|
|
}
|
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
|
|
|
}
|
2009-12-02 21:44:03 +00:00
|
|
|
|
2008-02-28 19:27:25 +00:00
|
|
|
return success;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
|
2009-01-06 20:09:32 +00:00
|
|
|
/** Function CountSheets
|
|
|
|
* calculates the number of sheets found in "this"
|
|
|
|
* this number includes the full subsheets count
|
|
|
|
* @return the full count of sheets+subsheets contained by "this"
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
int SCH_SHEET::CountSheets()
|
|
|
|
{
|
2008-02-26 19:19:54 +00:00
|
|
|
int count = 1; //1 = this!!
|
|
|
|
|
|
|
|
if( m_AssociatedScreen )
|
|
|
|
{
|
|
|
|
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList;
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; strct; strct = strct->Next() )
|
2008-02-26 19:19:54 +00:00
|
|
|
{
|
|
|
|
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET* subsheet = (SCH_SHEET*) strct;
|
2009-01-06 20:09:32 +00:00
|
|
|
count += subsheet->CountSheets();
|
2008-02-26 19:19:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return count;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
wxString SCH_SHEET::GetFileName( void )
|
2008-02-28 19:27:25 +00:00
|
|
|
{
|
2008-02-29 12:33:07 +00:00
|
|
|
return m_FileName;
|
2008-02-28 19:27:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-29 12:33:07 +00:00
|
|
|
/** Function ChangeFileName
|
|
|
|
* Set a new filename and manage data and associated screen
|
|
|
|
* The main difficulty is the filename change in a complex hierarchy.
|
2009-11-03 13:26:31 +00:00
|
|
|
* - if new filename is not already used: change to the new name (and if an
|
|
|
|
* existing file is found, load it on request)
|
|
|
|
* - if new filename is already used (a complex hierarchy) : reference the
|
|
|
|
* sheet.
|
2009-01-04 18:52:57 +00:00
|
|
|
* @param aFileName = the new filename
|
|
|
|
* @param aFrame = the schematic frame
|
2008-02-29 12:33:07 +00:00
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
bool SCH_SHEET::ChangeFileName( WinEDA_SchematicFrame* aFrame,
|
|
|
|
const wxString& aFileName )
|
|
|
|
{
|
|
|
|
if( ( GetFileName() == aFileName ) && m_AssociatedScreen )
|
2008-02-29 12:33:07 +00:00
|
|
|
return true;
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
SCH_SCREEN* Screen_to_use = NULL;
|
2008-04-15 19:38:19 +00:00
|
|
|
wxString msg;
|
|
|
|
bool LoadFromFile = false;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2008-02-29 12:33:07 +00:00
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
// do we reload the data from the existing hierarchy
|
|
|
|
if( g_RootSheet->SearchHierarchy( aFileName, &Screen_to_use ) )
|
2008-02-29 12:33:07 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
if( m_AssociatedScreen ) // upon initial load, this will be null.
|
2008-04-15 19:38:19 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
msg.Printf( _( "A Sub Hierarchy named %s exists, Use it (The \
|
|
|
|
data in this sheet will be replaced)?" ),
|
|
|
|
aFileName.GetData() );
|
2008-04-15 19:38:19 +00:00
|
|
|
if( !IsOK( NULL, msg ) )
|
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
DisplayInfoMessage( (wxWindow*) NULL,
|
|
|
|
_( "Sheet Filename Renaming Aborted" ) );
|
2008-04-15 19:38:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2008-03-20 01:50:21 +00:00
|
|
|
}
|
2009-11-03 13:26:31 +00:00
|
|
|
else if( wxFileExists( aFileName ) ) // do we reload the data from
|
|
|
|
// an existing file
|
2008-02-29 12:33:07 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
msg.Printf( _( "A file named %s exists, load it (otherwise keep \
|
|
|
|
current sheet data if possible)?" ),
|
2009-01-04 18:52:57 +00:00
|
|
|
aFileName.GetData() );
|
2008-03-20 01:50:21 +00:00
|
|
|
if( IsOK( NULL, msg ) )
|
|
|
|
{
|
|
|
|
LoadFromFile = true;
|
2009-11-03 13:26:31 +00:00
|
|
|
|
|
|
|
// Can be NULL if loading a file when creating a new sheet.
|
|
|
|
if( m_AssociatedScreen )
|
2008-06-15 15:45:41 +00:00
|
|
|
{
|
2009-11-03 13:26:31 +00:00
|
|
|
m_AssociatedScreen->m_RefCount--; // be careful with these
|
2008-06-15 15:45:41 +00:00
|
|
|
if( m_AssociatedScreen->m_RefCount == 0 )
|
|
|
|
SAFE_DELETE( m_AssociatedScreen );
|
2009-11-03 13:26:31 +00:00
|
|
|
m_AssociatedScreen = NULL; // will be created later
|
2008-06-15 15:45:41 +00:00
|
|
|
}
|
2008-03-20 01:50:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
// if an associated screen exists, shared between this sheet and others
|
|
|
|
// sheets, what we do ?
|
2008-04-15 19:38:19 +00:00
|
|
|
if( m_AssociatedScreen && ( m_AssociatedScreen->m_RefCount > 1 ) )
|
2008-03-20 01:50:21 +00:00
|
|
|
{
|
2008-04-15 19:38:19 +00:00
|
|
|
msg = _( "This sheet uses shared data in a complex hierarchy" );
|
|
|
|
msg << wxT( "\n" );
|
2009-11-03 13:26:31 +00:00
|
|
|
msg << _( "Do we convert it in a simple hierarchical sheet (\
|
|
|
|
otherwise delete current sheet data)" );
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
if( IsOK( NULL, msg ) )
|
|
|
|
{
|
|
|
|
LoadFromFile = true;
|
|
|
|
wxString oldfilename = m_AssociatedScreen->m_FileName;
|
|
|
|
m_AssociatedScreen->m_FileName = aFileName;
|
|
|
|
aFrame->SaveEEFile( m_AssociatedScreen, FILE_SAVE_AS );
|
|
|
|
m_AssociatedScreen->m_FileName = oldfilename;
|
|
|
|
}
|
2008-04-15 19:38:19 +00:00
|
|
|
m_AssociatedScreen->m_RefCount--; //be careful with these
|
|
|
|
m_AssociatedScreen = NULL; //will be created later
|
2008-03-20 01:50:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SetFileName( aFileName );
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
// if we use new data (from file or from internal hierarchy), delete the
|
|
|
|
// current sheet data
|
2008-03-20 01:50:21 +00:00
|
|
|
if( m_AssociatedScreen && (LoadFromFile || Screen_to_use) )
|
|
|
|
{
|
|
|
|
m_AssociatedScreen->m_RefCount--;
|
|
|
|
if( m_AssociatedScreen->m_RefCount == 0 )
|
|
|
|
SAFE_DELETE( m_AssociatedScreen );
|
2009-11-03 13:26:31 +00:00
|
|
|
m_AssociatedScreen = NULL; // so that we reload..
|
2008-03-20 01:50:21 +00:00
|
|
|
}
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
if( LoadFromFile )
|
2008-03-20 01:50:21 +00:00
|
|
|
Load( aFrame );
|
2008-04-15 19:38:19 +00:00
|
|
|
else if( Screen_to_use )
|
2008-03-20 01:50:21 +00:00
|
|
|
{
|
|
|
|
m_AssociatedScreen = Screen_to_use;
|
|
|
|
m_AssociatedScreen->m_RefCount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//just make a new screen if needed.
|
|
|
|
if( !m_AssociatedScreen )
|
|
|
|
{
|
2008-12-05 16:03:05 +00:00
|
|
|
m_AssociatedScreen = new SCH_SCREEN();
|
2009-11-03 13:26:31 +00:00
|
|
|
m_AssociatedScreen->m_RefCount++; // be careful with these
|
2008-03-20 01:50:21 +00:00
|
|
|
}
|
|
|
|
m_AssociatedScreen->m_FileName = aFileName;
|
2008-02-29 12:33:07 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
void SCH_SHEET::DisplayInfo( WinEDA_DrawFrame* frame )
|
2009-04-05 20:49:15 +00:00
|
|
|
{
|
2009-10-14 19:43:31 +00:00
|
|
|
frame->ClearMsgPanel();
|
|
|
|
frame->AppendMsgPanel( _( "Sheet name" ), m_SheetName, CYAN );
|
|
|
|
frame->AppendMsgPanel( _( "File name" ), m_FileName, BROWN );
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
/** virtual function Mirror_Y
|
|
|
|
* mirror item relative to an Y axis
|
|
|
|
* @param aYaxis_position = the y axis position
|
|
|
|
*/
|
2009-11-04 20:46:53 +00:00
|
|
|
void SCH_SHEET::Mirror_Y( int aYaxis_position )
|
2009-07-27 14:32:40 +00:00
|
|
|
{
|
|
|
|
m_Pos.x -= aYaxis_position;
|
|
|
|
NEGATE( m_Pos.x );
|
|
|
|
m_Pos.x += aYaxis_position;
|
|
|
|
|
|
|
|
m_Pos.x -= m_Size.x;
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET_PIN* label = m_Label;
|
2009-07-27 14:32:40 +00:00
|
|
|
while( label != NULL )
|
|
|
|
{
|
|
|
|
label->Mirror_Y( aYaxis_position );
|
|
|
|
label = label->Next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData )
|
|
|
|
{
|
|
|
|
if( !SCH_ITEM::Matches( m_SheetName, aSearchData ) )
|
|
|
|
return SCH_ITEM::Matches( m_FileName, aSearchData );
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-22 16:38:23 +00:00
|
|
|
#if defined(DEBUG)
|
2009-11-04 20:46:53 +00:00
|
|
|
void SCH_SHEET::Show( int nestLevel, std::ostream& os )
|
2008-04-22 16:38:23 +00:00
|
|
|
{
|
|
|
|
// XML output:
|
|
|
|
wxString s = GetClass();
|
|
|
|
|
|
|
|
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << ">"
|
2009-12-02 21:44:03 +00:00
|
|
|
<< " sheet_name=\""
|
|
|
|
<< CONV_TO_UTF8( m_SheetName )
|
2009-11-03 13:26:31 +00:00
|
|
|
<< '"' << ">\n";
|
2008-04-22 16:38:23 +00:00
|
|
|
|
|
|
|
// show all the pins, and check the linked list integrity
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_SHEET_PIN* label;
|
2009-11-03 13:26:31 +00:00
|
|
|
for( label = m_Label; label; label = label->Next() )
|
2008-04-22 16:38:23 +00:00
|
|
|
{
|
2009-01-04 18:52:57 +00:00
|
|
|
label->Show( nestLevel + 1, os );
|
2008-04-22 16:38:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NestedSpace( nestLevel, os ) << "</" << s.Lower().mb_str() << ">\n"
|
2009-01-04 18:52:57 +00:00
|
|
|
<< std::flush;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
#endif
|