Loading 3d-viewer/3d_frame.cpp +217 −200 Original line number Original line Diff line number Diff line ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Name: 3d_frame.cpp // Name: 3d_frame.cpp ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// Loading Loading @@ -38,7 +39,8 @@ END_EVENT_TABLE() /*******************************************************************/ /*******************************************************************/ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, WinEDA_App *app_parent, const wxString& title, long style ): WinEDA_App* app_parent, const wxString& title, long style ) : wxFrame( parent, DISPLAY3D_FRAME, title, wxFrame( parent, DISPLAY3D_FRAME, title, wxPoint( -1, -1 ), wxSize( -1, -1 ), style ) wxPoint( -1, -1 ), wxSize( -1, -1 ), style ) /*******************************************************************/ /*******************************************************************/ Loading @@ -56,24 +58,26 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame(WinEDA_BasePcbFrame * parent, GetSettings(); GetSettings(); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); // Create the status line // Create the status line int dims[5] = { -1, 100, 100, 100, 140 }; int dims[5] = { -1, 100, 100, 100, 140 }; CreateStatusBar( 5 ); CreateStatusBar( 5 ); SetStatusWidths( 5, dims ); SetStatusWidths( 5, dims ); ReCreateMenuBar(); ReCreateMenuBar(); ReCreateHToolbar(); ReCreateHToolbar(); // ReCreateAuxiliaryToolbar(); // ReCreateAuxiliaryToolbar(); ReCreateVToolbar(); ReCreateVToolbar(); // Make a Pcb3D_GLCanvas // Make a Pcb3D_GLCanvas m_Canvas = new Pcb3D_GLCanvas( this, -1, gl_attrib ); m_Canvas = new Pcb3D_GLCanvas( this, -1, gl_attrib ); /* init OpenGL once */ /* init OpenGL once */ m_Canvas->InitGL(); m_Canvas->InitGL(); } } /***********************************************************/ /***********************************************************/ void WinEDA3D_DrawFrame::Exit3DFrame( wxCommandEvent& event ) void WinEDA3D_DrawFrame::Exit3DFrame( wxCommandEvent& event ) /***********************************************************/ /***********************************************************/ Loading @@ -81,6 +85,7 @@ void WinEDA3D_DrawFrame::Exit3DFrame(wxCommandEvent& event) Close( TRUE ); Close( TRUE ); } } /***********************************************************/ /***********************************************************/ void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event ) /***********************************************************/ /***********************************************************/ Loading Loading @@ -116,11 +121,14 @@ wxConfig * Config = m_ParentAppl->m_EDA_Config; // Current config used by appl Config->Read( wxT( "BgColor_Blue" ), &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 ); Config->Read( wxT( "BgColor_Blue" ), &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 ); } } #ifdef __WXMAC__ #ifdef __WXMAC__ // for macOSX, the window must be below system (macOSX) toolbar // for macOSX, the window must be below system (macOSX) toolbar if ( m_FramePos.y < GetMBarHeight() ) m_FramePos.y = GetMBarHeight(); if( m_FramePos.y < GetMBarHeight() ) m_FramePos.y = GetMBarHeight(); #endif #endif } } /*******************************************/ /*******************************************/ void WinEDA3D_DrawFrame::SaveSettings() void WinEDA3D_DrawFrame::SaveSettings() /*******************************************/ /*******************************************/ Loading @@ -128,13 +136,15 @@ void WinEDA3D_DrawFrame::SaveSettings() wxString text; wxString text; wxConfig* Config = m_ParentAppl->m_EDA_Config; // Current config used by application wxConfig* Config = m_ParentAppl->m_EDA_Config; // Current config used by application if( ! Config ) return; if( !Config ) return; Config->Write( wxT( "BgColor_Red" ), g_Parm_3D_Visu.m_BgColor.m_Red ); Config->Write( wxT( "BgColor_Red" ), g_Parm_3D_Visu.m_BgColor.m_Red ); Config->Write( wxT( "BgColor_Green" ), g_Parm_3D_Visu.m_BgColor.m_Green ); Config->Write( wxT( "BgColor_Green" ), g_Parm_3D_Visu.m_BgColor.m_Green ); Config->Write( wxT( "BgColor_Blue" ), g_Parm_3D_Visu.m_BgColor.m_Blue ); Config->Write( wxT( "BgColor_Blue" ), g_Parm_3D_Visu.m_BgColor.m_Blue ); if( IsIconized() ) return; if( IsIconized() ) return; m_FrameSize = GetSize(); m_FrameSize = GetSize(); m_FramePos = GetPosition(); m_FramePos = GetPosition(); Loading @@ -155,10 +165,13 @@ void WinEDA3D_DrawFrame::Process_Zoom(wxCommandEvent& event) /***********************************************************/ /***********************************************************/ { { int ii; int ii; switch( event.GetId() ) switch( event.GetId() ) { { case ID_ZOOM_PAGE_BUTT: case ID_ZOOM_PAGE_BUTT: for ( ii = 0; ii < 4; ii++ ) g_Parm_3D_Visu.m_Rot[ii] = 0.0; for( ii = 0; ii < 4; ii++ ) g_Parm_3D_Visu.m_Rot[ii] = 0.0; g_Parm_3D_Visu.m_Zoom = 1.0; g_Parm_3D_Visu.m_Zoom = 1.0; g_Draw3d_dx = g_Draw3d_dy = 0; g_Draw3d_dx = g_Draw3d_dy = 0; trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 ); trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 ); Loading @@ -180,12 +193,12 @@ int ii; default: default: return; return; } } m_Canvas->DisplayStatus(); m_Canvas->DisplayStatus(); m_Canvas->Refresh( FALSE ); m_Canvas->Refresh( FALSE ); } } /************************************************************************/ /************************************************************************/ void WinEDA3D_DrawFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA3D_DrawFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) /************************************************************************/ /************************************************************************/ Loading @@ -199,9 +212,11 @@ void WinEDA3D_DrawFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu) { { } } /************************************/ /************************************/ int WinEDA3D_DrawFrame::BestZoom() int WinEDA3D_DrawFrame::BestZoom() /************************************/ /************************************/ // Retourne le meilleur zoom // Retourne le meilleur zoom { { return 1; return 1; Loading Loading @@ -282,6 +297,7 @@ void WinEDA3D_DrawFrame::Process_Special_Functions(wxCommandEvent& event) wxT( "WinEDA3D_DrawFrame::Process_Special_Functions() error: unknown command" ) ); wxT( "WinEDA3D_DrawFrame::Process_Special_Functions() error: unknown command" ) ); return; return; } } m_Canvas->DisplayStatus(); m_Canvas->DisplayStatus(); m_Canvas->Refresh( FALSE ); m_Canvas->Refresh( FALSE ); } } Loading @@ -301,6 +317,7 @@ void WinEDA3D_DrawFrame::NewDisplay() /******************************************/ /******************************************/ void WinEDA3D_DrawFrame::Set3DBgColor() void WinEDA3D_DrawFrame::Set3DBgColor() /******************************************/ /******************************************/ /* called to set the background color of the 3D scene /* called to set the background color of the 3D scene */ */ { { Loading Loading
3d-viewer/3d_frame.cpp +217 −200 Original line number Original line Diff line number Diff line ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // Name: 3d_frame.cpp // Name: 3d_frame.cpp ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// Loading Loading @@ -38,7 +39,8 @@ END_EVENT_TABLE() /*******************************************************************/ /*******************************************************************/ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, WinEDA_App *app_parent, const wxString& title, long style ): WinEDA_App* app_parent, const wxString& title, long style ) : wxFrame( parent, DISPLAY3D_FRAME, title, wxFrame( parent, DISPLAY3D_FRAME, title, wxPoint( -1, -1 ), wxSize( -1, -1 ), style ) wxPoint( -1, -1 ), wxSize( -1, -1 ), style ) /*******************************************************************/ /*******************************************************************/ Loading @@ -56,24 +58,26 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame(WinEDA_BasePcbFrame * parent, GetSettings(); GetSettings(); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); // Create the status line // Create the status line int dims[5] = { -1, 100, 100, 100, 140 }; int dims[5] = { -1, 100, 100, 100, 140 }; CreateStatusBar( 5 ); CreateStatusBar( 5 ); SetStatusWidths( 5, dims ); SetStatusWidths( 5, dims ); ReCreateMenuBar(); ReCreateMenuBar(); ReCreateHToolbar(); ReCreateHToolbar(); // ReCreateAuxiliaryToolbar(); // ReCreateAuxiliaryToolbar(); ReCreateVToolbar(); ReCreateVToolbar(); // Make a Pcb3D_GLCanvas // Make a Pcb3D_GLCanvas m_Canvas = new Pcb3D_GLCanvas( this, -1, gl_attrib ); m_Canvas = new Pcb3D_GLCanvas( this, -1, gl_attrib ); /* init OpenGL once */ /* init OpenGL once */ m_Canvas->InitGL(); m_Canvas->InitGL(); } } /***********************************************************/ /***********************************************************/ void WinEDA3D_DrawFrame::Exit3DFrame( wxCommandEvent& event ) void WinEDA3D_DrawFrame::Exit3DFrame( wxCommandEvent& event ) /***********************************************************/ /***********************************************************/ Loading @@ -81,6 +85,7 @@ void WinEDA3D_DrawFrame::Exit3DFrame(wxCommandEvent& event) Close( TRUE ); Close( TRUE ); } } /***********************************************************/ /***********************************************************/ void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event ) /***********************************************************/ /***********************************************************/ Loading Loading @@ -116,11 +121,14 @@ wxConfig * Config = m_ParentAppl->m_EDA_Config; // Current config used by appl Config->Read( wxT( "BgColor_Blue" ), &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 ); Config->Read( wxT( "BgColor_Blue" ), &g_Parm_3D_Visu.m_BgColor.m_Blue, 0.0 ); } } #ifdef __WXMAC__ #ifdef __WXMAC__ // for macOSX, the window must be below system (macOSX) toolbar // for macOSX, the window must be below system (macOSX) toolbar if ( m_FramePos.y < GetMBarHeight() ) m_FramePos.y = GetMBarHeight(); if( m_FramePos.y < GetMBarHeight() ) m_FramePos.y = GetMBarHeight(); #endif #endif } } /*******************************************/ /*******************************************/ void WinEDA3D_DrawFrame::SaveSettings() void WinEDA3D_DrawFrame::SaveSettings() /*******************************************/ /*******************************************/ Loading @@ -128,13 +136,15 @@ void WinEDA3D_DrawFrame::SaveSettings() wxString text; wxString text; wxConfig* Config = m_ParentAppl->m_EDA_Config; // Current config used by application wxConfig* Config = m_ParentAppl->m_EDA_Config; // Current config used by application if( ! Config ) return; if( !Config ) return; Config->Write( wxT( "BgColor_Red" ), g_Parm_3D_Visu.m_BgColor.m_Red ); Config->Write( wxT( "BgColor_Red" ), g_Parm_3D_Visu.m_BgColor.m_Red ); Config->Write( wxT( "BgColor_Green" ), g_Parm_3D_Visu.m_BgColor.m_Green ); Config->Write( wxT( "BgColor_Green" ), g_Parm_3D_Visu.m_BgColor.m_Green ); Config->Write( wxT( "BgColor_Blue" ), g_Parm_3D_Visu.m_BgColor.m_Blue ); Config->Write( wxT( "BgColor_Blue" ), g_Parm_3D_Visu.m_BgColor.m_Blue ); if( IsIconized() ) return; if( IsIconized() ) return; m_FrameSize = GetSize(); m_FrameSize = GetSize(); m_FramePos = GetPosition(); m_FramePos = GetPosition(); Loading @@ -155,10 +165,13 @@ void WinEDA3D_DrawFrame::Process_Zoom(wxCommandEvent& event) /***********************************************************/ /***********************************************************/ { { int ii; int ii; switch( event.GetId() ) switch( event.GetId() ) { { case ID_ZOOM_PAGE_BUTT: case ID_ZOOM_PAGE_BUTT: for ( ii = 0; ii < 4; ii++ ) g_Parm_3D_Visu.m_Rot[ii] = 0.0; for( ii = 0; ii < 4; ii++ ) g_Parm_3D_Visu.m_Rot[ii] = 0.0; g_Parm_3D_Visu.m_Zoom = 1.0; g_Parm_3D_Visu.m_Zoom = 1.0; g_Draw3d_dx = g_Draw3d_dy = 0; g_Draw3d_dx = g_Draw3d_dy = 0; trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 ); trackball( g_Parm_3D_Visu.m_Quat, 0.0, 0.0, 0.0, 0.0 ); Loading @@ -180,12 +193,12 @@ int ii; default: default: return; return; } } m_Canvas->DisplayStatus(); m_Canvas->DisplayStatus(); m_Canvas->Refresh( FALSE ); m_Canvas->Refresh( FALSE ); } } /************************************************************************/ /************************************************************************/ void WinEDA3D_DrawFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA3D_DrawFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) /************************************************************************/ /************************************************************************/ Loading @@ -199,9 +212,11 @@ void WinEDA3D_DrawFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu) { { } } /************************************/ /************************************/ int WinEDA3D_DrawFrame::BestZoom() int WinEDA3D_DrawFrame::BestZoom() /************************************/ /************************************/ // Retourne le meilleur zoom // Retourne le meilleur zoom { { return 1; return 1; Loading Loading @@ -282,6 +297,7 @@ void WinEDA3D_DrawFrame::Process_Special_Functions(wxCommandEvent& event) wxT( "WinEDA3D_DrawFrame::Process_Special_Functions() error: unknown command" ) ); wxT( "WinEDA3D_DrawFrame::Process_Special_Functions() error: unknown command" ) ); return; return; } } m_Canvas->DisplayStatus(); m_Canvas->DisplayStatus(); m_Canvas->Refresh( FALSE ); m_Canvas->Refresh( FALSE ); } } Loading @@ -301,6 +317,7 @@ void WinEDA3D_DrawFrame::NewDisplay() /******************************************/ /******************************************/ void WinEDA3D_DrawFrame::Set3DBgColor() void WinEDA3D_DrawFrame::Set3DBgColor() /******************************************/ /******************************************/ /* called to set the background color of the 3D scene /* called to set the background color of the 3D scene */ */ { { Loading