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
343e55b0
Commit
343e55b0
authored
Dec 02, 2011
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First working copy of KICAD_PLUGIN::Load()
parent
0fb4954f
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 @
343e55b0
...
...
@@ -46,8 +46,8 @@
*/
#define IO_FORMAT _( "IO_ERROR: %s\n
from %s : %s" )
#define PARSE_FORMAT _( "PARSE_ERROR: %s in input/source \"%s\", line %d, offset %d\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\nfrom %s : %s" )
// references:
// http://stackoverflow.com/questions/2670816/how-can-i-use-the-compile-time-constant-line-in-a-string
...
...
pcbnew/class_drawsegment.cpp
View file @
343e55b0
...
...
@@ -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
{
if
(
m_Parent
->
Type
()
!=
PCB_MODULE_T
)
...
...
pcbnew/class_drawsegment.h
View file @
343e55b0
...
...
@@ -46,7 +46,12 @@ public:
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
;
}
...
...
pcbnew/class_edge_mod.h
View file @
343e55b0
...
...
@@ -58,7 +58,6 @@ public:
*/
void
DisplayInfo
(
EDA_DRAW_FRAME
*
frame
);
/**
* Function GetClass
* returns the class name.
...
...
pcbnew/class_pad.cpp
View file @
343e55b0
...
...
@@ -185,6 +185,17 @@ void D_PAD::SetPadName( const wxString& name )
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
...
...
pcbnew/class_pad.h
View file @
343e55b0
...
...
@@ -183,7 +183,20 @@ public:
void
SetDelta
(
const
wxSize
&
aSize
)
{
m_DeltaSize
=
aSize
;
}
void
SetDrillSize
(
const
wxSize
&
aSize
)
{
m_Drill
=
aSize
;
}
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
SetLayerMask
(
int
aLayerMask
)
{
m_layerMask
=
aLayerMask
;
}
void
SetAttribute
(
int
aAttribute
)
{
m_Attribut
=
aAttribute
;
}
...
...
@@ -313,6 +326,7 @@ public:
// others
void
SetPadName
(
const
wxString
&
name
);
// Change pad name
void
SetPadName
(
const
char
*
aName
);
wxString
ReturnStringPadName
()
const
;
// Return pad name as string in a wxString
...
...
pcbnew/class_text_mod.h
View file @
343e55b0
...
...
@@ -50,11 +50,19 @@ public:
return
m_Pos
;
// from EDA_TEXT
}
/// @deprecated it seems
void
SetType
(
int
aType
)
{
m_Type
=
aType
;
}
void
SetPosition
(
const
wxPoint
&
aPos
)
// overload a base
{
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
int
GetLength
()
const
;
/* text length */
...
...
pcbnew/files.cpp
View file @
343e55b0
...
...
@@ -280,10 +280,12 @@ this file again." ) );
if
(
!
aAppend
)
SetBoard
(
board
);
}
catch
(
IO_ERROR
ioe
)
catch
(
IO_ERROR
ioe
)
{
// @todo
printf
(
"Error loading board: %s
\n
"
,
TO_UTF8
(
ioe
.
errorText
)
);
wxString
msg
=
wxString
::
Format
(
_
(
"Error loading board.
\n
%s"
),
ioe
.
errorText
.
GetData
()
);
wxMessageBox
(
msg
,
_
(
"Open Board File"
),
wxICON_ERROR
);
}
if
(
!
aAppend
)
...
...
pcbnew/io_mgr.cpp
View file @
343e55b0
...
...
@@ -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
)
{
case
KICAD
:
return
kicad
;
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,
return
pi
->
Load
(
aFileName
,
aAppendToMe
,
aProperties
);
// virtual
}
wxString
msg
;
msg
.
Printf
(
_
(
"Plugin type '%s' is not found.
\n
"
),
ShowType
(
aFileType
).
GetData
()
);
THROW_IO_ERROR
(
msg
);
THROW_IO_ERROR
(
wxString
::
Format
(
_
(
"Plugin type '%s' is not found."
),
ShowType
(
aFileType
).
GetData
()
)
);
}
...
...
@@ -111,11 +105,7 @@ void IO_MGR::Save( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* aBoar
return
;
}
wxString
msg
;
msg
.
Printf
(
_
(
"Plugin type '%s' is not found."
),
ShowType
(
aFileType
).
GetData
()
);
THROW_IO_ERROR
(
msg
);
THROW_IO_ERROR
(
wxString
::
Format
(
_
(
"Plugin type '%s' is not found."
),
ShowType
(
aFileType
).
GetData
()
)
);
}
...
...
@@ -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,
// e.g. Load() or Save() but not both.
wxString
msg
;
msg
.
Printf
(
_
(
"Plugin %s does not implement the BOARD Load() function."
),
PluginName
().
GetData
()
);
THROW_IO_ERROR
(
msg
);
THROW_IO_ERROR
(
wxString
::
Format
(
_
(
"Plugin %s does not implement the BOARD Load() function."
),
PluginName
().
GetData
()
)
);
}
...
...
@@ -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,
// e.g. Load() or Save() but not both.
wxString
msg
;
msg
.
Printf
(
_
(
"Plugin %s does not implement the BOARD Save() function."
),
PluginName
().
GetData
()
);
THROW_IO_ERROR
(
msg
);
THROW_IO_ERROR
(
wxString
::
Format
(
_
(
"Plugin %s does not implement the BOARD Save() function."
),
PluginName
().
GetData
()
)
);
}
pcbnew/io_mgr.h
View file @
343e55b0
...
...
@@ -34,7 +34,6 @@
WX_DECLARE_STRING_HASH_MAP
(
wxString
,
PROPERTIES
);
class
BOARD
;
class
SCHEMATIC
;
class
PLUGIN
;
...
...
@@ -88,7 +87,7 @@ public:
* Function ShowType
* 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
...
...
@@ -268,6 +267,8 @@ public:
//-----<SCHEMATIC STUFF>------------------------------------------------
// Should split into schematic specific PLUGIN base type
class SCHEMATIC;
/**
* Function Load
* loads a file from some special input file format that
...
...
pcbnew/kicad_plugin.cpp
View file @
343e55b0
This diff is collapsed.
Click to expand it.
pcbnew/kicad_plugin.h
View file @
343e55b0
...
...
@@ -56,7 +56,7 @@ public:
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
()
{
...
...
@@ -103,8 +103,10 @@ protected:
BIU
biuParse
(
const
char
*
aValue
,
const
char
**
nptrptr
=
NULL
);
/**
* Function dblParse
* parses an ASCII decimal floating point value without scaling into a double.
* Function degParse
* 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
*
...
...
@@ -113,7 +115,7 @@ protected:
*
* @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
...
...
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