diff -ru kicad-2010.04.06/3d-viewer/3d_frame.cpp kicad-2010.04.06-new/3d-viewer/3d_frame.cpp
--- kicad-2010.04.06/3d-viewer/3d_frame.cpp 2010-02-08 19:15:42.000000000 +0100
+++ kicad-2010.04.06-new/3d-viewer/3d_frame.cpp 2010-05-03 19:52:09.000000000 +0200
@@ -33,6 +33,7 @@
BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
+ EVT_ACTIVATE( WinEDA3D_DrawFrame::OnActivate )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA3D_DrawFrame::Process_Zoom )
EVT_TOOL_RANGE( ID_START_COMMAND_3D, ID_END_COMMAND_3D,
WinEDA3D_DrawFrame::Process_Special_Functions )
@@ -56,6 +57,7 @@
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 ) );
@@ -342,6 +344,8 @@
void WinEDA3D_DrawFrame::NewDisplay()
{
+ m_reloadRequest = false;
+
m_Canvas->ClearLists();
m_Canvas->CreateDrawGL_List();
@@ -351,6 +355,17 @@
}
+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_reloadRequest )
+ NewDisplay();
+
+ event.Skip(); // required under wxMAC
+}
+
+
/* called to set the background color of the 3D scene
*/
void WinEDA3D_DrawFrame::Set3DBgColor()
diff -ru kicad-2010.04.06/3d-viewer/3d_viewer.h kicad-2010.04.06-new/3d-viewer/3d_viewer.h
--- kicad-2010.04.06/3d-viewer/3d_viewer.h 2010-02-08 19:15:42.000000000 +0100
+++ kicad-2010.04.06-new/3d-viewer/3d_viewer.h 2010-05-03 20:35:42.000000000 +0200
@@ -123,7 +123,7 @@
double m_BoardScale; /* Normalization scale for coordinates:
* when scaled between -1.0 and +1.0 */
double m_LayerZcoord[32];
- double m_ActZpos;
+ double m_ActZpos;
public: Info_3D_Visu();
~Info_3D_Visu();
};
@@ -185,23 +185,25 @@
{
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 @@
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 );
@@ -219,6 +230,7 @@
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void Process_Special_Functions( wxCommandEvent& event );
void Process_Zoom( wxCommandEvent& event );
+ void OnActivate( wxActivateEvent& event );
void NewDisplay();
void Set3DBgColor();
diff -ru kicad-2010.04.06/include/wxBasePcbFrame.h kicad-2010.04.06-new/include/wxBasePcbFrame.h
--- kicad-2010.04.06/include/wxBasePcbFrame.h 2010-05-03 01:41:33.000000000 +0200
+++ kicad-2010.04.06-new/include/wxBasePcbFrame.h 2010-05-03 19:56:25.000000000 +0200
@@ -218,9 +218,11 @@
/** 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( );
diff -ru kicad-2010.04.06/include/wxPcbStruct.h kicad-2010.04.06-new/include/wxPcbStruct.h
--- kicad-2010.04.06/include/wxPcbStruct.h 2010-05-03 01:41:33.000000000 +0200
+++ kicad-2010.04.06-new/include/wxPcbStruct.h 2010-05-03 19:58:20.000000000 +0200
@@ -274,6 +274,14 @@
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
@@ -1050,6 +1058,14 @@
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
*/
diff -ru kicad-2010.04.06/pcbnew/basepcbframe.cpp kicad-2010.04.06-new/pcbnew/basepcbframe.cpp
--- kicad-2010.04.06/pcbnew/basepcbframe.cpp 2010-02-19 14:23:58.000000000 +0100
+++ kicad-2010.04.06-new/pcbnew/basepcbframe.cpp 2010-05-03 19:59:12.000000000 +0200
@@ -423,6 +423,8 @@
* 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( )
{
diff -ru kicad-2010.04.06/pcbnew/dialog_general_options.cpp kicad-2010.04.06-new/pcbnew/dialog_general_options.cpp
--- kicad-2010.04.06/pcbnew/dialog_general_options.cpp 2010-05-03 01:41:33.000000000 +0200
+++ kicad-2010.04.06-new/pcbnew/dialog_general_options.cpp 2010-05-03 20:03:26.000000000 +0200
@@ -50,7 +50,7 @@
m_ShowModuleRatsnest->SetValue( g_Show_Module_Ratsnest );
m_ShowGlobalRatsnest->SetValue( m_Board->IsElementVisible(RATSNEST_VISIBLE) );
m_TrackAutodel->SetValue( g_AutoDeleteOldTrack );
- m_Track_45_Only_Ctrl->SetValue( Track_45_Only );
+ m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed );
m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only );
m_AutoPANOpt->SetValue( m_Parent->DrawPanel->m_AutoPAN_Enable );
m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only );
@@ -92,7 +92,7 @@
g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue();
g_AutoDeleteOldTrack = m_TrackAutodel->GetValue();
Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue();
- Track_45_Only = m_Track_45_Only_Ctrl->GetValue();
+ g_Track_45_Only_Allowed = m_Track_45_Only_Ctrl->GetValue();
m_Parent->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue();
g_TwoSegmentTrackBuild = m_Track_DoubleSegm_Ctrl->GetValue();
diff -ru kicad-2010.04.06/pcbnew/editrack.cpp kicad-2010.04.06-new/pcbnew/editrack.cpp
--- kicad-2010.04.06/pcbnew/editrack.cpp 2010-02-19 14:23:58.000000000 +0100
+++ kicad-2010.04.06-new/pcbnew/editrack.cpp 2010-05-03 20:04:18.000000000 +0200
@@ -736,7 +736,7 @@
}
}
- if( Track_45_Only )
+ if( g_Track_45_Only_Allowed )
{
if( g_TwoSegmentTrackBuild )
{
diff -ru kicad-2010.04.06/pcbnew/files.cpp kicad-2010.04.06-new/pcbnew/files.cpp
--- kicad-2010.04.06/pcbnew/files.cpp 2010-05-03 01:41:33.000000000 +0200
+++ kicad-2010.04.06-new/pcbnew/files.cpp 2010-05-03 20:05:10.000000000 +0200
@@ -12,6 +12,7 @@
#include "wxPcbStruct.h"
#include "protos.h"
#include "pcbnew_id.h"
+#include "3d_viewer.h"
#define BACKUP_FILE_EXT wxT( "000" )
@@ -274,6 +275,9 @@
/* reset the auto save timer */
g_SaveTime = time( NULL );
+ // Refresh the 3D view, if any
+ if( m_Draw3DFrame )
+ m_Draw3DFrame->NewDisplay();
#if 0 && defined(DEBUG)
// note this freezes up pcbnew when run under the kicad project
diff -ru kicad-2010.04.06/pcbnew/modedit.cpp kicad-2010.04.06-new/pcbnew/modedit.cpp
--- kicad-2010.04.06/pcbnew/modedit.cpp 2009-12-20 20:48:58.000000000 +0100
+++ kicad-2010.04.06-new/pcbnew/modedit.cpp 2010-05-03 20:05:52.000000000 +0200
@@ -802,4 +802,5 @@
}
module->Set_Rectangle_Encadrement();
+ OnModify();
}
diff -ru kicad-2010.04.06/pcbnew/moduleframe.cpp kicad-2010.04.06-new/pcbnew/moduleframe.cpp
--- kicad-2010.04.06/pcbnew/moduleframe.cpp 2010-05-03 01:41:33.000000000 +0200
+++ kicad-2010.04.06-new/pcbnew/moduleframe.cpp 2010-05-03 20:06:34.000000000 +0200
@@ -532,3 +532,16 @@
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( );
+}
diff -ru kicad-2010.04.06/pcbnew/pcbframe.cpp kicad-2010.04.06-new/pcbnew/pcbframe.cpp
--- kicad-2010.04.06/pcbnew/pcbframe.cpp 2010-05-03 01:41:33.000000000 +0200
+++ kicad-2010.04.06-new/pcbnew/pcbframe.cpp 2010-05-03 20:08:11.000000000 +0200
@@ -99,6 +99,7 @@
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION,
WinEDA_PcbFrame::ImportSpecctraSession )
+
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_DESIGN,
WinEDA_PcbFrame::ImportSpecctraDesign )
@@ -677,3 +678,16 @@
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( );
+}
diff -ru kicad-2010.04.06/pcbnew/pcbnew.cpp kicad-2010.04.06-new/pcbnew/pcbnew.cpp
--- kicad-2010.04.06/pcbnew/pcbnew.cpp 2010-05-03 01:41:33.000000000 +0200
+++ kicad-2010.04.06-new/pcbnew/pcbnew.cpp 2010-05-03 20:08:52.000000000 +0200
@@ -43,8 +43,8 @@
bool g_Show_Module_Ratsnest;
bool g_Show_Pads_Module_in_Move = true;
bool g_Raccord_45_Auto = true;
-bool Track_45_Only;
-bool Segments_45_Only;
+bool g_Track_45_Only_Allowed = true; // True to allow horiz, vert. and 45deg only tracks
+bool Segments_45_Only; // True to allow horiz, vert. and 45deg only graphic segments
bool g_TwoSegmentTrackBuild = true;
bool g_HighLight_Status;
diff -ru kicad-2010.04.06/pcbnew/pcbnew.h kicad-2010.04.06-new/pcbnew/pcbnew.h
--- kicad-2010.04.06/pcbnew/pcbnew.h 2010-02-24 16:33:03.000000000 +0100
+++ kicad-2010.04.06-new/pcbnew/pcbnew.h 2010-05-03 21:03:50.000000000 +0200
@@ -60,7 +60,7 @@
extern const wxString g_FootprintLibFileWildcard; // Wildcard for footprint libraries filesnames
-extern bool Track_45_Only;
+extern bool g_Track_45_Only_Allowed;
extern bool Segments_45_Only;
extern wxString g_Shapes3DExtBuffer;
extern wxString g_DocModulesFileName;