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
157298ba
Commit
157298ba
authored
Mar 12, 2008
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes
parent
bfc705ed
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
22 deletions
+56
-22
gpcb_exchange.cpp
pcbnew/gpcb_exchange.cpp
+3
-3
librairi.cpp
pcbnew/librairi.cpp
+48
-14
math_for_graphics.cpp
polygon/math_for_graphics.cpp
+3
-3
math_for_graphics.h
polygon/math_for_graphics.h
+2
-2
No files found.
pcbnew/gpcb_exchange.cpp
View file @
157298ba
...
@@ -198,16 +198,16 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
...
@@ -198,16 +198,16 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
iprmcnt
++
;
iprmcnt
++
;
m_Doc
=
params
[
iprmcnt
];
m_Doc
=
params
[
iprmcnt
];
// Read pcb-name (
unused
)
// Read pcb-name (
reference
)
iprmcnt
++
;
iprmcnt
++
;
m_Reference
->
m_Text
=
params
[
iprmcnt
];
// Read value
// Read value
iprmcnt
++
;
iprmcnt
++
;
m_Value
->
m_Text
=
params
[
iprmcnt
];
m_Value
->
m_Text
=
params
[
iprmcnt
];
iprmcnt
++
;
// Read other infos
// Read other infos
iprmcnt
++
;
for
(
int
ii
=
0
;
ii
<
6
;
ii
++
)
for
(
int
ii
=
0
;
ii
<
6
;
ii
++
)
{
{
if
(
iprmcnt
<
icnt_max
)
if
(
iprmcnt
<
icnt_max
)
...
...
pcbnew/librairi.cpp
View file @
157298ba
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
#define OLD_EXT wxT( ".bak" )
#define OLD_EXT wxT( ".bak" )
#define FILETMP_EXT wxT( ".$$$" )
#define FILETMP_EXT wxT( ".$$$" )
#define EXPORT_IMPORT_LASTPATH_KEY wxT("import_last_path")
/* Fonctions locales */
/* Fonctions locales */
static
bool
CreateDocLibrary
(
const
wxString
&
LibName
);
static
bool
CreateDocLibrary
(
const
wxString
&
LibName
);
...
@@ -33,9 +33,15 @@ static bool CreateDocLibrary( const wxString& LibName );
...
@@ -33,9 +33,15 @@ static bool CreateDocLibrary( const wxString& LibName );
MODULE
*
WinEDA_ModuleEditFrame
::
Import_Module
(
wxDC
*
DC
)
MODULE
*
WinEDA_ModuleEditFrame
::
Import_Module
(
wxDC
*
DC
)
/*********************************************************/
/*********************************************************/
/*
/**
* Importation de modules Hors librairie
* Function Import_Module
* Lit 1 fichier type Empreinte et place le module sur PCB
* Read a file containing only one footprint.
* Used to import (after exporting) a footprint
* Exported files have the standart ext .emp
* This is the same format as .mod files but restricted to only one footprint
* The import function can also read gpcb footprint file, in Newlib format
* (One footprint per file, Newlib files have no special ext.)
* @param DC = Current Device Context (can be NULL)
*/
*/
{
{
int
NbLine
=
0
;
int
NbLine
=
0
;
...
@@ -45,10 +51,15 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
...
@@ -45,10 +51,15 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
MODULE
*
module
=
NULL
;
MODULE
*
module
=
NULL
;
bool
Footprint_Is_GPCB_Format
=
false
;
bool
Footprint_Is_GPCB_Format
=
false
;
wxString
mask
=
wxT
(
"*.*;"
);
mask
+=
EXT_CMP_MASK
;
wxString
mask
=
wxT
(
"*.*;"
);
mask
+=
EXT_CMP_MASK
;
wxString
LastOpenedPathForLoading
;
wxConfig
*
Config
=
m_Parent
->
m_EDA_Config
;
if
(
Config
)
Config
->
Read
(
EXPORT_IMPORT_LASTPATH_KEY
,
&
LastOpenedPathForLoading
);
/* Lecture Fichier module */
/* Lecture Fichier module */
CmpFullFileName
=
EDA_FileSelector
(
_
(
"Import Module:"
),
CmpFullFileName
=
EDA_FileSelector
(
_
(
"Import Module:"
),
wxEmptyStr
ing
,
/* Chemin par defaut */
LastOpenedPathForLoad
ing
,
/* Chemin par defaut */
wxEmptyString
,
/* nom fichier par defaut */
wxEmptyString
,
/* nom fichier par defaut */
wxEmptyString
,
/* extension par defaut */
wxEmptyString
,
/* extension par defaut */
mask
,
/* Masque d'affichage */
mask
,
/* Masque d'affichage */
...
@@ -67,8 +78,14 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
...
@@ -67,8 +78,14 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
DisplayError
(
this
,
msg
);
DisplayError
(
this
,
msg
);
return
NULL
;
return
NULL
;
}
}
/* Lecture Entete */
if
(
Config
)
// Save file path
{
LastOpenedPathForLoading
=
wxPathOnly
(
CmpFullFileName
);
Config
->
Write
(
EXPORT_IMPORT_LASTPATH_KEY
,
LastOpenedPathForLoading
);
}
/* Read header and test file type */
GetLine
(
dest
,
Line
,
&
NbLine
);
GetLine
(
dest
,
Line
,
&
NbLine
);
if
(
strnicmp
(
Line
,
ENTETE_LIBRAIRIE
,
L_ENTETE_LIB
)
!=
0
)
if
(
strnicmp
(
Line
,
ENTETE_LIBRAIRIE
,
L_ENTETE_LIB
)
!=
0
)
{
{
...
@@ -82,7 +99,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
...
@@ -82,7 +99,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
}
}
}
}
/*
Lecture du fichier: recherche du debut de la descr module
*/
/*
Read file: Search the description starting line (skip lib header)
*/
if
(
!
Footprint_Is_GPCB_Format
)
if
(
!
Footprint_Is_GPCB_Format
)
{
{
while
(
GetLine
(
dest
,
Line
,
&
NbLine
)
!=
NULL
)
while
(
GetLine
(
dest
,
Line
,
&
NbLine
)
!=
NULL
)
...
@@ -105,7 +122,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
...
@@ -105,7 +122,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
fclose
(
dest
);
fclose
(
dest
);
}
}
/*
Mise a jour du chainage
*/
/*
Insert footprint in list
*/
if
(
m_Pcb
->
m_Modules
)
if
(
m_Pcb
->
m_Modules
)
{
{
m_Pcb
->
m_Modules
->
Pback
=
module
;
m_Pcb
->
m_Modules
->
Pback
=
module
;
...
@@ -114,7 +131,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
...
@@ -114,7 +131,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
module
->
Pback
=
m_Pcb
;
module
->
Pback
=
m_Pcb
;
m_Pcb
->
m_Modules
=
module
;
m_Pcb
->
m_Modules
=
module
;
/*
Affichage des caracteristiques
: */
/*
Display info
: */
module
->
Display_Infos
(
this
);
module
->
Display_Infos
(
this
);
Place_Module
(
module
,
DC
);
Place_Module
(
module
,
DC
);
m_Pcb
->
m_Status_Pcb
=
0
;
m_Pcb
->
m_Status_Pcb
=
0
;
...
@@ -127,15 +144,23 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
...
@@ -127,15 +144,23 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC )
/************************************************************************/
/************************************************************************/
void
WinEDA_ModuleEditFrame
::
Export_Module
(
MODULE
*
ptmod
,
bool
createlib
)
void
WinEDA_ModuleEditFrame
::
Export_Module
(
MODULE
*
ptmod
,
bool
createlib
)
/************************************************************************/
/************************************************************************/
/**
/*
* Function Export_Module
* Genere 1 fichier type Empreinte a partir de la description du module sur PCB
* Create a file containing only one footprint.
* Used to export a footprint
* Exported files have the standart ext .emp
* This is the same format as .mod files but restricted to only one footprint
* So Create a new lib (which will contains one module) and export a footprint is basically the same thing
* @param DC = Current Device Context (can be NULL)
* @param createlib : true = use default lib path to create lib
* false = use current path or last used path to export footprint
*/
*/
{
{
wxString
FullFileName
,
Mask
(
wxT
(
"*"
)
);
wxString
FullFileName
,
Mask
(
wxT
(
"*"
)
);
char
Line
[
1025
];
char
Line
[
1025
];
FILE
*
dest
;
FILE
*
dest
;
wxString
msg
,
path
;
wxString
msg
,
path
;
wxConfig
*
Config
=
m_Parent
->
m_EDA_Config
;
if
(
ptmod
==
NULL
)
if
(
ptmod
==
NULL
)
return
;
return
;
...
@@ -148,6 +173,9 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
...
@@ -148,6 +173,9 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
if
(
createlib
)
if
(
createlib
)
path
=
g_RealLibDirBuffer
;
path
=
g_RealLibDirBuffer
;
else
if
(
Config
)
Config
->
Read
(
EXPORT_IMPORT_LASTPATH_KEY
,
&
path
);
FullFileName
=
EDA_FileSelector
(
createlib
?
_
(
"Create lib"
)
:
_
(
"Export Module:"
),
FullFileName
=
EDA_FileSelector
(
createlib
?
_
(
"Create lib"
)
:
_
(
"Export Module:"
),
path
,
/* Chemin par defaut */
path
,
/* Chemin par defaut */
FullFileName
,
/* nom fichier par defaut */
FullFileName
,
/* nom fichier par defaut */
...
@@ -161,7 +189,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
...
@@ -161,7 +189,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
if
(
FullFileName
.
IsEmpty
()
)
if
(
FullFileName
.
IsEmpty
()
)
return
;
return
;
if
(
createlib
&&
wxFileExists
(
FullFileName
)
)
if
(
wxFileExists
(
FullFileName
)
)
{
{
msg
.
Printf
(
_
(
"File %s exists, OK to replace ?"
),
msg
.
Printf
(
_
(
"File %s exists, OK to replace ?"
),
FullFileName
.
GetData
()
);
FullFileName
.
GetData
()
);
...
@@ -177,6 +205,12 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
...
@@ -177,6 +205,12 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib )
return
;
return
;
}
}
if
(
!
createlib
&&
Config
)
// Save file path
{
path
=
wxPathOnly
(
FullFileName
);
Config
->
Write
(
EXPORT_IMPORT_LASTPATH_KEY
,
path
);
}
fprintf
(
dest
,
"%s %s
\n
"
,
ENTETE_LIBRAIRIE
,
DateAndTime
(
Line
)
);
fprintf
(
dest
,
"%s %s
\n
"
,
ENTETE_LIBRAIRIE
,
DateAndTime
(
Line
)
);
fputs
(
"$INDEX
\n
"
,
dest
);
fputs
(
"$INDEX
\n
"
,
dest
);
...
...
polygon/math_for_graphics.cpp
View file @
157298ba
...
@@ -454,7 +454,7 @@ int FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, int
...
@@ -454,7 +454,7 @@ int FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, int
double
*
x1
,
double
*
y1
,
double
*
x2
,
double
*
y2
,
double
*
x1
,
double
*
y1
,
double
*
x2
,
double
*
y2
,
double
*
dist
)
double
*
dist
)
{
{
double
xx
,
yy
;
double
xx
=
0
,
yy
=
0
;
//Init made to avoid C compil "uninitialized" warning
bool
bVert
=
false
;
bool
bVert
=
false
;
if
(
b
>
DBL_MAX
/
10.0
)
if
(
b
>
DBL_MAX
/
10.0
)
bVert
=
true
;
bVert
=
true
;
...
@@ -531,7 +531,7 @@ int FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, int
...
@@ -531,7 +531,7 @@ int FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, int
yyf
=
yf
;
yyf
=
yf
;
}
}
// find center and radii of ellipse
// find center and radii of ellipse
double
xo
,
yo
,
rx
,
ry
;
double
xo
=
xxf
,
yo
=
yyi
,
rx
,
ry
;
// Init made to avoid C compil warnings
if
(
xxf
>
xxi
&&
yyf
>
yyi
)
if
(
xxf
>
xxi
&&
yyf
>
yyi
)
{
{
xo
=
xxf
;
xo
=
xxf
;
...
@@ -1337,7 +1337,7 @@ int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1,
...
@@ -1337,7 +1337,7 @@ int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1,
double
s_start2
=
th1
;
double
s_start2
=
th1
;
double
s_end2
=
th2
;
double
s_end2
=
th2
;
double
dmin
=
DBL_MAX
;
double
dmin
=
DBL_MAX
;
double
xmin
,
ymin
,
smin
,
smin2
;
double
xmin
=
0
,
ymin
=
0
,
smin
=
0
,
smin2
=
0
;
// Init made to avoid C compil warnings
int
nsteps
=
NSTEPS
;
int
nsteps
=
NSTEPS
;
int
nsteps2
=
NSTEPS
;
int
nsteps2
=
NSTEPS
;
...
...
polygon/math_for_graphics.h
View file @
157298ba
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
typedef
struct
PointTag
typedef
struct
PointTag
{
{
double
X
,
Y
;
double
X
,
Y
;
}
Point
;
}
Point
T
;
typedef
struct
EllipseTag
typedef
struct
EllipseTag
{
{
Point
Center
;
/* ellipse center */
Point
T
Center
;
/* ellipse center */
// double MaxRad,MinRad; /* major and minor axis */
// double MaxRad,MinRad; /* major and minor axis */
// double Phi; /* major axis rotation */
// double Phi; /* major axis rotation */
double
xrad
,
yrad
;
// radii on x and y
double
xrad
,
yrad
;
// radii on x and y
...
...
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