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
7e448f2e
Commit
7e448f2e
authored
Sep 30, 2007
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor housekeeping
parent
6a0451e7
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
190 additions
and
130 deletions
+190
-130
files-io.cpp
eeschema/files-io.cpp
+112
-97
wxstruct.h
include/wxstruct.h
+1
-1
class_pad.cpp
pcbnew/class_pad.cpp
+3
-2
drc.cpp
pcbnew/drc.cpp
+66
-23
edit.cpp
pcbnew/edit.cpp
+5
-4
editrack.cpp
pcbnew/editrack.cpp
+1
-1
files.cpp
pcbnew/files.cpp
+1
-1
hotkeys.cpp
pcbnew/hotkeys.cpp
+1
-1
No files found.
eeschema/files-io.cpp
View file @
7e448f2e
/****************************/
/****************************/
/* EESCHEMA - files-io.cpp */
/* EESCHEMA - files-io.cpp */
/****************************/
/****************************/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -17,49 +17,52 @@
...
@@ -17,49 +17,52 @@
/****************************************************************/
/****************************************************************/
void
WinEDA_SchematicFrame
::
Save_File
(
wxCommandEvent
&
event
)
void
WinEDA_SchematicFrame
::
Save_File
(
wxCommandEvent
&
event
)
/****************************************************************/
/****************************************************************/
/* Commands to save shepatic project or the current page.
/* Commands to save shepatic project or the current page.
*/
*/
{
{
int
id
=
event
.
GetId
();
int
id
=
event
.
GetId
();
switch
(
id
)
switch
(
id
)
{
{
case
ID_SAVE_PROJECT
:
/* Update Schematic File */
case
ID_SAVE_PROJECT
:
/* Update Schematic File */
SaveProject
(
this
);
SaveProject
(
this
);
break
;
break
;
case
ID_SAVE_ONE_SHEET
:
/* Update Schematic File */
case
ID_SAVE_ONE_SHEET
:
/* Update Schematic File */
SaveEEFile
(
NULL
,
FILE_SAVE_AS
);
SaveEEFile
(
NULL
,
FILE_SAVE_AS
);
break
;
break
;
case
ID_SAVE_ONE_SHEET_AS
:
/* Save EED (new name) */
case
ID_SAVE_ONE_SHEET_AS
:
/* Save EED (new name) */
SaveEEFile
(
NULL
,
FILE_SAVE_NEW
);
SaveEEFile
(
NULL
,
FILE_SAVE_NEW
);
break
;
break
;
default
:
DisplayError
(
this
,
wxT
(
"WinEDA_SchematicFrame::Save_File Internal Error"
));
default
:
DisplayError
(
this
,
wxT
(
"WinEDA_SchematicFrame::Save_File Internal Error"
)
);
break
;
break
;
}
}
}
}
/******************************************************************************************/
/******************************************************************************************/
bool
WinEDA_SchematicFrame
::
LoadOneSheet
(
SCH_SCREEN
*
screen
,
const
wxString
&
filename
)
bool
WinEDA_SchematicFrame
::
LoadOneSheet
(
SCH_SCREEN
*
screen
,
const
wxString
&
filename
)
/******************************************************************************************/
/******************************************************************************************/
{
{
wxString
FullFileName
=
filename
;
wxString
FullFileName
=
filename
;
if
(
screen
->
EEDrawList
!=
NULL
)
if
(
screen
->
EEDrawList
!=
NULL
)
{
{
if
(
!
IsOK
(
this
,
_
(
"Clear SubHierarchy ?"
)
)
)
return
FALSE
;
if
(
!
IsOK
(
this
,
_
(
"Clear SubHierarchy ?"
)
)
)
return
FALSE
;
}
}
if
(
FullFileName
.
IsEmpty
()
)
if
(
FullFileName
.
IsEmpty
()
)
{
{
wxString
mask
;
wxString
mask
;
mask
=
wxT
(
"*"
)
+
g_SchExtBuffer
;
mask
=
wxT
(
"*"
)
+
g_SchExtBuffer
;
FullFileName
=
EDA_FileSelector
(
_
(
"Schematic files:"
),
FullFileName
=
EDA_FileSelector
(
_
(
"Schematic files:"
),
wxEmptyString
,
/* default path */
wxEmptyString
,
/* default path */
screen
->
m_FileName
,
/* default filename */
screen
->
m_FileName
,
/* default filename */
g_SchExtBuffer
,
/* extension par defaut */
g_SchExtBuffer
,
/* extension par defaut */
...
@@ -68,74 +71,86 @@ wxString FullFileName = filename;
...
@@ -68,74 +71,86 @@ wxString FullFileName = filename;
wxFD_OPEN
,
wxFD_OPEN
,
FALSE
FALSE
);
);
if
(
FullFileName
.
IsEmpty
()
)
return
FALSE
;
if
(
FullFileName
.
IsEmpty
()
)
return
FALSE
;
}
}
ClearProjectDrawList
(
screen
,
TRUE
);
ClearProjectDrawList
(
screen
,
TRUE
);
screen
->
m_FileName
=
FullFileName
;
screen
->
m_FileName
=
FullFileName
;
LoadOneEEFile
(
screen
,
FullFileName
);
LoadOneEEFile
(
screen
,
FullFileName
);
screen
->
SetModify
();
screen
->
SetModify
();
if
(
GetScreen
()
==
screen
)
Refresh
(
TRUE
);
if
(
GetScreen
()
==
screen
)
Refresh
(
TRUE
);
return
TRUE
;
return
TRUE
;
}
}
/****************************************************/
/****************************************************/
void
SaveProject
(
WinEDA_SchematicFrame
*
frame
)
void
SaveProject
(
WinEDA_SchematicFrame
*
frame
)
/****************************************************/
/****************************************************/
/* Sauvegarde toutes les feuilles du projet
/* Sauvegarde toutes les feuilles du projet
et cre une librairie archive des composants, de nom <root_name>.chche.lib
*
et cre une librairie archive des composants, de nom <root_name>.chche.lib
*/
*/
{
{
SCH_SCREEN
*
screen_tmp
;
SCH_SCREEN
*
screen_tmp
;
wxString
LibArchiveFileName
;
wxString
LibArchiveFileName
;
if
(
frame
==
NULL
)
return
;
if
(
frame
==
NULL
)
return
;
screen_tmp
=
frame
->
GetScreen
();
screen_tmp
=
frame
->
GetScreen
();
EDA_ScreenList
ScreenList
(
NULL
);
EDA_ScreenList
ScreenList
(
NULL
);
for
(
ActiveScreen
=
ScreenList
.
GetFirst
();
ActiveScreen
!=
NULL
;
ActiveScreen
=
ScreenList
.
GetNext
()
)
for
(
ActiveScreen
=
ScreenList
.
GetFirst
();
ActiveScreen
!=
NULL
;
ActiveScreen
=
ScreenList
.
GetNext
()
)
{
{
frame
->
m_CurrentScreen
=
ActiveScreen
;
frame
->
m_CurrentScreen
=
ActiveScreen
;
frame
->
SaveEEFile
(
NULL
,
FILE_SAVE_AS
);
frame
->
SaveEEFile
(
NULL
,
FILE_SAVE_AS
);
}
}
frame
->
m_CurrentScreen
=
ActiveScreen
=
screen_tmp
;
frame
->
m_CurrentScreen
=
ActiveScreen
=
screen_tmp
;
/* Creation du fichier d'archivage composants en repertoire courant */
/* Creation du fichier d'archivage composants en repertoire courant */
LibArchiveFileName
=
MakeFileName
(
wxEmptyString
,
ScreenSch
->
m_FileName
,
wxEmptyString
);
LibArchiveFileName
=
MakeFileName
(
wxEmptyString
,
ScreenSch
->
m_FileName
,
wxEmptyString
);
ChangeFileNameExt
(
LibArchiveFileName
,
wxEmptyString
);
ChangeFileNameExt
(
LibArchiveFileName
,
wxEmptyString
);
/* mise a jour extension */
LibArchiveFileName
+=
wxT
(
".cache"
)
+
g_LibExtBuffer
;
LibArchive
(
frame
,
LibArchiveFileName
);
/* mise a jour extension */
LibArchiveFileName
+=
wxT
(
".cache"
)
+
g_LibExtBuffer
;
LibArchive
(
frame
,
LibArchiveFileName
);
}
}
/************************/
/************************/
int
CountCmpNumber
()
int
CountCmpNumber
()
/************************/
/************************/
/* Routine retournant le nombre de composants dans le schema,
/* Routine retournant le nombre de composants dans le schema,
powers non comprises */
*
powers non comprises */
{
{
BASE_SCREEN
*
Window
;
BASE_SCREEN
*
Window
;
EDA_BaseStruct
*
Phead
;
EDA_BaseStruct
*
Phead
;
int
Nb
=
0
;
int
Nb
=
0
;
Window
=
ScreenSch
;
Window
=
ScreenSch
;
while
(
Window
)
while
(
Window
)
{
{
for
(
Phead
=
Window
->
EEDrawList
;
Phead
!=
NULL
;
Phead
=
Phead
->
Pnext
)
for
(
Phead
=
Window
->
EEDrawList
;
Phead
!=
NULL
;
Phead
=
Phead
->
Pnext
)
{
{
if
(
Phead
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
Phead
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
{
{
DrawPartStruct
*
Cmp
=
(
DrawPartStruct
*
)
Phead
;
DrawPartStruct
*
Cmp
=
(
DrawPartStruct
*
)
Phead
;
if
(
Cmp
->
m_Field
[
VALUE
].
m_Text
.
GetChar
(
0
)
!=
'#'
)
Nb
++
;
if
(
Cmp
->
m_Field
[
VALUE
].
m_Text
.
GetChar
(
0
)
!=
'#'
)
Nb
++
;
}
}
}
}
Window
=
(
BASE_SCREEN
*
)
Window
->
Pnext
;
Window
=
(
BASE_SCREEN
*
)
Window
->
Pnext
;
}
}
return
(
Nb
)
;
return
Nb
;
}
}
include/wxstruct.h
View file @
7e448f2e
...
@@ -773,7 +773,7 @@ public:
...
@@ -773,7 +773,7 @@ public:
* to a part with the same reference as the objectToSync
* to a part with the same reference as the objectToSync
* @param objectToSync The object whose reference is used to syncronize eeschema.
* @param objectToSync The object whose reference is used to syncronize eeschema.
*/
*/
void
SendMessageToEESCHEMA
(
EDA_BaseStruct
*
objectToSync
);
void
SendMessageToEESCHEMA
(
BOARD_ITEM
*
objectToSync
);
/* Special micro_ondes */
/* Special micro_ondes */
void
Edit_Gap
(
wxDC
*
DC
,
MODULE
*
Module
);
void
Edit_Gap
(
wxDC
*
DC
,
MODULE
*
Module
);
...
...
pcbnew/class_pad.cpp
View file @
7e448f2e
...
@@ -1033,6 +1033,7 @@ void D_PAD::Show( int nestLevel, std::ostream& os )
...
@@ -1033,6 +1033,7 @@ void D_PAD::Show( int nestLevel, std::ostream& os )
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
" num=
\"
"
<<
padname
<<
'"'
<<
" num=
\"
"
<<
padname
<<
'"'
<<
" net=
\"
"
<<
m_Netname
.
mb_str
()
<<
'"'
<<
" net=
\"
"
<<
m_Netname
.
mb_str
()
<<
'"'
<<
" netcode=
\"
"
<<
m_NetCode
<<
'"'
<<
" layerMask=
\"
"
<<
layerMask
<<
'"'
<<
m_Pos
<<
"/>
\n
"
;
" layerMask=
\"
"
<<
layerMask
<<
'"'
<<
m_Pos
<<
"/>
\n
"
;
// NestedSpace( nestLevel+1, os ) << m_Text.mb_str() << '\n';
// NestedSpace( nestLevel+1, os ) << m_Text.mb_str() << '\n';
...
...
pcbnew/drc.cpp
View file @
7e448f2e
...
@@ -47,7 +47,7 @@ static int TestClearanceSegmToPad( const D_PAD* pad_to_test, int seg_width, int
...
@@ -47,7 +47,7 @@ static int TestClearanceSegmToPad( const D_PAD* pad_to_test, int seg_width, int
static
int
TestMarginToCircle
(
int
cx
,
int
cy
,
int
rayon
,
int
longueur
);
static
int
TestMarginToCircle
(
int
cx
,
int
cy
,
int
rayon
,
int
longueur
);
static
int
Tst_Ligne
(
int
x1
,
int
y1
,
int
x2
,
int
y2
);
static
int
Tst_Ligne
(
int
x1
,
int
y1
,
int
x2
,
int
y2
);
static
void
Affiche_Erreur_DRC
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
BOARD
*
Pcb
,
static
void
Affiche_Erreur_DRC
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
BOARD
*
Pcb
,
TRACK
*
pt_ref
,
void
*
pt_item
,
int
errnumber
);
TRACK
*
pt_ref
,
BOARD_ITEM
*
pt_item
,
int
errnumber
);
static
void
Affiche_Erreur_DRC
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
static
void
Affiche_Erreur_DRC
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
BOARD
*
Pcb
,
D_PAD
*
pad1
,
D_PAD
*
pad2
);
BOARD
*
Pcb
,
D_PAD
*
pad1
,
D_PAD
*
pad2
);
...
@@ -164,10 +164,12 @@ void WinEDA_DrcFrame::TestDrc( wxCommandEvent& event )
...
@@ -164,10 +164,12 @@ void WinEDA_DrcFrame::TestDrc( wxCommandEvent& event )
ListUnconnectedPads
(
event
);
ListUnconnectedPads
(
event
);
else
else
m_UnconnectedCount
=
0
;
m_UnconnectedCount
=
0
;
if
(
errors
)
if
(
errors
)
msg
.
Printf
(
_
(
"** End Drc: %d errors **
\n
"
),
errors
);
msg
.
Printf
(
_
(
"** End Drc: %d errors **
\n
"
),
errors
);
else
if
(
m_UnconnectedCount
==
0
)
else
if
(
m_UnconnectedCount
==
0
)
msg
=
_
(
"** End Drc: No Error **
\n
"
);
msg
=
_
(
"** End Drc: No Error **
\n
"
);
m_logWindow
->
AppendText
(
msg
);
m_logWindow
->
AppendText
(
msg
);
if
(
s_RptFile
)
if
(
s_RptFile
)
...
@@ -392,6 +394,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
...
@@ -392,6 +394,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
{
{
if
(
pt_segm
->
Pnext
==
NULL
)
if
(
pt_segm
->
Pnext
==
NULL
)
break
;
break
;
if
(
jj
==
0
)
if
(
jj
==
0
)
{
{
jj
=
100
;
jj
=
100
;
...
@@ -410,14 +413,17 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
...
@@ -410,14 +413,17 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
jj
=
1
;
jj
=
1
;
wxString
msg
;
wxString
msg
;
EQUIPOT
*
equipot
=
m_Pcb
->
FindNet
(
pt_segm
->
m_NetCode
);
EQUIPOT
*
equipot
=
m_Pcb
->
FindNet
(
pt_segm
->
m_NetCode
);
if
(
equipot
)
if
(
equipot
)
msg
=
equipot
->
m_Netname
+
wxT
(
" "
);
msg
=
equipot
->
m_Netname
+
wxT
(
" "
);
else
else
msg
=
wxT
(
"<noname>"
);
msg
=
wxT
(
"<noname>"
);
Affiche_1_Parametre
(
this
,
0
,
_
(
"Netname"
),
msg
,
YELLOW
);
Affiche_1_Parametre
(
this
,
0
,
_
(
"Netname"
),
msg
,
YELLOW
);
old_net
=
pt_segm
->
m_NetCode
;
old_net
=
pt_segm
->
m_NetCode
;
}
}
g_HightLigth_NetCode
=
pt_segm
->
m_NetCode
;
g_HightLigth_NetCode
=
pt_segm
->
m_NetCode
;
/* Test drc with other zone segments, and pads */
/* Test drc with other zone segments, and pads */
flag_err_Drc
=
Drc
(
this
,
DC
,
pt_segm
,
(
TRACK
*
)
pt_segm
->
Pnext
,
1
);
flag_err_Drc
=
Drc
(
this
,
DC
,
pt_segm
,
(
TRACK
*
)
pt_segm
->
Pnext
,
1
);
if
(
flag_err_Drc
==
BAD_DRC
)
if
(
flag_err_Drc
==
BAD_DRC
)
...
@@ -444,7 +450,8 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
...
@@ -444,7 +450,8 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
}
}
/* Test drc with track segments */
/* Test drc with track segments */
int
tmp
=
m_Pcb
->
m_NbPads
;
m_Pcb
->
m_NbPads
=
0
;
// Pads already tested: disable pad test
int
tmp
=
m_Pcb
->
m_NbPads
;
m_Pcb
->
m_NbPads
=
0
;
// Pads already tested: disable pad test
flag_err_Drc
=
Drc
(
this
,
DC
,
pt_segm
,
m_Pcb
->
m_Track
,
1
);
flag_err_Drc
=
Drc
(
this
,
DC
,
pt_segm
,
m_Pcb
->
m_Track
,
1
);
m_Pcb
->
m_NbPads
=
tmp
;
m_Pcb
->
m_NbPads
=
tmp
;
...
@@ -464,6 +471,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
...
@@ -464,6 +471,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
PtStruct
=
m_Pcb
->
m_Drawings
;
PtStruct
=
m_Pcb
->
m_Drawings
;
if
(
PtStruct
)
if
(
PtStruct
)
PtStruct
->
Pback
=
Marqueur
;
PtStruct
->
Pback
=
Marqueur
;
m_Pcb
->
m_Drawings
=
Marqueur
;
m_Pcb
->
m_Drawings
=
Marqueur
;
GRSetDrawMode
(
DC
,
GR_OR
);
GRSetDrawMode
(
DC
,
GR_OR
);
...
@@ -508,9 +516,12 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
...
@@ -508,9 +516,12 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
// l'origine du segment de reference
// l'origine du segment de reference
wxPoint
shape_pos
;
wxPoint
shape_pos
;
org_X
=
pt_segment
->
m_Start
.
x
;
org_Y
=
pt_segment
->
m_Start
.
y
;
org_X
=
pt_segment
->
m_Start
.
x
;
org_Y
=
pt_segment
->
m_Start
.
y
;
finx
=
dx
=
pt_segment
->
m_End
.
x
-
org_X
;
finx
=
dx
=
pt_segment
->
m_End
.
x
-
org_X
;
finy
=
dy
=
pt_segment
->
m_End
.
y
-
org_Y
;
finy
=
dy
=
pt_segment
->
m_End
.
y
-
org_Y
;
MaskLayer
=
pt_segment
->
ReturnMaskLayer
();
MaskLayer
=
pt_segment
->
ReturnMaskLayer
();
net_code_ref
=
pt_segment
->
m_NetCode
;
net_code_ref
=
pt_segment
->
m_NetCode
;
...
@@ -519,6 +530,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
...
@@ -519,6 +530,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
{
{
/* calcul de l'angle d'inclinaison en 0,1 degre */
/* calcul de l'angle d'inclinaison en 0,1 degre */
segm_angle
=
ArcTangente
(
dy
,
dx
);
segm_angle
=
ArcTangente
(
dy
,
dx
);
/* Calcul de la longueur du segment en segm_long : dx = longueur */
/* Calcul de la longueur du segment en segm_long : dx = longueur */
RotatePoint
(
&
dx
,
&
dy
,
segm_angle
);
/* segm_long = longueur, yf = 0 */
RotatePoint
(
&
dx
,
&
dy
,
segm_angle
);
/* segm_long = longueur, yf = 0 */
}
}
...
@@ -545,6 +557,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
...
@@ -545,6 +557,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
* a pseudo pad is used, with a shape and a size like the hole */
* a pseudo pad is used, with a shape and a size like the hole */
if
(
pt_pad
->
m_Drill
.
x
==
0
)
if
(
pt_pad
->
m_Drill
.
x
==
0
)
continue
;
continue
;
D_PAD
pseudo_pad
(
(
MODULE
*
)
NULL
);
D_PAD
pseudo_pad
(
(
MODULE
*
)
NULL
);
pseudo_pad
.
m_Size
=
pt_pad
->
m_Drill
;
pseudo_pad
.
m_Size
=
pt_pad
->
m_Drill
;
...
@@ -568,7 +581,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
...
@@ -568,7 +581,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
/* Le pad doit faire partie d'un net mais pas de probleme
/* Le pad doit faire partie d'un net mais pas de probleme
* si le pad est du meme net */
* si le pad est du meme net */
if
(
pt_pad
->
m_NetCode
&&
(
net_code_ref
==
pt_pad
->
m_NetCode
)
)
if
(
/*pt_pad->m_NetCode &&*/
net_code_ref
==
pt_pad
->
m_NetCode
)
continue
;
continue
;
/* Test DRC pour les pads */
/* Test DRC pour les pads */
...
@@ -664,10 +677,14 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
...
@@ -664,10 +677,14 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
/* calcule x0,y0, xf,yf = coord de debut et fin du segment de piste
/* calcule x0,y0, xf,yf = coord de debut et fin du segment de piste
* a tester, dans le repere axe X = segment de reference */
* a tester, dans le repere axe X = segment de reference */
x0
=
pttrack
->
m_Start
.
x
-
org_X
;
y0
=
pttrack
->
m_Start
.
y
-
org_Y
;
x0
=
pttrack
->
m_Start
.
x
-
org_X
;
xf
=
pttrack
->
m_End
.
x
-
org_X
;
yf
=
pttrack
->
m_End
.
y
-
org_Y
;
y0
=
pttrack
->
m_Start
.
y
-
org_Y
;
RotatePoint
(
&
x0
,
&
y0
,
segm_angle
);
RotatePoint
(
&
xf
,
&
yf
,
segm_angle
);
xf
=
pttrack
->
m_End
.
x
-
org_X
;
yf
=
pttrack
->
m_End
.
y
-
org_Y
;
RotatePoint
(
&
x0
,
&
y0
,
segm_angle
);
RotatePoint
(
&
xf
,
&
yf
,
segm_angle
);
if
(
pttrack
->
Type
()
==
TYPEVIA
)
if
(
pttrack
->
Type
()
==
TYPEVIA
)
{
{
...
@@ -824,11 +841,18 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
...
@@ -824,11 +841,18 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
{
{
// il faut tester les extremites de ce segment
// il faut tester les extremites de ce segment
int
angle
,
rx0
,
ry0
,
rxf
,
ryf
;
int
angle
,
rx0
,
ry0
,
rxf
,
ryf
;
x0
=
pttrack
->
m_Start
.
x
;
y0
=
pttrack
->
m_Start
.
y
;
x0
=
pttrack
->
m_Start
.
x
;
xf
=
pttrack
->
m_End
.
x
;
yf
=
pttrack
->
m_End
.
y
;
y0
=
pttrack
->
m_Start
.
y
;
dx
=
xf
-
x0
;
dy
=
yf
-
y0
;
xf
=
pttrack
->
m_End
.
x
;
yf
=
pttrack
->
m_End
.
y
;
dx
=
xf
-
x0
;
dy
=
yf
-
y0
;
/* calcul de l'angle d'inclinaison en 0,1 degre */
/* calcul de l'angle d'inclinaison en 0,1 degre */
angle
=
ArcTangente
(
dy
,
dx
);
angle
=
ArcTangente
(
dy
,
dx
);
/* Calcul de la longueur du segment: dx = longueur */
/* Calcul de la longueur du segment: dx = longueur */
RotatePoint
(
&
dx
,
&
dy
,
angle
);
RotatePoint
(
&
dx
,
&
dy
,
angle
);
...
@@ -923,6 +947,7 @@ static bool Test_Pad_to_Pads_Drc( WinEDA_BasePcbFrame* frame,
...
@@ -923,6 +947,7 @@ static bool Test_Pad_to_Pads_Drc( WinEDA_BasePcbFrame* frame,
if
(
Pad_to_Pad_Isol
(
pad_ref
,
pad
,
g_DesignSettings
.
m_TrackClearence
)
==
OK_DRC
)
if
(
Pad_to_Pad_Isol
(
pad_ref
,
pad
,
g_DesignSettings
.
m_TrackClearence
)
==
OK_DRC
)
continue
;
continue
;
else
/* defaut d'isolation trouve */
else
/* defaut d'isolation trouve */
{
{
ErrorsDRC_Count
++
;
ErrorsDRC_Count
++
;
...
@@ -1007,9 +1032,13 @@ static int Pad_to_Pad_Isol( D_PAD* pad_ref, D_PAD* pad, const int dist_min )
...
@@ -1007,9 +1032,13 @@ static int Pad_to_Pad_Isol( D_PAD* pad_ref, D_PAD* pad, const int dist_min )
// Test DRC:
// Test DRC:
diag
=
BAD_DRC
;
diag
=
BAD_DRC
;
rel_pos
.
x
=
ABS
(
rel_pos
.
x
);
rel_pos
.
y
=
ABS
(
rel_pos
.
y
);
rel_pos
.
x
=
ABS
(
rel_pos
.
x
);
rel_pos
.
y
=
ABS
(
rel_pos
.
y
);
if
(
(
rel_pos
.
x
-
(
(
size
.
x
+
pad_ref
->
m_Size
.
x
)
/
2
)
)
>=
dist_min
)
if
(
(
rel_pos
.
x
-
(
(
size
.
x
+
pad_ref
->
m_Size
.
x
)
/
2
)
)
>=
dist_min
)
diag
=
OK_DRC
;
diag
=
OK_DRC
;
if
(
(
rel_pos
.
y
-
(
(
size
.
y
+
pad_ref
->
m_Size
.
y
)
/
2
)
)
>=
dist_min
)
if
(
(
rel_pos
.
y
-
(
(
size
.
y
+
pad_ref
->
m_Size
.
y
)
/
2
)
)
>=
dist_min
)
diag
=
OK_DRC
;
diag
=
OK_DRC
;
}
}
...
@@ -1154,6 +1183,7 @@ static int TestClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int dis
...
@@ -1154,6 +1183,7 @@ static int TestClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int dis
y0
=
spot_cY
+
deltay
;
y0
=
spot_cY
+
deltay
;
RotatePoint
(
&
x0
,
&
y0
,
spot_cX
,
spot_cY
,
orient
);
RotatePoint
(
&
x0
,
&
y0
,
spot_cX
,
spot_cY
,
orient
);
RotatePoint
(
&
x0
,
&
y0
,
segm_angle
);
RotatePoint
(
&
x0
,
&
y0
,
segm_angle
);
bflag
=
TestMarginToCircle
(
x0
,
y0
,
p_dimx
+
seuil
,
segm_long
);
bflag
=
TestMarginToCircle
(
x0
,
y0
,
p_dimx
+
seuil
,
segm_long
);
if
(
bflag
==
BAD_DRC
)
if
(
bflag
==
BAD_DRC
)
return
BAD_DRC
;
return
BAD_DRC
;
...
@@ -1162,6 +1192,7 @@ static int TestClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int dis
...
@@ -1162,6 +1192,7 @@ static int TestClearanceSegmToPad( const D_PAD* pad_to_test, int w_segm, int dis
y0
=
spot_cY
-
deltay
;
y0
=
spot_cY
-
deltay
;
RotatePoint
(
&
x0
,
&
y0
,
spot_cX
,
spot_cY
,
orient
);
RotatePoint
(
&
x0
,
&
y0
,
spot_cX
,
spot_cY
,
orient
);
RotatePoint
(
&
x0
,
&
y0
,
segm_angle
);
RotatePoint
(
&
x0
,
&
y0
,
segm_angle
);
bflag
=
TestMarginToCircle
(
x0
,
y0
,
p_dimx
+
seuil
,
segm_long
);
bflag
=
TestMarginToCircle
(
x0
,
y0
,
p_dimx
+
seuil
,
segm_long
);
if
(
bflag
==
BAD_DRC
)
if
(
bflag
==
BAD_DRC
)
return
BAD_DRC
;
return
BAD_DRC
;
...
@@ -1282,7 +1313,7 @@ static int TestMarginToCircle( int cx, int cy, int rayon, int longueur )
...
@@ -1282,7 +1313,7 @@ static int TestMarginToCircle( int cx, int cy, int rayon, int longueur )
/******************************************************************************/
/******************************************************************************/
static
void
Affiche_Erreur_DRC
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
BOARD
*
Pcb
,
static
void
Affiche_Erreur_DRC
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
BOARD
*
Pcb
,
TRACK
*
pt_ref
,
void
*
pt_item
,
int
errnumber
)
TRACK
*
pt_ref
,
BOARD_ITEM
*
pt_item
,
int
errnumber
)
/******************************************************************************/
/******************************************************************************/
/* affiche les erreurs de DRC :
/* affiche les erreurs de DRC :
...
@@ -1302,24 +1333,30 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
...
@@ -1302,24 +1333,30 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
netname1
=
equipot
->
m_Netname
;
netname1
=
equipot
->
m_Netname
;
else
else
netname1
=
wxT
(
"<noname>"
);
netname1
=
wxT
(
"<noname>"
);
netname2
=
wxT
(
"<noname>"
);
netname2
=
wxT
(
"<noname>"
);
tracktype
=
wxT
(
"Track"
);
if
(
pt_ref
->
Type
()
==
TYPEVIA
)
if
(
pt_ref
->
Type
()
==
TYPEVIA
)
tracktype
=
wxT
(
"Via"
);
tracktype
=
wxT
(
"Via"
);
if
(
pt_ref
->
Type
()
==
TYPEZONE
)
else
if
(
pt_ref
->
Type
()
==
TYPEZONE
)
tracktype
=
wxT
(
"Zone"
);
tracktype
=
wxT
(
"Zone"
);
else
tracktype
=
wxT
(
"Track"
);
if
(
(
(
EDA_BaseStruct
*
)
pt_item
)
->
Type
()
==
TYPEPAD
)
if
(
pt_item
->
Type
()
==
TYPEPAD
)
{
{
D_PAD
*
pad
=
(
D_PAD
*
)
pt_item
;
D_PAD
*
pad
=
(
D_PAD
*
)
pt_item
;
equipot
=
Pcb
->
FindNet
(
pad
->
m_NetCode
);
equipot
=
Pcb
->
FindNet
(
pad
->
m_NetCode
);
if
(
equipot
)
if
(
equipot
)
netname2
=
equipot
->
m_Netname
;
netname2
=
equipot
->
m_Netname
;
erc_pos
=
pad
->
m_Pos
;
erc_pos
=
pad
->
m_Pos
;
wxString
pad_name
=
pad
->
ReturnStringPadName
();
wxString
pad_name
=
pad
->
ReturnStringPadName
();
wxString
module_name
=
(
(
MODULE
*
)
(
pad
->
m_Parent
)
)
->
m_Reference
->
m_Text
;
wxString
module_name
=
(
(
MODULE
*
)
(
pad
->
m_Parent
)
)
->
m_Reference
->
m_Text
;
msg
.
Printf
(
_
(
"%d Drc Err %d %s (net %s)and PAD %s (%s) net %s @ %d,%d
\n
"
),
msg
.
Printf
(
_
(
"%d Drc Err %d %s (net %s)and PAD %s (%s) net %s @ %d,%d
\n
"
),
ErrorsDRC_Count
,
errnumber
,
tracktype
.
GetData
(),
ErrorsDRC_Count
,
errnumber
,
tracktype
.
GetData
(),
netname1
.
GetData
(),
netname1
.
GetData
(),
...
@@ -1327,6 +1364,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
...
@@ -1327,6 +1364,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
netname2
.
GetData
(),
netname2
.
GetData
(),
erc_pos
.
x
,
erc_pos
.
y
);
erc_pos
.
x
,
erc_pos
.
y
);
}
}
else
/* erreur sur segment de piste */
else
/* erreur sur segment de piste */
{
{
pt_segm
=
(
TRACK
*
)
pt_item
;
pt_segm
=
(
TRACK
*
)
pt_item
;
...
@@ -1349,7 +1387,8 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
...
@@ -1349,7 +1387,8 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
<
hypot
(
(
double
)
(
erc_pos
.
x
-
pt_ref
->
m_End
.
x
),
<
hypot
(
(
double
)
(
erc_pos
.
x
-
pt_ref
->
m_End
.
x
),
(
double
)
(
erc_pos
.
y
-
pt_ref
->
m_End
.
y
)
)
)
(
double
)
(
erc_pos
.
y
-
pt_ref
->
m_End
.
y
)
)
)
{
{
EXCHG
(
erc_pos_f
.
x
,
erc_pos
.
x
);
EXCHG
(
erc_pos_f
.
y
,
erc_pos
.
y
);
EXCHG
(
erc_pos_f
.
x
,
erc_pos
.
x
);
EXCHG
(
erc_pos_f
.
y
,
erc_pos
.
y
);
}
}
msg
.
Printf
(
_
(
"%d Err type %d: %s (net %s) and track (net %s) @ %d,%d
\n
"
),
msg
.
Printf
(
_
(
"%d Err type %d: %s (net %s) and track (net %s) @ %d,%d
\n
"
),
ErrorsDRC_Count
,
errnumber
,
tracktype
.
GetData
(),
ErrorsDRC_Count
,
errnumber
,
tracktype
.
GetData
(),
...
@@ -1362,11 +1401,13 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
...
@@ -1362,11 +1401,13 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb,
DrcFrame
->
m_logWindow
->
AppendText
(
msg
);
DrcFrame
->
m_logWindow
->
AppendText
(
msg
);
else
else
panel
->
m_Parent
->
Affiche_Message
(
msg
);
panel
->
m_Parent
->
Affiche_Message
(
msg
);
if
(
s_RptFile
)
if
(
s_RptFile
)
fprintf
(
s_RptFile
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
fprintf
(
s_RptFile
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
if
(
current_marqueur
==
NULL
)
if
(
current_marqueur
==
NULL
)
current_marqueur
=
new
MARQUEUR
(
Pcb
);
current_marqueur
=
new
MARQUEUR
(
Pcb
);
current_marqueur
->
m_Pos
=
wxPoint
(
erc_pos
.
x
,
erc_pos
.
y
);
current_marqueur
->
m_Pos
=
wxPoint
(
erc_pos
.
x
,
erc_pos
.
y
);
current_marqueur
->
m_Color
=
WHITE
;
current_marqueur
->
m_Color
=
WHITE
;
current_marqueur
->
m_Diag
=
msg
;
current_marqueur
->
m_Diag
=
msg
;
...
@@ -1533,20 +1574,22 @@ static int Tst_Ligne( int x1, int y1, int x2, int y2 )
...
@@ -1533,20 +1574,22 @@ static int Tst_Ligne( int x1, int y1, int x2, int y2 )
if
(
x1
<
xcliplo
)
if
(
x1
<
xcliplo
)
{
{
temp
=
USCALE
(
(
y1
-
y2
),
(
xcliplo
-
x1
),
(
x2
-
x1
)
);
temp
=
USCALE
(
(
y1
-
y2
),
(
xcliplo
-
x1
),
(
x2
-
x1
)
);
y1
-=
temp
;
x1
=
xcliplo
;
y1
-=
temp
;
x1
=
xcliplo
;
WHEN_INSIDE
;
WHEN_INSIDE
;
}
}
if
(
x2
>
xcliphi
)
if
(
x2
>
xcliphi
)
{
{
temp
=
USCALE
(
(
y1
-
y2
),
(
x2
-
xcliphi
),
(
x2
-
x1
)
);
temp
=
USCALE
(
(
y1
-
y2
),
(
x2
-
xcliphi
),
(
x2
-
x1
)
);
y2
+=
temp
;
x2
=
xcliphi
;
y2
+=
temp
;
x2
=
xcliphi
;
WHEN_INSIDE
;
WHEN_INSIDE
;
}
}
}
}
}
while
(
0
);
}
while
(
0
);
if
(
(
(
x2
+
x1
)
/
2
<=
xcliphi
)
&&
(
(
x2
+
x1
)
/
2
>=
xcliplo
)
\
if
(
(
(
x2
+
x1
)
/
2
<=
xcliphi
)
&&
(
(
x2
+
x1
)
/
2
>=
xcliplo
)
\
&&
(
(
y2
+
y1
)
/
2
<=
ycliphi
)
&&
(
(
y2
+
y1
)
/
2
>=
ycliplo
)
)
&&
(
(
y2
+
y1
)
/
2
<=
ycliphi
)
&&
(
(
y2
+
y1
)
/
2
>=
ycliplo
)
)
{
{
return
BAD_DRC
;
return
BAD_DRC
;
}
}
...
...
pcbnew/edit.cpp
View file @
7e448f2e
...
@@ -20,19 +20,20 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame,
...
@@ -20,19 +20,20 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame,
EDA_BaseStruct
*
DrawStruct
,
wxDC
*
DC
);
EDA_BaseStruct
*
DrawStruct
,
wxDC
*
DC
);
// see wxstruct.h
// see wxstruct.h
void
WinEDA_PcbFrame
::
SendMessageToEESCHEMA
(
EDA_BaseStruct
*
objectToSync
)
void
WinEDA_PcbFrame
::
SendMessageToEESCHEMA
(
BOARD_ITEM
*
objectToSync
)
{
{
char
cmd
[
1024
];
char
cmd
[
1024
];
MODULE
*
module
=
NULL
;
MODULE
*
module
=
NULL
;
if
(
objectToSync
==
NULL
)
return
;
if
(
objectToSync
==
NULL
)
return
;
if
(
objectToSync
->
Type
()
==
TYPEMODULE
)
if
(
objectToSync
->
Type
()
==
TYPEMODULE
)
module
=
(
MODULE
*
)
objectToSync
;
module
=
(
MODULE
*
)
objectToSync
;
else
if
(
objectToSync
->
Type
()
==
TYPEPAD
)
else
if
(
objectToSync
->
Type
()
==
TYPEPAD
)
module
=
(
MODULE
*
)
objectToSync
->
m_Parent
;
module
=
(
MODULE
*
)
objectToSync
->
GetParent
()
;
else
if
(
objectToSync
->
Type
()
==
TYPETEXTEMODULE
)
else
if
(
objectToSync
->
Type
()
==
TYPETEXTEMODULE
)
module
=
(
MODULE
*
)
objectToSync
->
m_Parent
;
module
=
(
MODULE
*
)
objectToSync
->
GetParent
()
;
// ask only for the reference for now, maybe pins later.
// ask only for the reference for now, maybe pins later.
if
(
module
)
if
(
module
)
...
...
pcbnew/editrack.cpp
View file @
7e448f2e
...
@@ -375,7 +375,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
...
@@ -375,7 +375,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* track, wxDC* DC )
if
(
track
==
NULL
)
if
(
track
==
NULL
)
return
;
return
;
if
(
Drc_On
&&
(
Drc
(
this
,
DC
,
g_CurrentTrackSegment
,
m_Pcb
->
m_Track
,
1
)
==
BAD_DRC
)
)
if
(
Drc_On
&&
Drc
(
this
,
DC
,
g_CurrentTrackSegment
,
m_Pcb
->
m_Track
,
1
)
==
BAD_DRC
)
return
;
return
;
/* Sauvegarde des coord du point terminal de la piste */
/* Sauvegarde des coord du point terminal de la piste */
...
...
pcbnew/files.cpp
View file @
7e448f2e
...
@@ -235,7 +235,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, boo
...
@@ -235,7 +235,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, boo
g_SaveTime
=
time
(
NULL
);
g_SaveTime
=
time
(
NULL
);
#if
0
&& defined(DEBUG)
#if
1
&& defined(DEBUG)
// note this seems to freeze up pcbnew when run under the kicad project
// note this seems to freeze up pcbnew when run under the kicad project
// manager. runs fine from command prompt.
// manager. runs fine from command prompt.
// output the board object tree to stdout:
// output the board object tree to stdout:
...
...
pcbnew/hotkeys.cpp
View file @
7e448f2e
...
@@ -332,7 +332,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
...
@@ -332,7 +332,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
{
{
// A new track is in progress: call to End_Route()
// A new track is in progress: call to End_Route()
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
End_Route
(
(
TRACK
*
)
(
GetCurItem
()
),
DC
);
End_Route
(
(
TRACK
*
)
GetCurItem
(
),
DC
);
}
}
break
;
break
;
...
...
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