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
a37fdd97
Commit
a37fdd97
authored
Dec 02, 2011
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Plain Diff
First working version of KICAD_PLUGIN::Load(), short of some globals and minor conflicts
parents
0fb4954f
343e55b0
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
293 additions
and
217 deletions
+293
-217
richio.h
include/richio.h
+2
-2
class_drawsegment.cpp
pcbnew/class_drawsegment.cpp
+8
-0
class_drawsegment.h
pcbnew/class_drawsegment.h
+6
-1
class_edge_mod.h
pcbnew/class_edge_mod.h
+0
-1
class_pad.cpp
pcbnew/class_pad.cpp
+11
-0
class_pad.h
pcbnew/class_pad.h
+15
-1
class_text_mod.h
pcbnew/class_text_mod.h
+8
-0
files.cpp
pcbnew/files.cpp
+5
-3
io_mgr.cpp
pcbnew/io_mgr.cpp
+11
-30
io_mgr.h
pcbnew/io_mgr.h
+3
-2
kicad_plugin.cpp
pcbnew/kicad_plugin.cpp
+218
-173
kicad_plugin.h
pcbnew/kicad_plugin.h
+6
-4
No files found.
include/richio.h
View file @
a37fdd97
...
@@ -46,8 +46,8 @@
...
@@ -46,8 +46,8 @@
*/
*/
#define IO_FORMAT _( "IO_ERROR: %s\n
from %s : %s" )
#define IO_FORMAT _( "IO_ERROR: %s\nfrom %s : %s" )
#define PARSE_FORMAT _( "PARSE_ERROR: %s in input/source \"%s\", line %d, offset %d\n
from %s : %s" )
#define PARSE_FORMAT _( "PARSE_ERROR: %s in input/source \"%s\", line %d, offset %d\nfrom %s : %s" )
// references:
// references:
// http://stackoverflow.com/questions/2670816/how-can-i-use-the-compile-time-constant-line-in-a-string
// http://stackoverflow.com/questions/2670816/how-can-i-use-the-compile-time-constant-line-in-a-string
...
...
pcbnew/class_drawsegment.cpp
View file @
a37fdd97
...
@@ -221,6 +221,14 @@ wxPoint DRAWSEGMENT::GetEnd() const
...
@@ -221,6 +221,14 @@ wxPoint DRAWSEGMENT::GetEnd() const
}
}
void
DRAWSEGMENT
::
SetAngle
(
double
aAngle
)
{
NORMALIZE_ANGLE_360
(
aAngle
);
m_Angle
=
(
int
)
aAngle
;
}
MODULE
*
DRAWSEGMENT
::
GetParentModule
()
const
MODULE
*
DRAWSEGMENT
::
GetParentModule
()
const
{
{
if
(
m_Parent
->
Type
()
!=
PCB_MODULE_T
)
if
(
m_Parent
->
Type
()
!=
PCB_MODULE_T
)
...
...
pcbnew/class_drawsegment.h
View file @
a37fdd97
...
@@ -46,7 +46,12 @@ public:
...
@@ -46,7 +46,12 @@ public:
void
SetEnd
(
const
wxPoint
&
aEnd
)
{
m_End
=
aEnd
;
}
void
SetEnd
(
const
wxPoint
&
aEnd
)
{
m_End
=
aEnd
;
}
void
SetAngle
(
double
aAngle
)
{
m_Angle
=
(
int
)
aAngle
;
}
/**
* Function SetAngle
* sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
* @param aAngle is tenths of degrees, but will soon be degrees.
*/
void
SetAngle
(
double
aAngle
);
// encapsulates the transition to degrees
void
SetType
(
int
aType
)
{
m_Type
=
aType
;
}
void
SetType
(
int
aType
)
{
m_Type
=
aType
;
}
...
...
pcbnew/class_edge_mod.h
View file @
a37fdd97
...
@@ -58,7 +58,6 @@ public:
...
@@ -58,7 +58,6 @@ public:
*/
*/
void
DisplayInfo
(
EDA_DRAW_FRAME
*
frame
);
void
DisplayInfo
(
EDA_DRAW_FRAME
*
frame
);
/**
/**
* Function GetClass
* Function GetClass
* returns the class name.
* returns the class name.
...
...
pcbnew/class_pad.cpp
View file @
a37fdd97
...
@@ -185,6 +185,17 @@ void D_PAD::SetPadName( const wxString& name )
...
@@ -185,6 +185,17 @@ void D_PAD::SetPadName( const wxString& name )
m_Padname
[
ii
]
=
0
;
m_Padname
[
ii
]
=
0
;
}
}
void
D_PAD
::
SetPadName
(
const
char
*
aName
)
{
unsigned
i
;
for
(
i
=
0
;
i
<
sizeof
(
m_Padname
)
&&
*
aName
;
++
i
)
m_Padname
[
i
]
=
*
aName
++
;
while
(
i
<
sizeof
(
m_Padname
)
)
m_Padname
[
i
++
]
=
0
;
}
/**
/**
* Function SetNetname
* Function SetNetname
...
...
pcbnew/class_pad.h
View file @
a37fdd97
...
@@ -183,7 +183,20 @@ public:
...
@@ -183,7 +183,20 @@ public:
void
SetDelta
(
const
wxSize
&
aSize
)
{
m_DeltaSize
=
aSize
;
}
void
SetDelta
(
const
wxSize
&
aSize
)
{
m_DeltaSize
=
aSize
;
}
void
SetDrillSize
(
const
wxSize
&
aSize
)
{
m_Drill
=
aSize
;
}
void
SetDrillSize
(
const
wxSize
&
aSize
)
{
m_Drill
=
aSize
;
}
void
SetOffset
(
const
wxSize
&
aOffset
)
{
m_Offset
=
aOffset
;
}
void
SetOffset
(
const
wxSize
&
aOffset
)
{
m_Offset
=
aOffset
;
}
void
SetOrientation
(
int
aAngle
)
{
m_Orient
=
aAngle
;
}
/**
* Function SetOrientation
* sets the rotation angle of the pad.
* @param aAngle is tenths of degrees, but will soon be degrees.
*/
void
SetOrientation
(
double
aAngle
)
{
m_Orient
=
(
int
)
aAngle
;
}
// manage migration to degrees
/**
* Function GetOrientation
* returns the rotation angle of the pad in tenths of degress, but soon degress.
*/
double
GetOrientation
()
const
{
return
m_Orient
;
}
void
SetDrillShape
(
int
aDrillShape
)
{
m_DrillShape
=
aDrillShape
;
}
void
SetDrillShape
(
int
aDrillShape
)
{
m_DrillShape
=
aDrillShape
;
}
void
SetLayerMask
(
int
aLayerMask
)
{
m_layerMask
=
aLayerMask
;
}
void
SetLayerMask
(
int
aLayerMask
)
{
m_layerMask
=
aLayerMask
;
}
void
SetAttribute
(
int
aAttribute
)
{
m_Attribut
=
aAttribute
;
}
void
SetAttribute
(
int
aAttribute
)
{
m_Attribut
=
aAttribute
;
}
...
@@ -313,6 +326,7 @@ public:
...
@@ -313,6 +326,7 @@ public:
// others
// others
void
SetPadName
(
const
wxString
&
name
);
// Change pad name
void
SetPadName
(
const
wxString
&
name
);
// Change pad name
void
SetPadName
(
const
char
*
aName
);
wxString
ReturnStringPadName
()
const
;
// Return pad name as string in a wxString
wxString
ReturnStringPadName
()
const
;
// Return pad name as string in a wxString
...
...
pcbnew/class_text_mod.h
View file @
a37fdd97
...
@@ -50,11 +50,19 @@ public:
...
@@ -50,11 +50,19 @@ public:
return
m_Pos
;
// from EDA_TEXT
return
m_Pos
;
// from EDA_TEXT
}
}
/// @deprecated it seems
void
SetType
(
int
aType
)
{
m_Type
=
aType
;
}
void
SetPosition
(
const
wxPoint
&
aPos
)
// overload a base
void
SetPosition
(
const
wxPoint
&
aPos
)
// overload a base
{
{
m_Pos
=
aPos
;
// in EDA_TEXT
m_Pos
=
aPos
;
// in EDA_TEXT
}
}
void
SetVisible
(
bool
isVisible
)
{
m_NoShow
=
!
isVisible
;
}
void
SetInvisible
(
bool
isHidden
)
{
m_NoShow
=
isHidden
;
}
void
SetPos0
(
const
wxPoint
&
aPos
)
{
m_Pos0
=
aPos
;
}
void
Copy
(
TEXTE_MODULE
*
source
);
// copy structure
void
Copy
(
TEXTE_MODULE
*
source
);
// copy structure
int
GetLength
()
const
;
/* text length */
int
GetLength
()
const
;
/* text length */
...
...
pcbnew/files.cpp
View file @
a37fdd97
...
@@ -280,10 +280,12 @@ this file again." ) );
...
@@ -280,10 +280,12 @@ this file again." ) );
if
(
!
aAppend
)
if
(
!
aAppend
)
SetBoard
(
board
);
SetBoard
(
board
);
}
}
catch
(
IO_ERROR
ioe
)
catch
(
IO_ERROR
ioe
)
{
{
// @todo
wxString
msg
=
wxString
::
Format
(
_
(
"Error loading board.
\n
%s"
),
printf
(
"Error loading board: %s
\n
"
,
TO_UTF8
(
ioe
.
errorText
)
);
ioe
.
errorText
.
GetData
()
);
wxMessageBox
(
msg
,
_
(
"Open Board File"
),
wxICON_ERROR
);
}
}
if
(
!
aAppend
)
if
(
!
aAppend
)
...
...
pcbnew/io_mgr.cpp
View file @
a37fdd97
...
@@ -66,17 +66,15 @@ void IO_MGR::PluginRelease( PLUGIN* aPlugin )
...
@@ -66,17 +66,15 @@ void IO_MGR::PluginRelease( PLUGIN* aPlugin )
}
}
const
wxString
&
IO_MGR
::
ShowType
(
PCB_FILE_T
aFileType
)
const
wxString
IO_MGR
::
ShowType
(
PCB_FILE_T
aFileType
)
{
{
static
const
wxString
kicad
=
wxT
(
"KiCad"
);
static
const
wxString
unknown
=
_
(
"Unknown"
);
switch
(
aFileType
)
switch
(
aFileType
)
{
{
case
KICAD
:
return
kicad
;
default
:
default
:
return
unknown
;
// could Printf() the numeric value of aFileType
return
wxString
::
Format
(
_
(
"Unknown PCB_FILE_T value: %d"
),
aFileType
);
case
KICAD
:
return
wxString
(
wxT
(
"KiCad"
)
);
}
}
}
}
...
@@ -92,11 +90,7 @@ BOARD* IO_MGR::Load( PCB_FILE_T aFileType, const wxString& aFileName,
...
@@ -92,11 +90,7 @@ BOARD* IO_MGR::Load( PCB_FILE_T aFileType, const wxString& aFileName,
return
pi
->
Load
(
aFileName
,
aAppendToMe
,
aProperties
);
// virtual
return
pi
->
Load
(
aFileName
,
aAppendToMe
,
aProperties
);
// virtual
}
}
wxString
msg
;
THROW_IO_ERROR
(
wxString
::
Format
(
_
(
"Plugin type '%s' is not found."
),
ShowType
(
aFileType
).
GetData
()
)
);
msg
.
Printf
(
_
(
"Plugin type '%s' is not found.
\n
"
),
ShowType
(
aFileType
).
GetData
()
);
THROW_IO_ERROR
(
msg
);
}
}
...
@@ -111,11 +105,7 @@ void IO_MGR::Save( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* aBoar
...
@@ -111,11 +105,7 @@ void IO_MGR::Save( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* aBoar
return
;
return
;
}
}
wxString
msg
;
THROW_IO_ERROR
(
wxString
::
Format
(
_
(
"Plugin type '%s' is not found."
),
ShowType
(
aFileType
).
GetData
()
)
);
msg
.
Printf
(
_
(
"Plugin type '%s' is not found."
),
ShowType
(
aFileType
).
GetData
()
);
THROW_IO_ERROR
(
msg
);
}
}
...
@@ -124,12 +114,8 @@ BOARD* PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES*
...
@@ -124,12 +114,8 @@ BOARD* PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES*
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface,
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface,
// e.g. Load() or Save() but not both.
// e.g. Load() or Save() but not both.
wxString
msg
;
THROW_IO_ERROR
(
wxString
::
Format
(
_
(
"Plugin %s does not implement the BOARD Load() function."
),
PluginName
().
GetData
()
)
);
msg
.
Printf
(
_
(
"Plugin %s does not implement the BOARD Load() function."
),
PluginName
().
GetData
()
);
THROW_IO_ERROR
(
msg
);
}
}
...
@@ -138,11 +124,6 @@ void PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProper
...
@@ -138,11 +124,6 @@ void PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProper
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface,
// not pure virtual so that plugins only have to implement subset of the PLUGIN interface,
// e.g. Load() or Save() but not both.
// e.g. Load() or Save() but not both.
wxString
msg
;
THROW_IO_ERROR
(
wxString
::
Format
(
_
(
"Plugin %s does not implement the BOARD Save() function."
),
PluginName
().
GetData
()
)
);
msg
.
Printf
(
_
(
"Plugin %s does not implement the BOARD Save() function."
),
PluginName
().
GetData
()
);
THROW_IO_ERROR
(
msg
);
}
}
pcbnew/io_mgr.h
View file @
a37fdd97
...
@@ -34,7 +34,6 @@
...
@@ -34,7 +34,6 @@
WX_DECLARE_STRING_HASH_MAP
(
wxString
,
PROPERTIES
);
WX_DECLARE_STRING_HASH_MAP
(
wxString
,
PROPERTIES
);
class
BOARD
;
class
BOARD
;
class
SCHEMATIC
;
class
PLUGIN
;
class
PLUGIN
;
...
@@ -88,7 +87,7 @@ public:
...
@@ -88,7 +87,7 @@ public:
* Function ShowType
* Function ShowType
* returns a brief name for a plugin, given aFileType enum.
* returns a brief name for a plugin, given aFileType enum.
*/
*/
static
const
wxString
&
ShowType
(
PCB_FILE_T
aFileType
);
static
const
wxString
ShowType
(
PCB_FILE_T
aFileType
);
/**
/**
* Function Load
* Function Load
...
@@ -268,6 +267,8 @@ public:
...
@@ -268,6 +267,8 @@ public:
//-----<SCHEMATIC STUFF>------------------------------------------------
//-----<SCHEMATIC STUFF>------------------------------------------------
// Should split into schematic specific PLUGIN base type
// Should split into schematic specific PLUGIN base type
class SCHEMATIC;
/**
/**
* Function Load
* Function Load
* loads a file from some special input file format that
* loads a file from some special input file format that
...
...
pcbnew/kicad_plugin.cpp
View file @
a37fdd97
This diff is collapsed.
Click to expand it.
pcbnew/kicad_plugin.h
View file @
a37fdd97
...
@@ -56,7 +56,7 @@ public:
...
@@ -56,7 +56,7 @@ public:
BOARD
*
Load
(
const
wxString
&
aFileName
,
BOARD
*
aAppendToMe
,
PROPERTIES
*
aProperties
=
NULL
);
// overload
BOARD
*
Load
(
const
wxString
&
aFileName
,
BOARD
*
aAppendToMe
,
PROPERTIES
*
aProperties
=
NULL
);
// overload
void
Save
(
const
wxString
*
aFileName
,
BOARD
*
aBoard
,
PROPERTIES
*
aProperties
=
NULL
);
// overload
void
Save
(
const
wxString
&
aFileName
,
BOARD
*
aBoard
,
PROPERTIES
*
aProperties
=
NULL
);
// overload
const
wxString
&
PluginName
()
const
wxString
&
PluginName
()
{
{
...
@@ -103,8 +103,10 @@ protected:
...
@@ -103,8 +103,10 @@ protected:
BIU
biuParse
(
const
char
*
aValue
,
const
char
**
nptrptr
=
NULL
);
BIU
biuParse
(
const
char
*
aValue
,
const
char
**
nptrptr
=
NULL
);
/**
/**
* Function dblParse
* Function degParse
* parses an ASCII decimal floating point value without scaling into a double.
* parses an ASCII decimal floating point value which is certainy an angle. This
* is a dedicated function for encapsulating support for the migration from
* tenths of degrees to degrees in floating point.
*
*
* @param aValue is the ASCII value in C locale form with possible leading whitespace
* @param aValue is the ASCII value in C locale form with possible leading whitespace
*
*
...
@@ -113,7 +115,7 @@ protected:
...
@@ -113,7 +115,7 @@ protected:
*
*
* @return double - the string converted to a primitive double type
* @return double - the string converted to a primitive double type
*/
*/
double
d
bl
Parse
(
const
char
*
aValue
,
const
char
**
nptrptr
=
NULL
);
double
d
eg
Parse
(
const
char
*
aValue
,
const
char
**
nptrptr
=
NULL
);
// load / parse functions
// load / parse functions
...
...
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