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
1bd70efc
Commit
1bd70efc
authored
Feb 15, 2015
by
Garth Corral
Browse files
Options
Browse Files
Download
Plain Diff
Merge trunk @ 5423
parents
ebec4e69
b0ad779e
Changes
57
Hide whitespace changes
Inline
Side-by-side
Showing
57 changed files
with
1073 additions
and
696 deletions
+1073
-696
3d_mesh_model.cpp
3d-viewer/3d_mesh_model.cpp
+59
-64
modelparsers.h
3d-viewer/modelparsers.h
+29
-23
vrml_v2_modelparser.cpp
3d-viewer/vrml_v2_modelparser.cpp
+139
-79
CMakeLists.txt
CMakeLists.txt
+27
-1
config.h.cmake
CMakeModules/config.h.cmake
+5
-0
draw_panel_gal.cpp
common/draw_panel_gal.cpp
+57
-40
opengl_compositor.cpp
common/gal/opengl/opengl_compositor.cpp
+23
-23
opengl_gal.cpp
common/gal/opengl/opengl_gal.cpp
+32
-70
shader.cpp
common/gal/opengl/shader.cpp
+11
-25
context_menu.cpp
common/tool/context_menu.cpp
+5
-7
tool_manager.cpp
common/tool/tool_manager.cpp
+7
-7
dialog_choose_component.cpp
eeschema/dialogs/dialog_choose_component.cpp
+9
-0
dialog_schematic_find_base.fbp
eeschema/dialogs/dialog_schematic_find_base.fbp
+0
-0
class_draw_panel_gal.h
include/class_draw_panel_gal.h
+1
-1
opengl_gal.h
include/gal/opengl/opengl_gal.h
+0
-2
tool_base.h
include/tool/tool_base.h
+1
-1
tool_interactive.h
include/tool/tool_interactive.h
+2
-2
tool_manager.h
include/tool/tool_manager.h
+5
-5
view.h
include/view/view.h
+8
-1
wxPcbStruct.h
include/wxPcbStruct.h
+14
-2
class_board.cpp
pcbnew/class_board.cpp
+26
-1
class_board.h
pcbnew/class_board.h
+12
-0
class_board_design_settings.cpp
pcbnew/class_board_design_settings.cpp
+2
-0
class_module.cpp
pcbnew/class_module.cpp
+13
-6
cross-probing.cpp
pcbnew/cross-probing.cpp
+13
-2
dialog_enum_pads.cpp
pcbnew/dialogs/dialog_enum_pads.cpp
+4
-0
dialog_enum_pads_base.cpp
pcbnew/dialogs/dialog_enum_pads_base.cpp
+22
-19
dialog_enum_pads_base.fbp
pcbnew/dialogs/dialog_enum_pads_base.fbp
+123
-33
dialog_enum_pads_base.h
pcbnew/dialogs/dialog_enum_pads_base.h
+10
-5
files.cpp
pcbnew/files.cpp
+63
-3
footprint_wizard.cpp
pcbnew/footprint_wizard.cpp
+1
-2
menubar_pcbframe.cpp
pcbnew/menubar_pcbframe.cpp
+17
-2
modedit.cpp
pcbnew/modedit.cpp
+16
-21
pad_edition_functions.cpp
pcbnew/pad_edition_functions.cpp
+3
-2
pcbframe.cpp
pcbnew/pcbframe.cpp
+9
-6
pcbnew.cpp
pcbnew/pcbnew.cpp
+37
-40
pcbnew_id.h
pcbnew/pcbnew_id.h
+1
-0
router_tool.cpp
pcbnew/router/router_tool.cpp
+1
-1
router_tool.h
pcbnew/router/router_tool.h
+1
-1
drawing_tool.cpp
pcbnew/tools/drawing_tool.cpp
+21
-20
drawing_tool.h
pcbnew/tools/drawing_tool.h
+12
-12
edit_tool.cpp
pcbnew/tools/edit_tool.cpp
+8
-6
edit_tool.h
pcbnew/tools/edit_tool.h
+5
-5
module_tools.cpp
pcbnew/tools/module_tools.cpp
+8
-7
module_tools.h
pcbnew/tools/module_tools.h
+6
-6
pcb_editor_control.cpp
pcbnew/tools/pcb_editor_control.cpp
+25
-9
pcb_editor_control.h
pcbnew/tools/pcb_editor_control.h
+11
-8
pcbnew_control.cpp
pcbnew/tools/pcbnew_control.cpp
+27
-27
pcbnew_control.h
pcbnew/tools/pcbnew_control.h
+26
-26
placement_tool.cpp
pcbnew/tools/placement_tool.cpp
+7
-7
placement_tool.h
pcbnew/tools/placement_tool.h
+36
-22
point_editor.cpp
pcbnew/tools/point_editor.cpp
+3
-3
point_editor.h
pcbnew/tools/point_editor.h
+1
-1
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+21
-26
selection_tool.h
pcbnew/tools/selection_tool.h
+10
-10
test_002_board_class.py
qa/testcases/test_002_board_class.py
+28
-1
python_scripting.cpp
scripting/python_scripting.cpp
+10
-3
No files found.
3d-viewer/3d_mesh_model.cpp
View file @
1bd70efc
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
* This program source code file is part of KiCad, a free EDA CAD application.
*
*
* Copyright (C) 2014 Mario Luzeiro <mrluzeiro@gmail.com>
* Copyright (C) 2014 Mario Luzeiro <mrluzeiro@gmail.com>
* Copyright (C) 1992-201
4
KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-201
5
KiCad Developers, see AUTHORS.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* modify it under the terms of the GNU General Public License
...
@@ -46,8 +46,8 @@ S3D_MESH::S3D_MESH()
...
@@ -46,8 +46,8 @@ S3D_MESH::S3D_MESH()
m_translation
=
glm
::
vec3
(
0.0
f
,
0.0
f
,
0.0
f
);
m_translation
=
glm
::
vec3
(
0.0
f
,
0.0
f
,
0.0
f
);
m_rotation
=
glm
::
vec4
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
);
m_rotation
=
glm
::
vec4
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
);
m_scale
=
glm
::
vec3
(
1.0
f
,
1.0
f
,
1.0
f
);
m_scale
=
glm
::
vec3
(
1.0
f
,
1.0
f
,
1.0
f
);
m_scaleOrientation
=
glm
::
vec4
(
0.0
f
,
0.0
f
,
1.0
f
,
0.0
f
);
// not used
m_scaleOrientation
=
glm
::
vec4
(
0.0
f
,
0.0
f
,
1.0
f
,
0.0
f
);
// not used
m_center
=
glm
::
vec3
(
0.0
f
,
0.0
f
,
0.0
f
);
// not used
m_center
=
glm
::
vec3
(
0.0
f
,
0.0
f
,
0.0
f
);
// not used
}
}
...
@@ -55,10 +55,11 @@ S3D_MESH::~S3D_MESH()
...
@@ -55,10 +55,11 @@ S3D_MESH::~S3D_MESH()
{
{
for
(
unsigned
int
idx
=
0
;
idx
<
childs
.
size
();
idx
++
)
for
(
unsigned
int
idx
=
0
;
idx
<
childs
.
size
();
idx
++
)
{
{
delete
childs
[
idx
];
delete
childs
[
idx
];
}
}
}
}
void
S3D_MESH
::
openGL_RenderAllChilds
()
void
S3D_MESH
::
openGL_RenderAllChilds
()
{
{
//DBG( printf( "openGL_RenderAllChilds") );
//DBG( printf( "openGL_RenderAllChilds") );
...
@@ -82,7 +83,6 @@ void S3D_MESH::openGL_RenderAllChilds()
...
@@ -82,7 +83,6 @@ void S3D_MESH::openGL_RenderAllChilds()
SetOpenGlDefaultMaterial
();
SetOpenGlDefaultMaterial
();
glPopMatrix
();
glPopMatrix
();
}
}
...
@@ -94,15 +94,10 @@ void S3D_MESH::openGL_Render()
...
@@ -94,15 +94,10 @@ void S3D_MESH::openGL_Render()
&&
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_SMOOTH
);
&&
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_SMOOTH
);
if
(
m_Materials
)
if
(
m_Materials
)
{
m_Materials
->
SetOpenGLMaterial
(
0
,
useMaterial
);
m_Materials
->
SetOpenGLMaterial
(
0
,
useMaterial
);
}
if
(
m_CoordIndex
.
size
()
==
0
)
{
if
(
m_CoordIndex
.
size
()
==
0
)
return
;
return
;
}
glPushMatrix
();
glPushMatrix
();
glTranslatef
(
m_translation
.
x
,
m_translation
.
y
,
m_translation
.
z
);
glTranslatef
(
m_translation
.
x
,
m_translation
.
y
,
m_translation
.
z
);
...
@@ -117,9 +112,7 @@ void S3D_MESH::openGL_Render()
...
@@ -117,9 +112,7 @@ void S3D_MESH::openGL_Render()
if
(
m_PerVertexNormalsNormalized
.
size
()
==
0
)
if
(
m_PerVertexNormalsNormalized
.
size
()
==
0
)
{
{
if
(
smoothShapes
)
if
(
smoothShapes
)
{
calcPerPointNormals
();
calcPerPointNormals
();
}
}
}
for
(
unsigned
int
idx
=
0
;
idx
<
m_CoordIndex
.
size
();
idx
++
)
for
(
unsigned
int
idx
=
0
;
idx
<
m_CoordIndex
.
size
();
idx
++
)
...
@@ -127,17 +120,21 @@ void S3D_MESH::openGL_Render()
...
@@ -127,17 +120,21 @@ void S3D_MESH::openGL_Render()
if
(
m_MaterialIndex
.
size
()
>
1
)
if
(
m_MaterialIndex
.
size
()
>
1
)
{
{
if
(
m_Materials
)
if
(
m_Materials
)
{
m_Materials
->
SetOpenGLMaterial
(
m_MaterialIndex
[
idx
],
useMaterial
);
m_Materials
->
SetOpenGLMaterial
(
m_MaterialIndex
[
idx
],
useMaterial
);
}
}
}
switch
(
m_CoordIndex
[
idx
].
size
()
)
switch
(
m_CoordIndex
[
idx
].
size
()
)
{
{
case
3
:
glBegin
(
GL_TRIANGLES
);
break
;
case
3
:
case
4
:
glBegin
(
GL_QUADS
);
break
;
glBegin
(
GL_TRIANGLES
);
default
:
glBegin
(
GL_POLYGON
);
break
;
break
;
case
4
:
glBegin
(
GL_QUADS
);
break
;
default
:
glBegin
(
GL_POLYGON
);
break
;
}
}
...
@@ -187,34 +184,36 @@ void S3D_MESH::openGL_Render()
...
@@ -187,34 +184,36 @@ void S3D_MESH::openGL_Render()
}
}
void
S3D_MESH
::
calcPointNormalized
()
void
S3D_MESH
::
calcPointNormalized
()
{
{
//DBG( printf( "calcPointNormalized\n" ) );
//DBG( printf( "calcPointNormalized\n" ) );
if
(
isPointNormalizedComputed
==
true
)
if
(
isPointNormalizedComputed
==
true
)
{
return
;
return
;
}
isPointNormalizedComputed
=
true
;
isPointNormalizedComputed
=
true
;
if
(
m_PerVertexNormalsNormalized
.
size
()
>
0
)
if
(
m_PerVertexNormalsNormalized
.
size
()
>
0
)
{
return
;
return
;
}
m_PointNormalized
.
clear
();
m_PointNormalized
.
clear
();
float
biggerPoint
=
0.0
f
;
float
biggerPoint
=
0.0
f
;
for
(
unsigned
int
i
=
0
;
i
<
m_Point
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
m_Point
.
size
();
i
++
)
{
{
if
(
fabs
(
m_Point
[
i
].
x
)
>
biggerPoint
)
biggerPoint
=
fabs
(
m_Point
[
i
].
x
);
if
(
fabs
(
m_Point
[
i
].
x
)
>
biggerPoint
)
if
(
fabs
(
m_Point
[
i
].
y
)
>
biggerPoint
)
biggerPoint
=
fabs
(
m_Point
[
i
].
y
);
biggerPoint
=
fabs
(
m_Point
[
i
].
x
);
if
(
fabs
(
m_Point
[
i
].
z
)
>
biggerPoint
)
biggerPoint
=
fabs
(
m_Point
[
i
].
z
);
if
(
fabs
(
m_Point
[
i
].
y
)
>
biggerPoint
)
biggerPoint
=
fabs
(
m_Point
[
i
].
y
);
if
(
fabs
(
m_Point
[
i
].
z
)
>
biggerPoint
)
biggerPoint
=
fabs
(
m_Point
[
i
].
z
);
}
}
biggerPoint
=
1.0
/
biggerPoint
;
biggerPoint
=
1.0
/
biggerPoint
;
for
(
unsigned
int
i
=
0
;
i
<
m_Point
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
m_Point
.
size
();
i
++
)
{
{
glm
::
vec3
p
;
glm
::
vec3
p
;
p
=
m_Point
[
i
]
*
biggerPoint
;
p
=
m_Point
[
i
]
*
biggerPoint
;
...
@@ -237,30 +236,22 @@ bool IsClockwise( glm::vec3 v0, glm::vec3 v1, glm::vec3 v2 )
...
@@ -237,30 +236,22 @@ bool IsClockwise( glm::vec3 v0, glm::vec3 v1, glm::vec3 v2 )
}
}
void
S3D_MESH
::
calcPerFaceNormals
()
void
S3D_MESH
::
calcPerFaceNormals
()
{
{
//DBG( printf( "calcPerFaceNormals" ) );
//DBG( printf( "calcPerFaceNormals" ) );
if
(
isPerFaceNormalsComputed
==
true
)
if
(
isPerFaceNormalsComputed
==
true
)
{
return
;
return
;
}
isPerFaceNormalsComputed
=
true
;
isPerFaceNormalsComputed
=
true
;
if
(
m_PerVertexNormalsNormalized
.
size
()
>
0
)
if
(
m_PerVertexNormalsNormalized
.
size
()
>
0
)
{
return
;
return
;
}
bool
haveAlreadyNormals_from_model_file
=
false
;
bool
haveAlreadyNormals_from_model_file
=
false
;
if
(
m_PerFaceNormalsNormalized
.
size
()
>
0
)
if
(
m_PerFaceNormalsNormalized
.
size
()
>
0
)
{
haveAlreadyNormals_from_model_file
=
true
;
haveAlreadyNormals_from_model_file
=
true
;
}
m_PerFaceNormalsRaw
.
clear
();
m_PerFaceNormalsRaw
.
clear
();
m_PerFaceSquaredArea
.
clear
();
m_PerFaceSquaredArea
.
clear
();
...
@@ -268,9 +259,15 @@ void S3D_MESH::calcPerFaceNormals ()
...
@@ -268,9 +259,15 @@ void S3D_MESH::calcPerFaceNormals ()
//DBG( printf("m_CoordIndex.size %u\n", m_CoordIndex.size()) );
//DBG( printf("m_CoordIndex.size %u\n", m_CoordIndex.size()) );
//DBG( printf("m_PointNormalized.size %u\n", m_PointNormalized.size()) );
//DBG( printf("m_PointNormalized.size %u\n", m_PointNormalized.size()) );
for
(
unsigned
int
idx
=
0
;
idx
<
m_CoordIndex
.
size
();
idx
++
)
// There are no points defined for the coordIndex
if
(
m_PointNormalized
.
size
()
==
0
)
{
{
m_CoordIndex
.
clear
();
return
;
}
for
(
unsigned
int
idx
=
0
;
idx
<
m_CoordIndex
.
size
();
idx
++
)
{
// User normalized and multiply to get better resolution
// User normalized and multiply to get better resolution
glm
::
vec3
v0
=
m_PointNormalized
[
m_CoordIndex
[
idx
][
0
]];
glm
::
vec3
v0
=
m_PointNormalized
[
m_CoordIndex
[
idx
][
0
]];
glm
::
vec3
v1
=
m_PointNormalized
[
m_CoordIndex
[
idx
][
1
]];
glm
::
vec3
v1
=
m_PointNormalized
[
m_CoordIndex
[
idx
][
1
]];
...
@@ -300,14 +297,10 @@ void S3D_MESH::calcPerFaceNormals ()
...
@@ -300,14 +297,10 @@ void S3D_MESH::calcPerFaceNormals ()
float
area
=
glm
::
dot
(
cross_prod
,
cross_prod
);
float
area
=
glm
::
dot
(
cross_prod
,
cross_prod
);
if
(
cross_prod
[
2
]
<
0.0
)
if
(
cross_prod
[
2
]
<
0.0
)
{
area
=
-
area
;
area
=
-
area
;
}
if
(
area
<
FLT_EPSILON
)
if
(
area
<
FLT_EPSILON
)
{
area
=
FLT_EPSILON
*
2.0
f
;
area
=
FLT_EPSILON
*
2.0
f
;
}
m_PerFaceSquaredArea
.
push_back
(
area
);
m_PerFaceSquaredArea
.
push_back
(
area
);
...
@@ -315,52 +308,55 @@ void S3D_MESH::calcPerFaceNormals ()
...
@@ -315,52 +308,55 @@ void S3D_MESH::calcPerFaceNormals ()
if
(
haveAlreadyNormals_from_model_file
==
false
)
if
(
haveAlreadyNormals_from_model_file
==
false
)
{
{
// normalize vertex normal
// normalize vertex normal
float
l
=
glm
::
length
(
cross_prod
);
float
l
=
glm
::
length
(
cross_prod
);
if
(
l
>
FLT_EPSILON
)
// avoid division by zero
if
(
l
>
FLT_EPSILON
)
// avoid division by zero
{
{
cross_prod
=
cross_prod
/
l
;
cross_prod
=
cross_prod
/
l
;
}
}
else
else
{
{
// Cannot calc normal
// Cannot calc normal
if
(
(
cross_prod
.
x
>
cross_prod
.
y
)
&&
(
cross_prod
.
x
>
cross_prod
.
z
)
)
if
(
(
cross_prod
.
x
>
cross_prod
.
y
)
&&
(
cross_prod
.
x
>
cross_prod
.
z
)
)
{
{
cross_prod
.
x
=
1.0
;
cross_prod
.
y
=
0.0
;
cross_prod
.
z
=
0.0
;
cross_prod
.
x
=
1.0
;
}
else
if
(
(
cross_prod
.
y
>
cross_prod
.
x
)
&&
(
cross_prod
.
y
>
cross_prod
.
z
))
cross_prod
.
y
=
0.0
;
cross_prod
.
z
=
0.0
;
}
else
if
(
(
cross_prod
.
y
>
cross_prod
.
x
)
&&
(
cross_prod
.
y
>
cross_prod
.
z
)
)
{
{
cross_prod
.
x
=
0.0
;
cross_prod
.
y
=
1.0
;
cross_prod
.
z
=
0.0
;
cross_prod
.
x
=
0.0
;
}
else
cross_prod
.
y
=
1.0
;
cross_prod
.
z
=
0.0
;
}
else
{
{
cross_prod
.
x
=
0.0
;
cross_prod
.
y
=
1.0
;
cross_prod
.
z
=
0.0
;
cross_prod
.
x
=
0.0
;
cross_prod
.
y
=
0.0
;
cross_prod
.
z
=
1.0
;
}
}
}
}
m_PerFaceNormalsNormalized
.
push_back
(
cross_prod
);
m_PerFaceNormalsNormalized
.
push_back
(
cross_prod
);
}
}
}
}
}
}
// http://www.bytehazard.com/code/vertnorm.html
// http://www.bytehazard.com/code/vertnorm.html
// http://www.emeyex.com/site/tuts/VertexNormals.pdf
// http://www.emeyex.com/site/tuts/VertexNormals.pdf
void
S3D_MESH
::
calcPerPointNormals
()
void
S3D_MESH
::
calcPerPointNormals
()
{
{
//DBG( printf( "calcPerPointNormals" ) );
//DBG( printf( "calcPerPointNormals" ) );
if
(
isPerPointNormalsComputed
==
true
)
if
(
isPerPointNormalsComputed
==
true
)
{
return
;
return
;
}
isPerPointNormalsComputed
=
true
;
isPerPointNormalsComputed
=
true
;
if
(
m_PerVertexNormalsNormalized
.
size
()
>
0
)
if
(
m_PerVertexNormalsNormalized
.
size
()
>
0
)
{
return
;
return
;
}
m_PerFaceVertexNormals
.
clear
();
m_PerFaceVertexNormals
.
clear
();
...
@@ -371,6 +367,7 @@ void S3D_MESH::calcPerPointNormals ()
...
@@ -371,6 +367,7 @@ void S3D_MESH::calcPerPointNormals ()
#ifdef USE_OPENMP
#ifdef USE_OPENMP
#pragma omp parallel for
#pragma omp parallel for
#endif
/* USE_OPENMP */
#endif
/* USE_OPENMP */
for
(
unsigned
int
each_face_A_idx
=
0
;
each_face_A_idx
<
m_CoordIndex
.
size
();
each_face_A_idx
++
)
for
(
unsigned
int
each_face_A_idx
=
0
;
each_face_A_idx
<
m_CoordIndex
.
size
();
each_face_A_idx
++
)
{
{
// n = face A facet normal
// n = face A facet normal
...
@@ -390,15 +387,16 @@ void S3D_MESH::calcPerPointNormals ()
...
@@ -390,15 +387,16 @@ void S3D_MESH::calcPerPointNormals ()
for
(
unsigned
int
each_face_B_idx
=
0
;
each_face_B_idx
<
m_CoordIndex
.
size
();
each_face_B_idx
++
)
for
(
unsigned
int
each_face_B_idx
=
0
;
each_face_B_idx
<
m_CoordIndex
.
size
();
each_face_B_idx
++
)
{
{
//if A != B { // ignore self
//if A != B { // ignore self
if
(
each_face_A_idx
!=
each_face_B_idx
)
if
(
each_face_A_idx
!=
each_face_B_idx
)
{
{
if
(
(
m_CoordIndex
[
each_face_B_idx
][
0
]
==
vertexIndex
)
||
if
(
(
m_CoordIndex
[
each_face_B_idx
][
0
]
==
vertexIndex
)
(
m_CoordIndex
[
each_face_B_idx
][
1
]
==
vertexIndex
)
||
||
(
m_CoordIndex
[
each_face_B_idx
][
1
]
==
vertexIndex
)
(
m_CoordIndex
[
each_face_B_idx
][
2
]
==
vertexIndex
)
)
||
(
m_CoordIndex
[
each_face_B_idx
][
2
]
==
vertexIndex
)
)
{
{
glm
::
vec3
vector_face_B
=
m_PerFaceNormalsNormalized
[
each_face_B_idx
];
glm
::
vec3
vector_face_B
=
m_PerFaceNormalsNormalized
[
each_face_B_idx
];
float
dot_prod
=
glm
::
dot
(
vector_face_A
,
vector_face_B
);
float
dot_prod
=
glm
::
dot
(
vector_face_A
,
vector_face_B
);
if
(
dot_prod
>
0.05
f
)
if
(
dot_prod
>
0.05
f
)
{
{
face_A_normals
[
each_vert_A_idx
]
+=
m_PerFaceNormalsRaw
[
each_face_B_idx
]
*
(
m_PerFaceSquaredArea
[
each_face_B_idx
]
*
dot_prod
);
face_A_normals
[
each_vert_A_idx
]
+=
m_PerFaceNormalsRaw
[
each_face_B_idx
]
*
(
m_PerFaceSquaredArea
[
each_face_B_idx
]
*
dot_prod
);
...
@@ -411,10 +409,7 @@ void S3D_MESH::calcPerPointNormals ()
...
@@ -411,10 +409,7 @@ void S3D_MESH::calcPerPointNormals ()
float
l
=
glm
::
length
(
face_A_normals
[
each_vert_A_idx
]
);
float
l
=
glm
::
length
(
face_A_normals
[
each_vert_A_idx
]
);
if
(
l
>
FLT_EPSILON
)
// avoid division by zero
if
(
l
>
FLT_EPSILON
)
// avoid division by zero
{
face_A_normals
[
each_vert_A_idx
]
/=
l
;
face_A_normals
[
each_vert_A_idx
]
/=
l
;
}
}
}
}
}
}
}
3d-viewer/modelparsers.h
View file @
1bd70efc
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
* This program source code file is part of KiCad, a free EDA CAD application.
*
*
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
* Copyright (C) 1992-201
3
KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-201
5
KiCad Developers, see AUTHORS.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* modify it under the terms of the GNU General Public License
...
@@ -45,7 +45,7 @@ class X3D_MODEL_PARSER;
...
@@ -45,7 +45,7 @@ class X3D_MODEL_PARSER;
class
S3D_MODEL_PARSER
class
S3D_MODEL_PARSER
{
{
public
:
public
:
S3D_MODEL_PARSER
(
S3D_MASTER
*
aMaster
)
:
S3D_MODEL_PARSER
(
S3D_MASTER
*
aMaster
)
:
master
(
aMaster
)
master
(
aMaster
)
{}
{}
...
@@ -96,7 +96,7 @@ public:
...
@@ -96,7 +96,7 @@ public:
void
Load
(
const
wxString
&
aFilename
,
double
aVrmlunits_to_3Dunits
);
void
Load
(
const
wxString
&
aFilename
,
double
aVrmlunits_to_3Dunits
);
typedef
std
::
map
<
wxString
,
wxString
>
PROPERTY_MAP
;
typedef
std
::
map
<
wxString
,
wxString
>
PROPERTY_MAP
;
typedef
std
::
vector
<
wxXmlNode
*
>
NODE_LIST
;
typedef
std
::
vector
<
wxXmlNode
*
>
NODE_LIST
;
/**
/**
* Function GetChildsByName
* Function GetChildsByName
...
@@ -125,9 +125,9 @@ public:
...
@@ -125,9 +125,9 @@ public:
wxString
VRML2_representation
();
wxString
VRML2_representation
();
private
:
private
:
wxString
m_Filename
;
wxString
m_Filename
;
S3D_MESH
*
m_model
;
S3D_MESH
*
m_model
;
std
::
vector
<
S3D_MESH
*
>
childs
;
std
::
vector
<
S3D_MESH
*
>
childs
;
std
::
vector
<
wxString
>
vrml_materials
;
std
::
vector
<
wxString
>
vrml_materials
;
std
::
vector
<
wxString
>
vrml_points
;
std
::
vector
<
wxString
>
vrml_points
;
...
@@ -142,6 +142,7 @@ private:
...
@@ -142,6 +142,7 @@ private:
};
};
typedef
std
::
map
<
std
::
string
,
std
::
vector
<
glm
::
vec3
>
>
VRML2_COORDINATE_MAP
;
/**
/**
* class VRML2_MODEL_PARSER
* class VRML2_MODEL_PARSER
...
@@ -165,25 +166,30 @@ public:
...
@@ -165,25 +166,30 @@ public:
private
:
private
:
int
read_Transform
();
int
read_Transform
();
int
read_DEF
();
int
read_DEF
();
int
read_DEF_Coordinate
();
int
read_Shape
();
int
read_Shape
();
int
read_Appearance
();
int
read_Appearance
();
int
read_material
();
int
read_material
();
int
read_Material
();
int
read_Material
();
int
read_IndexedFaceSet
();
int
read_IndexedFaceSet
();
int
read_IndexedLineSet
();
int
read_Coordinate
();
int
read_Coordinate
();
int
read_CoordinateDef
();
int
read_Normal
();
int
read_Normal
();
int
read_NormalIndex
();
int
read_NormalIndex
();
int
read_Color
();
int
read_Color
();
int
read_coordIndex
();
int
read_coordIndex
();
int
read_colorIndex
();
int
read_colorIndex
();
int
read_USE
();
bool
m_normalPerVertex
;
bool
colorPerVertex
;
bool
m_normalPerVertex
;
S3D_MESH
*
m_model
;
bool
colorPerVertex
;
std
::
vector
<
S3D_MESH
*>
childs
;
S3D_MESH
*
m_model
;
FILE
*
m_file
;
std
::
vector
<
S3D_MESH
*
>
childs
;
S3D_MATERIAL
*
m_Materials
;
FILE
*
m_file
;
wxString
m_Filename
;
S3D_MATERIAL
*
m_Materials
;
wxString
m_Filename
;
VRML2_COORDINATE_MAP
m_defCoordinateMap
;
};
};
...
@@ -224,13 +230,13 @@ private:
...
@@ -224,13 +230,13 @@ private:
int
readIndexedFaceSet_coordIndex
();
int
readIndexedFaceSet_coordIndex
();
int
readIndexedFaceSet_materialIndex
();
int
readIndexedFaceSet_materialIndex
();
bool
m_normalPerVertex
;
bool
m_normalPerVertex
;
bool
colorPerVertex
;
bool
colorPerVertex
;
S3D_MESH
*
m_model
;
S3D_MESH
*
m_model
;
std
::
vector
<
S3D_MESH
*
>
childs
;
std
::
vector
<
S3D_MESH
*
>
childs
;
S3D_MATERIAL
*
m_Materials
;
S3D_MATERIAL
*
m_Materials
;
FILE
*
m_file
;
FILE
*
m_file
;
wxString
m_Filename
;
wxString
m_Filename
;
};
};
/**
/**
...
@@ -246,8 +252,8 @@ public:
...
@@ -246,8 +252,8 @@ public:
void
Load
(
const
wxString
&
aFilename
,
double
aVrmlunits_to_3Dunits
);
void
Load
(
const
wxString
&
aFilename
,
double
aVrmlunits_to_3Dunits
);
private
:
private
:
VRML1_MODEL_PARSER
*
vrml1_parser
;
VRML1_MODEL_PARSER
*
vrml1_parser
;
VRML2_MODEL_PARSER
*
vrml2_parser
;
VRML2_MODEL_PARSER
*
vrml2_parser
;
};
};
...
...
3d-viewer/vrml_v2_modelparser.cpp
View file @
1bd70efc
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-201
4
KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-201
5
KiCad Developers, see AUTHORS.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* modify it under the terms of the GNU General Public License
...
@@ -39,6 +39,16 @@
...
@@ -39,6 +39,16 @@
#include "modelparsers.h"
#include "modelparsers.h"
#include "vrml_aux.h"
#include "vrml_aux.h"
/**
* Trace mask used to enable or disable the trace output of the VRML V2 parser code.
* The debug output can be turned on by setting the WXTRACE environment variable to
* "KI_TRACE_VRML_V2_PARSER". See the wxWidgets documentation on wxLogTrace for
* more information.
*/
static
const
wxChar
*
traceVrmlV2Parser
=
wxT
(
"KI_TRACE_VRML_V2_PARSER"
);
VRML2_MODEL_PARSER
::
VRML2_MODEL_PARSER
(
S3D_MASTER
*
aMaster
)
:
VRML2_MODEL_PARSER
::
VRML2_MODEL_PARSER
(
S3D_MASTER
*
aMaster
)
:
S3D_MODEL_PARSER
(
aMaster
)
S3D_MODEL_PARSER
(
aMaster
)
{
{
...
@@ -59,7 +69,7 @@ void VRML2_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3
...
@@ -59,7 +69,7 @@ void VRML2_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3
{
{
char
text
[
128
];
char
text
[
128
];
// DBG( printf( "Load %s\n", GetChars(aFilename)
) );
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
"Load %s"
),
GetChars
(
aFilename
)
);
m_file
=
wxFopen
(
aFilename
,
wxT
(
"rt"
)
);
m_file
=
wxFopen
(
aFilename
,
wxT
(
"rt"
)
);
if
(
m_file
==
NULL
)
if
(
m_file
==
NULL
)
...
@@ -117,9 +127,6 @@ void VRML2_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3
...
@@ -117,9 +127,6 @@ void VRML2_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3
fclose
(
m_file
);
fclose
(
m_file
);
// DBG( printf( "chils size:%lu\n", childs.size() ) );
if
(
GetMaster
()
->
IsOpenGlAllowed
()
)
if
(
GetMaster
()
->
IsOpenGlAllowed
()
)
{
{
for
(
unsigned
int
idx
=
0
;
idx
<
childs
.
size
();
idx
++
)
for
(
unsigned
int
idx
=
0
;
idx
<
childs
.
size
();
idx
++
)
...
@@ -134,8 +141,6 @@ int VRML2_MODEL_PARSER::read_Transform()
...
@@ -134,8 +141,6 @@ int VRML2_MODEL_PARSER::read_Transform()
{
{
char
text
[
128
];
char
text
[
128
];
// DBG( printf( "Transform\n" ) );
while
(
GetNextTag
(
m_file
,
text
)
)
while
(
GetNextTag
(
m_file
,
text
)
)
{
{
if
(
*
text
==
']'
)
if
(
*
text
==
']'
)
...
@@ -145,7 +150,6 @@ int VRML2_MODEL_PARSER::read_Transform()
...
@@ -145,7 +150,6 @@ int VRML2_MODEL_PARSER::read_Transform()
if
(
*
text
==
'}'
)
if
(
*
text
==
'}'
)
{
{
// DBG( printf( " } Exit Transform\n" ) );
break
;
break
;
}
}
...
@@ -239,7 +243,7 @@ int VRML2_MODEL_PARSER::read_Transform()
...
@@ -239,7 +243,7 @@ int VRML2_MODEL_PARSER::read_Transform()
}
}
else
else
{
{
// DBG( printf( " %s NotImplemented\n", text )
);
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
" %s NotImplemented"
),
text
);
read_NotImplemented
(
m_file
,
'}'
);
read_NotImplemented
(
m_file
,
'}'
);
}
}
}
}
...
@@ -248,24 +252,56 @@ int VRML2_MODEL_PARSER::read_Transform()
...
@@ -248,24 +252,56 @@ int VRML2_MODEL_PARSER::read_Transform()
}
}
/**
* Read the DEF for a Coordinate
*/
int
VRML2_MODEL_PARSER
::
read_DEF_Coordinate
()
{
char
text
[
128
];
// Get the name of the definition.
GetNextTag
(
m_file
,
text
);
std
::
string
coordinateName
=
text
;
while
(
GetNextTag
(
m_file
,
text
)
)
{
if
(
(
text
==
NULL
)
||
(
*
text
==
']'
)
)
continue
;
if
(
(
*
text
==
'}'
)
)
return
0
;
if
(
strcmp
(
text
,
"Coordinate"
)
==
0
)
{
int
retVal
=
read_CoordinateDef
();
if
(
retVal
==
0
)
m_defCoordinateMap
.
insert
(
std
::
make_pair
(
coordinateName
,
m_model
->
m_Point
)
);
return
retVal
;
}
}
return
-
1
;
}
int
VRML2_MODEL_PARSER
::
read_DEF
()
int
VRML2_MODEL_PARSER
::
read_DEF
()
{
{
char
text
[
128
];
char
text
[
128
];
GetNextTag
(
m_file
,
text
);
GetNextTag
(
m_file
,
text
);
// DBG( printf( "DEF %s ", text ) );
while
(
GetNextTag
(
m_file
,
text
)
)
while
(
GetNextTag
(
m_file
,
text
)
)
{
{
if
(
*
text
==
']'
)
if
(
*
text
==
']'
)
{
{
// DBG( printf( " skiping %c\n", *text)
);
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
" skipping %c"
),
*
text
);
continue
;
continue
;
}
}
if
(
*
text
==
'}'
)
if
(
*
text
==
'}'
)
{
{
// DBG( printf( " } Exit DEF\n") );
return
0
;
return
0
;
}
}
...
@@ -301,16 +337,39 @@ int VRML2_MODEL_PARSER::read_DEF()
...
@@ -301,16 +337,39 @@ int VRML2_MODEL_PARSER::read_DEF()
}
}
}
}
// DBG( printf( " DEF failed\n
" ) );
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
" DEF failed
"
)
);
return
-
1
;
return
-
1
;
}
}
int
VRML2_MODEL_PARSER
::
read_
Shape
()
int
VRML2_MODEL_PARSER
::
read_
USE
()
{
{
char
text
[
128
];
char
text
[
128
];
// DBG( printf( " Shape\n") );
// Get the name of the definition.
GetNextTag
(
m_file
,
text
);
std
::
string
coordinateName
=
text
;
// Look for it in our coordinate map.
VRML2_COORDINATE_MAP
::
iterator
coordinate
;
coordinate
=
m_defCoordinateMap
.
find
(
coordinateName
);
// Not previously defined.
if
(
coordinate
==
m_defCoordinateMap
.
end
()
)
{
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
"USE: coordinate %s not previously defined "
"in a DEF section."
),
text
);
return
-
1
;
}
m_model
->
m_Point
=
coordinate
->
second
;
return
0
;
}
int
VRML2_MODEL_PARSER
::
read_Shape
()
{
char
text
[
128
];
while
(
GetNextTag
(
m_file
,
text
)
)
while
(
GetNextTag
(
m_file
,
text
)
)
{
{
...
@@ -321,12 +380,12 @@ int VRML2_MODEL_PARSER::read_Shape()
...
@@ -321,12 +380,12 @@ int VRML2_MODEL_PARSER::read_Shape()
if
(
*
text
==
'}'
)
if
(
*
text
==
'}'
)
{
{
// DBG( printf( " } Exit Shape\n") );
return
0
;
return
0
;
}
}
if
(
strcmp
(
text
,
"appearance"
)
==
0
)
if
(
strcmp
(
text
,
"appearance"
)
==
0
)
{
{
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
"
\"
appearance
\"
key word not supported."
)
);
// skip
// skip
}
}
else
if
(
strcmp
(
text
,
"Appearance"
)
==
0
)
else
if
(
strcmp
(
text
,
"Appearance"
)
==
0
)
...
@@ -335,20 +394,25 @@ int VRML2_MODEL_PARSER::read_Shape()
...
@@ -335,20 +394,25 @@ int VRML2_MODEL_PARSER::read_Shape()
}
}
else
if
(
strcmp
(
text
,
"geometry"
)
==
0
)
else
if
(
strcmp
(
text
,
"geometry"
)
==
0
)
{
{
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
"
\"
geometry
\"
key word not supported."
)
);
// skip
// skip
}
}
else
if
(
strcmp
(
text
,
"IndexedFaceSet"
)
==
0
)
else
if
(
strcmp
(
text
,
"IndexedFaceSet"
)
==
0
)
{
{
read_IndexedFaceSet
();
read_IndexedFaceSet
();
}
}
else
if
(
strcmp
(
text
,
"IndexedLineSet"
)
==
0
)
{
read_IndexedLineSet
();
}
else
else
{
{
// DBG( printf( " %s NotImplemented\n", text )
);
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
" %s NotImplemented"
),
text
);
read_NotImplemented
(
m_file
,
'}'
);
read_NotImplemented
(
m_file
,
'}'
);
}
}
}
}
// DBG( printf( " Shape failed\n
" ) );
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
" Shape failed
"
)
);
return
-
1
;
return
-
1
;
}
}
...
@@ -357,8 +421,6 @@ int VRML2_MODEL_PARSER::read_Appearance()
...
@@ -357,8 +421,6 @@ int VRML2_MODEL_PARSER::read_Appearance()
{
{
char
text
[
128
];
char
text
[
128
];
// DBG( printf( " Appearance\n") );
while
(
GetNextTag
(
m_file
,
text
)
)
while
(
GetNextTag
(
m_file
,
text
)
)
{
{
if
(
*
text
==
']'
)
if
(
*
text
==
']'
)
...
@@ -377,7 +439,7 @@ int VRML2_MODEL_PARSER::read_Appearance()
...
@@ -377,7 +439,7 @@ int VRML2_MODEL_PARSER::read_Appearance()
}
}
}
}
// DBG( printf( " Appearance failed\n
" ) );
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
" Appearance failed
"
)
);
return
-
1
;
return
-
1
;
}
}
...
@@ -387,8 +449,6 @@ int VRML2_MODEL_PARSER::read_material()
...
@@ -387,8 +449,6 @@ int VRML2_MODEL_PARSER::read_material()
S3D_MATERIAL
*
material
=
NULL
;
S3D_MATERIAL
*
material
=
NULL
;
char
text
[
128
];
char
text
[
128
];
// DBG( printf( " material ") );
if
(
GetNextTag
(
m_file
,
text
)
)
if
(
GetNextTag
(
m_file
,
text
)
)
{
{
if
(
strcmp
(
text
,
"Material"
)
==
0
)
if
(
strcmp
(
text
,
"Material"
)
==
0
)
...
@@ -405,12 +465,8 @@ int VRML2_MODEL_PARSER::read_material()
...
@@ -405,12 +465,8 @@ int VRML2_MODEL_PARSER::read_material()
}
}
else
if
(
strcmp
(
text
,
"DEF"
)
==
0
)
else
if
(
strcmp
(
text
,
"DEF"
)
==
0
)
{
{
// DBG( printf( "DEF") );
if
(
GetNextTag
(
m_file
,
text
)
)
if
(
GetNextTag
(
m_file
,
text
)
)
{
{
// DBG( printf( "%s", text ) );
wxString
mat_name
;
wxString
mat_name
;
mat_name
=
FROM_UTF8
(
text
);
mat_name
=
FROM_UTF8
(
text
);
...
@@ -429,12 +485,8 @@ int VRML2_MODEL_PARSER::read_material()
...
@@ -429,12 +485,8 @@ int VRML2_MODEL_PARSER::read_material()
}
}
else
if
(
strcmp
(
text
,
"USE"
)
==
0
)
else
if
(
strcmp
(
text
,
"USE"
)
==
0
)
{
{
// DBG( printf( "USE") );
if
(
GetNextTag
(
m_file
,
text
)
)
if
(
GetNextTag
(
m_file
,
text
)
)
{
{
// DBG( printf( "%s\n", text ) );
wxString
mat_name
;
wxString
mat_name
;
mat_name
=
FROM_UTF8
(
text
);
mat_name
=
FROM_UTF8
(
text
);
...
@@ -447,12 +499,12 @@ int VRML2_MODEL_PARSER::read_material()
...
@@ -447,12 +499,12 @@ int VRML2_MODEL_PARSER::read_material()
}
}
}
}
DBG
(
printf
(
" read_material error: material not found
\n
"
)
);
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
" read_material error: material not found
"
)
);
}
}
}
}
}
}
// DBG( printf( " failed material\n
" ) );
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
" failed material
"
)
);
return
-
1
;
return
-
1
;
}
}
...
@@ -462,8 +514,6 @@ int VRML2_MODEL_PARSER::read_Material()
...
@@ -462,8 +514,6 @@ int VRML2_MODEL_PARSER::read_Material()
char
text
[
128
];
char
text
[
128
];
glm
::
vec3
vertex
;
glm
::
vec3
vertex
;
// DBG( printf( " Material\n") );
while
(
GetNextTag
(
m_file
,
text
)
)
while
(
GetNextTag
(
m_file
,
text
)
)
{
{
if
(
*
text
==
']'
)
if
(
*
text
==
']'
)
...
@@ -478,17 +528,13 @@ int VRML2_MODEL_PARSER::read_Material()
...
@@ -478,17 +528,13 @@ int VRML2_MODEL_PARSER::read_Material()
if
(
strcmp
(
text
,
"diffuseColor"
)
==
0
)
if
(
strcmp
(
text
,
"diffuseColor"
)
==
0
)
{
{
// DBG( printf( " diffuseColor") );
parseVertex
(
m_file
,
vertex
);
parseVertex
(
m_file
,
vertex
);
// DBG( printf( "\n") );
m_model
->
m_Materials
->
m_DiffuseColor
.
push_back
(
vertex
);
m_model
->
m_Materials
->
m_DiffuseColor
.
push_back
(
vertex
);
}
}
else
if
(
strcmp
(
text
,
"emissiveColor"
)
==
0
)
else
if
(
strcmp
(
text
,
"emissiveColor"
)
==
0
)
{
{
// DBG( printf( " emissiveColor") );
parseVertex
(
m_file
,
vertex
);
parseVertex
(
m_file
,
vertex
);
// DBG( printf( "\n") );
if
(
GetMaster
()
->
m_use_modelfile_emissiveColor
==
true
)
if
(
GetMaster
()
->
m_use_modelfile_emissiveColor
==
true
)
{
{
m_model
->
m_Materials
->
m_EmissiveColor
.
push_back
(
vertex
);
m_model
->
m_Materials
->
m_EmissiveColor
.
push_back
(
vertex
);
...
@@ -496,9 +542,7 @@ int VRML2_MODEL_PARSER::read_Material()
...
@@ -496,9 +542,7 @@ int VRML2_MODEL_PARSER::read_Material()
}
}
else
if
(
strcmp
(
text
,
"specularColor"
)
==
0
)
else
if
(
strcmp
(
text
,
"specularColor"
)
==
0
)
{
{
// DBG( printf( " specularColor") );
parseVertex
(
m_file
,
vertex
);
parseVertex
(
m_file
,
vertex
);
// DBG( printf( "\n") );
if
(
GetMaster
()
->
m_use_modelfile_specularColor
==
true
)
if
(
GetMaster
()
->
m_use_modelfile_specularColor
==
true
)
{
{
...
@@ -509,7 +553,6 @@ int VRML2_MODEL_PARSER::read_Material()
...
@@ -509,7 +553,6 @@ int VRML2_MODEL_PARSER::read_Material()
{
{
float
ambientIntensity
;
float
ambientIntensity
;
parseFloat
(
m_file
,
&
ambientIntensity
);
parseFloat
(
m_file
,
&
ambientIntensity
);
// DBG( printf( " ambientIntensity %f\n", ambientIntensity) );
if
(
GetMaster
()
->
m_use_modelfile_ambientIntensity
==
true
)
if
(
GetMaster
()
->
m_use_modelfile_ambientIntensity
==
true
)
{
{
...
@@ -521,7 +564,6 @@ int VRML2_MODEL_PARSER::read_Material()
...
@@ -521,7 +564,6 @@ int VRML2_MODEL_PARSER::read_Material()
{
{
float
transparency
;
float
transparency
;
parseFloat
(
m_file
,
&
transparency
);
parseFloat
(
m_file
,
&
transparency
);
// DBG( printf( " transparency %f\n", transparency) );
if
(
GetMaster
()
->
m_use_modelfile_transparency
==
true
)
if
(
GetMaster
()
->
m_use_modelfile_transparency
==
true
)
{
{
...
@@ -533,7 +575,6 @@ int VRML2_MODEL_PARSER::read_Material()
...
@@ -533,7 +575,6 @@ int VRML2_MODEL_PARSER::read_Material()
float
shininess
;
float
shininess
;
parseFloat
(
m_file
,
&
shininess
);
parseFloat
(
m_file
,
&
shininess
);
// DBG( printf( " shininess %f\n", shininess) );
// VRML value is normalized and openGL expects a value 0 - 128
// VRML value is normalized and openGL expects a value 0 - 128
if
(
GetMaster
()
->
m_use_modelfile_shininess
==
true
)
if
(
GetMaster
()
->
m_use_modelfile_shininess
==
true
)
{
{
...
@@ -543,7 +584,7 @@ int VRML2_MODEL_PARSER::read_Material()
...
@@ -543,7 +584,7 @@ int VRML2_MODEL_PARSER::read_Material()
}
}
}
}
// DBG( printf
( " Material failed\n" ) );
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
" Material failed
\n
"
)
);
return
-
1
;
return
-
1
;
}
}
...
@@ -552,8 +593,6 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
...
@@ -552,8 +593,6 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
{
{
char
text
[
128
];
char
text
[
128
];
// DBG( printf( " IndexedFaceSet\n") );
m_normalPerVertex
=
false
;
m_normalPerVertex
=
false
;
colorPerVertex
=
false
;
colorPerVertex
=
false
;
...
@@ -566,7 +605,6 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
...
@@ -566,7 +605,6 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
if
(
*
text
==
'}'
)
if
(
*
text
==
'}'
)
{
{
// DBG( printf( " } Exit IndexedFaceSet\n") );
return
0
;
return
0
;
}
}
...
@@ -576,7 +614,6 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
...
@@ -576,7 +614,6 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
{
{
if
(
strcmp
(
text
,
"TRUE"
)
==
0
)
if
(
strcmp
(
text
,
"TRUE"
)
==
0
)
{
{
// DBG( printf( " m_normalPerVertex TRUE\n") );
m_normalPerVertex
=
true
;
m_normalPerVertex
=
true
;
}
}
}
}
...
@@ -587,7 +624,6 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
...
@@ -587,7 +624,6 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
if
(
strcmp
(
text
,
"TRUE"
)
)
if
(
strcmp
(
text
,
"TRUE"
)
)
{
{
// DBG( printf( " colorPerVertex = true\n") );
colorPerVertex
=
true
;
colorPerVertex
=
true
;
}
}
else
else
...
@@ -619,17 +655,43 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
...
@@ -619,17 +655,43 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
{
{
read_colorIndex
();
read_colorIndex
();
}
}
else
if
(
strcmp
(
text
,
"USE"
)
==
0
)
{
read_USE
();
}
}
}
// DBG( printf( " IndexedFaceSet failed %s\n", text )
);
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
" IndexedFaceSet failed %s"
),
text
);
return
-
1
;
return
-
1
;
}
}
int
VRML2_MODEL_PARSER
::
read_
colorIndex
()
int
VRML2_MODEL_PARSER
::
read_
IndexedLineSet
()
{
{
// DBG( printf( " read_colorIndex\n" ) )
;
char
text
[
128
]
;
while
(
GetNextTag
(
m_file
,
text
)
)
{
if
(
(
text
==
NULL
)
||
(
*
text
==
']'
)
)
continue
;
if
(
(
*
text
==
'}'
)
)
return
0
;
if
(
strcmp
(
text
,
"Coordinate"
)
==
0
)
read_Coordinate
();
else
if
(
strcmp
(
text
,
"coordIndex"
)
==
0
)
read_coordIndex
();
else
if
(
strcmp
(
text
,
"DEF"
)
==
0
)
read_DEF_Coordinate
();
}
return
-
1
;
}
int
VRML2_MODEL_PARSER
::
read_colorIndex
()
{
m_model
->
m_MaterialIndex
.
clear
();
m_model
->
m_MaterialIndex
.
clear
();
if
(
colorPerVertex
==
true
)
if
(
colorPerVertex
==
true
)
...
@@ -660,16 +722,12 @@ int VRML2_MODEL_PARSER::read_colorIndex()
...
@@ -660,16 +722,12 @@ int VRML2_MODEL_PARSER::read_colorIndex()
}
}
}
}
// DBG( printf( " m_MaterialIndex.size: %ld\n", m_model->m_MaterialIndex.size() ) );
return
0
;
return
0
;
}
}
int
VRML2_MODEL_PARSER
::
read_NormalIndex
()
int
VRML2_MODEL_PARSER
::
read_NormalIndex
()
{
{
// DBG( printf( " read_NormalIndex\n" ) );
m_model
->
m_NormalIndex
.
clear
();
m_model
->
m_NormalIndex
.
clear
();
glm
::
ivec3
coord
;
glm
::
ivec3
coord
;
...
@@ -684,26 +742,20 @@ int VRML2_MODEL_PARSER::read_NormalIndex()
...
@@ -684,26 +742,20 @@ int VRML2_MODEL_PARSER::read_NormalIndex()
if
(
dummy
==
-
1
)
if
(
dummy
==
-
1
)
{
{
m_model
->
m_NormalIndex
.
push_back
(
coord_list
);
m_model
->
m_NormalIndex
.
push_back
(
coord_list
);
// DBG( printf( " size: %lu ", coord_list.size()) );
coord_list
.
clear
();
coord_list
.
clear
();
}
}
else
else
{
{
coord_list
.
push_back
(
dummy
);
coord_list
.
push_back
(
dummy
);
// DBG( printf( "%d ", dummy) );
}
}
}
}
// DBG( printf( " m_NormalIndex.size: %ld\n", m_model->m_NormalIndex.size() ) );
return
0
;
return
0
;
}
}
int
VRML2_MODEL_PARSER
::
read_coordIndex
()
int
VRML2_MODEL_PARSER
::
read_coordIndex
()
{
{
// DBG( printf( " read_coordIndex\n" ) );
m_model
->
m_CoordIndex
.
clear
();
m_model
->
m_CoordIndex
.
clear
();
glm
::
ivec3
coord
;
glm
::
ivec3
coord
;
...
@@ -718,18 +770,14 @@ int VRML2_MODEL_PARSER::read_coordIndex()
...
@@ -718,18 +770,14 @@ int VRML2_MODEL_PARSER::read_coordIndex()
if
(
dummy
==
-
1
)
if
(
dummy
==
-
1
)
{
{
m_model
->
m_CoordIndex
.
push_back
(
coord_list
);
m_model
->
m_CoordIndex
.
push_back
(
coord_list
);
// DBG( printf( " size: %lu ", coord_list.size()) );
coord_list
.
clear
();
coord_list
.
clear
();
}
}
else
else
{
{
coord_list
.
push_back
(
dummy
);
coord_list
.
push_back
(
dummy
);
// DBG( printf( "%d ", dummy) );
}
}
}
}
// DBG( printf( " m_CoordIndex.size: %ld\n", m_model->m_CoordIndex.size() ) );
return
0
;
return
0
;
}
}
...
@@ -738,8 +786,6 @@ int VRML2_MODEL_PARSER::read_Color()
...
@@ -738,8 +786,6 @@ int VRML2_MODEL_PARSER::read_Color()
{
{
char
text
[
128
];
char
text
[
128
];
// DBG( printf( " read_Color\n") );
while
(
GetNextTag
(
m_file
,
text
)
)
while
(
GetNextTag
(
m_file
,
text
)
)
{
{
if
(
*
text
==
']'
)
if
(
*
text
==
']'
)
...
@@ -749,7 +795,6 @@ int VRML2_MODEL_PARSER::read_Color()
...
@@ -749,7 +795,6 @@ int VRML2_MODEL_PARSER::read_Color()
if
(
*
text
==
'}'
)
if
(
*
text
==
'}'
)
{
{
// DBG( printf( " m_DiffuseColor.size: %ld\n", m_model->m_Materials->m_DiffuseColor.size() ) );
return
0
;
return
0
;
}
}
...
@@ -759,7 +804,7 @@ int VRML2_MODEL_PARSER::read_Color()
...
@@ -759,7 +804,7 @@ int VRML2_MODEL_PARSER::read_Color()
}
}
}
}
// DBG( printf( " read_Color failed\n"
) );
wxLogTrace
(
traceVrmlV2Parser
,
wxT
(
" read_Color failed"
)
);
return
-
1
;
return
-
1
;
}
}
...
@@ -768,8 +813,6 @@ int VRML2_MODEL_PARSER::read_Normal()
...
@@ -768,8 +813,6 @@ int VRML2_MODEL_PARSER::read_Normal()
{
{
char
text
[
128
];
char
text
[
128
];
// DBG( printf( " Normal\n") );
while
(
GetNextTag
(
m_file
,
text
)
)
while
(
GetNextTag
(
m_file
,
text
)
)
{
{
if
(
*
text
==
']'
)
if
(
*
text
==
']'
)
...
@@ -779,7 +822,6 @@ int VRML2_MODEL_PARSER::read_Normal()
...
@@ -779,7 +822,6 @@ int VRML2_MODEL_PARSER::read_Normal()
if
(
*
text
==
'}'
)
if
(
*
text
==
'}'
)
{
{
// DBG( printf( " m_PerFaceNormalsNormalized.size: %lu\n", m_model->m_PerFaceNormalsNormalized.size() ) );
return
0
;
return
0
;
}
}
...
@@ -792,8 +834,6 @@ int VRML2_MODEL_PARSER::read_Normal()
...
@@ -792,8 +834,6 @@ int VRML2_MODEL_PARSER::read_Normal()
else
else
{
{
parseVertexList
(
m_file
,
m_model
->
m_PerVertexNormalsNormalized
);
parseVertexList
(
m_file
,
m_model
->
m_PerVertexNormalsNormalized
);
// DBG( printf( " m_PerVertexNormalsNormalized.size: %lu\n", m_model->m_PerVertexNormalsNormalized.size() ) );
}
}
}
}
}
}
...
@@ -806,8 +846,6 @@ int VRML2_MODEL_PARSER::read_Coordinate()
...
@@ -806,8 +846,6 @@ int VRML2_MODEL_PARSER::read_Coordinate()
{
{
char
text
[
128
];
char
text
[
128
];
// DBG( printf( " Coordinate\n") );
while
(
GetNextTag
(
m_file
,
text
)
)
while
(
GetNextTag
(
m_file
,
text
)
)
{
{
if
(
*
text
==
']'
)
if
(
*
text
==
']'
)
...
@@ -817,7 +855,6 @@ int VRML2_MODEL_PARSER::read_Coordinate()
...
@@ -817,7 +855,6 @@ int VRML2_MODEL_PARSER::read_Coordinate()
if
(
*
text
==
'}'
)
if
(
*
text
==
'}'
)
{
{
// DBG( printf( " m_Point.size: %lu\n", m_model->m_Point.size() ) );
return
0
;
return
0
;
}
}
...
@@ -829,3 +866,26 @@ int VRML2_MODEL_PARSER::read_Coordinate()
...
@@ -829,3 +866,26 @@ int VRML2_MODEL_PARSER::read_Coordinate()
return
-
1
;
return
-
1
;
}
}
/**
* Read the point of the Coordinate for a DEF
*/
int
VRML2_MODEL_PARSER
::
read_CoordinateDef
()
{
char
text
[
128
];
while
(
GetNextTag
(
m_file
,
text
)
)
{
if
(
(
text
==
NULL
)
||
(
*
text
==
']'
)
)
continue
;
if
(
(
*
text
==
'}'
)
)
return
0
;
if
(
strcmp
(
text
,
"point"
)
==
0
)
parseVertexList
(
m_file
,
m_model
->
m_Point
);
}
return
-
1
;
}
CMakeLists.txt
View file @
1bd70efc
...
@@ -639,7 +639,6 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
...
@@ -639,7 +639,6 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
# FindPythonInterp unless the user specifically defined a custom path.
# FindPythonInterp unless the user specifically defined a custom path.
if
(
NOT PYTHON_SITE_PACKAGE_PATH
)
if
(
NOT PYTHON_SITE_PACKAGE_PATH
)
execute_process
(
COMMAND
${
PYTHON_EXECUTABLE
}
-c
"import distutils.sysconfig;print
\"
%s
\"
%distutils.sysconfig.get_python_lib(plat_specific=0, standard_lib=0, prefix='')"
execute_process
(
COMMAND
${
PYTHON_EXECUTABLE
}
-c
"import distutils.sysconfig;print
\"
%s
\"
%distutils.sysconfig.get_python_lib(plat_specific=0, standard_lib=0, prefix='')"
# execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib()"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH
OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
)
...
@@ -666,6 +665,33 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
...
@@ -666,6 +665,33 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
find_package
(
PythonLibs 2.6
)
find_package
(
PythonLibs 2.6
)
if
(
KICAD_SCRIPTING_WXPYTHON
)
# Check to see if the correct version of wxPython is installed based on the version of
# wxWidgets found. At least the major an minor version should match.
set
(
_wxpy_version
"
${
wxWidgets_VERSION_MAJOR
}
.
${
wxWidgets_VERSION_MINOR
}
"
)
set
(
_py_cmd
"import wxversion;print wxversion.checkInstalled('
${
_wxpy_version
}
')"
)
execute_process
(
COMMAND
${
PYTHON_EXECUTABLE
}
-c
"
${
_py_cmd
}
"
RESULT_VARIABLE WXPYTHON_VERSION_RESULT
OUTPUT_VARIABLE WXPYTHON_VERSION_FOUND
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# message( STATUS "WXPYTHON_VERSION_FOUND: ${WXPYTHON_VERSION_FOUND}" )
# message( STATUS "WXPYTHON_VERSION_RESULT: ${WXPYTHON_VERSION_RESULT}" )
# Check to see if any version of wxPython is installed on the system.
if
(
WXPYTHON_VERSION_RESULT GREATER 0
)
message
(
FATAL_ERROR
"wxPython does not appear to be installed on the system."
)
endif
()
if
(
NOT WXPYTHON_VERSION_FOUND STREQUAL
"True"
)
message
(
FATAL_ERROR
"wxPython version
${
_wxpy_version
}
does not appear to be installed on the system."
)
else
()
set
(
WXPYTHON_VERSION_FOUND
"
${
_wxpy_version
}
"
CACHE STRING
"wxPython version found."
)
endif
()
endif
()
#message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" )
#message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" )
# Infrequently needed headers go at end of search paths, append to INC_AFTER which
# Infrequently needed headers go at end of search paths, append to INC_AFTER which
...
...
CMakeModules/config.h.cmake
View file @
1bd70efc
...
@@ -70,6 +70,11 @@
...
@@ -70,6 +70,11 @@
#define KICAD_DATA_PATH "@CMAKE_INSTALL_PREFIX@/@KICAD_DATA@"
#define KICAD_DATA_PATH "@CMAKE_INSTALL_PREFIX@/@KICAD_DATA@"
#endif
#endif
/// The wxPython version found during configuration.
#if defined( KICAD_SCRIPTING_WXPYTHON )
#define WXPYTHON_VERSION "@WXPYTHON_VERSION_FOUND@"
#endif
/// When defined, build the GITHUB_PLUGIN for pcbnew.
/// When defined, build the GITHUB_PLUGIN for pcbnew.
#cmakedefine BUILD_GITHUB_PLUGIN
#cmakedefine BUILD_GITHUB_PLUGIN
...
...
common/draw_panel_gal.cpp
View file @
1bd70efc
/*
/*
* This program source code file is part of KiCad, a free EDA CAD application.
* This program source code file is part of KiCad, a free EDA CAD application.
*
*
* Copyright (C) 2013-201
4
CERN
* Copyright (C) 2013-201
5
CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* modify it under the terms of the GNU General Public License
...
@@ -28,6 +29,7 @@
...
@@ -28,6 +29,7 @@
#include <wx/event.h>
#include <wx/event.h>
#include <wx/colour.h>
#include <wx/colour.h>
#include <wx/filename.h>
#include <wx/filename.h>
#include <confirm.h>
#include <kiface_i.h>
#include <kiface_i.h>
#include <class_draw_panel_gal.h>
#include <class_draw_panel_gal.h>
...
@@ -133,30 +135,30 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
...
@@ -133,30 +135,30 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
m_pendingRefresh
=
false
;
m_pendingRefresh
=
false
;
m_lastRefresh
=
wxGetLocalTimeMillis
();
m_lastRefresh
=
wxGetLocalTimeMillis
();
if
(
!
m_drawing
)
if
(
m_drawing
)
{
return
;
m_drawing
=
true
;
m_view
->
UpdateItems
();
m_drawing
=
true
;
m_gal
->
BeginDrawing
();
m_gal
->
ClearScreen
(
m_painter
->
GetSettings
()
->
GetBackgroundColor
()
);
if
(
m_view
->
IsDirty
()
)
m_view
->
UpdateItems
();
{
m_gal
->
BeginDrawing
();
m_view
->
ClearTargets
(
);
m_gal
->
ClearScreen
(
m_painter
->
GetSettings
()
->
GetBackgroundColor
()
);
// Grid has to be redrawn only when the NONCACHED target is redrawn
if
(
m_view
->
IsDirty
()
)
if
(
m_view
->
IsTargetDirty
(
KIGFX
::
TARGET_NONCACHED
)
)
{
m_view
->
ClearTargets
();
// Grid has to be redrawn only when the NONCACHED target is redrawn
if
(
m_view
->
IsTargetDirty
(
KIGFX
::
TARGET_NONCACHED
)
)
m_gal
->
DrawGrid
();
m_gal
->
DrawGrid
();
m_view
->
Redraw
();
m_view
->
Redraw
();
}
}
m_gal
->
DrawCursor
(
m_viewControls
->
GetCursorPosition
()
);
m_gal
->
DrawCursor
(
m_viewControls
->
GetCursorPosition
()
);
m_gal
->
EndDrawing
();
m_gal
->
EndDrawing
();
m_drawing
=
false
;
m_drawing
=
false
;
}
}
}
...
@@ -250,7 +252,8 @@ void EDA_DRAW_PANEL_GAL::SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher )
...
@@ -250,7 +252,8 @@ void EDA_DRAW_PANEL_GAL::SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher )
void
EDA_DRAW_PANEL_GAL
::
StartDrawing
()
void
EDA_DRAW_PANEL_GAL
::
StartDrawing
()
{
{
m_pendingRefresh
=
false
;
m_drawing
=
false
;
m_pendingRefresh
=
true
;
Connect
(
wxEVT_PAINT
,
wxPaintEventHandler
(
EDA_DRAW_PANEL_GAL
::
onPaint
),
NULL
,
this
);
Connect
(
wxEVT_PAINT
,
wxPaintEventHandler
(
EDA_DRAW_PANEL_GAL
::
onPaint
),
NULL
,
this
);
wxPaintEvent
redrawEvent
;
wxPaintEvent
redrawEvent
;
...
@@ -260,7 +263,8 @@ void EDA_DRAW_PANEL_GAL::StartDrawing()
...
@@ -260,7 +263,8 @@ void EDA_DRAW_PANEL_GAL::StartDrawing()
void
EDA_DRAW_PANEL_GAL
::
StopDrawing
()
void
EDA_DRAW_PANEL_GAL
::
StopDrawing
()
{
{
m_pendingRefresh
=
true
;
m_pendingRefresh
=
false
;
m_drawing
=
true
;
m_refreshTimer
.
Stop
();
m_refreshTimer
.
Stop
();
Disconnect
(
wxEVT_PAINT
,
wxPaintEventHandler
(
EDA_DRAW_PANEL_GAL
::
onPaint
),
NULL
,
this
);
Disconnect
(
wxEVT_PAINT
,
wxPaintEventHandler
(
EDA_DRAW_PANEL_GAL
::
onPaint
),
NULL
,
this
);
}
}
...
@@ -288,41 +292,54 @@ void EDA_DRAW_PANEL_GAL::SetTopLayer( LAYER_ID aLayer )
...
@@ -288,41 +292,54 @@ void EDA_DRAW_PANEL_GAL::SetTopLayer( LAYER_ID aLayer )
}
}
void
EDA_DRAW_PANEL_GAL
::
SwitchBackend
(
GalType
aGalType
)
bool
EDA_DRAW_PANEL_GAL
::
SwitchBackend
(
GalType
aGalType
)
{
{
// Do not do anything if the currently used GAL is correct
// Do not do anything if the currently used GAL is correct
if
(
aGalType
==
m_backend
&&
m_gal
!=
NULL
)
if
(
aGalType
==
m_backend
&&
m_gal
!=
NULL
)
return
;
return
true
;
// Prevent refreshing canvas during backend switch
// Prevent refreshing canvas during backend switch
StopDrawing
();
StopDrawing
();
delete
m_gal
;
KIGFX
::
GAL
*
new_gal
=
NULL
;
switch
(
aGalType
)
try
{
{
case
GAL_TYPE_OPENGL
:
switch
(
aGalType
)
m_gal
=
new
KIGFX
::
OPENGL_GAL
(
this
,
this
,
this
);
{
break
;
case
GAL_TYPE_OPENGL
:
new_gal
=
new
KIGFX
::
OPENGL_GAL
(
this
,
this
,
this
);
break
;
case
GAL_TYPE_CAIRO
:
case
GAL_TYPE_CAIRO
:
m
_gal
=
new
KIGFX
::
CAIRO_GAL
(
this
,
this
,
this
);
new
_gal
=
new
KIGFX
::
CAIRO_GAL
(
this
,
this
,
this
);
break
;
break
;
case
GAL_TYPE_NONE
:
case
GAL_TYPE_NONE
:
return
;
return
false
;
}
}
wxSize
size
=
GetClientSize
()
;
delete
m_gal
;
m_gal
->
ResizeScreen
(
size
.
GetX
(),
size
.
GetY
()
)
;
m_gal
=
new_gal
;
if
(
m_painter
)
wxSize
size
=
GetClientSize
();
m_
painter
->
SetGAL
(
m_gal
);
m_
gal
->
ResizeScreen
(
size
.
GetX
(),
size
.
GetY
()
);
if
(
m_view
)
if
(
m_painter
)
m_view
->
SetGAL
(
m_gal
);
m_painter
->
SetGAL
(
m_gal
);
if
(
m_view
)
m_view
->
SetGAL
(
m_gal
);
m_backend
=
aGalType
;
}
catch
(
std
::
runtime_error
&
err
)
{
DisplayError
(
m_parent
,
wxString
(
err
.
what
()
)
);
return
false
;
}
m_backend
=
aGalTyp
e
;
return
tru
e
;
}
}
...
...
common/gal/opengl/opengl_compositor.cpp
View file @
1bd70efc
/*
/*
* This program source code file is part of KiCad, a free EDA CAD application.
* This program source code file is part of KiCad, a free EDA CAD application.
*
*
* Copyright (C) 2013 CERN
* Copyright (C) 2013
-2015
CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
...
@@ -24,13 +24,14 @@
...
@@ -24,13 +24,14 @@
/**
/**
* @file opengl_compositor.cpp
* @file opengl_compositor.cpp
* @brief Class that handles multitarget rendering (ie. to different textures/surfaces) and
* @brief Class that handles multitarget rendering (i
.
e. to different textures/surfaces) and
* later compositing into a single image (OpenGL flavour).
* later compositing into a single image (OpenGL flavour).
*/
*/
#include <gal/opengl/opengl_compositor.h>
#include <gal/opengl/opengl_compositor.h>
#include <wx/msgdlg.h>
#include <confirm.h>
#include <stdexcept>
#include <cassert>
using
namespace
KIGFX
;
using
namespace
KIGFX
;
...
@@ -89,7 +90,7 @@ void OPENGL_COMPOSITOR::Resize( unsigned int aWidth, unsigned int aHeight )
...
@@ -89,7 +90,7 @@ void OPENGL_COMPOSITOR::Resize( unsigned int aWidth, unsigned int aHeight )
unsigned
int
OPENGL_COMPOSITOR
::
CreateBuffer
()
unsigned
int
OPENGL_COMPOSITOR
::
CreateBuffer
()
{
{
wxASSERT
(
m_initialized
);
assert
(
m_initialized
);
unsigned
int
maxBuffers
;
unsigned
int
maxBuffers
;
...
@@ -98,10 +99,9 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
...
@@ -98,10 +99,9 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
if
(
usedBuffers
()
>=
maxBuffers
)
if
(
usedBuffers
()
>=
maxBuffers
)
{
{
DisplayError
(
NULL
,
wxT
(
"Cannot create more framebuffers. OpenGL rendering "
throw
std
::
runtime_error
(
"Cannot create more framebuffers. OpenGL rendering "
"backend requires at least 3 framebuffers. You may try to update/change "
"backend requires at least 3 framebuffers. You may try to update/change "
"your graphic drivers."
)
);
"your graphic drivers."
);
return
0
;
// Unfortunately we have no more free buffers left
}
}
// GL_COLOR_ATTACHMENTn are consecutive integers
// GL_COLOR_ATTACHMENTn are consecutive integers
...
@@ -133,38 +133,38 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
...
@@ -133,38 +133,38 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
switch
(
status
)
switch
(
status
)
{
{
case
GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT
:
case
GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT
:
DisplayError
(
NULL
,
wxT
(
"Cannot create the framebuffer."
)
);
throw
std
::
runtime_error
(
"Cannot create the framebuffer."
);
break
;
break
;
case
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT
:
case
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT
:
DisplayError
(
NULL
,
wxT
(
"The framebuffer attachment points are incomplete."
)
);
throw
std
::
runtime_error
(
"The framebuffer attachment points are incomplete."
);
break
;
break
;
case
GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT
:
case
GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT
:
DisplayError
(
NULL
,
wxT
(
"The framebuffer does not have at least
"
throw
std
::
runtime_error
(
"The framebuffer does not have at least one
"
"one image attached to it."
)
);
"image attached to it."
);
break
;
break
;
case
GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT
:
case
GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT
:
DisplayError
(
NULL
,
wxT
(
"The framebuffer read buffer is incomplete."
)
);
throw
std
::
runtime_error
(
"The framebuffer read buffer is incomplete."
);
break
;
break
;
case
GL_FRAMEBUFFER_UNSUPPORTED_EXT
:
case
GL_FRAMEBUFFER_UNSUPPORTED_EXT
:
DisplayError
(
NULL
,
wxT
(
"The combination of internal formats of the attached images
"
throw
std
::
runtime_error
(
"The combination of internal formats of the attached
"
"violates an implementation-dependent set of restrictions."
)
);
"images violates an implementation-dependent set of restrictions."
);
break
;
break
;
case
GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT
:
case
GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT
:
DisplayError
(
NULL
,
wxT
(
"GL_RENDERBUFFER_SAMPLES is not the same
"
throw
std
::
runtime_error
(
"GL_RENDERBUFFER_SAMPLES is not the same for
"
"for all attached renderbuffers"
)
);
"all attached renderbuffers"
);
break
;
break
;
case
GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT
:
case
GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT
:
DisplayError
(
NULL
,
wxT
(
"Framebuffer incomplete layer targets errors."
)
);
throw
std
::
runtime_error
(
"Framebuffer incomplete layer targets errors."
);
break
;
break
;
default
:
default
:
DisplayError
(
NULL
,
wxT
(
"Cannot create the framebuffer."
)
);
throw
std
::
runtime_error
(
"Cannot create the framebuffer."
);
break
;
break
;
}
}
...
@@ -211,7 +211,7 @@ void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
...
@@ -211,7 +211,7 @@ void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
void
OPENGL_COMPOSITOR
::
ClearBuffer
()
void
OPENGL_COMPOSITOR
::
ClearBuffer
()
{
{
wxASSERT
(
m_initialized
);
assert
(
m_initialized
);
glClearColor
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
);
glClearColor
(
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
);
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
...
@@ -220,8 +220,8 @@ void OPENGL_COMPOSITOR::ClearBuffer()
...
@@ -220,8 +220,8 @@ void OPENGL_COMPOSITOR::ClearBuffer()
void
OPENGL_COMPOSITOR
::
DrawBuffer
(
unsigned
int
aBufferHandle
)
void
OPENGL_COMPOSITOR
::
DrawBuffer
(
unsigned
int
aBufferHandle
)
{
{
wxASSERT
(
m_initialized
);
assert
(
m_initialized
);
wxASSERT
(
aBufferHandle
!=
0
&&
aBufferHandle
<=
usedBuffers
()
);
assert
(
aBufferHandle
!=
0
&&
aBufferHandle
<=
usedBuffers
()
);
// Switch to the main framebuffer and blit the scene
// Switch to the main framebuffer and blit the scene
glBindFramebufferEXT
(
GL_FRAMEBUFFER
,
DIRECT_RENDERING
);
glBindFramebufferEXT
(
GL_FRAMEBUFFER
,
DIRECT_RENDERING
);
...
@@ -267,7 +267,7 @@ void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aBufferHandle )
...
@@ -267,7 +267,7 @@ void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aBufferHandle )
void
OPENGL_COMPOSITOR
::
clean
()
void
OPENGL_COMPOSITOR
::
clean
()
{
{
wxASSERT
(
m_initialized
);
assert
(
m_initialized
);
glBindFramebufferEXT
(
GL_FRAMEBUFFER
,
DIRECT_RENDERING
);
glBindFramebufferEXT
(
GL_FRAMEBUFFER
,
DIRECT_RENDERING
);
m_currentFbo
=
DIRECT_RENDERING
;
m_currentFbo
=
DIRECT_RENDERING
;
...
...
common/gal/opengl/opengl_gal.cpp
View file @
1bd70efc
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2012 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 2012 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 2013 CERN
* Copyright (C) 2013
-2015
CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
*
* Graphics Abstraction Layer (GAL) for OpenGL
* Graphics Abstraction Layer (GAL) for OpenGL
...
@@ -31,7 +31,6 @@
...
@@ -31,7 +31,6 @@
#include <wx/log.h>
#include <wx/log.h>
#include <macros.h>
#include <macros.h>
#include <confirm.h>
#ifdef __WXDEBUG__
#ifdef __WXDEBUG__
#include <profile.h>
#include <profile.h>
#endif
/* __WXDEBUG__ */
#endif
/* __WXDEBUG__ */
...
@@ -51,6 +50,9 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
...
@@ -51,6 +50,9 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
wxEvtHandler
*
aPaintListener
,
const
wxString
&
aName
)
:
wxEvtHandler
*
aPaintListener
,
const
wxString
&
aName
)
:
wxGLCanvas
(
aParent
,
wxID_ANY
,
(
int
*
)
glAttributes
,
wxDefaultPosition
,
wxDefaultSize
,
wxGLCanvas
(
aParent
,
wxID_ANY
,
(
int
*
)
glAttributes
,
wxDefaultPosition
,
wxDefaultSize
,
wxEXPAND
,
aName
),
wxEXPAND
,
aName
),
parentWindow
(
aParent
),
mouseListener
(
aMouseListener
),
paintListener
(
aPaintListener
),
cachedManager
(
true
),
cachedManager
(
true
),
nonCachedManager
(
false
),
nonCachedManager
(
false
),
overlayManager
(
false
)
overlayManager
(
false
)
...
@@ -59,14 +61,29 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
...
@@ -59,14 +61,29 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
if
(
glContext
==
NULL
)
if
(
glContext
==
NULL
)
glContext
=
new
wxGLContext
(
this
);
glContext
=
new
wxGLContext
(
this
);
parentWindow
=
aParent
;
aParent
->
Show
();
// wxWidgets require the window to be visible to set its GL context
mouseListener
=
aMouseListener
;
paintListener
=
aPaintListener
;
// Initialize GLEW, FBOs & VBOs
SetCurrent
(
*
glContext
);
initGlew
();
// Prepare shaders
if
(
!
shader
.
LoadBuiltinShader
(
0
,
SHADER_TYPE_VERTEX
)
)
throw
std
::
runtime_error
(
"Cannot compile vertex shader!"
);
if
(
!
shader
.
LoadBuiltinShader
(
1
,
SHADER_TYPE_FRAGMENT
)
)
throw
std
::
runtime_error
(
"Cannot compile fragment shader!"
);
if
(
!
shader
.
Link
()
)
throw
std
::
runtime_error
(
"Cannot link the shaders!"
);
// Make VBOs use shaders
cachedManager
.
SetShader
(
shader
);
nonCachedManager
.
SetShader
(
shader
);
overlayManager
.
SetShader
(
shader
);
// Initialize the flags
// Initialize the flags
isGlewInitialized
=
false
;
isFramebufferInitialized
=
false
;
isFramebufferInitialized
=
false
;
isShaderInitialized
=
false
;
isGrouping
=
false
;
isGrouping
=
false
;
groupCounter
=
0
;
groupCounter
=
0
;
...
@@ -103,10 +120,7 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
...
@@ -103,10 +120,7 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
InitTesselatorCallbacks
(
tesselator
);
InitTesselatorCallbacks
(
tesselator
);
if
(
tesselator
==
NULL
)
if
(
tesselator
==
NULL
)
{
throw
std
::
runtime_error
(
"Could not create the tesselator"
);
DisplayError
(
parentWindow
,
wxT
(
"Could not create the tesselator"
)
);
exit
(
1
);
}
gluTessProperty
(
tesselator
,
GLU_TESS_WINDING_RULE
,
GLU_TESS_WINDING_POSITIVE
);
gluTessProperty
(
tesselator
,
GLU_TESS_WINDING_RULE
,
GLU_TESS_WINDING_POSITIVE
);
...
@@ -126,13 +140,8 @@ OPENGL_GAL::~OPENGL_GAL()
...
@@ -126,13 +140,8 @@ OPENGL_GAL::~OPENGL_GAL()
void
OPENGL_GAL
::
BeginDrawing
()
void
OPENGL_GAL
::
BeginDrawing
()
{
{
SetCurrent
(
*
glContext
);
SetCurrent
(
*
glContext
);
clientDC
=
new
wxClientDC
(
this
);
clientDC
=
new
wxClientDC
(
this
);
// Initialize GLEW, FBOs & VBOs
if
(
!
isGlewInitialized
)
initGlew
();
// Set up the view port
// Set up the view port
glMatrixMode
(
GL_PROJECTION
);
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
glLoadIdentity
();
...
@@ -151,35 +160,6 @@ void OPENGL_GAL::BeginDrawing()
...
@@ -151,35 +160,6 @@ void OPENGL_GAL::BeginDrawing()
isFramebufferInitialized
=
true
;
isFramebufferInitialized
=
true
;
}
}
// Compile the shaders
if
(
!
isShaderInitialized
)
{
if
(
!
shader
.
LoadBuiltinShader
(
0
,
SHADER_TYPE_VERTEX
)
)
{
DisplayError
(
parentWindow
,
wxT
(
"Cannot compile vertex shader!"
)
);
exit
(
1
);
}
if
(
!
shader
.
LoadBuiltinShader
(
1
,
SHADER_TYPE_FRAGMENT
)
)
{
DisplayError
(
parentWindow
,
wxT
(
"Cannot compile fragment shader!"
)
);
exit
(
1
);
}
if
(
!
shader
.
Link
()
)
{
DisplayError
(
parentWindow
,
wxT
(
"Cannot link the shaders!"
)
);
exit
(
1
);
}
// Make VBOs use shaders
cachedManager
.
SetShader
(
shader
);
nonCachedManager
.
SetShader
(
shader
);
overlayManager
.
SetShader
(
shader
);
isShaderInitialized
=
true
;
}
// Disable 2D Textures
// Disable 2D Textures
glDisable
(
GL_TEXTURE_2D
);
glDisable
(
GL_TEXTURE_2D
);
...
@@ -818,7 +798,7 @@ void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd
...
@@ -818,7 +798,7 @@ void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd
if
(
lineLength
<=
0.0
)
if
(
lineLength
<=
0.0
)
return
;
return
;
double
scale
=
0.5
*
lineWidth
/
lineLength
;
double
scale
=
0.5
*
lineWidth
/
lineLength
;
// The perpendicular vector also needs transformations
// The perpendicular vector also needs transformations
...
@@ -944,8 +924,7 @@ void OPENGL_GAL::initGlew()
...
@@ -944,8 +924,7 @@ void OPENGL_GAL::initGlew()
if
(
GLEW_OK
!=
err
)
if
(
GLEW_OK
!=
err
)
{
{
DisplayError
(
parentWindow
,
wxString
::
FromUTF8
(
(
char
*
)
glewGetErrorString
(
err
)
)
);
throw
std
::
runtime_error
(
(
const
char
*
)
glewGetErrorString
(
err
)
);
exit
(
1
);
}
}
else
else
{
{
...
@@ -955,30 +934,17 @@ void OPENGL_GAL::initGlew()
...
@@ -955,30 +934,17 @@ void OPENGL_GAL::initGlew()
// Check the OpenGL version (minimum 2.1 is required)
// Check the OpenGL version (minimum 2.1 is required)
if
(
GLEW_VERSION_2_1
)
if
(
GLEW_VERSION_2_1
)
{
wxLogInfo
(
wxT
(
"OpenGL 2.1 supported."
)
);
wxLogInfo
(
wxT
(
"OpenGL 2.1 supported."
)
);
}
else
else
{
throw
std
::
runtime_error
(
"OpenGL 2.1 or higher is required!"
);
DisplayError
(
parentWindow
,
wxT
(
"OpenGL 2.1 or higher is required!"
)
);
exit
(
1
);
}
// Framebuffers have to be supported
// Framebuffers have to be supported
if
(
!
GLEW_EXT_framebuffer_object
)
if
(
!
GLEW_EXT_framebuffer_object
)
{
throw
std
::
runtime_error
(
"Framebuffer objects are not supported!"
);
DisplayError
(
parentWindow
,
wxT
(
"Framebuffer objects are not supported!"
)
);
exit
(
1
);
}
// Vertex buffer has to be supported
// Vertex buffer has to be supported
if
(
!
GLEW_ARB_vertex_buffer_object
)
if
(
!
GLEW_ARB_vertex_buffer_object
)
{
throw
std
::
runtime_error
(
"Vertex buffer objects are not supported!"
);
DisplayError
(
parentWindow
,
wxT
(
"Vertex buffer objects are not supported!"
)
);
exit
(
1
);
}
isGlewInitialized
=
true
;
}
}
...
@@ -1061,12 +1027,8 @@ void CALLBACK EdgeCallback( GLboolean aEdgeFlag )
...
@@ -1061,12 +1027,8 @@ void CALLBACK EdgeCallback( GLboolean aEdgeFlag )
void
CALLBACK
ErrorCallback
(
GLenum
aErrorCode
)
void
CALLBACK
ErrorCallback
(
GLenum
aErrorCode
)
{
{
const
GLubyte
*
eString
=
gluErrorString
(
aErrorCode
);
//throw std::runtime_error( std::string( "Tessellation error: " ) +
//std::string( (const char*) gluErrorString( aErrorCode ) );
DisplayError
(
NULL
,
wxT
(
"Tessellation error: "
)
+
wxString
(
(
const
char
*
)(
eString
),
wxConvUTF8
)
);
exit
(
1
);
}
}
...
...
common/gal/opengl/shader.cpp
View file @
1bd70efc
...
@@ -28,10 +28,10 @@
...
@@ -28,10 +28,10 @@
#include <iostream>
#include <iostream>
#include <fstream>
#include <fstream>
#include <stdexcept>
#include <wx/log.h>
#include <cstring>
#include <wx/gdicmn.h>
#include <cassert>
#include <confirm.h>
#include <gal/opengl/shader.h>
#include <gal/opengl/shader.h>
#include "shader_src.h"
#include "shader_src.h"
...
@@ -102,8 +102,7 @@ bool SHADER::Link()
...
@@ -102,8 +102,7 @@ bool SHADER::Link()
glGetObjectParameterivARB
(
programNumber
,
GL_OBJECT_LINK_STATUS_ARB
,
glGetObjectParameterivARB
(
programNumber
,
GL_OBJECT_LINK_STATUS_ARB
,
(
GLint
*
)
&
isShaderLinked
);
(
GLint
*
)
&
isShaderLinked
);
#ifdef __WXDEBUG__
#ifdef DEBUG
if
(
!
isShaderLinked
)
if
(
!
isShaderLinked
)
{
{
int
maxLength
;
int
maxLength
;
...
@@ -115,8 +114,7 @@ bool SHADER::Link()
...
@@ -115,8 +114,7 @@ bool SHADER::Link()
std
::
cerr
<<
linkInfoLog
;
std
::
cerr
<<
linkInfoLog
;
delete
[]
linkInfoLog
;
delete
[]
linkInfoLog
;
}
}
#endif
/* DEBUG */
#endif
/* __WXDEBUG__ */
return
isShaderLinked
;
return
isShaderLinked
;
}
}
...
@@ -127,9 +125,7 @@ int SHADER::AddParameter( const std::string& aParameterName )
...
@@ -127,9 +125,7 @@ int SHADER::AddParameter( const std::string& aParameterName )
GLint
location
=
glGetUniformLocation
(
programNumber
,
aParameterName
.
c_str
()
);
GLint
location
=
glGetUniformLocation
(
programNumber
,
aParameterName
.
c_str
()
);
if
(
location
!=
-
1
)
if
(
location
!=
-
1
)
{
parameterLocation
.
push_back
(
location
);
parameterLocation
.
push_back
(
location
);
}
return
location
;
return
location
;
}
}
...
@@ -167,7 +163,7 @@ void SHADER::programInfo( GLuint aProgram )
...
@@ -167,7 +163,7 @@ void SHADER::programInfo( GLuint aProgram )
GLchar
*
glInfoLog
=
new
GLchar
[
glInfoLogLength
];
GLchar
*
glInfoLog
=
new
GLchar
[
glInfoLogLength
];
glGetProgramInfoLog
(
aProgram
,
glInfoLogLength
,
&
writtenChars
,
glInfoLog
);
glGetProgramInfoLog
(
aProgram
,
glInfoLogLength
,
&
writtenChars
,
glInfoLog
);
wxLogInfo
(
wxString
::
FromUTF8
(
(
char
*
)
glInfoLog
)
)
;
std
::
cerr
<<
glInfoLog
<<
std
::
endl
;
delete
[]
glInfoLog
;
delete
[]
glInfoLog
;
}
}
...
@@ -188,7 +184,7 @@ void SHADER::shaderInfo( GLuint aShader )
...
@@ -188,7 +184,7 @@ void SHADER::shaderInfo( GLuint aShader )
GLchar
*
glInfoLog
=
new
GLchar
[
glInfoLogLength
];
GLchar
*
glInfoLog
=
new
GLchar
[
glInfoLogLength
];
glGetShaderInfoLog
(
aShader
,
glInfoLogLength
,
&
writtenChars
,
glInfoLog
);
glGetShaderInfoLog
(
aShader
,
glInfoLogLength
,
&
writtenChars
,
glInfoLog
);
wxLogInfo
(
wxString
::
FromUTF8
(
(
char
*
)
glInfoLog
)
)
;
std
::
cerr
<<
glInfoLog
<<
std
::
endl
;
delete
[]
glInfoLog
;
delete
[]
glInfoLog
;
}
}
...
@@ -202,11 +198,7 @@ std::string SHADER::readSource( std::string aShaderSourceName )
...
@@ -202,11 +198,7 @@ std::string SHADER::readSource( std::string aShaderSourceName )
std
::
string
shaderSource
;
std
::
string
shaderSource
;
if
(
!
inputFile
)
if
(
!
inputFile
)
{
throw
std
::
runtime_error
(
"Can't read the shader source: "
+
aShaderSourceName
);
DisplayError
(
NULL
,
wxString
::
FromUTF8
(
"Can't read the shader source: "
)
+
wxString
(
aShaderSourceName
.
c_str
(),
wxConvUTF8
)
);
exit
(
1
);
}
std
::
string
shaderSourceLine
;
std
::
string
shaderSourceLine
;
...
@@ -223,10 +215,7 @@ std::string SHADER::readSource( std::string aShaderSourceName )
...
@@ -223,10 +215,7 @@ std::string SHADER::readSource( std::string aShaderSourceName )
bool
SHADER
::
addSource
(
const
std
::
string
&
aShaderSource
,
SHADER_TYPE
aShaderType
)
bool
SHADER
::
addSource
(
const
std
::
string
&
aShaderSource
,
SHADER_TYPE
aShaderType
)
{
{
if
(
isShaderLinked
)
assert
(
!
isShaderLinked
);
{
wxLogDebug
(
wxT
(
"Shader is already linked!"
)
);
}
// Create the program
// Create the program
if
(
!
isProgramCreated
)
if
(
!
isProgramCreated
)
...
@@ -244,7 +233,7 @@ bool SHADER::addSource( const std::string& aShaderSource, SHADER_TYPE aShaderTyp
...
@@ -244,7 +233,7 @@ bool SHADER::addSource( const std::string& aShaderSource, SHADER_TYPE aShaderTyp
// Copy to char array
// Copy to char array
char
*
source
=
new
char
[
aShaderSource
.
size
()
+
1
];
char
*
source
=
new
char
[
aShaderSource
.
size
()
+
1
];
str
cpy
(
source
,
aShaderSource
.
c_str
()
);
str
ncpy
(
source
,
aShaderSource
.
c_str
(),
aShaderSource
.
size
()
+
1
);
const
char
**
source_
=
(
const
char
**
)
(
&
source
);
const
char
**
source_
=
(
const
char
**
)
(
&
source
);
// Attach the source
// Attach the source
...
@@ -261,11 +250,8 @@ bool SHADER::addSource( const std::string& aShaderSource, SHADER_TYPE aShaderTyp
...
@@ -261,11 +250,8 @@ bool SHADER::addSource( const std::string& aShaderSource, SHADER_TYPE aShaderTyp
if
(
status
!=
GL_TRUE
)
if
(
status
!=
GL_TRUE
)
{
{
DisplayError
(
NULL
,
wxT
(
"Shader compilation error"
)
);
shaderInfo
(
shaderNumber
);
shaderInfo
(
shaderNumber
);
throw
std
::
runtime_error
(
"Shader compilation error"
);
return
false
;
}
}
glAttachShader
(
programNumber
,
shaderNumber
);
glAttachShader
(
programNumber
,
shaderNumber
);
...
...
common/tool/context_menu.cpp
View file @
1bd70efc
...
@@ -222,22 +222,20 @@ void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
...
@@ -222,22 +222,20 @@ void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
// Under Linux, every submenu can have a separate event handler, under
// Under Linux, every submenu can have a separate event handler, under
// Windows all submenus are handled by the main menu.
// Windows all submenus are handled by the main menu.
#ifdef __WINDOWS__
#ifdef __WINDOWS__
if
(
!
evt
)
{
if
(
!
evt
)
{
// Try to find the submenu which holds the selected item
// Try to find the submenu which holds the selected item
wxMenu
*
menu
=
NULL
;
wxMenu
*
menu
=
NULL
;
FindItem
(
m_selected
,
&
menu
);
FindItem
(
m_selected
,
&
menu
);
if
(
menu
)
if
(
menu
&&
menu
!=
this
)
{
{
menu
->
ProcessEvent
(
aEvent
);
menu
->
ProcessEvent
(
aEvent
);
return
;
return
;
}
}
assert
(
false
);
// The event should be handled above
}
}
#e
lse
#e
ndif
evt
=
m_customHandler
(
aEvent
);
evt
=
m_customHandler
(
aEvent
);
#endif
/* else __WINDOWS__ */
// Handling non-action menu entries (e.g. items in clarification list)
// Handling non-action menu entries (e.g. items in clarification list)
if
(
!
evt
)
if
(
!
evt
)
...
...
common/tool/tool_manager.cpp
View file @
1bd70efc
...
@@ -101,7 +101,7 @@ struct TOOL_MANAGER::TOOL_STATE
...
@@ -101,7 +101,7 @@ struct TOOL_MANAGER::TOOL_STATE
CONTEXT_MENU_TRIGGER
contextMenuTrigger
;
CONTEXT_MENU_TRIGGER
contextMenuTrigger
;
/// Tool execution context
/// Tool execution context
COROUTINE
<
int
,
TOOL_EVENT
&>*
cofunc
;
COROUTINE
<
int
,
const
TOOL_EVENT
&>*
cofunc
;
/// The event that triggered the execution/wakeup of the tool after Wait() call
/// The event that triggered the execution/wakeup of the tool after Wait() call
TOOL_EVENT
wakeupEvent
;
TOOL_EVENT
wakeupEvent
;
...
@@ -464,7 +464,7 @@ optional<TOOL_EVENT> TOOL_MANAGER::ScheduleWait( TOOL_BASE* aTool,
...
@@ -464,7 +464,7 @@ optional<TOOL_EVENT> TOOL_MANAGER::ScheduleWait( TOOL_BASE* aTool,
}
}
void
TOOL_MANAGER
::
dispatchInternal
(
TOOL_EVENT
&
aEvent
)
void
TOOL_MANAGER
::
dispatchInternal
(
const
TOOL_EVENT
&
aEvent
)
{
{
// iterate over all registered tools
// iterate over all registered tools
BOOST_FOREACH
(
TOOL_ID
toolId
,
m_activeTools
)
BOOST_FOREACH
(
TOOL_ID
toolId
,
m_activeTools
)
...
@@ -512,7 +512,7 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
...
@@ -512,7 +512,7 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
// as the state changes, the transition table has to be set up again
// as the state changes, the transition table has to be set up again
st
->
transitions
.
clear
();
st
->
transitions
.
clear
();
st
->
cofunc
=
new
COROUTINE
<
int
,
TOOL_EVENT
&>
(
tr
.
second
);
st
->
cofunc
=
new
COROUTINE
<
int
,
const
TOOL_EVENT
&>
(
tr
.
second
);
// got match? Run the handler.
// got match? Run the handler.
st
->
cofunc
->
Call
(
aEvent
);
st
->
cofunc
->
Call
(
aEvent
);
...
@@ -529,7 +529,7 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
...
@@ -529,7 +529,7 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
}
}
bool
TOOL_MANAGER
::
dispatchStandardEvents
(
TOOL_EVENT
&
aEvent
)
bool
TOOL_MANAGER
::
dispatchStandardEvents
(
const
TOOL_EVENT
&
aEvent
)
{
{
if
(
aEvent
.
Action
()
==
TA_KEY_PRESSED
)
if
(
aEvent
.
Action
()
==
TA_KEY_PRESSED
)
{
{
...
@@ -542,7 +542,7 @@ bool TOOL_MANAGER::dispatchStandardEvents( TOOL_EVENT& aEvent )
...
@@ -542,7 +542,7 @@ bool TOOL_MANAGER::dispatchStandardEvents( TOOL_EVENT& aEvent )
}
}
bool
TOOL_MANAGER
::
dispatchActivation
(
TOOL_EVENT
&
aEvent
)
bool
TOOL_MANAGER
::
dispatchActivation
(
const
TOOL_EVENT
&
aEvent
)
{
{
if
(
aEvent
.
IsActivate
()
)
if
(
aEvent
.
IsActivate
()
)
{
{
...
@@ -559,7 +559,7 @@ bool TOOL_MANAGER::dispatchActivation( TOOL_EVENT& aEvent )
...
@@ -559,7 +559,7 @@ bool TOOL_MANAGER::dispatchActivation( TOOL_EVENT& aEvent )
}
}
void
TOOL_MANAGER
::
dispatchContextMenu
(
TOOL_EVENT
&
aEvent
)
void
TOOL_MANAGER
::
dispatchContextMenu
(
const
TOOL_EVENT
&
aEvent
)
{
{
BOOST_FOREACH
(
TOOL_ID
toolId
,
m_activeTools
)
BOOST_FOREACH
(
TOOL_ID
toolId
,
m_activeTools
)
{
{
...
@@ -614,7 +614,7 @@ void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
...
@@ -614,7 +614,7 @@ void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
}
}
bool
TOOL_MANAGER
::
ProcessEvent
(
TOOL_EVENT
&
aEvent
)
bool
TOOL_MANAGER
::
ProcessEvent
(
const
TOOL_EVENT
&
aEvent
)
{
{
// Early dispatch of events destined for the TOOL_MANAGER
// Early dispatch of events destined for the TOOL_MANAGER
if
(
!
dispatchStandardEvents
(
aEvent
)
)
if
(
!
dispatchStandardEvents
(
aEvent
)
)
...
...
eeschema/dialogs/dialog_choose_component.cpp
View file @
1bd70efc
...
@@ -81,7 +81,16 @@ void DIALOG_CHOOSE_COMPONENT::OnSearchBoxChange( wxCommandEvent& aEvent )
...
@@ -81,7 +81,16 @@ void DIALOG_CHOOSE_COMPONENT::OnSearchBoxChange( wxCommandEvent& aEvent )
{
{
m_search_container
->
UpdateSearchTerm
(
m_searchBox
->
GetLineText
(
0
)
);
m_search_container
->
UpdateSearchTerm
(
m_searchBox
->
GetLineText
(
0
)
);
updateSelection
();
updateSelection
();
// On Windows, but not on Linux, the focus is given to
// the m_libraryComponentTree, after modificatuons.
// We want the focus for m_searchBox.
//
// We cannot call SetFocus on Linux because it changes the current text selection
// and the text edit cursor position.
#ifdef __WINDOWS__
m_searchBox
->
SetFocus
();
m_searchBox
->
SetFocus
();
#endif
}
}
...
...
eeschema/dialogs/dialog_sch
_find
.fbp
→
eeschema/dialogs/dialog_sch
ematic_find_base
.fbp
View file @
1bd70efc
File moved
include/class_draw_panel_gal.h
View file @
1bd70efc
...
@@ -66,7 +66,7 @@ public:
...
@@ -66,7 +66,7 @@ public:
* Switches method of rendering graphics.
* Switches method of rendering graphics.
* @param aGalType is a type of rendering engine that you want to use.
* @param aGalType is a type of rendering engine that you want to use.
*/
*/
void
SwitchBackend
(
GalType
aGalType
);
bool
SwitchBackend
(
GalType
aGalType
);
/**
/**
* Function GetBackend
* Function GetBackend
...
...
include/gal/opengl/opengl_gal.h
View file @
1bd70efc
...
@@ -277,9 +277,7 @@ private:
...
@@ -277,9 +277,7 @@ private:
SHADER
shader
;
///< There is only one shader used for different objects
SHADER
shader
;
///< There is only one shader used for different objects
// Internal flags
// Internal flags
bool
isGlewInitialized
;
///< Is GLEW initialized?
bool
isFramebufferInitialized
;
///< Are the framebuffers initialized?
bool
isFramebufferInitialized
;
///< Are the framebuffers initialized?
bool
isShaderInitialized
;
///< Was the shader initialized?
bool
isGrouping
;
///< Was a group started?
bool
isGrouping
;
///< Was a group started?
// Polygon tesselation
// Polygon tesselation
...
...
include/tool/tool_base.h
View file @
1bd70efc
...
@@ -51,7 +51,7 @@ enum TOOL_TYPE
...
@@ -51,7 +51,7 @@ enum TOOL_TYPE
/// Unique identifier for tools
/// Unique identifier for tools
typedef
int
TOOL_ID
;
typedef
int
TOOL_ID
;
typedef
DELEGATE
<
int
,
TOOL_EVENT
&>
TOOL_STATE_FUNC
;
typedef
DELEGATE
<
int
,
const
TOOL_EVENT
&>
TOOL_STATE_FUNC
;
/**
/**
* Class TOOL_BASE
* Class TOOL_BASE
...
...
include/tool/tool_interactive.h
View file @
1bd70efc
...
@@ -70,7 +70,7 @@ public:
...
@@ -70,7 +70,7 @@ public:
* No conditions means any event.
* No conditions means any event.
*/
*/
template
<
class
T
>
template
<
class
T
>
void
Go
(
int
(
T
::*
aStateFunc
)(
TOOL_EVENT
&
),
void
Go
(
int
(
T
::*
aStateFunc
)(
const
TOOL_EVENT
&
),
const
TOOL_EVENT_LIST
&
aConditions
=
TOOL_EVENT
(
TC_ANY
,
TA_ANY
)
);
const
TOOL_EVENT_LIST
&
aConditions
=
TOOL_EVENT
(
TC_ANY
,
TA_ANY
)
);
/**
/**
...
@@ -110,7 +110,7 @@ private:
...
@@ -110,7 +110,7 @@ private:
// hide TOOL_MANAGER implementation
// hide TOOL_MANAGER implementation
template
<
class
T
>
template
<
class
T
>
void
TOOL_INTERACTIVE
::
Go
(
int
(
T
::*
aStateFunc
)(
TOOL_EVENT
&
),
void
TOOL_INTERACTIVE
::
Go
(
int
(
T
::*
aStateFunc
)(
const
TOOL_EVENT
&
),
const
TOOL_EVENT_LIST
&
aConditions
)
const
TOOL_EVENT_LIST
&
aConditions
)
{
{
TOOL_STATE_FUNC
sptr
(
static_cast
<
T
*>
(
this
),
aStateFunc
);
TOOL_STATE_FUNC
sptr
(
static_cast
<
T
*>
(
this
),
aStateFunc
);
...
...
include/tool/tool_manager.h
View file @
1bd70efc
...
@@ -169,7 +169,7 @@ public:
...
@@ -169,7 +169,7 @@ public:
* Propagates an event to tools that requested events of matching type(s).
* Propagates an event to tools that requested events of matching type(s).
* @param aEvent is the event to be processed.
* @param aEvent is the event to be processed.
*/
*/
bool
ProcessEvent
(
TOOL_EVENT
&
aEvent
);
bool
ProcessEvent
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Puts an event to the event queue to be processed at the end of event processing cycle.
* Puts an event to the event queue to be processed at the end of event processing cycle.
...
@@ -309,7 +309,7 @@ private:
...
@@ -309,7 +309,7 @@ private:
* Function dispatchInternal
* Function dispatchInternal
* Passes an event at first to the active tools, then to all others.
* Passes an event at first to the active tools, then to all others.
*/
*/
void
dispatchInternal
(
TOOL_EVENT
&
aEvent
);
void
dispatchInternal
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function dispatchStandardEvents()
* Function dispatchStandardEvents()
...
@@ -317,7 +317,7 @@ private:
...
@@ -317,7 +317,7 @@ private:
* @param aEvent is the event to be processed.
* @param aEvent is the event to be processed.
* @return False if the event was processed and should not go any further.
* @return False if the event was processed and should not go any further.
*/
*/
bool
dispatchStandardEvents
(
TOOL_EVENT
&
aEvent
);
bool
dispatchStandardEvents
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function dispatchActivation()
* Function dispatchActivation()
...
@@ -325,13 +325,13 @@ private:
...
@@ -325,13 +325,13 @@ private:
* @param aEvent is an event to be tested.
* @param aEvent is an event to be tested.
* @return True if a tool was invoked, false otherwise.
* @return True if a tool was invoked, false otherwise.
*/
*/
bool
dispatchActivation
(
TOOL_EVENT
&
aEvent
);
bool
dispatchActivation
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function dispatchContextMenu()
* Function dispatchContextMenu()
* Handles context menu related events.
* Handles context menu related events.
*/
*/
void
dispatchContextMenu
(
TOOL_EVENT
&
aEvent
);
void
dispatchContextMenu
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function invokeTool()
* Function invokeTool()
...
...
include/view/view.h
View file @
1bd70efc
...
@@ -492,7 +492,14 @@ public:
...
@@ -492,7 +492,14 @@ public:
{
{
wxASSERT
(
aLayer
<
(
int
)
m_layers
.
size
()
);
wxASSERT
(
aLayer
<
(
int
)
m_layers
.
size
()
);
return
m_layers
.
at
(
aLayer
).
target
==
TARGET_CACHED
;
try
{
return
m_layers
.
at
(
aLayer
).
target
==
TARGET_CACHED
;
}
catch
(
std
::
out_of_range
)
{
return
false
;
}
}
}
/**
/**
...
...
include/wxPcbStruct.h
View file @
1bd70efc
...
@@ -848,12 +848,14 @@ public:
...
@@ -848,12 +848,14 @@ public:
/**
/**
* Function AppendBoardFile
* Function AppendBoardFile
* appends a board file onto the current one, creating God knows what.
* appends a board file onto the current one, creating God knows what.
* the main purpose is only to allow panelizing boards.
*/
*/
bool
AppendBoardFile
(
const
wxString
&
aFullFileName
,
int
aCtl
);
bool
AppendBoardFile
(
const
wxString
&
aFullFileName
,
int
aCtl
);
/**
/**
* Function SavePcbFile
* Function SavePcbFile
* writes the board data structures to \a a aFileName
* writes the board data structures to \a a aFileName
* Creates backup when requested and update flags (modified and saved flgs)
*
*
* @param aFileName The file name to write or wxEmptyString to prompt user for
* @param aFileName The file name to write or wxEmptyString to prompt user for
* file name.
* file name.
...
@@ -864,8 +866,18 @@ public:
...
@@ -864,8 +866,18 @@ public:
*/
*/
bool
SavePcbFile
(
const
wxString
&
aFileName
,
bool
aCreateBackupFile
=
CREATE_BACKUP_FILE
);
bool
SavePcbFile
(
const
wxString
&
aFileName
,
bool
aCreateBackupFile
=
CREATE_BACKUP_FILE
);
int
SavePcbFormatAscii
(
FILE
*
File
);
/**
bool
WriteGeneralDescrPcb
(
FILE
*
File
);
* Function SavePcbCopy
* writes the board data structures to \a a aFileName
* but unlike SavePcbFile, does not make anything else
* (no backup, borad fliename change, no flag changes ...)
* Used under a project mgr to save under a new name the current board
*
* When not under a project mgr, the full SavePcbFile is used.
* @param aFileName The file name to write.
* @return True if file was saved successfully.
*/
bool
SavePcbCopy
(
const
wxString
&
aFileName
);
// BOARD handling
// BOARD handling
...
...
pcbnew/class_board.cpp
View file @
1bd70efc
...
@@ -314,6 +314,32 @@ bool BOARD::SetLayerDescr( LAYER_ID aIndex, const LAYER& aLayer )
...
@@ -314,6 +314,32 @@ bool BOARD::SetLayerDescr( LAYER_ID aIndex, const LAYER& aLayer )
return
false
;
return
false
;
}
}
#include <stdio.h>
const
LAYER_ID
BOARD
::
GetLayerID
(
wxString
aLayerName
)
const
{
// Look for the BOARD specific copper layer names
for
(
LAYER_NUM
layer
=
0
;
layer
<
LAYER_ID_COUNT
;
++
layer
)
{
if
(
IsCopperLayer
(
layer
)
&&
(
m_Layer
[
layer
].
m_name
==
aLayerName
)
)
{
return
ToLAYER_ID
(
layer
);
}
}
// Otherwise fall back to the system standard layer names
for
(
LAYER_NUM
layer
=
0
;
layer
<
LAYER_ID_COUNT
;
++
layer
)
{
if
(
GetStandardLayerName
(
ToLAYER_ID
(
layer
)
)
==
aLayerName
)
{
return
ToLAYER_ID
(
layer
);
}
}
return
UNDEFINED_LAYER
;
}
const
wxString
BOARD
::
GetLayerName
(
LAYER_ID
aLayer
)
const
const
wxString
BOARD
::
GetLayerName
(
LAYER_ID
aLayer
)
const
{
{
...
@@ -331,7 +357,6 @@ const wxString BOARD::GetLayerName( LAYER_ID aLayer ) const
...
@@ -331,7 +357,6 @@ const wxString BOARD::GetLayerName( LAYER_ID aLayer ) const
return
GetStandardLayerName
(
aLayer
);
return
GetStandardLayerName
(
aLayer
);
}
}
bool
BOARD
::
SetLayerName
(
LAYER_ID
aLayer
,
const
wxString
&
aLayerName
)
bool
BOARD
::
SetLayerName
(
LAYER_ID
aLayer
,
const
wxString
&
aLayerName
)
{
{
if
(
!
IsCopperLayer
(
aLayer
)
)
if
(
!
IsCopperLayer
(
aLayer
)
)
...
...
pcbnew/class_board.h
View file @
1bd70efc
...
@@ -621,6 +621,18 @@ public:
...
@@ -621,6 +621,18 @@ public:
*/
*/
void
ConvertBrdLayerToPolygonalContours
(
LAYER_ID
aLayer
,
CPOLYGONS_LIST
&
aOutlines
);
void
ConvertBrdLayerToPolygonalContours
(
LAYER_ID
aLayer
,
CPOLYGONS_LIST
&
aOutlines
);
/**
* Function GetLayerID
* returns the ID of a layer given by aLayerName. Copper layers may
* have custom names.
*
* @param aLayerName = A layer name, like wxT("B.Cu"), etc.
*
* @return LAYER_ID - the layer id, which for copper layers may
* be custom, else standard.
*/
const
LAYER_ID
GetLayerID
(
wxString
aLayerName
)
const
;
/**
/**
* Function GetLayerName
* Function GetLayerName
* returns the name of a layer given by aLayer. Copper layers may
* returns the name of a layer given by aLayer. Copper layers may
...
...
pcbnew/class_board_design_settings.cpp
View file @
1bd70efc
...
@@ -82,6 +82,8 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
...
@@ -82,6 +82,8 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_PcbTextSize
=
wxSize
(
DEFAULT_TEXT_PCB_SIZE
,
m_PcbTextSize
=
wxSize
(
DEFAULT_TEXT_PCB_SIZE
,
DEFAULT_TEXT_PCB_SIZE
);
// current Pcb (not module) Text size
DEFAULT_TEXT_PCB_SIZE
);
// current Pcb (not module) Text size
m_useCustomTrackVia
=
false
;
m_customTrackWidth
=
DMils2iu
(
100
);
m_TrackMinWidth
=
DMils2iu
(
100
);
// track min value for width (min copper size value)
m_TrackMinWidth
=
DMils2iu
(
100
);
// track min value for width (min copper size value)
m_ViasMinSize
=
DMils2iu
(
350
);
// vias (not micro vias) min diameter
m_ViasMinSize
=
DMils2iu
(
350
);
// vias (not micro vias) min diameter
m_ViasMinDrill
=
DMils2iu
(
200
);
// vias (not micro vias) min drill diameter
m_ViasMinDrill
=
DMils2iu
(
200
);
// vias (not micro vias) min drill diameter
...
...
pcbnew/class_module.cpp
View file @
1bd70efc
...
@@ -800,14 +800,21 @@ EDA_ITEM* MODULE::Clone() const
...
@@ -800,14 +800,21 @@ EDA_ITEM* MODULE::Clone() const
void
MODULE
::
RunOnChildren
(
boost
::
function
<
void
(
BOARD_ITEM
*
)
>
aFunction
)
void
MODULE
::
RunOnChildren
(
boost
::
function
<
void
(
BOARD_ITEM
*
)
>
aFunction
)
{
{
for
(
D_PAD
*
pad
=
m_Pads
;
pad
;
pad
=
pad
->
Next
()
)
try
aFunction
(
static_cast
<
BOARD_ITEM
*>
(
pad
)
);
{
for
(
D_PAD
*
pad
=
m_Pads
;
pad
;
pad
=
pad
->
Next
()
)
aFunction
(
static_cast
<
BOARD_ITEM
*>
(
pad
)
);
for
(
BOARD_ITEM
*
drawing
=
m_Drawings
;
drawing
;
drawing
=
drawing
->
Next
()
)
for
(
BOARD_ITEM
*
drawing
=
m_Drawings
;
drawing
;
drawing
=
drawing
->
Next
()
)
aFunction
(
drawing
);
aFunction
(
drawing
);
aFunction
(
static_cast
<
BOARD_ITEM
*>
(
m_Reference
)
);
aFunction
(
static_cast
<
BOARD_ITEM
*>
(
m_Reference
)
);
aFunction
(
static_cast
<
BOARD_ITEM
*>
(
m_Value
)
);
aFunction
(
static_cast
<
BOARD_ITEM
*>
(
m_Value
)
);
}
catch
(
boost
::
bad_function_call
&
e
)
{
DisplayError
(
NULL
,
wxT
(
"Error running MODULE::RunOnChildren"
)
);
}
}
}
...
...
pcbnew/cross-probing.cpp
View file @
1bd70efc
...
@@ -25,6 +25,8 @@
...
@@ -25,6 +25,8 @@
#include <collectors.h>
#include <collectors.h>
#include <pcbnew.h>
#include <pcbnew.h>
#include <tools/common_actions.h>
#include <pcb_draw_panel_gal.h>
/* Execute a remote command send by Eeschema via a socket,
/* Execute a remote command send by Eeschema via a socket,
* port KICAD_PCB_PORT_SERVICE_NUMBER
* port KICAD_PCB_PORT_SERVICE_NUMBER
...
@@ -127,8 +129,17 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
...
@@ -127,8 +129,17 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if
(
module
)
// if found, center the module on screen, and redraw the screen.
if
(
module
)
// if found, center the module on screen, and redraw the screen.
{
{
SetCrossHairPosition
(
pos
);
if
(
IsGalCanvasActive
()
)
RedrawScreen
(
pos
,
false
);
{
GetGalCanvas
()
->
GetView
()
->
SetCenter
(
VECTOR2D
(
module
->
GetPosition
()
)
);
m_toolManager
->
RunAction
(
COMMON_ACTIONS
::
selectionClear
,
true
);
m_toolManager
->
RunAction
(
COMMON_ACTIONS
::
selectItem
,
true
,
module
);
}
else
{
SetCrossHairPosition
(
pos
);
RedrawScreen
(
pos
,
false
);
}
}
}
}
}
...
...
pcbnew/dialogs/dialog_enum_pads.cpp
View file @
1bd70efc
...
@@ -27,6 +27,10 @@
...
@@ -27,6 +27,10 @@
DIALOG_ENUM_PADS
::
DIALOG_ENUM_PADS
(
wxWindow
*
aParent
)
:
DIALOG_ENUM_PADS
::
DIALOG_ENUM_PADS
(
wxWindow
*
aParent
)
:
DIALOG_ENUM_PADS_BASE
(
aParent
)
DIALOG_ENUM_PADS_BASE
(
aParent
)
{
{
// Calling SetSizeHints after all widgets are built is mandatory
// to set the correct size of the dialog
GetSizer
()
->
SetSizeHints
(
this
);
Center
();
}
}
...
...
pcbnew/dialogs/dialog_enum_pads_base.cpp
View file @
1bd70efc
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version
Apr 30 2013
)
// C++ code generated with wxFormBuilder (version
Jun 5 2014
)
// http://www.wxformbuilder.org/
// http://www.wxformbuilder.org/
//
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
...
@@ -9,43 +9,46 @@
...
@@ -9,43 +9,46 @@
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
DIALOG_ENUM_PADS_BASE
::
DIALOG_ENUM_PADS_BASE
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxString
&
title
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
:
wxDialog
(
parent
,
id
,
title
,
pos
,
size
,
style
)
DIALOG_ENUM_PADS_BASE
::
DIALOG_ENUM_PADS_BASE
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxString
&
title
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
:
DIALOG_SHIM
(
parent
,
id
,
title
,
pos
,
size
,
style
)
{
{
this
->
SetSizeHints
(
wxDefaultSize
,
wxDefaultSize
);
this
->
SetSizeHints
(
wxDefaultSize
,
wxDefaultSize
);
wxBoxSizer
*
bMainSizer
;
wxBoxSizer
*
bMainSizer
;
bMainSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
bMainSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
wxBoxSizer
*
bPrefixSizer
;
m_lblInfo
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"Pad names are restricted to 4 characters (including number)."
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
bPrefixSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
m_lblInfo
->
Wrap
(
-
1
);
bMainSizer
->
Add
(
m_lblInfo
,
0
,
wxALL
|
wxALIGN_CENTER_HORIZONTAL
,
5
);
bMainSizer
->
Add
(
0
,
0
,
0
,
wxTOP
|
wxBOTTOM
,
5
);
wxFlexGridSizer
*
fgSizer
;
fgSizer
=
new
wxFlexGridSizer
(
0
,
2
,
0
,
0
);
fgSizer
->
AddGrowableCol
(
1
);
fgSizer
->
SetFlexibleDirection
(
wxBOTH
);
fgSizer
->
SetNonFlexibleGrowMode
(
wxFLEX_GROWMODE_SPECIFIED
);
m_lblPadPrefix
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"Pad name prefix:"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_lblPadPrefix
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"Pad name prefix:"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_lblPadPrefix
->
Wrap
(
-
1
);
m_lblPadPrefix
->
Wrap
(
-
1
);
bPrefixSizer
->
Add
(
m_lblPadPrefix
,
1
,
wxAL
L
,
5
);
fgSizer
->
Add
(
m_lblPadPrefix
,
0
,
wxALL
|
wxALIGN_CENTER_VERTICA
L
,
5
);
m_padPrefix
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_padPrefix
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_padPrefix
->
SetMaxLength
(
4
);
m_padPrefix
->
SetMaxLength
(
4
);
bPrefixSizer
->
Add
(
m_padPrefix
,
0
,
wxALL
,
5
);
fgSizer
->
Add
(
m_padPrefix
,
0
,
wxALL
|
wxEXPAND
|
wxALIGN_CENTER_VERTICAL
,
5
);
bMainSizer
->
Add
(
bPrefixSizer
,
1
,
wxEXPAND
,
5
);
wxBoxSizer
*
bPadNumSizer
;
bPadNumSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
m_lblPadStartNum
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"First pad number:"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_lblPadStartNum
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"First pad number:"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_lblPadStartNum
->
Wrap
(
-
1
);
m_lblPadStartNum
->
Wrap
(
-
1
);
bPadNumSizer
->
Add
(
m_lblPadStartNum
,
1
,
wxAL
L
,
5
);
fgSizer
->
Add
(
m_lblPadStartNum
,
0
,
wxALL
|
wxALIGN_CENTER_VERTICA
L
,
5
);
m_padStartNum
=
new
wxSpinCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
wxSP_ARROW_KEYS
,
0
,
999
,
1
);
m_padStartNum
=
new
wxSpinCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
wxSP_ARROW_KEYS
,
0
,
999
,
1
);
bPadNumSizer
->
Add
(
m_padStartNum
,
0
,
wxALL
,
5
);
fgSizer
->
Add
(
m_padStartNum
,
0
,
wxALL
|
wxEXPAND
,
5
);
bMainSizer
->
Add
(
bPadNumSizer
,
1
,
wxEXPAND
,
5
);
bMainSizer
->
Add
(
fgSizer
,
1
,
wxEXPAND
|
wxALL
,
5
);
m_lblInfo
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"Pad names are restricted to 4 characters (including number)."
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticline1
=
new
wxStaticLine
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxLI_HORIZONTAL
);
m_lblInfo
->
Wrap
(
320
);
bMainSizer
->
Add
(
m_staticline1
,
0
,
wxEXPAND
|
wxALL
,
5
);
bMainSizer
->
Add
(
m_lblInfo
,
0
,
wxALL
,
5
);
m_stdButtons
=
new
wxStdDialogButtonSizer
();
m_stdButtons
=
new
wxStdDialogButtonSizer
();
m_stdButtonsOK
=
new
wxButton
(
this
,
wxID_OK
);
m_stdButtonsOK
=
new
wxButton
(
this
,
wxID_OK
);
...
@@ -54,7 +57,7 @@ DIALOG_ENUM_PADS_BASE::DIALOG_ENUM_PADS_BASE( wxWindow* parent, wxWindowID id, c
...
@@ -54,7 +57,7 @@ DIALOG_ENUM_PADS_BASE::DIALOG_ENUM_PADS_BASE( wxWindow* parent, wxWindowID id, c
m_stdButtons
->
AddButton
(
m_stdButtonsCancel
);
m_stdButtons
->
AddButton
(
m_stdButtonsCancel
);
m_stdButtons
->
Realize
();
m_stdButtons
->
Realize
();
bMainSizer
->
Add
(
m_stdButtons
,
2
,
wxEXPAND
,
5
);
bMainSizer
->
Add
(
m_stdButtons
,
0
,
wxEXPAND
|
wxALL
,
5
);
this
->
SetSizer
(
bMainSizer
);
this
->
SetSizer
(
bMainSizer
);
...
...
pcbnew/dialogs/dialog_enum_pads_base.fbp
View file @
1bd70efc
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<wxFormBuilder_Project>
<FileVersion
major=
"1"
minor=
"1
1
"
/>
<FileVersion
major=
"1"
minor=
"1
3
"
/>
<object
class=
"Project"
expanded=
"1"
>
<object
class=
"Project"
expanded=
"1"
>
<property
name=
"class_decoration"
></property>
<property
name=
"class_decoration"
></property>
<property
name=
"code_generation"
>
C++
</property>
<property
name=
"code_generation"
>
C++
</property>
...
@@ -20,8 +20,10 @@
...
@@ -20,8 +20,10 @@
<property
name=
"path"
>
.
</property>
<property
name=
"path"
>
.
</property>
<property
name=
"precompiled_header"
></property>
<property
name=
"precompiled_header"
></property>
<property
name=
"relative_path"
>
1
</property>
<property
name=
"relative_path"
>
1
</property>
<property
name=
"skip_lua_events"
>
1
</property>
<property
name=
"skip_php_events"
>
1
</property>
<property
name=
"skip_php_events"
>
1
</property>
<property
name=
"skip_python_events"
>
1
</property>
<property
name=
"skip_python_events"
>
1
</property>
<property
name=
"ui_table"
>
UI
</property>
<property
name=
"use_enum"
>
0
</property>
<property
name=
"use_enum"
>
0
</property>
<property
name=
"use_microsoft_bom"
>
0
</property>
<property
name=
"use_microsoft_bom"
>
0
</property>
<object
class=
"Dialog"
expanded=
"1"
>
<object
class=
"Dialog"
expanded=
"1"
>
...
@@ -42,9 +44,9 @@
...
@@ -42,9 +44,9 @@
<property
name=
"minimum_size"
></property>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
DIALOG_ENUM_PADS_BASE
</property>
<property
name=
"name"
>
DIALOG_ENUM_PADS_BASE
</property>
<property
name=
"pos"
></property>
<property
name=
"pos"
></property>
<property
name=
"size"
>
340,
240
</property>
<property
name=
"size"
>
340,
187
</property>
<property
name=
"style"
>
wxDEFAULT_DIALOG_STYLE
</property>
<property
name=
"style"
>
wxDEFAULT_DIALOG_STYLE
|wxRESIZE_BORDER
</property>
<property
name=
"subclass"
></property>
<property
name=
"subclass"
>
DIALOG_SHIM; dialog_shim.h
</property>
<property
name=
"title"
>
Pad enumeration settings
</property>
<property
name=
"title"
>
Pad enumeration settings
</property>
<property
name=
"tooltip"
></property>
<property
name=
"tooltip"
></property>
<property
name=
"window_extra_style"
></property>
<property
name=
"window_extra_style"
></property>
...
@@ -93,17 +95,117 @@
...
@@ -93,17 +95,117 @@
<property
name=
"permission"
>
none
</property>
<property
name=
"permission"
>
none
</property>
<object
class=
"sizeritem"
expanded=
"1"
>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxEXPAND
</property>
<property
name=
"flag"
>
wxALL|wxALIGN_CENTER_HORIZONTAL
</property>
<property
name=
"proportion"
>
0
</property>
<object
class=
"wxStaticText"
expanded=
"1"
>
<property
name=
"BottomDockable"
>
1
</property>
<property
name=
"LeftDockable"
>
1
</property>
<property
name=
"RightDockable"
>
1
</property>
<property
name=
"TopDockable"
>
1
</property>
<property
name=
"aui_layer"
></property>
<property
name=
"aui_name"
></property>
<property
name=
"aui_position"
></property>
<property
name=
"aui_row"
></property>
<property
name=
"best_size"
></property>
<property
name=
"bg"
></property>
<property
name=
"caption"
></property>
<property
name=
"caption_visible"
>
1
</property>
<property
name=
"center_pane"
>
0
</property>
<property
name=
"close_button"
>
1
</property>
<property
name=
"context_help"
></property>
<property
name=
"context_menu"
>
1
</property>
<property
name=
"default_pane"
>
0
</property>
<property
name=
"dock"
>
Dock
</property>
<property
name=
"dock_fixed"
>
0
</property>
<property
name=
"docking"
>
Left
</property>
<property
name=
"enabled"
>
1
</property>
<property
name=
"fg"
></property>
<property
name=
"floatable"
>
1
</property>
<property
name=
"font"
></property>
<property
name=
"gripper"
>
0
</property>
<property
name=
"hidden"
>
0
</property>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"label"
>
Pad names are restricted to 4 characters (including number).
</property>
<property
name=
"max_size"
></property>
<property
name=
"maximize_button"
>
0
</property>
<property
name=
"maximum_size"
></property>
<property
name=
"min_size"
></property>
<property
name=
"minimize_button"
>
0
</property>
<property
name=
"minimum_size"
></property>
<property
name=
"moveable"
>
1
</property>
<property
name=
"name"
>
m_lblInfo
</property>
<property
name=
"pane_border"
>
1
</property>
<property
name=
"pane_position"
></property>
<property
name=
"pane_size"
></property>
<property
name=
"permission"
>
protected
</property>
<property
name=
"pin_button"
>
1
</property>
<property
name=
"pos"
></property>
<property
name=
"resize"
>
Resizable
</property>
<property
name=
"show"
>
1
</property>
<property
name=
"size"
></property>
<property
name=
"style"
></property>
<property
name=
"subclass"
></property>
<property
name=
"toolbar_pane"
>
0
</property>
<property
name=
"tooltip"
></property>
<property
name=
"window_extra_style"
></property>
<property
name=
"window_name"
></property>
<property
name=
"window_style"
></property>
<property
name=
"wrap"
>
-1
</property>
<event
name=
"OnChar"
></event>
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEraseBackground"
></event>
<event
name=
"OnKeyDown"
></event>
<event
name=
"OnKeyUp"
></event>
<event
name=
"OnKillFocus"
></event>
<event
name=
"OnLeaveWindow"
></event>
<event
name=
"OnLeftDClick"
></event>
<event
name=
"OnLeftDown"
></event>
<event
name=
"OnLeftUp"
></event>
<event
name=
"OnMiddleDClick"
></event>
<event
name=
"OnMiddleDown"
></event>
<event
name=
"OnMiddleUp"
></event>
<event
name=
"OnMotion"
></event>
<event
name=
"OnMouseEvents"
></event>
<event
name=
"OnMouseWheel"
></event>
<event
name=
"OnPaint"
></event>
<event
name=
"OnRightDClick"
></event>
<event
name=
"OnRightDown"
></event>
<event
name=
"OnRightUp"
></event>
<event
name=
"OnSetFocus"
></event>
<event
name=
"OnSize"
></event>
<event
name=
"OnUpdateUI"
></event>
</object>
</object>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxTOP|wxBOTTOM
</property>
<property
name=
"proportion"
>
0
</property>
<object
class=
"spacer"
expanded=
"1"
>
<property
name=
"height"
>
0
</property>
<property
name=
"permission"
>
protected
</property>
<property
name=
"width"
>
0
</property>
</object>
</object>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxEXPAND|wxALL
</property>
<property
name=
"proportion"
>
1
</property>
<property
name=
"proportion"
>
1
</property>
<object
class=
"wxBoxSizer"
expanded=
"0"
>
<object
class=
"wxFlexGridSizer"
expanded=
"1"
>
<property
name=
"cols"
>
2
</property>
<property
name=
"flexible_direction"
>
wxBOTH
</property>
<property
name=
"growablecols"
>
1
</property>
<property
name=
"growablerows"
></property>
<property
name=
"hgap"
>
0
</property>
<property
name=
"minimum_size"
></property>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
bPrefix
Sizer
</property>
<property
name=
"name"
>
fg
Sizer
</property>
<property
name=
"
orient"
>
wxHORIZONTAL
</property>
<property
name=
"
non_flexible_grow_mode"
>
wxFLEX_GROWMODE_SPECIFIED
</property>
<property
name=
"permission"
>
none
</property>
<property
name=
"permission"
>
none
</property>
<property
name=
"rows"
>
0
</property>
<property
name=
"vgap"
>
0
</property>
<object
class=
"sizeritem"
expanded=
"0"
>
<object
class=
"sizeritem"
expanded=
"0"
>
<property
name=
"border"
>
5
</property>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxALL
</property>
<property
name=
"flag"
>
wxALL
|wxALIGN_CENTER_VERTICAL
</property>
<property
name=
"proportion"
>
1
</property>
<property
name=
"proportion"
>
0
</property>
<object
class=
"wxStaticText"
expanded=
"0"
>
<object
class=
"wxStaticText"
expanded=
"0"
>
<property
name=
"BottomDockable"
>
1
</property>
<property
name=
"BottomDockable"
>
1
</property>
<property
name=
"LeftDockable"
>
1
</property>
<property
name=
"LeftDockable"
>
1
</property>
...
@@ -185,7 +287,7 @@
...
@@ -185,7 +287,7 @@
</object>
</object>
<object
class=
"sizeritem"
expanded=
"0"
>
<object
class=
"sizeritem"
expanded=
"0"
>
<property
name=
"border"
>
5
</property>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxALL
</property>
<property
name=
"flag"
>
wxALL
|wxEXPAND|wxALIGN_CENTER_VERTICAL
</property>
<property
name=
"proportion"
>
0
</property>
<property
name=
"proportion"
>
0
</property>
<object
class=
"wxTextCtrl"
expanded=
"0"
>
<object
class=
"wxTextCtrl"
expanded=
"0"
>
<property
name=
"BottomDockable"
>
1
</property>
<property
name=
"BottomDockable"
>
1
</property>
...
@@ -274,21 +376,10 @@
...
@@ -274,21 +376,10 @@
<event
name=
"OnUpdateUI"
></event>
<event
name=
"OnUpdateUI"
></event>
</object>
</object>
</object>
</object>
</object>
</object>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxEXPAND
</property>
<property
name=
"proportion"
>
1
</property>
<object
class=
"wxBoxSizer"
expanded=
"1"
>
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
bPadNumSizer
</property>
<property
name=
"orient"
>
wxHORIZONTAL
</property>
<property
name=
"permission"
>
none
</property>
<object
class=
"sizeritem"
expanded=
"1"
>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxALL
</property>
<property
name=
"flag"
>
wxALL
|wxALIGN_CENTER_VERTICAL
</property>
<property
name=
"proportion"
>
1
</property>
<property
name=
"proportion"
>
0
</property>
<object
class=
"wxStaticText"
expanded=
"1"
>
<object
class=
"wxStaticText"
expanded=
"1"
>
<property
name=
"BottomDockable"
>
1
</property>
<property
name=
"BottomDockable"
>
1
</property>
<property
name=
"LeftDockable"
>
1
</property>
<property
name=
"LeftDockable"
>
1
</property>
...
@@ -370,7 +461,7 @@
...
@@ -370,7 +461,7 @@
</object>
</object>
<object
class=
"sizeritem"
expanded=
"1"
>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxALL
</property>
<property
name=
"flag"
>
wxALL
|wxEXPAND
</property>
<property
name=
"proportion"
>
0
</property>
<property
name=
"proportion"
>
0
</property>
<object
class=
"wxSpinCtrl"
expanded=
"1"
>
<object
class=
"wxSpinCtrl"
expanded=
"1"
>
<property
name=
"BottomDockable"
>
1
</property>
<property
name=
"BottomDockable"
>
1
</property>
...
@@ -452,6 +543,7 @@
...
@@ -452,6 +543,7 @@
<event
name=
"OnSize"
></event>
<event
name=
"OnSize"
></event>
<event
name=
"OnSpinCtrl"
></event>
<event
name=
"OnSpinCtrl"
></event>
<event
name=
"OnSpinCtrlText"
></event>
<event
name=
"OnSpinCtrlText"
></event>
<event
name=
"OnTextEnter"
></event>
<event
name=
"OnUpdateUI"
></event>
<event
name=
"OnUpdateUI"
></event>
</object>
</object>
</object>
</object>
...
@@ -459,9 +551,9 @@
...
@@ -459,9 +551,9 @@
</object>
</object>
<object
class=
"sizeritem"
expanded=
"1"
>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxALL
</property>
<property
name=
"flag"
>
wx
EXPAND | wx
ALL
</property>
<property
name=
"proportion"
>
0
</property>
<property
name=
"proportion"
>
0
</property>
<object
class=
"wxStatic
Text
"
expanded=
"1"
>
<object
class=
"wxStatic
Line
"
expanded=
"1"
>
<property
name=
"BottomDockable"
>
1
</property>
<property
name=
"BottomDockable"
>
1
</property>
<property
name=
"LeftDockable"
>
1
</property>
<property
name=
"LeftDockable"
>
1
</property>
<property
name=
"RightDockable"
>
1
</property>
<property
name=
"RightDockable"
>
1
</property>
...
@@ -489,7 +581,6 @@
...
@@ -489,7 +581,6 @@
<property
name=
"gripper"
>
0
</property>
<property
name=
"gripper"
>
0
</property>
<property
name=
"hidden"
>
0
</property>
<property
name=
"hidden"
>
0
</property>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"id"
>
wxID_ANY
</property>
<property
name=
"label"
>
Pad names are restricted to 4 characters (including number).
</property>
<property
name=
"max_size"
></property>
<property
name=
"max_size"
></property>
<property
name=
"maximize_button"
>
0
</property>
<property
name=
"maximize_button"
>
0
</property>
<property
name=
"maximum_size"
></property>
<property
name=
"maximum_size"
></property>
...
@@ -497,7 +588,7 @@
...
@@ -497,7 +588,7 @@
<property
name=
"minimize_button"
>
0
</property>
<property
name=
"minimize_button"
>
0
</property>
<property
name=
"minimum_size"
></property>
<property
name=
"minimum_size"
></property>
<property
name=
"moveable"
>
1
</property>
<property
name=
"moveable"
>
1
</property>
<property
name=
"name"
>
m_
lblInfo
</property>
<property
name=
"name"
>
m_
staticline1
</property>
<property
name=
"pane_border"
>
1
</property>
<property
name=
"pane_border"
>
1
</property>
<property
name=
"pane_position"
></property>
<property
name=
"pane_position"
></property>
<property
name=
"pane_size"
></property>
<property
name=
"pane_size"
></property>
...
@@ -507,14 +598,13 @@
...
@@ -507,14 +598,13 @@
<property
name=
"resize"
>
Resizable
</property>
<property
name=
"resize"
>
Resizable
</property>
<property
name=
"show"
>
1
</property>
<property
name=
"show"
>
1
</property>
<property
name=
"size"
></property>
<property
name=
"size"
></property>
<property
name=
"style"
></property>
<property
name=
"style"
>
wxLI_HORIZONTAL
</property>
<property
name=
"subclass"
></property>
<property
name=
"subclass"
></property>
<property
name=
"toolbar_pane"
>
0
</property>
<property
name=
"toolbar_pane"
>
0
</property>
<property
name=
"tooltip"
></property>
<property
name=
"tooltip"
></property>
<property
name=
"window_extra_style"
></property>
<property
name=
"window_extra_style"
></property>
<property
name=
"window_name"
></property>
<property
name=
"window_name"
></property>
<property
name=
"window_style"
></property>
<property
name=
"window_style"
></property>
<property
name=
"wrap"
>
320
</property>
<event
name=
"OnChar"
></event>
<event
name=
"OnChar"
></event>
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEraseBackground"
></event>
<event
name=
"OnEraseBackground"
></event>
...
@@ -542,8 +632,8 @@
...
@@ -542,8 +632,8 @@
</object>
</object>
<object
class=
"sizeritem"
expanded=
"1"
>
<object
class=
"sizeritem"
expanded=
"1"
>
<property
name=
"border"
>
5
</property>
<property
name=
"border"
>
5
</property>
<property
name=
"flag"
>
wxEXPAND
</property>
<property
name=
"flag"
>
wxEXPAND
|wxALL
</property>
<property
name=
"proportion"
>
2
</property>
<property
name=
"proportion"
>
0
</property>
<object
class=
"wxStdDialogButtonSizer"
expanded=
"1"
>
<object
class=
"wxStdDialogButtonSizer"
expanded=
"1"
>
<property
name=
"Apply"
>
0
</property>
<property
name=
"Apply"
>
0
</property>
<property
name=
"Cancel"
>
1
</property>
<property
name=
"Cancel"
>
1
</property>
...
...
pcbnew/dialogs/dialog_enum_pads_base.h
View file @
1bd70efc
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version
Apr 30 2013
)
// C++ code generated with wxFormBuilder (version
Jun 5 2014
)
// http://www.wxformbuilder.org/
// http://www.wxformbuilder.org/
//
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
...
@@ -11,6 +11,9 @@
...
@@ -11,6 +11,9 @@
#include <wx/artprov.h>
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/intl.h>
class
DIALOG_SHIM
;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/gdicmn.h>
...
@@ -18,8 +21,9 @@
...
@@ -18,8 +21,9 @@
#include <wx/colour.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/spinctrl.h>
#include <wx/spinctrl.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/dialog.h>
...
@@ -29,23 +33,24 @@
...
@@ -29,23 +33,24 @@
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_ENUM_PADS_BASE
/// Class DIALOG_ENUM_PADS_BASE
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
class
DIALOG_ENUM_PADS_BASE
:
public
wxDialog
class
DIALOG_ENUM_PADS_BASE
:
public
DIALOG_SHIM
{
{
private
:
private
:
protected
:
protected
:
wxStaticText
*
m_lblInfo
;
wxStaticText
*
m_lblPadPrefix
;
wxStaticText
*
m_lblPadPrefix
;
wxTextCtrl
*
m_padPrefix
;
wxTextCtrl
*
m_padPrefix
;
wxStaticText
*
m_lblPadStartNum
;
wxStaticText
*
m_lblPadStartNum
;
wxSpinCtrl
*
m_padStartNum
;
wxSpinCtrl
*
m_padStartNum
;
wxStatic
Text
*
m_lblInfo
;
wxStatic
Line
*
m_staticline1
;
wxStdDialogButtonSizer
*
m_stdButtons
;
wxStdDialogButtonSizer
*
m_stdButtons
;
wxButton
*
m_stdButtonsOK
;
wxButton
*
m_stdButtonsOK
;
wxButton
*
m_stdButtonsCancel
;
wxButton
*
m_stdButtonsCancel
;
public
:
public
:
DIALOG_ENUM_PADS_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
_
(
"Pad enumeration settings"
),
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
340
,
240
),
long
style
=
wxDEFAULT_DIALOG_STYLE
);
DIALOG_ENUM_PADS_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
_
(
"Pad enumeration settings"
),
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
340
,
187
),
long
style
=
wxDEFAULT_DIALOG_STYLE
|
wxRESIZE_BORDER
);
~
DIALOG_ENUM_PADS_BASE
();
~
DIALOG_ENUM_PADS_BASE
();
};
};
...
...
pcbnew/files.cpp
View file @
1bd70efc
...
@@ -327,14 +327,20 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
...
@@ -327,14 +327,20 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
break
;
break
;
}
}
// Fall through
// Fall through
case
ID_SAVE_BOARD_AS
:
case
ID_COPY_BOARD_AS
:
case
ID_SAVE_BOARD_AS
:
{
{
wxString
pro_dir
=
wxPathOnly
(
Prj
().
GetProjectFullName
()
);
wxString
pro_dir
=
wxPathOnly
(
Prj
().
GetProjectFullName
()
);
wxFileName
fn
(
pro_dir
,
_
(
"noname"
),
KiCadPcbFileExtension
);
wxFileName
fn
(
pro_dir
,
_
(
"noname"
),
KiCadPcbFileExtension
);
wxString
filename
=
fn
.
GetFullPath
();
wxString
filename
=
fn
.
GetFullPath
();
if
(
AskSaveBoardFileName
(
this
,
&
filename
)
)
if
(
AskSaveBoardFileName
(
this
,
&
filename
)
)
SavePcbFile
(
filename
,
true
);
{
if
(
id
==
ID_COPY_BOARD_AS
)
SavePcbCopy
(
filename
);
else
SavePcbFile
(
filename
,
NO_BACKUP_FILE
);
}
}
}
break
;
break
;
...
@@ -412,7 +418,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
...
@@ -412,7 +418,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
if
(
response
==
wxID_CANCEL
)
if
(
response
==
wxID_CANCEL
)
return
false
;
return
false
;
else
if
(
response
==
wxID_YES
)
else
if
(
response
==
wxID_YES
)
SavePcbFile
(
GetBoard
()
->
GetFileName
(),
true
);
SavePcbFile
(
GetBoard
()
->
GetFileName
(),
CREATE_BACKUP_FILE
);
else
else
{
{
// response == wxID_NO, fall thru
// response == wxID_NO, fall thru
...
@@ -660,6 +666,8 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
...
@@ -660,6 +666,8 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
wxString
backupFileName
;
wxString
backupFileName
;
// aCreateBackupFile == false is mainly used to write autosave files
// or new files in save as... command
if
(
aCreateBackupFile
)
if
(
aCreateBackupFile
)
{
{
backupFileName
=
create_backup_file
(
aFileName
);
backupFileName
=
create_backup_file
(
aFileName
);
...
@@ -733,6 +741,58 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
...
@@ -733,6 +741,58 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
}
}
bool
PCB_EDIT_FRAME
::
SavePcbCopy
(
const
wxString
&
aFileName
)
{
wxFileName
pcbFileName
=
aFileName
;
// Ensure the file ext is the right ext:
pcbFileName
.
SetExt
(
KiCadPcbFileExtension
);
if
(
!
IsWritable
(
pcbFileName
)
)
{
wxString
msg
=
wxString
::
Format
(
_
(
"No access rights to write to file '%s'"
),
GetChars
(
pcbFileName
.
GetFullPath
()
)
);
DisplayError
(
this
,
msg
);
return
false
;
}
GetBoard
()
->
m_Status_Pcb
&=
~
CONNEXION_OK
;
GetBoard
()
->
SynchronizeNetsAndNetClasses
();
// Select default Netclass before writing file.
// Useful to save default values in headers
SetCurrentNetClass
(
NETCLASS
::
Default
);
try
{
PLUGIN
::
RELEASER
pi
(
IO_MGR
::
PluginFind
(
IO_MGR
::
KICAD
)
);
wxASSERT
(
pcbFileName
.
IsAbsolute
()
);
pi
->
Save
(
pcbFileName
.
GetFullPath
(),
GetBoard
(),
NULL
);
}
catch
(
const
IO_ERROR
&
ioe
)
{
wxString
msg
=
wxString
::
Format
(
_
(
"Error saving board file '%s'.
\n
%s"
),
GetChars
(
pcbFileName
.
GetFullPath
()
),
GetChars
(
ioe
.
errorText
)
);
DisplayError
(
this
,
msg
);
return
false
;
}
DisplayInfoMessage
(
this
,
wxString
::
Format
(
_
(
"Board copied to:
\n
'%s'"
),
GetChars
(
pcbFileName
.
GetFullPath
()
)
)
);
return
true
;
}
bool
PCB_EDIT_FRAME
::
doAutoSave
()
bool
PCB_EDIT_FRAME
::
doAutoSave
()
{
{
wxFileName
tmpFileName
=
Prj
().
AbsolutePath
(
GetBoard
()
->
GetFileName
()
);
wxFileName
tmpFileName
=
Prj
().
AbsolutePath
(
GetBoard
()
->
GetFileName
()
);
...
...
pcbnew/footprint_wizard.cpp
View file @
1bd70efc
...
@@ -110,8 +110,7 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
...
@@ -110,8 +110,7 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
if
(
module
)
if
(
module
)
{
{
// Add the object to board
// Add the object to board
module
->
SetParent
(
(
EDA_ITEM
*
)
GetBoard
()
);
GetBoard
()
->
Add
(
module
,
ADD_APPEND
);
GetBoard
()
->
m_Modules
.
Append
(
module
);
module
->
SetPosition
(
wxPoint
(
0
,
0
)
);
module
->
SetPosition
(
wxPoint
(
0
,
0
)
);
}
}
else
else
...
...
pcbnew/menubar_pcbframe.cpp
View file @
1bd70efc
...
@@ -111,14 +111,29 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
...
@@ -111,14 +111,29 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_
(
"Save current board"
),
_
(
"Save current board"
),
KiBitmap
(
save_xpm
)
);
KiBitmap
(
save_xpm
)
);
if
(
Kiface
().
IsSingle
()
)
// not when under a project mgr
// Save as menu:
// under a project mgr we do not want to modify the board filename
// to keep consistency with the project mgr which expects files names same as prj name
// for main files
// when not under a project mgr, we are free to change filenames, cwd ...
if
(
Kiface
().
IsSingle
()
)
// not when under a project mgr (pcbnew is run as stand alone)
{
{
text
=
AddHotkeyName
(
_
(
"Sa&ve As..."
),
g_Board_Editor_Hokeys_Descr
,
HK_SAVE_BOARD_AS
);
text
=
AddHotkeyName
(
_
(
"Sa&ve As..."
),
g_Board_Editor_Hokeys_Descr
,
HK_SAVE_BOARD_AS
);
AddMenuItem
(
filesMenu
,
ID_SAVE_BOARD_AS
,
text
,
AddMenuItem
(
filesMenu
,
ID_SAVE_BOARD_AS
,
text
,
_
(
"Save the current board as..."
),
_
(
"Save the current board as..."
),
KiBitmap
(
save_as_xpm
)
);
KiBitmap
(
save_as_xpm
)
);
filesMenu
->
AppendSeparator
();
}
}
// under a project mgr, we can save a copy of the board,
// but do not change the current board file name
else
{
text
=
AddHotkeyName
(
_
(
"Sa&ve Copy As..."
),
g_Board_Editor_Hokeys_Descr
,
HK_SAVE_BOARD_AS
);
AddMenuItem
(
filesMenu
,
ID_COPY_BOARD_AS
,
text
,
_
(
"Save a copy of the current board as..."
),
KiBitmap
(
save_as_xpm
)
);
}
filesMenu
->
AppendSeparator
();
AddMenuItem
(
filesMenu
,
ID_MENU_READ_BOARD_BACKUP_FILE
,
AddMenuItem
(
filesMenu
,
ID_MENU_READ_BOARD_BACKUP_FILE
,
_
(
"Revert to Last"
),
_
(
"Revert to Last"
),
...
...
pcbnew/modedit.cpp
View file @
1bd70efc
...
@@ -120,8 +120,8 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
...
@@ -120,8 +120,8 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
{
{
wxMenu
itemMenu
;
wxMenu
itemMenu
;
// Give a title to the selection menu.
This is also a cancel menu item *
// Give a title to the selection menu.
It also allow to close the popup menu without any action
wxMenuItem
*
item_title
=
new
wxMenuItem
(
&
itemMenu
,
-
1
,
_
(
"Selection Clarification"
)
);
wxMenuItem
*
item_title
=
new
wxMenuItem
(
&
itemMenu
,
wxID_NONE
,
_
(
"Selection Clarification"
)
);
#ifdef __WINDOWS__
#ifdef __WINDOWS__
wxFont
bold_font
(
*
wxNORMAL_FONT
);
wxFont
bold_font
(
*
wxNORMAL_FONT
);
...
@@ -195,7 +195,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -195,7 +195,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
{
int
id
=
event
.
GetId
();
int
id
=
event
.
GetId
();
wxPoint
pos
;
wxPoint
pos
;
bool
redraw
=
false
;
INSTALL_UNBUFFERED_DC
(
dc
,
m_canvas
);
INSTALL_UNBUFFERED_DC
(
dc
,
m_canvas
);
...
@@ -308,7 +307,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -308,7 +307,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// module the defaults are used)
// module the defaults are used)
// This is mandatory to handle and draw pads
// This is mandatory to handle and draw pads
GetBoard
()
->
BuildListOfNets
();
GetBoard
()
->
BuildListOfNets
();
redraw
=
true
;
module
->
SetPosition
(
wxPoint
(
0
,
0
)
);
module
->
SetPosition
(
wxPoint
(
0
,
0
)
);
if
(
GetBoard
()
->
m_Modules
)
if
(
GetBoard
()
->
m_Modules
)
...
@@ -317,8 +315,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -317,8 +315,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
Zoom_Automatique
(
false
);
Zoom_Automatique
(
false
);
}
}
if
(
IsGalCanvasActive
()
)
updateView
();
updateView
();
m_canvas
->
Refresh
();
GetScreen
()
->
ClrModify
();
GetScreen
()
->
ClrModify
();
}
}
...
@@ -349,18 +347,18 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -349,18 +347,18 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetCrossHairPosition
(
wxPoint
(
0
,
0
)
);
SetCrossHairPosition
(
wxPoint
(
0
,
0
)
);
// Add the new object to board
// Add the new object to board
module
->
SetParent
(
(
EDA_ITEM
*
)
GetBoard
()
);
GetBoard
()
->
Add
(
module
,
ADD_APPEND
);
GetBoard
()
->
m_Modules
.
Append
(
module
);
// Initialize data relative to nets and netclasses (for a new
// Initialize data relative to nets and netclasses (for a new
// module the defaults are used)
// module the defaults are used)
// This is mandatory to handle and draw pads
// This is mandatory to handle and draw pads
GetBoard
()
->
BuildListOfNets
();
GetBoard
()
->
BuildListOfNets
();
redraw
=
true
;
module
->
SetPosition
(
wxPoint
(
0
,
0
)
);
module
->
SetPosition
(
wxPoint
(
0
,
0
)
);
module
->
ClearFlags
();
module
->
ClearFlags
();
Zoom_Automatique
(
false
);
Zoom_Automatique
(
false
);
updateView
();
m_canvas
->
Refresh
();
if
(
m_Draw3DFrame
)
if
(
m_Draw3DFrame
)
m_Draw3DFrame
->
NewDisplay
();
m_Draw3DFrame
->
NewDisplay
();
...
@@ -492,13 +490,13 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -492,13 +490,13 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetCrossHairPosition
(
wxPoint
(
0
,
0
)
);
SetCrossHairPosition
(
wxPoint
(
0
,
0
)
);
Import_Module
();
Import_Module
();
redraw
=
true
;
if
(
GetBoard
()
->
m_Modules
)
if
(
GetBoard
()
->
m_Modules
)
GetBoard
()
->
m_Modules
->
ClearFlags
();
GetBoard
()
->
m_Modules
->
ClearFlags
();
GetScreen
()
->
ClrModify
();
GetScreen
()
->
ClrModify
();
Zoom_Automatique
(
false
);
Zoom_Automatique
(
false
);
m_canvas
->
Refresh
();
if
(
m_Draw3DFrame
)
if
(
m_Draw3DFrame
)
m_Draw3DFrame
->
NewDisplay
();
m_Draw3DFrame
->
NewDisplay
();
...
@@ -532,7 +530,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -532,7 +530,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetCrossHairPosition
(
wxPoint
(
0
,
0
)
);
SetCrossHairPosition
(
wxPoint
(
0
,
0
)
);
LoadModuleFromLibrary
(
GetCurrentLib
(),
Prj
().
PcbFootprintLibs
(),
true
);
LoadModuleFromLibrary
(
GetCurrentLib
(),
Prj
().
PcbFootprintLibs
(),
true
);
redraw
=
true
;
if
(
GetBoard
()
->
m_Modules
)
if
(
GetBoard
()
->
m_Modules
)
GetBoard
()
->
m_Modules
->
ClearFlags
();
GetBoard
()
->
m_Modules
->
ClearFlags
();
...
@@ -564,7 +561,9 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -564,7 +561,9 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_Draw3DFrame
->
NewDisplay
();
m_Draw3DFrame
->
NewDisplay
();
GetScreen
()
->
ClrModify
();
GetScreen
()
->
ClrModify
();
updateView
();
updateView
();
m_canvas
->
Refresh
();
break
;
break
;
...
@@ -600,24 +599,22 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -600,24 +599,22 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE
:
case
ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE
:
m_canvas
->
MoveCursorToCrossHair
();
m_canvas
->
MoveCursorToCrossHair
();
Rotate_Module
(
NULL
,
(
MODULE
*
)
GetScreen
()
->
GetCurItem
(),
900
,
true
);
Rotate_Module
(
NULL
,
(
MODULE
*
)
GetScreen
()
->
GetCurItem
(),
900
,
true
);
redraw
=
true
;
m_canvas
->
Refresh
()
;
break
;
break
;
case
ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE
:
case
ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE
:
m_canvas
->
MoveCursorToCrossHair
();
m_canvas
->
MoveCursorToCrossHair
();
Rotate_Module
(
NULL
,
(
MODULE
*
)
GetScreen
()
->
GetCurItem
(),
-
900
,
true
);
Rotate_Module
(
NULL
,
(
MODULE
*
)
GetScreen
()
->
GetCurItem
(),
-
900
,
true
);
redraw
=
true
;
m_canvas
->
Refresh
()
;
break
;
break
;
case
ID_POPUP_PCB_EDIT_MODULE_PRMS
:
case
ID_POPUP_PCB_EDIT_MODULE_PRMS
:
{
{
DIALOG_MODULE_MODULE_EDITOR
dialog
(
this
,
(
MODULE
*
)
GetScreen
()
->
GetCurItem
()
);
DIALOG_MODULE_MODULE_EDITOR
dialog
(
this
,
(
MODULE
*
)
GetScreen
()
->
GetCurItem
()
);
int
ret
=
dialog
.
ShowModal
();
dialog
.
ShowModal
();
GetScreen
()
->
GetCurItem
()
->
ClearFlags
();
GetScreen
()
->
GetCurItem
()
->
ClearFlags
();
m_canvas
->
MoveCursorToCrossHair
();
m_canvas
->
MoveCursorToCrossHair
();
m_canvas
->
Refresh
();
if
(
ret
>
0
)
m_canvas
->
Refresh
();
}
}
break
;
break
;
...
@@ -696,6 +693,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -696,6 +693,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH
:
case
ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH
:
{
{
EDGE_MODULE
*
edge
=
NULL
;
EDGE_MODULE
*
edge
=
NULL
;
if
(
GetScreen
()
->
GetCurItem
()
if
(
GetScreen
()
->
GetCurItem
()
&&
(
GetScreen
()
->
GetCurItem
()
->
Type
()
==
PCB_MODULE_EDGE_T
)
)
&&
(
GetScreen
()
->
GetCurItem
()
->
Type
()
==
PCB_MODULE_EDGE_T
)
)
{
{
...
@@ -739,7 +737,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -739,7 +737,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case
ID_MODEDIT_MODULE_MIRROR
:
case
ID_MODEDIT_MODULE_MIRROR
:
SaveCopyInUndoList
(
GetBoard
()
->
m_Modules
,
UR_MODEDIT
);
SaveCopyInUndoList
(
GetBoard
()
->
m_Modules
,
UR_MODEDIT
);
Transform
(
(
MODULE
*
)
GetScreen
()
->
GetCurItem
(),
id
);
Transform
(
(
MODULE
*
)
GetScreen
()
->
GetCurItem
(),
id
);
redraw
=
true
;
m_canvas
->
Refresh
()
;
break
;
break
;
case
ID_PCB_DRAWINGS_WIDTHS_SETUP
:
case
ID_PCB_DRAWINGS_WIDTHS_SETUP
:
...
@@ -811,9 +809,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -811,9 +809,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
wxT
(
"FOOTPRINT_EDIT_FRAME::Process_Special_Functions error"
)
);
wxT
(
"FOOTPRINT_EDIT_FRAME::Process_Special_Functions error"
)
);
break
;
break
;
}
}
if
(
redraw
)
m_canvas
->
Refresh
();
}
}
...
...
pcbnew/pad_edition_functions.cpp
View file @
1bd70efc
...
@@ -161,9 +161,10 @@ void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw )
...
@@ -161,9 +161,10 @@ void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw )
// Add the new pad to end of the module pad list.
// Add the new pad to end of the module pad list.
aModule
->
Pads
().
PushBack
(
pad
);
aModule
->
Pads
().
PushBack
(
pad
);
// Update the pad properties.
// Update the pad properties,
// and keep NETINFO_LIST::ORPHANED as net info
// which is the default when nets cannot be handled.
Import_Pad_Settings
(
pad
,
false
);
Import_Pad_Settings
(
pad
,
false
);
pad
->
SetNetCode
(
NETINFO_LIST
::
UNCONNECTED
);
pad
->
SetPosition
(
GetCrossHairPosition
()
);
pad
->
SetPosition
(
GetCrossHairPosition
()
);
...
...
pcbnew/pcbframe.cpp
View file @
1bd70efc
...
@@ -120,6 +120,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
...
@@ -120,6 +120,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU
(
ID_APPEND_FILE
,
PCB_EDIT_FRAME
::
Files_io
)
EVT_MENU
(
ID_APPEND_FILE
,
PCB_EDIT_FRAME
::
Files_io
)
EVT_MENU
(
ID_SAVE_BOARD_AS
,
PCB_EDIT_FRAME
::
Files_io
)
EVT_MENU
(
ID_SAVE_BOARD_AS
,
PCB_EDIT_FRAME
::
Files_io
)
EVT_MENU
(
ID_COPY_BOARD_AS
,
PCB_EDIT_FRAME
::
Files_io
)
EVT_MENU_RANGE
(
wxID_FILE1
,
wxID_FILE9
,
PCB_EDIT_FRAME
::
OnFileHistory
)
EVT_MENU_RANGE
(
wxID_FILE1
,
wxID_FILE9
,
PCB_EDIT_FRAME
::
OnFileHistory
)
EVT_MENU
(
ID_GEN_PLOT
,
PCB_EDIT_FRAME
::
ToPlotter
)
EVT_MENU
(
ID_GEN_PLOT
,
PCB_EDIT_FRAME
::
ToPlotter
)
...
@@ -693,24 +694,26 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )
...
@@ -693,24 +694,26 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )
void
PCB_EDIT_FRAME
::
SwitchCanvas
(
wxCommandEvent
&
aEvent
)
void
PCB_EDIT_FRAME
::
SwitchCanvas
(
wxCommandEvent
&
aEvent
)
{
{
int
id
=
aEvent
.
GetId
();
int
id
=
aEvent
.
GetId
();
bool
use_gal
=
false
;
switch
(
id
)
switch
(
id
)
{
{
case
ID_MENU_CANVAS_DEFAULT
:
case
ID_MENU_CANVAS_DEFAULT
:
Compile_Ratsnest
(
NULL
,
true
);
UseGalCanvas
(
false
);
break
;
break
;
case
ID_MENU_CANVAS_CAIRO
:
case
ID_MENU_CANVAS_CAIRO
:
GetGalCanvas
()
->
SwitchBackend
(
EDA_DRAW_PANEL_GAL
::
GAL_TYPE_CAIRO
);
use_gal
=
GetGalCanvas
()
->
SwitchBackend
(
EDA_DRAW_PANEL_GAL
::
GAL_TYPE_CAIRO
);
UseGalCanvas
(
true
);
break
;
break
;
case
ID_MENU_CANVAS_OPENGL
:
case
ID_MENU_CANVAS_OPENGL
:
GetGalCanvas
()
->
SwitchBackend
(
EDA_DRAW_PANEL_GAL
::
GAL_TYPE_OPENGL
);
use_gal
=
GetGalCanvas
()
->
SwitchBackend
(
EDA_DRAW_PANEL_GAL
::
GAL_TYPE_OPENGL
);
UseGalCanvas
(
true
);
break
;
break
;
}
}
if
(
!
use_gal
)
Compile_Ratsnest
(
NULL
,
true
);
UseGalCanvas
(
use_gal
);
}
}
...
...
pcbnew/pcbnew.cpp
View file @
1bd70efc
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-201
2
KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-201
5
KiCad Developers, see AUTHORS.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* modify it under the terms of the GNU General Public License
...
@@ -109,57 +109,46 @@ static struct IFACE : public KIFACE_I
...
@@ -109,57 +109,46 @@ static struct IFACE : public KIFACE_I
wxWindow
*
CreateWindow
(
wxWindow
*
aParent
,
int
aClassId
,
KIWAY
*
aKiway
,
int
aCtlBits
=
0
)
wxWindow
*
CreateWindow
(
wxWindow
*
aParent
,
int
aClassId
,
KIWAY
*
aKiway
,
int
aCtlBits
=
0
)
{
{
wxWindow
*
frame
=
NULL
;
switch
(
aClassId
)
switch
(
aClassId
)
{
{
case
FRAME_PCB
:
case
FRAME_PCB
:
{
frame
=
dynamic_cast
<
wxWindow
*
>
(
new
PCB_EDIT_FRAME
(
aKiway
,
aParent
)
);
PCB_EDIT_FRAME
*
frame
=
new
PCB_EDIT_FRAME
(
aKiway
,
aParent
);
#if defined(
KICAD_SCRIPTING
)
#if defined(
KICAD_SCRIPTING
)
// give the scripting helpers access to our frame
// give the scripting helpers access to our frame
ScriptingSetPcbEditFrame
(
frame
);
ScriptingSetPcbEditFrame
(
(
PCB_EDIT_FRAME
*
)
frame
);
#endif
#endif
if
(
Kiface
().
IsSingle
()
)
if
(
Kiface
().
IsSingle
()
)
{
{
// only run this under single_top, not under a project manager.
// only run this under single_top, not under a project manager.
CreateServer
(
frame
,
KICAD_PCB_PORT_SERVICE_NUMBER
);
CreateServer
(
frame
,
KICAD_PCB_PORT_SERVICE_NUMBER
);
}
return
frame
;
}
}
break
;
break
;
case
FRAME_PCB_MODULE_EDITOR
:
case
FRAME_PCB_MODULE_EDITOR
:
{
frame
=
dynamic_cast
<
wxWindow
*
>
(
new
FOOTPRINT_EDIT_FRAME
(
aKiway
,
aParent
)
);
FOOTPRINT_EDIT_FRAME
*
frame
=
new
FOOTPRINT_EDIT_FRAME
(
aKiway
,
aParent
);
return
frame
;
}
break
;
break
;
case
FRAME_PCB_MODULE_VIEWER
:
case
FRAME_PCB_MODULE_VIEWER
:
case
FRAME_PCB_MODULE_VIEWER_MODAL
:
case
FRAME_PCB_MODULE_VIEWER_MODAL
:
{
frame
=
dynamic_cast
<
wxWindow
*
>
(
new
FOOTPRINT_VIEWER_FRAME
(
aKiway
,
aParent
,
FOOTPRINT_VIEWER_FRAME
*
frame
=
new
FOOTPRINT_VIEWER_FRAME
(
FRAME_T
(
aClassId
)
)
);
aKiway
,
aParent
,
FRAME_T
(
aClassId
)
);
return
frame
;
}
break
;
break
;
case
FRAME_PCB_FOOTPRINT_WIZARD_MODAL
:
case
FRAME_PCB_FOOTPRINT_WIZARD_MODAL
:
{
frame
=
dynamic_cast
<
wxWindow
*
>
(
new
FOOTPRINT_WIZARD_FRAME
(
aKiway
,
aParent
,
FOOTPRINT_WIZARD_FRAME
*
frame
=
new
FOOTPRINT_WIZARD_FRAME
(
FRAME_T
(
aClassId
)
)
);
aKiway
,
aParent
,
FRAME_T
(
aClassId
)
);
return
frame
;
}
break
;
break
;
default:
default:
;
;
}
}
return
NULL
;
return
frame
;
}
}
/**
/**
...
@@ -193,13 +182,13 @@ KIFACE_I& Kiface() { return kiface; }
...
@@ -193,13 +182,13 @@ KIFACE_I& Kiface() { return kiface; }
// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
MY_API
(
KIFACE
*
)
KIFACE_GETTER
(
int
*
aKIFACEversion
,
int
aKiwayVersion
,
PGM_BASE
*
aProgram
)
MY_API
(
KIFACE
*
)
KIFACE_GETTER
(
int
*
aKIFACEversion
,
int
aKiwayVersion
,
PGM_BASE
*
aProgram
)
{
{
process
=
(
PGM_BASE
*
)
aProgram
;
process
=
(
PGM_BASE
*
)
aProgram
;
return
&
kiface
;
return
&
kiface
;
}
}
#if defined(
BUILD_KIWAY_DLL
)
#if defined(
BUILD_KIWAY_DLL
)
PGM_BASE
&
Pgm
()
PGM_BASE
&
Pgm
()
{
{
wxASSERT
(
process
);
// KIFACE_GETTER has already been called.
wxASSERT
(
process
);
// KIFACE_GETTER has already been called.
...
@@ -208,7 +197,7 @@ PGM_BASE& Pgm()
...
@@ -208,7 +197,7 @@ PGM_BASE& Pgm()
#endif
#endif
#if defined(
KICAD_SCRIPTING
)
#if defined(
KICAD_SCRIPTING
)
static
bool
scriptingSetup
()
static
bool
scriptingSetup
()
{
{
wxString
path_frag
;
wxString
path_frag
;
...
@@ -218,7 +207,7 @@ static bool scriptingSetup()
...
@@ -218,7 +207,7 @@ static bool scriptingSetup()
const
wxString
python_us
(
"python27_us"
);
const
wxString
python_us
(
"python27_us"
);
// Build our python path inside kicad
// Build our python path inside kicad
wxString
kipython
=
FindKicadFile
(
python_us
+
wxT
(
"/python.exe"
)
);
wxString
kipython
=
FindKicadFile
(
python_us
+
wxT
(
"/python.exe"
)
);
//we need only the path:
//we need only the path:
wxFileName
fn
(
kipython
);
wxFileName
fn
(
kipython
);
...
@@ -231,19 +220,20 @@ static bool scriptingSetup()
...
@@ -231,19 +220,20 @@ static bool scriptingSetup()
if
(
!
wxGetEnv
(
wxT
(
"PYTHONPATH"
),
&
ppath
)
||
!
ppath
.
Contains
(
python_us
)
)
if
(
!
wxGetEnv
(
wxT
(
"PYTHONPATH"
),
&
ppath
)
||
!
ppath
.
Contains
(
python_us
)
)
{
{
ppath
<<
kipython
<<
wxT
(
"/pylib;"
);
ppath
<<
kipython
<<
wxT
(
"/pylib;"
);
ppath
<<
kipython
<<
wxT
(
"/lib;"
);
ppath
<<
kipython
<<
wxT
(
"/lib;"
);
ppath
<<
kipython
<<
wxT
(
"/dll"
);
ppath
<<
kipython
<<
wxT
(
"/dll"
);
wxSetEnv
(
wxT
(
"PYTHONPATH"
),
ppath
);
wxSetEnv
(
wxT
(
"PYTHONPATH"
),
ppath
);
DBG
(
std
::
cout
<<
"set PYTHONPATH to "
<<
TO_UTF8
(
ppath
)
<<
"
\n
"
;
)
// DBG( std::cout << "set PYTHONPATH to " << TO_UTF8( ppath
) << "\n"; )
// Add python executable path:
// Add python executable path:
wxGetEnv
(
wxT
(
"PATH"
),
&
ppath
);
wxGetEnv
(
wxT
(
"PATH"
),
&
ppath
);
if
(
!
ppath
.
Contains
(
python_us
)
)
if
(
!
ppath
.
Contains
(
python_us
)
)
{
{
kipython
<<
wxT
(
";"
)
<<
ppath
;
kipython
<<
wxT
(
";"
)
<<
ppath
;
wxSetEnv
(
wxT
(
"PATH"
),
kipython
);
wxSetEnv
(
wxT
(
"PATH"
),
kipython
);
DBG
(
std
::
cout
<<
"set PATH to "
<<
TO_UTF8
(
kipython
)
<<
"
\n
"
;
)
// DBG( std::cout << "set PATH to " << TO_UTF8( kipython
) << "\n"; )
}
}
}
}
}
}
...
@@ -263,14 +253,20 @@ static bool scriptingSetup()
...
@@ -263,14 +253,20 @@ static bool scriptingSetup()
// Add default paths to PYTHONPATH
// Add default paths to PYTHONPATH
wxString
pypath
;
wxString
pypath
;
// User scripting folder (~/Library/Application Support/kicad/scripting/plugins)
// User scripting folder (~/Library/Application Support/kicad/scripting/plugins)
pypath
=
GetOSXKicadUserDataDir
()
+
wxT
(
"/scripting/plugins"
);
pypath
=
GetOSXKicadUserDataDir
()
+
wxT
(
"/scripting/plugins"
);
// Machine scripting folder (/Library/Application Support/kicad/scripting/plugins)
// Machine scripting folder (/Library/Application Support/kicad/scripting/plugins)
pypath
+=
wxT
(
":"
)
+
GetOSXKicadMachineDataDir
()
+
wxT
(
"/scripting/plugins"
);
pypath
+=
wxT
(
":"
)
+
GetOSXKicadMachineDataDir
()
+
wxT
(
"/scripting/plugins"
);
// Bundle scripting folder (<kicad.app>/Contents/SharedSupport/scripting/plugins)
// Bundle scripting folder (<kicad.app>/Contents/SharedSupport/scripting/plugins)
pypath
+=
wxT
(
":"
)
+
GetOSXKicadDataDir
()
+
wxT
(
"/scripting/plugins"
);
pypath
+=
wxT
(
":"
)
+
GetOSXKicadDataDir
()
+
wxT
(
"/scripting/plugins"
);
// Bundle wxPython folder (<kicad.app>/Contents/Frameworks/python/site-packages)
// Bundle wxPython folder (<kicad.app>/Contents/Frameworks/python/site-packages)
pypath
+=
wxT
(
":"
)
+
Pgm
().
GetExecutablePath
()
+
wxT
(
"Contents/Frameworks/python/site-packages"
);
pypath
+=
wxT
(
":"
)
+
Pgm
().
GetExecutablePath
()
+
wxT
(
"Contents/Frameworks/python/site-packages"
);
// Original content of $PYTHONPATH
// Original content of $PYTHONPATH
if
(
wxGetenv
(
"PYTHONPATH"
)
!=
NULL
)
if
(
wxGetenv
(
"PYTHONPATH"
)
!=
NULL
)
{
{
...
@@ -289,6 +285,7 @@ static bool scriptingSetup()
...
@@ -289,6 +285,7 @@ static bool scriptingSetup()
wxLogSysError
(
wxT
(
"pcbnewInitPythonScripting() failed."
)
);
wxLogSysError
(
wxT
(
"pcbnewInitPythonScripting() failed."
)
);
return
false
;
return
false
;
}
}
return
true
;
return
true
;
}
}
#endif // KICAD_SCRIPTING
#endif // KICAD_SCRIPTING
...
...
pcbnew/pcbnew_id.h
View file @
1bd70efc
...
@@ -21,6 +21,7 @@ enum pcbnew_ids
...
@@ -21,6 +21,7 @@ enum pcbnew_ids
ID_OPEN_MODULE_VIEWER
,
ID_OPEN_MODULE_VIEWER
,
ID_READ_NETLIST
,
ID_READ_NETLIST
,
ID_SET_RELATIVE_OFFSET
,
ID_SET_RELATIVE_OFFSET
,
ID_COPY_BOARD_AS
,
// Right vertical tool bar command IDs.
// Right vertical tool bar command IDs.
ID_PCB_HIGHLIGHT_BUTT
,
ID_PCB_HIGHLIGHT_BUTT
,
...
...
pcbnew/router/router_tool.cpp
View file @
1bd70efc
...
@@ -725,7 +725,7 @@ void ROUTER_TOOL::performRouting()
...
@@ -725,7 +725,7 @@ void ROUTER_TOOL::performRouting()
}
}
int
ROUTER_TOOL
::
Main
(
TOOL_EVENT
&
aEvent
)
int
ROUTER_TOOL
::
Main
(
const
TOOL_EVENT
&
aEvent
)
{
{
VIEW_CONTROLS
*
ctls
=
getViewControls
();
VIEW_CONTROLS
*
ctls
=
getViewControls
();
PCB_EDIT_FRAME
*
frame
=
getEditFrame
<
PCB_EDIT_FRAME
>
();
PCB_EDIT_FRAME
*
frame
=
getEditFrame
<
PCB_EDIT_FRAME
>
();
...
...
pcbnew/router/router_tool.h
View file @
1bd70efc
...
@@ -41,7 +41,7 @@ public:
...
@@ -41,7 +41,7 @@ public:
~
ROUTER_TOOL
();
~
ROUTER_TOOL
();
void
Reset
(
RESET_REASON
aReason
);
void
Reset
(
RESET_REASON
aReason
);
int
Main
(
TOOL_EVENT
&
aEvent
);
int
Main
(
const
TOOL_EVENT
&
aEvent
);
private
:
private
:
PNS_ITEM
*
pickSingleItem
(
const
VECTOR2I
&
aWhere
,
int
aNet
=
-
1
,
int
aLayer
=
-
1
);
PNS_ITEM
*
pickSingleItem
(
const
VECTOR2I
&
aWhere
,
int
aNet
=
-
1
,
int
aLayer
=
-
1
);
...
...
pcbnew/tools/drawing_tool.cpp
View file @
1bd70efc
...
@@ -52,7 +52,8 @@
...
@@ -52,7 +52,8 @@
#include <class_module.h>
#include <class_module.h>
DRAWING_TOOL
::
DRAWING_TOOL
()
:
DRAWING_TOOL
::
DRAWING_TOOL
()
:
TOOL_INTERACTIVE
(
"pcbnew.InteractiveDrawing"
),
m_editModules
(
false
)
TOOL_INTERACTIVE
(
"pcbnew.InteractiveDrawing"
),
m_view
(
NULL
),
m_controls
(
NULL
),
m_board
(
NULL
),
m_frame
(
NULL
),
m_editModules
(
false
),
m_lineWidth
(
1
)
{
{
}
}
...
@@ -74,7 +75,7 @@ void DRAWING_TOOL::Reset( RESET_REASON aReason )
...
@@ -74,7 +75,7 @@ void DRAWING_TOOL::Reset( RESET_REASON aReason )
}
}
int
DRAWING_TOOL
::
DrawLine
(
TOOL_EVENT
&
aEvent
)
int
DRAWING_TOOL
::
DrawLine
(
const
TOOL_EVENT
&
aEvent
)
{
{
boost
::
optional
<
VECTOR2D
>
startingPoint
;
boost
::
optional
<
VECTOR2D
>
startingPoint
;
...
@@ -135,7 +136,7 @@ int DRAWING_TOOL::DrawLine( TOOL_EVENT& aEvent )
...
@@ -135,7 +136,7 @@ int DRAWING_TOOL::DrawLine( TOOL_EVENT& aEvent )
}
}
int
DRAWING_TOOL
::
DrawCircle
(
TOOL_EVENT
&
aEvent
)
int
DRAWING_TOOL
::
DrawCircle
(
const
TOOL_EVENT
&
aEvent
)
{
{
if
(
m_editModules
)
if
(
m_editModules
)
{
{
...
@@ -184,7 +185,7 @@ int DRAWING_TOOL::DrawCircle( TOOL_EVENT& aEvent )
...
@@ -184,7 +185,7 @@ int DRAWING_TOOL::DrawCircle( TOOL_EVENT& aEvent )
}
}
int
DRAWING_TOOL
::
DrawArc
(
TOOL_EVENT
&
aEvent
)
int
DRAWING_TOOL
::
DrawArc
(
const
TOOL_EVENT
&
aEvent
)
{
{
if
(
m_editModules
)
if
(
m_editModules
)
{
{
...
@@ -233,7 +234,7 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent )
...
@@ -233,7 +234,7 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent )
}
}
int
DRAWING_TOOL
::
PlaceText
(
TOOL_EVENT
&
aEvent
)
int
DRAWING_TOOL
::
PlaceText
(
const
TOOL_EVENT
&
aEvent
)
{
{
if
(
m_editModules
)
if
(
m_editModules
)
return
placeTextModule
();
return
placeTextModule
();
...
@@ -242,7 +243,7 @@ int DRAWING_TOOL::PlaceText( TOOL_EVENT& aEvent )
...
@@ -242,7 +243,7 @@ int DRAWING_TOOL::PlaceText( TOOL_EVENT& aEvent )
}
}
int
DRAWING_TOOL
::
DrawDimension
(
TOOL_EVENT
&
aEvent
)
int
DRAWING_TOOL
::
DrawDimension
(
const
TOOL_EVENT
&
aEvent
)
{
{
DIMENSION
*
dimension
=
NULL
;
DIMENSION
*
dimension
=
NULL
;
int
width
,
maxThickness
;
int
width
,
maxThickness
;
...
@@ -421,7 +422,7 @@ int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent )
...
@@ -421,7 +422,7 @@ int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent )
}
}
int
DRAWING_TOOL
::
DrawZone
(
TOOL_EVENT
&
aEvent
)
int
DRAWING_TOOL
::
DrawZone
(
const
TOOL_EVENT
&
aEvent
)
{
{
m_frame
->
SetToolID
(
ID_PCB_ZONES_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add zones"
)
);
m_frame
->
SetToolID
(
ID_PCB_ZONES_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add zones"
)
);
...
@@ -429,7 +430,7 @@ int DRAWING_TOOL::DrawZone( TOOL_EVENT& aEvent )
...
@@ -429,7 +430,7 @@ int DRAWING_TOOL::DrawZone( TOOL_EVENT& aEvent )
}
}
int
DRAWING_TOOL
::
DrawKeepout
(
TOOL_EVENT
&
aEvent
)
int
DRAWING_TOOL
::
DrawKeepout
(
const
TOOL_EVENT
&
aEvent
)
{
{
m_frame
->
SetToolID
(
ID_PCB_KEEPOUT_AREA_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add keepout"
)
);
m_frame
->
SetToolID
(
ID_PCB_KEEPOUT_AREA_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Add keepout"
)
);
...
@@ -437,7 +438,7 @@ int DRAWING_TOOL::DrawKeepout( TOOL_EVENT& aEvent )
...
@@ -437,7 +438,7 @@ int DRAWING_TOOL::DrawKeepout( TOOL_EVENT& aEvent )
}
}
int
DRAWING_TOOL
::
PlaceTarget
(
TOOL_EVENT
&
aEvent
)
int
DRAWING_TOOL
::
PlaceTarget
(
const
TOOL_EVENT
&
aEvent
)
{
{
PCB_TARGET
*
target
=
new
PCB_TARGET
(
m_board
);
PCB_TARGET
*
target
=
new
PCB_TARGET
(
m_board
);
...
@@ -525,7 +526,7 @@ int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent )
...
@@ -525,7 +526,7 @@ int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent )
}
}
int
DRAWING_TOOL
::
PlaceModule
(
TOOL_EVENT
&
aEvent
)
int
DRAWING_TOOL
::
PlaceModule
(
const
TOOL_EVENT
&
aEvent
)
{
{
MODULE
*
module
=
NULL
;
MODULE
*
module
=
NULL
;
...
@@ -635,7 +636,7 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent )
...
@@ -635,7 +636,7 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent )
}
}
int
DRAWING_TOOL
::
PlaceDXF
(
TOOL_EVENT
&
aEvent
)
int
DRAWING_TOOL
::
PlaceDXF
(
const
TOOL_EVENT
&
aEvent
)
{
{
DIALOG_DXF_IMPORT
dlg
(
m_frame
);
DIALOG_DXF_IMPORT
dlg
(
m_frame
);
int
dlgResult
=
dlg
.
ShowModal
();
int
dlgResult
=
dlg
.
ShowModal
();
...
@@ -825,7 +826,7 @@ int DRAWING_TOOL::PlaceDXF( TOOL_EVENT& aEvent )
...
@@ -825,7 +826,7 @@ int DRAWING_TOOL::PlaceDXF( TOOL_EVENT& aEvent )
}
}
int
DRAWING_TOOL
::
SetAnchor
(
TOOL_EVENT
&
aEvent
)
int
DRAWING_TOOL
::
SetAnchor
(
const
TOOL_EVENT
&
aEvent
)
{
{
assert
(
m_editModules
);
assert
(
m_editModules
);
...
@@ -901,7 +902,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
...
@@ -901,7 +902,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
// Init the new item attributes
// Init the new item attributes
aGraphic
->
SetShape
(
(
STROKE_T
)
aShape
);
aGraphic
->
SetShape
(
(
STROKE_T
)
aShape
);
aGraphic
->
SetWidth
(
lineWidth
);
aGraphic
->
SetWidth
(
m_
lineWidth
);
aGraphic
->
SetStart
(
wxPoint
(
aStartingPoint
->
x
,
aStartingPoint
->
y
)
);
aGraphic
->
SetStart
(
wxPoint
(
aStartingPoint
->
x
,
aStartingPoint
->
y
)
);
aGraphic
->
SetEnd
(
wxPoint
(
cursorPos
.
x
,
cursorPos
.
y
)
);
aGraphic
->
SetEnd
(
wxPoint
(
cursorPos
.
x
,
cursorPos
.
y
)
);
aGraphic
->
SetLayer
(
layer
);
aGraphic
->
SetLayer
(
layer
);
...
@@ -963,8 +964,8 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
...
@@ -963,8 +964,8 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
{
{
// Init the new item attributes
// Init the new item attributes
aGraphic
->
SetShape
(
(
STROKE_T
)
aShape
);
aGraphic
->
SetShape
(
(
STROKE_T
)
aShape
);
lineWidth
=
getSegmentWidth
(
layer
);
m_
lineWidth
=
getSegmentWidth
(
layer
);
aGraphic
->
SetWidth
(
lineWidth
);
aGraphic
->
SetWidth
(
m_
lineWidth
);
aGraphic
->
SetStart
(
wxPoint
(
cursorPos
.
x
,
cursorPos
.
y
)
);
aGraphic
->
SetStart
(
wxPoint
(
cursorPos
.
x
,
cursorPos
.
y
)
);
aGraphic
->
SetEnd
(
wxPoint
(
cursorPos
.
x
,
cursorPos
.
y
)
);
aGraphic
->
SetEnd
(
wxPoint
(
cursorPos
.
x
,
cursorPos
.
y
)
);
aGraphic
->
SetLayer
(
layer
);
aGraphic
->
SetLayer
(
layer
);
...
@@ -1012,17 +1013,17 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
...
@@ -1012,17 +1013,17 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
else
if
(
evt
->
IsAction
(
&
COMMON_ACTIONS
::
incWidth
)
)
else
if
(
evt
->
IsAction
(
&
COMMON_ACTIONS
::
incWidth
)
)
{
{
lineWidth
+=
WIDTH_STEP
;
m_
lineWidth
+=
WIDTH_STEP
;
aGraphic
->
SetWidth
(
lineWidth
);
aGraphic
->
SetWidth
(
m_
lineWidth
);
updatePreview
=
true
;
updatePreview
=
true
;
}
}
else
if
(
evt
->
IsAction
(
&
COMMON_ACTIONS
::
decWidth
)
)
else
if
(
evt
->
IsAction
(
&
COMMON_ACTIONS
::
decWidth
)
)
{
{
if
(
lineWidth
>
(
unsigned
)
WIDTH_STEP
)
if
(
m_
lineWidth
>
(
unsigned
)
WIDTH_STEP
)
{
{
lineWidth
-=
WIDTH_STEP
;
m_
lineWidth
-=
WIDTH_STEP
;
aGraphic
->
SetWidth
(
lineWidth
);
aGraphic
->
SetWidth
(
m_
lineWidth
);
updatePreview
=
true
;
updatePreview
=
true
;
}
}
}
}
...
...
pcbnew/tools/drawing_tool.h
View file @
1bd70efc
...
@@ -58,7 +58,7 @@ public:
...
@@ -58,7 +58,7 @@ public:
* to click at least two times to determine the origin and the end for a line. If there are
* to click at least two times to determine the origin and the end for a line. If there are
* more clicks, the line is drawn as a continous polyline.
* more clicks, the line is drawn as a continous polyline.
*/
*/
int
DrawLine
(
TOOL_EVENT
&
aEvent
);
int
DrawLine
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function DrawCircle()
* Function DrawCircle()
...
@@ -66,7 +66,7 @@ public:
...
@@ -66,7 +66,7 @@ public:
* to first click on a point that is going to be used as the center of the circle. The second
* to first click on a point that is going to be used as the center of the circle. The second
* click determines the circle radius.
* click determines the circle radius.
*/
*/
int
DrawCircle
(
TOOL_EVENT
&
aEvent
);
int
DrawCircle
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function DrawArc()
* Function DrawArc()
...
@@ -74,14 +74,14 @@ public:
...
@@ -74,14 +74,14 @@ public:
* to first click on a point that is going to be used as the center of the arc. The second
* to first click on a point that is going to be used as the center of the arc. The second
* click determines the origin and radius, the third one - the angle.
* click determines the origin and radius, the third one - the angle.
*/
*/
int
DrawArc
(
TOOL_EVENT
&
aEvent
);
int
DrawArc
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function PlaceText()
* Function PlaceText()
* Displays a dialog that allows to input text and its settings and then lets the user decide
* Displays a dialog that allows to input text and its settings and then lets the user decide
* where to place the text in editor.
* where to place the text in editor.
*/
*/
int
PlaceText
(
TOOL_EVENT
&
aEvent
);
int
PlaceText
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function DrawDimension()
* Function DrawDimension()
...
@@ -89,7 +89,7 @@ public:
...
@@ -89,7 +89,7 @@ public:
* to first click on a point that is going to be used as the origin of the dimension.
* to first click on a point that is going to be used as the origin of the dimension.
* The second click determines the end and the third click modifies its height.
* The second click determines the end and the third click modifies its height.
*/
*/
int
DrawDimension
(
TOOL_EVENT
&
aEvent
);
int
DrawDimension
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function DrawZone()
* Function DrawZone()
...
@@ -98,7 +98,7 @@ public:
...
@@ -98,7 +98,7 @@ public:
* as a boundary polygon of the zone. Double click or clicking on the origin of the boundary
* as a boundary polygon of the zone. Double click or clicking on the origin of the boundary
* polyline finishes the drawing.
* polyline finishes the drawing.
*/
*/
int
DrawZone
(
TOOL_EVENT
&
aEvent
);
int
DrawZone
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function DrawKeepout()
* Function DrawKeepout()
...
@@ -107,31 +107,31 @@ public:
...
@@ -107,31 +107,31 @@ public:
* be used as a boundary polygon of the area. Double click or clicking on the origin of the
* be used as a boundary polygon of the area. Double click or clicking on the origin of the
* boundary polyline finishes the drawing.
* boundary polyline finishes the drawing.
*/
*/
int
DrawKeepout
(
TOOL_EVENT
&
aEvent
);
int
DrawKeepout
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function PlaceTarget()
* Function PlaceTarget()
* Allows user to place a layer alignment target.
* Allows user to place a layer alignment target.
*/
*/
int
PlaceTarget
(
TOOL_EVENT
&
aEvent
);
int
PlaceTarget
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function PlaceModule()
* Function PlaceModule()
* Displays a dialog to select a module to be added and allows the user to set its position.
* Displays a dialog to select a module to be added and allows the user to set its position.
*/
*/
int
PlaceModule
(
TOOL_EVENT
&
aEvent
);
int
PlaceModule
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function PlaceDXF()
* Function PlaceDXF()
* Places a drawing imported from a DXF file in module editor.
* Places a drawing imported from a DXF file in module editor.
*/
*/
int
PlaceDXF
(
TOOL_EVENT
&
aEvent
);
int
PlaceDXF
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function SetAnchor()
* Function SetAnchor()
* Places the footprint anchor (only in module editor).
* Places the footprint anchor (only in module editor).
*/
*/
int
SetAnchor
(
TOOL_EVENT
&
aEvent
);
int
SetAnchor
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function EditModules()
* Function EditModules()
...
@@ -203,7 +203,7 @@ private:
...
@@ -203,7 +203,7 @@ private:
bool
m_editModules
;
bool
m_editModules
;
/// Stores the current line width for multisegment drawing.
/// Stores the current line width for multisegment drawing.
unsigned
int
lineWidth
;
unsigned
int
m_
lineWidth
;
// How does line width change after one -/+ key press.
// How does line width change after one -/+ key press.
static
const
int
WIDTH_STEP
=
100000
;
static
const
int
WIDTH_STEP
=
100000
;
...
...
pcbnew/tools/edit_tool.cpp
View file @
1bd70efc
...
@@ -43,7 +43,8 @@
...
@@ -43,7 +43,8 @@
#include "edit_tool.h"
#include "edit_tool.h"
EDIT_TOOL
::
EDIT_TOOL
()
:
EDIT_TOOL
::
EDIT_TOOL
()
:
TOOL_INTERACTIVE
(
"pcbnew.InteractiveEdit"
),
m_selectionTool
(
NULL
),
m_editModules
(
false
)
TOOL_INTERACTIVE
(
"pcbnew.InteractiveEdit"
),
m_selectionTool
(
NULL
),
m_dragging
(
false
),
m_editModules
(
false
),
m_updateFlag
(
KIGFX
::
VIEW_ITEM
::
NONE
)
{
{
}
}
...
@@ -51,6 +52,7 @@ EDIT_TOOL::EDIT_TOOL() :
...
@@ -51,6 +52,7 @@ EDIT_TOOL::EDIT_TOOL() :
void
EDIT_TOOL
::
Reset
(
RESET_REASON
aReason
)
void
EDIT_TOOL
::
Reset
(
RESET_REASON
aReason
)
{
{
m_dragging
=
false
;
m_dragging
=
false
;
m_updateFlag
=
KIGFX
::
VIEW_ITEM
::
NONE
;
}
}
...
@@ -81,7 +83,7 @@ bool EDIT_TOOL::Init()
...
@@ -81,7 +83,7 @@ bool EDIT_TOOL::Init()
}
}
int
EDIT_TOOL
::
Main
(
TOOL_EVENT
&
aEvent
)
int
EDIT_TOOL
::
Main
(
const
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
...
@@ -238,7 +240,7 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
...
@@ -238,7 +240,7 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
}
}
int
EDIT_TOOL
::
Properties
(
TOOL_EVENT
&
aEvent
)
int
EDIT_TOOL
::
Properties
(
const
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
PCB_BASE_EDIT_FRAME
*
editFrame
=
getEditFrame
<
PCB_BASE_EDIT_FRAME
>
();
PCB_BASE_EDIT_FRAME
*
editFrame
=
getEditFrame
<
PCB_BASE_EDIT_FRAME
>
();
...
@@ -307,7 +309,7 @@ int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
...
@@ -307,7 +309,7 @@ int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
}
}
int
EDIT_TOOL
::
Rotate
(
TOOL_EVENT
&
aEvent
)
int
EDIT_TOOL
::
Rotate
(
const
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
PCB_BASE_EDIT_FRAME
*
editFrame
=
getEditFrame
<
PCB_BASE_EDIT_FRAME
>
();
PCB_BASE_EDIT_FRAME
*
editFrame
=
getEditFrame
<
PCB_BASE_EDIT_FRAME
>
();
...
@@ -361,7 +363,7 @@ int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent )
...
@@ -361,7 +363,7 @@ int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent )
}
}
int
EDIT_TOOL
::
Flip
(
TOOL_EVENT
&
aEvent
)
int
EDIT_TOOL
::
Flip
(
const
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
PCB_BASE_FRAME
*
editFrame
=
getEditFrame
<
PCB_BASE_FRAME
>
();
PCB_BASE_FRAME
*
editFrame
=
getEditFrame
<
PCB_BASE_FRAME
>
();
...
@@ -415,7 +417,7 @@ int EDIT_TOOL::Flip( TOOL_EVENT& aEvent )
...
@@ -415,7 +417,7 @@ int EDIT_TOOL::Flip( TOOL_EVENT& aEvent )
}
}
int
EDIT_TOOL
::
Remove
(
TOOL_EVENT
&
aEvent
)
int
EDIT_TOOL
::
Remove
(
const
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
...
...
pcbnew/tools/edit_tool.h
View file @
1bd70efc
...
@@ -61,35 +61,35 @@ public:
...
@@ -61,35 +61,35 @@ public:
* Main loop in which events are handled.
* Main loop in which events are handled.
* @param aEvent is the handled event.
* @param aEvent is the handled event.
*/
*/
int
Main
(
TOOL_EVENT
&
aEvent
);
int
Main
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function Edit()
* Function Edit()
*
*
* Displays properties window for the selected object.
* Displays properties window for the selected object.
*/
*/
int
Properties
(
TOOL_EVENT
&
aEvent
);
int
Properties
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function Rotate()
* Function Rotate()
*
*
* Rotates currently selected items.
* Rotates currently selected items.
*/
*/
int
Rotate
(
TOOL_EVENT
&
aEvent
);
int
Rotate
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function Flip()
* Function Flip()
*
*
* Rotates currently selected items. The rotation point is the current cursor position.
* Rotates currently selected items. The rotation point is the current cursor position.
*/
*/
int
Flip
(
TOOL_EVENT
&
aEvent
);
int
Flip
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function Remove()
* Function Remove()
*
*
* Deletes currently selected items. The rotation point is the current cursor position.
* Deletes currently selected items. The rotation point is the current cursor position.
*/
*/
int
Remove
(
TOOL_EVENT
&
aEvent
);
int
Remove
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function EditModules()
* Function EditModules()
...
...
pcbnew/tools/module_tools.cpp
View file @
1bd70efc
...
@@ -47,7 +47,8 @@
...
@@ -47,7 +47,8 @@
#include <wx/defs.h>
#include <wx/defs.h>
MODULE_TOOLS
::
MODULE_TOOLS
()
:
MODULE_TOOLS
::
MODULE_TOOLS
()
:
TOOL_INTERACTIVE
(
"pcbnew.ModuleEditor"
)
TOOL_INTERACTIVE
(
"pcbnew.ModuleEditor"
),
m_view
(
NULL
),
m_controls
(
NULL
),
m_board
(
NULL
),
m_frame
(
NULL
)
{
{
}
}
...
@@ -119,7 +120,7 @@ static wxString getNextPadName( MODULE* aModule )
...
@@ -119,7 +120,7 @@ static wxString getNextPadName( MODULE* aModule )
}
}
int
MODULE_TOOLS
::
PlacePad
(
TOOL_EVENT
&
aEvent
)
int
MODULE_TOOLS
::
PlacePad
(
const
TOOL_EVENT
&
aEvent
)
{
{
m_frame
->
SetToolID
(
ID_MODEDIT_PAD_TOOL
,
wxCURSOR_PENCIL
,
_
(
"Add pads"
)
);
m_frame
->
SetToolID
(
ID_MODEDIT_PAD_TOOL
,
wxCURSOR_PENCIL
,
_
(
"Add pads"
)
);
...
@@ -222,7 +223,7 @@ int MODULE_TOOLS::PlacePad( TOOL_EVENT& aEvent )
...
@@ -222,7 +223,7 @@ int MODULE_TOOLS::PlacePad( TOOL_EVENT& aEvent )
}
}
int
MODULE_TOOLS
::
EnumeratePads
(
TOOL_EVENT
&
aEvent
)
int
MODULE_TOOLS
::
EnumeratePads
(
const
TOOL_EVENT
&
aEvent
)
{
{
std
::
list
<
D_PAD
*>
pads
;
std
::
list
<
D_PAD
*>
pads
;
std
::
set
<
D_PAD
*>
allPads
;
std
::
set
<
D_PAD
*>
allPads
;
...
@@ -329,7 +330,7 @@ int MODULE_TOOLS::EnumeratePads( TOOL_EVENT& aEvent )
...
@@ -329,7 +330,7 @@ int MODULE_TOOLS::EnumeratePads( TOOL_EVENT& aEvent )
}
}
int
MODULE_TOOLS
::
CopyItems
(
TOOL_EVENT
&
aEvent
)
int
MODULE_TOOLS
::
CopyItems
(
const
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION
&
selection
=
m_toolMgr
->
GetTool
<
SELECTION_TOOL
>
()
->
GetSelection
();
const
SELECTION
&
selection
=
m_toolMgr
->
GetTool
<
SELECTION_TOOL
>
()
->
GetSelection
();
...
@@ -401,7 +402,7 @@ int MODULE_TOOLS::CopyItems( TOOL_EVENT& aEvent )
...
@@ -401,7 +402,7 @@ int MODULE_TOOLS::CopyItems( TOOL_EVENT& aEvent )
}
}
int
MODULE_TOOLS
::
PasteItems
(
TOOL_EVENT
&
aEvent
)
int
MODULE_TOOLS
::
PasteItems
(
const
TOOL_EVENT
&
aEvent
)
{
{
// Parse clipboard
// Parse clipboard
PCB_IO
io
(
CTL_FOR_CLIPBOARD
);
PCB_IO
io
(
CTL_FOR_CLIPBOARD
);
...
@@ -533,7 +534,7 @@ int MODULE_TOOLS::PasteItems( TOOL_EVENT& aEvent )
...
@@ -533,7 +534,7 @@ int MODULE_TOOLS::PasteItems( TOOL_EVENT& aEvent )
}
}
int
MODULE_TOOLS
::
ModuleTextOutlines
(
TOOL_EVENT
&
aEvent
)
int
MODULE_TOOLS
::
ModuleTextOutlines
(
const
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
PCB_PAINTER
*
painter
=
KIGFX
::
PCB_PAINTER
*
painter
=
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
...
@@ -570,7 +571,7 @@ int MODULE_TOOLS::ModuleTextOutlines( TOOL_EVENT& aEvent )
...
@@ -570,7 +571,7 @@ int MODULE_TOOLS::ModuleTextOutlines( TOOL_EVENT& aEvent )
}
}
int
MODULE_TOOLS
::
ModuleEdgeOutlines
(
TOOL_EVENT
&
aEvent
)
int
MODULE_TOOLS
::
ModuleEdgeOutlines
(
const
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
PCB_PAINTER
*
painter
=
KIGFX
::
PCB_PAINTER
*
painter
=
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
...
...
pcbnew/tools/module_tools.h
View file @
1bd70efc
...
@@ -55,41 +55,41 @@ public:
...
@@ -55,41 +55,41 @@ public:
* Function PlacePad()
* Function PlacePad()
* Places a pad in module editor.
* Places a pad in module editor.
*/
*/
int
PlacePad
(
TOOL_EVENT
&
aEvent
);
int
PlacePad
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function EnumeratePads()
* Function EnumeratePads()
* Tool for quick pad enumeration.
* Tool for quick pad enumeration.
*/
*/
int
EnumeratePads
(
TOOL_EVENT
&
aEvent
);
int
EnumeratePads
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function CopyItems()
* Function CopyItems()
*
*
* Copies selected items to the clipboard. Works only in "edit modules" mode.
* Copies selected items to the clipboard. Works only in "edit modules" mode.
*/
*/
int
CopyItems
(
TOOL_EVENT
&
aEvent
);
int
CopyItems
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function PastePad()
* Function PastePad()
*
*
* Pastes items from the clipboard. Works only in "edit modules" mode.
* Pastes items from the clipboard. Works only in "edit modules" mode.
*/
*/
int
PasteItems
(
TOOL_EVENT
&
aEvent
);
int
PasteItems
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function ModuleTextOutlines()
* Function ModuleTextOutlines()
*
*
* Toggles display mode for module texts (outline/filled).
* Toggles display mode for module texts (outline/filled).
*/
*/
int
ModuleTextOutlines
(
TOOL_EVENT
&
aEvent
);
int
ModuleTextOutlines
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function ModuleEdgeOutlines()
* Function ModuleEdgeOutlines()
*
*
* Toggles display mode for module edges (outline/filled).
* Toggles display mode for module edges (outline/filled).
*/
*/
int
ModuleEdgeOutlines
(
TOOL_EVENT
&
aEvent
);
int
ModuleEdgeOutlines
(
const
TOOL_EVENT
&
aEvent
);
private
:
private
:
///> Sets up handlers for various events.
///> Sets up handlers for various events.
...
...
pcbnew/tools/pcb_editor_control.cpp
View file @
1bd70efc
...
@@ -47,7 +47,7 @@ public:
...
@@ -47,7 +47,7 @@ public:
PCB_EDITOR_CONTROL
::
PCB_EDITOR_CONTROL
()
:
PCB_EDITOR_CONTROL
::
PCB_EDITOR_CONTROL
()
:
TOOL_INTERACTIVE
(
"pcbnew.EditorControl"
)
TOOL_INTERACTIVE
(
"pcbnew.EditorControl"
)
,
m_frame
(
NULL
)
{
{
}
}
...
@@ -75,7 +75,7 @@ bool PCB_EDITOR_CONTROL::Init()
...
@@ -75,7 +75,7 @@ bool PCB_EDITOR_CONTROL::Init()
// Track & via size control
// Track & via size control
int
PCB_EDITOR_CONTROL
::
TrackWidthInc
(
TOOL_EVENT
&
aEvent
)
int
PCB_EDITOR_CONTROL
::
TrackWidthInc
(
const
TOOL_EVENT
&
aEvent
)
{
{
BOARD
*
board
=
getModel
<
BOARD
>
();
BOARD
*
board
=
getModel
<
BOARD
>
();
int
widthIndex
=
board
->
GetDesignSettings
().
GetTrackWidthIndex
()
+
1
;
int
widthIndex
=
board
->
GetDesignSettings
().
GetTrackWidthIndex
()
+
1
;
...
@@ -96,7 +96,7 @@ int PCB_EDITOR_CONTROL::TrackWidthInc( TOOL_EVENT& aEvent )
...
@@ -96,7 +96,7 @@ int PCB_EDITOR_CONTROL::TrackWidthInc( TOOL_EVENT& aEvent )
}
}
int
PCB_EDITOR_CONTROL
::
TrackWidthDec
(
TOOL_EVENT
&
aEvent
)
int
PCB_EDITOR_CONTROL
::
TrackWidthDec
(
const
TOOL_EVENT
&
aEvent
)
{
{
BOARD
*
board
=
getModel
<
BOARD
>
();
BOARD
*
board
=
getModel
<
BOARD
>
();
int
widthIndex
=
board
->
GetDesignSettings
().
GetTrackWidthIndex
()
-
1
;
int
widthIndex
=
board
->
GetDesignSettings
().
GetTrackWidthIndex
()
-
1
;
...
@@ -117,7 +117,7 @@ int PCB_EDITOR_CONTROL::TrackWidthDec( TOOL_EVENT& aEvent )
...
@@ -117,7 +117,7 @@ int PCB_EDITOR_CONTROL::TrackWidthDec( TOOL_EVENT& aEvent )
}
}
int
PCB_EDITOR_CONTROL
::
ViaSizeInc
(
TOOL_EVENT
&
aEvent
)
int
PCB_EDITOR_CONTROL
::
ViaSizeInc
(
const
TOOL_EVENT
&
aEvent
)
{
{
BOARD
*
board
=
getModel
<
BOARD
>
();
BOARD
*
board
=
getModel
<
BOARD
>
();
int
sizeIndex
=
board
->
GetDesignSettings
().
GetViaSizeIndex
()
+
1
;
int
sizeIndex
=
board
->
GetDesignSettings
().
GetViaSizeIndex
()
+
1
;
...
@@ -138,7 +138,7 @@ int PCB_EDITOR_CONTROL::ViaSizeInc( TOOL_EVENT& aEvent )
...
@@ -138,7 +138,7 @@ int PCB_EDITOR_CONTROL::ViaSizeInc( TOOL_EVENT& aEvent )
}
}
int
PCB_EDITOR_CONTROL
::
ViaSizeDec
(
TOOL_EVENT
&
aEvent
)
int
PCB_EDITOR_CONTROL
::
ViaSizeDec
(
const
TOOL_EVENT
&
aEvent
)
{
{
BOARD
*
board
=
getModel
<
BOARD
>
();
BOARD
*
board
=
getModel
<
BOARD
>
();
int
sizeIndex
=
board
->
GetDesignSettings
().
GetViaSizeIndex
()
-
1
;
int
sizeIndex
=
board
->
GetDesignSettings
().
GetViaSizeIndex
()
-
1
;
...
@@ -160,7 +160,7 @@ int PCB_EDITOR_CONTROL::ViaSizeDec( TOOL_EVENT& aEvent )
...
@@ -160,7 +160,7 @@ int PCB_EDITOR_CONTROL::ViaSizeDec( TOOL_EVENT& aEvent )
// Zone actions
// Zone actions
int
PCB_EDITOR_CONTROL
::
ZoneFill
(
TOOL_EVENT
&
aEvent
)
int
PCB_EDITOR_CONTROL
::
ZoneFill
(
const
TOOL_EVENT
&
aEvent
)
{
{
SELECTION_TOOL
*
selTool
=
m_toolMgr
->
GetTool
<
SELECTION_TOOL
>
();
SELECTION_TOOL
*
selTool
=
m_toolMgr
->
GetTool
<
SELECTION_TOOL
>
();
const
SELECTION
&
selection
=
selTool
->
GetSelection
();
const
SELECTION
&
selection
=
selTool
->
GetSelection
();
...
@@ -181,7 +181,7 @@ int PCB_EDITOR_CONTROL::ZoneFill( TOOL_EVENT& aEvent )
...
@@ -181,7 +181,7 @@ int PCB_EDITOR_CONTROL::ZoneFill( TOOL_EVENT& aEvent )
}
}
int
PCB_EDITOR_CONTROL
::
ZoneFillAll
(
TOOL_EVENT
&
aEvent
)
int
PCB_EDITOR_CONTROL
::
ZoneFillAll
(
const
TOOL_EVENT
&
aEvent
)
{
{
BOARD
*
board
=
getModel
<
BOARD
>
();
BOARD
*
board
=
getModel
<
BOARD
>
();
...
@@ -199,7 +199,7 @@ int PCB_EDITOR_CONTROL::ZoneFillAll( TOOL_EVENT& aEvent )
...
@@ -199,7 +199,7 @@ int PCB_EDITOR_CONTROL::ZoneFillAll( TOOL_EVENT& aEvent )
}
}
int
PCB_EDITOR_CONTROL
::
ZoneUnfill
(
TOOL_EVENT
&
aEvent
)
int
PCB_EDITOR_CONTROL
::
ZoneUnfill
(
const
TOOL_EVENT
&
aEvent
)
{
{
SELECTION_TOOL
*
selTool
=
m_toolMgr
->
GetTool
<
SELECTION_TOOL
>
();
SELECTION_TOOL
*
selTool
=
m_toolMgr
->
GetTool
<
SELECTION_TOOL
>
();
const
SELECTION
&
selection
=
selTool
->
GetSelection
();
const
SELECTION
&
selection
=
selTool
->
GetSelection
();
...
@@ -220,7 +220,7 @@ int PCB_EDITOR_CONTROL::ZoneUnfill( TOOL_EVENT& aEvent )
...
@@ -220,7 +220,7 @@ int PCB_EDITOR_CONTROL::ZoneUnfill( TOOL_EVENT& aEvent )
}
}
int
PCB_EDITOR_CONTROL
::
ZoneUnfillAll
(
TOOL_EVENT
&
aEvent
)
int
PCB_EDITOR_CONTROL
::
ZoneUnfillAll
(
const
TOOL_EVENT
&
aEvent
)
{
{
BOARD
*
board
=
getModel
<
BOARD
>
();
BOARD
*
board
=
getModel
<
BOARD
>
();
...
@@ -238,6 +238,20 @@ int PCB_EDITOR_CONTROL::ZoneUnfillAll( TOOL_EVENT& aEvent )
...
@@ -238,6 +238,20 @@ int PCB_EDITOR_CONTROL::ZoneUnfillAll( TOOL_EVENT& aEvent )
}
}
int
PCB_EDITOR_CONTROL
::
SelectionCrossProbe
(
const
TOOL_EVENT
&
aEvent
)
{
SELECTION_TOOL
*
selTool
=
m_toolMgr
->
GetTool
<
SELECTION_TOOL
>
();
const
SELECTION
&
selection
=
selTool
->
GetSelection
();
if
(
selection
.
Size
()
==
1
)
m_frame
->
SendMessageToEESCHEMA
(
selection
.
Item
<
BOARD_ITEM
>
(
0
)
);
setTransitions
();
return
0
;
}
void
PCB_EDITOR_CONTROL
::
setTransitions
()
void
PCB_EDITOR_CONTROL
::
setTransitions
()
{
{
// Track & via size control
// Track & via size control
...
@@ -251,4 +265,6 @@ void PCB_EDITOR_CONTROL::setTransitions()
...
@@ -251,4 +265,6 @@ void PCB_EDITOR_CONTROL::setTransitions()
Go
(
&
PCB_EDITOR_CONTROL
::
ZoneFillAll
,
COMMON_ACTIONS
::
zoneFillAll
.
MakeEvent
()
);
Go
(
&
PCB_EDITOR_CONTROL
::
ZoneFillAll
,
COMMON_ACTIONS
::
zoneFillAll
.
MakeEvent
()
);
Go
(
&
PCB_EDITOR_CONTROL
::
ZoneUnfill
,
COMMON_ACTIONS
::
zoneUnfill
.
MakeEvent
()
);
Go
(
&
PCB_EDITOR_CONTROL
::
ZoneUnfill
,
COMMON_ACTIONS
::
zoneUnfill
.
MakeEvent
()
);
Go
(
&
PCB_EDITOR_CONTROL
::
ZoneUnfillAll
,
COMMON_ACTIONS
::
zoneUnfillAll
.
MakeEvent
()
);
Go
(
&
PCB_EDITOR_CONTROL
::
ZoneUnfillAll
,
COMMON_ACTIONS
::
zoneUnfillAll
.
MakeEvent
()
);
Go
(
&
PCB_EDITOR_CONTROL
::
SelectionCrossProbe
,
SELECTION_TOOL
::
SelectedEvent
);
}
}
pcbnew/tools/pcb_editor_control.h
View file @
1bd70efc
...
@@ -46,16 +46,19 @@ public:
...
@@ -46,16 +46,19 @@ public:
bool
Init
();
bool
Init
();
// Track & via size control
// Track & via size control
int
TrackWidthInc
(
TOOL_EVENT
&
aEvent
);
int
TrackWidthInc
(
const
TOOL_EVENT
&
aEvent
);
int
TrackWidthDec
(
TOOL_EVENT
&
aEvent
);
int
TrackWidthDec
(
const
TOOL_EVENT
&
aEvent
);
int
ViaSizeInc
(
TOOL_EVENT
&
aEvent
);
int
ViaSizeInc
(
const
TOOL_EVENT
&
aEvent
);
int
ViaSizeDec
(
TOOL_EVENT
&
aEvent
);
int
ViaSizeDec
(
const
TOOL_EVENT
&
aEvent
);
// Zone actions
// Zone actions
int
ZoneFill
(
TOOL_EVENT
&
aEvent
);
int
ZoneFill
(
const
TOOL_EVENT
&
aEvent
);
int
ZoneFillAll
(
TOOL_EVENT
&
aEvent
);
int
ZoneFillAll
(
const
TOOL_EVENT
&
aEvent
);
int
ZoneUnfill
(
TOOL_EVENT
&
aEvent
);
int
ZoneUnfill
(
const
TOOL_EVENT
&
aEvent
);
int
ZoneUnfillAll
(
TOOL_EVENT
&
aEvent
);
int
ZoneUnfillAll
(
const
TOOL_EVENT
&
aEvent
);
///> Notifies eeschema about the selected item.
int
SelectionCrossProbe
(
const
TOOL_EVENT
&
aEvent
);
private
:
private
:
///> Sets up handlers for various events.
///> Sets up handlers for various events.
...
...
pcbnew/tools/pcbnew_control.cpp
View file @
1bd70efc
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
PCBNEW_CONTROL
::
PCBNEW_CONTROL
()
:
PCBNEW_CONTROL
::
PCBNEW_CONTROL
()
:
TOOL_INTERACTIVE
(
"pcbnew.Control"
)
TOOL_INTERACTIVE
(
"pcbnew.Control"
)
,
m_frame
(
NULL
)
{
{
}
}
...
@@ -60,7 +60,7 @@ bool PCBNEW_CONTROL::Init()
...
@@ -60,7 +60,7 @@ bool PCBNEW_CONTROL::Init()
}
}
int
PCBNEW_CONTROL
::
ZoomInOut
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
ZoomInOut
(
const
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
double
zoomScale
=
1.0
;
double
zoomScale
=
1.0
;
...
@@ -77,7 +77,7 @@ int PCBNEW_CONTROL::ZoomInOut( TOOL_EVENT& aEvent )
...
@@ -77,7 +77,7 @@ int PCBNEW_CONTROL::ZoomInOut( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
ZoomInOutCenter
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
ZoomInOutCenter
(
const
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
double
zoomScale
=
1.0
;
double
zoomScale
=
1.0
;
...
@@ -94,7 +94,7 @@ int PCBNEW_CONTROL::ZoomInOutCenter( TOOL_EVENT& aEvent )
...
@@ -94,7 +94,7 @@ int PCBNEW_CONTROL::ZoomInOutCenter( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
ZoomCenter
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
ZoomCenter
(
const
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
view
->
SetCenter
(
getViewControls
()
->
GetCursorPosition
()
);
view
->
SetCenter
(
getViewControls
()
->
GetCursorPosition
()
);
...
@@ -104,7 +104,7 @@ int PCBNEW_CONTROL::ZoomCenter( TOOL_EVENT& aEvent )
...
@@ -104,7 +104,7 @@ int PCBNEW_CONTROL::ZoomCenter( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
ZoomFitScreen
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
ZoomFitScreen
(
const
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
KIGFX
::
GAL
*
gal
=
m_frame
->
GetGalCanvas
()
->
GetGAL
();
KIGFX
::
GAL
*
gal
=
m_frame
->
GetGalCanvas
()
->
GetGAL
();
...
@@ -140,7 +140,7 @@ int PCBNEW_CONTROL::ZoomFitScreen( TOOL_EVENT& aEvent )
...
@@ -140,7 +140,7 @@ int PCBNEW_CONTROL::ZoomFitScreen( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
TrackDisplayMode
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
TrackDisplayMode
(
const
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
PCB_PAINTER
*
painter
=
KIGFX
::
PCB_PAINTER
*
painter
=
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
...
@@ -165,7 +165,7 @@ int PCBNEW_CONTROL::TrackDisplayMode( TOOL_EVENT& aEvent )
...
@@ -165,7 +165,7 @@ int PCBNEW_CONTROL::TrackDisplayMode( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
PadDisplayMode
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
PadDisplayMode
(
const
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
PCB_PAINTER
*
painter
=
KIGFX
::
PCB_PAINTER
*
painter
=
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
...
@@ -190,7 +190,7 @@ int PCBNEW_CONTROL::PadDisplayMode( TOOL_EVENT& aEvent )
...
@@ -190,7 +190,7 @@ int PCBNEW_CONTROL::PadDisplayMode( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
ViaDisplayMode
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
ViaDisplayMode
(
const
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
PCB_PAINTER
*
painter
=
KIGFX
::
PCB_PAINTER
*
painter
=
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
...
@@ -215,7 +215,7 @@ int PCBNEW_CONTROL::ViaDisplayMode( TOOL_EVENT& aEvent )
...
@@ -215,7 +215,7 @@ int PCBNEW_CONTROL::ViaDisplayMode( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
ZoneDisplayMode
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
ZoneDisplayMode
(
const
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
PCB_PAINTER
*
painter
=
KIGFX
::
PCB_PAINTER
*
painter
=
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
...
@@ -246,7 +246,7 @@ int PCBNEW_CONTROL::ZoneDisplayMode( TOOL_EVENT& aEvent )
...
@@ -246,7 +246,7 @@ int PCBNEW_CONTROL::ZoneDisplayMode( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
HighContrastMode
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
HighContrastMode
(
const
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
PCB_PAINTER
*
painter
=
KIGFX
::
PCB_PAINTER
*
painter
=
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
...
@@ -264,7 +264,7 @@ int PCBNEW_CONTROL::HighContrastMode( TOOL_EVENT& aEvent )
...
@@ -264,7 +264,7 @@ int PCBNEW_CONTROL::HighContrastMode( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
HighContrastInc
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
HighContrastInc
(
const
TOOL_EVENT
&
aEvent
)
{
{
std
::
cout
<<
__PRETTY_FUNCTION__
<<
std
::
endl
;
std
::
cout
<<
__PRETTY_FUNCTION__
<<
std
::
endl
;
setTransitions
();
setTransitions
();
...
@@ -273,7 +273,7 @@ int PCBNEW_CONTROL::HighContrastInc( TOOL_EVENT& aEvent )
...
@@ -273,7 +273,7 @@ int PCBNEW_CONTROL::HighContrastInc( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
HighContrastDec
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
HighContrastDec
(
const
TOOL_EVENT
&
aEvent
)
{
{
std
::
cout
<<
__PRETTY_FUNCTION__
<<
std
::
endl
;
std
::
cout
<<
__PRETTY_FUNCTION__
<<
std
::
endl
;
setTransitions
();
setTransitions
();
...
@@ -283,7 +283,7 @@ int PCBNEW_CONTROL::HighContrastDec( TOOL_EVENT& aEvent )
...
@@ -283,7 +283,7 @@ int PCBNEW_CONTROL::HighContrastDec( TOOL_EVENT& aEvent )
// Layer control
// Layer control
int
PCBNEW_CONTROL
::
LayerSwitch
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
LayerSwitch
(
const
TOOL_EVENT
&
aEvent
)
{
{
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerTop
)
)
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerTop
)
)
m_frame
->
SwitchLayer
(
NULL
,
F_Cu
);
m_frame
->
SwitchLayer
(
NULL
,
F_Cu
);
...
@@ -308,7 +308,7 @@ int PCBNEW_CONTROL::LayerSwitch( TOOL_EVENT& aEvent )
...
@@ -308,7 +308,7 @@ int PCBNEW_CONTROL::LayerSwitch( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
LayerNext
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
LayerNext
(
const
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
();
...
@@ -336,7 +336,7 @@ int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent )
...
@@ -336,7 +336,7 @@ int PCBNEW_CONTROL::LayerNext( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
LayerPrev
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
LayerPrev
(
const
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
();
...
@@ -364,7 +364,7 @@ int PCBNEW_CONTROL::LayerPrev( TOOL_EVENT& aEvent )
...
@@ -364,7 +364,7 @@ int PCBNEW_CONTROL::LayerPrev( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
LayerAlphaInc
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
LayerAlphaInc
(
const
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
PCB_PAINTER
*
painter
=
KIGFX
::
PCB_PAINTER
*
painter
=
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
...
@@ -387,7 +387,7 @@ int PCBNEW_CONTROL::LayerAlphaInc( TOOL_EVENT& aEvent )
...
@@ -387,7 +387,7 @@ int PCBNEW_CONTROL::LayerAlphaInc( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
LayerAlphaDec
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
LayerAlphaDec
(
const
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
PCB_PAINTER
*
painter
=
KIGFX
::
PCB_PAINTER
*
painter
=
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
static_cast
<
KIGFX
::
PCB_PAINTER
*>
(
m_frame
->
GetGalCanvas
()
->
GetView
()
->
GetPainter
()
);
...
@@ -411,7 +411,7 @@ int PCBNEW_CONTROL::LayerAlphaDec( TOOL_EVENT& aEvent )
...
@@ -411,7 +411,7 @@ int PCBNEW_CONTROL::LayerAlphaDec( TOOL_EVENT& aEvent )
// Grid control
// Grid control
int
PCBNEW_CONTROL
::
GridFast1
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
GridFast1
(
const
TOOL_EVENT
&
aEvent
)
{
{
m_frame
->
SetFastGrid1
();
m_frame
->
SetFastGrid1
();
setTransitions
();
setTransitions
();
...
@@ -420,7 +420,7 @@ int PCBNEW_CONTROL::GridFast1( TOOL_EVENT& aEvent )
...
@@ -420,7 +420,7 @@ int PCBNEW_CONTROL::GridFast1( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
GridFast2
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
GridFast2
(
const
TOOL_EVENT
&
aEvent
)
{
{
m_frame
->
SetFastGrid2
();
m_frame
->
SetFastGrid2
();
setTransitions
();
setTransitions
();
...
@@ -429,7 +429,7 @@ int PCBNEW_CONTROL::GridFast2( TOOL_EVENT& aEvent )
...
@@ -429,7 +429,7 @@ int PCBNEW_CONTROL::GridFast2( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
GridNext
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
GridNext
(
const
TOOL_EVENT
&
aEvent
)
{
{
m_frame
->
SetNextGrid
();
m_frame
->
SetNextGrid
();
setTransitions
();
setTransitions
();
...
@@ -438,7 +438,7 @@ int PCBNEW_CONTROL::GridNext( TOOL_EVENT& aEvent )
...
@@ -438,7 +438,7 @@ int PCBNEW_CONTROL::GridNext( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
GridPrev
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
GridPrev
(
const
TOOL_EVENT
&
aEvent
)
{
{
m_frame
->
SetPrevGrid
();
m_frame
->
SetPrevGrid
();
setTransitions
();
setTransitions
();
...
@@ -447,7 +447,7 @@ int PCBNEW_CONTROL::GridPrev( TOOL_EVENT& aEvent )
...
@@ -447,7 +447,7 @@ int PCBNEW_CONTROL::GridPrev( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
GridSetOrigin
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
GridSetOrigin
(
const
TOOL_EVENT
&
aEvent
)
{
{
Activate
();
Activate
();
m_frame
->
SetToolID
(
ID_PCB_PLACE_GRID_COORD_BUTT
,
wxCURSOR_PENCIL
,
m_frame
->
SetToolID
(
ID_PCB_PLACE_GRID_COORD_BUTT
,
wxCURSOR_PENCIL
,
...
@@ -481,7 +481,7 @@ int PCBNEW_CONTROL::GridSetOrigin( TOOL_EVENT& aEvent )
...
@@ -481,7 +481,7 @@ int PCBNEW_CONTROL::GridSetOrigin( TOOL_EVENT& aEvent )
// Miscellaneous
// Miscellaneous
int
PCBNEW_CONTROL
::
ResetCoords
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
ResetCoords
(
const
TOOL_EVENT
&
aEvent
)
{
{
VECTOR2I
cursorPos
=
getViewControls
()
->
GetCursorPosition
();
VECTOR2I
cursorPos
=
getViewControls
()
->
GetCursorPosition
();
...
@@ -493,7 +493,7 @@ int PCBNEW_CONTROL::ResetCoords( TOOL_EVENT& aEvent )
...
@@ -493,7 +493,7 @@ int PCBNEW_CONTROL::ResetCoords( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
SwitchCursor
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
SwitchCursor
(
const
TOOL_EVENT
&
aEvent
)
{
{
const
unsigned
int
BIG_CURSOR
=
4000
;
const
unsigned
int
BIG_CURSOR
=
4000
;
const
unsigned
int
SMALL_CURSOR
=
80
;
const
unsigned
int
SMALL_CURSOR
=
80
;
...
@@ -511,7 +511,7 @@ int PCBNEW_CONTROL::SwitchCursor( TOOL_EVENT& aEvent )
...
@@ -511,7 +511,7 @@ int PCBNEW_CONTROL::SwitchCursor( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
SwitchUnits
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
SwitchUnits
(
const
TOOL_EVENT
&
aEvent
)
{
{
// TODO should not it be refactored to pcb_frame member function?
// TODO should not it be refactored to pcb_frame member function?
wxCommandEvent
evt
(
wxEVT_COMMAND_MENU_SELECTED
);
wxCommandEvent
evt
(
wxEVT_COMMAND_MENU_SELECTED
);
...
@@ -528,7 +528,7 @@ int PCBNEW_CONTROL::SwitchUnits( TOOL_EVENT& aEvent )
...
@@ -528,7 +528,7 @@ int PCBNEW_CONTROL::SwitchUnits( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
ShowHelp
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
ShowHelp
(
const
TOOL_EVENT
&
aEvent
)
{
{
// TODO
// TODO
DisplayInfoMessage
(
m_frame
,
_
(
"Not implemented yet."
)
);
DisplayInfoMessage
(
m_frame
,
_
(
"Not implemented yet."
)
);
...
@@ -538,7 +538,7 @@ int PCBNEW_CONTROL::ShowHelp( TOOL_EVENT& aEvent )
...
@@ -538,7 +538,7 @@ int PCBNEW_CONTROL::ShowHelp( TOOL_EVENT& aEvent )
}
}
int
PCBNEW_CONTROL
::
ToBeDone
(
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
ToBeDone
(
const
TOOL_EVENT
&
aEvent
)
{
{
DisplayInfoMessage
(
m_frame
,
_
(
"Not implemented yet."
)
);
DisplayInfoMessage
(
m_frame
,
_
(
"Not implemented yet."
)
);
setTransitions
();
setTransitions
();
...
...
pcbnew/tools/pcbnew_control.h
View file @
1bd70efc
...
@@ -47,40 +47,40 @@ public:
...
@@ -47,40 +47,40 @@ public:
bool
Init
();
bool
Init
();
// View controls
// View controls
int
ZoomInOut
(
TOOL_EVENT
&
aEvent
);
int
ZoomInOut
(
const
TOOL_EVENT
&
aEvent
);
int
ZoomInOutCenter
(
TOOL_EVENT
&
aEvent
);
int
ZoomInOutCenter
(
const
TOOL_EVENT
&
aEvent
);
int
ZoomCenter
(
TOOL_EVENT
&
aEvent
);
int
ZoomCenter
(
const
TOOL_EVENT
&
aEvent
);
int
ZoomFitScreen
(
TOOL_EVENT
&
aEvent
);
int
ZoomFitScreen
(
const
TOOL_EVENT
&
aEvent
);
// Display modes
// Display modes
int
TrackDisplayMode
(
TOOL_EVENT
&
aEvent
);
int
TrackDisplayMode
(
const
TOOL_EVENT
&
aEvent
);
int
PadDisplayMode
(
TOOL_EVENT
&
aEvent
);
int
PadDisplayMode
(
const
TOOL_EVENT
&
aEvent
);
int
ViaDisplayMode
(
TOOL_EVENT
&
aEvent
);
int
ViaDisplayMode
(
const
TOOL_EVENT
&
aEvent
);
int
ZoneDisplayMode
(
TOOL_EVENT
&
aEvent
);
int
ZoneDisplayMode
(
const
TOOL_EVENT
&
aEvent
);
int
HighContrastMode
(
TOOL_EVENT
&
aEvent
);
int
HighContrastMode
(
const
TOOL_EVENT
&
aEvent
);
int
HighContrastInc
(
TOOL_EVENT
&
aEvent
);
int
HighContrastInc
(
const
TOOL_EVENT
&
aEvent
);
int
HighContrastDec
(
TOOL_EVENT
&
aEvent
);
int
HighContrastDec
(
const
TOOL_EVENT
&
aEvent
);
// Layer control
// Layer control
int
LayerSwitch
(
TOOL_EVENT
&
aEvent
);
int
LayerSwitch
(
const
TOOL_EVENT
&
aEvent
);
int
LayerNext
(
TOOL_EVENT
&
aEvent
);
int
LayerNext
(
const
TOOL_EVENT
&
aEvent
);
int
LayerPrev
(
TOOL_EVENT
&
aEvent
);
int
LayerPrev
(
const
TOOL_EVENT
&
aEvent
);
int
LayerAlphaInc
(
TOOL_EVENT
&
aEvent
);
int
LayerAlphaInc
(
const
TOOL_EVENT
&
aEvent
);
int
LayerAlphaDec
(
TOOL_EVENT
&
aEvent
);
int
LayerAlphaDec
(
const
TOOL_EVENT
&
aEvent
);
// Grid control
// Grid control
int
GridFast1
(
TOOL_EVENT
&
aEvent
);
int
GridFast1
(
const
TOOL_EVENT
&
aEvent
);
int
GridFast2
(
TOOL_EVENT
&
aEvent
);
int
GridFast2
(
const
TOOL_EVENT
&
aEvent
);
int
GridNext
(
TOOL_EVENT
&
aEvent
);
int
GridNext
(
const
TOOL_EVENT
&
aEvent
);
int
GridPrev
(
TOOL_EVENT
&
aEvent
);
int
GridPrev
(
const
TOOL_EVENT
&
aEvent
);
int
GridSetOrigin
(
TOOL_EVENT
&
aEvent
);
int
GridSetOrigin
(
const
TOOL_EVENT
&
aEvent
);
// Miscellaneous
// Miscellaneous
int
ResetCoords
(
TOOL_EVENT
&
aEvent
);
int
ResetCoords
(
const
TOOL_EVENT
&
aEvent
);
int
SwitchCursor
(
TOOL_EVENT
&
aEvent
);
int
SwitchCursor
(
const
TOOL_EVENT
&
aEvent
);
int
SwitchUnits
(
TOOL_EVENT
&
aEvent
);
int
SwitchUnits
(
const
TOOL_EVENT
&
aEvent
);
int
ShowHelp
(
TOOL_EVENT
&
aEvent
);
int
ShowHelp
(
const
TOOL_EVENT
&
aEvent
);
int
ToBeDone
(
TOOL_EVENT
&
aEvent
);
int
ToBeDone
(
const
TOOL_EVENT
&
aEvent
);
private
:
private
:
///> Sets up handlers for various events.
///> Sets up handlers for various events.
...
...
pcbnew/tools/placement_tool.cpp
View file @
1bd70efc
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#include <boost/foreach.hpp>
#include <boost/foreach.hpp>
PLACEMENT_TOOL
::
PLACEMENT_TOOL
()
:
PLACEMENT_TOOL
::
PLACEMENT_TOOL
()
:
TOOL_INTERACTIVE
(
"pcbnew.Placement"
)
TOOL_INTERACTIVE
(
"pcbnew.Placement"
)
,
m_selectionTool
(
NULL
)
{
{
}
}
...
@@ -72,7 +72,7 @@ bool PLACEMENT_TOOL::Init()
...
@@ -72,7 +72,7 @@ bool PLACEMENT_TOOL::Init()
}
}
int
PLACEMENT_TOOL
::
AlignTop
(
TOOL_EVENT
&
aEvent
)
int
PLACEMENT_TOOL
::
AlignTop
(
const
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
...
@@ -115,7 +115,7 @@ int PLACEMENT_TOOL::AlignTop( TOOL_EVENT& aEvent )
...
@@ -115,7 +115,7 @@ int PLACEMENT_TOOL::AlignTop( TOOL_EVENT& aEvent )
}
}
int
PLACEMENT_TOOL
::
AlignBottom
(
TOOL_EVENT
&
aEvent
)
int
PLACEMENT_TOOL
::
AlignBottom
(
const
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
...
@@ -158,7 +158,7 @@ int PLACEMENT_TOOL::AlignBottom( TOOL_EVENT& aEvent )
...
@@ -158,7 +158,7 @@ int PLACEMENT_TOOL::AlignBottom( TOOL_EVENT& aEvent )
}
}
int
PLACEMENT_TOOL
::
AlignLeft
(
TOOL_EVENT
&
aEvent
)
int
PLACEMENT_TOOL
::
AlignLeft
(
const
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
...
@@ -201,7 +201,7 @@ int PLACEMENT_TOOL::AlignLeft( TOOL_EVENT& aEvent )
...
@@ -201,7 +201,7 @@ int PLACEMENT_TOOL::AlignLeft( TOOL_EVENT& aEvent )
}
}
int
PLACEMENT_TOOL
::
AlignRight
(
TOOL_EVENT
&
aEvent
)
int
PLACEMENT_TOOL
::
AlignRight
(
const
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
...
@@ -256,7 +256,7 @@ static bool compareY( const BOARD_ITEM* aA, const BOARD_ITEM* aB )
...
@@ -256,7 +256,7 @@ static bool compareY( const BOARD_ITEM* aA, const BOARD_ITEM* aB )
}
}
int
PLACEMENT_TOOL
::
DistributeHorizontally
(
TOOL_EVENT
&
aEvent
)
int
PLACEMENT_TOOL
::
DistributeHorizontally
(
const
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
...
@@ -305,7 +305,7 @@ int PLACEMENT_TOOL::DistributeHorizontally( TOOL_EVENT& aEvent )
...
@@ -305,7 +305,7 @@ int PLACEMENT_TOOL::DistributeHorizontally( TOOL_EVENT& aEvent )
}
}
int
PLACEMENT_TOOL
::
DistributeVertically
(
TOOL_EVENT
&
aEvent
)
int
PLACEMENT_TOOL
::
DistributeVertically
(
const
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
...
...
pcbnew/tools/placement_tool.h
View file @
1bd70efc
...
@@ -29,10 +29,6 @@
...
@@ -29,10 +29,6 @@
class
SELECTION_TOOL
;
class
SELECTION_TOOL
;
/**
* TODO description
*/
class
PLACEMENT_TOOL
:
public
TOOL_INTERACTIVE
class
PLACEMENT_TOOL
:
public
TOOL_INTERACTIVE
{
{
public
:
public
:
...
@@ -45,26 +41,44 @@ public:
...
@@ -45,26 +41,44 @@ public:
/// @copydoc TOOL_INTERACTIVE::Init()
/// @copydoc TOOL_INTERACTIVE::Init()
bool
Init
();
bool
Init
();
/// TODO
/**
int
AlignTop
(
TOOL_EVENT
&
aEvent
);
* Function AlignTop()
* Sets Y coordinate of the selected items to the value of the top-most selected item Y coordinate.
/// TODO
*/
int
AlignBottom
(
TOOL_EVENT
&
aEvent
);
int
AlignTop
(
const
TOOL_EVENT
&
aEvent
);
/// TODO
/**
int
AlignLeft
(
TOOL_EVENT
&
aEvent
);
* Function AlignBottom()
* Sets Y coordinate of the selected items to the value of the bottom-most selected item Y coordinate.
/// TODO
*/
int
AlignRight
(
TOOL_EVENT
&
aEvent
);
int
AlignBottom
(
const
TOOL_EVENT
&
aEvent
);
/// TODO
/**
int
DistributeHorizontally
(
TOOL_EVENT
&
aEvent
);
* Function AlignLeft()
* Sets X coordinate of the selected items to the value of the left-most selected item X coordinate.
/// TODO
*/
int
DistributeVertically
(
TOOL_EVENT
&
aEvent
);
int
AlignLeft
(
const
TOOL_EVENT
&
aEvent
);
/**
* Function AlignRight()
* Sets X coordinate of the selected items to the value of the right-most selected item X coordinate.
*/
int
AlignRight
(
const
TOOL_EVENT
&
aEvent
);
/**
* Function DistributeHorizontally()
* Distributes the selected items along the X axis.
*/
int
DistributeHorizontally
(
const
TOOL_EVENT
&
aEvent
);
/**
* Function DistributeVertically()
* Distributes the selected items along the Y axis.
*/
int
DistributeVertically
(
const
TOOL_EVENT
&
aEvent
);
private
:
private
:
///
TODO
///
> Sets up handlers for various events.
void
setTransitions
();
void
setTransitions
();
SELECTION_TOOL
*
m_selectionTool
;
SELECTION_TOOL
*
m_selectionTool
;
...
...
pcbnew/tools/point_editor.cpp
View file @
1bd70efc
...
@@ -219,7 +219,7 @@ bool POINT_EDITOR::Init()
...
@@ -219,7 +219,7 @@ bool POINT_EDITOR::Init()
}
}
int
POINT_EDITOR
::
OnSelectionChange
(
TOOL_EVENT
&
aEvent
)
int
POINT_EDITOR
::
OnSelectionChange
(
const
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
...
@@ -797,8 +797,8 @@ void POINT_EDITOR::breakOutline( const VECTOR2I& aBreakPoint )
...
@@ -797,8 +797,8 @@ void POINT_EDITOR::breakOutline( const VECTOR2I& aBreakPoint )
void
POINT_EDITOR
::
setTransitions
()
void
POINT_EDITOR
::
setTransitions
()
{
{
Go
(
&
POINT_EDITOR
::
OnSelectionChange
,
m_selectionTool
->
SelectedEvent
);
Go
(
&
POINT_EDITOR
::
OnSelectionChange
,
SELECTION_TOOL
::
SelectedEvent
);
Go
(
&
POINT_EDITOR
::
OnSelectionChange
,
m_selectionTool
->
UnselectedEvent
);
Go
(
&
POINT_EDITOR
::
OnSelectionChange
,
SELECTION_TOOL
::
UnselectedEvent
);
}
}
...
...
pcbnew/tools/point_editor.h
View file @
1bd70efc
...
@@ -53,7 +53,7 @@ public:
...
@@ -53,7 +53,7 @@ public:
*
*
* Change selection event handler.
* Change selection event handler.
*/
*/
int
OnSelectionChange
(
TOOL_EVENT
&
aEvent
);
int
OnSelectionChange
(
const
TOOL_EVENT
&
aEvent
);
private
:
private
:
///> Selection tool used for obtaining selected items
///> Selection tool used for obtaining selected items
...
...
pcbnew/tools/selection_tool.cpp
View file @
1bd70efc
...
@@ -51,9 +51,6 @@
...
@@ -51,9 +51,6 @@
SELECTION_TOOL
::
SELECTION_TOOL
()
:
SELECTION_TOOL
::
SELECTION_TOOL
()
:
TOOL_INTERACTIVE
(
"pcbnew.InteractiveSelection"
),
TOOL_INTERACTIVE
(
"pcbnew.InteractiveSelection"
),
SelectedEvent
(
TC_MESSAGE
,
TA_ACTION
,
"pcbnew.InteractiveSelection.selected"
),
UnselectedEvent
(
TC_MESSAGE
,
TA_ACTION
,
"pcbnew.InteractiveSelection.unselected"
),
ClearedEvent
(
TC_MESSAGE
,
TA_ACTION
,
"pcbnew.InteractiveSelection.cleared"
),
m_frame
(
NULL
),
m_additive
(
false
),
m_multiple
(
false
),
m_frame
(
NULL
),
m_additive
(
false
),
m_multiple
(
false
),
m_editModules
(
false
),
m_locked
(
true
)
m_editModules
(
false
),
m_locked
(
true
)
{
{
...
@@ -90,7 +87,7 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
...
@@ -90,7 +87,7 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
}
}
int
SELECTION_TOOL
::
Main
(
TOOL_EVENT
&
aEvent
)
int
SELECTION_TOOL
::
Main
(
const
TOOL_EVENT
&
aEvent
)
{
{
// Main loop: keep receiving events
// Main loop: keep receiving events
while
(
OPT_TOOL_EVENT
evt
=
Wait
()
)
while
(
OPT_TOOL_EVENT
evt
=
Wait
()
)
...
@@ -234,8 +231,7 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
...
@@ -234,8 +231,7 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
unselect
(
aItem
);
unselect
(
aItem
);
// Inform other potentially interested tools
// Inform other potentially interested tools
TOOL_EVENT
unselectEvent
(
UnselectedEvent
);
m_toolMgr
->
ProcessEvent
(
UnselectedEvent
);
m_toolMgr
->
ProcessEvent
(
unselectEvent
);
}
}
else
else
{
{
...
@@ -248,8 +244,7 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
...
@@ -248,8 +244,7 @@ void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem )
select
(
aItem
);
select
(
aItem
);
// Inform other potentially interested tools
// Inform other potentially interested tools
TOOL_EVENT
selectEvent
(
SelectedEvent
);
m_toolMgr
->
ProcessEvent
(
SelectedEvent
);
m_toolMgr
->
ProcessEvent
(
selectEvent
);
}
}
}
}
}
}
...
@@ -384,8 +379,7 @@ bool SELECTION_TOOL::selectMultiple()
...
@@ -384,8 +379,7 @@ bool SELECTION_TOOL::selectMultiple()
if
(
!
m_selection
.
Empty
()
)
if
(
!
m_selection
.
Empty
()
)
{
{
// Inform other potentially interested tools
// Inform other potentially interested tools
TOOL_EVENT
selectEvent
(
SelectedEvent
);
m_toolMgr
->
ProcessEvent
(
SelectedEvent
);
m_toolMgr
->
ProcessEvent
(
selectEvent
);
}
}
break
;
// Stop waiting for events
break
;
// Stop waiting for events
...
@@ -456,7 +450,7 @@ bool SELECTION_TOOL::CheckLock()
...
@@ -456,7 +450,7 @@ bool SELECTION_TOOL::CheckLock()
}
}
int
SELECTION_TOOL
::
CursorSelection
(
TOOL_EVENT
&
aEvent
)
int
SELECTION_TOOL
::
CursorSelection
(
const
TOOL_EVENT
&
aEvent
)
{
{
selectCursor
(
getView
()
->
ToWorld
(
getViewControls
()
->
GetMousePosition
()
)
);
selectCursor
(
getView
()
->
ToWorld
(
getViewControls
()
->
GetMousePosition
()
)
);
setTransitions
();
setTransitions
();
...
@@ -465,7 +459,7 @@ int SELECTION_TOOL::CursorSelection( TOOL_EVENT& aEvent )
...
@@ -465,7 +459,7 @@ int SELECTION_TOOL::CursorSelection( TOOL_EVENT& aEvent )
}
}
int
SELECTION_TOOL
::
ClearSelection
(
TOOL_EVENT
&
aEvent
)
int
SELECTION_TOOL
::
ClearSelection
(
const
TOOL_EVENT
&
aEvent
)
{
{
clearSelection
();
clearSelection
();
setTransitions
();
setTransitions
();
...
@@ -473,7 +467,7 @@ int SELECTION_TOOL::ClearSelection( TOOL_EVENT& aEvent )
...
@@ -473,7 +467,7 @@ int SELECTION_TOOL::ClearSelection( TOOL_EVENT& aEvent )
return
0
;
return
0
;
}
}
int
SELECTION_TOOL
::
SelectItem
(
TOOL_EVENT
&
aEvent
)
int
SELECTION_TOOL
::
SelectItem
(
const
TOOL_EVENT
&
aEvent
)
{
{
// Check if there is an item to be selected
// Check if there is an item to be selected
BOARD_ITEM
*
item
=
static_cast
<
BOARD_ITEM
*>
(
aEvent
.
Parameter
()
);
BOARD_ITEM
*
item
=
static_cast
<
BOARD_ITEM
*>
(
aEvent
.
Parameter
()
);
...
@@ -483,8 +477,7 @@ int SELECTION_TOOL::SelectItem( TOOL_EVENT& aEvent )
...
@@ -483,8 +477,7 @@ int SELECTION_TOOL::SelectItem( TOOL_EVENT& aEvent )
select
(
item
);
select
(
item
);
// Inform other potentially interested tools
// Inform other potentially interested tools
TOOL_EVENT
select
(
SelectedEvent
);
m_toolMgr
->
ProcessEvent
(
SelectedEvent
);
m_toolMgr
->
ProcessEvent
(
select
);
}
}
setTransitions
();
setTransitions
();
...
@@ -492,7 +485,7 @@ int SELECTION_TOOL::SelectItem( TOOL_EVENT& aEvent )
...
@@ -492,7 +485,7 @@ int SELECTION_TOOL::SelectItem( TOOL_EVENT& aEvent )
return
0
;
return
0
;
}
}
int
SELECTION_TOOL
::
UnselectItem
(
TOOL_EVENT
&
aEvent
)
int
SELECTION_TOOL
::
UnselectItem
(
const
TOOL_EVENT
&
aEvent
)
{
{
// Check if there is an item to be selected
// Check if there is an item to be selected
BOARD_ITEM
*
item
=
static_cast
<
BOARD_ITEM
*>
(
aEvent
.
Parameter
()
);
BOARD_ITEM
*
item
=
static_cast
<
BOARD_ITEM
*>
(
aEvent
.
Parameter
()
);
...
@@ -502,8 +495,7 @@ int SELECTION_TOOL::UnselectItem( TOOL_EVENT& aEvent )
...
@@ -502,8 +495,7 @@ int SELECTION_TOOL::UnselectItem( TOOL_EVENT& aEvent )
unselect
(
item
);
unselect
(
item
);
// Inform other potentially interested tools
// Inform other potentially interested tools
TOOL_EVENT
unselect
(
UnselectedEvent
);
m_toolMgr
->
ProcessEvent
(
UnselectedEvent
);
m_toolMgr
->
ProcessEvent
(
unselect
);
}
}
setTransitions
();
setTransitions
();
...
@@ -519,17 +511,17 @@ void SELECTION_TOOL::findCallback( BOARD_ITEM* aItem )
...
@@ -519,17 +511,17 @@ void SELECTION_TOOL::findCallback( BOARD_ITEM* aItem )
{
{
clearSelection
();
clearSelection
();
select
(
aItem
);
select
(
aItem
);
getView
()
->
SetCenter
(
VECTOR2D
(
aItem
->
GetPosition
()
)
);
// Inform other potentially interested tools
// Inform other potentially interested tools
TOOL_EVENT
selectEvent
(
SelectedEvent
);
m_toolMgr
->
ProcessEvent
(
SelectedEvent
);
m_toolMgr
->
ProcessEvent
(
selectEvent
);
}
}
m_frame
->
GetGalCanvas
()
->
ForceRefresh
();
m_frame
->
GetGalCanvas
()
->
ForceRefresh
();
}
}
int
SELECTION_TOOL
::
find
(
TOOL_EVENT
&
aEvent
)
int
SELECTION_TOOL
::
find
(
const
TOOL_EVENT
&
aEvent
)
{
{
DIALOG_FIND
dlg
(
m_frame
);
DIALOG_FIND
dlg
(
m_frame
);
dlg
.
EnableWarp
(
false
);
dlg
.
EnableWarp
(
false
);
...
@@ -541,7 +533,7 @@ int SELECTION_TOOL::find( TOOL_EVENT& aEvent )
...
@@ -541,7 +533,7 @@ int SELECTION_TOOL::find( TOOL_EVENT& aEvent )
}
}
int
SELECTION_TOOL
::
findMove
(
TOOL_EVENT
&
aEvent
)
int
SELECTION_TOOL
::
findMove
(
const
TOOL_EVENT
&
aEvent
)
{
{
MODULE
*
module
=
m_frame
->
GetModuleByName
();
MODULE
*
module
=
m_frame
->
GetModuleByName
();
...
@@ -579,8 +571,7 @@ void SELECTION_TOOL::clearSelection()
...
@@ -579,8 +571,7 @@ void SELECTION_TOOL::clearSelection()
m_locked
=
true
;
m_locked
=
true
;
// Inform other potentially interested tools
// Inform other potentially interested tools
TOOL_EVENT
clearEvent
(
ClearedEvent
);
m_toolMgr
->
ProcessEvent
(
ClearedEvent
);
m_toolMgr
->
ProcessEvent
(
clearEvent
);
}
}
...
@@ -811,8 +802,7 @@ void SELECTION_TOOL::unselect( BOARD_ITEM* aItem )
...
@@ -811,8 +802,7 @@ void SELECTION_TOOL::unselect( BOARD_ITEM* aItem )
}
}
// Inform other potentially interested tools
// Inform other potentially interested tools
TOOL_EVENT
unselected
(
UnselectedEvent
);
m_toolMgr
->
ProcessEvent
(
UnselectedEvent
);
m_toolMgr
->
ProcessEvent
(
unselected
);
}
}
...
@@ -939,3 +929,8 @@ void SELECTION::clear()
...
@@ -939,3 +929,8 @@ void SELECTION::clear()
items
.
ClearItemsList
();
items
.
ClearItemsList
();
group
->
Clear
();
group
->
Clear
();
}
}
const
TOOL_EVENT
SELECTION_TOOL
::
SelectedEvent
(
TC_MESSAGE
,
TA_ACTION
,
"pcbnew.InteractiveSelection.selected"
);
const
TOOL_EVENT
SELECTION_TOOL
::
UnselectedEvent
(
TC_MESSAGE
,
TA_ACTION
,
"pcbnew.InteractiveSelection.unselected"
);
const
TOOL_EVENT
SELECTION_TOOL
::
ClearedEvent
(
TC_MESSAGE
,
TA_ACTION
,
"pcbnew.InteractiveSelection.cleared"
);
pcbnew/tools/selection_tool.h
View file @
1bd70efc
...
@@ -103,7 +103,7 @@ public:
...
@@ -103,7 +103,7 @@ public:
*
*
* The main loop.
* The main loop.
*/
*/
int
Main
(
TOOL_EVENT
&
aEvent
);
int
Main
(
const
TOOL_EVENT
&
aEvent
);
/**
/**
* Function GetSelection()
* Function GetSelection()
...
@@ -152,25 +152,25 @@ public:
...
@@ -152,25 +152,25 @@ public:
bool
CheckLock
();
bool
CheckLock
();
///> Select a single item under cursor event handler.
///> Select a single item under cursor event handler.
int
CursorSelection
(
TOOL_EVENT
&
aEvent
);
int
CursorSelection
(
const
TOOL_EVENT
&
aEvent
);
///> Clear current selection event handler.
///> Clear current selection event handler.
int
ClearSelection
(
TOOL_EVENT
&
aEvent
);
int
ClearSelection
(
const
TOOL_EVENT
&
aEvent
);
///> Item selection event handler.
///> Item selection event handler.
int
SelectItem
(
TOOL_EVENT
&
aEvent
);
int
SelectItem
(
const
TOOL_EVENT
&
aEvent
);
///> Item unselection event handler.
///> Item unselection event handler.
int
UnselectItem
(
TOOL_EVENT
&
aEvent
);
int
UnselectItem
(
const
TOOL_EVENT
&
aEvent
);
///> Event sent after an item is selected.
///> Event sent after an item is selected.
const
TOOL_EVENT
SelectedEvent
;
static
const
TOOL_EVENT
SelectedEvent
;
///> Event sent after an item is unselected.
///> Event sent after an item is unselected.
const
TOOL_EVENT
UnselectedEvent
;
static
const
TOOL_EVENT
UnselectedEvent
;
///> Event sent after selection is cleared.
///> Event sent after selection is cleared.
const
TOOL_EVENT
ClearedEvent
;
static
const
TOOL_EVENT
ClearedEvent
;
private
:
private
:
/**
/**
...
@@ -197,10 +197,10 @@ private:
...
@@ -197,10 +197,10 @@ private:
void
findCallback
(
BOARD_ITEM
*
aItem
);
void
findCallback
(
BOARD_ITEM
*
aItem
);
///> Find an item.
///> Find an item.
int
find
(
TOOL_EVENT
&
aEvent
);
int
find
(
const
TOOL_EVENT
&
aEvent
);
///> Find an item and start moving.
///> Find an item and start moving.
int
findMove
(
TOOL_EVENT
&
aEvent
);
int
findMove
(
const
TOOL_EVENT
&
aEvent
);
///> Sets up handlers for various events.
///> Sets up handlers for various events.
void
setTransitions
();
void
setTransitions
();
...
...
qa/testcases/test_002_board_class.py
View file @
1bd70efc
...
@@ -8,6 +8,12 @@ import tempfile
...
@@ -8,6 +8,12 @@ import tempfile
from
pcbnew
import
*
from
pcbnew
import
*
BACK_COPPER
=
'Back_Copper'
B_CU
=
'B.Cu'
NEW_NAME
=
'My_Fancy_Layer_Name'
class
TestBoardClass
(
unittest
.
TestCase
):
class
TestBoardClass
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -97,9 +103,30 @@ class TestBoardClass(unittest.TestCase):
...
@@ -97,9 +103,30 @@ class TestBoardClass(unittest.TestCase):
os
.
remove
(
self
.
FILENAME
)
os
.
remove
(
self
.
FILENAME
)
def
test_pcb_layer_name_set_get
(
self
):
pcb
=
BOARD
()
pcb
.
SetLayerName
(
31
,
BACK_COPPER
)
self
.
assertEqual
(
pcb
.
GetLayerName
(
31
),
BACK_COPPER
)
def
test_pcb_layer_name_set_get
(
self
):
pcb
=
BOARD
()
pcb
.
SetLayerName
(
31
,
BACK_COPPER
)
self
.
assertEqual
(
pcb
.
GetLayerName
(
31
),
BACK_COPPER
)
def
test_pcb_layer_id_get
(
self
):
pcb
=
BOARD
()
b_cu_id
=
pcb
.
GetLayerID
(
B_CU
)
pcb
.
SetLayerName
(
b_cu_id
,
NEW_NAME
)
# ensure we can get the ID for the new name
self
.
assertEqual
(
pcb
.
GetLayerID
(
NEW_NAME
),
b_cu_id
)
# ensure we can get to the ID via the STD name too
self
.
assertEqual
(
pcb
.
GetLayerID
(
B_CU
),
b_cu_id
)
#def test_interactive(self):
#def test_interactive(self):
# code.interact(local=locals())
# code.interact(local=locals())
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
\ No newline at end of file
scripting/python_scripting.cpp
View file @
1bd70efc
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
* This program source code file is part of KiCad, a free EDA CAD application.
*
*
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es>
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es>
* Copyright (C) 1992-201
2
KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-201
5
KiCad Developers, see AUTHORS.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* modify it under the terms of the GNU General Public License
...
@@ -68,7 +68,7 @@ static void swigAddModule( const char* name, void (* initfunc)() )
...
@@ -68,7 +68,7 @@ static void swigAddModule( const char* name, void (* initfunc)() )
}
}
/* Add the builtin
g
python modules */
/* Add the builtin python modules */
static
void
swigAddBuiltin
()
static
void
swigAddBuiltin
()
{
{
...
@@ -140,6 +140,13 @@ bool pcbnewInitPythonScripting( const char * aUserPluginsPath )
...
@@ -140,6 +140,13 @@ bool pcbnewInitPythonScripting( const char * aUserPluginsPath )
#ifdef KICAD_SCRIPTING_WXPYTHON
#ifdef KICAD_SCRIPTING_WXPYTHON
PyEval_InitThreads
();
PyEval_InitThreads
();
char
cmd
[
1024
];
// Make sure that that the correct version of wxPython is loaded. In systems where there
// are different versions of wxPython installed this can lead to select wrong wxPython
// version being selected.
snprintf
(
cmd
,
1023
,
"import wxversion; wxversion.select('%s')"
,
WXPYTHON_VERSION
);
PyRun_SimpleString
(
cmd
);
// Load the wxPython core API. Imports the wx._core_ module and sets a
// Load the wxPython core API. Imports the wx._core_ module and sets a
// local pointer to a function table located there. The pointer is used
// local pointer to a function table located there. The pointer is used
// internally by the rest of the API functions.
// internally by the rest of the API functions.
...
@@ -181,7 +188,7 @@ void pcbnewFinishPythonScripting()
...
@@ -181,7 +188,7 @@ void pcbnewFinishPythonScripting()
}
}
#if defined(
KICAD_SCRIPTING_WXPYTHON
)
#if defined(
KICAD_SCRIPTING_WXPYTHON
)
void
RedirectStdio
()
void
RedirectStdio
()
{
{
...
...
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