1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
/*
* TreeView
* A phylogenetic tree viewer.
* Copyright (C) 2001 Roderic D. M. Page <r.page@bio.gla.ac.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// $Id: tdoc.cpp,v 1.6 2001/07/25 10:37:06 rdmp1c Exp $
#ifdef __GNUG__
// #pragma implementation
#endif
#include "tdoc.h"
#include "tview.h"
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#if !wxUSE_DOC_VIEW_ARCHITECTURE
#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
#endif
IMPLEMENT_DYNAMIC_CLASS(TDocument, wxDocument)
TDocument::TDocument(void)
{
}
TDocument::~TDocument(void)
{
}
// Since text windows have their own method for saving to/loading from files,
// we override OnSave/OpenDocument instead of Save/LoadObject
bool TDocument::OnSaveDocument(const wxString& filename)
{
TView *view = (TView *)GetFirstView();
if (!view->WriteTrees (filename))
return FALSE;
Modify(FALSE);
return TRUE;
}
bool TDocument::OnOpenDocument(const wxString& filename)
{
TView *view = (TView *)GetFirstView();
if (!view->ReadTrees (filename))
return FALSE;
SetFilename(filename, TRUE);
Modify(FALSE);
UpdateAllViews();
view->Activate(TRUE); // Ensures TView::OnActivate is called
return TRUE;
}
|