2007-08-24 15:10:46 +00:00
|
|
|
|
/********************************************/
|
|
|
|
|
/* Definitions for the EESchema program: */
|
|
|
|
|
/********************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
#ifndef PROGRAM_H
|
|
|
|
|
#define PROGRAM_H
|
|
|
|
|
|
|
|
|
|
#ifndef eda_global
|
|
|
|
|
#define eda_global extern
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "macros.h"
|
|
|
|
|
#include "base_struct.h"
|
|
|
|
|
|
|
|
|
|
#include "component_class.h"
|
|
|
|
|
#include "class_screen.h"
|
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
#define DRAWJUNCTION_SIZE 16 /* Rayon du symbole connexion */
|
|
|
|
|
#define DRAWMARKER_SIZE 16 /* Rayon du symbole marqueur */
|
|
|
|
|
#define DRAWNOCONNECT_SIZE 48 /* Rayon du symbole No Connexion */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
#define HIGHLIGHT_COLOR WHITE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define TEXT_NO_VISIBLE 1
|
|
|
|
|
|
|
|
|
|
/* flags pour BUS ENTRY (bus to bus ou wire to bus */
|
|
|
|
|
#define WIRE_TO_BUS 0
|
2007-08-24 15:10:46 +00:00
|
|
|
|
#define BUS_TO_BUS 1
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
typedef enum { /* Type des Marqueurs */
|
|
|
|
|
MARQ_UNSPEC,
|
|
|
|
|
MARQ_ERC,
|
|
|
|
|
MARQ_PCB,
|
|
|
|
|
MARQ_SIMUL,
|
|
|
|
|
MARQ_NMAX /* Derniere valeur: fin de tableau */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
} TypeMarker;
|
|
|
|
|
|
|
|
|
|
/* Messages correspondants aux types des marqueurs */
|
|
|
|
|
#ifdef MAIN
|
2007-08-24 15:10:46 +00:00
|
|
|
|
const wxChar* NameMarqueurType[] =
|
|
|
|
|
{
|
|
|
|
|
wxT( "" ),
|
|
|
|
|
wxT( "ERC" ),
|
|
|
|
|
wxT( "PCB" ),
|
|
|
|
|
wxT( "SIMUL" ),
|
|
|
|
|
wxT( "?????" )
|
|
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
#else
|
2007-08-24 15:10:46 +00:00
|
|
|
|
extern const wxChar* NameMarqueurType[];
|
2007-06-05 12:10:51 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Forward declarations */
|
|
|
|
|
class DrawSheetStruct;
|
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class EDA_DrawLineStruct
|
|
|
|
|
* is a segment decription base class to describe items which have 2 end
|
|
|
|
|
* points (track, wire, draw line ...)
|
|
|
|
|
*/
|
|
|
|
|
class EDA_DrawLineStruct : public EDA_BaseStruct
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2007-08-24 15:10:46 +00:00
|
|
|
|
int m_Layer; // Layer number
|
|
|
|
|
int m_Width; // 0 = line, > 0 = tracks, bus ...
|
|
|
|
|
wxPoint m_Start; // Line start point
|
|
|
|
|
wxPoint m_End; // Line end point
|
|
|
|
|
|
|
|
|
|
bool m_StartIsDangling;
|
|
|
|
|
bool m_EndIsDangling; // TRUE si Start ou End not connected (wires, tracks...)
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2007-09-13 11:28:58 +00:00
|
|
|
|
EDA_DrawLineStruct( const wxPoint& pos, int layer );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
~EDA_DrawLineStruct() { }
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
|
return wxT( "EDA_DrawLine" );
|
2007-09-13 11:28:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
bool IsOneEndPointAt( const wxPoint& pos );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
EDA_DrawLineStruct* GenCopy();
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
bool IsNull()
|
2007-08-24 15:10:46 +00:00
|
|
|
|
{
|
|
|
|
|
return m_Start == m_End;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
|
|
|
|
int Color = -1 );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
|
|
|
|
#if defined(DEBUG)
|
|
|
|
|
/**
|
|
|
|
|
* Function Show
|
|
|
|
|
* is used to output the object tree, currently for debugging only.
|
|
|
|
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
|
|
|
|
* of nesting of this object within the overall tree.
|
|
|
|
|
* @param os The ostream& to output to.
|
|
|
|
|
*/
|
|
|
|
|
void Show( int nestLevel, std::ostream& os );
|
|
|
|
|
#endif
|
2007-06-05 12:10:51 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
class DrawMarkerStruct : public EDA_BaseStruct /* marqueurs */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2007-08-24 15:10:46 +00:00
|
|
|
|
wxPoint m_Pos; /* XY coordinates of marker. */
|
|
|
|
|
TypeMarker m_Type;
|
|
|
|
|
int m_MarkFlags; // complements d'information
|
|
|
|
|
wxString m_Comment; /* Texte (commentaireassocie eventuel */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2007-09-13 11:28:58 +00:00
|
|
|
|
DrawMarkerStruct( const wxPoint& pos, const wxString& text );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
~DrawMarkerStruct();
|
2007-09-13 11:28:58 +00:00
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
|
return wxT( "DrawMarker" );
|
2007-09-13 11:28:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
DrawMarkerStruct* GenCopy();
|
|
|
|
|
wxString GetComment();
|
2007-08-24 15:10:46 +00:00
|
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
|
|
|
|
int draw_mode, int Color = -1 );
|
2007-09-20 21:06:49 +00:00
|
|
|
|
#if defined(DEBUG)
|
|
|
|
|
/**
|
|
|
|
|
* Function Show
|
|
|
|
|
* is used to output the object tree, currently for debugging only.
|
|
|
|
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
|
|
|
|
* of nesting of this object within the overall tree.
|
|
|
|
|
* @param os The ostream& to output to.
|
|
|
|
|
*/
|
|
|
|
|
void Show( int nestLevel, std::ostream& os );
|
|
|
|
|
#endif
|
2007-06-05 12:10:51 +00:00
|
|
|
|
};
|
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
|
|
class DrawNoConnectStruct : public EDA_BaseStruct /* Symboles de non connexion */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2007-08-24 15:10:46 +00:00
|
|
|
|
wxPoint m_Pos; /* XY coordinates of NoConnect. */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2007-09-13 11:28:58 +00:00
|
|
|
|
DrawNoConnectStruct( const wxPoint& pos );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
~DrawNoConnectStruct() { }
|
2007-09-13 11:28:58 +00:00
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
|
return wxT( "DrawNoConnect" );
|
2007-09-13 11:28:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
DrawNoConnectStruct* GenCopy();
|
2007-08-24 15:10:46 +00:00
|
|
|
|
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-24 15:10:46 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class DrawBusEntryStruct
|
2007-09-13 11:28:58 +00:00
|
|
|
|
* Struct de descr 1 raccord a 45 degres de BUS ou WIRE
|
2007-08-24 15:10:46 +00:00
|
|
|
|
*/
|
|
|
|
|
class DrawBusEntryStruct : public EDA_BaseStruct
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2007-08-24 15:10:46 +00:00
|
|
|
|
int m_Layer;
|
|
|
|
|
int m_Width;
|
|
|
|
|
wxPoint m_Pos;
|
|
|
|
|
wxSize m_Size;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2007-09-13 11:28:58 +00:00
|
|
|
|
DrawBusEntryStruct( const wxPoint& pos, int shape, int id );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
~DrawBusEntryStruct() { }
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
|
return wxT( "DrawBusEntry" );
|
2007-09-13 11:28:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
DrawBusEntryStruct* GenCopy();
|
|
|
|
|
wxPoint m_End(); // retourne la coord de fin du raccord
|
2007-08-24 15:10:46 +00:00
|
|
|
|
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-09-13 11:28:58 +00:00
|
|
|
|
class DrawPolylineStruct : public EDA_BaseStruct /* Polyligne (serie de segments) */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2007-08-24 15:10:46 +00:00
|
|
|
|
int m_Layer;
|
|
|
|
|
int m_Width;
|
|
|
|
|
int m_NumOfPoints; /* Number of XY pairs in Points array. */
|
|
|
|
|
int* m_Points; /* XY pairs that forms the polyline. */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2007-08-24 15:10:46 +00:00
|
|
|
|
DrawPolylineStruct( int layer );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
~DrawPolylineStruct();
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
|
return wxT( "DrawPolyline" );
|
2007-09-13 11:28:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
DrawPolylineStruct* GenCopy();
|
2007-08-24 15:10:46 +00:00
|
|
|
|
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-24 15:10:46 +00:00
|
|
|
|
class DrawJunctionStruct : public EDA_BaseStruct
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2007-08-24 15:10:46 +00:00
|
|
|
|
int m_Layer;
|
|
|
|
|
wxPoint m_Pos; /* XY coordinates of connection. */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2007-09-13 11:28:58 +00:00
|
|
|
|
DrawJunctionStruct( const wxPoint& pos );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
~DrawJunctionStruct() { }
|
2007-09-20 21:06:49 +00:00
|
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
|
return wxT( "DrawJunction" );
|
2007-09-13 11:28:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
DrawJunctionStruct* GenCopy();
|
2007-08-24 15:10:46 +00:00
|
|
|
|
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-09-01 12:00:30 +00:00
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
class DrawTextStruct : public EDA_BaseStruct, public EDA_TextStruct
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2007-08-24 15:10:46 +00:00
|
|
|
|
int m_Layer;
|
|
|
|
|
int m_Shape;
|
2007-09-01 12:00:30 +00:00
|
|
|
|
bool m_IsDangling; // TRUE si non connect<63>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2007-09-13 11:28:58 +00:00
|
|
|
|
DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
|
|
|
|
|
KICAD_T aType = DRAW_TEXT_STRUCT_TYPE );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
~DrawTextStruct() { }
|
2007-09-13 11:28:58 +00:00
|
|
|
|
|
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
|
return wxT( "DrawText" );
|
2007-09-13 11:28:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
DrawTextStruct* GenCopy();
|
2007-08-24 15:10:46 +00:00
|
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
|
|
|
|
int Color = -1 );
|
2007-09-13 11:28:58 +00:00
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
void SwapData( DrawTextStruct* copyitem );
|
|
|
|
|
|
2007-09-13 11:28:58 +00:00
|
|
|
|
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
};
|
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
class DrawLabelStruct : public DrawTextStruct
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2007-08-24 15:10:46 +00:00
|
|
|
|
DrawLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
~DrawLabelStruct() { }
|
2007-09-13 11:28:58 +00:00
|
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
|
|
|
|
int Color = -1 );
|
|
|
|
|
|
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
|
return wxT( "DrawLabel" );
|
2007-09-13 11:28:58 +00:00
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
};
|
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
|
class DrawGlobalLabelStruct : public DrawTextStruct
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2007-09-13 11:28:58 +00:00
|
|
|
|
DrawGlobalLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ),
|
|
|
|
|
const wxString& text = wxEmptyString );
|
2007-09-01 12:00:30 +00:00
|
|
|
|
~DrawGlobalLabelStruct() { }
|
2007-09-13 11:28:58 +00:00
|
|
|
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
|
|
|
|
int Color = -1 );
|
|
|
|
|
|
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
|
{
|
2007-09-20 21:06:49 +00:00
|
|
|
|
return wxT( "DrawGlobalLabel" );
|
2007-09-13 11:28:58 +00:00
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define MAX_LAYERS 44
|
|
|
|
|
class LayerStruct
|
|
|
|
|
{
|
|
|
|
|
public:
|
2007-08-24 15:10:46 +00:00
|
|
|
|
char LayerNames[MAX_LAYERS + 1][8];
|
|
|
|
|
int LayerColor[MAX_LAYERS + 1];
|
|
|
|
|
char LayerStatus[MAX_LAYERS + 1];
|
|
|
|
|
int NumberOfLayers;
|
|
|
|
|
int CurrentLayer;
|
|
|
|
|
int CurrentWidth;
|
|
|
|
|
int CommonColor;
|
|
|
|
|
int Flags;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* PROGRAM_H */
|