r571: no message
[ctsim.git] / src / docs.cpp
index 93c5f1ea8d60954ccc54d007d644d842dd58e81b..460082a63ae8f3a14f1e30a1beccb1c322e21352 100644 (file)
@@ -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
 // #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)
 {