CDoc Class Reference

#include <srDoc.h>

List of all members.

Public Member Functions

SimulationGetSimulation ()
CString GetSelectedObject ()
const std::vector< ObjectDescription > & GetObjectDescriptionTree () const
ObjectType GetType (CString fullName) const
bool IsRestoringLayout ()
const char * GetLayoutFile ()
void NewSection (const CString &sSection)
void WriteString (const CString &sName, const CString &sValue)
void WriteInt (const CString &sName, int nValue)
void WriteDouble (const CString &sName, double value)
CString ReadString (const CString &sName)
int ReadInt (const CString &sName)
double ReadDouble (const CString &sName)
void OnSelected (SimObject *)
void OnConsoleCommand (const char *command)
void OnConsoleCompletion (char *command, bool forard)
virtual BOOL OnNewDocument ()
virtual void Serialize (CArchive &ar)
virtual void OnCloseDocument ()
virtual BOOL OnOpenDocument (LPCTSTR lpszPathName)
virtual BOOL CanCloseFrame (CFrameWnd *pFrame)
virtual ~CDoc ()

Public Attributes

CString m_sLayoutFile

Static Public Attributes

static CDoctheDocument = 0

Protected Member Functions

 CDoc ()
afx_msg void OnSimReset ()
afx_msg void OnUpdateSimReset (CCmdUI *pCmdUI)
afx_msg void OnSimStart ()
afx_msg void OnUpdateSimStart (CCmdUI *pCmdUI)
afx_msg void OnSimStep ()
afx_msg void OnUpdateSimStep (CCmdUI *pCmdUI)
afx_msg void OnViewTree ()
afx_msg void OnUpdateSteps (CCmdUI *pCmdUI)
afx_msg void OnKey0 ()
afx_msg void OnKey1 ()
afx_msg void OnKey2 ()
afx_msg void OnKey3 ()
afx_msg void OnKey4 ()
afx_msg void OnKey5 ()
afx_msg void OnKey6 ()
afx_msg void OnKey7 ()
afx_msg void OnKey8 ()
afx_msg void OnKey9 ()
afx_msg void OnKeyDec ()

Private Member Functions

void Compile ()
virtual void OnIdle ()
virtual void UpdateFrameCounts ()
bool InitLayoutFile ()
int GetNumberFromWindow (CWnd *pWnd)
CView * GetViewFromNumber (int n)
void WriteLayout ()
void RestoreLayout ()

Private Attributes

bool m_bRunning
bool m_bStep
Controllerm_pController
Simulationm_pSim
CString m_sStatusMessage
CString m_sSection
CMapStringToPtr m_map
std::vector< ObjectDescriptionm_objectDescriptionTree
ErrorDescription m_errorDescription


Detailed Description

Definition at line 21 of file srDoc.h.


Constructor & Destructor Documentation

CDoc::CDoc (  )  [protected]

Definition at line 93 of file srDoc.cpp.

CDoc::~CDoc (  )  [virtual]

Definition at line 105 of file srDoc.cpp.

References Controller::destroy(), m_pController, m_pSim, and theDocument.


Member Function Documentation

BOOL CDoc::CanCloseFrame ( CFrameWnd pFrame  )  [virtual]

Definition at line 606 of file srDoc.cpp.

void CDoc::Compile (  )  [private]

Definition at line 159 of file srDoc.cpp.

References Connection::createController(), Simulation::getFirstError(), Simulation::getObjectDescriptionTree(), Simulation::hasSceneGraphChanged(), IDS_NOCONTROLLER, IDS_SUCCESS, Simulation::loadFile(), m_errorDescription, m_objectDescriptionTree, m_pController, m_pSim, m_sStatusMessage, Connection::next, Simulation::resetSceneGraphChanged(), Connection::sceneName, and Connection::start.

Referenced by OnSimReset(), and RestoreLayout().

const char* CDoc::GetLayoutFile (  )  [inline]

Definition at line 51 of file srDoc.h.

References m_sLayoutFile.

int CDoc::GetNumberFromWindow ( CWnd *  pWnd  )  [private]

Definition at line 302 of file srDoc.cpp.

Referenced by WriteLayout().

const std::vector<ObjectDescription>& CDoc::GetObjectDescriptionTree (  )  const [inline]

Definition at line 47 of file srDoc.h.

References m_objectDescriptionTree.

