2007-08-20 01:20:48 +00:00
|
|
|
/********************************************/
|
|
|
|
/* Definitions for the EESchema program: */
|
|
|
|
/********************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#ifndef CLASS_SCREEN_H
|
|
|
|
#define CLASS_SCREEN_H
|
|
|
|
|
|
|
|
#include "macros.h"
|
2010-11-03 14:13:15 +00:00
|
|
|
#include "sch_item_struct.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_base_screen.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-10-26 20:25:48 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Max number of sheets in a hierarchy project: */
|
|
|
|
#define NB_MAX_SHEET 500
|
|
|
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
class SCH_SCREEN : public BASE_SCREEN
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-11-03 14:13:15 +00:00
|
|
|
int m_RefCount; ///< Number of sheets referencing this screen.
|
|
|
|
///< Delete when it goes to zero.
|
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
SCH_SCREEN( KICAD_T aType = SCREEN_STRUCT_TYPE );
|
2007-08-20 01:20:48 +00:00
|
|
|
~SCH_SCREEN();
|
2008-02-26 19:19:54 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
/**
|
|
|
|
* Function GetCurItem
|
|
|
|
* returns the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
|
|
|
|
* @return SCH_ITEM* - the one selected, or NULL.
|
|
|
|
*/
|
|
|
|
SCH_ITEM* GetCurItem() const { return (SCH_ITEM*) BASE_SCREEN::GetCurItem(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetCurItem
|
|
|
|
* sets the currently selected object, m_CurrentItem.
|
|
|
|
* @param current Any object derived from SCH_ITEM
|
|
|
|
*/
|
2009-04-05 20:49:15 +00:00
|
|
|
void SetCurItem( SCH_ITEM* aItem )
|
|
|
|
{
|
|
|
|
BASE_SCREEN::SetCurItem( (BASE_SCREEN*) aItem );
|
|
|
|
}
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
2008-02-26 19:19:54 +00:00
|
|
|
return wxT( "SCH_SCREEN" );
|
2007-09-13 11:28:58 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-10-26 20:25:48 +00:00
|
|
|
/**
|
|
|
|
* Free all the items from the schematic associated with the screen.
|
|
|
|
*
|
|
|
|
* This does not delete any sub hierarchies.
|
|
|
|
*/
|
|
|
|
void FreeDrawList();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ) { };
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2010-10-26 20:25:48 +00:00
|
|
|
/**
|
|
|
|
* Remove \a aItem from the schematic associated with this screen.
|
|
|
|
*
|
|
|
|
* @param aItem - Item to be removed from schematic.
|
|
|
|
*/
|
|
|
|
void RemoveFromDrawList( SCH_ITEM* DrawStruct );
|
2008-04-30 17:04:22 +00:00
|
|
|
bool CheckIfOnDrawList( SCH_ITEM* st );
|
|
|
|
void AddToDrawList( SCH_ITEM* DrawStruct );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-04-30 17:04:22 +00:00
|
|
|
bool SchematicCleanUp( wxDC* DC = NULL );
|
|
|
|
SCH_ITEM* ExtractWires( bool CreateCopy );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
/* full undo redo management : */
|
2009-07-29 13:10:36 +00:00
|
|
|
// use BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aItem )
|
|
|
|
// use BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aItem )
|
2009-07-23 15:37:00 +00:00
|
|
|
|
|
|
|
/** Function ClearUndoORRedoList
|
|
|
|
* free the undo or redo list from List element
|
|
|
|
* Wrappers are deleted.
|
2010-10-26 20:25:48 +00:00
|
|
|
* data pointed by wrappers are deleted if not in use in schematic
|
2009-07-29 13:10:36 +00:00
|
|
|
* i.e. when they are copy of a schematic item or they are no more in use (DELETED)
|
2009-07-23 15:37:00 +00:00
|
|
|
* @param aList = the UNDO_REDO_CONTAINER to clear
|
|
|
|
* @param aItemCount = the count of items to remove. < 0 for all items
|
|
|
|
* items are removed from the beginning of the list.
|
|
|
|
* So this function can be called to remove old commands
|
|
|
|
*/
|
2010-11-03 14:13:15 +00:00
|
|
|
virtual void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 );
|
2008-04-30 17:04:22 +00:00
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
2010-10-26 20:25:48 +00:00
|
|
|
* writes the data structures for this object out to \a aFile 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.
|
|
|
|
*/
|
2008-04-30 17:04:22 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2010-11-03 14:13:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear the state flags of all the items in the screen.
|
|
|
|
*/
|
|
|
|
void ClearDrawingState();
|
|
|
|
|
|
|
|
virtual void AddItem( SCH_ITEM* aItem ) { BASE_SCREEN::AddItem( (EDA_BaseStruct*) aItem ); }
|
|
|
|
virtual void InsertItem( EDA_ITEMS::iterator aIter, SCH_ITEM* aItem )
|
|
|
|
{
|
|
|
|
BASE_SCREEN::InsertItem( aIter, (EDA_BaseStruct*) aItem );
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
/********************************************************/
|
2008-02-12 21:12:46 +00:00
|
|
|
/* Class to handle the list of *screens* in a hierarchy */
|
2008-02-26 19:19:54 +00:00
|
|
|
/********************************************************/
|
|
|
|
|
|
|
|
// screens are unique, and correspond to .sch files.
|
2010-10-26 20:25:48 +00:00
|
|
|
class SCH_SCREENS
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
private:
|
2010-10-26 20:25:48 +00:00
|
|
|
std::vector< SCH_SCREEN* > m_screens;
|
|
|
|
unsigned int m_index;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2010-10-26 20:25:48 +00:00
|
|
|
SCH_SCREENS();
|
|
|
|
~SCH_SCREENS();
|
|
|
|
int GetCount() const { return m_screens.size(); }
|
2008-02-28 19:27:25 +00:00
|
|
|
SCH_SCREEN* GetFirst();
|
|
|
|
SCH_SCREEN* GetNext();
|
2010-10-26 20:25:48 +00:00
|
|
|
SCH_SCREEN* GetScreen( unsigned int aIndex );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
private:
|
2010-10-26 20:25:48 +00:00
|
|
|
void AddScreenToList( SCH_SCREEN* aScreen );
|
|
|
|
void BuildScreenList( EDA_BaseStruct* aItem );
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* CLASS_SCREEN_H */
|