r632: Added Clipboard functions to image files
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 11 Mar 2001 17:55:29 +0000 (17:55 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 11 Mar 2001 17:55:29 +0000 (17:55 +0000)
ChangeLog
NEWS
libctsim/projections.cpp
msvc/ctsim/ctsim.plg
src/backgroundmgr.cpp
src/ctsim.h
src/dialogs.cpp
src/docs.cpp
src/docs.h
src/views.cpp
src/views.h

index 566e6a1917aaaff40de103dc98db2a7866726d0c..7d4a93f5880b63cfb7598ec7768a3d77fe99b954 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,4 @@
-3.5.0 - Released 2//01
+3.5.0 - Released 3//01
 
        * ctsim: Added tips to be displayed at startup and via the help menu.
 
@@ -7,6 +7,9 @@
        projection files are not incompatible with previous version of
        CTSim.
        
+       * ctsim: Added background and SMP processing for reconstructions, 
+       scanning, and rasterization. 
+
        * ctsim: Added generic threaded tasks and background manager for 
        background processing as well as taking advantage of multiple-CPU's 
        on SMP systems.
 
        * ctsim: Added imagefile export to DICOM files.
 
-       * ctsim: Added plot t-theta sampling to projection file menu.
+       * ctsim: Added clipboard cut/copy/paste for image files.
        
-       * ctsim: Added background and SMP processing for reconstructions. 
-
-       * ctsim: Added background and SMP processing for scanning.
-
-       * ctsim: Added background and SMP processing for rasterization.
+       * ctsim: Added plot t-theta sampling to projection file menu.
        
-       * ctsim: Added region of interest to reconstruction dialog.
+       * ctsim: Added region of interest to reconstructions.
 
        * ctsim: Added "Verbose Logging", "Startup Tips", and
        "Background processes" options  to Preferences dialog.
@@ -34,6 +33,8 @@
 
        * ctsim: Added accelerator key for File-Properties
 
+       * sgp.cpp/ezplot.cpp: Improved plotting with markers.
+       
        * views.cpp: Added out of memory checks to display for huge
        image and projection files.
 
diff --git a/NEWS b/NEWS
index b2837f0cc79ca66e5c3444dad00b3c56dc5fb665..a4a4c475181f4f79c3c40d6d181c8e1479b9b36e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,13 +4,20 @@ Version 3.5 New Features
   takes advantage of multiple-CPU's in SMP systems for speed improvements
   with parallel processing.
 
+* Interpolate divergent beams to parallel beams for faster reconstructions.
+
+* Region of interest can be specified for reconstruction zooming.
+
 * Import PNG, PPM, and PGM images
 
 * DICOM file import/export
 
+* Clipboard for cutting and pasting images
+
 * Can read and reconstruct SIEMENS AR.STAR DICOM raw data files
 
-* Scattergram of T-Theta sampling.
+* Scattergram of T-Theta sampling. Useful for understand divergent beam
+  scanning.
 
 * Added startup-tips to help new users learn features.
 
index dc7248e62b9f3e42c86561612e99233c1bd6c245..27d5b69ffa7516d5435ce0406068b61fd94bbeea 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: projections.cpp,v 1.59 2001/03/11 15:27:30 kevin Exp $
+**  $Id: projections.cpp,v 1.60 2001/03/11 17:55:29 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
@@ -688,17 +688,16 @@ Projections::convertPolar (ImageFile& rIF, int iInterpolationID)
   if (! v || nx == 0 || ny == 0)
     return false;
 
-  if (m_geometry != Scanner::GEOMETRY_PARALLEL) {
-    sys_error (ERR_WARNING, "convertPolar supports Parallel only");
-    return false;
-  }
+  Projections* pProj = this;
+  if (m_geometry == Scanner::GEOMETRY_EQUIANGULAR || m_geometry == Scanner::GEOMETRY_EQUILINEAR)
+    pProj = interpolateToParallel();
   
   Array2d<double> adView (nx, ny);
   Array2d<double> adDet (nx, ny);
   double** ppdView = adView.getArray();
   double** ppdDet = adDet.getArray();
 
-  if (! calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet)) 
+  if (! pProj->calcArrayPolarCoordinates (nx, ny, ppdView, ppdDet)) 
     return false;
 
   std::complex<double>** ppcDetValue = new std::complex<double>* [m_nView];
