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
99408024
Commit
99408024
authored
Jan 31, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleaning. Some bugs fixed. Added contributors to list in About Kicad.
parent
5813a12e
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
227 additions
and
184 deletions
+227
-184
CHANGELOG.txt
CHANGELOG.txt
+4
-1
about_kicad.cpp
common/about_kicad.cpp
+3
-1
base_struct.cpp
common/base_struct.cpp
+4
-5
class_drawsheet.cpp
eeschema/class_drawsheet.cpp
+12
-0
class_drawsheet.h
eeschema/class_drawsheet.h
+7
-0
class_libentry.cpp
eeschema/class_libentry.cpp
+2
-2
class_schematic_items.cpp
eeschema/class_schematic_items.cpp
+62
-2
class_schematic_items.h
eeschema/class_schematic_items.h
+12
-0
class_text-label.cpp
eeschema/class_text-label.cpp
+41
-0
class_text-label.h
eeschema/class_text-label.h
+19
-0
classes_body_items.cpp
eeschema/classes_body_items.cpp
+8
-7
component_class.cpp
eeschema/component_class.cpp
+1
-1
eeredraw.cpp
eeschema/eeredraw.cpp
+1
-30
locate.cpp
eeschema/locate.cpp
+45
-130
onleftclick.cpp
eeschema/onleftclick.cpp
+6
-5
No files found.
CHANGELOG.txt
View file @
99408024
...
...
@@ -9,7 +9,10 @@ email address.
================================================================================
++All:
Print functions and display zoom level modified to use the new zoom implementation
Comments adde in some functions.
Comments added in some functions.
Code cleaning
some bugs fixed.
Added contributors to list in about Kicad.
2009-Jan-29 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
...
...
common/about_kicad.cpp
View file @
99408024
...
...
@@ -110,9 +110,11 @@ InitKiCadAbout( wxAboutDialogInfo& info )
/* Add developers */
info
.
AddDeveloper
(
wxT
(
"Jean-Pierre Charras <jean-pierre.charras@inpg.fr>"
)
);
info
.
AddDeveloper
(
SetMsg
(
wxT
(
"Jerry Jacobs <jerkejacobs@gmail.com>"
)
)
);
info
.
AddDeveloper
(
SetMsg
(
wxT
(
"Dick Hollenbeck <dick@softplc.com>"
)
)
);
info
.
AddDeveloper
(
SetMsg
(
wxT
(
"Jerry Jacobs <jerkejacobs@gmail.com>"
)
)
);
info
.
AddDeveloper
(
SetMsg
(
wxT
(
"Jonas Diemer <diemer@gmx.de>"
)
)
);
info
.
AddDeveloper
(
SetMsg
(
wxT
(
"KBool Library <http://boolean.klaasholwerda.nl/bool.html>"
)
)
);
info
.
AddDeveloper
(
SetMsg
(
wxT
(
"Rok Markovic <rok@kanardia.eu>"
)
)
);
info
.
AddDeveloper
(
SetMsg
(
wxT
(
"Vesa Solonen <vesa.solonen@hut.fi>"
)
)
);
info
.
AddDeveloper
(
SetMsg
(
wxT
(
"Wayne Stambaugh <stambaughw@verizon.net>"
)
)
);
...
...
common/base_struct.cpp
View file @
99408024
...
...
@@ -209,18 +209,17 @@ bool EDA_TextStruct::HitTest( const wxPoint& posref )
*/
{
int
dx
,
dy
;
int
spot_cX
,
spot_cY
;
wxPoint
location
;
dx
=
(
int
)
((
Pitch
()
*
GetLength
()
)
/
2
);
dy
=
m_Size
.
y
/
2
;
/* Is the ref point inside the text area ? */
spot_cX
=
posref
.
x
-
m_Pos
.
x
;
spot_cY
=
posref
.
y
-
m_Pos
.
y
;
location
=
posref
-
m_Pos
;
RotatePoint
(
&
spot_cX
,
&
spot_cY
,
-
m_Orient
);
RotatePoint
(
&
location
,
-
m_Orient
);
if
(
(
abs
(
spot_cX
)
<=
abs
(
dx
)
)
&&
(
abs
(
spot_cY
)
<=
abs
(
dy
)
)
)
if
(
(
abs
(
location
.
x
)
<=
abs
(
dx
)
)
&&
(
abs
(
location
.
y
)
<=
abs
(
dy
)
)
)
return
true
;
return
false
;
...
...
eeschema/class_drawsheet.cpp
View file @
99408024
...
...
@@ -374,6 +374,18 @@ EDA_Rect DrawSheetStruct::GetBoundingBox()
return
box
;
}
/************************************************/
bool
DrawSheetStruct
::
HitTest
(
const
wxPoint
&
aPosRef
)
/************************************************/
/** Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
{
EDA_Rect
rect
=
GetBoundingBox
();
return
rect
.
Inside
(
aPosRef
);
}
/************************************/
int
DrawSheetStruct
::
ComponentCount
()
...
...
eeschema/class_drawsheet.h
View file @
99408024
...
...
@@ -129,10 +129,17 @@ public:
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aDrawMode
,
int
aColor
=
-
1
);
/** Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
bool
HitTest
(
const
wxPoint
&
aPosRef
);
/** Function GetBoundingBox
* @return an EDA_Rect giving the bouding box of the sheet
*/
EDA_Rect
GetBoundingBox
();
void
SwapData
(
DrawSheetStruct
*
copyitem
);
/** Function ComponentCount
...
...
eeschema/class_libentry.cpp
View file @
99408024
...
...
@@ -249,8 +249,8 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
}
// Update the BoundaryBox. Remember the fact the screen Y axis is the reverse */
NEGATE
(
ymax
);
NEGATE
(
ymin
);
//
Y is not is screen axis sense
// Ensure H > 0
(wxRect assume it)
NEGATE
(
ymax
);
NEGATE
(
ymin
);
//
y coordinates are screen oriented
// Ensure H > 0
if
(
ymax
<
ymin
)
EXCHG
(
ymax
,
ymin
);
BoundaryBox
.
SetX
(
xmin
);
BoundaryBox
.
SetWidth
(
xmax
-
xmin
);
...
...
eeschema/class_schematic_items.cpp
View file @
99408024
...
...
@@ -40,9 +40,9 @@ DrawBusEntryStruct::DrawBusEntryStruct( const wxPoint& pos, int shape, int id )
}
/*************************************/
/*************************************
***
/
wxPoint
DrawBusEntryStruct
::
m_End
()
const
/*************************************/
/*************************************
***
/
// retourne la coord de fin du raccord
{
...
...
@@ -98,6 +98,21 @@ bool DrawBusEntryStruct::Save( FILE* aFile ) const
}
/*********************************************/
EDA_Rect
DrawBusEntryStruct
::
GetBoundingBox
()
/*********************************************/
{
int
dx
=
m_Pos
.
x
-
m_End
().
x
;
int
dy
=
m_Pos
.
y
-
m_End
().
y
;
EDA_Rect
box
(
wxPoint
(
m_Pos
.
x
,
m_Pos
.
y
),
wxSize
(
dx
,
dy
)
);
box
.
Normalize
();
int
width
=
MAX
(
m_Width
,
g_DrawMinimunLineWidth
);
box
.
Inflate
(
width
/
2
,
width
/
2
);
return
box
;
}
/****************************/
/* class DrawJunctionStruct */
/***************************/
...
...
@@ -143,6 +158,7 @@ bool DrawJunctionStruct::Save( FILE* aFile ) const
EDA_Rect
DrawJunctionStruct
::
GetBoundingBox
()
// return a bounding box
{
int
width
=
DRAWJUNCTION_SIZE
*
2
;
int
xmin
=
m_Pos
.
x
-
DRAWJUNCTION_SIZE
;
...
...
@@ -153,6 +169,21 @@ EDA_Rect DrawJunctionStruct::GetBoundingBox()
return
ret
;
};
/*********************************************************/
bool
DrawJunctionStruct
::
HitTest
(
const
wxPoint
&
aPosRef
)
/*********************************************************/
/** Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
{
wxPoint
dist
=
aPosRef
-
m_Pos
;
if
(
sqrt
(
((
double
)
dist
.
x
*
dist
.
x
)
+
((
double
)
dist
.
y
*
dist
.
y
)
)
<
DRAWJUNCTION_SIZE
)
return
true
;
return
false
;
}
#if defined(DEBUG)
void
DrawJunctionStruct
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
...
...
@@ -188,6 +219,35 @@ DrawNoConnectStruct* DrawNoConnectStruct::GenCopy()
return
newitem
;
}
/*********************************************/
EDA_Rect
DrawNoConnectStruct
::
GetBoundingBox
()
/*********************************************/
{
const
int
DELTA
=
DRAWNOCONNECT_SIZE
/
2
;
EDA_Rect
box
(
wxPoint
(
m_Pos
.
x
-
DELTA
,
m_Pos
.
y
-
DELTA
),
wxSize
(
2
*
DELTA
,
2
*
DELTA
)
);
box
.
Normalize
();
return
box
;
}
/*********************************************************/
bool
DrawNoConnectStruct
::
HitTest
(
const
wxPoint
&
aPosRef
)
/*********************************************************/
/** Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
{
int
width
=
g_DrawMinimunLineWidth
;
int
delta
=
(
DRAWNOCONNECT_SIZE
+
width
)
/
2
;
wxPoint
dist
=
aPosRef
-
m_Pos
;
if
(
(
ABS
(
dist
.
x
)
<=
delta
)
&&
(
ABS
(
dist
.
y
)
<=
delta
)
)
return
true
;
return
false
;
}
/**
* Function Save
...
...
eeschema/class_schematic_items.h
View file @
99408024
...
...
@@ -162,6 +162,12 @@ public:
*/
bool
Save
(
FILE
*
aFile
)
const
;
/** Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
bool
HitTest
(
const
wxPoint
&
aPosRef
);
EDA_Rect
GetBoundingBox
();
};
...
...
@@ -261,6 +267,12 @@ public:
}
/** Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
bool
HitTest
(
const
wxPoint
&
aPosRef
);
EDA_Rect
GetBoundingBox
();
DrawJunctionStruct
*
GenCopy
();
...
...
eeschema/class_text-label.cpp
View file @
99408024
...
...
@@ -35,6 +35,16 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
m_IsDangling
=
FALSE
;
}
/** Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
bool
SCH_TEXT
::
HitTest
(
const
wxPoint
&
aPosRef
)
{
EDA_Rect
rect
=
GetBoundingBox
();
return
rect
.
Inside
(
aPosRef
);
}
/*********************************************/
SCH_TEXT
*
SCH_TEXT
::
GenCopy
()
...
...
@@ -290,6 +300,19 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const
return
success
;
}
/************************************************/
bool
SCH_GLOBALLABEL
::
HitTest
(
const
wxPoint
&
aPosRef
)
/************************************************/
/** Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
{
EDA_Rect
rect
=
GetBoundingBox
();
return
rect
.
Inside
(
aPosRef
);
}
/***********************************************************************************/
SCH_HIERLABEL
::
SCH_HIERLABEL
(
const
wxPoint
&
pos
,
const
wxString
&
text
)
:
...
...
@@ -327,6 +350,18 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const
return
success
;
}
/************************************************/
bool
SCH_HIERLABEL
::
HitTest
(
const
wxPoint
&
aPosRef
)
/************************************************/
/** Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
{
EDA_Rect
rect
=
GetBoundingBox
();
return
rect
.
Inside
(
aPosRef
);
}
/*********************************************************************************************/
void
SCH_LABEL
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
...
...
@@ -426,7 +461,9 @@ void SCH_HIERLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
}
}
/****************************************/
EDA_Rect
SCH_HIERLABEL
::
GetBoundingBox
()
/****************************************/
{
int
x
,
y
,
dx
,
dy
,
length
,
height
;
...
...
@@ -639,7 +676,9 @@ void SCH_GLOBALLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
}
/******************************************/
EDA_Rect
SCH_GLOBALLABEL
::
GetBoundingBox
()
/******************************************/
{
int
x
,
y
,
dx
,
dy
,
length
,
height
;
...
...
@@ -688,7 +727,9 @@ EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
}
/***********************************/
EDA_Rect
SCH_TEXT
::
GetBoundingBox
()
/***********************************/
{
int
x
,
y
,
dx
,
dy
,
length
,
height
;
...
...
eeschema/class_text-label.h
View file @
99408024
...
...
@@ -102,6 +102,13 @@ public:
void
SwapData
(
SCH_TEXT
*
copyitem
);
void
Place
(
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
);
/** Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
bool
HitTest
(
const
wxPoint
&
aPosRef
);
EDA_Rect
GetBoundingBox
();
/**
...
...
@@ -175,6 +182,12 @@ public:
*/
bool
Save
(
FILE
*
aFile
)
const
;
/** Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
bool
HitTest
(
const
wxPoint
&
aPosRef
);
EDA_Rect
GetBoundingBox
();
};
...
...
@@ -212,6 +225,12 @@ public:
*/
bool
Save
(
FILE
*
aFile
)
const
;
/** Function HitTest
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
bool
HitTest
(
const
wxPoint
&
aPosRef
);
EDA_Rect
GetBoundingBox
();
};
...
...
eeschema/classes_body_items.cpp
View file @
99408024
...
...
@@ -557,10 +557,10 @@ bool LibDrawPolyline::HitTest( wxPoint aPosRef, int aThreshold, const int aTrans
{
wxPoint
ref
,
start
,
end
;
for
(
unsigned
ii
=
0
;
ii
<
m_PolyPoints
.
size
()
-
1
;
ii
++
)
for
(
unsigned
ii
=
1
;
ii
<
GetCornerCount
()
;
ii
++
)
{
start
=
TransformCoordinate
(
aTransMat
,
m_PolyPoints
[
0
]
);
end
=
TransformCoordinate
(
aTransMat
,
m_PolyPoints
[
1
]
);
start
=
TransformCoordinate
(
aTransMat
,
m_PolyPoints
[
ii
-
1
]
);
end
=
TransformCoordinate
(
aTransMat
,
m_PolyPoints
[
ii
]
);
ref
=
aPosRef
-
start
;
end
-=
start
;
...
...
@@ -584,14 +584,15 @@ EDA_Rect LibDrawPolyline::GetBoundaryBox()
ymin
=
ymax
=
m_PolyPoints
[
0
].
y
;
for
(
unsigned
ii
=
1
;
ii
<
GetCornerCount
();
ii
++
)
{
xmin
=
MIN
(
xmin
,
m_PolyPoints
[
0
].
x
);
xmax
=
MAX
(
xmax
,
m_PolyPoints
[
0
].
x
);
ymin
=
MIN
(
ymin
,
m_PolyPoints
[
0
].
y
);
ymax
=
MAX
(
ymax
,
m_PolyPoints
[
0
].
y
);
xmin
=
MIN
(
xmin
,
m_PolyPoints
[
ii
-
1
].
x
);
xmax
=
MAX
(
xmax
,
m_PolyPoints
[
ii
-
1
].
x
);
ymin
=
MIN
(
ymin
,
m_PolyPoints
[
ii
].
y
);
ymax
=
MAX
(
ymax
,
m_PolyPoints
[
ii
].
y
);
}
BoundaryBox
.
SetX
(
xmin
);
BoundaryBox
.
SetWidth
(
xmax
-
xmin
);
BoundaryBox
.
SetY
(
ymin
);
BoundaryBox
.
SetHeight
(
ymax
-
ymin
);
BoundaryBox
.
Inflate
(
m_Width
,
m_Width
);
return
BoundaryBox
;
}
eeschema/component_class.cpp
View file @
99408024
...
...
@@ -353,7 +353,7 @@ EDA_Rect SCH_COMPONENT::GetBoundaryBox() const
int
y2
=
m_Transform
[
1
][
0
]
*
xm
+
m_Transform
[
1
][
1
]
*
ym
;
// H and W must be > 0
for wxRect
:
// H and W must be > 0:
if
(
x2
<
x1
)
EXCHG
(
x2
,
x1
);
if
(
y2
<
y1
)
...
...
eeschema/eeredraw.cpp
View file @
99408024
...
...
@@ -294,16 +294,6 @@ void DrawNoConnectStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint
}
EDA_Rect
DrawNoConnectStruct
::
GetBoundingBox
()
{
const
int
DELTA
=
(
DRAWNOCONNECT_SIZE
/
2
);
EDA_Rect
box
(
wxPoint
(
m_Pos
.
x
-
DELTA
,
m_Pos
.
y
-
DELTA
),
wxSize
(
2
*
DELTA
,
2
*
DELTA
)
);
box
.
Normalize
();
return
box
;
}
/**************************************************************/
void
DrawBusEntryStruct
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
DrawMode
,
int
Color
)
...
...
@@ -329,16 +319,6 @@ void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint&
}
EDA_Rect
DrawBusEntryStruct
::
GetBoundingBox
()
{
int
dx
=
m_Pos
.
x
-
m_End
().
x
;
int
dy
=
m_Pos
.
y
-
m_End
().
y
;
EDA_Rect
box
(
wxPoint
(
m_Pos
.
x
,
m_Pos
.
y
),
wxSize
(
dx
,
dy
)
);
box
.
Normalize
();
return
box
;
}
/*****************************************************************************
* Routine to redraw polyline struct. *
...
...
@@ -411,7 +391,6 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
* Utilisee dans les deplacements de blocs
*/
{
int
Width
;
int
DrawMode
=
g_XorMode
;
int
width
=
g_DrawMinimunLineWidth
;
...
...
@@ -477,15 +456,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
{
DrawJunctionStruct
*
Struct
;
Struct
=
(
DrawJunctionStruct
*
)
DrawStruct
;
Width
=
DRAWJUNCTION_SIZE
;
GRFilledRect
(
&
panel
->
m_ClipBox
,
DC
,
Struct
->
m_Pos
.
x
-
Width
+
dx
,
Struct
->
m_Pos
.
y
-
Width
+
dy
,
Struct
->
m_Pos
.
x
+
Width
+
dx
,
Struct
->
m_Pos
.
y
+
Width
+
dy
,
g_GhostColor
,
g_GhostColor
);
Struct
->
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
DrawMode
,
g_GhostColor
);
break
;
}
...
...
eeschema/locate.cpp
View file @
99408024
This diff is collapsed.
Click to expand it.
eeschema/onleftclick.cpp
View file @
99408024
...
...
@@ -324,11 +324,12 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
void
WinEDA_SchematicFrame
::
OnLeftDClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
)
/***************************************************************************/
/* Appel� sur un double click:
* pour un �l�ment editable (textes, composant):
* appel de l'editeur correspondant.
* pour une connexion en cours:
* termine la connexion
/** Function OnLeftDClick
* called on a double click event from the drawpanel mouse handler
* if an editable item is found (text, component)
* Call the suitable dialog editor.
* Id a creat command is in progress:
* validate and finish the command
*/
{
EDA_BaseStruct
*
DrawStruct
=
GetScreen
()
->
GetCurItem
();
...
...
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