// InterfaceCAN.cpp : implementation file // #include "stdafx.h" #include "ROBOT.h" #include "InterfaceCAN.h" #include "ConfigurationCAN.h" #include "ROBOTDoc.h" #include "ReseauxCAN.h" #include "canpcex.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CInterfaceCAN IMPLEMENT_DYNCREATE(CInterfaceCAN, CFormView) //IMPLEMENT_DYNCREATE(CInterfaceCAN,CConfigurationCAN) CInterfaceCAN::CInterfaceCAN() : CFormView(CInterfaceCAN::IDD) { //{{AFX_DATA_INIT(CInterfaceCAN) m_AffichageCarte = _T(""); m_Reseaux=NULL; // m_Reseaux = new CReseauxCAN(); //}}AFX_DATA_INIT } /* CInterfaceCAN::CInterfaceCAN() : CConfigurationCAN() { } */ CInterfaceCAN::~CInterfaceCAN() { // delete m_Reseaux; } void CInterfaceCAN::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); //{{AFX_DATA_MAP(CInterfaceCAN) DDX_Text(pDX, IDC_AffichageCarte, m_AffichageCarte); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CInterfaceCAN, CFormView) //{{AFX_MSG_MAP(CInterfaceCAN) ON_BN_CLICKED(IDC_ButtonConfigCAN, OnButtonConfigCAN) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CInterfaceCAN diagnostics #ifdef _DEBUG void CInterfaceCAN::AssertValid() const { CFormView::AssertValid(); } void CInterfaceCAN::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } /* CROBOTDoc* CInterfaceCAN::GetDocument() const // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CROBOTDoc))); return (CROBOTDoc*)m_pDocument; } */ #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CInterfaceCAN message handlers void CInterfaceCAN::OnInitialUpdate() { CFormView::OnInitialUpdate(); TailleMDI(); CROBOTApp *TheApp=(CROBOTApp*)AfxGetApp(); CFrameWnd * pFrame =TheApp->pDocTemplate2->CreateNewFrame(GetDocument(),GetParentFrame()); TheApp->pDocTemplate->InitialUpdateFrame(pFrame,GetDocument(),0); POSITION pos=GetDocument()->GetFirstViewPosition(); CView *pView; do { pView=GetDocument()->GetNextView(pos); if(pView && pView->IsKindOf(RUNTIME_CLASS(CReseauxCAN))) m_Reseaux=static_cast(pView); } while(pView); } void CInterfaceCAN::TailleMDI() { CRect RectFrame; // Récupération de la taille de la mdi GetParentFrame()->GetWindowRect(&RectFrame); // changement de la hauteur sans bouger la fenêtre . GetParentFrame()->SetWindowPos(NULL,0,0,250,180, SWP_NOZORDER); //Affichage dans les EDITS SetDlgItemText(IDC_AffichageDebit,"Débit"); SetDlgItemText(IDC_AffichageInterface,"Interface CAN"); SetDlgItemText(IDC_AffichageCarte,"Affichage Canaux CAN"); } void CInterfaceCAN::OnButtonConfigCAN() { if(m_ClassDebit.DoModal()==IDOK) { //Récuperation valeur du débit sélectionné switch(m_ClassDebit.getValeurDebit()) { case 0: SetDlgItemText(IDC_AffichageDebit,"250 Kbit/s"); break; case 1: SetDlgItemText(IDC_AffichageDebit,"500 Kbit/s"); break; case 2: SetDlgItemText(IDC_AffichageDebit,"1000 Kbit/s"); break; default: SetDlgItemText(IDC_AffichageDebit,"Débit"); break; } //récuperation valeur du canal choisis m_AffichageCarte=m_ClassDebit.getValeurCarte(); m_Reseaux->test=m_ClassDebit.getSelectionCanal() ; // m_Reseaux->SetDlgItemInt(IDC_EDIT1,m_ClassDebit.getSelectionCanal()); // mise a jour des controles de la view. UpdateData(FALSE); } }