@@ -709,12 +708,15 @@ Projections::convertPolar (ImageFile& rIF, int iInterpolationID)
       ppcDetValue[iView][iDet] = std::complex<double>(getDetectorArray (iView).detValues()[iDet], 0);
   }
 
-  interpolatePolar (v, vImag, nx, ny, ppcDetValue, ppdView, ppdDet, m_nView, m_nDet, iInterpolationID);
+  pProj->interpolatePolar (v, vImag, nx, ny, ppcDetValue, ppdView, ppdDet, m_nView, m_nDet, iInterpolationID);
 
   for (iView = 0; iView < m_nView; iView++)
     delete [] ppcDetValue[iView];
   delete [] ppcDetValue;
 
+  if (m_geometry == Scanner::GEOMETRY_EQUIANGULAR || m_geometry == Scanner::GEOMETRY_EQUILINEAR)
+    delete pProj;
+
   return true;
 }
 
index 21230c3c30c2d6b139e8ce8feaa77435a6056b23..34c4d9df4a6f25fe9875c193207bc08e2b40ef54 100644 (file)
@@ -3,63 +3,16 @@
 <pre>
 <h1>Build Log</h1>
 <h3>
---------------------Configuration: libctsim - Win32 Debug--------------------
+--------------------Configuration: ctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP461.tmp" with contents
-[
-/nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "..\..\..\wx2.2.5\src\png" /I "..\..\..\wx2.2.5\src\zlib" /I "..\..\INCLUDE" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /I "..\..\..\wx2.2.5\include" /I "\dicom\ctn\include" /D "_DEBUG" /D "HAVE_WXWIN" /D "HAVE_STRING_H" /D "HAVE_GETOPT_H" /D "WIN32" /D "_MBCS" /D "_LIB" /D "MSVC" /D "HAVE_FFTW" /D "HAVE_PNG" /D "HAVE_SGP" /D "HAVE_WXWINDOWS" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "HAVE_CTN_DICOM" /D VERSION=\"3.1.0\" /FR"Debug/" /Fp"Debug/libctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 
-"C:\ctsim\libctgraphics\ezplot.cpp"
-"C:\ctsim\libctsim\projections.cpp"
-]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP461.tmp" 
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP462.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP4EA.tmp" with contents
 [
-/nologo /out:"Debug\libctsim.lib" 
-.\Debug\array2dfile.obj
-.\Debug\backprojectors.obj
-.\Debug\clip.obj
-.\Debug\consoleio.obj
-.\Debug\ctndicom.obj
-.\Debug\dlgezplot.obj
-.\Debug\ezplot.obj
-.\Debug\ezset.obj
-.\Debug\ezsupport.obj
-.\Debug\filter.obj
-.\Debug\fnetorderstream.obj
-.\Debug\fourier.obj
-.\Debug\getopt.obj
-.\Debug\getopt1.obj
-.\Debug\globalvars.obj
-.\Debug\hashtable.obj
-.\Debug\imagefile.obj
-.\Debug\interpolator.obj
-.\Debug\mathfuncs.obj
-.\Debug\phantom.obj
-.\Debug\plotfile.obj
-.\Debug\pol.obj
-.\Debug\procsignal.obj
-.\Debug\projections.obj
-.\Debug\reconstruct.obj
-.\Debug\scanner.obj
-.\Debug\sgp.obj
-.\Debug\strfuncs.obj
-.\Debug\syserror.obj
-.\Debug\trace.obj
-.\Debug\transformmatrix.obj
-.\Debug\xform.obj
+/nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "\wx2.2.5\include" /I "..\..\..\fftw-2.1.3\fftw" /I "\wx2.2.5\src\png" /I "\wx2.2.5\src\zlib" /I "..\..\include" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\rfftw" /I "\dicom\ctn\include" /D VERSION=\"3.0.0beta1\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"3.1.0\" /D "HAVE_CTN_DICOM" /D CTSIMVERSION=\"3.0.0alpha5\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 
+"C:\ctsim\src\views.cpp"
 ]
-Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP462.tmp"
-<h3>Output Window</h3>
-Compiling...
-ezplot.cpp
-projections.cpp
-Creating library...
-<h3>
---------------------Configuration: ctsim - Win32 Debug--------------------
-</h3>
-<h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP463.tmp" with contents
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP4EA.tmp" 
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP4EB.tmp" with contents
 [
 winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib wxd.lib xpmd.lib tiffd.lib zlibd.lib pngd.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib htmlhelp.lib ctn_lib.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"\wx2.2.5\lib" /libpath:"\dicom\ctn\winctn\ctn_lib\Debug" 
 .\Debug\backgroundmgr.obj
@@ -86,8 +39,10 @@ winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..
 \wx2.2.5\lib\zlibd.lib
 \wx2.2.5\lib\tiffd.lib
 ]
-Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP463.tmp"
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP4EB.tmp"
 <h3>Output Window</h3>
+Compiling...
+views.cpp
 Linking...
 
 
index 58bd9029a428f1acd6684d6b419b09039a26b341..55e611b766560c452c18ba86b1ba6024135f1870 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2001 Kevin Rosenberg
 **
-**  $Id: backgroundmgr.cpp,v 1.17 2001/03/11 12:37:34 kevin Exp $
+**  $Id: backgroundmgr.cpp,v 1.18 2001/03/11 17:55:29 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
@@ -151,8 +151,8 @@ BackgroundManager::OnAddTask (wxCommandEvent& event)
 
   resizeWindow();
   if (m_iNumTasks == 1) {
+    m_pCanvas->SetFocus();
     Show(true);  
-       theApp->getLog()->SetFocus();
   }
 }
 
