** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: backgroundmgr.cpp,v 1.8 2001/02/25 10:52:55 kevin Exp $
+** $Id: backgroundmgr.cpp,v 1.9 2001/03/04 03:14:47 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
wxPoint posGauge (m_sizeBorder.x, m_sizeBorder.y + iFirstUnusedPos * m_sizeCell.y);
wxPoint posLabel (m_sizeBorder.x + m_sizeGauge.x, m_sizeBorder.y + iFirstUnusedPos * m_sizeCell.y);
- wxPoint posButton (m_sizeBorder.x + m_sizeGauge.x + m_sizeLabel.x, m_sizeBorder.y + iFirstUnusedPos * m_sizeCell.y);
wxGauge* pGauge = new wxGauge (m_pCanvas, -1, iNumUnits, posGauge, m_sizeGauge);
wxStaticText* pLabel = new wxStaticText (m_pCanvas, -1, pszTaskName, posLabel, m_sizeLabel);
+ // wxPoint posButton (m_sizeBorder.x + m_sizeGauge.x + m_sizeLabel.x, m_sizeBorder.y + iFirstUnusedPos * m_sizeCell.y);
// wxButton* pCancelButton = new wxButton (m_pCanvas, iFirstUnusedPos, _T("Cancel"), posButton, m_sizeButton, wxBU_LEFT);
m_vecpBackgroundTasks.push_back (pTask);
// dc.DrawLine (0, 0, 30, 30);
// dc.DrawLine (30,0, 0, 30);
}
-#endif
\ No newline at end of file
+#endif
** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: backgroundsupr.cpp,v 1.10 2001/03/02 21:11:50 kevin Exp $
+** $Id: backgroundsupr.cpp,v 1.11 2001/03/04 03:14:47 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
wxEvtHandler()
{
m_iNumThreads = theApp->getNumberCPU();
- ++m_iNumThreads;
+ // ++m_iNumThreads;
m_vecpThreads.reserve (m_iNumThreads);
for (int iThread = 0; iThread < m_iNumThreads; iThread++)
** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: backgroundsupr.h,v 1.6 2001/03/02 21:11:50 kevin Exp $
+** $Id: backgroundsupr.h,v 1.7 2001/03/04 03:14:47 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
int iTotalUnits);
BackgroundSupervisor ()
- : m_iTotalUnits(0), wxEvtHandler()
+ : wxEvtHandler(), m_iTotalUnits(0)
{}
virtual ~BackgroundSupervisor();
class BackgroundWorkerThread : public wxThread {
protected:
BackgroundSupervisor* m_pSupervisor;
+ const int m_iThread;
const int m_iStartUnit;
const int m_iNumUnits;
- const int m_iThread;
public:
BackgroundWorkerThread (BackgroundSupervisor* pSupervisor, int iThread, int iStartUnit, int iNumUnits)
- : m_pSupervisor(pSupervisor), m_iThread(iThread), m_iStartUnit(iStartUnit), m_iNumUnits(iNumUnits),
- wxThread (wxTHREAD_DETACHED)
+ : wxThread (wxTHREAD_DETACHED), m_pSupervisor(pSupervisor), m_iThread(iThread), m_iStartUnit(iStartUnit), m_iNumUnits(iNumUnits)
{}
};
** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: ctsim.cpp,v 1.92 2001/03/02 21:11:50 kevin Exp $
+** $Id: ctsim.cpp,v 1.93 2001/03/04 03:14:47 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
#endif
#endif
-static const char* rcsindent = "$Id: ctsim.cpp,v 1.92 2001/03/02 21:11:50 kevin Exp $";
+static const char* rcsindent = "$Id: ctsim.cpp,v 1.93 2001/03/04 03:14:47 kevin Exp $";
struct option CTSimApp::ctsimOptions[] =
{
CTSimApp::CTSimApp()
: m_bAdvancedOptions(false), m_bSetModifyNewDocs(true), m_bVerboseLogging(false), m_bShowStartupTips(true),
m_iCurrentTip(0), m_bUseBackgroundTasks(false),
-m_docManager(NULL), m_pFrame(NULL), m_pLog(0), m_pLogDoc(0), m_pConfig(0)
+m_docManager(NULL), m_pFrame(NULL), m_pLog(0), m_pConfig(0), m_pLogDoc(0)
{
theApp = this;
}
EVT_MENU(MAINMENU_IMPORT, MainFrame::OnImport)
EVT_MENU(IDH_QUICKSTART, MainFrame::OnHelpButton)
EVT_MENU(MAINMENU_LOG_EVENT, MainFrame::OnLogEvent)
+EVT_MENU(NEW_IMAGEFILE_EVENT, MainFrame::OnNewImageFile)
+EVT_MENU(NEW_PROJECTIONFILE_EVENT, MainFrame::OnNewProjectionFile)
EVT_BUTTON(IDH_DLG_RASTERIZE, MainFrame::OnHelpButton)
EVT_BUTTON(IDH_DLG_PROJECTIONS, MainFrame::OnHelpButton)
EVT_BUTTON(IDH_DLG_RECONSTRUCTION, MainFrame::OnHelpButton)
}
+void
+MainFrame::OnNewImageFile (wxCommandEvent& event)
+{
+ ImageFile* pImageFile = reinterpret_cast<ImageFile*>(event.GetClientData());
+
+ ImageFileDocument* pImageDoc = theApp->newImageDoc();
+ if (! pImageDoc) {
+ sys_error (ERR_SEVERE, "Unable to create image file");
+ return;
+ }
+ pImageDoc->setImageFile (pImageFile);
+ pImageDoc->UpdateAllViews (NULL);
+ if (ImageFileView* imageView = pImageDoc->getView()) {
+ imageView->OnUpdate (imageView, NULL);
+ imageView->getFrame()->SetFocus();
+ imageView->getFrame()->Show(true);
+ }
+ if (theApp->getAskDeleteNewDocs())
+ pImageDoc->Modify (true);
+
+}
+
+void
+MainFrame::OnNewProjectionFile (wxCommandEvent& event)
+{
+ Projections* pProjections = reinterpret_cast<Projections*>(event.GetClientData());
+ ProjectionFileDocument* pProjDoc = theApp->newProjectionDoc();
+ if (! pProjDoc) {
+ sys_error (ERR_SEVERE, "Unable to create projection file");
+ return;
+ }
+ pProjDoc->setProjections (pProjections);
+ pProjDoc->UpdateAllViews (NULL);
+ if (ProjectionFileView* projView = pProjDoc->getView()) {
+ projView->OnUpdate (projView, NULL);
+ projView->getFrame()->SetFocus();
+ projView->getFrame()->Show(true);
+ }
+
+ if (theApp->getAskDeleteNewDocs())
+ pProjDoc->Modify (true);
+}
+
void
MainFrame::OnLogEvent (wxCommandEvent& event)
{
** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: ctsim.h,v 1.54 2001/03/02 21:11:50 kevin Exp $
+** $Id: ctsim.h,v 1.55 2001/03/04 03:14:47 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
#define HAVE_WXTHREADS 1
#else
#undef HAVE_WXTHREADS
+#define HAVE_WXTHREADS 1
#endif
#ifndef WX_PRECOMP
void OnCreatePhantom (wxCommandEvent& event);
void OnPreferences (wxCommandEvent& event);
void OnLogEvent (wxCommandEvent& event); // used by thread children
+ void OnNewImageFile (wxCommandEvent& event);
+ void OnNewProjectionFile (wxCommandEvent& event);
void OnHelpButton (wxCommandEvent& event);
void OnImport (wxCommandEvent& event);
MainFrame* m_pFrame;
wxConfig* m_pConfig;
wxTextCtrl* m_pLog;
+ TextFileDocument* m_pLogDoc;
wxDocTemplate* m_pDocTemplImage;
wxDocTemplate* m_pDocTemplProjection;
wxDocTemplate* m_pDocTemplPhantom;
#if wxUSE_GLCANVAS
wxDocTemplate* m_pDocTemplGraph3d;
#endif
-
- TextFileDocument* m_pLogDoc;
void usage (const char* program);
void openConfig();
GRAPH3D_VIEW_SCALE_FULL,
RECONSTRUCTION_THREAD_EVENT,
+ NEW_IMAGEFILE_EVENT,
+ NEW_PROJECTIONFILE_EVENT,
};
#endif
** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: graph3dview.cpp,v 1.15 2001/02/22 11:05:38 kevin Exp $
+** $Id: graph3dview.cpp,v 1.16 2001/03/04 03:14:47 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
Graph3dFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) )
{
m_pFrame = CreateChildFrame(doc, this);
- (m_pFrame);
int width, height;
m_pFrame->GetClientSize (&width, &height);
** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: threadproj.cpp,v 1.8 2001/03/02 21:32:34 kevin Exp $
+** $Id: threadproj.cpp,v 1.9 2001/03/04 03:14:47 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
wxCriticalSectionLocker critsect (doneSection);
Projections* pProjections = getProjections();
-
- if (! wxThread::IsMain())
- wxMutexGuiEnter();
- ProjectionFileDocument* pProjDoc = theApp->newProjectionDoc();
- if (! pProjDoc) {
- sys_error (ERR_SEVERE, "Unable to create projection file");
- return;
- }
- pProjDoc->setProjections (pProjections);
- pProjDoc->UpdateAllViews (NULL);
- if (ProjectionFileView* projView = pProjDoc->getView()) {
- projView->OnUpdate (projView, NULL);
- projView->getFrame()->SetFocus();
- projView->getFrame()->Show(true);
- }
- *theApp->getLog() << m_pszLabel << "\n";
- if (! wxThread::IsMain())
- wxMutexGuiLeave();
-
- if (theApp->getAskDeleteNewDocs())
- pProjDoc->Modify (true);
pProjections->setRemark (m_pszLabel);
pProjections->setCalcTime (getTimerEnd());
+ // *theApp->getLog() << m_pszLabel << "\n";
+ wxCommandEvent newProjEvent (wxEVT_COMMAND_MENU_SELECTED, NEW_PROJECTIONFILE_EVENT);
+ newImageEvent.SetClientData (pProjections);
+ wxPostEvent (theApp->getMainFrame(), newProjEvent);
+
setDone();
}
** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: threadraster.cpp,v 1.3 2001/03/02 21:32:34 kevin Exp $
+** $Id: threadraster.cpp,v 1.4 2001/03/04 03:14:47 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
RasterizerSupervisorThread::RasterizerSupervisorThread (PhantomFileView* pProjView, int iNX, int iNY,
int iNSample, double dViewRatio, const char* const pszLabel)
-: m_pPhantomView(pProjView), m_iNX(iNX), m_iNY(iNY), m_iNSample(iNSample), m_dViewRatio(dViewRatio), m_strLabel(pszLabel),
- SupervisorThread()
+: SupervisorThread(), m_pPhantomView(pProjView), m_iNX(iNX), m_iNY(iNY), m_iNSample(iNSample), m_dViewRatio(dViewRatio), m_strLabel(pszLabel)
{
}
wxCriticalSectionLocker critsect (doneSection);
ImageFile* pImageFile = getImageFile();
-
- if (! wxThread::IsMain())
- wxMutexGuiEnter();
- ImageFileDocument* pImageDoc = theApp->newImageDoc();
- if (! pImageDoc) {
- sys_error (ERR_SEVERE, "Unable to create image file");
- return;
- }
- pImageDoc->setImageFile (pImageFile);
- pImageDoc->UpdateAllViews (NULL);
- if (ImageFileView* imageView = pImageDoc->getView()) {
- imageView->OnUpdate (imageView, NULL);
- imageView->getFrame()->SetFocus();
- imageView->getFrame()->Show(true);
- }
- *theApp->getLog() << m_pszLabel << "\n";
- if (! wxThread::IsMain())
- wxMutexGuiLeave();
pImageFile->labelAdd (m_pszLabel, getTimerEnd());
- if (theApp->getAskDeleteNewDocs())
- pImageDoc->Modify (true);
+ // *theApp->getLog() << m_pszLabel << "\n";
+ wxCommandEvent newImageEvent (wxEVT_COMMAND_MENU_SELECTED, NEW_IMAGEFILE_EVENT);
+ newImageEvent.SetClientData (pImageFile);
+ wxPostEvent (theApp->getMainFrame(), newImageEvent);
+
setDone();
}
** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: threadraster.h,v 1.2 2001/03/02 21:11:50 kevin Exp $
+** $Id: threadraster.h,v 1.3 2001/03/04 03:14:47 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
class RasterizerSupervisor : public BackgroundSupervisor {
private:
+ PhantomFileView* m_pPhantomView;
std::vector<ImageFile*> m_vecpChildImageFiles;
PhantomFileDocument* m_pPhantomDoc;
- PhantomFileView* m_pPhantomView;
const int m_iNX;
const int m_iNY;
** This is part of the CTSim program
** Copyright (C) 1983-2001 Kevin Rosenberg
**
-** $Id: threadrecon.cpp,v 1.16 2001/03/02 21:32:34 kevin Exp $
+** $Id: threadrecon.cpp,v 1.17 2001/03/04 03:14:47 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
wxCriticalSectionLocker critsect (doneSection);
ImageFile* pImageFile = getImageFile();
-
- if (! wxThread::IsMain())
- wxMutexGuiEnter();
- ImageFileDocument* pReconDoc = theApp->newImageDoc();
- if (! pReconDoc) {
- sys_error (ERR_SEVERE, "Unable to create image file");
- return;
- }
- pReconDoc->setImageFile (pImageFile);
- pReconDoc->UpdateAllViews (m_pProjView);
- if (ImageFileView* rasterView = pReconDoc->getView()) {
- rasterView->OnUpdate (rasterView, NULL);
- rasterView->getFrame()->SetFocus();
- rasterView->getFrame()->Show(true);
- }
- *theApp->getLog() << m_pszLabel << "\n";
- if (! wxThread::IsMain())
- wxMutexGuiLeave();
-
- if (theApp->getAskDeleteNewDocs())
- pReconDoc->Modify (true);
pImageFile->labelAdd (m_pProjView->GetDocument()->getProjections().getLabel());
pImageFile->labelAdd (m_pszLabel, getTimerEnd());
+ // *theApp->getLog() << m_pszLabel << "\n";
+
+ wxCommandEvent newImageEvent (wxEVT_COMMAND_MENU_SELECTED, NEW_IMAGEFILE_EVENT);
+ newImageEvent.SetClientData (pImageFile);
+ wxPostEvent (theApp->getMainFrame(), newImageEvent);
setDone();
}