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
fb54ab86
Commit
fb54ab86
authored
Mar 13, 2008
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dirty rect used in footprint start move, rotation, flip and delete.
parent
8e5665c2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
125 additions
and
26 deletions
+125
-26
change_log.txt
change_log.txt
+6
-0
base_struct.h
include/base_struct.h
+1
-1
class_module.cpp
pcbnew/class_module.cpp
+65
-14
class_text_mod.cpp
pcbnew/class_text_mod.cpp
+28
-2
class_text_mod.h
pcbnew/class_text_mod.h
+5
-0
dialog_edit_module.cpp
pcbnew/dialog_edit_module.cpp
+0
-3
modules.cpp
pcbnew/modules.cpp
+20
-6
No files found.
change_log.txt
View file @
fb54ab86
...
...
@@ -5,6 +5,12 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Mar-13 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew
Dirty rect used in footprint rotation, flip and delete.
Better calculation of the footprint dirty rect.
2008-Mar-13 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
...
...
include/base_struct.h
View file @
fb54ab86
...
...
@@ -167,7 +167,7 @@ public:
#define STRUCT_DELETED (1 << 13) ///< Bit flag de Status pour structures effacee
#define CANDIDATE (1 << 14) ///< flag indiquant que la structure est connectee
#define SKIP_STRUCT (1 << 15) ///< flag indiquant que la structure ne doit pas etre traitee
#define DO_NOT_DRAW (1 << 16) ///< Used to disable draw function
unsigned
long
m_TimeStamp
;
// Time stamp used for logical links
int
m_Selected
;
/* Used by block commands, and selective editing */
...
...
pcbnew/class_module.cpp
View file @
fb54ab86
...
...
@@ -267,20 +267,22 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const
wxPoint
&
offset
,
int
draw_mode
)
/**********************************************************/
/* Dessin d'une empreinte sur l'ecran actif:
* Entree :
* Module: pointeur sur le module
* ox, oy = offset de trace
* draw_mode = mode de trace ( GR_OR, GR_XOR, GR_AND)
* Utilise par ailleur:
* Description des parametres de l'empreinte calcules par caract() ;
/** Function Draw
* Draws the footprint to the current Device Context
* @param panel = The active Draw Panel (used to know the clip box)
* @param DC = current Device Context
* @param offset = draw offset (usually wxPoint(0,0)
* @param draw_mode = GR_OR, GR_XOR, GR_AND
*/
{
D_PAD
*
pt_pad
;
EDA_BaseStruct
*
PtStruct
;
TEXTE_MODULE
*
PtTexte
;
if
(
(
m_Flags
&
DO_NOT_DRAW
)
)
return
;
/*
trace des pastille
s */
/*
Draw pad
s */
pt_pad
=
m_Pads
;
for
(
;
pt_pad
!=
NULL
;
pt_pad
=
(
D_PAD
*
)
pt_pad
->
Pnext
)
{
...
...
@@ -289,10 +291,10 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
pt_pad
->
Draw
(
panel
,
DC
,
offset
,
draw_mode
);
}
/*
Impression de l'ancre du module
*/
/*
Draws foootprint anchor
*/
DrawAncre
(
panel
,
DC
,
offset
,
DIM_ANCRE_MODULE
,
draw_mode
);
/*
impression des graphisme
s */
/*
Draw graphic item
s */
if
(
!
(
m_Reference
->
m_Flags
&
IS_MOVED
)
)
m_Reference
->
Draw
(
panel
,
DC
,
offset
,
draw_mode
);
if
(
!
(
m_Value
->
m_Flags
&
IS_MOVED
)
)
...
...
@@ -326,10 +328,17 @@ void MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
void
MODULE
::
DrawEdgesOnly
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
)
/**************************************************************/
/** Function DrawEdgesOnly
* Draws the footprint edges only to the current Device Context
* @param panel = The active Draw Panel (used to know the clip box)
* @param DC = current Device Context
* @param offset = draw offset (usually wxPoint(0,0)
* @param draw_mode = GR_OR, GR_XOR, GR_AND
*/
{
EDA_BaseStruct
*
PtStruct
;
/*
impression des graphisme
s */
/*
Draw graphic item
s */
PtStruct
=
m_Drawings
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
{
...
...
@@ -1041,13 +1050,55 @@ void MODULE::SetRectangleExinscrit()
/**
* Function GetBoundingBox
* returns the bounding box of this Footprint
* returns the full bounding box of this Footprint, including texts
*/
EDA_Rect
MODULE
::
GetBoundingBox
()
{
// Calculate area without text fielsd:
SetRectangleExinscrit
();
return
m_RealBoundaryBox
;
EDA_Rect
area
=
m_RealBoundaryBox
;
area
.
Normalize
();
// Calculate extended area including text field:
EDGE_MODULE
*
EdgeMod
=
(
EDGE_MODULE
*
)
m_Drawings
;
TEXTE_MODULE
*
text
;
EDA_Rect
text_area
;
wxPoint
textstart
,
textend
;
wxPoint
modstart
=
area
.
GetOrigin
();
wxPoint
modend
=
area
.
GetEnd
();
for
(
int
ii
=
0
;
;
ii
++
)
{
if
(
ii
==
0
)
text
=
m_Reference
;
else
if
(
ii
==
1
)
text
=
m_Value
;
else
{
if
(
EdgeMod
==
NULL
)
break
;
text
=
(
TEXTE_MODULE
*
)
EdgeMod
;
EdgeMod
=
(
EDGE_MODULE
*
)
EdgeMod
->
Pnext
;
if
(
text
->
Type
()
!=
TYPETEXTEMODULE
)
continue
;
}
text_area
=
text
->
GetTextRect
();
textstart
=
text_area
.
GetOrigin
();
textend
=
text_area
.
GetEnd
();
int
angle
=
text
->
GetDrawRotation
();
RotatePoint
(
&
textstart
,
text
->
m_Pos
,
angle
);
RotatePoint
(
&
textend
,
text
->
m_Pos
,
angle
);
modstart
.
x
=
min
(
modstart
.
x
,
textstart
.
x
);
modstart
.
x
=
min
(
modstart
.
x
,
textend
.
x
);
modstart
.
y
=
min
(
modstart
.
y
,
textstart
.
y
);
modstart
.
y
=
min
(
modstart
.
y
,
textend
.
y
);
modend
.
x
=
max
(
modend
.
x
,
textstart
.
x
);
modend
.
x
=
max
(
modend
.
x
,
textend
.
x
);
modend
.
y
=
max
(
modend
.
y
,
textstart
.
y
);
modend
.
y
=
max
(
modend
.
y
,
textend
.
y
);
}
area
.
SetOrigin
(
modstart
);
area
.
SetEnd
(
modend
);
return
area
;
}
/*******************************************************/
...
...
pcbnew/class_text_mod.cpp
View file @
fb54ab86
...
...
@@ -194,6 +194,31 @@ void TEXTE_MODULE:: SetLocalCoord()
/* locate functions */
/** Function GetTextRect
* @return an EDA_Rect which gives the position and size of the text area (for the O orient footprint)
*/
EDA_Rect
TEXTE_MODULE
::
GetTextRect
(
void
)
{
EDA_Rect
area
;
int
dx
,
dy
;
dx
=
(
m_Size
.
x
*
GetLength
()
)
/
2
;
dx
=
(
dx
*
10
)
/
9
;
/* letter size = 10/9 */
dx
+=
m_Width
/
2
;
dy
=
(
m_Size
.
y
+
m_Width
)
/
2
;
wxPoint
Org
=
m_Pos
;
// This is the position of the centre of the area
Org
.
x
-=
dx
;
Org
.
y
-=
dy
;
area
.
SetOrigin
(
Org
);
area
.
SetHeight
(
2
*
dy
);
area
.
SetWidth
(
2
*
dx
);
area
.
Normalize
();
return
area
;
}
bool
TEXTE_MODULE
::
HitTest
(
const
wxPoint
&
posref
)
{
int
mX
,
mY
,
dx
,
dy
;
...
...
@@ -204,8 +229,9 @@ bool TEXTE_MODULE::HitTest( const wxPoint& posref )
angle
+=
Module
->
m_Orient
;
dx
=
(
m_Size
.
x
*
GetLength
()
)
/
2
;
dy
=
m_Size
.
y
/
2
;
dx
=
(
(
dx
*
10
)
/
9
)
+
m_Width
;
/* Facteur de forme des lettres : 10/9 */
dx
=
(
dx
*
10
)
/
9
;
/* Facteur de forme des lettres : 10/9 */
dx
+=
m_Width
/
2
;
dy
=
(
m_Size
.
y
+
m_Width
)
/
2
;
/* le point de reference est tourn�de - angle
* pour se ramener a un rectangle de reference horizontal */
...
...
pcbnew/class_text_mod.h
View file @
fb54ab86
...
...
@@ -53,6 +53,11 @@ public:
int
GetLength
();
/* text length */
int
Pitch
();
/* retourne le pas entre 2 caracteres */
int
GetDrawRotation
();
// Return text rotation for drawings and plotting
/** Function GetTextRect
* @return an EDA_Rect which gives the position and size of the text area (for the O orient text and footprint)
*/
EDA_Rect
GetTextRect
(
void
);
void
SetDrawCoord
();
// mise a jour des coordonn�s absolues de trac�
// a partir des coord relatives
...
...
pcbnew/dialog_edit_module.cpp
View file @
fb54ab86
...
...
@@ -500,9 +500,6 @@ void WinEDA_ModulePropertiesFrame::OnOkClick( wxCommandEvent& event )
if
(
m_DC
)
m_Parent
->
DrawPanel
->
CursorOff
(
m_DC
);
if
(
m_DC
)
m_CurrentModule
->
Draw
(
m_Parent
->
DrawPanel
,
m_DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
if
(
m_OrientValue
)
{
long
orient
=
0
;
wxString
msg
=
m_OrientValue
->
GetValue
();
...
...
pcbnew/modules.cpp
View file @
fb54ab86
...
...
@@ -126,7 +126,13 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
DrawPanel
->
m_AutoPAN_Request
=
TRUE
;
// effacement module a l'ecran:
module
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
if
(
DC
)
{
int
tmp
=
module
->
m_Flags
;
module
->
m_Flags
|=
DO_NOT_DRAW
;
DrawPanel
->
PostDirtyRect
(
module
->
GetBoundingBox
()
);
module
->
m_Flags
=
tmp
;
}
// Reaffichage
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
...
...
@@ -250,8 +256,7 @@ void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
}
/* Redessine le module a la nouvelle place */
g_Offset_Module
.
x
=
module
->
m_Pos
.
x
-
panel
->
m_Parent
->
m_CurrentScreen
->
m_Curseur
.
x
;
g_Offset_Module
.
y
=
module
->
m_Pos
.
y
-
panel
->
m_Parent
->
m_CurrentScreen
->
m_Curseur
.
y
;
g_Offset_Module
=
module
->
m_Pos
-
panel
->
m_Parent
->
m_CurrentScreen
->
m_Curseur
;
DrawModuleOutlines
(
panel
,
DC
,
module
);
Dessine_Segments_Dragges
(
panel
,
DC
);
...
...
@@ -333,7 +338,7 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
* The mirroring is made from X axis
* if a footprint is not on copper or component layer it is not flipped
* (it could be on an adhesive layer, not supported at this time)
* @param Module the footprint to fli
^
p
* @param Module the footprint to flip
* @param DC Current Device Context. if NULL, no redraw
*/
{
...
...
@@ -353,7 +358,12 @@ void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
{
m_Status_Pcb
&=
~
(
LISTE_CHEVELU_OK
|
CONNEXION_OK
);
if
(
DC
&&
m_PcbFrame
)
Module
->
Draw
(
m_PcbFrame
->
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
{
int
tmp
=
Module
->
m_Flags
;
Module
->
m_Flags
|=
DO_NOT_DRAW
;
m_PcbFrame
->
DrawPanel
->
PostDirtyRect
(
Module
->
GetBoundingBox
()
);
Module
->
m_Flags
=
tmp
;
}
/* Effacement chevelu general si necessaire */
if
(
DC
&&
g_Show_Ratsnest
)
...
...
@@ -709,7 +719,11 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
{
if
(
DC
)
{
module
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
int
tmp
=
module
->
m_Flags
;
module
->
m_Flags
|=
DO_NOT_DRAW
;
DrawPanel
->
PostDirtyRect
(
module
->
GetBoundingBox
()
);
module
->
m_Flags
=
tmp
;
/* Reaffichage chevelu general si necessaire */
if
(
g_Show_Ratsnest
)
DrawGeneralRatsnest
(
DC
);
...
...
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