index 9ca514c855a298103492e261e826429bcc0a498d..ef100ad474a3ba13b1fdc8404b5ed2f90fa21389 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: ctsim.h,v 1.57 2001/03/11 06:34:37 kevin Exp $
+**  $Id: ctsim.h,v 1.58 2001/03/11 17:55:29 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
@@ -315,7 +315,11 @@ enum {
     
     IFMENU_FILE_EXPORT,
     IFMENU_FILE_PROPERTIES,
-    
+
+    IFMENU_EDIT_COPY,
+    IFMENU_EDIT_CUT,
+    IFMENU_EDIT_PASTE,
+
     IFMENU_PLOT_ROW,
     IFMENU_PLOT_COL,
     IFMENU_PLOT_FFT_ROW,
index b4811ed1faeb74aff28170b42c981a63f9df90e4..57dc3f73a42d8ec1db7407e83cfbcef7b3ef1dac 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: dialogs.cpp,v 1.50 2001/03/11 15:27:30 kevin Exp $
+**  $Id: dialogs.cpp,v 1.51 2001/03/11 17:55:29 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
@@ -392,7 +392,7 @@ DialogAutoScaleParameters::DialogAutoScaleParameters (wxWindow *pParent, double
   
   pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
   
-  wxString asTitle[] = {"Median", "Mode", "Mean"};
+  wxString asTitle[] = {"Mode", "Median", "Mean"};
   
   m_pRadioBoxCenter = new wxRadioBox (this, -1, _T("Center"), wxDefaultPosition, wxDefaultSize, 3, asTitle, 1, wxRA_SPECIFY_COLS);
   m_pRadioBoxCenter->SetSelection (0);
@@ -429,11 +429,11 @@ bool
 DialogAutoScaleParameters::getMinMax (double* pMin, double* pMax)
 {
   int iCenter = m_pRadioBoxCenter->GetSelection();
-  double dCenter = m_dMedian;
+  double dCenter = m_dMode;
   if (iCenter == 1)
-    dCenter = m_dMode;
+    dCenter = m_dMedian;
   else if (iCenter == 2)
-    dCenter = m_dMode;
+    dCenter = m_dMean;
   
   wxString sStddevFactor = m_pTextCtrlStdDevFactor->GetValue();
   double dValue;
index bd4e404416579ccc1cf924b4d3150ca16b8f6979..aa70dbfb4bb72c563fd38cdb5019ff8e0f557857 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: docs.cpp,v 1.33 2001/03/05 17:26:46 kevin Exp $
+**  $Id: docs.cpp,v 1.34 2001/03/11 17:55:29 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
@@ -104,6 +104,13 @@ ImageFileDocument::getView() const
   return dynamic_cast<ImageFileView*>(GetFirstView()); 
 }
 
+void
+ImageFileDocument::Activate()
+{
+#if CTSIM_MDI
+  getView()->getFrame()->Activate();
+#endif
+};
 
 bool
 ImageFileDocument::Revert ()
index 7c41956b7dc2a8c312bdb821171fd69f6a51df5d..ab2902672079792c935c632980b6279f0f080101 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: docs.h,v 1.28 2001/03/05 17:26:46 kevin Exp $
+**  $Id: docs.h,v 1.29 2001/03/11 17:55:29 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
@@ -84,6 +84,7 @@ public:
     ImageFileView* getView() const;
     bool getBadFileOpen() const { return m_bBadFileOpen; }
     void setBadFileOpen() { m_bBadFileOpen = true; }
+    void Activate();
 };
 
 class BackgroundProcessingDocument : public wxDocument
index c9689bfab866a05e6b81b901f2d697b0198d2a07..41e4367fe44b675239a522f329577619f8674e76 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.133 2001/03/11 15:27:30 kevin Exp $
+**  $Id: views.cpp,v 1.134 2001/03/11 17:55:29 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
@@ -36,6 +36,7 @@
 
 #include "wx/image.h"
 #include "wx/progdlg.h"
+#include "wx/clipbrd.h"
 
 #include "ct.h"
 #include "ctsim.h"
@@ -204,6 +205,9 @@ IMPLEMENT_DYNAMIC_CLASS(ImageFileView, wxView)
 BEGIN_EVENT_TABLE(ImageFileView, wxView)
 EVT_MENU(IFMENU_FILE_EXPORT, ImageFileView::OnExport)
 EVT_MENU(IFMENU_FILE_PROPERTIES, ImageFileView::OnProperties)
+EVT_MENU(IFMENU_EDIT_COPY, ImageFileView::OnEditCopy)
+EVT_MENU(IFMENU_EDIT_CUT, ImageFileView::OnEditCut)
+EVT_MENU(IFMENU_EDIT_PASTE, ImageFileView::OnEditPaste)
 EVT_MENU(IFMENU_VIEW_SCALE_MINMAX, ImageFileView::OnScaleMinMax)
 EVT_MENU(IFMENU_VIEW_SCALE_AUTO, ImageFileView::OnScaleAuto)
 EVT_MENU(IFMENU_VIEW_SCALE_FULL, ImageFileView::OnScaleFull)
@@ -289,6 +293,7 @@ ImageFileView::OnProperties (wxCommandEvent& event)
     wxMessageDialog dialogMsg (getFrameForChild(), os.str().c_str(), "Imagefile Properties", wxOK | wxICON_INFORMATION);
     dialogMsg.ShowModal();
   }
+  GetDocument()->Activate();
 }
 
 void 
@@ -307,9 +312,10 @@ ImageFileView::OnScaleAuto (wxCommandEvent& event)
       m_dMinPixel = dMin;
       m_dMaxPixel = dMax;
       m_dAutoScaleFactor = dialogAutoScale.getAutoScaleFactor();
-      OnUpdate (this, NULL);
+      GetDocument()->UpdateAllViews (this);
     }
   }
+  GetDocument()->Activate();
 }
 
 void 
@@ -332,8 +338,9 @@ ImageFileView::OnScaleMinMax (wxCommandEvent& event)
     m_bMaxSpecified = true;
     m_dMinPixel = dialogMinMax.getMinimum();
     m_dMaxPixel = dialogMinMax.getMaximum();
