Auto update 3D display after footprint or board edition.

This commit is contained in:
jean-pierre charras 2010-05-01 14:46:33 +02:00
parent a35a083690
commit e14311997d
8 changed files with 72 additions and 11 deletions

View File

@ -57,6 +57,7 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
m_HToolBar = NULL;
m_VToolBar = NULL;
m_InternalUnits = 10000; // Internal units = 1/10000 inch
m_reloadRequest = false;
// Give it an icon
SetIcon( wxICON( icon_w3d ) );
@ -343,6 +344,8 @@ error: unknown command" ) );
void WinEDA3D_DrawFrame::NewDisplay()
{
m_reloadRequest = false;
m_Canvas->ClearLists();
m_Canvas->CreateDrawGL_List();
@ -356,10 +359,9 @@ void WinEDA3D_DrawFrame::OnActivate( wxActivateEvent& event )
{
// Reload data if 3D frame shows a footprint,
// because it can be changed since last frame activation
if( m_Parent->m_Ident == MODULE_EDITOR_FRAME )
{
// NewDisplay();
}
if( m_reloadRequest )
NewDisplay();
event.Skip(); // required under wxMAC
}

View File

@ -185,23 +185,25 @@ class WinEDA3D_DrawFrame : public wxFrame
{
public:
WinEDA_BasePcbFrame* m_Parent;
private:
wxString m_FrameName; // name used for writing and reading setup
// It is "Frame3D"
Pcb3D_GLCanvas* m_Canvas;
WinEDA_Toolbar* m_HToolBar;
WinEDA_Toolbar* m_VToolBar;
int m_InternalUnits;
wxPoint m_FramePos;
wxSize m_FrameSize;
wxAuiManager m_auimgr;
~WinEDA3D_DrawFrame() { m_auimgr.UnInit(); };
private:
wxString m_FrameName; // name used for writing and reading setup
// It is "Frame3D"
bool m_reloadRequest;
public:
WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, const wxString& title,
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
~WinEDA3D_DrawFrame()
{
m_auimgr.UnInit();
};
void Exit3DFrame( wxCommandEvent& event );
void OnCloseWindow( wxCloseEvent& Event );
@ -211,6 +213,15 @@ public:
void SetToolbars();
void GetSettings();
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 OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );

View File

@ -218,9 +218,11 @@ public:
/** Function OnModify()
* 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
* 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( );

View File

@ -274,6 +274,14 @@ public:
void ReCreateMenuBar();
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
* tests whether a given element category is visible. Keep this as an
@ -1069,6 +1077,14 @@ public:
void GeneralControle( wxDC* DC, wxPoint Mouse );
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
* Install the print dialog
*/

View File

@ -423,6 +423,8 @@ void WinEDA_BasePcbFrame::SaveSettings()
* Must be called after a schematic change
* in order to set the "modify" flag of the current screen
* 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( )
{

View File

@ -802,4 +802,5 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
}
module->Set_Rectangle_Encadrement();
OnModify();
}

View File

@ -531,3 +531,16 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
SetToolbars();
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( );
}

View File

@ -678,3 +678,17 @@ void WinEDA_PcbFrame::SetLastNetListRead( const wxString& aLastNetListRead )
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( );
}