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
db0d7083
Commit
db0d7083
authored
Jul 09, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified code for switching layers in GAL view. Tools are notified of layer change event.
parent
c0a96141
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
51 additions
and
104 deletions
+51
-104
pcbframe.cpp
pcbnew/pcbframe.cpp
+3
-0
common_actions.cpp
pcbnew/tools/common_actions.cpp
+4
-0
common_actions.h
pcbnew/tools/common_actions.h
+2
-0
drawing_tool.cpp
pcbnew/tools/drawing_tool.cpp
+1
-1
module_tools.cpp
pcbnew/tools/module_tools.cpp
+3
-8
pcbnew_control.cpp
pcbnew/tools/pcbnew_control.cpp
+36
-86
pcbnew_control.h
pcbnew/tools/pcbnew_control.h
+1
-8
zones_convert_brd_items_to_polygons_with_Boost.cpp
pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
+1
-1
No files found.
pcbnew/pcbframe.cpp
View file @
db0d7083
...
@@ -828,7 +828,10 @@ void PCB_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer )
...
@@ -828,7 +828,10 @@ void PCB_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer )
syncLayerWidgetLayer
();
syncLayerWidgetLayer
();
if
(
IsGalCanvasActive
()
)
if
(
IsGalCanvasActive
()
)
{
m_toolManager
->
RunAction
(
COMMON_ACTIONS
::
layerChanged
);
// notify other tools
GetGalCanvas
()
->
Refresh
();
GetGalCanvas
()
->
Refresh
();
}
}
}
...
...
pcbnew/tools/common_actions.cpp
View file @
db0d7083
...
@@ -222,6 +222,10 @@ TOOL_ACTION COMMON_ACTIONS::layerAlphaDec( "pcbnew.Control.layerAlphaDec",
...
@@ -222,6 +222,10 @@ TOOL_ACTION COMMON_ACTIONS::layerAlphaDec( "pcbnew.Control.layerAlphaDec",
AS_GLOBAL
,
'{'
,
AS_GLOBAL
,
'{'
,
""
,
""
);
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
layerChanged
(
"pcbnew.Control.layerChanged"
,
AS_GLOBAL
,
0
,
""
,
""
,
AF_NOTIFY
);
// Grid control
// Grid control
TOOL_ACTION
COMMON_ACTIONS
::
gridFast1
(
"pcbnew.Control.gridFast1"
,
TOOL_ACTION
COMMON_ACTIONS
::
gridFast1
(
"pcbnew.Control.gridFast1"
,
...
...
pcbnew/tools/common_actions.h
View file @
db0d7083
...
@@ -157,6 +157,8 @@ public:
...
@@ -157,6 +157,8 @@ public:
static
TOOL_ACTION
layerAlphaInc
;
static
TOOL_ACTION
layerAlphaInc
;
static
TOOL_ACTION
layerAlphaDec
;
static
TOOL_ACTION
layerAlphaDec
;
static
TOOL_ACTION
layerChanged
;
// notification
// Grid control
// Grid control
static
TOOL_ACTION
gridFast1
;
static
TOOL_ACTION
gridFast1
;
static
TOOL_ACTION
gridFast2
;
static
TOOL_ACTION
gridFast2
;
...
...
pcbnew/tools/drawing_tool.cpp
View file @
db0d7083
...
@@ -889,7 +889,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
...
@@ -889,7 +889,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
if
(
aStartingPoint
)
if
(
aStartingPoint
)
{
{
LAYER_
NUM
layer
=
m_frame
->
GetScreen
()
->
m_Active_Layer
;
LAYER_
ID
layer
=
m_frame
->
GetScreen
()
->
m_Active_Layer
;
// Init the new item attributes
// Init the new item attributes
aGraphic
->
SetShape
(
(
STROKE_T
)
aShape
);
aGraphic
->
SetShape
(
(
STROKE_T
)
aShape
);
...
...
pcbnew/tools/module_tools.cpp
View file @
db0d7083
...
@@ -576,14 +576,9 @@ int MODULE_TOOLS::ModuleEdgeOutlines( TOOL_EVENT& aEvent )
...
@@ -576,14 +576,9 @@ int MODULE_TOOLS::ModuleEdgeOutlines( TOOL_EVENT& aEvent )
KIGFX
::
PCB_RENDER_SETTINGS
*
settings
=
KIGFX
::
PCB_RENDER_SETTINGS
*
settings
=
static_cast
<
KIGFX
::
PCB_RENDER_SETTINGS
*>
(
painter
->
GetSettings
()
);
static_cast
<
KIGFX
::
PCB_RENDER_SETTINGS
*>
(
painter
->
GetSettings
()
);
const
LAYER_NUM
layers
[]
=
{
ADHESIVE_N_FRONT
,
ADHESIVE_N_BACK
,
\
const
LAYER_ID
layers
[]
=
{
F_Adhes
,
B_Adhes
,
F_Paste
,
B_Paste
,
SOLDERPASTE_N_FRONT
,
SOLDERPASTE_N_BACK
,
\
F_SilkS
,
B_SilkS
,
F_Mask
,
B_Mask
,
SILKSCREEN_N_FRONT
,
SILKSCREEN_N_BACK
,
\
Dwgs_User
,
Cmts_User
,
Eco1_User
,
Eco2_User
,
Edge_Cuts
};
SOLDERMASK_N_FRONT
,
SOLDERMASK_N_BACK
,
\
DRAW_N
,
\
COMMENT_N
,
\
ECO1_N
,
ECO2_N
,
\
EDGE_N
};
bool
enable
=
!
settings
->
GetSketchMode
(
layers
[
0
]
);
bool
enable
=
!
settings
->
GetSketchMode
(
layers
[
0
]
);
...
...
pcbnew/tools/pcbnew_control.cpp
View file @
db0d7083
...
@@ -279,79 +279,25 @@ int PCBNEW_CONTROL::HighContrastDec( TOOL_EVENT& aEvent )
...
@@ -279,79 +279,25 @@ int PCBNEW_CONTROL::HighContrastDec( TOOL_EVENT& aEvent )
// Layer control
// Layer control
int
PCBNEW_CONTROL
::
Layer
Top
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
Layer
Switch
(
TOOL_EVENT
&
aEvent
)
{
{
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerTop
)
)
m_frame
->
SwitchLayer
(
NULL
,
F_Cu
);
m_frame
->
SwitchLayer
(
NULL
,
F_Cu
);
m_frame
->
GetGalCanvas
()
->
SetFocus
();
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerInner1
)
)
setTransitions
();
return
0
;
}
int
PCBNEW_CONTROL
::
LayerInner1
(
TOOL_EVENT
&
aEvent
)
{
m_frame
->
SwitchLayer
(
NULL
,
In1_Cu
);
m_frame
->
SwitchLayer
(
NULL
,
In1_Cu
);
m_frame
->
GetGalCanvas
()
->
SetFocus
();
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerInner2
)
)
setTransitions
();
return
0
;
}
int
PCBNEW_CONTROL
::
LayerInner2
(
TOOL_EVENT
&
aEvent
)
{
m_frame
->
SwitchLayer
(
NULL
,
In2_Cu
);
m_frame
->
SwitchLayer
(
NULL
,
In2_Cu
);
m_frame
->
GetGalCanvas
()
->
SetFocus
();
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerInner3
)
)
setTransitions
();
return
0
;
}
int
PCBNEW_CONTROL
::
LayerInner3
(
TOOL_EVENT
&
aEvent
)
{
m_frame
->
SwitchLayer
(
NULL
,
In3_Cu
);
m_frame
->
SwitchLayer
(
NULL
,
In3_Cu
);
m_frame
->
GetGalCanvas
()
->
SetFocus
();
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerInner4
)
)
setTransitions
();
return
0
;
}
int
PCBNEW_CONTROL
::
LayerInner4
(
TOOL_EVENT
&
aEvent
)
{
m_frame
->
SwitchLayer
(
NULL
,
In4_Cu
);
m_frame
->
SwitchLayer
(
NULL
,
In4_Cu
);
m_frame
->
GetGalCanvas
()
->
SetFocus
();
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerInner5
)
)
setTransitions
();
return
0
;
}
int
PCBNEW_CONTROL
::
LayerInner5
(
TOOL_EVENT
&
aEvent
)
{
m_frame
->
SwitchLayer
(
NULL
,
In5_Cu
);
m_frame
->
SwitchLayer
(
NULL
,
In5_Cu
);
m_frame
->
GetGalCanvas
()
->
SetFocus
();
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerInner6
)
)
setTransitions
();
return
0
;
}
int
PCBNEW_CONTROL
::
LayerInner6
(
TOOL_EVENT
&
aEvent
)
{
m_frame
->
SwitchLayer
(
NULL
,
In6_Cu
);
m_frame
->
SwitchLayer
(
NULL
,
In6_Cu
);
m_frame
->
GetGalCanvas
()
->
SetFocus
();
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerBottom
)
)
setTransitions
();
m_frame
->
SwitchLayer
(
NULL
,
B_Cu
);
return
0
;
}
int
PCBNEW_CONTROL
::
LayerBottom
(
TOOL_EVENT
&
aEvent
)
{
m_frame
->
SetActiveLayer
(
B_Cu
);
m_frame
->
GetGalCanvas
()
->
SetFocus
();
m_frame
->
GetGalCanvas
()
->
SetFocus
();
setTransitions
();
setTransitions
();
...
@@ -364,15 +310,17 @@ int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent )
...
@@ -364,15 +310,17 @@ int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent )
PCB_BASE_FRAME
*
editFrame
=
m_frame
;
PCB_BASE_FRAME
*
editFrame
=
m_frame
;
LAYER_NUM
layer
=
editFrame
->
GetActiveLayer
();
LAYER_NUM
layer
=
editFrame
->
GetActiveLayer
();
if
(
layer
<
F_Cu
||
layer
>
=
B_Cu
)
if
(
layer
<
F_Cu
||
layer
>
B_Cu
)
{
{
setTransitions
();
setTransitions
();
return
0
;
return
0
;
}
}
if
(
getModel
<
BOARD
>
()
->
GetCopperLayerCount
()
<
2
)
// Single layer
int
layerCount
=
getModel
<
BOARD
>
()
->
GetCopperLayerCount
();
if
(
layer
==
layerCount
-
2
||
layerCount
<
2
)
layer
=
B_Cu
;
layer
=
B_Cu
;
else
if
(
layer
>=
getModel
<
BOARD
>
()
->
GetCopperLayerCount
()
-
2
)
else
if
(
layer
==
B_Cu
)
layer
=
F_Cu
;
layer
=
F_Cu
;
else
else
++
layer
;
++
layer
;
...
@@ -390,16 +338,18 @@ int PCBNEW_CONTROL::LayerPrev( TOOL_EVENT& aEvent )
...
@@ -390,16 +338,18 @@ int PCBNEW_CONTROL::LayerPrev( TOOL_EVENT& aEvent )
PCB_BASE_FRAME
*
editFrame
=
m_frame
;
PCB_BASE_FRAME
*
editFrame
=
m_frame
;
LAYER_NUM
layer
=
editFrame
->
GetActiveLayer
();
LAYER_NUM
layer
=
editFrame
->
GetActiveLayer
();
if
(
layer
<
=
F_Cu
||
layer
>
B_Cu
)
if
(
layer
<
F_Cu
||
layer
>
B_Cu
)
{
{
setTransitions
();
setTransitions
();
return
0
;
return
0
;
}
}
if
(
getModel
<
BOARD
>
()
->
GetCopperLayerCount
()
<
2
)
// Single layer
int
layerCount
=
getModel
<
BOARD
>
()
->
GetCopperLayerCount
();
if
(
layer
==
F_Cu
||
layerCount
<
2
)
layer
=
B_Cu
;
layer
=
B_Cu
;
else
if
(
layer
==
B_Cu
)
else
if
(
layer
==
B_Cu
)
layer
=
std
::
max
(
int
(
F_Cu
),
getModel
<
BOARD
>
()
->
GetCopperLayerCount
()
-
2
)
;
layer
=
layerCount
-
2
;
else
else
--
layer
;
--
layer
;
...
@@ -617,14 +567,14 @@ void PCBNEW_CONTROL::setTransitions()
...
@@ -617,14 +567,14 @@ void PCBNEW_CONTROL::setTransitions()
Go
(
&
PCBNEW_CONTROL
::
HighContrastDec
,
COMMON_ACTIONS
::
highContrastDec
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
HighContrastDec
,
COMMON_ACTIONS
::
highContrastDec
.
MakeEvent
()
);
// Layer control
// Layer control
Go
(
&
PCBNEW_CONTROL
::
Layer
Top
,
COMMON_ACTIONS
::
layerTop
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Switch
,
COMMON_ACTIONS
::
layerTop
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Inner1
,
COMMON_ACTIONS
::
layerInner1
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Switch
,
COMMON_ACTIONS
::
layerInner1
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Inner2
,
COMMON_ACTIONS
::
layerInner2
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Switch
,
COMMON_ACTIONS
::
layerInner2
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Inner3
,
COMMON_ACTIONS
::
layerInner3
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Switch
,
COMMON_ACTIONS
::
layerInner3
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Inner4
,
COMMON_ACTIONS
::
layerInner4
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Switch
,
COMMON_ACTIONS
::
layerInner4
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Inner5
,
COMMON_ACTIONS
::
layerInner5
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Switch
,
COMMON_ACTIONS
::
layerInner5
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Inner6
,
COMMON_ACTIONS
::
layerInner6
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Switch
,
COMMON_ACTIONS
::
layerInner6
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Bottom
,
COMMON_ACTIONS
::
layerBottom
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
Layer
Switch
,
COMMON_ACTIONS
::
layerBottom
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
LayerNext
,
COMMON_ACTIONS
::
layerNext
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
LayerNext
,
COMMON_ACTIONS
::
layerNext
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
LayerPrev
,
COMMON_ACTIONS
::
layerPrev
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
LayerPrev
,
COMMON_ACTIONS
::
layerPrev
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
LayerAlphaInc
,
COMMON_ACTIONS
::
layerAlphaInc
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
LayerAlphaInc
,
COMMON_ACTIONS
::
layerAlphaInc
.
MakeEvent
()
);
...
...
pcbnew/tools/pcbnew_control.h
View file @
db0d7083
...
@@ -62,14 +62,7 @@ public:
...
@@ -62,14 +62,7 @@ public:
int
HighContrastDec
(
TOOL_EVENT
&
aEvent
);
int
HighContrastDec
(
TOOL_EVENT
&
aEvent
);
// Layer control
// Layer control
int
LayerTop
(
TOOL_EVENT
&
aEvent
);
int
LayerSwitch
(
TOOL_EVENT
&
aEvent
);
int
LayerInner1
(
TOOL_EVENT
&
aEvent
);
int
LayerInner2
(
TOOL_EVENT
&
aEvent
);
int
LayerInner3
(
TOOL_EVENT
&
aEvent
);
int
LayerInner4
(
TOOL_EVENT
&
aEvent
);
int
LayerInner5
(
TOOL_EVENT
&
aEvent
);
int
LayerInner6
(
TOOL_EVENT
&
aEvent
);
int
LayerBottom
(
TOOL_EVENT
&
aEvent
);
int
LayerNext
(
TOOL_EVENT
&
aEvent
);
int
LayerNext
(
TOOL_EVENT
&
aEvent
);
int
LayerPrev
(
TOOL_EVENT
&
aEvent
);
int
LayerPrev
(
TOOL_EVENT
&
aEvent
);
int
LayerAlphaInc
(
TOOL_EVENT
&
aEvent
);
int
LayerAlphaInc
(
TOOL_EVENT
&
aEvent
);
...
...
pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
View file @
db0d7083
...
@@ -303,7 +303,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
...
@@ -303,7 +303,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
{
{
for
(
BOARD_ITEM
*
item
=
module
->
GraphicalItems
();
item
;
item
=
item
->
Next
()
)
for
(
BOARD_ITEM
*
item
=
module
->
GraphicalItems
();
item
;
item
=
item
->
Next
()
)
{
{
if
(
!
item
->
IsOnLayer
(
GetLayer
()
)
&&
!
item
->
IsOnLayer
(
E
DGE_N
)
)
if
(
!
item
->
IsOnLayer
(
GetLayer
()
)
&&
!
item
->
IsOnLayer
(
E
dge_Cuts
)
)
continue
;
continue
;
if
(
item
->
Type
()
!=
PCB_MODULE_EDGE_T
)
if
(
item
->
Type
()
!=
PCB_MODULE_EDGE_T
)
...
...
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