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
b0a52709
Commit
b0a52709
authored
Sep 28, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcbnew: apply zone patch, fixed very minor bugs
parent
8b3d5a69
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
41 deletions
+71
-41
automove.cpp
pcbnew/automove.cpp
+5
-3
edit.cpp
pcbnew/edit.cpp
+1
-0
onleftclick.cpp
pcbnew/onleftclick.cpp
+65
-38
No files found.
pcbnew/automove.cpp
View file @
b0a52709
...
...
@@ -57,6 +57,10 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
switch
(
id
)
// Arret eventuel de la commande de dplacement en cours
{
case
ID_TOOLBARH_PCB_AUTOPLACE
:
case
ID_TOOLBARH_PCB_AUTOROUTE
:
break
;
case
ID_POPUP_CANCEL_CURRENT_COMMAND
:
if
(
DrawPanel
->
ManageCurseur
&&
DrawPanel
->
ForceCloseManageCurseur
)
...
...
@@ -71,9 +75,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
{
DrawPanel
->
ForceCloseManageCurseur
(
DrawPanel
,
&
dc
);
}
m_ID_current_state
=
0
;
DisplayToolMsg
(
wxEmptyString
);
DrawPanel
->
SetCursor
(
wxCursor
(
wxCURSOR_ARROW
)
);
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
break
;
}
...
...
pcbnew/edit.cpp
View file @
b0a52709
...
...
@@ -55,6 +55,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_ON_ZOOM_SELECT
:
case
ID_PCB_USER_GRID_SETUP
:
case
ID_TOOLBARH_PCB_SELECT_LAYER
:
case
ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR
:
case
ID_POPUP_PCB_ROTATE_TEXTEPCB
:
case
ID_POPUP_PCB_EDIT_TEXTEPCB
:
case
ID_POPUP_PCB_EDIT_MIRE
:
...
...
pcbnew/onleftclick.cpp
View file @
b0a52709
...
...
@@ -14,7 +14,6 @@
#include "pcbnew_id.h"
/********************************************************************/
void
WinEDA_PcbFrame
::
OnLeftClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
)
/********************************************************************/
...
...
@@ -23,26 +22,26 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
*/
{
BOARD_ITEM
*
DrawStruct
=
GetCurItem
();
bool
exit
=
false
;
bool
exit
=
false
;
if
(
(
m_ID_current_state
==
0
)
||
(
DrawStruct
&&
DrawStruct
->
m_Flags
)
)
{
DrawPanel
->
m_AutoPAN_Request
=
false
;
if
(
DrawStruct
&&
DrawStruct
->
m_Flags
)
// "POPUP" in progress
{
DrawPanel
->
m_IgnoreMouseEvents
=
TRUE
;
DrawPanel
->
m_IgnoreMouseEvents
=
true
;
DrawPanel
->
CursorOff
(
DC
);
switch
(
DrawStruct
->
Type
()
)
{
case
TYPE_ZONE_CONTAINER
:
if
(
(
DrawStruct
->
m_Flags
&
IS_NEW
)
)
if
(
(
DrawStruct
->
m_Flags
&
IS_NEW
)
)
{
DrawPanel
->
m_AutoPAN_Request
=
true
;
Begin_Zone
(
DC
);
}
else
End_Move_Zone_Corner_Or_Outlines
(
DC
,
(
ZONE_CONTAINER
*
)
DrawStruct
);
End_Move_Zone_Corner_Or_Outlines
(
DC
,
(
ZONE_CONTAINER
*
)
DrawStruct
);
exit
=
true
;
break
;
...
...
@@ -92,7 +91,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if
(
m_ID_current_state
==
0
)
{
DisplayError
(
this
,
wxT
(
"WinEDA_PcbFrame::OnLeftClick() err: DrawType %d m_Flags != 0"
),
DrawStruct
->
Type
()
);
wxT
(
"WinEDA_PcbFrame::OnLeftClick() err: DrawType %d m_Flags != 0"
),
DrawStruct
->
Type
()
);
exit
=
true
;
}
break
;
...
...
@@ -100,11 +101,11 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawPanel
->
m_IgnoreMouseEvents
=
false
;
DrawPanel
->
CursorOn
(
DC
);
if
(
exit
)
return
;
if
(
exit
)
return
;
}
else
if
(
!
wxGetKeyState
(
WXK_SHIFT
)
&&
!
wxGetKeyState
(
WXK_ALT
)
&&
!
wxGetKeyState
(
WXK_CONTROL
)
)
else
if
(
!
wxGetKeyState
(
WXK_SHIFT
)
&&
!
wxGetKeyState
(
WXK_ALT
)
&&
!
wxGetKeyState
(
WXK_CONTROL
)
)
{
DrawStruct
=
PcbGeneralLocateAndDisplay
();
if
(
DrawStruct
)
...
...
@@ -130,18 +131,18 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break
;
case
ID_PCB_HIGHLIGHT_BUTT
:
{
int
netcode
=
Select_High_Light
(
DC
);
if
(
netcode
<
0
)
GetBoard
()
->
DisplayInfo
(
this
);
else
{
int
netcode
=
Select_High_Light
(
DC
);
if
(
netcode
<
0
)
GetBoard
()
->
DisplayInfo
(
this
);
else
{
NETINFO_ITEM
*
net
=
GetBoard
()
->
FindNet
(
netcode
);
if
(
net
)
net
->
DisplayInfo
(
this
);
}
NETINFO_ITEM
*
net
=
GetBoard
()
->
FindNet
(
netcode
);
if
(
net
)
net
->
DisplayInfo
(
this
);
}
break
;
}
break
;
case
ID_PCB_SHOW_1_RATSNEST_BUTT
:
DrawStruct
=
PcbGeneralLocateAndDisplay
();
...
...
@@ -175,7 +176,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if
(
m_ID_current_state
==
ID_PCB_ARC_BUTT
)
shape
=
S_ARC
;
if
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
<=
LAST_COPPER_LAYER
)
if
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
<=
LAST_COPPER_LAYER
)
{
DisplayError
(
this
,
_
(
"Graphic not authorized on Copper layers"
)
);
break
;
...
...
@@ -184,7 +185,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
DrawStruct
=
Begin_DrawSegment
(
NULL
,
shape
,
DC
);
SetCurItem
(
DrawStruct
);
DrawPanel
->
m_AutoPAN_Request
=
TRUE
;
DrawPanel
->
m_AutoPAN_Request
=
true
;
}
else
if
(
DrawStruct
&&
(
DrawStruct
->
Type
()
==
TYPE_DRAWSEGMENT
)
...
...
@@ -192,13 +193,13 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
DrawStruct
=
Begin_DrawSegment
(
(
DRAWSEGMENT
*
)
DrawStruct
,
shape
,
DC
);
SetCurItem
(
DrawStruct
);
DrawPanel
->
m_AutoPAN_Request
=
TRUE
;
DrawPanel
->
m_AutoPAN_Request
=
true
;
}
break
;
}
case
ID_TRACK_BUTT
:
if
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
>
LAST_COPPER_LAYER
)
if
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
>
LAST_COPPER_LAYER
)
{
DisplayError
(
this
,
_
(
"Tracks on Copper layers only "
)
);
break
;
...
...
@@ -209,22 +210,48 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct
=
Begin_Route
(
NULL
,
DC
);
SetCurItem
(
DrawStruct
);
if
(
DrawStruct
)
DrawPanel
->
m_AutoPAN_Request
=
TRUE
;
DrawPanel
->
m_AutoPAN_Request
=
true
;
}
else
if
(
DrawStruct
&&
(
DrawStruct
->
m_Flags
&
IS_NEW
)
)
{
TRACK
*
track
=
Begin_Route
(
(
TRACK
*
)
DrawStruct
,
DC
);
if
(
track
)
// c'est a dire si OK
SetCurItem
(
DrawStruct
=
track
);
DrawPanel
->
m_AutoPAN_Request
=
TRUE
;
DrawPanel
->
m_AutoPAN_Request
=
true
;
}
break
;
case
ID_PCB_ZONES_BUTT
:
/* ZONE Tool is selected. Determine action for a left click:
* this can be start a new zone or select and move an existing zone outline corner
* if found near the mouse cursor
*/
if
(
(
DrawStruct
==
NULL
)
||
(
DrawStruct
->
m_Flags
==
0
)
)
{
if
(
Begin_Zone
(
DC
)
)
// there is no current item, try to find something under mouse
DrawStruct
=
PcbGeneralLocateAndDisplay
();
bool
hit_on_corner
=
false
;
if
(
DrawStruct
&&
(
DrawStruct
->
Type
()
==
TYPE_ZONE_CONTAINER
)
)
{
// We have a hit under mouse (a zone outline corner or segment)
// test for a corner only because want to move corners only.
ZONE_CONTAINER
*
edge_zone
=
(
ZONE_CONTAINER
*
)
DrawStruct
;
if
(
edge_zone
->
HitTestForCorner
(
GetScreen
()
->
RefPos
(
true
)
)
>=
0
)
// corner located!
hit_on_corner
=
true
;
}
if
(
hit_on_corner
)
{
DrawPanel
->
MouseToCursorSchema
();
ZONE_CONTAINER
*
zone_cont
=
(
ZONE_CONTAINER
*
)
GetCurItem
();
DrawPanel
->
m_AutoPAN_Request
=
true
;
Start_Move_Zone_Corner
(
DC
,
zone_cont
,
zone_cont
->
m_CornerSelection
,
false
);
}
else
if
(
Begin_Zone
(
DC
)
)
{
DrawPanel
->
m_AutoPAN_Request
=
true
;
DrawStruct
=
GetBoard
()
->
m_CurrentZoneContour
;
...
...
@@ -234,14 +261,14 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
else
if
(
DrawStruct
&&
(
DrawStruct
->
Type
()
==
TYPE_ZONE_CONTAINER
)
&&
(
DrawStruct
->
m_Flags
&
IS_NEW
)
)
{
{
// Add a new corner to the current outline beeing created:
DrawPanel
->
m_AutoPAN_Request
=
true
;
Begin_Zone
(
DC
);
DrawStruct
=
GetBoard
()
->
m_CurrentZoneContour
;
GetScreen
()
->
SetCurItem
(
DrawStruct
);
}
else
DisplayError
(
this
,
wxT
(
"
Edit:
zone internal error"
)
);
DisplayError
(
this
,
wxT
(
"
WinEDA_PcbFrame::OnLeftClick()
zone internal error"
)
);
break
;
case
ID_PCB_ADD_TEXT_BUTT
:
...
...
@@ -249,7 +276,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
SetCurItem
(
Create_Texte_Pcb
(
DC
)
);
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
m_AutoPAN_Request
=
TRUE
;
DrawPanel
->
m_AutoPAN_Request
=
true
;
}
else
if
(
DrawStruct
->
Type
()
==
TYPE_TEXTE
)
{
...
...
@@ -279,7 +306,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break
;
case
ID_PCB_COTATION_BUTT
:
if
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
<=
LAST_COPPER_LAYER
)
if
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
<=
LAST_COPPER_LAYER
)
{
DisplayError
(
this
,
_
(
"Cotation not authorized on Copper layers"
)
);
break
;
...
...
@@ -288,7 +315,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
DrawStruct
=
Begin_Cotation
(
NULL
,
DC
);
SetCurItem
(
DrawStruct
);
DrawPanel
->
m_AutoPAN_Request
=
TRUE
;
DrawPanel
->
m_AutoPAN_Request
=
true
;
}
else
if
(
DrawStruct
&&
(
DrawStruct
->
Type
()
==
TYPE_COTATION
)
...
...
@@ -296,7 +323,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
DrawStruct
=
Begin_Cotation
(
(
COTATION
*
)
DrawStruct
,
DC
);
SetCurItem
(
DrawStruct
);
DrawPanel
->
m_AutoPAN_Request
=
TRUE
;
DrawPanel
->
m_AutoPAN_Request
=
true
;
}
else
DisplayError
(
this
,
wxT
(
"Internal err: Struct not COTATION"
)
);
...
...
@@ -337,9 +364,9 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/* handle the double click on the mouse left button
*/
{
BOARD_ITEM
*
DrawStruct
=
GetCurItem
();
wxPoint
pos
=
GetPosition
();
wxClientDC
dc
(
DrawPanel
);
BOARD_ITEM
*
DrawStruct
=
GetCurItem
();
wxPoint
pos
=
GetPosition
();
wxClientDC
dc
(
DrawPanel
);
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
...
...
@@ -405,7 +432,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break
;
case
TYPE_DRAWSEGMENT
:
InstallGraphicItemPropertiesDialog
(
(
DRAWSEGMENT
*
)
DrawStruct
,
&
dc
);
InstallGraphicItemPropertiesDialog
(
(
DRAWSEGMENT
*
)
DrawStruct
,
&
dc
);
break
;
case
TYPE_ZONE_CONTAINER
:
...
...
@@ -429,7 +456,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break
;
case
ID_PCB_ZONES_BUTT
:
if
(
End_Zone
(
DC
)
)
if
(
End_Zone
(
DC
)
)
{
DrawPanel
->
m_AutoPAN_Request
=
false
;
SetCurItem
(
NULL
);
...
...
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