-    OnUpdate (this, NULL);
+    GetDocument()->UpdateAllViews (this);
   }
+  GetDocument()->Activate();
 }
 
 void 
@@ -342,8 +349,9 @@ ImageFileView::OnScaleFull (wxCommandEvent& event)
   if (m_bMinSpecified || m_bMaxSpecified) {
     m_bMinSpecified = false;
     m_bMaxSpecified = false;
-    OnUpdate (this, NULL);
+    GetDocument()->UpdateAllViews (this);
   }
+  GetDocument()->Activate();
 }
 
 void
@@ -401,6 +409,7 @@ ImageFileView::OnCompare (wxCommandEvent& event)
         pDifferenceDoc->UpdateAllViews (this);
         pDifferenceDoc->getView()->OnUpdate (this, NULL);
         pDifferenceDoc->getView()->getFrame()->Show(true);
+        pDifferenceDoc->Activate();
       }
       wxMessageBox(os.str().c_str(), "Image Comparison");
     }
@@ -416,6 +425,7 @@ ImageFileView::OnInvertValues (wxCommandEvent& event)
   if (theApp->getAskDeleteNewDocs())
     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
+  GetDocument()->Activate();
 }
 
 void
@@ -427,6 +437,7 @@ ImageFileView::OnSquare (wxCommandEvent& event)
   if (theApp->getAskDeleteNewDocs())
     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
+  GetDocument()->Activate();
 }
 
 void
@@ -438,6 +449,7 @@ ImageFileView::OnSquareRoot (wxCommandEvent& event)
   if (theApp->getAskDeleteNewDocs())
     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
+  GetDocument()->Activate();
 }
 
 void
@@ -449,6 +461,7 @@ ImageFileView::OnLog (wxCommandEvent& event)
   if (theApp->getAskDeleteNewDocs())
     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
+  GetDocument()->Activate();
 }
 
 void
@@ -460,6 +473,7 @@ ImageFileView::OnExp (wxCommandEvent& event)
   if (theApp->getAskDeleteNewDocs())
     GetDocument()->Modify (true);
   GetDocument()->UpdateAllViews (this);
+  GetDocument()->Activate();
 }
 
 void
@@ -497,8 +511,8 @@ ImageFileView::OnAdd (wxCommandEvent& event)
       if (theApp->getAskDeleteNewDocs())
         pNewDoc->Modify (true);
       pNewDoc->UpdateAllViews (this);
-      pNewDoc->getView()->OnUpdate (this, NULL);
       pNewDoc->getView()->getFrame()->Show(true);
+      pNewDoc->Activate();
     }
   }
 }
@@ -538,8 +552,8 @@ ImageFileView::OnSubtract (wxCommandEvent& event)
       if (theApp->getAskDeleteNewDocs())
         pNewDoc->Modify (true);
       pNewDoc->UpdateAllViews (this);
-      pNewDoc->getView()->OnUpdate (this, NULL);
       pNewDoc->getView()->getFrame()->Show(true);
+      pNewDoc->Activate();
     }
   }
 }
@@ -579,8 +593,8 @@ ImageFileView::OnMultiply (wxCommandEvent& event)
       if (theApp->getAskDeleteNewDocs())
         pNewDoc->Modify (true);
       pNewDoc->UpdateAllViews (this);
-      pNewDoc->getView()->OnUpdate (this, NULL);
       pNewDoc->getView()->getFrame()->Show(true);
+      pNewDoc->Activate();
     }
   }
 }
@@ -620,8 +634,8 @@ ImageFileView::OnDivide (wxCommandEvent& event)
       if (theApp->getAskDeleteNewDocs())
         pNewDoc->Modify (true);
       pNewDoc->UpdateAllViews (this);
-      pNewDoc->getView()->OnUpdate (this, NULL);
       pNewDoc->getView()->getFrame()->Show(true);
+      pNewDoc->Activate();
     }
   }
 }
@@ -850,6 +864,11 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu);
   GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);
   