Referenced by CTree::OnUpdate().

CString CDoc::GetSelectedObject (  ) 

Definition at line 209 of file srDoc.cpp.

References ASSERT.

Referenced by CSensor::OnInitialUpdate(), CObjectView::OnInitialUpdate(), and CActuator::OnInitialUpdate().

Simulation* CDoc::GetSimulation (  )  [inline]

Definition at line 45 of file srDoc.h.

References m_pSim.

Referenced by CObjectView::computeZoom(), Controller::Controller(), CSensor::DrawDirect(), CObjectView::OnLButtonDown(), CObjectView::OnLButtonUp(), CObjectView::OnMouseMove(), CObjectView::OnRButtonDown(), CObjectView::OnRButtonUp(), CSensor::OnUpdate(), CActuator::OnUpdate(), OnUpdateSteps(), CObjectFrame::OnUpdateViewTurn(), CTree::OnViewSelected(), CObjectFrame::OnViewTurn(), CSensor::SetClipboardText(), and CTree::WriteLayout().

ObjectType CDoc::GetType ( CString  fullName  )  const

Definition at line 223 of file srDoc.cpp.

References m_objectDescriptionTree, m_pSim, and OBJECT_TYPE_NONE.

Referenced by CObjectView::OnUpdate().

CView * CDoc::GetViewFromNumber ( int  n  )  [private]

Definition at line 314 of file srDoc.cpp.

Referenced by RestoreLayout().

bool CDoc::InitLayoutFile (  )  [private]

Definition at line 233 of file srDoc.cpp.

References m_map, and m_sLayoutFile.

Referenced by RestoreLayout(), and WriteLayout().

bool CDoc::IsRestoringLayout (  )  [inline]

Definition at line 50 of file srDoc.h.

References m_sLayoutFile.

Referenced by CTree::RestoreLayout(), CSensor::RestoreLayout(), CObjectView::RestoreLayout(), CFrame::RestoreLayout(), CEditor::RestoreLayout(), and CActuator::RestoreLayout().

void CDoc::NewSection ( const CString &  sSection  ) 

Definition at line 246 of file srDoc.cpp.

References m_map, and m_sSection.

Referenced by CTree::RestoreLayout(), CSensor::RestoreLayout(), CObjectFrame::RestoreLayout(), CObjectView::RestoreLayout(), CFrame::RestoreLayout(), CEditor::RestoreLayout(), RestoreLayout(), CActuator::RestoreLayout(), CTree::WriteLayout(), CSensor::WriteLayout(), CObjectFrame::WriteLayout(), CObjectView::WriteLayout(), CFrame::WriteLayout(), CEditor::WriteLayout(), WriteLayout(), and CActuator::WriteLayout().

void CDoc::OnCloseDocument (  )  [virtual]

Definition at line 129 of file srDoc.cpp.

References WriteLayout().

void CDoc::OnConsoleCommand ( const char *  command  ) 

Definition at line 448 of file srDoc.cpp.

References m_pController, and Controller::onConsoleCommand().

Referenced by CConsoleEdit::OnChar().

void CDoc::OnConsoleCompletion ( char *  command,
bool  forard 
)

Definition at line 454 of file srDoc.cpp.

References m_pController, and Controller::onConsoleCompletion().

Referenced by CConsoleEdit::OnChar().

void CDoc::OnIdle (  )  [private, virtual]

Definition at line 536 of file srDoc.cpp.

References Simulation::doSimulationStep(), Controller::execute(), Simulation::getObjectDescriptionTree(), Simulation::hasSceneGraphChanged(), m_bRunning, m_bStep, m_objectDescriptionTree, m_pController, m_pSim, m_sStatusMessage, UPDATE_ACTORS, and UPDATE_SENSORS.

void CDoc::OnKey0 (  )  [protected]

Definition at line 615 of file srDoc.cpp.

References m_pController, and Controller::onKeyPressed().

void CDoc::OnKey1 (  )  [protected]

Definition at line 621 of file srDoc.cpp.

References m_pController, and Controller::onKeyPressed().

void CDoc::OnKey2 (  )  [protected]

Definition at line 627 of file srDoc.cpp.

References m_pController, and Controller::onKeyPressed().

void CDoc::OnKey3 (  )  [protected]

Definition at line 633 of file srDoc.cpp.

