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
f0cd1476
Commit
f0cd1476
authored
Oct 27, 2007
by
CHARRAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcbnew: use collector class to locate items in modedit, the footprint editor (thanks, Dick).
parent
5fc79254
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
318 additions
and
212 deletions
+318
-212
change_log.txt
change_log.txt
+4
-0
wxstruct.h
include/wxstruct.h
+1
-1
kicad.mo
internat/fr/kicad.mo
+0
-0
kicad.po
internat/fr/kicad.po
+149
-151
basepcbframe.cpp
pcbnew/basepcbframe.cpp
+3
-1
clean.cpp
pcbnew/clean.cpp
+52
-50
collectors.cpp
pcbnew/collectors.cpp
+8
-0
collectors.h
pcbnew/collectors.h
+5
-0
modedit.cpp
pcbnew/modedit.cpp
+91
-9
modedit_onclick.cpp
pcbnew/modedit_onclick.cpp
+2
-0
moduleframe.cpp
pcbnew/moduleframe.cpp
+3
-0
No files found.
change_log.txt
View file @
f0cd1476
...
@@ -15,6 +15,10 @@ email address.
...
@@ -15,6 +15,10 @@ email address.
display frame
display frame
minor other changes
minor other changes
+ pcbnew:
Use collector class to locate items in modedit.
This is a big enhancement,
but a small work for me because Dick made all the work.
2007-Oct-26 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
2007-Oct-26 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
...
...
include/wxstruct.h
View file @
f0cd1476
...
@@ -942,7 +942,7 @@ public:
...
@@ -942,7 +942,7 @@ public:
virtual
void
HandleBlockPlace
(
wxDC
*
DC
);
virtual
void
HandleBlockPlace
(
wxDC
*
DC
);
virtual
int
HandleBlockEnd
(
wxDC
*
DC
);
virtual
int
HandleBlockEnd
(
wxDC
*
DC
);
BOARD_ITEM
*
ModeditLocateAndDisplay
();
BOARD_ITEM
*
ModeditLocateAndDisplay
(
int
aHotKeyCode
=
0
);
/* Undo and redo functions */
/* Undo and redo functions */
public
:
public
:
...
...
internat/fr/kicad.mo
View file @
f0cd1476
No preview for this file type
internat/fr/kicad.po
View file @
f0cd1476
This diff is collapsed.
Click to expand it.
pcbnew/basepcbframe.cpp
View file @
f0cd1476
...
@@ -69,6 +69,9 @@ WinEDA_BasePcbFrame::~WinEDA_BasePcbFrame( void )
...
@@ -69,6 +69,9 @@ WinEDA_BasePcbFrame::~WinEDA_BasePcbFrame( void )
/**************************************/
/**************************************/
int
WinEDA_BasePcbFrame
::
BestZoom
(
void
)
int
WinEDA_BasePcbFrame
::
BestZoom
(
void
)
/**************************************/
/**************************************/
/**
* Return the "best" zoom, i.e. the zoom which shows the entire borad on screen
*/
{
{
int
dx
,
dy
,
ii
,
jj
;
int
dx
,
dy
,
ii
,
jj
;
int
bestzoom
;
int
bestzoom
;
...
@@ -79,7 +82,6 @@ int WinEDA_BasePcbFrame::BestZoom( void )
...
@@ -79,7 +82,6 @@ int WinEDA_BasePcbFrame::BestZoom( void )
m_Pcb
->
ComputeBoundaryBox
();
m_Pcb
->
ComputeBoundaryBox
();
/* calcul du zoom montrant tout le dessim */
dx
=
m_Pcb
->
m_BoundaryBox
.
GetWidth
();
dx
=
m_Pcb
->
m_BoundaryBox
.
GetWidth
();
dy
=
m_Pcb
->
m_BoundaryBox
.
GetHeight
();
dy
=
m_Pcb
->
m_BoundaryBox
.
GetHeight
();
...
...
pcbnew/clean.cpp
View file @
f0cd1476
This diff is collapsed.
Click to expand it.
pcbnew/collectors.cpp
View file @
f0cd1476
...
@@ -92,6 +92,14 @@ const KICAD_T GENERAL_COLLECTOR::PadsOrModules[] = {
...
@@ -92,6 +92,14 @@ const KICAD_T GENERAL_COLLECTOR::PadsOrModules[] = {
EOT
EOT
};
};
const
KICAD_T
GENERAL_COLLECTOR
::
ModulesAndTheirItems
[]
=
{
TYPETEXTEMODULE
,
TYPEEDGEMODULE
,
TYPEPAD
,
TYPEMODULE
,
EOT
};
const
KICAD_T
GENERAL_COLLECTOR
::
Tracks
[]
=
{
const
KICAD_T
GENERAL_COLLECTOR
::
Tracks
[]
=
{
TYPETRACK
,
TYPETRACK
,
...
...
pcbnew/collectors.h
View file @
f0cd1476
...
@@ -226,6 +226,11 @@ public:
...
@@ -226,6 +226,11 @@ public:
*/
*/
static
const
KICAD_T
PadsOrModules
[];
static
const
KICAD_T
PadsOrModules
[];
/**
* A scan list for MODULEs and their items (for Modedit)
*/
static
const
KICAD_T
ModulesAndTheirItems
[];
/**
/**
* A scan list for only TRACKS
* A scan list for only TRACKS
...
...
pcbnew/modedit.cpp
View file @
f0cd1476
...
@@ -17,29 +17,111 @@
...
@@ -17,29 +17,111 @@
#include "protos.h"
#include "protos.h"
#include "id.h"
#include "id.h"
#include "collectors.h"
/*********************************************************************/
/*********************************************************************
*******
/
BOARD_ITEM
*
WinEDA_ModuleEditFrame
::
ModeditLocateAndDisplay
()
BOARD_ITEM
*
WinEDA_ModuleEditFrame
::
ModeditLocateAndDisplay
(
int
aHotKeyCode
)
/*********************************************************************/
/*********************************************************************
*******
/
{
{
BOARD_ITEM
*
DrawStruct
=
GetCurItem
();
BOARD_ITEM
*
item
=
GetCurItem
();
MODULE
*
Module
=
m_Pcb
->
m_Modules
;
MODULE
*
Module
=
m_Pcb
->
m_Modules
;
if
(
Module
==
NULL
)
if
(
Module
==
NULL
)
return
NULL
;
return
NULL
;
DrawStruct
=
Locate_Edge_Module
(
Module
,
CURSEUR_OFF_GRILLE
);
GENERAL_COLLECTORS_GUIDE
guide
=
GetCollectorsGuide
();
if
(
DrawStruct
)
// Assign to scanList the proper item types desired based on tool type
// or hotkey that is in play.
const
KICAD_T
*
scanList
=
NULL
;
if
(
aHotKeyCode
)
{
{
DrawStruct
->
Display_Infos
(
this
);
// @todo: add switch here and add calls to PcbGeneralLocateAndDisplay( int aHotKeyCode )
// when searching is needed from a hotkey handler
}
}
else
else
DrawStruct
=
Locate
(
CURSEUR_OFF_GRILLE
,
-
1
);
{
scanList
=
GENERAL_COLLECTOR
::
ModulesAndTheirItems
;
}
m_Collector
->
Collect
(
m_Pcb
,
scanList
,
GetScreen
()
->
RefPos
(
true
),
guide
);
return
DrawStruct
;
/* Remove redundancies: when an item is found, we can remove the
* module from list
*/
if
(
m_Collector
->
GetCount
()
>
1
)
{
for
(
int
ii
=
0
;
ii
<
m_Collector
->
GetCount
();
ii
++
)
{
item
=
(
*
m_Collector
)[
ii
];
if
(
item
->
Type
()
!=
TYPEMODULE
)
continue
;
m_Collector
->
Remove
(
ii
);
ii
--
;
}
}
if
(
m_Collector
->
GetCount
()
<=
1
)
{
item
=
(
*
m_Collector
)[
0
];
SetCurItem
(
item
);
}
else
// we can't figure out which item user wants, do popup menu so user can choose
{
wxMenu
itemMenu
;
/* Give a title to the selection menu. This is also a cancel menu item */
wxMenuItem
*
item_title
=
new
wxMenuItem
(
&
itemMenu
,
-
1
,
_
(
"Selection Clarification"
)
);
#ifdef __WINDOWS__
wxFont
bold_font
(
*
wxNORMAL_FONT
);
bold_font
.
SetWeight
(
wxFONTWEIGHT_BOLD
);
bold_font
.
SetStyle
(
wxFONTSTYLE_ITALIC
);
item_title
->
SetFont
(
bold_font
);
#endif
itemMenu
.
Append
(
item_title
);
itemMenu
.
AppendSeparator
();
int
limit
=
MIN
(
MAX_ITEMS_IN_PICKER
,
m_Collector
->
GetCount
()
);
for
(
int
ii
=
0
;
ii
<
limit
;
++
ii
)
{
wxString
text
;
const
char
**
xpm
;
item
=
(
*
m_Collector
)[
ii
];
text
=
item
->
MenuText
(
m_Pcb
);
xpm
=
item
->
MenuIcon
();
ADD_MENUITEM
(
&
itemMenu
,
ID_POPUP_PCB_ITEM_SELECTION_START
+
ii
,
text
,
xpm
);
}
// this menu's handler is void WinEDA_BasePcbFrame::ProcessItemSelection()
// and it calls SetCurItem() which in turn calls Display_Infos() on the item.
DrawPanel
->
m_AbortRequest
=
true
;
// changed in false if an item
PopupMenu
(
&
itemMenu
);
// m_AbortRequest = false if an item is selected
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
m_IgnoreMouseEvents
=
FALSE
;
// The function ProcessItemSelection() has set the current item, return it.
item
=
GetCurItem
();
}
if
(
item
)
{
item
->
Display_Infos
(
this
);
}
return
item
;
}
}
/****************************************************************************/
/****************************************************************************/
void
WinEDA_ModuleEditFrame
::
Process_Special_Functions
(
wxCommandEvent
&
event
)
void
WinEDA_ModuleEditFrame
::
Process_Special_Functions
(
wxCommandEvent
&
event
)
/****************************************************************************/
/****************************************************************************/
...
...
pcbnew/modedit_onclick.cpp
View file @
f0cd1476
...
@@ -74,6 +74,8 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -74,6 +74,8 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct
=
GetCurItem
();
DrawStruct
=
GetCurItem
();
if
(
!
DrawStruct
||
(
DrawStruct
->
m_Flags
==
0
)
)
if
(
!
DrawStruct
||
(
DrawStruct
->
m_Flags
==
0
)
)
{
{
if
(
!
wxGetKeyState
(
WXK_SHIFT
)
&&
!
wxGetKeyState
(
WXK_ALT
)
&&
!
wxGetKeyState
(
WXK_CONTROL
)
)
DrawStruct
=
ModeditLocateAndDisplay
();
DrawStruct
=
ModeditLocateAndDisplay
();
SetCurItem
(
DrawStruct
);
SetCurItem
(
DrawStruct
);
}
}
...
...
pcbnew/moduleframe.cpp
View file @
f0cd1476
...
@@ -19,6 +19,9 @@
...
@@ -19,6 +19,9 @@
/* class WinEDA_ModuleEditFrame */
/* class WinEDA_ModuleEditFrame */
/********************************/
/********************************/
BEGIN_EVENT_TABLE
(
WinEDA_ModuleEditFrame
,
wxFrame
)
BEGIN_EVENT_TABLE
(
WinEDA_ModuleEditFrame
,
wxFrame
)
COMMON_EVENTS_DRAWFRAME
EVT_MENU_RANGE
(
ID_POPUP_PCB_ITEM_SELECTION_START
,
ID_POPUP_PCB_ITEM_SELECTION_END
,
WinEDA_BasePcbFrame
::
ProcessItemSelection
)
COMMON_EVENTS_DRAWFRAME
EVT_CLOSE
(
WinEDA_ModuleEditFrame
::
OnCloseWindow
)
COMMON_EVENTS_DRAWFRAME
EVT_CLOSE
(
WinEDA_ModuleEditFrame
::
OnCloseWindow
)
EVT_SIZE
(
WinEDA_ModuleEditFrame
::
OnSize
)
EVT_SIZE
(
WinEDA_ModuleEditFrame
::
OnSize
)
...
...
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