2008-04-12 18:39:20 +00:00
|
|
|
/********************************************/
|
2009-11-03 13:26:31 +00:00
|
|
|
/* Definitions for the EESchema program: */
|
2008-04-12 18:39:20 +00:00
|
|
|
/********************************************/
|
|
|
|
|
|
|
|
#ifndef CLASS_DRAWSHEET_H
|
|
|
|
#define CLASS_DRAWSHEET_H
|
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
#include <boost/ptr_container/ptr_vector.hpp>
|
|
|
|
#include <boost/foreach.hpp>
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_text.h"
|
2008-04-12 18:39:20 +00:00
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
|
|
|
|
class LINE_READER;
|
|
|
|
class SCH_SCREEN;
|
|
|
|
class SCH_SHEET;
|
|
|
|
class SCH_SHEET_PIN;
|
|
|
|
class SCH_SHEET_PATH;
|
|
|
|
class DANGLING_END_ITEM;
|
2010-12-08 20:12:46 +00:00
|
|
|
class SCH_EDIT_FRAME;
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Pin (label) used in sheets to create hierarchical schematics.
|
|
|
|
*
|
|
|
|
* A SCH_SHEET_PIN is used to create a hierarchical sheet in the same way a
|
2009-12-02 21:44:03 +00:00
|
|
|
* pin is used in a component. It connects the objects in the sheet object
|
|
|
|
* to the objects in the schematic page to the objects in the page that is
|
2009-11-04 20:46:53 +00:00
|
|
|
* represented by the sheet. In a sheet object, a SCH_SHEET_PIN must be
|
|
|
|
* connected to a wire, bus, or label. In the schematic page represented by
|
|
|
|
* the sheet, it corresponds to a hierarchical label.
|
2009-01-04 18:52:57 +00:00
|
|
|
*/
|
2010-09-05 17:01:48 +00:00
|
|
|
|
|
|
|
class SCH_SHEET_PIN : public SCH_HIERLABEL
|
2008-04-12 18:39:20 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
private:
|
2010-09-05 17:01:48 +00:00
|
|
|
int m_Number; ///< Label number use for saving sheet label to file.
|
2010-06-24 18:31:43 +00:00
|
|
|
///< Sheet label numbering begins at 2.
|
|
|
|
///< 0 is reserved for the sheet name.
|
|
|
|
///< 1 is reserve for the sheet file name.
|
2010-11-03 14:13:15 +00:00
|
|
|
int m_Edge; /* For pin labels only: sheet edge (0 to 3) of the pin
|
|
|
|
* m_Edge define on which edge the pin is positionned:
|
|
|
|
* 0: pin on left side
|
|
|
|
* 1: pin on right side
|
|
|
|
* 2: pin on top side
|
|
|
|
* 3: pin on bottom side
|
|
|
|
* for compatibility reasons, this does not follow same values as text
|
|
|
|
* orientation.
|
|
|
|
*/
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
virtual EDA_ITEM* doClone() const;
|
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
public:
|
|
|
|
SCH_SHEET_PIN( SCH_SHEET* parent,
|
|
|
|
const wxPoint& pos = wxPoint( 0, 0 ),
|
|
|
|
const wxString& text = wxEmptyString );
|
2008-04-12 18:39:20 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
SCH_SHEET_PIN( const SCH_SHEET_PIN& aSheetLabel );
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
~SCH_SHEET_PIN() { }
|
2008-04-22 16:38:23 +00:00
|
|
|
|
2008-04-12 18:39:20 +00:00
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
return wxT( "SCH_SHEET_PIN" );
|
2008-04-12 18:39:20 +00:00
|
|
|
}
|
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
bool operator ==( const SCH_SHEET_PIN* aPin ) const;
|
2008-04-12 18:39:20 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
virtual void Draw( EDA_DRAW_PANEL* aPanel,
|
|
|
|
wxDC* aDC,
|
|
|
|
const wxPoint& aOffset,
|
|
|
|
int aDraw_mode,
|
|
|
|
int aColor = -1 );
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function CreateGraphicShape (virual)
|
2010-09-11 16:33:43 +00:00
|
|
|
* Calculates the graphic shape (a polygon) associated to the text
|
|
|
|
* @param aCorner_list = a buffer to fill with polygon corners coordinates
|
2010-12-14 15:56:30 +00:00
|
|
|
* @param aPos = Position of the shape
|
2010-09-11 16:33:43 +00:00
|
|
|
*/
|
|
|
|
virtual void CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
|
2010-12-14 15:56:30 +00:00
|
|
|
const wxPoint& aPos );
|
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
void SwapData( SCH_SHEET_PIN* copyitem );
|
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
/**
|
|
|
|
* Get the sheet label number.
|
|
|
|
*
|
|
|
|
* @return Number of the sheet label.
|
|
|
|
*/
|
|
|
|
int GetNumber() { return m_Number; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the sheet label number.
|
|
|
|
*
|
|
|
|
* @param aNumber - New sheet number label.
|
|
|
|
*/
|
2010-09-05 17:01:48 +00:00
|
|
|
void SetNumber( int aNumber );
|
|
|
|
void SetEdge( int aEdge );
|
|
|
|
int GetEdge();
|
2010-12-21 15:13:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ConstraintOnEdge
|
|
|
|
* is used to adjust label position to egde based on proximity to vertical / horizontal edge
|
|
|
|
* of the parent sheet.
|
|
|
|
*/
|
2010-09-05 17:01:48 +00:00
|
|
|
void ConstraintOnEdge( wxPoint Pos );
|
2010-06-24 18:31:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the parent sheet object of this sheet pin.
|
|
|
|
*
|
|
|
|
* @return The sheet that is the parent of this sheet pin or NULL if it does
|
|
|
|
* not have a parent.
|
|
|
|
*/
|
|
|
|
SCH_SHEET* GetParent() const { return (SCH_SHEET*) m_Parent; }
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
2009-11-03 13:26:31 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.sch"
|
|
|
|
* format.
|
2008-04-15 19:38:19 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2008-04-30 17:04:22 +00:00
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
/**
|
|
|
|
* Load schematic sheet hierarchical lable from \a aLine in a .sch file.
|
|
|
|
*
|
|
|
|
* @param aLine - Essentially this is file to read the sheet hierarchical label from.
|
|
|
|
* @param aErrorMsg - Description of the error if an error occurs while loading the sheet
|
|
|
|
* hierarchical label.
|
|
|
|
* @return True if the sheet heirarchical label loaded successfully.
|
|
|
|
*/
|
|
|
|
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
#if defined(DEBUG)
|
2008-04-22 16:38:23 +00:00
|
|
|
|
|
|
|
// comment inherited by Doxygen from Base_Struct
|
2009-11-03 13:26:31 +00:00
|
|
|
void Show( int nestLevel, std::ostream& os );
|
2008-04-30 17:04:22 +00:00
|
|
|
|
2008-04-22 16:38:23 +00:00
|
|
|
#endif
|
2009-05-05 18:25:47 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetPenSize
|
2009-06-30 19:21:41 +00:00
|
|
|
* @return the size of the "pen" that be used to draw or plot this item
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
virtual int GetPenSize() const;
|
2009-06-30 19:21:41 +00:00
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
// Geometric transforms (used in block operations):
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
/** virtual function Move
|
|
|
|
* move item to a new position.
|
2009-11-03 13:26:31 +00:00
|
|
|
* @param aMoveVector = the displacement vector
|
2009-07-27 14:32:40 +00:00
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
virtual void Move( const wxPoint& aMoveVector )
|
2009-07-27 14:32:40 +00:00
|
|
|
{
|
|
|
|
m_Pos += aMoveVector;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** virtual function Mirror_Y
|
|
|
|
* mirror item relative to an Y axis
|
|
|
|
* @param aYaxis_position = the y axis position
|
|
|
|
*/
|
2010-09-05 17:01:48 +00:00
|
|
|
virtual void Mirror_Y( int aYaxis_position );
|
2010-12-14 15:56:30 +00:00
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
virtual void Rotate( wxPoint rotationPoint );
|
|
|
|
|
2010-12-14 15:56:30 +00:00
|
|
|
virtual void Mirror_X( int aXaxis_position );
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function Matches
|
2010-10-20 19:43:58 +00:00
|
|
|
* Compare hierarchical pin name against search string.
|
2010-03-16 18:22:59 +00:00
|
|
|
*
|
|
|
|
* @param aSearchData - Criteria to search against.
|
2010-10-20 19:43:58 +00:00
|
|
|
* @param aAuxData - a pointer on auxiliary data, if needed.
|
|
|
|
* When searching string in REFERENCE field we must know the sheet path
|
|
|
|
* This param is used in this case
|
|
|
|
* @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
|
2010-03-16 18:22:59 +00:00
|
|
|
* @return True if this item matches the search criteria.
|
|
|
|
*/
|
2010-11-03 14:13:15 +00:00
|
|
|
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
|
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList );
|
2011-01-07 19:24:24 +00:00
|
|
|
|
|
|
|
virtual bool IsConnectable() const { return true; }
|
2008-04-12 18:39:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-09-05 17:01:48 +00:00
|
|
|
typedef boost::ptr_vector<SCH_SHEET_PIN> SCH_SHEET_PIN_LIST;
|
2010-06-24 18:31:43 +00:00
|
|
|
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
/* class SCH_SHEET
|
2009-11-03 13:26:31 +00:00
|
|
|
* This class is the sheet symbol placed in a schematic, and is the entry point
|
|
|
|
* for a sub schematic
|
2008-04-12 18:39:20 +00:00
|
|
|
*/
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
class SCH_SHEET : public SCH_ITEM
|
2008-04-12 18:39:20 +00:00
|
|
|
{
|
2011-01-20 16:34:57 +00:00
|
|
|
SCH_SCREEN* m_AssociatedScreen; ///< Screen that contains the physical data for
|
|
|
|
///< the sheet. In complex hierarchies multiple
|
|
|
|
///< sheets can share a common screen.
|
|
|
|
SCH_SHEET_PIN_LIST m_labels; ///< List of sheet connection points.
|
2010-06-24 18:31:43 +00:00
|
|
|
wxString m_FileName; /* also in SCH_SCREEN (redundant),
|
2008-04-21 06:34:56 +00:00
|
|
|
* but need it here for loading after
|
2009-11-03 13:26:31 +00:00
|
|
|
* reading the sheet description from
|
|
|
|
* file. */
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2011-01-20 16:34:57 +00:00
|
|
|
public:
|
|
|
|
wxString m_SheetName; /* this is equivalent to C101 for
|
|
|
|
* components: it is stored in F0 ...
|
|
|
|
* of the file. */
|
2008-04-12 18:39:20 +00:00
|
|
|
public:
|
2009-11-03 13:26:31 +00:00
|
|
|
int m_SheetNameSize; /* Size (height) of the text, used to
|
|
|
|
* draw the sheet name */
|
|
|
|
int m_FileNameSize; /* Size (height) of the text, used to
|
|
|
|
* draw the file name */
|
2008-04-21 06:34:56 +00:00
|
|
|
wxPoint m_Pos;
|
2009-11-03 13:26:31 +00:00
|
|
|
wxSize m_Size; /* Position and Size of *sheet symbol */
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
public:
|
|
|
|
SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) );
|
2010-12-21 15:13:09 +00:00
|
|
|
|
|
|
|
SCH_SHEET( const SCH_SHEET& aSheet );
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
~SCH_SHEET();
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2008-04-12 18:39:20 +00:00
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
return wxT( "SCH_SHEET" );
|
2008-04-12 18:39:20 +00:00
|
|
|
}
|
|
|
|
|
2011-01-20 16:34:57 +00:00
|
|
|
SCH_SCREEN* GetScreen() { return m_AssociatedScreen; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetScreen
|
|
|
|
* sets the screen associated with this sheet to \a aScreen.
|
|
|
|
* <p>
|
|
|
|
* The screen reference counting is performed by SetScreen. If \a aScreen is not
|
|
|
|
* the same as the current screen, the current screen reference count is decremented
|
|
|
|
* and \a aScreen becomes the screen for the sheet. If the current screen reference
|
|
|
|
* count reaches zero, the current screen is deleted. NULL is a valid value for
|
|
|
|
* \a aScreen.
|
|
|
|
* </p>
|
|
|
|
* @param aScreen The new screen to associate with the sheet.
|
|
|
|
*/
|
|
|
|
void SetScreen( SCH_SCREEN* aScreen );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetScreenCount
|
|
|
|
* returns the number of times the associated screen for the sheet is being used. If
|
|
|
|
* no screen is associated with the sheet, then zero is returned.
|
|
|
|
*/
|
|
|
|
int GetScreenCount() const;
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
2009-11-03 13:26:31 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.sch"
|
|
|
|
* format.
|
2008-04-15 19:38:19 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2008-04-30 17:04:22 +00:00
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
/**
|
|
|
|
* Load schematic sheet from \a aLine in a .sch file.
|
|
|
|
*
|
|
|
|
* @param aLine - Essentially this is file to read the component from.
|
|
|
|
* @param aErrorMsg - Description of the error if an error occurs while loading the sheet.
|
|
|
|
* @return True if the sheet loaded successfully.
|
|
|
|
*/
|
|
|
|
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
|
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
void DisplayInfo( EDA_DRAW_FRAME* frame );
|
2010-09-05 17:01:48 +00:00
|
|
|
|
|
|
|
/* there is no member for orientation in sch_sheet, to preserve file
|
|
|
|
* format, we detect orientation based on pin edges
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
bool IsVerticalOrientation();
|
2008-04-30 17:04:22 +00:00
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
/**
|
|
|
|
* Add aLabel to this sheet.
|
|
|
|
*
|
|
|
|
* Note: Once a label is added to the sheet, it is owned by the sheet.
|
|
|
|
* Do not delete the label object or you will likely get a segfault
|
|
|
|
* when this sheet is destroyed.
|
|
|
|
*
|
|
|
|
* @param aLabel - The label to add to the sheet.
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
void AddLabel( SCH_SHEET_PIN* aLabel );
|
2010-06-24 18:31:43 +00:00
|
|
|
|
|
|
|
SCH_SHEET_PIN_LIST& GetSheetPins() { return m_labels; }
|
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
SCH_SHEET_PIN_LIST& GetSheetPins() const
|
|
|
|
{
|
|
|
|
return const_cast< SCH_SHEET_PIN_LIST& >( m_labels );
|
|
|
|
}
|
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
/**
|
|
|
|
* Remove a sheet label from this sheet.
|
|
|
|
*
|
|
|
|
* @param aSheetLabel - The sheet label to remove from the list.
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
void RemoveLabel( SCH_SHEET_PIN* aSheetLabel );
|
2010-06-24 18:31:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete sheet label which do not have a corresponding hierarchical label.
|
|
|
|
*
|
|
|
|
* Note: Make sure you save a copy of the sheet in the undo list before calling
|
|
|
|
* CleanupSheet() otherwise any unrefernced sheet labels will be lost.
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
void CleanupSheet();
|
2010-06-24 18:31:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the label found at aPosition in this sheet.
|
|
|
|
*
|
|
|
|
* @param aPosition - The position to check for a label.
|
|
|
|
*
|
|
|
|
* @return The label found at aPosition or NULL if no label is found.
|
|
|
|
*/
|
|
|
|
SCH_SHEET_PIN* GetLabel( const wxPoint& aPosition );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if a label already exists with aName.
|
|
|
|
*
|
|
|
|
* @param aName - Name of label to search for.
|
|
|
|
*
|
|
|
|
* @return - True if label found, otherwise false.
|
2008-04-21 06:34:56 +00:00
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
bool HasLabel( const wxString& aName );
|
2010-06-24 18:31:43 +00:00
|
|
|
|
|
|
|
bool HasLabels() { return !m_labels.empty(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check all sheet labels against schematic for undefined hierarchical labels.
|
|
|
|
*
|
|
|
|
* @return True if there are any undefined labels.
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
bool HasUndefinedLabels();
|
2008-04-21 06:34:56 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetPenSize
|
2009-06-30 19:21:41 +00:00
|
|
|
* @return the size of the "pen" that be used to draw or plot this item
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
virtual int GetPenSize() const;
|
2009-06-30 19:21:41 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function Draw
|
2009-01-04 18:52:57 +00:00
|
|
|
* Draw the hierarchical sheet shape
|
|
|
|
* @param aPanel = the current DrawPanel
|
2010-12-14 15:56:30 +00:00
|
|
|
* @param aDC = the current Device Context
|
2009-01-04 18:52:57 +00:00
|
|
|
* @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
|
2008-04-21 06:34:56 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void Draw( EDA_DRAW_PANEL* aPanel,
|
|
|
|
wxDC* aDC,
|
|
|
|
const wxPoint& aOffset,
|
|
|
|
int aDrawMode,
|
|
|
|
int aColor = -1 );
|
2009-01-31 18:08:47 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoundingBox
|
2009-11-03 13:26:31 +00:00
|
|
|
* @return an EDA_Rect giving the bounding box of the sheet
|
2008-04-21 06:34:56 +00:00
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
EDA_Rect GetBoundingBox() const;
|
2009-01-31 18:08:47 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
void SwapData( SCH_SHEET* copyitem );
|
2008-04-12 18:39:20 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function ComponentCount
|
2009-01-04 18:52:57 +00:00
|
|
|
* count our own components, without the power components.
|
2009-01-06 20:09:32 +00:00
|
|
|
* @return the component count.
|
2009-01-04 18:52:57 +00:00
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
int ComponentCount();
|
2008-04-12 18:39:20 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function Load.
|
2009-01-04 18:52:57 +00:00
|
|
|
* for the sheet: load the file m_FileName
|
|
|
|
* if a screen already exists, the file is already read.
|
2009-11-03 13:26:31 +00:00
|
|
|
* m_AssociatedScreen point on the screen, and its m_RefCount is
|
|
|
|
* incremented
|
2009-01-04 18:52:57 +00:00
|
|
|
* else creates a new associated screen and load the data file.
|
2010-12-10 19:47:44 +00:00
|
|
|
* @param aFrame = a SCH_EDIT_FRAME pointer to the maim schematic frame
|
2009-01-04 18:52:57 +00:00
|
|
|
* @return true if OK
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
bool Load( SCH_EDIT_FRAME* aFrame );
|
2008-04-12 18:39:20 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SearchHierarchy
|
2009-01-04 18:52:57 +00:00
|
|
|
* search the existing hierarchy for an instance of screen "FileName".
|
|
|
|
* @param aFilename = the filename to find
|
2010-12-14 15:56:30 +00:00
|
|
|
* @param aScreen = a location to return a pointer to the screen (if found)
|
2009-01-04 18:52:57 +00:00
|
|
|
* @return bool if found, and a pointer to the screen
|
|
|
|
*/
|
2011-01-20 16:34:57 +00:00
|
|
|
bool SearchHierarchy( const wxString& aFilename, SCH_SCREEN** aScreen );
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function LocatePathOfScreen
|
2009-01-04 18:52:57 +00:00
|
|
|
* 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
|
2009-12-02 21:44:03 +00:00
|
|
|
* 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
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
bool LocatePathOfScreen( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aList );
|
2009-01-06 20:09:32 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function CountSheets
|
2009-01-06 20:09:32 +00:00
|
|
|
* 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"
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
int CountSheets();
|
2009-01-06 20:09:32 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetFileName
|
2009-01-06 20:09:32 +00:00
|
|
|
* return the filename corresponding to this sheet
|
|
|
|
* @return a wxString containing the filename
|
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
wxString GetFileName( void );
|
2008-04-12 18:39:20 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
// Set a new filename without changing anything else
|
2010-06-24 18:31:43 +00:00
|
|
|
void SetFileName( const wxString& aFilename )
|
2008-04-12 18:39:20 +00:00
|
|
|
{
|
2009-01-04 18:52:57 +00:00
|
|
|
m_FileName = aFilename;
|
2008-04-12 18:39:20 +00:00
|
|
|
}
|
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
bool ChangeFileName( SCH_EDIT_FRAME* aFrame, const wxString& aFileName );
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
//void RemoveSheet(SCH_SHEET* sheet);
|
2009-01-04 18:52:57 +00:00
|
|
|
//to remove a sheet, just delete it
|
|
|
|
//-- the destructor should take care of everything else.
|
2008-04-12 18:39:20 +00:00
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
// Geometric transforms (used in block operations):
|
2009-11-03 13:26:31 +00:00
|
|
|
|
2009-07-27 14:32:40 +00:00
|
|
|
/** virtual function Move
|
|
|
|
* move item to a new position.
|
2009-11-03 13:26:31 +00:00
|
|
|
* @param aMoveVector = the displacement vector
|
2009-07-27 14:32:40 +00:00
|
|
|
*/
|
2009-11-03 13:26:31 +00:00
|
|
|
virtual void Move( const wxPoint& aMoveVector )
|
2009-07-27 14:32:40 +00:00
|
|
|
{
|
|
|
|
m_Pos += aMoveVector;
|
2010-11-03 14:13:15 +00:00
|
|
|
|
|
|
|
BOOST_FOREACH( SCH_SHEET_PIN & label, m_labels )
|
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
label.Move( aMoveVector );
|
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-03 13:26:31 +00:00
|
|
|
virtual void Mirror_Y( int aYaxis_position );
|
2010-09-05 17:01:48 +00:00
|
|
|
virtual void Mirror_X( int aXaxis_position );
|
|
|
|
virtual void Rotate( wxPoint rotationPoint );
|
2009-07-27 14:32:40 +00:00
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
/**
|
|
|
|
* Compare schematic sheet file and sheet name against search string.
|
|
|
|
*
|
|
|
|
* @param aSearchData - Criteria to search against.
|
2010-10-20 19:43:58 +00:00
|
|
|
* @param aAuxData - a pointer on auxiliary data, if needed.
|
|
|
|
* When searching string in REFERENCE field we must know the sheet path
|
|
|
|
* This param is used in this case
|
|
|
|
* @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
|
2010-06-24 18:31:43 +00:00
|
|
|
*
|
2010-03-16 18:22:59 +00:00
|
|
|
* @return True if this item matches the search criteria.
|
|
|
|
*/
|
2010-11-03 14:13:15 +00:00
|
|
|
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
/**
|
|
|
|
* Resize this sheet to aSize and adjust all of the labels accordingly.
|
|
|
|
*
|
|
|
|
* @param aSize - The new size for this sheet.
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
void Resize( const wxSize& aSize );
|
2010-06-24 18:31:43 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetSheetNamePosition
|
2010-10-20 19:43:58 +00:00
|
|
|
* @return the position of the anchor of sheet name text
|
|
|
|
*/
|
|
|
|
wxPoint GetSheetNamePosition ();
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetFileNamePosition
|
2010-10-20 19:43:58 +00:00
|
|
|
* @return the position of the anchor of filename text
|
|
|
|
*/
|
|
|
|
wxPoint GetFileNamePosition ();
|
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList );
|
|
|
|
|
|
|
|
virtual bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList );
|
|
|
|
|
|
|
|
virtual bool IsDangling() const;
|
|
|
|
|
|
|
|
virtual bool IsSelectStateChanged( const wxRect& aRect );
|
|
|
|
|
2011-01-07 19:24:24 +00:00
|
|
|
virtual bool IsConnectable() const { return true; }
|
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
|
|
|
|
|
2009-11-03 13:26:31 +00:00
|
|
|
#if defined(DEBUG)
|
2008-04-12 18:39:20 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
// comment inherited by Doxygen from Base_Struct
|
2009-11-03 13:26:31 +00:00
|
|
|
void Show( int nestLevel, std::ostream& os );
|
2008-04-12 18:39:20 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
#endif
|
2010-06-24 18:31:43 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renumber labels in list.
|
|
|
|
*
|
|
|
|
* This method is used internally by SCH_SHEET to update the label numbering
|
|
|
|
* when the label list changes. Make sure you call this method any time a
|
|
|
|
* label is added or removed.
|
|
|
|
*/
|
|
|
|
void renumberLabels();
|
2010-12-10 19:47:44 +00:00
|
|
|
|
|
|
|
private:
|
2010-12-21 15:13:09 +00:00
|
|
|
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy, SCH_FILTER_T aFilter ) const;
|
|
|
|
virtual bool doHitTest( const EDA_Rect& aRect, bool aContained, int aAccuracy ) const;
|
|
|
|
virtual EDA_ITEM* doClone() const;
|
2008-04-12 18:39:20 +00:00
|
|
|
};
|
|
|
|
|
2011-01-22 19:48:28 +00:00
|
|
|
|
2011-01-30 22:22:38 +00:00
|
|
|
typedef std::vector< SCH_SHEET* > SCH_SHEETS;
|
2011-01-22 19:48:28 +00:00
|
|
|
|
2008-04-12 18:39:20 +00:00
|
|
|
#endif /* CLASS_DRAWSHEET_H */
|