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
|
|
|
|
|
|
|
|
#ifndef eda_global
|
2008-08-11 11:45:29 +00:00
|
|
|
#define eda_global extern
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "macros.h"
|
|
|
|
#include "base_struct.h"
|
|
|
|
|
|
|
|
/* 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:
|
2008-04-30 17:04:22 +00:00
|
|
|
int m_RefCount; /*how many sheets reference 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
|
|
|
|
*/
|
|
|
|
void SetCurItem( SCH_ITEM* aItem ) { BASE_SCREEN::SetCurItem( aItem ); }
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2008-04-30 17:04:22 +00:00
|
|
|
void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies)
|
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
|
|
|
|
2008-04-30 17:04:22 +00:00
|
|
|
void RemoveFromDrawList( SCH_ITEM* DrawStruct ); /* remove DrawStruct from EEDrawList. */
|
|
|
|
bool CheckIfOnDrawList( SCH_ITEM* st );
|
|
|
|
void AddToDrawList( SCH_ITEM* DrawStruct );
|
|
|
|
void ClearUndoORRedoList( EDA_BaseStruct* List );
|
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 : */
|
2008-04-30 17:04:22 +00:00
|
|
|
virtual void ClearUndoRedoList();
|
|
|
|
virtual void AddItemToUndoList( EDA_BaseStruct* item );
|
|
|
|
virtual void AddItemToRedoList( EDA_BaseStruct* item );
|
|
|
|
|
2008-04-15 19:38:19 +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-30 17:04:22 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
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.
|
|
|
|
WX_DEFINE_ARRAY( SCH_SCREEN *, ScreenGrowArray );
|
2007-06-05 12:10:51 +00:00
|
|
|
class EDA_ScreenList
|
|
|
|
{
|
|
|
|
private:
|
2008-02-12 21:12:46 +00:00
|
|
|
ScreenGrowArray m_List;
|
2008-02-26 19:19:54 +00:00
|
|
|
unsigned int m_Index;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2008-04-12 18:39:20 +00:00
|
|
|
EDA_ScreenList();
|
2008-02-26 19:19:54 +00:00
|
|
|
~EDA_ScreenList() { }
|
|
|
|
int GetCount() { return m_List.GetCount(); }
|
2008-02-28 19:27:25 +00:00
|
|
|
SCH_SCREEN* GetFirst();
|
|
|
|
SCH_SCREEN* GetNext();
|
|
|
|
SCH_SCREEN* GetScreen( unsigned int index );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
private:
|
2008-04-30 17:04:22 +00:00
|
|
|
void AddScreenToList( SCH_SCREEN* testscreen );
|
|
|
|
void BuildScreenList( EDA_BaseStruct* sheet );
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* CLASS_SCREEN_H */
|