** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: views.cpp,v 1.88 2001/01/29 23:11:32 kevin Exp $
+** $Id: views.cpp,v 1.90 2001/01/30 02:20:50 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
BEGIN_EVENT_TABLE(ImageFileCanvas, wxScrolledWindow)
EVT_MOUSE_EVENTS(ImageFileCanvas::OnMouseEvent)
+EVT_CHAR(ImageFileCanvas::OnChar)
END_EVENT_TABLE()
}
}
+void
+ImageFileCanvas::OnChar (wxKeyEvent& event)
+{
+ if (event.GetKeyCode() == WXK_ESCAPE) {
+ m_xCursor = -1;
+ m_yCursor = -1;
+ if (m_pView)
+ m_pView->OnUpdate (NULL);
+ } else
+ wxScrolledWindow::OnChar (event);
+}
+
wxSize
ImageFileCanvas::GetBestSize() const
{
bool
ImageFileView::OnClose (bool deleteWindow)
{
- GetDocumentManager()->ActivateView (this, false, true);
+ //GetDocumentManager()->ActivateView (this, false, true);
if (! GetDocument() || ! GetDocument()->Close())
return false;
if (m_pCanvas) {
- //m_pCanvas->Show(false);
m_pCanvas->setView(NULL);
m_pCanvas = NULL;
}
- //m_pFrame->Show(false);
wxString s(theApp->GetAppName());
if (m_pFrame)
m_pFrame->SetTitle(s);
Activate(false);
if (deleteWindow) {
- //delete m_pFrame;
m_pFrame->Destroy();
m_pFrame = NULL;
+ if (GetDocument() && GetDocument()->getBadFileOpen())
+ ::wxYield(); // wxWindows bug workaround
}
-
+
return true;
}
bool
PhantomFileView::OnClose (bool deleteWindow)
{
- GetDocumentManager()->ActivateView (this, false, true);
+ //GetDocumentManager()->ActivateView (this, false, true);
if (! GetDocument() || ! GetDocument()->Close())
return false;
if (m_pCanvas) {
- m_pCanvas->Show(false);
m_pCanvas->setView(NULL);
m_pCanvas = NULL;
}
- m_pFrame->Show(false);
wxString s(wxTheApp->GetAppName());
if (m_pFrame)
m_pFrame->SetTitle(s);
Activate(false);
if (deleteWindow) {
- //delete m_pFrame;
m_pFrame->Destroy();
m_pFrame = NULL;
+ if (GetDocument() && GetDocument()->getBadFileOpen())
+ ::wxYield(); // wxWindows bug workaround
}
-// ::wxYield();
return true;
}
bool
ProjectionFileView::OnClose (bool deleteWindow)
{
- GetDocumentManager()->ActivateView (this, false, true);
+ //GetDocumentManager()->ActivateView (this, false, true);
if (! GetDocument() || ! GetDocument()->Close())
return false;
if (m_pCanvas) {
- m_pCanvas->Show(false);
- m_pCanvas->setView(NULL);
+ m_pCanvas->setView(NULL);
m_pCanvas = NULL;
}
- m_pFrame->Show(false);
wxString s(wxTheApp->GetAppName());
if (m_pFrame)
m_pFrame->SetTitle(s);
Activate(false);
if (deleteWindow) {
-// delete m_pFrame;
m_pFrame->Destroy();
m_pFrame = NULL;
+ if (GetDocument() && GetDocument()->getBadFileOpen())
+ ::wxYield(); // wxWindows bug workaround
}
return true;
bool
PlotFileView::OnClose (bool deleteWindow)
{
- GetDocumentManager()->ActivateView (this, false, true);
+ //GetDocumentManager()->ActivateView (this, false, true);
if (! GetDocument() || ! GetDocument()->Close())
return false;
if (m_pCanvas) {
- //m_pCanvas->Show(false);
m_pCanvas->setView (NULL);
m_pCanvas = NULL;
}
- //m_pFrame->Show(false);
wxString s(wxTheApp->GetAppName());
if (m_pFrame)
m_pFrame->SetTitle(s);
Activate(false);
- m_pFrame->SetView(NULL);
SetFrame(NULL);
if (deleteWindow) {
- //delete m_pFrame;
m_pFrame->Destroy();
m_pFrame = NULL;
- }
+ if (GetDocument() && GetDocument()->getBadFileOpen())
+ ::wxYield(); // wxWindows bug workaround
+ }
return true;
}
// if (m_pFrame && m_pFrame->GetTitle() == "Log")
return false;
- GetDocumentManager()->ActivateView (this, false, true);
+ //GetDocumentManager()->ActivateView (this, false, true);
if (! GetDocument() || ! GetDocument()->Close())
return false;
- //m_pCanvas->Show(false);
- //m_pFrame->Show(false);
Activate(false);
SetFrame(NULL);
- m_pFrame->SetView(NULL);
if (deleteWindow) {
- //delete m_pFrame;
m_pFrame->Destroy();
m_pFrame = NULL;
-
+ if (GetDocument() && GetDocument()->getBadFileOpen())
+ ::wxYield(); // wxWindows bug workaround
}
return TRUE;