X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fviews.cpp;h=2e0f78ab58480ada03cb6be7484eeff75a3d4c7c;hp=a2a30f40abd2590dd9fe78b0c5cee84b025a25c2;hb=cbcb02ba9b76a82c9a09ce1c7712431bb215575a;hpb=593439890a507e49b5a2a6fa4d463adca61d42c3 diff --git a/src/views.cpp b/src/views.cpp index a2a30f4..2e0f78a 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -9,7 +9,7 @@ ** 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 @@ -65,6 +65,7 @@ BEGIN_EVENT_TABLE(ImageFileCanvas, wxScrolledWindow) EVT_MOUSE_EVENTS(ImageFileCanvas::OnMouseEvent) +EVT_CHAR(ImageFileCanvas::OnChar) END_EVENT_TABLE() @@ -175,6 +176,18 @@ ImageFileCanvas::OnMouseEvent(wxMouseEvent& event) } } +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 { @@ -995,16 +1008,14 @@ ImageFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) ) 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); @@ -1013,11 +1024,12 @@ ImageFileView::OnClose (bool deleteWindow) Activate(false); if (deleteWindow) { - //delete m_pFrame; m_pFrame->Destroy(); m_pFrame = NULL; + if (GetDocument() && GetDocument()->getBadFileOpen()) + ::wxYield(); // wxWindows bug workaround } - + return true; } @@ -2060,16 +2072,14 @@ PhantomFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) ) 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); @@ -2078,11 +2088,11 @@ PhantomFileView::OnClose (bool deleteWindow) Activate(false); if (deleteWindow) { - //delete m_pFrame; m_pFrame->Destroy(); m_pFrame = NULL; + if (GetDocument() && GetDocument()->getBadFileOpen()) + ::wxYield(); // wxWindows bug workaround } -// ::wxYield(); return true; } @@ -2540,16 +2550,14 @@ ProjectionFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) 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); @@ -2558,9 +2566,10 @@ ProjectionFileView::OnClose (bool deleteWindow) Activate(false); if (deleteWindow) { -// delete m_pFrame; m_pFrame->Destroy(); m_pFrame = NULL; + if (GetDocument() && GetDocument()->getBadFileOpen()) + ::wxYield(); // wxWindows bug workaround } return true; @@ -2871,29 +2880,27 @@ PlotFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) ) 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; } @@ -2949,21 +2956,18 @@ TextFileView::OnClose (bool deleteWindow) // 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;