|
From: Emilien K. <cur...@us...> - 2005-04-15 15:41:54
|
Update of /cvsroot/wxdevcenter/wxDevCenter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1846/src Modified Files: Document.cpp Project.cpp Log Message: Néttoyage. Redirection des évènements passant et non traités par le document au projet si existant. Fonctions d'attache/déttache du document à un projet. Index: Project.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Project.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Project.cpp 16 Mar 2005 14:27:37 -0000 1.4 --- Project.cpp 15 Apr 2005 15:41:46 -0000 1.5 *************** *** 30,34 **** using namespace wxDevCenter; ! IMPLEMENT_DYNAMIC_CLASS(wxDevCenter::Project, wxObject); /** --- 30,34 ---- using namespace wxDevCenter; ! IMPLEMENT_DYNAMIC_CLASS(wxDevCenter::Project, wxEvtHandler); /** *************** *** 36,40 **** */ Project::Project(): ! ManagedObject(), m_strName(""), m_strPath(""), --- 36,41 ---- */ Project::Project(): ! wxEvtHandler(), ! InitializableInterface(), m_strName(""), m_strPath(""), Index: Document.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Document.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Document.cpp 12 Apr 2005 12:12:01 -0000 1.9 --- Document.cpp 15 Apr 2005 15:41:37 -0000 1.10 *************** *** 39,43 **** Document::Document(void): wxEvtHandler(), ! m_bIsDocumentModified(false) { } --- 39,48 ---- Document::Document(void): wxEvtHandler(), ! m_pDocumentManager(NULL), ! m_pDocumentTemplate(NULL), ! m_pProject(NULL), ! m_bIsDocumentModified(false), ! m_strName(wxT("")), ! m_strPath(wxT("")) { } *************** *** 237,240 **** --- 242,290 ---- + /** + * Fonctions virtuelles de liaison du document à un projet. + */ + + // Prétraitement avant attachement à un projet. + bool Document::CanAttachToProject(Project* WXUNUSED(pProject)) + { + return true; + } + + // Fonction d'attachement à un projet. + bool Document::OnAttachToProject(Project* WXUNUSED(pProject), FilePath pathNew) + { + if(pathNew.IsEmpty()) + SetDocumentPath(pathNew); + return true; + } + + // Teste si un document peu être détaché d'un document. + bool Document::CanDetachFromProject(Project* WXUNUSED(pProject)) + { + return true; + } + + // Fonction de détachement d'un projet. + bool Document::OnDetachFromProject(FilePath pathNew) + { + if(pathNew.IsEmpty()) + SetDocumentPath(pathNew); + return true; + } + + + /** + * Interception et redirection des évènements. + */ + // Surcharge de l'exéction des évènements pour les passer au projet s'il existe. + bool Document::ProcesEvent(wxEvent& event) + { + if(m_pProject!=NULL) + if(m_pProject->ProcessEvent(event)) + return true; + return wxEvtHandler::ProcessEvent(event); + } + ////////////////////////////////////////////////////////////////////// |