References m_pController, and Controller::onKeyPressed().

void CDoc::OnKey4 (  )  [protected]

Definition at line 639 of file srDoc.cpp.

References m_pController, and Controller::onKeyPressed().

void CDoc::OnKey5 (  )  [protected]

Definition at line 645 of file srDoc.cpp.

References m_pController, and Controller::onKeyPressed().

void CDoc::OnKey6 (  )  [protected]

Definition at line 651 of file srDoc.cpp.

References m_pController, and Controller::onKeyPressed().

void CDoc::OnKey7 (  )  [protected]

Definition at line 657 of file srDoc.cpp.

References m_pController, and Controller::onKeyPressed().

void CDoc::OnKey8 (  )  [protected]

Definition at line 663 of file srDoc.cpp.

References m_pController, and Controller::onKeyPressed().

void CDoc::OnKey9 (  )  [protected]

Definition at line 669 of file srDoc.cpp.

References m_pController, and Controller::onKeyPressed().

void CDoc::OnKeyDec (  )  [protected]

Definition at line 675 of file srDoc.cpp.

References m_pController, and Controller::onKeyPressed().

BOOL CDoc::OnNewDocument (  )  [virtual]

Definition at line 122 of file srDoc.cpp.

BOOL CDoc::OnOpenDocument ( LPCTSTR  lpszPathName  )  [virtual]

Definition at line 597 of file srDoc.cpp.

References RestoreLayout().

void CDoc::OnSelected ( SimObject  ) 

Definition at line 442 of file srDoc.cpp.

References m_pController, and Controller::onSelected().

Referenced by CObjectView::OnLButtonDblClk().

void CDoc::OnSimReset (  )  [protected]

Definition at line 467 of file srDoc.cpp.

References ErrorDescription::column, Compile(), Controller::destroy(), ID_VIEW_TREE, ErrorDescription::line, m_bRunning, m_errorDescription, m_pController, m_pSim, UPDATE_ERROR, and UPDATE_SUCCESS.

Referenced by OnSimStart(), and OnSimStep().

void CDoc::OnSimStart (  )  [protected]

Definition at line 502 of file srDoc.cpp.

References m_bRunning, m_pSim, and OnSimReset().

void CDoc::OnSimStep (  )  [protected]

Definition at line 521 of file srDoc.cpp.

References m_bRunning, m_bStep, m_pSim, and OnSimReset().

void CDoc::OnUpdateSimReset ( CCmdUI *  pCmdUI  )  [protected]

Definition at line 497 of file srDoc.cpp.

void CDoc::OnUpdateSimStart ( CCmdUI *  pCmdUI  )  [protected]

Definition at line 515 of file srDoc.cpp.

References m_bRunning.

void CDoc::OnUpdateSimStep ( CCmdUI *  pCmdUI  )  [protected]

Definition at line 531 of file srDoc.cpp.

References m_bRunning.

void CDoc::OnUpdateSteps ( CCmdUI *  pCmdUI  )  [protected]

Definition at line 581 of file srDoc.cpp.

References GetSimulation().

void CDoc::OnViewTree (  )  [protected]

Definition at line 562 of file srDoc.cpp.

double CDoc::ReadDouble ( const CString &  sName  ) 

Definition at line 293 of file srDoc.cpp.

References ReadString().

Referenced by CObjectView::RestoreLayout().

int CDoc::ReadInt ( const CString &  sName  ) 

Definition at line 284 of file srDoc.cpp.

References ReadString().

Referenced by CTree::RestoreLayout(), CSensor::RestoreLayout(), CObjectFrame::RestoreLayout(), CObjectView::RestoreLayout(), CFrame::RestoreLayout(), CEditor::RestoreLayout(), RestoreLayout(), and CActuator::RestoreLayout().

CString CDoc::ReadString ( const CString &  sName  ) 

Definition at line 278 of file srDoc.cpp.

References m_sSection.

Referenced by ReadDouble(), ReadInt(), CTree::RestoreLayout(), CSensor::RestoreLayout(), CObjectView::RestoreLayout(), RestoreLayout(), and CActuator::RestoreLayout().

void CDoc::RestoreLayout (  )  [private]

Definition at line 386 of file srDoc.cpp.

