X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fdocs.cpp;h=460082a63ae8f3a14f1e30a1beccb1c322e21352;hb=e081109a4a541c8780aaa253b874acada5957200;hp=93c5f1ea8d60954ccc54d007d644d842dd58e81b;hpb=f1303ea0f1188b0a89846c67b5783f596e7ba1b7;p=ctsim.git diff --git a/src/docs.cpp b/src/docs.cpp index 93c5f1e..460082a 100644 --- a/src/docs.cpp +++ b/src/docs.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: docs.cpp,v 1.24 2001/02/21 20:13:03 kevin Exp $ +** $Id: docs.cpp,v 1.25 2001/02/22 11:05:38 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -29,18 +29,14 @@ // #pragma implementation #endif -// For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "wx/txtstrm.h" #include "wx/file.h" +#include "wx/thread.h" #if !wxUSE_DOC_VIEW_ARCHITECTURE #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h! @@ -50,6 +46,8 @@ #include "ctsim.h" #include "docs.h" #include "views.h" +#include "threadrecon.h" + // ImageFileDocument @@ -145,6 +143,35 @@ ProjectionFileDocument::OnSaveDocument(const wxString& filename) return true; } +ProjectionFileDocument::~ProjectionFileDocument() +{ + for (int i = 0; i < m_vecpActiveReconstructors.size(); i++) { + ThreadedReconstructor* pThreadedReconstructor = m_vecpActiveReconstructors[i]; + if (pThreadedReconstructor) { + pThreadedReconstructor->cancel(); + } + } + + delete m_pProjectionFile; +} + +void +ProjectionFileDocument::addReconstructor (ThreadedReconstructor* pRecon) +{ + wxCriticalSectionLocker locker (m_criticalSection); + m_vecpActiveReconstructors.push_back (pRecon); +} + +void +ProjectionFileDocument::removeReconstructor (ThreadedReconstructor* pRecon) +{ + wxCriticalSectionLocker locker (m_criticalSection); + for (int i = 0; i < m_vecpActiveReconstructors.size(); i++) { + if (m_vecpActiveReconstructors[i] == pRecon) + m_vecpActiveReconstructors[i] = NULL; + } +} + bool ProjectionFileDocument::OnOpenDocument(const wxString& filename) {