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
fa8cbd98
Commit
fa8cbd98
authored
Jan 30, 2014
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3d-frame: is now derived from EDA_BASE_FRAME. Remove duplicate code and some useless includes
parent
f43ed909
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
100 deletions
+59
-100
3d_canvas.h
3d-viewer/3d_canvas.h
+1
-1
3d_draw.cpp
3d-viewer/3d_draw.cpp
+4
-1
3d_frame.cpp
3d-viewer/3d_frame.cpp
+15
-48
3d_toolbar.cpp
3d-viewer/3d_toolbar.cpp
+31
-37
3d_viewer.h
3d-viewer/3d_viewer.h
+6
-12
info3d_visu.h
3d-viewer/info3d_visu.h
+2
-1
No files found.
3d-viewer/3d_canvas.h
View file @
fa8cbd98
...
...
@@ -31,7 +31,6 @@
#define _3D_CANVAS_H_
#include <wx/glcanvas.h>
#include <wxBasePcbFrame.h> // for m_auimanager member.
#ifdef __WXMAC__
# ifdef __DARWIN__
...
...
@@ -49,6 +48,7 @@ class BOARD_DESIGN_SETTINGS;
class
EDA_3D_FRAME
;
class
S3D_VERTEX
;
class
SEGVIA
;
class
D_PAD
;
class
EDA_3D_CANVAS
:
public
wxGLCanvas
...
...
3d-viewer/3d_draw.cpp
View file @
fa8cbd98
...
...
@@ -32,6 +32,7 @@
#include <drawtxt.h>
#include <layers_id_colors_and_visibility.h>
#include <wxBasePcbFrame.h>
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
...
...
@@ -248,6 +249,8 @@ void EDA_3D_CANVAS::BuildBoard3DView()
&&
layer
>=
g_Parm_3D_Visu
.
m_CopperLayersCount
)
continue
;
// Skip non enabled layers in normal mode,
// and internal layers in realistic mode
if
(
!
Is3DLayerEnabled
(
layer
)
)
continue
;
...
...
@@ -293,7 +296,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
segcountforcircle
,
correctionFactor
);
// Micro-wave modu
k
es may have items on copper layers
// Micro-wave modu
l
es may have items on copper layers
module
->
TransformGraphicShapesWithClearanceToPolygonSet
(
layer
,
bufferPolys
,
0
,
...
...
3d-viewer/3d_frame.cpp
View file @
fa8cbd98
...
...
@@ -34,16 +34,12 @@
#include <trackball.h>
#include <wx/colordlg.h>
#include <wxstruct.h>
#include <3d_viewer_id.h>
#include <wxBasePcbFrame.h>
INFO3D_VISU
g_Parm_3D_Visu
;
// Key to store 3D Viewer config:
static
const
wxString
keyPosx
(
wxT
(
"Pos_x"
)
);
static
const
wxString
keyPosy
(
wxT
(
"Pos_y"
)
);
static
const
wxString
keySizex
(
wxT
(
"Size_x"
)
);
static
const
wxString
keySizey
(
wxT
(
"Size_y"
)
);
static
const
wxString
keyBgColor_Red
(
wxT
(
"BgColor_Red"
)
);
static
const
wxString
keyBgColor_Green
(
wxT
(
"BgColor_Green"
)
);
static
const
wxString
keyBgColor_Blue
(
wxT
(
"BgColor_Blue"
)
);
...
...
@@ -60,7 +56,7 @@ static const wxString keyShowCommentsLayer( wxT( "ShowCommentsLayers" ) );
static
const
wxString
keyShowBoardBody
(
wxT
(
"ShowBoardBody"
)
);
static
const
wxString
keyShowEcoLayers
(
wxT
(
"ShowEcoLayers"
)
);
BEGIN_EVENT_TABLE
(
EDA_3D_FRAME
,
wxFrame
)
BEGIN_EVENT_TABLE
(
EDA_3D_FRAME
,
EDA_BASE_FRAME
)
EVT_ACTIVATE
(
EDA_3D_FRAME
::
OnActivate
)
EVT_TOOL_RANGE
(
ID_ZOOM_IN
,
ID_ZOOM_PAGE
,
EDA_3D_FRAME
::
Process_Zoom
)
...
...
@@ -79,12 +75,10 @@ EVT_CLOSE( EDA_3D_FRAME::OnCloseWindow )
END_EVENT_TABLE
()
EDA_3D_FRAME
::
EDA_3D_FRAME
(
PCB_BASE_FRAME
*
parent
,
const
wxString
&
title
,
long
style
)
:
wxFrame
(
parent
,
DISPLAY3D_FRAME_TYPE
,
title
,
wxDefaultPosition
,
wxDefaultSize
,
style
)
EDA_BASE_FRAME
(
parent
,
DISPLAY3D_FRAME_TYPE
,
title
,
wxDefaultPosition
,
wxDefaultSize
,
style
,
wxT
(
"Frame3D"
)
)
{
m_frameName
=
wxT
(
"Frame3D"
);
m_canvas
=
NULL
;
m_HToolBar
=
NULL
;
m_VToolBar
=
NULL
;
m_reloadRequest
=
false
;
m_ortho
=
false
;
...
...
@@ -94,7 +88,7 @@ END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent,
SetIcon
(
icon
);
GetSettings
();
SetSize
(
m_
framePos
.
x
,
m_framePos
.
y
,
m_frameSize
.
x
,
m_f
rameSize
.
y
);
SetSize
(
m_
FramePos
.
x
,
m_FramePos
.
y
,
m_FrameSize
.
x
,
m_F
rameSize
.
y
);
// Create the status line
static
const
int
dims
[
5
]
=
{
-
1
,
100
,
100
,
100
,
140
};
...
...
@@ -103,10 +97,7 @@ END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent,
SetStatusWidths
(
5
,
dims
);
CreateMenuBar
();
ReCreateHToolbar
();
// ReCreateAuxiliaryToolbar();
ReCreateVToolbar
();
ReCreateMainToolbar
();
// Make a EDA_3D_CANVAS
int
attrs
[]
=
{
WX_GL_RGBA
,
WX_GL_DOUBLEBUFFER
,
WX_GL_DEPTH_SIZE
,
16
,
0
};
...
...
@@ -115,11 +106,11 @@ END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME* parent,
m_auimgr
.
SetManagedWindow
(
this
);
EDA_PANEINFO
horiz
;
horiz
.
HorizontalToolbarPane
();
EDA_PANEINFO
horiz
tb
;
horiz
tb
.
HorizontalToolbarPane
();
m_auimgr
.
AddPane
(
m_
H
ToolBar
,
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"m_H
ToolBar"
)
).
Top
()
);
m_auimgr
.
AddPane
(
m_
main
ToolBar
,
wxAuiPaneInfo
(
horiz
tb
).
Name
(
wxT
(
"m_main
ToolBar"
)
).
Top
()
);
m_auimgr
.
AddPane
(
m_canvas
,
wxAuiPaneInfo
().
Name
(
wxT
(
"DrawFrame"
)
).
CentrePane
()
);
...
...
@@ -141,9 +132,6 @@ void EDA_3D_FRAME::Exit3DFrame( wxCommandEvent& event )
void
EDA_3D_FRAME
::
OnCloseWindow
(
wxCloseEvent
&
Event
)
{
SaveSettings
();
Show
(
false
);
if
(
Parent
()
)
Parent
()
->
m_Draw3DFrame
=
NULL
;
...
...
@@ -153,20 +141,13 @@ void EDA_3D_FRAME::OnCloseWindow( wxCloseEvent& Event )
void
EDA_3D_FRAME
::
GetSettings
()
{
wxString
text
;
wxConfig
*
config
=
wxGetApp
().
GetSettings
();
// Current config used by application
class
INFO3D_VISU
&
prms
=
g_Parm_3D_Visu
;
if
(
config
)
{
text
=
m_frameName
+
keyPosx
;
config
->
Read
(
text
,
&
m_framePos
.
x
);
text
=
m_frameName
+
keyPosy
;
config
->
Read
(
text
,
&
m_framePos
.
y
);
text
=
m_frameName
+
keySizex
;
config
->
Read
(
text
,
&
m_frameSize
.
x
,
600
);
text
=
m_frameName
+
keySizey
;
config
->
Read
(
text
,
&
m_frameSize
.
y
,
400
);
EDA_BASE_FRAME
::
LoadSettings
();
config
->
Read
(
keyBgColor_Red
,
&
g_Parm_3D_Visu
.
m_BgColor
.
m_Red
,
0.0
);
config
->
Read
(
keyBgColor_Green
,
&
g_Parm_3D_Visu
.
m_BgColor
.
m_Green
,
0.0
);
config
->
Read
(
keyBgColor_Blue
,
&
g_Parm_3D_Visu
.
m_BgColor
.
m_Blue
,
0.0
);
...
...
@@ -213,12 +194,13 @@ void EDA_3D_FRAME::GetSettings()
void
EDA_3D_FRAME
::
SaveSettings
()
{
wxString
text
;
wxConfig
*
config
=
wxGetApp
().
GetSettings
();
// Current config used by application
wxConfig
*
config
=
wxGetApp
().
GetSettings
();
// Current config used by application
if
(
!
config
)
return
;
EDA_BASE_FRAME
::
SaveSettings
();
config
->
Write
(
keyBgColor_Red
,
g_Parm_3D_Visu
.
m_BgColor
.
m_Red
);
config
->
Write
(
keyBgColor_Green
,
g_Parm_3D_Visu
.
m_BgColor
.
m_Green
);
config
->
Write
(
keyBgColor_Blue
,
g_Parm_3D_Visu
.
m_BgColor
.
m_Blue
);
...
...
@@ -235,21 +217,6 @@ void EDA_3D_FRAME::SaveSettings()
config
->
Write
(
keyShowCommentsLayer
,
prms
.
GetFlag
(
FL_COMMENTS
)
);
config
->
Write
(
keyShowEcoLayers
,
prms
.
GetFlag
(
FL_ECO
)
);
config
->
Write
(
keyShowBoardBody
,
prms
.
GetFlag
(
FL_SHOW_BOARD_BODY
)
);
if
(
IsIconized
()
)
return
;
m_frameSize
=
GetSize
();
m_framePos
=
GetPosition
();
text
=
m_frameName
+
keyPosx
;
config
->
Write
(
text
,
(
long
)
m_framePos
.
x
);
text
=
m_frameName
+
keyPosy
;
config
->
Write
(
text
,
(
long
)
m_framePos
.
y
);
text
=
m_frameName
+
keySizex
;
config
->
Write
(
text
,
(
long
)
m_frameSize
.
x
);
text
=
m_frameName
+
keySizey
;
config
->
Write
(
text
,
(
long
)
m_frameSize
.
y
);
}
...
...
3d-viewer/3d_toolbar.cpp
View file @
fa8cbd98
...
...
@@ -35,104 +35,98 @@
#include <3d_viewer_id.h>
void
EDA_3D_FRAME
::
ReCreate
H
Toolbar
()
void
EDA_3D_FRAME
::
ReCreate
Main
Toolbar
()
{
if
(
m_
H
ToolBar
!=
NULL
)
if
(
m_
main
ToolBar
!=
NULL
)
{
// Simple update to the list of old files.
SetToolbars
();
return
;
}
m_
H
ToolBar
=
new
wxAuiToolBar
(
this
,
ID_H_TOOLBAR
,
wxDefaultPosition
,
wxDefaultSize
,
m_
main
ToolBar
=
new
wxAuiToolBar
(
this
,
ID_H_TOOLBAR
,
wxDefaultPosition
,
wxDefaultSize
,
wxAUI_TB_DEFAULT_STYLE
|
wxAUI_TB_HORZ_LAYOUT
);
// Set up toolbar
m_HToolBar
->
AddTool
(
ID_RELOAD3D_BOARD
,
wxEmptyString
,
KiBitmap
(
import3d_xpm
),
_
(
"Reload board"
)
);
m_mainToolBar
->
AddTool
(
ID_RELOAD3D_BOARD
,
wxEmptyString
,
KiBitmap
(
import3d_xpm
),
_
(
"Reload board"
)
);
#if (defined(__WINDOWS__) || defined(__APPLE__ ) )
// Does not work properly under linux
m_
H
ToolBar
->
AddSeparator
();
m_
main
ToolBar
->
AddSeparator
();
m_
H
ToolBar
->
AddTool
(
ID_TOOL_SCREENCOPY_TOCLIBBOARD
,
wxEmptyString
,
m_
main
ToolBar
->
AddTool
(
ID_TOOL_SCREENCOPY_TOCLIBBOARD
,
wxEmptyString
,
KiBitmap
(
copy_button_xpm
),
_
(
"Copy 3D Image to Clipboard"
)
);
#endif
m_
H
ToolBar
->
AddSeparator
();
m_
main
ToolBar
->
AddSeparator
();
m_
H
ToolBar
->
AddTool
(
ID_TOOL_SET_VISIBLE_ITEMS
,
wxEmptyString
,
m_
main
ToolBar
->
AddTool
(
ID_TOOL_SET_VISIBLE_ITEMS
,
wxEmptyString
,
KiBitmap
(
read_setup_xpm
),
_
(
"Set display options, and some layers visibility"
)
);
m_
H
ToolBar
->
AddSeparator
();
m_
main
ToolBar
->
AddSeparator
();
m_
H
ToolBar
->
AddTool
(
ID_ZOOM_IN
,
wxEmptyString
,
KiBitmap
(
zoom_in_xpm
),
m_
main
ToolBar
->
AddTool
(
ID_ZOOM_IN
,
wxEmptyString
,
KiBitmap
(
zoom_in_xpm
),
_
(
"Zoom in"
)
);
m_
H
ToolBar
->
AddTool
(
ID_ZOOM_OUT
,
wxEmptyString
,
KiBitmap
(
zoom_out_xpm
),
m_
main
ToolBar
->
AddTool
(
ID_ZOOM_OUT
,
wxEmptyString
,
KiBitmap
(
zoom_out_xpm
),
_
(
"Zoom out"
)
);
m_
H
ToolBar
->
AddTool
(
ID_ZOOM_REDRAW
,
wxEmptyString
,
m_
main
ToolBar
->
AddTool
(
ID_ZOOM_REDRAW
,
wxEmptyString
,
KiBitmap
(
zoom_redraw_xpm
),
_
(
"Redraw view"
)
);
m_
H
ToolBar
->
AddTool
(
ID_ZOOM_PAGE
,
wxEmptyString
,
KiBitmap
(
zoom_fit_in_page_xpm
),
m_
main
ToolBar
->
AddTool
(
ID_ZOOM_PAGE
,
wxEmptyString
,
KiBitmap
(
zoom_fit_in_page_xpm
),
_
(
"Fit in page"
)
);
m_
H
ToolBar
->
AddSeparator
();
m_
H
ToolBar
->
AddTool
(
ID_ROTATE3D_X_NEG
,
wxEmptyString
,
m_
main
ToolBar
->
AddSeparator
();
m_
main
ToolBar
->
AddTool
(
ID_ROTATE3D_X_NEG
,
wxEmptyString
,
KiBitmap
(
rotate_neg_x_xpm
),
_
(
"Rotate X <-"
)
);
m_
H
ToolBar
->
AddTool
(
ID_ROTATE3D_X_POS
,
wxEmptyString
,
m_
main
ToolBar
->
AddTool
(
ID_ROTATE3D_X_POS
,
wxEmptyString
,
KiBitmap
(
rotate_pos_x_xpm
),
_
(
"Rotate X ->"
)
);
m_
H
ToolBar
->
AddSeparator
();
m_
H
ToolBar
->
AddTool
(
ID_ROTATE3D_Y_NEG
,
wxEmptyString
,
m_
main
ToolBar
->
AddSeparator
();
m_
main
ToolBar
->
AddTool
(
ID_ROTATE3D_Y_NEG
,
wxEmptyString
,
KiBitmap
(
rotate_neg_y_xpm
),
_
(
"Rotate Y <-"
)
);
m_
H
ToolBar
->
AddTool
(
ID_ROTATE3D_Y_POS
,
wxEmptyString
,
m_
main
ToolBar
->
AddTool
(
ID_ROTATE3D_Y_POS
,
wxEmptyString
,
KiBitmap
(
rotate_pos_y_xpm
),
_
(
"Rotate Y ->"
)
);
m_
H
ToolBar
->
AddSeparator
();
m_
H
ToolBar
->
AddTool
(
ID_ROTATE3D_Z_NEG
,
wxEmptyString
,
m_
main
ToolBar
->
AddSeparator
();
m_
main
ToolBar
->
AddTool
(
ID_ROTATE3D_Z_NEG
,
wxEmptyString
,
KiBitmap
(
rotate_neg_z_xpm
),
_
(
"Rotate Z <-"
)
);
m_
H
ToolBar
->
AddTool
(
ID_ROTATE3D_Z_POS
,
wxEmptyString
,
m_
main
ToolBar
->
AddTool
(
ID_ROTATE3D_Z_POS
,
wxEmptyString
,
KiBitmap
(
rotate_pos_z_xpm
),
_
(
"Rotate Z ->"
)
);
m_
H
ToolBar
->
AddSeparator
();
m_
H
ToolBar
->
AddTool
(
ID_MOVE3D_LEFT
,
wxEmptyString
,
KiBitmap
(
left_xpm
),
m_
main
ToolBar
->
AddSeparator
();
m_
main
ToolBar
->
AddTool
(
ID_MOVE3D_LEFT
,
wxEmptyString
,
KiBitmap
(
left_xpm
),
_
(
"Move left"
)
);
m_
H
ToolBar
->
AddTool
(
ID_MOVE3D_RIGHT
,
wxEmptyString
,
KiBitmap
(
right_xpm
),
m_
main
ToolBar
->
AddTool
(
ID_MOVE3D_RIGHT
,
wxEmptyString
,
KiBitmap
(
right_xpm
),
_
(
"Move right"
)
);
m_
H
ToolBar
->
AddTool
(
ID_MOVE3D_UP
,
wxEmptyString
,
KiBitmap
(
up_xpm
),
m_
main
ToolBar
->
AddTool
(
ID_MOVE3D_UP
,
wxEmptyString
,
KiBitmap
(
up_xpm
),
_
(
"Move up"
)
);
m_
H
ToolBar
->
AddTool
(
ID_MOVE3D_DOWN
,
wxEmptyString
,
KiBitmap
(
down_xpm
),
m_
main
ToolBar
->
AddTool
(
ID_MOVE3D_DOWN
,
wxEmptyString
,
KiBitmap
(
down_xpm
),
_
(
"Move down"
)
);
m_
H
ToolBar
->
AddSeparator
();
m_
H
ToolBar
->
AddTool
(
ID_ORTHO
,
wxEmptyString
,
KiBitmap
(
ortho_xpm
),
m_
main
ToolBar
->
AddSeparator
();
m_
main
ToolBar
->
AddTool
(
ID_ORTHO
,
wxEmptyString
,
KiBitmap
(
ortho_xpm
),
_
(
"Enable/Disable orthographic projection"
),
wxITEM_CHECK
);
m_HToolBar
->
Realize
();
}
void
EDA_3D_FRAME
::
ReCreateVToolbar
()
{
m_mainToolBar
->
Realize
();
}
...
...
3d-viewer/3d_viewer.h
View file @
fa8cbd98
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 20
0
4 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 20
1
4 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
...
...
@@ -30,10 +30,10 @@
#ifndef __3D_VIEWER_H__
#define __3D_VIEWER_H__
#include <wx
BasePcbFrame.h> // for m_auimanager member
.
#include <wx
struct.h> // for EDA_BASE_FRAME
.
#if !wxUSE_GLCANVAS
#error Please
set wxUSE_GLCANVAS to 1 in setup.h.
#error Please
build wxWidgets with Opengl support (./configure --with-opengl)
#endif
#include <wx/glcanvas.h>
...
...
@@ -51,20 +51,15 @@
#include <3d_struct.h>
class
EDA_3D_CANVAS
;
class
PCB_BASE_FRAME
;
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
#define LIB3D_PATH wxT( "packages3d" )
class
EDA_3D_FRAME
:
public
wxFrame
class
EDA_3D_FRAME
:
public
EDA_BASE_FRAME
{
private
:
wxString
m_frameName
;
// name used for writing and reading setup. It is "Frame3D"
EDA_3D_CANVAS
*
m_canvas
;
wxAuiToolBar
*
m_HToolBar
;
wxAuiToolBar
*
m_VToolBar
;
wxPoint
m_framePos
;
wxSize
m_frameSize
;
wxAuiManager
m_auimgr
;
bool
m_reloadRequest
;
wxString
m_defaultFileName
;
/// Filename to propose for screenshot
/// Tracks whether to use Orthographic or Perspective projection
...
...
@@ -121,8 +116,7 @@ private:
void
CreateMenuBar
();
void
SetMenuBarOptionsState
();
// Set the state of toggle menus according
// to the current display options
void
ReCreateHToolbar
();
void
ReCreateVToolbar
();
void
ReCreateMainToolbar
();
void
SetToolbars
();
void
GetSettings
();
void
SaveSettings
();
...
...
3d-viewer/info3d_visu.h
View file @
fa8cbd98
...
...
@@ -30,7 +30,7 @@
#ifndef __INFO3D_VISU_H__
#define __INFO3D_VISU_H__
#include <wxBasePcbFrame.h> // m_auimanager member.
//#include <wxBasePcbFrame.h>
#include <layers_id_colors_and_visibility.h> // Layers id definitions
#include <wx/glcanvas.h>
...
...
@@ -51,6 +51,7 @@
#define m_ROTY m_Rot[1]
#define m_ROTZ m_Rot[2]
class
BOARD_DESIGN_SETTINGS
;
class
S3D_COLOR
/* 3D color (R, G, B) 3 floats range 0 to 1.0*/
{
...
...
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