Commit e1431199 authored by jean-pierre charras's avatar jean-pierre charras

Auto update 3D display after footprint or board edition.

parent a35a0836
...@@ -57,6 +57,7 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, ...@@ -57,6 +57,7 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
m_HToolBar = NULL; m_HToolBar = NULL;
m_VToolBar = NULL; m_VToolBar = NULL;
m_InternalUnits = 10000; // Internal units = 1/10000 inch m_InternalUnits = 10000; // Internal units = 1/10000 inch
m_reloadRequest = false;
// Give it an icon // Give it an icon
SetIcon( wxICON( icon_w3d ) ); SetIcon( wxICON( icon_w3d ) );
...@@ -343,6 +344,8 @@ error: unknown command" ) ); ...@@ -343,6 +344,8 @@ error: unknown command" ) );
void WinEDA3D_DrawFrame::NewDisplay() void WinEDA3D_DrawFrame::NewDisplay()
{ {
m_reloadRequest = false;
m_Canvas->ClearLists(); m_Canvas->ClearLists();
m_Canvas->CreateDrawGL_List(); m_Canvas->CreateDrawGL_List();
...@@ -356,10 +359,9 @@ void WinEDA3D_DrawFrame::OnActivate( wxActivateEvent& event ) ...@@ -356,10 +359,9 @@ void WinEDA3D_DrawFrame::OnActivate( wxActivateEvent& event )
{ {
// Reload data if 3D frame shows a footprint, // Reload data if 3D frame shows a footprint,
// because it can be changed since last frame activation // because it can be changed since last frame activation
if( m_Parent->m_Ident == MODULE_EDITOR_FRAME ) if( m_reloadRequest )
{ NewDisplay();
// NewDisplay();
}
event.Skip(); // required under wxMAC event.Skip(); // required under wxMAC
} }
......
...@@ -185,23 +185,25 @@ class WinEDA3D_DrawFrame : public wxFrame ...@@ -185,23 +185,25 @@ class WinEDA3D_DrawFrame : public wxFrame
{ {
public: public:
WinEDA_BasePcbFrame* m_Parent; WinEDA_BasePcbFrame* m_Parent;
private:
wxString m_FrameName; // name used for writing and reading setup
// It is "Frame3D"
Pcb3D_GLCanvas* m_Canvas; Pcb3D_GLCanvas* m_Canvas;
WinEDA_Toolbar* m_HToolBar; WinEDA_Toolbar* m_HToolBar;
WinEDA_Toolbar* m_VToolBar; WinEDA_Toolbar* m_VToolBar;
int m_InternalUnits; int m_InternalUnits;
wxPoint m_FramePos; wxPoint m_FramePos;
wxSize m_FrameSize; wxSize m_FrameSize;
wxAuiManager m_auimgr; wxAuiManager m_auimgr;
~WinEDA3D_DrawFrame() { m_auimgr.UnInit(); }; bool m_reloadRequest;
private:
wxString m_FrameName; // name used for writing and reading setup
// It is "Frame3D"
public: public:
WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, const wxString& title, WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, const wxString& title,
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
~WinEDA3D_DrawFrame()
{
m_auimgr.UnInit();
};
void Exit3DFrame( wxCommandEvent& event ); void Exit3DFrame( wxCommandEvent& event );
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
...@@ -211,6 +213,15 @@ public: ...@@ -211,6 +213,15 @@ public:
void SetToolbars(); void SetToolbars();
void GetSettings(); void GetSettings();
void SaveSettings(); void SaveSettings();
/** function ReloadRequest
* must be called when reloading data from Pcbnew is needed
* mainly after edition of the board or footprint beeing displayed.
* mainly for the mudule editor.
*/
void ReloadRequest( )
{
m_reloadRequest = true;
}
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
......
...@@ -218,9 +218,11 @@ public: ...@@ -218,9 +218,11 @@ public:
/** Function OnModify() /** Function OnModify()
* Virtual * Virtual
* Must be called after a schematic change * Must be called after a change
* in order to set the "modify" flag of the current screen * in order to set the "modify" flag of the current screen
* and update the date in frame reference * and update the date in frame reference
* do not forget to call this basic OnModify function to update info
* in derived OnModify functions
*/ */
virtual void OnModify( ); virtual void OnModify( );
......
...@@ -274,6 +274,14 @@ public: ...@@ -274,6 +274,14 @@ public:
void ReCreateMenuBar(); void ReCreateMenuBar();
WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent ); WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent );
/** Virtual Function OnModify()
* Must be called after a board change
* in order to set the "modify" flag of the current screen
* and prepare, if needed the refresh of the 3D frame showing the footprint
* do not forget to call the basic OnModify function to update auxiliary info
*/
virtual void OnModify( );
/** /**
* Function IsElementVisible * Function IsElementVisible
* tests whether a given element category is visible. Keep this as an * tests whether a given element category is visible. Keep this as an
...@@ -1069,6 +1077,14 @@ public: ...@@ -1069,6 +1077,14 @@ public:
void GeneralControle( wxDC* DC, wxPoint Mouse ); void GeneralControle( wxDC* DC, wxPoint Mouse );
void LoadModuleFromBoard( wxCommandEvent& event ); void LoadModuleFromBoard( wxCommandEvent& event );
/** Virtual Function OnModify()
* Must be called after a footprint change
* in order to set the "modify" flag of the current screen
* and prepare, if needed the refresh of the 3D frame showing the footprint
* do not forget to call the basic OnModify function to update auxiliary info
*/
virtual void OnModify( );
/** function ToPrinter /** function ToPrinter
* Install the print dialog * Install the print dialog
*/ */
......
...@@ -423,6 +423,8 @@ void WinEDA_BasePcbFrame::SaveSettings() ...@@ -423,6 +423,8 @@ void WinEDA_BasePcbFrame::SaveSettings()
* Must be called after a schematic change * Must be called after a schematic change
* in order to set the "modify" flag of the current screen * in order to set the "modify" flag of the current screen
* and update the date in frame reference * and update the date in frame reference
* do not forget to call this basic OnModify function to update info
* in derived OnModify functions
*/ */
void WinEDA_BasePcbFrame::OnModify( ) void WinEDA_BasePcbFrame::OnModify( )
{ {
......
...@@ -802,4 +802,5 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform ) ...@@ -802,4 +802,5 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
} }
module->Set_Rectangle_Encadrement(); module->Set_Rectangle_Encadrement();
OnModify();
} }
...@@ -531,3 +531,16 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -531,3 +531,16 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
SetToolbars(); SetToolbars();
UpdateStatusBar(); UpdateStatusBar();
} }
/** Virtual Function OnModify()
* Must be called after a change
* in order to set the "modify" flag of the current screen
* and prepare, if needed the refresh of the 3D frame showing the footprint
* do not forget to call the basic OnModify function to update auxiliary info
*/
void WinEDA_ModuleEditFrame::OnModify( )
{
WinEDA_BasePcbFrame::OnModify( );
if( m_Draw3DFrame )
m_Draw3DFrame->ReloadRequest( );
}
...@@ -678,3 +678,17 @@ void WinEDA_PcbFrame::SetLastNetListRead( const wxString& aLastNetListRead ) ...@@ -678,3 +678,17 @@ void WinEDA_PcbFrame::SetLastNetListRead( const wxString& aLastNetListRead )
m_lastNetListRead = relativeFileName.GetFullPath(); m_lastNetListRead = relativeFileName.GetFullPath();
} }
} }
/** Virtual Function OnModify()
* Must be called after a change
* in order to set the "modify" flag of the current screen
* and prepare, if needed the refresh of the 3D frame showing the footprint
* do not forget to call the basic OnModify function to update auxiliary info
*/
void WinEDA_PcbFrame::OnModify( )
{
WinEDA_BasePcbFrame::OnModify( );
if( m_Draw3DFrame )
m_Draw3DFrame->ReloadRequest( );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment