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
da9fc844
Commit
da9fc844
authored
Feb 17, 2015
by
Tomasz Włostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved module locking: lock pads only/lock whole module mode added
parent
5d78a007
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
16 deletions
+55
-16
class_module.cpp
pcbnew/class_module.cpp
+21
-7
class_module.h
pcbnew/class_module.h
+18
-0
class_pad.cpp
pcbnew/class_pad.cpp
+0
-1
dialog_edit_module_for_BoardEditor.cpp
pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp
+12
-4
dialog_edit_module_for_BoardEditor_base.cpp
pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.cpp
+2
-2
dialog_edit_module_for_BoardEditor_base.fbp
pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.fbp
+2
-2
No files found.
pcbnew/class_module.cpp
View file @
da9fc844
...
...
@@ -57,7 +57,7 @@ MODULE::MODULE( BOARD* parent ) :
m_Attributs
=
MOD_DEFAULT
;
m_Layer
=
F_Cu
;
m_Orient
=
0
;
m_ModuleStatus
=
0
;
m_ModuleStatus
=
MODULE_PADS_LOCKED
;
flag
=
0
;
m_CntRot90
=
m_CntRot180
=
0
;
m_Surface
=
0.0
;
...
...
@@ -815,6 +815,11 @@ void MODULE::RunOnChildren( boost::function<void (BOARD_ITEM*)> aFunction )
}
}
const
BOX2I
MODULE
::
ViewBBox
()
const
{
return
BOX2I
(
VECTOR2I
(
GetFootprintRect
().
GetOrigin
()
),
VECTOR2I
(
GetFootprintRect
().
GetSize
()
)
);
}
void
MODULE
::
ViewUpdate
(
int
aUpdateFlags
)
{
...
...
@@ -867,12 +872,6 @@ unsigned int MODULE::ViewGetLOD( int aLayer ) const
return
30
;
}
const
BOX2I
MODULE
::
ViewBBox
()
const
{
EDA_RECT
fpRect
=
GetFootprintRect
();
return
BOX2I
(
VECTOR2I
(
fpRect
.
GetOrigin
()
),
VECTOR2I
(
fpRect
.
GetSize
()
)
);
}
/* Test for validity of the name in a library of the footprint
* ( no spaces, dir separators ... )
...
...
@@ -1116,3 +1115,18 @@ void MODULE::SetOrientation( double newangle )
CalculateBoundingBox
();
}
double
MODULE
::
PadCoverageRatio
()
const
{
double
padArea
=
0.0
;
double
moduleArea
=
GetFootprintRect
().
GetArea
();
for
(
D_PAD
*
pad
=
m_Pads
;
pad
;
pad
=
pad
->
Next
()
)
padArea
+=
pad
->
GetBoundingBox
().
GetArea
();
if
(
moduleArea
==
0.0
)
return
1.0
;
double
ratio
=
padArea
/
moduleArea
;
return
std
::
min
(
ratio
,
1.0
);
}
pcbnew/class_module.h
View file @
da9fc844
...
...
@@ -223,6 +223,7 @@ public:
#define MODULE_is_LOCKED 0x01 ///< module LOCKED: no autoplace allowed
#define MODULE_is_PLACED 0x02 ///< In autoplace: module automatically placed
#define MODULE_to_PLACE 0x04 ///< In autoplace: module waiting for autoplace
#define MODULE_PADS_LOCKED 0x08 ///< In autoplace: module waiting for autoplace
bool
IsLocked
()
const
...
...
@@ -261,6 +262,15 @@ public:
m_ModuleStatus
&=
~
MODULE_to_PLACE
;
}
bool
PadsLocked
()
const
{
return
(
m_ModuleStatus
&
MODULE_PADS_LOCKED
);
}
void
SetPadsLocked
(
bool
aPadsLocked
)
{
if
(
aPadsLocked
)
m_ModuleStatus
|=
MODULE_PADS_LOCKED
;
else
m_ModuleStatus
&=
~
MODULE_PADS_LOCKED
;
}
void
SetLastEditTime
(
time_t
aTime
)
{
m_LastEditTime
=
aTime
;
}
void
SetLastEditTime
(
)
{
m_LastEditTime
=
time
(
NULL
);
}
time_t
GetLastEditTime
()
const
{
return
m_LastEditTime
;
}
...
...
@@ -559,6 +569,14 @@ public:
m_initial_comments
=
aInitialComments
;
}
/**
* Function PadCoverageRatio
* Calculates the ratio of total area of the footprint pads to the area of the
* footprint. Used by selection tool heuristics.
* @return the ratio
*/
double
PadCoverageRatio
()
const
;
/// Return the initial comments block or NULL if none, without transfer of ownership.
const
wxArrayString
*
GetInitialComments
()
const
{
return
m_initial_comments
;
}
...
...
pcbnew/class_pad.cpp
View file @
da9fc844
...
...
@@ -177,7 +177,6 @@ const EDA_RECT D_PAD::GetBoundingBox() const
area
.
SetOrigin
(
m_Pos
.
x
-
dx
,
m_Pos
.
y
-
dy
);
area
.
SetSize
(
2
*
dx
,
2
*
dy
);
break
;
break
;
case
PAD_RECT
:
//Use two corners and track their rotation
...
...
pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp
View file @
da9fc844
...
...
@@ -313,12 +313,19 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
break
;
}
m_AutoPlaceCtrl
->
SetSelection
(
(
m_CurrentModule
->
IsLocked
())
?
1
:
0
);
if
(
m_CurrentModule
->
IsLocked
()
)
m_AutoPlaceCtrl
->
SetSelection
(
2
);
else
if
(
m_CurrentModule
->
PadsLocked
()
)
m_AutoPlaceCtrl
->
SetSelection
(
1
);
else
m_AutoPlaceCtrl
->
SetSelection
(
0
);
m_AutoPlaceCtrl
->
SetItemToolTip
(
0
,
_
(
"
Enable hotkey move commands and Auto Placement
"
)
);
_
(
"
Component can be freely moved and auto placed. User can arbitrarily select and edit component's pads.
"
)
);
m_AutoPlaceCtrl
->
SetItemToolTip
(
1
,
_
(
"Disable hotkey move commands and Auto Placement"
)
);
_
(
"Component can be freely moved and auto placed, but its pads cannot be selected or edited."
)
);
m_AutoPlaceCtrl
->
SetItemToolTip
(
2
,
_
(
"Component is locked: it cannot be freely moved or auto placed."
)
);
m_CostRot90Ctrl
->
SetValue
(
m_CurrentModule
->
GetPlacementCost90
()
);
...
...
@@ -583,7 +590,8 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
modpos
.
x
=
ValueFromTextCtrl
(
*
m_ModPositionX
);
modpos
.
y
=
ValueFromTextCtrl
(
*
m_ModPositionY
);
m_CurrentModule
->
SetPosition
(
modpos
);
m_CurrentModule
->
SetLocked
(
m_AutoPlaceCtrl
->
GetSelection
()
==
1
);
m_CurrentModule
->
SetLocked
(
m_AutoPlaceCtrl
->
GetSelection
()
==
2
);
m_CurrentModule
->
SetPadsLocked
(
m_AutoPlaceCtrl
->
GetSelection
()
==
1
);
switch
(
m_AttributsCtrl
->
GetSelection
()
)
{
...
...
pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.cpp
View file @
da9fc844
...
...
@@ -143,10 +143,10 @@ DIALOG_MODULE_BOARD_EDITOR_BASE::DIALOG_MODULE_BOARD_EDITOR_BASE( wxWindow* pare
m_AttributsCtrl
->
SetSelection
(
0
);
bSizerAttrib
->
Add
(
m_AttributsCtrl
,
1
,
wxALL
|
wxEXPAND
,
5
);
wxString
m_AutoPlaceCtrlChoices
[]
=
{
_
(
"Free"
),
_
(
"Lock
ed
"
)
};
wxString
m_AutoPlaceCtrlChoices
[]
=
{
_
(
"Free"
),
_
(
"Lock
pads"
),
_
(
"Lock module
"
)
};
int
m_AutoPlaceCtrlNChoices
=
sizeof
(
m_AutoPlaceCtrlChoices
)
/
sizeof
(
wxString
);
m_AutoPlaceCtrl
=
new
wxRadioBox
(
m_PanelProperties
,
wxID_ANY
,
_
(
"Move and Place"
),
wxDefaultPosition
,
wxDefaultSize
,
m_AutoPlaceCtrlNChoices
,
m_AutoPlaceCtrlChoices
,
1
,
wxRA_SPECIFY_COLS
);
m_AutoPlaceCtrl
->
SetSelection
(
0
);
m_AutoPlaceCtrl
->
SetSelection
(
1
);
bSizerAttrib
->
Add
(
m_AutoPlaceCtrl
,
1
,
wxALL
|
wxEXPAND
,
5
);
...
...
pcbnew/dialogs/dialog_edit_module_for_BoardEditor_base.fbp
View file @
da9fc844
...
...
@@ -2260,7 +2260,7 @@
<property
name=
"caption"
></property>
<property
name=
"caption_visible"
>
1
</property>
<property
name=
"center_pane"
>
0
</property>
<property
name=
"choices"
>
"
Free
"
"
Lock
ed
"
</property>
<property
name=
"choices"
>
"
Free
"
"
Lock
pads
"
"
Lock module
"
</property>
<property
name=
"close_button"
>
1
</property>
<property
name=
"context_help"
></property>
<property
name=
"context_menu"
>
1
</property>
...
...
@@ -2292,7 +2292,7 @@
<property
name=
"pin_button"
>
1
</property>
<property
name=
"pos"
></property>
<property
name=
"resize"
>
Resizable
</property>
<property
name=
"selection"
>
0
</property>
<property
name=
"selection"
>
1
</property>
<property
name=
"show"
>
1
</property>
<property
name=
"size"
></property>
<property
name=
"style"
>
wxRA_SPECIFY_COLS
</property>
...
...
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