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
df754ad5
Commit
df754ad5
authored
Sep 14, 2007
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AllAreModulesAndReturnSmallestIfSo()
parent
bfa36f31
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
1 deletion
+57
-1
change_log.txt
change_log.txt
+8
-0
makefile.gtk
makefile.gtk
+1
-1
controle.cpp
pcbnew/controle.cpp
+48
-0
No files found.
change_log.txt
View file @
df754ad5
...
@@ -4,6 +4,14 @@ Started 2007-June-11
...
@@ -4,6 +4,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.
2007-Sep-14 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew
* controle.cpp, added Function AllAreModulesAndReturnSmallestIfSo() which is
called from PcbGeneralLocateAndDisplay()
2007-Sep-13 UPDATE Dick Hollenbeck <dick@softplc.com>
2007-Sep-13 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
================================================================================
+ kicad
+ kicad
...
...
makefile.gtk
View file @
df754ad5
MAKEGTK
=
$(MAKE)
-f
makefile.gtk
MAKEGTK
=
$(MAKE)
-f
makefile.gtk
KICAD_SUBDIRS
=
common 3d-viewer pcbnew eeschema eeschema/plugins cvpcb kicad gerbview
KICAD_SUBDIRS
=
common 3d-viewer pcbnew
#
eeschema eeschema/plugins cvpcb kicad gerbview
KICAD_SUBDIRS_BIN
=
eeschema eeschema/plugins pcbnew cvpcb kicad gerbview
KICAD_SUBDIRS_BIN
=
eeschema eeschema/plugins pcbnew cvpcb kicad gerbview
KICAD_SUBDIRS_RES
=
internat modules template library
KICAD_SUBDIRS_RES
=
internat modules template library
KICAD_SUBDIRS_HELP
=
help
KICAD_SUBDIRS_HELP
=
help
...
...
pcbnew/controle.cpp
View file @
df754ad5
...
@@ -286,6 +286,47 @@ const char** BOARD_ITEM::MenuIcon() const
...
@@ -286,6 +286,47 @@ const char** BOARD_ITEM::MenuIcon() const
}
}
/**
* Function AllAreModulesAndReturnSmallestIfSo
* tests that all items in the collection are MODULEs and if so, returns the
* smallest MODULE.
* @return BOARD_ITEM* - The smallest or NULL.
*/
static
BOARD_ITEM
*
AllAreModulesAndReturnSmallestIfSo
(
GENERAL_COLLECTOR
*
aCollector
)
{
int
count
=
aCollector
->
GetCount
();
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
if
(
(
*
aCollector
)[
i
]
->
Type
()
!=
TYPEMODULE
)
return
NULL
;
}
// all are modules, now find smallest MODULE
int
minDim
=
0x7FFFFFFF
;
int
minNdx
=
0
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
MODULE
*
module
=
(
MODULE
*
)
(
*
aCollector
)[
i
];
int
lx
=
module
->
m_BoundaryBox
.
GetWidth
();
int
ly
=
module
->
m_BoundaryBox
.
GetHeight
();
int
lmin
=
MIN
(
lx
,
ly
);
if
(
lmin
<=
minDim
)
{
minDim
=
lmin
;
minNdx
=
i
;
}
}
return
(
*
aCollector
)[
minNdx
];
}
/***********************************************************************/
/***********************************************************************/
BOARD_ITEM
*
WinEDA_BasePcbFrame
::
PcbGeneralLocateAndDisplay
()
BOARD_ITEM
*
WinEDA_BasePcbFrame
::
PcbGeneralLocateAndDisplay
()
...
@@ -355,6 +396,13 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
...
@@ -355,6 +396,13 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
item
=
(
*
m_Collector
)[
0
];
item
=
(
*
m_Collector
)[
0
];
SetCurItem
(
item
);
SetCurItem
(
item
);
}
}
// if all are modules, find the smallest one amoung the primary choices
else
if
(
(
item
=
AllAreModulesAndReturnSmallestIfSo
(
m_Collector
)
)
!=
NULL
)
{
SetCurItem
(
item
);
}
else
// show a popup menu
else
// show a popup menu
{
{
wxMenu
itemMenu
;
wxMenu
itemMenu
;
...
...
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