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
623ae37f
Commit
623ae37f
authored
Feb 10, 2012
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pcbnew - ModView: add 3D view, and fix issues.
parent
fa470d5c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
74 additions
and
4 deletions
+74
-4
modedit.cpp
pcbnew/modedit.cpp
+1
-1
modview.cpp
pcbnew/modview.cpp
+1
-0
modview_frame.cpp
pcbnew/modview_frame.cpp
+48
-0
modview_frame.h
pcbnew/modview_frame.h
+17
-2
onleftclick.cpp
pcbnew/onleftclick.cpp
+1
-1
pcbnew_id.h
pcbnew/pcbnew_id.h
+1
-0
tool_modview.cpp
pcbnew/tool_modview.cpp
+5
-0
No files found.
pcbnew/modedit.cpp
View file @
623ae37f
...
@@ -419,7 +419,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -419,7 +419,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
Clear_Pcb
(
true
);
Clear_Pcb
(
true
);
GetScreen
()
->
SetCrossHairPosition
(
wxPoint
(
0
,
0
)
);
GetScreen
()
->
SetCrossHairPosition
(
wxPoint
(
0
,
0
)
);
Load_Module_From_Library
(
full_libraryfilename
,
NULL
);
Load_Module_From_Library
(
full_libraryfilename
,
true
);
redraw
=
true
;
redraw
=
true
;
}
}
...
...
pcbnew/modview.cpp
View file @
623ae37f
...
@@ -161,6 +161,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
...
@@ -161,6 +161,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
GetBoard
()
->
m_Modules
.
DeleteAll
();
GetBoard
()
->
m_Modules
.
DeleteAll
();
GetModuleLibrary
(
m_libraryName
+
wxT
(
"."
)
+
ModuleFileExtension
,
GetModuleLibrary
(
m_libraryName
+
wxT
(
"."
)
+
ModuleFileExtension
,
m_footprintName
,
true
);
m_footprintName
,
true
);
Update3D_Frame
();
}
}
DisplayLibInfos
();
DisplayLibInfos
();
...
...
pcbnew/modview_frame.cpp
View file @
623ae37f
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <fctsys.h>
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <appl_wxstruct.h>
#include <macros.h>
#include <class_drawpanel.h>
#include <class_drawpanel.h>
#include <wxPcbStruct.h>
#include <wxPcbStruct.h>
#include <3d_viewer.h>
#include <3d_viewer.h>
...
@@ -77,6 +78,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME )
...
@@ -77,6 +78,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME )
FOOTPRINT_VIEWER_FRAME
::
Process_Special_Functions
)
FOOTPRINT_VIEWER_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD
,
EVT_TOOL
(
ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD
,
FOOTPRINT_VIEWER_FRAME
::
ExportSelectedFootprint
)
FOOTPRINT_VIEWER_FRAME
::
ExportSelectedFootprint
)
EVT_TOOL
(
ID_MODVIEW_SHOW_3D_VIEW
,
FOOTPRINT_VIEWER_FRAME
::
Show3D_Frame
)
/* listbox events */
/* listbox events */
EVT_LISTBOX
(
ID_MODVIEW_LIB_LIST
,
FOOTPRINT_VIEWER_FRAME
::
ClickOnLibList
)
EVT_LISTBOX
(
ID_MODVIEW_LIB_LIST
,
FOOTPRINT_VIEWER_FRAME
::
ClickOnLibList
)
...
@@ -263,6 +265,8 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( wxWindow* parent, wxSemaphore* s
...
@@ -263,6 +265,8 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( wxWindow* parent, wxSemaphore* s
FOOTPRINT_VIEWER_FRAME
::~
FOOTPRINT_VIEWER_FRAME
()
FOOTPRINT_VIEWER_FRAME
::~
FOOTPRINT_VIEWER_FRAME
()
{
{
if
(
m_Draw3DFrame
)
m_Draw3DFrame
->
Destroy
();
PCB_BASE_FRAME
*
frame
=
(
PCB_BASE_FRAME
*
)
GetParent
();
PCB_BASE_FRAME
*
frame
=
(
PCB_BASE_FRAME
*
)
GetParent
();
frame
->
m_ModuleViewerFrame
=
NULL
;
frame
->
m_ModuleViewerFrame
=
NULL
;
}
}
...
@@ -441,6 +445,7 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
...
@@ -441,6 +445,7 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
DisplayLibInfos
();
DisplayLibInfos
();
Zoom_Automatique
(
false
);
Zoom_Automatique
(
false
);
m_canvas
->
Refresh
();
m_canvas
->
Refresh
();
Update3D_Frame
();
}
}
}
}
...
@@ -605,3 +610,46 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
...
@@ -605,3 +610,46 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
UpdateStatusBar
();
/* Display new cursor coordinates */
UpdateStatusBar
();
/* Display new cursor coordinates */
}
}
void
FOOTPRINT_VIEWER_FRAME
::
Show3D_Frame
(
wxCommandEvent
&
event
)
{
if
(
m_Draw3DFrame
)
{
// Raising the window does not show the window on Windows if iconized.
// This should work on any platform.
if
(
m_Draw3DFrame
->
IsIconized
()
)
m_Draw3DFrame
->
Iconize
(
false
);
m_Draw3DFrame
->
Raise
();
// Raising the window does not set the focus on Linux. This should work on any platform.
if
(
wxWindow
::
FindFocus
()
!=
m_Draw3DFrame
)
m_Draw3DFrame
->
SetFocus
();
return
;
}
m_Draw3DFrame
=
new
EDA_3D_FRAME
(
this
,
wxEmptyString
);
Update3D_Frame
();
m_Draw3DFrame
->
Show
(
true
);
}
/**
* Function Update3D_Frame
* must be called after a footprint selection
* Updates the 3D view and 3D frame title.
*/
void
FOOTPRINT_VIEWER_FRAME
::
Update3D_Frame
()
{
if
(
m_Draw3DFrame
==
NULL
)
return
;
wxString
frm3Dtitle
;
frm3Dtitle
.
Printf
(
_
(
"ModView: 3D Viewer [%s]"
),
GetChars
(
m_footprintName
)
);
m_Draw3DFrame
->
SetTitle
(
frm3Dtitle
);
m_Draw3DFrame
->
ReloadRequest
();
// Force 3D screen refresh immediately
if
(
GetBoard
()
->
m_Modules
)
m_Draw3DFrame
->
NewDisplay
();
}
pcbnew/modview_frame.h
View file @
623ae37f
...
@@ -69,6 +69,10 @@ public:
...
@@ -69,6 +69,10 @@ public:
~
FOOTPRINT_VIEWER_FRAME
();
~
FOOTPRINT_VIEWER_FRAME
();
wxString
&
GetSelectedFootprint
(
void
)
const
{
return
m_selectedFootprintName
;
}
private
:
void
OnSize
(
wxSizeEvent
&
event
);
void
OnSize
(
wxSizeEvent
&
event
);
/**
/**
...
@@ -119,9 +123,7 @@ public:
...
@@ -119,9 +123,7 @@ public:
void
SaveSettings
();
void
SaveSettings
();
wxString
&
GetFootprintName
(
void
)
const
{
return
m_footprintName
;
}
wxString
&
GetFootprintName
(
void
)
const
{
return
m_footprintName
;
}
wxString
&
GetSelectedFootprint
(
void
)
const
{
return
m_selectedFootprintName
;
}
private
:
/**
/**
* Function OnActivate
* Function OnActivate
* is called when the frame frame is activate to reload the libraries and component lists
* is called when the frame frame is activate to reload the libraries and component lists
...
@@ -149,6 +151,19 @@ private:
...
@@ -149,6 +151,19 @@ private:
bool
OnRightClick
(
const
wxPoint
&
MousePos
,
wxMenu
*
PopMenu
);
bool
OnRightClick
(
const
wxPoint
&
MousePos
,
wxMenu
*
PopMenu
);
/**
* Function Show3D_Frame (virtual)
* displays 3D view of the footprint (module) being edited.
*/
void
Show3D_Frame
(
wxCommandEvent
&
event
);
/**
* Function Update3D_Frame
* must be called after a footprint selection
* Updates the 3D view and 3D frame title.
*/
void
Update3D_Frame
();
/*
/*
* Virtual functions, not used here, but needed by PCB_BASE_FRAME
* Virtual functions, not used here, but needed by PCB_BASE_FRAME
* (virtual pure functions )
* (virtual pure functions )
...
...
pcbnew/onleftclick.cpp
View file @
623ae37f
...
@@ -362,7 +362,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
...
@@ -362,7 +362,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if
(
(
DrawStruct
==
NULL
)
||
(
DrawStruct
->
GetFlags
()
==
0
)
)
if
(
(
DrawStruct
==
NULL
)
||
(
DrawStruct
->
GetFlags
()
==
0
)
)
{
{
m_canvas
->
MoveCursorToCrossHair
();
m_canvas
->
MoveCursorToCrossHair
();
DrawStruct
=
(
BOARD_ITEM
*
)
Load_Module_From_Library
(
wxEmptyString
,
aDC
);
DrawStruct
=
(
BOARD_ITEM
*
)
Load_Module_From_Library
(
wxEmptyString
,
true
,
aDC
);
SetCurItem
(
DrawStruct
);
SetCurItem
(
DrawStruct
);
if
(
DrawStruct
)
if
(
DrawStruct
)
...
...
pcbnew/pcbnew_id.h
View file @
623ae37f
...
@@ -321,6 +321,7 @@ enum pcbnew_ids
...
@@ -321,6 +321,7 @@ enum pcbnew_ids
ID_MODVIEW_SELECT_PART
,
ID_MODVIEW_SELECT_PART
,
ID_MODVIEW_PREVIOUS
,
ID_MODVIEW_PREVIOUS
,
ID_MODVIEW_NEXT
,
ID_MODVIEW_NEXT
,
ID_MODVIEW_SHOW_3D_VIEW
,
ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD
ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD
};
};
...
...
pcbnew/tool_modview.cpp
View file @
623ae37f
...
@@ -66,6 +66,11 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
...
@@ -66,6 +66,11 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
KiBitmap
(
lib_next_xpm
),
KiBitmap
(
lib_next_xpm
),
_
(
"Display next footprint"
)
);
_
(
"Display next footprint"
)
);
m_mainToolBar
->
AddSeparator
();
m_mainToolBar
->
AddTool
(
ID_MODVIEW_SHOW_3D_VIEW
,
wxEmptyString
,
KiBitmap
(
three_d_xpm
),
_
(
"Show footprint in 3D viewer"
)
);
m_mainToolBar
->
AddSeparator
();
m_mainToolBar
->
AddSeparator
();
msg
=
AddHotkeyName
(
_
(
"Zoom in"
),
g_Module_Editor_Hokeys_Descr
,
msg
=
AddHotkeyName
(
_
(
"Zoom in"
),
g_Module_Editor_Hokeys_Descr
,
HK_ZOOM_IN
,
IS_COMMENT
);
HK_ZOOM_IN
,
IS_COMMENT
);
...
...
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