kicad/eeschema/program.h

301 lines
7.4 KiB
C
Raw Normal View History

/********************************************/
/* Definitions for the EESchema program: */
/********************************************/
#ifndef PROGRAM_H
#define PROGRAM_H
#ifndef eda_global
#define eda_global extern
#endif
#include "wxEeschemaStruct.h"
#include "macros.h"
#include "base_struct.h"
#include "sch_item_struct.h"
#include "component_class.h"
#include "class_screen.h"
2008-04-12 18:39:20 +00:00
#include "class_drawsheet.h"
#include "class_text-label.h"
#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 */
#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
#define BUS_TO_BUS 1
2008-04-22 17:19:28 +00:00
enum TypeMarker { /* Type des Marqueurs */
MARQ_UNSPEC,
MARQ_ERC,
MARQ_PCB,
MARQ_SIMUL,
MARQ_NMAX /* Derniere valeur: fin de tableau */
2008-04-22 17:19:28 +00:00
};
/* Messages correspondants aux types des marqueurs */
#ifdef MAIN
const wxChar* NameMarqueurType[] =
{
wxT( "" ),
wxT( "ERC" ),
wxT( "PCB" ),
wxT( "SIMUL" ),
wxT( "?????" )
};
#else
extern const wxChar* NameMarqueurType[];
#endif
/* Forward declarations */
class DrawSheetStruct;
/**
* 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 SCH_ITEM
{
public:
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...)
public:
EDA_DrawLineStruct( const wxPoint& pos, int layer );
2007-09-01 12:00:30 +00:00
~EDA_DrawLineStruct() { }
2008-03-13 05:04:59 +00:00
virtual wxString GetClass() const
{
2007-09-20 21:06:49 +00:00
return wxT( "EDA_DrawLine" );
}
bool IsOneEndPointAt( const wxPoint& pos );
2007-09-01 12:00:30 +00:00
EDA_DrawLineStruct* GenCopy();
2007-09-01 12:00:30 +00:00
bool IsNull()
{
return m_Start == m_End;
}
2008-03-15 04:18:32 +00:00
EDA_Rect GetBoundingBox();
2008-03-13 05:04:59 +00:00
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
2008-03-13 05:04:59 +00:00
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.
*/
bool Save( FILE* aFile ) const;
2008-03-13 05:04:59 +00:00
#if defined(DEBUG)
2007-09-20 21:06:49 +00:00
void Show( int nestLevel, std::ostream& os );
2008-03-13 05:04:59 +00:00
#endif
};
class DrawMarkerStruct : public SCH_ITEM /* marqueurs */
{
public:
wxPoint m_Pos; /* XY coordinates of marker. */
TypeMarker m_Type;
int m_MarkFlags; // complements d'information
wxString m_Comment; /* Texte (commentaireassocie eventuel */
public:
DrawMarkerStruct( const wxPoint& pos, const wxString& text );
2007-09-01 12:00:30 +00:00
~DrawMarkerStruct();
virtual wxString GetClass() const
{
2007-09-20 21:06:49 +00:00
return wxT( "DrawMarker" );
}
2007-09-01 12:00:30 +00:00
DrawMarkerStruct* GenCopy();
wxString GetComment();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 );
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.
*/
bool Save( FILE* aFile ) const;
2008-03-13 05:04:59 +00:00
#if defined(DEBUG)
2007-09-20 21:06:49 +00:00
void Show( int nestLevel, std::ostream& os );
2008-03-13 05:04:59 +00:00
#endif
};
class DrawNoConnectStruct : public SCH_ITEM /* Symboles de non connexion */
{
public:
wxPoint m_Pos; /* XY coordinates of NoConnect. */
public:
DrawNoConnectStruct( const wxPoint& pos );
2007-09-01 12:00:30 +00:00
~DrawNoConnectStruct() { }
virtual wxString GetClass() const
{
2007-09-20 21:06:49 +00:00
return wxT( "DrawNoConnect" );
}
2007-09-01 12:00:30 +00:00
DrawNoConnectStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 );
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.
*/
bool Save( FILE* aFile ) const;
EDA_Rect GetBoundingBox();
};
/**
* Class DrawBusEntryStruct
* Struct de descr 1 raccord a 45 degres de BUS ou WIRE
*/
class DrawBusEntryStruct : public SCH_ITEM
{
public:
int m_Width;
wxPoint m_Pos;
wxSize m_Size;
public:
DrawBusEntryStruct( const wxPoint& pos, int shape, int id );
2007-09-01 12:00:30 +00:00
~DrawBusEntryStruct() { }
2008-03-13 05:04:59 +00:00
virtual wxString GetClass() const
{
2007-09-20 21:06:49 +00:00
return wxT( "DrawBusEntry" );
}
2007-09-01 12:00:30 +00:00
DrawBusEntryStruct* GenCopy();
2008-04-15 19:38:19 +00:00
wxPoint m_End() const ; // retourne la coord de fin du raccord
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 );
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.
*/
bool Save( FILE* aFile ) const;
EDA_Rect GetBoundingBox();
};
class DrawPolylineStruct : public SCH_ITEM /* Polyligne (serie de segments) */
{
public:
int m_Width;
int m_NumOfPoints; /* Number of XY pairs in Points array. */
int* m_Points; /* XY pairs that forms the polyline. */
public:
DrawPolylineStruct( int layer );
2007-09-01 12:00:30 +00:00
~DrawPolylineStruct();
2008-03-13 05:04:59 +00:00
virtual wxString GetClass() const
{
2007-09-20 21:06:49 +00:00
return wxT( "DrawPolyline" );
}
2007-09-01 12:00:30 +00:00
DrawPolylineStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 );
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.
*/
bool Save( FILE* aFile ) const;
};
class DrawJunctionStruct : public SCH_ITEM
{
public:
wxPoint m_Pos; /* XY coordinates of connection. */
public:
DrawJunctionStruct( const wxPoint& pos );
2007-09-01 12:00:30 +00:00
~DrawJunctionStruct() { }
2008-03-13 05:04:59 +00:00
virtual wxString GetClass() const
{
2007-09-20 21:06:49 +00:00
return wxT( "DrawJunction" );
}
2008-03-15 04:18:32 +00:00
EDA_Rect GetBoundingBox();
2007-09-01 12:00:30 +00:00
DrawJunctionStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 );
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.
*/
bool Save( FILE* aFile ) const;
2008-04-22 16:38:23 +00:00
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os );
#endif
};
2007-09-01 12:00:30 +00:00
#define MAX_LAYERS 44
class LayerStruct
{
public:
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;
};
#endif /* PROGRAM_H */