References Compile(), CApp::CreateActuator(), CApp::CreateObject(), CApp::CreateSensor(), CApp::CreateTree(), GetViewFromNumber(), InitLayoutFile(), m_bRunning, m_pSim, m_sLayoutFile, NewSection(), ReadInt(), ReadString(), and CApp::SetOrder().

Referenced by OnOpenDocument().

void CDoc::Serialize ( CArchive &  ar  )  [virtual]

Definition at line 138 of file srDoc.cpp.

void CDoc::UpdateFrameCounts (  )  [private, virtual]

Definition at line 558 of file srDoc.cpp.

void CDoc::WriteDouble ( const CString &  sName,
double  value 
)

Definition at line 271 of file srDoc.cpp.

References WriteString().

Referenced by CObjectView::WriteLayout().

void CDoc::WriteInt ( const CString &  sName,
int  nValue 
)

Definition at line 264 of file srDoc.cpp.

References WriteString().

Referenced by CTree::WriteLayout(), CSensor::WriteLayout(), CObjectFrame::WriteLayout(), CObjectView::WriteLayout(), CFrame::WriteLayout(), CEditor::WriteLayout(), WriteLayout(), and CActuator::WriteLayout().

void CDoc::WriteLayout (  )  [private]

Definition at line 323 of file srDoc.cpp.

References GetNumberFromWindow(), InitLayoutFile(), m_bRunning, m_pSim, m_sLayoutFile, NewSection(), WriteInt(), CFrame::WriteLayout(), and WriteString().

Referenced by OnCloseDocument().

void CDoc::WriteString ( const CString &  sName,
const CString &  sValue 
)

Definition at line 259 of file srDoc.cpp.

References m_sSection.

Referenced by WriteDouble(), WriteInt(), CTree::WriteLayout(), CSensor::WriteLayout(), CObjectView::WriteLayout(), WriteLayout(), and CActuator::WriteLayout().


Member Data Documentation

bool CDoc::m_bRunning [private]

Definition at line 24 of file srDoc.h.

Referenced by OnIdle(), OnSimReset(), OnSimStart(), OnSimStep(), OnUpdateSimStart(), OnUpdateSimStep(), RestoreLayout(), and WriteLayout().

bool CDoc::m_bStep [private]

Definition at line 24 of file srDoc.h.

Referenced by OnIdle(), and OnSimStep().

ErrorDescription CDoc::m_errorDescription [private]

Definition at line 32 of file srDoc.h.

Referenced by Compile(), and OnSimReset().

CMapStringToPtr CDoc::m_map [private]

Definition at line 30 of file srDoc.h.

Referenced by InitLayoutFile(), and NewSection().

std::vector<ObjectDescription> CDoc::m_objectDescriptionTree [private]

Definition at line 31 of file srDoc.h.

Referenced by Compile(), GetObjectDescriptionTree(), GetType(), and OnIdle().

Controller* CDoc::m_pController [private]

Definition at line 26 of file srDoc.h.

Referenced by Compile(), OnConsoleCommand(), OnConsoleCompletion(), OnIdle(), OnKey0(), OnKey1(), OnKey2(), OnKey3(), OnKey4(), OnKey5(), OnKey6(), OnKey7(), OnKey8(), OnKey9(), OnKeyDec(), OnSelected(), OnSimReset(), and ~CDoc().

Simulation* CDoc::m_pSim [private]

Definition at line 27 of file srDoc.h.

Referenced by Compile(), GetSimulation(), GetType(), OnIdle(), OnSimReset(), OnSimStart(), OnSimStep(), RestoreLayout(), WriteLayout(), and ~CDoc().

CString CDoc::m_sLayoutFile

Definition at line 44 of file srDoc.h.

Referenced by GetLayoutFile(), InitLayoutFile(), IsRestoringLayout(), RestoreLayout(), and WriteLayout().

CString CDoc::m_sSection [private]

Definition at line 29 of file srDoc.h.

Referenced by NewSection(), ReadString(), and WriteString().

CString CDoc::m_sStatusMessage [private]

Definition at line 28 of file srDoc.h.

Referenced by Compile(), and OnIdle().

CDoc * CDoc::theDocument = 0 [static]

Definition at line 43 of file srDoc.h.

Referenced by CConsoleEdit::OnChar(), and ~CDoc().


The documentation for this class was generated from the following files:
Generated on Thu Dec 7 01:20:05 2006 for DT2005.panorama by  doxygen 1.4.7