Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
7a93d0b2
Commit
7a93d0b2
authored
Nov 30, 2011
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more KICAD_PLUGIN work progress
parent
8f79b146
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
338 additions
and
115 deletions
+338
-115
base_struct.h
include/base_struct.h
+5
-1
class_netclass.h
pcbnew/class_netclass.h
+2
-0
class_pcb_text.h
pcbnew/class_pcb_text.h
+0
-3
class_track.h
pcbnew/class_track.h
+6
-12
io_mgr.cpp
pcbnew/io_mgr.cpp
+13
-9
io_mgr.h
pcbnew/io_mgr.h
+15
-10
kicad_plugin.cpp
pcbnew/kicad_plugin.cpp
+287
-77
kicad_plugin.h
pcbnew/kicad_plugin.h
+10
-3
No files found.
include/base_struct.h
View file @
7a93d0b2
...
...
@@ -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.
...
...
pcbnew/class_netclass.h
View file @
7a93d0b2
...
...
@@ -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.
...
...
pcbnew/class_pcb_text.h
View file @
7a93d0b2
...
...
@@ -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
pcbnew/class_track.h
View file @
7a93d0b2
...
...
@@ -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
;
}
...
...
pcbnew/io_mgr.cpp
View file @
7a93d0b2
...
...
@@ -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.
//
t
he other one would cater to DLL/DSO's. But since it would be nearly
//
T
he 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
()
);
Plugin
Name
().
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
()
);
Plugin
Name
().
GetData
()
);
THROW_IO_ERROR
(
msg
);
}
...
...
pcbnew/io_mgr.h
View file @
7a93d0b2
...
...
@@ -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>----------------------------------------------------
...
...
@@ -255,4 +261,3 @@ public:
};
#endif // IO_MGR_H_
pcbnew/kicad_plugin.cpp
View file @
7a93d0b2
This diff is collapsed.
Click to expand it.
pcbnew/kicad_plugin.h
View file @
7a93d0b2
...
...
@@ -52,7 +52,7 @@ public:
void
Save
(
const
wxString
*
aFileName
,
BOARD
*
aBoard
,
PROPERTIES
*
aProperties
=
NULL
);
const
wxString
&
Name
()
const
wxString
&
Plugin
Name
()
{
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 );
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment