** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: views.cpp,v 1.161 2002/06/06 22:50:24 kevin Exp $
+** $Id: views.cpp,v 1.166 2003/01/29 07:11:17 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
if (m_pView)
m_pView->OnUpdate (NULL);
} else
- wxScrolledWindow::OnChar (event);
+ event.Skip();
}
wxSize
END_EVENT_TABLE()
ImageFileView::ImageFileView()
-: wxView(), m_pFrame(0), m_pCanvas(0), m_pFileMenu(0), m_pFilterMenu(0),
- m_bMinSpecified(false), m_bMaxSpecified(false),
- m_iDefaultExportFormatID(ImageFile::EXPORT_FORMAT_PNG)
+ : wxView(), m_pBitmap(0), m_pFrame(0), m_pCanvas(0), m_pFileMenu(0),
+ m_pFilterMenu(0), m_bMinSpecified(false), m_bMaxSpecified(false),
+ m_iDefaultExportFormatID(ImageFile::EXPORT_FORMAT_PNG)
{}
ImageFileView::~ImageFileView()
m_pFileMenu->Append(wxID_PREVIEW, "Print Preview");
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
-#ifdef CTSIM_MDI
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
m_pFileMenu->Append(MAINMENU_FILE_EXIT, "E&xit");
-#endif
GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu);
GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);
void
ImageFileView::OnDraw (wxDC* dc)
{
- if (m_bitmap.Ok())
- dc->DrawBitmap(m_bitmap, 0, 0, false);
+ if (m_pBitmap && m_pBitmap->Ok()) {
+ *theApp->getLog() << "Drawing bitmap";
+ dc->DrawBitmap(*m_pBitmap, 0, 0, false);
+ }
int xCursor, yCursor;
if (m_pCanvas->GetCurrentCursor (xCursor, yCursor))
}
}
wxImage image (nx, ny, imageData, true);
- m_bitmap = image.ConvertToBitmap();
+ if (m_pBitmap) {
+ delete m_pBitmap;
+ m_pBitmap = NULL;
+ }
+ *theApp->getLog() << "Making new bitmap bitmap";
+ m_pBitmap = new wxBitmap (image);
delete imageData;
m_pCanvas->SetScrollbars(20, 20, nx/20, ny/20);
m_pCanvas->SetBackgroundColour(*wxWHITE);
ImageFileView::OnEditCopy (wxCommandEvent& event)
{
wxBitmapDataObject *pBitmapObject = new wxBitmapDataObject;
-
- pBitmapObject->SetBitmap (m_bitmap);
+
+ if (m_pBitmap)
+ pBitmapObject->SetBitmap (*m_pBitmap);
if (wxTheClipboard->Open()) {
wxTheClipboard->SetData (pBitmapObject);
bool bMonochrome = false;
if (bitmap.Ok() == true && bitmap.GetWidth() == nx && bitmap.GetHeight() == ny) {
- wxImage image (bitmap);
+ wxImage image (bitmap.ConvertToImage());
double dScale3 = 3 * 255;
unsigned char* pixels = image.GetData();
ImageFileArray v = rIF.getArray();
m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
-#ifdef CTSIM_MDI
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
m_pFileMenu->Append(MAINMENU_FILE_EXIT, "E&xit");
-#endif
GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu);
GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);
ProjectionFileView::ProjectionFileView()
-: wxView(), m_pFrame(0), m_pCanvas(0), m_pFileMenu(0)
+ : wxView(), m_pBitmap(0), m_pFrame(0), m_pCanvas(0), m_pFileMenu(0)
{
#ifdef DEBUG
m_iDefaultNX = 115;
m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
-#ifdef CTSIM_MDI
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
m_pFileMenu->Append(MAINMENU_FILE_EXIT, "E&xit");
-#endif
GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu);
GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);
void
ProjectionFileView::OnDraw (wxDC* dc)
{
- if (m_bitmap.Ok())
- dc->DrawBitmap (m_bitmap, 0, 0, false);
+ if (m_pBitmap && m_pBitmap->Ok())
+ dc->DrawBitmap (*m_pBitmap, 0, 0, false);
}
}
}
wxImage image (nDet, nView, imageData, true);
- m_bitmap = image.ConvertToBitmap();
+ if (m_pBitmap) {
+ delete m_pBitmap;
+ m_pBitmap = NULL;
+ }
+ m_pBitmap = new wxBitmap (image);
delete imageData;
}
m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
-#ifdef CTSIM_MDI
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
m_pFileMenu->Append(MAINMENU_FILE_EXIT, "E&xit");
-#endif
GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu);
GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);
m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append(MAINMENU_IMPORT, "&Import...\tCtrl-M");
-#ifdef CTSIM_MDI
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
m_pFileMenu->Append(MAINMENU_FILE_EXIT, "E&xit");
-#endif
GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu);
GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu);