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
|
|
|
|
|
#define eda_global extern
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "macros.h"
|
|
|
|
|
#include "base_struct.h"
|
|
|
|
|
|
|
|
|
|
/* Max number of sheets in a hierarchy project: */
|
|
|
|
|
#define NB_MAX_SHEET 500
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Type des labels sur sheet (Labels sur hierarchie) et forme des Global-Labels*/
|
|
|
|
|
typedef enum {
|
2007-08-20 01:20:48 +00:00
|
|
|
|
NET_INPUT,
|
|
|
|
|
NET_OUTPUT,
|
|
|
|
|
NET_BIDI,
|
|
|
|
|
NET_TRISTATE,
|
|
|
|
|
NET_UNSPECIFIED,
|
|
|
|
|
NET_TMAX /* Derniere valeur: fin de tableau */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
} TypeSheetLabel;
|
|
|
|
|
|
|
|
|
|
/* Messages correspondants aux types ou forme des labels */
|
|
|
|
|
#ifdef MAIN
|
2007-08-20 01:20:48 +00:00
|
|
|
|
const char* SheetLabelType[] =
|
|
|
|
|
{
|
|
|
|
|
"Input",
|
|
|
|
|
"Output",
|
|
|
|
|
"BiDi",
|
|
|
|
|
"3State",
|
|
|
|
|
"UnSpc",
|
|
|
|
|
"?????"
|
|
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
#else
|
2007-08-20 01:20:48 +00:00
|
|
|
|
extern const char* SheetLabelType[];
|
2007-06-05 12:10:51 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Description du graphisme des icones associes aux types des Global_Labels */
|
|
|
|
|
#ifdef MAIN
|
2007-08-20 01:20:48 +00:00
|
|
|
|
int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 };
|
|
|
|
|
int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 };
|
|
|
|
|
int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 };
|
|
|
|
|
int TemplateIN_UP[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 };
|
|
|
|
|
|
|
|
|
|
int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 };
|
|
|
|
|
int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 };
|
|
|
|
|
int TemplateOUT_BOTTOM[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 };
|
|
|
|
|
int TemplateOUT_UP[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 };
|
|
|
|
|
|
|
|
|
|
int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 };
|
|
|
|
|
int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 };
|
|
|
|
|
int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 };
|
|
|
|
|
int TemplateUNSPC_UP[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 };
|
|
|
|
|
|
|
|
|
|
int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
|
|
|
|
|
int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
|
|
|
|
|
int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
|
|
|
|
|
int TemplateBIDI_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
|
|
|
|
|
|
|
|
|
|
int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
|
|
|
|
|
int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
|
|
|
|
|
int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
|
|
|
|
|
int Template3STATE_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
|
|
|
|
|
|
|
|
|
|
int* TemplateShape[5][4] =
|
|
|
|
|
{
|
|
|
|
|
{ TemplateIN_HN, TemplateIN_UP, TemplateIN_HI, TemplateIN_BOTTOM },
|
|
|
|
|
{ TemplateOUT_HN, TemplateOUT_UP, TemplateOUT_HI, TemplateOUT_BOTTOM },
|
|
|
|
|
{ TemplateBIDI_HN, TemplateBIDI_UP, TemplateBIDI_HI, TemplateBIDI_BOTTOM },
|
|
|
|
|
{ Template3STATE_HN, Template3STATE_UP, Template3STATE_HI, Template3STATE_BOTTOM },
|
|
|
|
|
{ TemplateUNSPC_HN, TemplateUNSPC_UP, TemplateUNSPC_HI, TemplateUNSPC_BOTTOM }
|
|
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
#else
|
2007-08-20 01:20:48 +00:00
|
|
|
|
extern int* TemplateShape[5][4];
|
2007-06-05 12:10:51 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Forward declarations */
|
|
|
|
|
class DrawSheetStruct;
|
|
|
|
|
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
class SCH_SCREEN : public BASE_SCREEN
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2007-09-01 12:00:30 +00:00
|
|
|
|
SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
~SCH_SCREEN();
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
|
{
|
|
|
|
|
return wxT("SCH_SCREEN");
|
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies)
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { };
|
|
|
|
|
void RemoveFromDrawList( EDA_BaseStruct* DrawStruct );/* remove DrawStruct from EEDrawList. */
|
|
|
|
|
void ClearUndoORRedoList( EDA_BaseStruct* List );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
bool SchematicCleanUp( wxDC* DC = NULL );
|
|
|
|
|
EDA_BaseStruct* ExtractWires( bool CreateCopy );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
/* full undo redo management : */
|
2007-09-01 12:00:30 +00:00
|
|
|
|
virtual void ClearUndoRedoList();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
virtual void AddItemToUndoList( EDA_BaseStruct* item );
|
|
|
|
|
virtual void AddItemToRedoList( EDA_BaseStruct* item );
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
class DrawSheetLabelStruct : public EDA_BaseStruct, public EDA_TextStruct
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2007-08-23 04:28:46 +00:00
|
|
|
|
int m_Layer;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
int m_Edge, m_Shape;
|
|
|
|
|
bool m_IsDangling; // TRUE si non connect<63>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DrawSheetLabelStruct( DrawSheetStruct* parent,
|
|
|
|
|
const wxPoint& pos = wxPoint( 0, 0 ),
|
|
|
|
|
const wxString& text = wxEmptyString );
|
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
~DrawSheetLabelStruct() { }
|
2007-09-13 11:28:58 +00:00
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
|
{
|
|
|
|
|
return wxT("DrawSheetLabelStruct");
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
DrawSheetLabelStruct* GenCopy();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
DrawSheetLabelStruct* Next()
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{ return (DrawSheetLabelStruct*) Pnext; }
|
|
|
|
|
|
|
|
|
|
void Place( WinEDA_DrawFrame* frame, wxDC* DC );
|
|
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
|
|
|
|
int draw_mode, int Color = -1 );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
class DrawSheetStruct : public SCH_SCREEN /* Gestion de la hierarchie */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2007-08-20 01:20:48 +00:00
|
|
|
|
wxString m_SheetName;
|
|
|
|
|
int m_SheetNameSize;
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
// wxString m_FileName; in SCH_SCREEN
|
2007-08-20 01:20:48 +00:00
|
|
|
|
int m_FileNameSize;
|
|
|
|
|
wxPoint m_Pos;
|
|
|
|
|
wxSize m_Size; /* Position and Size of sheet symbol */
|
2007-08-23 04:28:46 +00:00
|
|
|
|
int m_Layer;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DrawSheetLabelStruct* m_Label; /* Points de connection */
|
|
|
|
|
int m_NbLabel; /* Nombre de points de connexion */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
~DrawSheetStruct();
|
2007-09-13 11:28:58 +00:00
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
|
{
|
|
|
|
|
return wxT("DrawSheetStruct");
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void Place( WinEDA_DrawFrame* frame, wxDC* DC );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
DrawSheetStruct* GenCopy();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void Display_Infos( WinEDA_DrawFrame* frame );
|
|
|
|
|
void CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC );
|
|
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
|
|
|
|
int draw_mode, int Color = -1 );
|
|
|
|
|
void SwapData( DrawSheetStruct* copyitem );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Class to handle the list of screens in a hierarchy */
|
|
|
|
|
class EDA_ScreenList
|
|
|
|
|
{
|
|
|
|
|
private:
|
2007-08-20 01:20:48 +00:00
|
|
|
|
int m_Count;
|
|
|
|
|
SCH_SCREEN** m_List;
|
|
|
|
|
int m_Index;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2007-08-20 01:20:48 +00:00
|
|
|
|
EDA_ScreenList( EDA_BaseStruct* DrawStruct );
|
|
|
|
|
~EDA_ScreenList();
|
2007-09-01 12:00:30 +00:00
|
|
|
|
int GetCount() { return m_Count; }
|
|
|
|
|
SCH_SCREEN* GetFirst();
|
|
|
|
|
SCH_SCREEN* GetNext();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
SCH_SCREEN* GetScreen( int index );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
void UpdateSheetNumberAndDate();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
private:
|
2007-08-20 01:20:48 +00:00
|
|
|
|
SCH_SCREEN** BuildScreenList( SCH_SCREEN** ScreenList,
|
|
|
|
|
EDA_BaseStruct* DrawStruct, int* Count );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif /* CLASS_SCREEN_H */
|