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
f353c77c
Commit
f353c77c
authored
Oct 31, 2007
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more zone preps
parent
64e9e168
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1131 additions
and
893 deletions
+1131
-893
change_log.txt
change_log.txt
+2
-0
base_struct.cpp
common/base_struct.cpp
+0
-17
gr_basic.cpp
common/gr_basic.cpp
+1009
-826
base_struct.h
include/base_struct.h
+13
-2
pcbstruct.h
include/pcbstruct.h
+11
-0
wxstruct.h
include/wxstruct.h
+7
-1
class_board.cpp
pcbnew/class_board.cpp
+13
-5
class_edge_mod.cpp
pcbnew/class_edge_mod.cpp
+3
-1
class_track.h
pcbnew/class_track.h
+6
-4
classpcb.cpp
pcbnew/classpcb.cpp
+19
-1
files.cpp
pcbnew/files.cpp
+7
-3
tracepcb.cpp
pcbnew/tracepcb.cpp
+2
-1
trpiste.cpp
pcbnew/trpiste.cpp
+1
-1
zones.cpp
pcbnew/zones.cpp
+38
-31
No files found.
change_log.txt
View file @
f353c77c
...
...
@@ -19,6 +19,8 @@ email address.
design and was crashing. Also, export_to_pcbnew.cpp now uses the simple
BOARD::Save() function. It was another place to maintain the PCB file format,
rather than simply putting that knowledge into one place like BOARD::Save().
+ all
beautified gr_basic.cpp and made CLIP_LINE macro a static inline function.
2007-Oct-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
...
...
common/base_struct.cpp
View file @
f353c77c
...
...
@@ -57,23 +57,6 @@ void EDA_BaseStruct::InitVars()
}
/* Gestion de l'etat (status) de la structure (active, deleted..) */
int
EDA_BaseStruct
::
GetState
(
int
type
)
const
{
return
m_Status
&
type
;
}
void
EDA_BaseStruct
::
SetState
(
int
type
,
int
state
)
{
if
(
state
)
m_Status
|=
type
;
/* state = ON ou OFF */
else
m_Status
&=
~
type
;
}
/***********************************************************/
void
EDA_BaseStruct
::
DeleteStructList
()
/***********************************************************/
...
...
common/gr_basic.cpp
View file @
f353c77c
This diff is collapsed.
Click to expand it.
include/base_struct.h
View file @
f353c77c
...
...
@@ -191,8 +191,19 @@ public:
/* Gestion de l'etat (status) de la structure (active, deleted..) */
int
GetState
(
int
type
)
const
;
void
SetState
(
int
type
,
int
state
);
int
GetState
(
int
type
)
const
{
return
m_Status
&
type
;
}
void
SetState
(
int
type
,
int
state
)
{
if
(
state
)
m_Status
|=
type
;
// state = ON or OFF
else
m_Status
&=
~
type
;
}
int
ReturnStatus
()
const
{
return
m_Status
;
}
...
...
include/pcbstruct.h
View file @
f353c77c
...
...
@@ -442,6 +442,17 @@ public:
EDGE_ZONE
(
BOARD_ITEM
*
StructFather
);
EDGE_ZONE
(
const
EDGE_ZONE
&
edgezone
);
~
EDGE_ZONE
();
EDGE_ZONE
*
Next
()
{
return
(
EDGE_ZONE
*
)
Pnext
;
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.pcb" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
;
};
...
...
include/wxstruct.h
View file @
f353c77c
...
...
@@ -535,7 +535,13 @@ public:
void
Block_Move
(
wxDC
*
DC
);
void
Block_Duplicate
(
wxDC
*
DC
);
// zone handling:
/**
* Function DelLimitesZone
* deletes the limits of a zone.
* @param DC A wxDC to draw onto.
* @param Redraw If true, means redraw the pcb without the zone limits
*/
void
DelLimitesZone
(
wxDC
*
DC
,
bool
Redraw
);
// layerhandling:
...
...
pcbnew/class_board.cpp
View file @
f353c77c
...
...
@@ -610,7 +610,7 @@ bool BOARD::Save( FILE* aFile ) const
default
:
// future: throw exception here
#if defined(DEBUG)
printf
(
"BOARD::Save() ignoring
draw
type %d
\n
"
,
item
->
Type
()
);
printf
(
"BOARD::Save() ignoring
m_Drawings
type %d
\n
"
,
item
->
Type
()
);
#endif
break
;
}
...
...
@@ -623,14 +623,22 @@ bool BOARD::Save( FILE* aFile ) const
goto
out
;
fprintf
(
aFile
,
"$EndTRACK
\n
"
);
// save the zones
fprintf
(
aFile
,
"$ZONE
\n
"
);
for
(
item
=
m_Zone
;
item
;
item
=
item
->
Next
()
)
if
(
!
item
->
Save
(
aFile
)
)
goto
out
;
fprintf
(
aFile
,
"$EndZONE
\n
"
);
// save the zone edges
if
(
m_CurrentLimitZone
)
{
fprintf
(
aFile
,
"$ZONE_EDGE
\n
"
);
for
(
item
=
m_CurrentLimitZone
;
item
;
item
=
item
->
Next
()
)
if
(
!
item
->
Save
(
aFile
)
)
goto
out
;
fprintf
(
aFile
,
"$EndZONE_EDGE
\n
"
);
}
if
(
fprintf
(
aFile
,
"$EndBOARD
\n
"
)
!=
sizeof
(
"$EndBOARD
\n
"
)
-
1
)
goto
out
;
...
...
@@ -690,11 +698,11 @@ void BOARD::Show( int nestLevel, std::ostream& os )
p
->
Show
(
nestLevel
+
2
,
os
);
NestedSpace
(
nestLevel
+
1
,
os
)
<<
"</zones>
\n
"
;
NestedSpace
(
nestLevel
+
1
,
os
)
<<
"<
edgezon
es>
\n
"
;
NestedSpace
(
nestLevel
+
1
,
os
)
<<
"<
zoneedg
es>
\n
"
;
p
=
m_CurrentLimitZone
;
for
(
;
p
;
p
=
p
->
Pnext
)
p
->
Show
(
nestLevel
+
2
,
os
);
NestedSpace
(
nestLevel
+
1
,
os
)
<<
"</
edgezon
es>
\n
"
;
NestedSpace
(
nestLevel
+
1
,
os
)
<<
"</
zoneedg
es>
\n
"
;
p
=
m_Son
;
for
(
;
p
;
p
=
p
->
Pnext
)
...
...
pcbnew/class_edge_mod.cpp
View file @
f353c77c
...
...
@@ -404,7 +404,9 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
default
:
// future: throw an exception here
printf
(
"%s unexpected EDGE_MODULE::m_Shape: %d
\n
"
,
__func__
,
m_Shape
);
#if defined(DEBUG)
printf
(
"EDGE_MODULE::Save(): unexpected m_Shape: %d
\n
"
,
m_Shape
);
#endif
break
;
}
...
...
pcbnew/class_track.h
View file @
f353c77c
...
...
@@ -80,10 +80,12 @@ public:
*/
void
Insert
(
BOARD
*
Pcb
,
BOARD_ITEM
*
InsertPoint
);
/*Search the "best" insertion point within the track linked list
* the best point is the of the corresponding net code section
* @return the item found in the linked list (or NULL if no track)
*/
/**
* Function GetBestInsertPoint
* searches the "best" insertion point within the track linked list.
* The best point is the of the corresponding net code section.
* @return TRACK* - the item found in the linked list (or NULL if no track)
*/
TRACK
*
GetBestInsertPoint
(
BOARD
*
Pcb
);
/* Search (within the track linked list) the first segment matching the netcode
...
...
pcbnew/classpcb.cpp
View file @
f353c77c
...
...
@@ -38,6 +38,7 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
EDGE_ZONE
::
EDGE_ZONE
(
BOARD_ITEM
*
parent
)
:
DRAWSEGMENT
(
parent
,
TYPEEDGEZONE
)
{
m_Width
=
2
;
// a minimum for visibility, while dragging
}
...
...
@@ -47,6 +48,23 @@ EDGE_ZONE:: ~EDGE_ZONE()
}
bool
EDGE_ZONE
::
Save
(
FILE
*
aFile
)
const
{
if
(
GetState
(
DELETED
)
)
return
true
;
int
ret
=
fprintf
(
aFile
,
"ZE %d %d %d %d %d %lX %X
\n
"
,
m_Start
.
x
,
m_Start
.
y
,
m_End
.
x
,
m_End
.
y
,
m_Angle
,
m_TimeStamp
,
ReturnStatus
()
);
return
(
ret
>
14
);
}
/**********************/
/* Classe DRAWSEGMENT */
/**********************/
...
...
@@ -131,7 +149,7 @@ bool DRAWSEGMENT::Save( FILE* aFile ) const
bool
rc
=
false
;
if
(
fprintf
(
aFile
,
"$DRAWSEGMENT
\n
"
)
!=
sizeof
(
"
%
DRAWSEGMENT
\n
"
)
-
1
)
if
(
fprintf
(
aFile
,
"$DRAWSEGMENT
\n
"
)
!=
sizeof
(
"
$
DRAWSEGMENT
\n
"
)
-
1
)
goto
out
;
fprintf
(
aFile
,
"Po %d %d %d %d %d %d
\n
"
,
...
...
pcbnew/files.cpp
View file @
f353c77c
...
...
@@ -235,9 +235,13 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC * DC, bo
#if 1 && defined(DEBUG)
// note this seems to freeze up pcbnew when run under the kicad project
// manager. runs fine from command prompt.
// output the board object tree to stdout:
// note this freezes up pcbnew when run under the kicad project
// manager. runs fine from command prompt. This is because the kicad
// project manager redirects stdout of the child pcbnew process to itself,
// but never reads from that pipe, and that in turn eventually blocks
// the pcbnew program when the pipe it is writing to gets full.
// Output the board object tree to stdout, but please run from command prompt:
m_Pcb
->
Show
(
0
,
std
::
cout
);
#endif
...
...
pcbnew/tracepcb.cpp
View file @
f353c77c
...
...
@@ -177,10 +177,11 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode )
DrawHightLight
(
DC
,
g_HightLigth_NetCode
);
EDGE_ZONE
*
segment
=
m_Pcb
->
m_CurrentLimitZone
;
for
(
;
segment
!=
NULL
;
segment
=
(
EDGE_ZONE
*
)
segment
->
Pback
)
for
(
;
segment
!=
NULL
;
segment
=
(
EDGE_ZONE
*
)
segment
->
Pback
)
{
if
(
segment
->
m_Flags
&
IS_MOVED
)
continue
;
Trace_DrawSegmentPcb
(
DrawPanel
,
DC
,
segment
,
mode
);
}
...
...
pcbnew/trpiste.cpp
View file @
f353c77c
...
...
@@ -92,11 +92,11 @@ void Trace_DrawSegmentPcb( WinEDA_DrawPanel* panel, wxDC* DC,
/* coord de depart */
ux0
=
PtDrawSegment
->
m_Start
.
x
;
uy0
=
PtDrawSegment
->
m_Start
.
y
;
/* coord d'arrivee */
dx
=
PtDrawSegment
->
m_End
.
x
;
dy
=
PtDrawSegment
->
m_End
.
y
;
mode
=
DisplayOpt
.
DisplayDrawItems
;
if
(
PtDrawSegment
->
m_Flags
&
FORCE_SKETCH
)
mode
=
SKETCH
;
...
...
pcbnew/zones.cpp
View file @
f353c77c
...
...
@@ -412,8 +412,7 @@ void WinEDA_PcbFrame::Edit_Zone_Width( wxDC* DC, SEGZONE* aZone )
Line
.
ToDouble
(
&
f_new_width
);
g_DesignSettings
.
m_CurrentTrackWidth
=
From_User_Unit
(
g_UnitMetric
,
f_new_width
,
GetScreen
(
)
->
GetInternalUnits
()
);
f_new_width
,
GetScreen
()
->
GetInternalUnits
()
);
for
(
SEGZONE
*
zone
=
m_Pcb
->
m_Zone
;
zone
;
zone
=
zone
->
Next
()
)
{
...
...
@@ -604,16 +603,16 @@ static void Display_Zone_Netname( WinEDA_PcbFrame* frame )
static
void
Exit_Zones
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
/********************************************************/
/*
routine d'annulation de la Commande Begin_Zone si une piste est en cours
*
de tracage, ou de sortie de l'application SEGZONES.
*
Appel par la touche ESC
/*
*
*
Function Exit_Zones
*
cancels the Begin_Zone state if at least one EDGE_ZONE has been created.
*/
{
WinEDA_PcbFrame
*
pcbframe
=
(
WinEDA_PcbFrame
*
)
Panel
->
m_Parent
;
if
(
pcbframe
->
m_Pcb
->
m_CurrentLimitZone
)
{
if
(
Panel
->
ManageCurseur
)
/* trace en cours */
if
(
Panel
->
ManageCurseur
)
// trace in progress
{
Panel
->
ManageCurseur
(
Panel
,
DC
,
0
);
}
...
...
@@ -629,12 +628,9 @@ static void Exit_Zones( WinEDA_DrawPanel* Panel, wxDC* DC )
/**************************************************************/
void
WinEDA_BasePcbFrame
::
DelLimitesZone
(
wxDC
*
DC
,
bool
Redraw
)
/**************************************************************/
/* Supprime la liste des segments constituant la frontiere courante
* Libere la memoire correspondante
*/
{
EDGE_ZONE
*
segment
,
*
Next
;
EDGE_ZONE
*
segment
;
EDGE_ZONE
*
next
;
if
(
m_Pcb
->
m_CurrentLimitZone
==
NULL
)
return
;
...
...
@@ -642,14 +638,17 @@ void WinEDA_BasePcbFrame::DelLimitesZone( wxDC* DC, bool Redraw )
if
(
!
IsOK
(
this
,
_
(
"Delete Current Zone Edges"
)
)
)
return
;
/
* efface ancienne limite de zone */
/
/ erase the old zone border, one segment at a time
segment
=
m_Pcb
->
m_CurrentLimitZone
;
for
(
;
segment
!=
NULL
;
segment
=
N
ext
)
for
(
;
segment
!=
NULL
;
segment
=
n
ext
)
{
Next
=
(
EDGE_ZONE
*
)
segment
->
Pback
;
next
=
(
EDGE_ZONE
*
)
segment
->
Pback
;
if
(
Redraw
)
Trace_DrawSegmentPcb
(
DrawPanel
,
DC
,
segment
,
GR_XOR
);
segment
->
Pnext
=
NULL
;
delete
segment
;
segment
->
Pnext
=
NULL
;
delete
segment
;
}
SetCurItem
(
NULL
);
...
...
@@ -657,47 +656,53 @@ void WinEDA_BasePcbFrame::DelLimitesZone( wxDC* DC, bool Redraw )
}
/********************************************/
EDGE_ZONE
*
WinEDA_PcbFrame
::
Begin_Zone
()
/********************************************/
/*
* Routine d'initialisation d'un trace de Limite de Zone ou
* de placement d'un point intermediaire
/**
* Function Begin_Zone
* either initializes the first segment of a new zone, or adds an
* intermediate segment.
*/
EDGE_ZONE
*
WinEDA_PcbFrame
::
Begin_Zone
()
{
EDGE_ZONE
*
oldedge
,
*
newedge
=
NULL
;
EDGE_ZONE
*
oldedge
;
EDGE_ZONE
*
newedge
=
NULL
;
oldedge
=
m_Pcb
->
m_CurrentLimitZone
;
// if first segment
if
(
(
m_Pcb
->
m_CurrentLimitZone
==
NULL
)
/* debut reel du trace */
||
(
DrawPanel
->
ManageCurseur
==
NULL
)
)
/* reprise d'un trace complementaire */
{
m_Pcb
->
m_CurrentLimitZone
=
newedge
=
new
EDGE_ZONE
(
m_Pcb
);
newedge
=
new
EDGE_ZONE
(
m_Pcb
);
newedge
->
m_Flags
=
IS_NEW
|
STARTPOINT
|
IS_MOVED
;
newedge
->
m_Start
=
newedge
->
m_End
=
GetScreen
()
->
m_Curseur
;
newedge
->
SetLayer
(
GetScreen
()
->
m_Active_Layer
);
// link into list:
newedge
->
Pback
=
oldedge
;
if
(
oldedge
)
oldedge
->
Pnext
=
newedge
;
newedge
->
SetLayer
(
GetScreen
()
->
m_Active_Layer
);
newedge
->
m_Width
=
2
;
/* Largeur minimum tracable */
newedge
->
m_Start
=
newedge
->
m_End
=
GetScreen
()
->
m_Curseur
;
m_Pcb
->
m_CurrentLimitZone
=
newedge
;
DrawPanel
->
ManageCurseur
=
Show_Zone_Edge_While_MoveMouse
;
DrawPanel
->
ForceCloseManageCurseur
=
Exit_Zones
;
}
// edge in progress:
else
/* piste en cours : les coord du point d'arrivee ont ete mises
* a jour par la routine Show_Zone_Edge_While_MoveMouse*/
{
if
(
oldedge
->
m_Start
!=
oldedge
->
m_End
)
{
newedge
=
new
EDGE_ZONE
(
oldedge
);
newedge
->
Pback
=
oldedge
;
oldedge
->
Pnext
=
newedge
;
newedge
->
m_Flags
=
IS_NEW
|
IS_MOVED
;
newedge
->
m_Start
=
newedge
->
m_End
=
oldedge
->
m_End
;
newedge
->
SetLayer
(
GetScreen
()
->
m_Active_Layer
);
// link into list:
newedge
->
Pback
=
oldedge
;
oldedge
->
Pnext
=
newedge
;
m_Pcb
->
m_CurrentLimitZone
=
newedge
;
}
}
...
...
@@ -724,11 +729,13 @@ void WinEDA_PcbFrame::End_Zone( wxDC* DC )
/* il sera raccorde au point de depart */
PtLim
=
m_Pcb
->
m_CurrentLimitZone
;
PtLim
->
m_Flags
&=
~
(
IS_NEW
|
IS_MOVED
);
while
(
PtLim
&&
PtLim
->
Pback
)
{
PtLim
=
(
EDGE_ZONE
*
)
PtLim
->
Pback
;
if
(
PtLim
->
m_Flags
&
STARTPOINT
)
break
;
PtLim
->
m_Flags
&=
~
(
IS_NEW
|
IS_MOVED
);
}
...
...
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