Commit 7a93d0b2 authored by Dick Hollenbeck's avatar Dick Hollenbeck

more KICAD_PLUGIN work progress

parent 8f79b146
......@@ -390,6 +390,8 @@ public:
*/
KICAD_T Type() const { return m_StructType; }
void SetTimeStamp( unsigned long aNewTimeStamp ) { m_TimeStamp = aNewTimeStamp; }
unsigned long GetTimeStamp() const { return m_TimeStamp; }
EDA_ITEM* Next() const { return (EDA_ITEM*) Pnext; }
EDA_ITEM* Back() const { return (EDA_ITEM*) Pback; }
......@@ -728,7 +730,6 @@ enum FILL_T {
*/
class EDA_TEXT
{
public:
int m_Thickness; /* pen size used to draw this text */
int m_Orient; /* Orient in 0.1 degrees */
......@@ -770,6 +771,9 @@ public:
void SetOrientation( int aOrientation ) { m_Orient = aOrientation; }
int GetOrientation() const { return m_Orient; }
void SetItalic( bool isItalic ) { m_Italic = isItalic; }
bool GetItalic() const { return m_Italic; }
/**
* Function SetSize
* sets text size.
......
......@@ -112,6 +112,8 @@ public:
return m_Name;
}
void SetName( const wxString& aName ) { m_Name = aName; }
/**
* Function GetCount
* returns the number of nets in this NETCLASS, i.e. using these rules.
......
......@@ -82,7 +82,6 @@ public:
*/
void DisplayInfo( EDA_DRAW_FRAME* frame );
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
......@@ -94,7 +93,6 @@ public:
return TextHitTest( refPos );
}
/**
* Function HitTest (overloaded)
* tests if the given EDA_RECT intersect this object.
......@@ -149,7 +147,6 @@ public:
*/
virtual void Show( int nestLevel, std::ostream& os );
#endif
};
#endif // #define CLASS_PCB_TEXT_H
......@@ -117,23 +117,18 @@ public:
*/
virtual void Flip( const wxPoint& aCentre );
/**
* Function GetPosition
* returns the position of this object.
* @return const wxPoint& - The position of this object.
*/
wxPoint& GetPosition()
{
return m_Start; // it had to be start or end.
}
const wxPoint GetPosition() const // overload
{
return m_Start; // it had to be start or end.
}
int GetWidth() const { return m_Width; }
void SetWidth( int aWidth ) { m_Width = aWidth; }
void SetPosition( const wxPoint& aPos ) { m_Start = aPos; } // overload
void SetEnd( const wxPoint& aEnd ) { m_Start = aEnd; }
EDA_RECT GetBoundingBox() const;
/**
......@@ -177,13 +172,13 @@ public:
return hypot( dx, dy );
}
/* Display on screen: */
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode,
const wxPoint& aOffset = ZeroOffset );
/* divers */
int Shape() const { return m_Shape & 0xFF; }
void SetShape( int aShape ) { m_Shape = aShape; }
/**
* Function TransformShapeWithClearanceToPolygon
......@@ -489,7 +484,6 @@ public:
return wxT( "VIA" );
}
virtual wxString GetSelectMenuText() const;
virtual BITMAP_DEF GetMenuImage() const { return via_sketch_xpm; }
......
......@@ -27,22 +27,26 @@
#include <kicad_plugin.h>
// some day plugins could be in separate DLL/DSOs, until then, use the simplest method:
// Some day plugins might be in separate DLL/DSOs, simply because of numbers of them
// and code size. Until then, use the simplest method:
// This implementation is one of two which could be done.
// the other one would cater to DLL/DSO's. But since it would be nearly
// The other one would cater to DLL/DSO's. But since it would be nearly
// impossible to link a KICAD type DLL/DSO right now without pulling in all
// ::Draw() functions, I forgo that option.
// ::Draw() functions, I forgo that option temporarily.
// Some day it may be possible to have some built in AND some DLL/DSO, but
// only when we can keep things clean enough to link a DLL/DSO without
// pulling in the world.
// Some day it may be possible to have some built in AND some DLL/DSO
// plugins coexisting.
static KICAD_PLUGIN kicad_plugin;
static KICAD_PLUGIN kicad_plugin; // a secret
//static EAGLE_PLUGIN eagle_plugin;
PLUGIN* IO_MGR::PluginFind( PCB_FILE_T aFileType )
{
// This implementation is subject to change, any magic is allowed here.
// The public IO_MGR API is the only pertinent public information.
switch( aFileType )
{
case KICAD: return &kicad_plugin;
......@@ -104,7 +108,7 @@ BOARD* PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES*
wxString msg;
msg.Printf( _( "Plugin %s does not implement the BOARD Load() function.\n" ),
Name().GetData() );
PluginName().GetData() );
THROW_IO_ERROR( msg );
}
......@@ -118,7 +122,7 @@ void PLUGIN::Save( const wxString* aFileName, BOARD* aBoard, PROPERTIES* aProper
wxString msg;
msg.Printf( _( "Plugin %s does not implement the BOARD Save() function.\n" ),
Name().GetData() );
PluginName().GetData() );
THROW_IO_ERROR( msg );
}
......
......@@ -40,7 +40,7 @@ class PLUGIN;
/**
* Class IO_MGR
* is factory which returns an instance of a PLUGIN DSO/DLL.
* is a factory which returns an instance of a PLUGIN.
*/
class IO_MGR
{
......@@ -63,7 +63,8 @@ public:
* Function PluginFind
* returns a PLUGIN which the caller can use to import, export, save, or load
* design documents. The returned PLUGIN, may be reference counted, so please
* call PluginRelease() when you are done using the returned PLUGIN.
* call PluginRelease() when you are done using the returned PLUGIN. It may or
* may not be code running from a DLL/DSO.
*
* @param aFileType is from PCB_FILE_T and tells which plugin to find.
*
......@@ -88,21 +89,21 @@ public:
/**
* Function Load
* finds the requested plugin and loads a BOARD, or throws an exception trying.
* finds the requested PLUGIN and loads a BOARD, or throws an exception trying.
*
* @param aFileType is the type of file to load.
* @param aFileType is the PCB_FILE_T of file to load.
*
* @param aFileName is the name of the file to load.
*
* @param aAppendToMe is an existing BOARD to append to, use NULL if fresh
* board load wanted.
* board load is wanted.
*
* @param aProperties is an associative array that allows the caller to
* pass additional tuning parameters to the plugin.
* pass additional tuning parameters to the PLUGIN.
*
* @return BOARD* - caller owns it, never NULL because exception thrown if error.
*
* @throw IO_ERROR if the pluging cannot be found, file cannot be found,
* @throw IO_ERROR if the PLUGIN cannot be found, file cannot be found,
* or file cannot be loaded.
*/
static BOARD* Load( PCB_FILE_T aFileType, const wxString& aFileName,
......@@ -168,7 +169,12 @@ public:
}
};
virtual const wxString& Name() = 0;
/**
* Function PluginName
* returns a brief hard coded name for this PLUGIN.
*/
virtual const wxString& PluginName() = 0;
//-----<BOARD STUFF>----------------------------------------------------
......@@ -192,7 +198,7 @@ public:
* @throw IO_ERROR if there is a problem loading, and its contents should
* say what went wrong.
*/
virtual BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe,
virtual BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe,
PROPERTIES* aProperties = NULL );
/**
......@@ -255,4 +261,3 @@ public:
};
#endif // IO_MGR_H_
This diff is collapsed.
......@@ -52,7 +52,7 @@ public:
void Save( const wxString* aFileName, BOARD* aBoard, PROPERTIES* aProperties = NULL );
const wxString& Name()
const wxString& PluginName()
{
static const wxString name = wxT( "KiCad" );
return name;
......@@ -108,12 +108,19 @@ protected:
void loadDRAWSEGMENT();
void loadNETINFO_ITEM();
void loadPCB_TEXTE();
void loadNETCLASS();
/*
/**
* Function loadTrackList
* reads a list of segments (Tracks and Vias)
*/
void loadTrackList( TRACK* aInsertBeforeMe, int aStructType, int aSegCount );
/* @todo
void load( PCB_TARGET* me );
void load( NETINFO* me );
void load( TRACK* me );
void load( NETCLASS* me );
void load( ZONE_CONTAINER* me );
void load( DIMENSION* me );
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment