1998-05-22 19:57:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: doc.h
|
|
|
|
// Purpose: Document classes
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 04/01/98
|
|
|
|
// RCS-ID: $Id$
|
2003-03-17 11:55:54 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
2002-03-17 14:16:03 +00:00
|
|
|
// Licence: wxWindows license
|
1998-05-22 19:57:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-04-06 13:57:23 +00:00
|
|
|
#ifndef __DOC_H__
|
|
|
|
#define __DOC_H__
|
1998-05-22 19:57:05 +00:00
|
|
|
|
|
|
|
#include "wx/docview.h"
|
2001-06-27 12:31:16 +00:00
|
|
|
#include "wx/cmdproc.h"
|
1998-05-22 19:57:05 +00:00
|
|
|
|
|
|
|
// Plots a line from one point to the other
|
2008-04-06 13:57:23 +00:00
|
|
|
class DoodleLine : public wxObject
|
1998-05-22 19:57:05 +00:00
|
|
|
{
|
2000-07-15 19:51:35 +00:00
|
|
|
public:
|
|
|
|
wxInt32 x1;
|
|
|
|
wxInt32 y1;
|
|
|
|
wxInt32 x2;
|
|
|
|
wxInt32 y2;
|
1998-05-22 19:57:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Contains a list of lines: represents a mouse-down doodle
|
2008-04-06 13:57:23 +00:00
|
|
|
class DoodleSegment : public wxObject
|
1998-05-22 19:57:05 +00:00
|
|
|
{
|
2000-07-15 19:51:35 +00:00
|
|
|
public:
|
2008-04-06 13:57:23 +00:00
|
|
|
wxList m_lines;
|
2004-10-06 20:32:05 +00:00
|
|
|
|
2008-04-06 13:57:23 +00:00
|
|
|
DoodleSegment() : wxObject() {}
|
2005-09-24 21:43:15 +00:00
|
|
|
DoodleSegment(const DoodleSegment& seg);
|
2008-04-06 13:57:23 +00:00
|
|
|
virtual ~DoodleSegment();
|
2004-10-06 20:32:05 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
void Draw(wxDC *dc);
|
1999-07-11 19:29:59 +00:00
|
|
|
#if wxUSE_STD_IOSTREAM
|
2001-06-06 16:51:53 +00:00
|
|
|
wxSTD ostream& SaveObject(wxSTD ostream& text_stream);
|
|
|
|
wxSTD istream& LoadObject(wxSTD istream& text_stream);
|
1999-07-11 19:29:59 +00:00
|
|
|
#else
|
2000-07-15 19:51:35 +00:00
|
|
|
wxOutputStream& SaveObject(wxOutputStream& stream);
|
|
|
|
wxInputStream& LoadObject(wxInputStream& stream);
|
1999-07-11 19:29:59 +00:00
|
|
|
#endif
|
2004-10-06 20:32:05 +00:00
|
|
|
|
1998-05-22 19:57:05 +00:00
|
|
|
};
|
|
|
|
|
2008-04-06 13:57:23 +00:00
|
|
|
class DrawingDocument : public wxDocument
|
1998-05-22 19:57:05 +00:00
|
|
|
{
|
2000-07-15 19:51:35 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(DrawingDocument)
|
|
|
|
private:
|
|
|
|
public:
|
2008-04-06 13:57:23 +00:00
|
|
|
wxList m_doodleSegments;
|
2004-10-06 20:32:05 +00:00
|
|
|
|
2008-04-06 13:57:23 +00:00
|
|
|
DrawingDocument() : wxDocument() {}
|
|
|
|
virtual ~DrawingDocument();
|
2004-10-06 20:32:05 +00:00
|
|
|
|
1999-07-11 19:29:59 +00:00
|
|
|
#if wxUSE_STD_IOSTREAM
|
2001-06-06 16:51:53 +00:00
|
|
|
wxSTD ostream& SaveObject(wxSTD ostream& text_stream);
|
|
|
|
wxSTD istream& LoadObject(wxSTD istream& text_stream);
|
1999-07-11 19:29:59 +00:00
|
|
|
#else
|
2000-07-15 19:51:35 +00:00
|
|
|
wxOutputStream& SaveObject(wxOutputStream& stream);
|
|
|
|
wxInputStream& LoadObject(wxInputStream& stream);
|
1999-07-11 19:29:59 +00:00
|
|
|
#endif
|
2004-10-06 20:32:05 +00:00
|
|
|
|
2008-04-06 13:57:23 +00:00
|
|
|
inline wxList& GetDoodleSegments() const { return (wxList&) m_doodleSegments; };
|
1998-05-22 19:57:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define DOODLE_CUT 1
|
|
|
|
#define DOODLE_ADD 2
|
|
|
|
|
2008-04-06 13:57:23 +00:00
|
|
|
class DrawingCommand : public wxCommand
|
1998-05-22 19:57:05 +00:00
|
|
|
{
|
2000-07-15 19:51:35 +00:00
|
|
|
protected:
|
2008-04-06 13:57:23 +00:00
|
|
|
DoodleSegment* m_segment;
|
|
|
|
DrawingDocument* m_doc;
|
|
|
|
int m_cmd;
|
2000-07-15 19:51:35 +00:00
|
|
|
public:
|
2008-04-06 13:57:23 +00:00
|
|
|
DrawingCommand(const wxString& name, int cmd, DrawingDocument*, DoodleSegment*);
|
|
|
|
virtual ~DrawingCommand();
|
2004-10-06 20:32:05 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
bool Do(void);
|
|
|
|
bool Undo(void);
|
1998-05-22 19:57:05 +00:00
|
|
|
};
|
|
|
|
|
2008-04-06 13:57:23 +00:00
|
|
|
class TextEditView;
|
|
|
|
class TextEditDocument : public wxDocument
|
1998-05-22 19:57:05 +00:00
|
|
|
{
|
2000-07-15 19:51:35 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(TextEditDocument)
|
|
|
|
public:
|
2008-04-06 13:57:23 +00:00
|
|
|
TextEditDocument() : wxDocument() {}
|
|
|
|
virtual ~TextEditDocument() {}
|
1998-05-22 19:57:05 +00:00
|
|
|
/*
|
2008-04-06 13:57:23 +00:00
|
|
|
wxSTD ostream& SaveObject(wxSTD ostream&);
|
|
|
|
wxSTD istream& LoadObject(wxSTD istream&);
|
|
|
|
*/
|
|
|
|
TextEditView* GetFirstView() const;
|
|
|
|
|
2008-08-21 08:49:42 +00:00
|
|
|
virtual bool DoSaveDocument(const wxString& filename);
|
|
|
|
virtual bool DoOpenDocument(const wxString& filename);
|
2000-07-15 19:51:35 +00:00
|
|
|
virtual bool IsModified(void) const;
|
|
|
|
virtual void Modify(bool mod);
|
1998-05-22 19:57:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|