/////////////////////////////////////////////////////////////////////////////
// Name:        doc.cc
// Purpose:     Implements document functionality
// Author:      Daniel Horak
// Modified by:
// RCS-ID:      $Id: doc.cc,v 1.2 2003/06/06 17:46:04 horakdan Exp $
// Copyright:   (c) Daniel Horak
// Licence:     GPL
/////////////////////////////////////////////////////////////////////////////

// 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
#include "wx/txtstrm.h"

#if !wxUSE_DOC_VIEW_ARCHITECTURE
#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
#endif

#if wxUSE_STD_IOSTREAM
#error You cannot use std C++ streams!
#endif

#include "doc.h"
#include "view.h"
#include "project.h"

IMPLEMENT_DYNAMIC_CLASS(DataDesignerDocument, wxDocument)

DataDesignerDocument::DataDesignerDocument(void)
{
#ifdef ENABLE_DEBUG
	wxLogMessage("DataDesignerDocument - constructor");
#endif
}

DataDesignerDocument::~DataDesignerDocument(void)
{
#ifdef ENABLE_DEBUG
	wxLogMessage("DataDesignerDocument - destructor");
#endif
}

wxOutputStream& DataDesignerDocument::SaveObject(wxOutputStream& stream)
{
	DataDesignerView	*view;
	
#ifdef ENABLE_DEBUG
	wxLogMessage("DataDesignerDocument::SaveObject");
#endif

	view = (DataDesignerView *)GetFirstView();
	if (view)
	{
		view->m_splitter->GetProject()->Save(stream);
	}
	
	return stream;
}

wxInputStream& DataDesignerDocument::LoadObject(wxInputStream& stream)
{
	DataDesignerView	*view;
	
#ifdef ENABLE_DEBUG
	wxLogMessage("DataDesignerDocument::LoadObject");
#endif
	
	view = (DataDesignerView *)GetFirstView();
	if (view)
	{
		view->m_splitter->GetProject()->Open(stream);
	}

	return stream;
}

/*
 * Implementation of datadesigner command
 */

DataDesignerCommand::DataDesignerCommand(const wxString& name, int command, DataDesignerDocument *doc):
  wxCommand(TRUE, name)
{
	m_doc = doc;
	m_cmd = command;
}

DataDesignerCommand::~DataDesignerCommand(void)
{
}

bool DataDesignerCommand::Do(void)
{
	switch (m_cmd)
	{
		default:
			wxLogMessage("Unknown command %d", m_cmd);
			break;
	}
	return TRUE;
}

bool DataDesignerCommand::Undo(void)
{
	switch (m_cmd)
	{
		default:
			wxLogMessage("Unknown command %d", m_cmd);
			break;
	}
	return TRUE;
}


syntax highlighted by Code2HTML, v. 0.9.1