diff --git a/TestEGr.rc b/TestEGr.rc index 4fa46c8..c2a7308 100644 Binary files a/TestEGr.rc and b/TestEGr.rc differ diff --git a/TestEGrDlg.cpp b/TestEGrDlg.cpp index 6621699..9728e57 100644 --- a/TestEGrDlg.cpp +++ b/TestEGrDlg.cpp @@ -144,6 +144,7 @@ BEGIN_MESSAGE_MAP( CTestEGrDlg, CDialog) ON_BN_CLICKED( IDC_IMPORT, OnFileImport) ON_BN_CLICKED( IDC_EXEC, OnFileExec) ON_CONTROL_RANGE( BN_CLICKED, IDC_WIREFRAME, IDC_SHADING, OnShowMode) + ON_BN_CLICKED( IDC_SHOWCURVEDIR, OnShowCurveDir) ON_CONTROL_RANGE( BN_CLICKED, IDC_ZOOM_ALL, IDC_ZOOM_OUT, OnZoom) ON_CONTROL_RANGE( BN_CLICKED, IDC_VIEW_TOP, IDC_VIEW_ISO, OnView) ON_BN_CLICKED( IDC_CLOSE, OnClose) @@ -232,6 +233,13 @@ CTestEGrDlg::OnInitDialog( void) UpdateShowModeButtons() ; } + // recupero lo stato di visualizzazione direzione curve + if ( m_View.GetScene() != nullptr) { + bool bCrvDir = ( GetPrivateProfileInt( "Scene", "CurveDir", 0, AfxGetApp()->m_pszProfileName) != 0) ; + m_View.GetScene()->SetShowCurveDirection( bCrvDir) ; + UpdateShowCurveDir() ; + } + // recupero gli angoli di vista e li imposto if ( m_View.GetScene() != nullptr) { double dAngVdeg = 0, dAngOdeg = 0 ; @@ -475,6 +483,7 @@ CTestEGrDlg::OnSize( UINT nType, int cx, int cy) MoveDlgItem( IDC_WIREFRAME, IP_TR, cx, cy) ; MoveDlgItem( IDC_HIDDENLINE, IP_TR, cx, cy) ; MoveDlgItem( IDC_SHADING, IP_TR, cx, cy) ; + MoveDlgItem( IDC_SHOWCURVEDIR, IP_TR, cx, cy) ; MoveDlgItem( IDC_ZOOM_ALL, IP_TR, cx, cy) ; MoveDlgItem( IDC_ZOOM_IN, IP_TR, cx, cy) ; MoveDlgItem( IDC_ZOOM_OUT, IP_TR, cx, cy) ; @@ -625,6 +634,10 @@ CTestEGrDlg::OnClose( void) int nShMode = m_View.GetScene()->GetShowMode() ; WritePrivateProfileInt( "Scene", "ShowMode", nShMode, AfxGetApp()->m_pszProfileName) ; + // salvo stato visualizzazione direzione curve + bool bCrvDir = m_View.GetScene()->GetShowCurveDirection() ; + WritePrivateProfileInt( "Scene", "CurveDir", bCrvDir, AfxGetApp()->m_pszProfileName) ; + // salvo gli angoli di vista double dAngVdeg, dAngOdeg ; m_View.GetScene()->GetCamera( &dAngVdeg, &dAngOdeg) ; @@ -850,6 +863,22 @@ CTestEGrDlg::UpdateShowModeButtons( void) (( CButton*) GetDlgItem( IDC_SHADING))->SetCheck( ( nSM == SM_SHADING ? BST_CHECKED : BST_UNCHECKED)) ; } +//---------------------------------------------------------------------------- +void +CTestEGrDlg::OnShowCurveDir( void) +{ + bool bShow = ( (( CButton*) GetDlgItem( IDC_SHOWCURVEDIR))->GetCheck() == BST_CHECKED) ; + m_View.ShowCurveDir( bShow) ; +} + +//---------------------------------------------------------------------------- +void +CTestEGrDlg::UpdateShowCurveDir( void) +{ + bool bShow = m_View.GetScene()->GetShowCurveDirection() ; + (( CButton*) GetDlgItem( IDC_SHOWCURVEDIR))->SetCheck( ( bShow ? BST_CHECKED : BST_UNCHECKED)) ; +} + //---------------------------------------------------------------------------- void CTestEGrDlg::OnZoom( UINT nID) diff --git a/TestEGrDlg.h b/TestEGrDlg.h index 1a2c52a..eb7e58e 100644 --- a/TestEGrDlg.h +++ b/TestEGrDlg.h @@ -37,6 +37,7 @@ class CTestEGrDlg : public CDialog { return m_View.GetSceneInfo( sInfo) ; } bool LineExec( const std::string& sLine) ; void UpdateShowModeButtons( void) ; + void UpdateShowCurveDir( void) ; void UpdateViewButtons( void) ; protected : @@ -52,6 +53,7 @@ class CTestEGrDlg : public CDialog afx_msg void OnFileImport( void) ; afx_msg void OnFileExec( void) ; afx_msg void OnShowMode( UINT nID) ; + afx_msg void OnShowCurveDir( void) ; afx_msg void OnZoom( UINT nID) ; afx_msg void OnView( UINT nID) ; afx_msg void OnCommand( void) ; diff --git a/TestEGrUtils.cpp b/TestEGrUtils.cpp index 9d9bd60..c354d26 100644 --- a/TestEGrUtils.cpp +++ b/TestEGrUtils.cpp @@ -50,5 +50,6 @@ void UpdateButtons( void) { ((CTestEGrDlg*)AfxGetMainWnd())->UpdateShowModeButtons() ; + ((CTestEGrDlg*)AfxGetMainWnd())->UpdateShowCurveDir() ; ((CTestEGrDlg*)AfxGetMainWnd())->UpdateViewButtons() ; } diff --git a/TestEGrView.cpp b/TestEGrView.cpp index 0578347..a469829 100644 --- a/TestEGrView.cpp +++ b/TestEGrView.cpp @@ -181,6 +181,9 @@ TestEGrView::Redraw( void) void TestEGrView::ShowMode( UINT nID) { + if ( m_pScene == nullptr) + return ; + switch ( nID) { case IDC_WIREFRAME : m_pScene->SetShowMode( SM_WIREFRAME) ; @@ -199,6 +202,17 @@ TestEGrView::ShowMode( UINT nID) RedrawWindow() ; } +//---------------------------------------------------------------------------- +void +TestEGrView::ShowCurveDir( bool bShow) +{ + if ( m_pScene == nullptr) + return ; + m_pScene->SetShowCurveDirection( bShow) ; + + RedrawWindow() ; +} + //---------------------------------------------------------------------------- void TestEGrView::Zoom( UINT nID) diff --git a/TestEGrView.h b/TestEGrView.h index 9058a81..6ae3c45 100644 --- a/TestEGrView.h +++ b/TestEGrView.h @@ -25,6 +25,7 @@ class TestEGrView : public CWnd bool Reshape( int nX, int nY, int nW, int nH) ; void Redraw( void) ; void ShowMode( UINT nID) ; + void ShowCurveDir( bool bShow) ; void Zoom( UINT nID) ; void View( UINT nID) ; diff --git a/resource.h b/resource.h index 99a40cd..cc020d4 100644 Binary files a/resource.h and b/resource.h differ