+  wxMenu* edit_menu = new wxMenu;
+  edit_menu->Append(IFMENU_EDIT_COPY, "Copy\tCtrl-C");
+  edit_menu->Append(IFMENU_EDIT_CUT, "Cut\tCtrl-X");
+  edit_menu->Append(IFMENU_EDIT_PASTE, "Paste\tCtrl-V");
+
   wxMenu *view_menu = new wxMenu;
   view_menu->Append(IFMENU_VIEW_SCALE_MINMAX, "Display Scale S&et...\tCtrl-E");
   view_menu->Append(IFMENU_VIEW_SCALE_AUTO, "Display Scale &Auto...\tCtrl-A");
@@ -918,6 +937,7 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   wxMenuBar *menu_bar = new wxMenuBar;
   
   menu_bar->Append(m_pFileMenu, "&File");
+  menu_bar->Append(edit_menu, "&Edit");
   menu_bar->Append(view_menu, "&View");
   menu_bar->Append(image_menu, "&Image");
   menu_bar->Append(filter_menu, "Fi&lter");
@@ -928,16 +948,19 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
   
   subframe->Centre(wxBOTH);
   
-  wxAcceleratorEntry accelEntries[5];
+  wxAcceleratorEntry accelEntries[8];
   accelEntries[0].Set (wxACCEL_CTRL, static_cast<int>('A'), IFMENU_VIEW_SCALE_AUTO);
   accelEntries[1].Set (wxACCEL_CTRL, static_cast<int>('U'), IFMENU_VIEW_SCALE_FULL);
   accelEntries[2].Set (wxACCEL_CTRL, static_cast<int>('E'), IFMENU_VIEW_SCALE_MINMAX);
   accelEntries[3].Set (wxACCEL_CTRL, static_cast<int>('I'), IFMENU_FILE_PROPERTIES);
+  accelEntries[4].Set (wxACCEL_CTRL, static_cast<int>('C'), IFMENU_EDIT_COPY);
+  accelEntries[5].Set (wxACCEL_CTRL, static_cast<int>('X'), IFMENU_EDIT_CUT);
+  accelEntries[6].Set (wxACCEL_CTRL, static_cast<int>('V'), IFMENU_EDIT_PASTE);
 #if wxUSE_GLCANVAS
-  accelEntries[4].Set (wxACCEL_CTRL, static_cast<int>('3'), IFMENU_IMAGE_CONVERT3D);
-  wxAcceleratorTable accelTable (5, accelEntries);
+  accelEntries[7].Set (wxACCEL_CTRL, static_cast<int>('3'), IFMENU_IMAGE_CONVERT3D);
+  wxAcceleratorTable accelTable (8, accelEntries);
 #else
-  wxAcceleratorTable accelTable (4, accelEntries);
+  wxAcceleratorTable accelTable (7, accelEntries);
 #endif
   
   subframe->SetAcceleratorTable (accelTable);
@@ -1062,6 +1085,72 @@ ImageFileView::OnClose (bool deleteWindow)
   return true;
 }
 
+void
+ImageFileView::OnEditCopy (wxCommandEvent& event)
+{
+  wxBitmapDataObject *pBitmapObject = new wxBitmapDataObject;
+
+  pBitmapObject->SetBitmap (m_bitmap);
+
+  if (wxTheClipboard->Open()) {
+    wxTheClipboard->SetData (pBitmapObject);
+    wxTheClipboard->Close();
+  }
+}
+
+void
+ImageFileView::OnEditCut (wxCommandEvent& event)
+{
+  OnEditCopy (event);
+  ImageFile& rIF = GetDocument()->getImageFile();
+  int nx = rIF.nx();
+  int ny = rIF.ny();
+  ImageFile* pIF = new ImageFile (nx, ny);
+  pIF->arrayDataClear();
+  GetDocument()->setImageFile (pIF); // deletes old IF
+  OnUpdate(this, NULL);
+  GetDocument()->UpdateAllViews();
+  if (theApp->getAskDeleteNewDocs())
+    GetDocument()->Modify (true);
+}
+
+void
+ImageFileView::OnEditPaste (wxCommandEvent& event)
+{
+  ImageFile& rIF = GetDocument()->getImageFile();
+
+  if (wxTheClipboard->Open()) {
+    wxBitmap bitmap;
+    if (wxTheClipboard->IsSupported (wxDF_BITMAP)) {
+      wxBitmapDataObject bitmapObject;
+      wxTheClipboard->GetData (bitmapObject);
+      bitmap = bitmapObject.GetBitmap ();
+    }
+    wxTheClipboard->Close();
+
+    int nx = rIF.nx();
+    int ny = rIF.ny();
+    if (bitmap.Ok() == true && bitmap.GetWidth() == nx && bitmap.GetHeight() == ny) {
+      wxImage image (bitmap);
+      unsigned char* pixels = image.GetData();
+      ImageFileArray v = rIF.getArray();
+      for (int ix = 0; ix < rIF.nx(); ix++) {
+        for (int iy = 0; iy < rIF.ny(); iy++) {
+          unsigned int iBase = 3 * (iy * nx + ix);
+          double dR = pixels[iBase] / 255.;
+          double dG = pixels[iBase+1] / 255.;
+          double dB = pixels[iBase+2] / 255.;
+          v[ix][ny - 1 - iy] = ImageFile::colorToGrayscale (dR, dG, dB);
+        }
+      }
+      OnUpdate(this, NULL);
+      GetDocument()->UpdateAllViews();
+      if (theApp->getAskDeleteNewDocs())
+        GetDocument()->Modify(true);
+    }
+  }
+}
+
 void
 ImageFileView::OnExport (wxCommandEvent& event)
 {
@@ -2340,6 +2429,7 @@ ProjectionFileView::OnConvertPolar (wxCommandEvent& event)
   DialogGetConvertPolarParameters dialogPolar (getFrameForChild(), "Convert Polar", m_iDefaultPolarNX, m_iDefaultPolarNY,
     m_iDefaultPolarInterpolation, -1);
   if (dialogPolar.ShowModal() == wxID_OK) {
+    wxProgressDialog dlgProgress (wxString("Convert Polar"), wxString("Conversion Progress"), 1, getFrameForChild(), wxPD_APP_MODAL);
     wxString strInterpolation (dialogPolar.getInterpolationName());
     m_iDefaultPolarNX = dialogPolar.getXSize();
     m_iDefaultPolarNY = dialogPolar.getYSize();
@@ -2381,6 +2471,7 @@ ProjectionFileView::OnConvertFFTPolar (wxCommandEvent& event)
   DialogGetConvertPolarParameters dialogPolar (getFrameForChild(), "Convert to FFT Polar", m_iDefaultPolarNX, m_iDefaultPolarNY,
     m_iDefaultPolarInterpolation, m_iDefaultPolarZeropad);
   if (dialogPolar.ShowModal() == wxID_OK) {
+    wxProgressDialog dlgProgress (wxString("Convert FFT Polar"), wxString("Conversion Progress"), 1, getFrameForChild(), wxPD_APP_MODAL);
     wxString strInterpolation (dialogPolar.getInterpolationName());
     m_iDefaultPolarNX = dialogPolar.getXSize();
     m_iDefaultPolarNY = dialogPolar.getYSize();
index 1946806bb878dc9fa22972dea056f6df582405f8..9aca9648cc4565f8a58cb96e4fe0777eeb284563 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: views.h,v 1.49 2001/03/11 06:34:37 kevin Exp $
+**  $Id: views.h,v 1.50 2001/03/11 17:55:29 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
@@ -91,6 +91,10 @@ public:
   void OnUpdate(wxView *sender, wxObject *hint = NULL);
   bool OnClose (bool deleteWindow = true);
   
+  void OnEditCopy (wxCommandEvent& event);
+  void OnEditCut (wxCommandEvent& event);
+  void OnEditPaste (wxCommandEvent& event);
+
   void OnRevert (wxCommandEvent& event);
   void OnExport (wxCommandEvent& event);  
   void OnProperties (wxCommandEvent& event);